@tanstack/query-persist-client-core 5.94.4 → 5.94.5
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/build/legacy/_tsup-dts-rollup.d.cts +246 -0
- package/build/legacy/_tsup-dts-rollup.d.ts +246 -0
- package/build/legacy/createPersister.cjs +258 -0
- package/build/legacy/createPersister.cjs.map +1 -0
- package/build/legacy/createPersister.d.cts +6 -0
- package/build/legacy/createPersister.d.ts +6 -0
- package/build/legacy/createPersister.js +237 -0
- package/build/legacy/createPersister.js.map +1 -0
- package/build/legacy/index.cjs +29 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +19 -0
- package/build/legacy/index.d.ts +19 -0
- package/build/legacy/index.js +5 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/persist.cjs +117 -0
- package/build/legacy/persist.cjs.map +1 -0
- package/build/legacy/persist.d.cts +11 -0
- package/build/legacy/persist.d.ts +11 -0
- package/build/legacy/persist.js +89 -0
- package/build/legacy/persist.js.map +1 -0
- package/build/legacy/retryStrategies.cjs +47 -0
- package/build/legacy/retryStrategies.cjs.map +1 -0
- package/build/legacy/retryStrategies.d.cts +2 -0
- package/build/legacy/retryStrategies.d.ts +2 -0
- package/build/legacy/retryStrategies.js +22 -0
- package/build/legacy/retryStrategies.js.map +1 -0
- package/build/modern/_tsup-dts-rollup.d.cts +246 -0
- package/build/modern/_tsup-dts-rollup.d.ts +246 -0
- package/build/modern/createPersister.cjs +258 -0
- package/build/modern/createPersister.cjs.map +1 -0
- package/build/modern/createPersister.d.cts +6 -0
- package/build/modern/createPersister.d.ts +6 -0
- package/build/modern/createPersister.js +237 -0
- package/build/modern/createPersister.js.map +1 -0
- package/build/modern/index.cjs +29 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +19 -0
- package/build/modern/index.d.ts +19 -0
- package/build/modern/index.js +5 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/persist.cjs +117 -0
- package/build/modern/persist.cjs.map +1 -0
- package/build/modern/persist.d.cts +11 -0
- package/build/modern/persist.d.ts +11 -0
- package/build/modern/persist.js +89 -0
- package/build/modern/persist.js.map +1 -0
- package/build/modern/retryStrategies.cjs +47 -0
- package/build/modern/retryStrategies.cjs.map +1 -0
- package/build/modern/retryStrategies.d.cts +2 -0
- package/build/modern/retryStrategies.d.ts +2 -0
- package/build/modern/retryStrategies.js +22 -0
- package/build/modern/retryStrategies.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { DehydratedState } from '@tanstack/query-core';
|
|
2
|
+
import type { DehydrateOptions } from '@tanstack/query-core';
|
|
3
|
+
import type { HydrateOptions } from '@tanstack/query-core';
|
|
4
|
+
import { Options } from 'tsup';
|
|
5
|
+
import type { Query } from '@tanstack/query-core';
|
|
6
|
+
import type { QueryClient } from '@tanstack/query-core';
|
|
7
|
+
import type { QueryFilters } from '@tanstack/query-core';
|
|
8
|
+
import type { QueryFunctionContext } from '@tanstack/query-core';
|
|
9
|
+
import type { QueryKey } from '@tanstack/query-core';
|
|
10
|
+
import type { QueryState } from '@tanstack/query-core';
|
|
11
|
+
import { UserConfig } from 'vite';
|
|
12
|
+
|
|
13
|
+
declare interface AsyncStorage<TStorageValue = string> {
|
|
14
|
+
getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>;
|
|
15
|
+
setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>;
|
|
16
|
+
removeItem: (key: string) => MaybePromise<void>;
|
|
17
|
+
entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>;
|
|
18
|
+
}
|
|
19
|
+
export { AsyncStorage }
|
|
20
|
+
export { AsyncStorage as AsyncStorage_alias_1 }
|
|
21
|
+
|
|
22
|
+
export declare function createMockPersister(): Persister;
|
|
23
|
+
|
|
24
|
+
export declare function createSpyPersister(): Persister;
|
|
25
|
+
|
|
26
|
+
export declare const default_alias: any[];
|
|
27
|
+
|
|
28
|
+
export declare const default_alias_1: any[];
|
|
29
|
+
|
|
30
|
+
export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
|
31
|
+
|
|
32
|
+
export declare const default_alias_3: UserConfig;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Warning: experimental feature.
|
|
36
|
+
* This utility function enables fine-grained query persistence.
|
|
37
|
+
* Simple add it as a `persister` parameter to `useQuery` or `defaultOptions` on `queryClient`.
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
* useQuery({
|
|
41
|
+
queryKey: ['myKey'],
|
|
42
|
+
queryFn: fetcher,
|
|
43
|
+
persister: createPersister({
|
|
44
|
+
storage: localStorage,
|
|
45
|
+
}),
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
*/
|
|
49
|
+
declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters, }: StoragePersisterOptions<TStorageValue>): {
|
|
50
|
+
persisterFn: <T, TQueryKey extends QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>, ctx: QueryFunctionContext<TQueryKey>, query: Query) => Promise<T>;
|
|
51
|
+
persistQuery: (query: Query) => Promise<void>;
|
|
52
|
+
persistQueryByKey: (queryKey: QueryKey, queryClient: QueryClient) => Promise<void>;
|
|
53
|
+
retrieveQuery: <T>(queryHash: string, afterRestoreMacroTask?: (persistedQuery: PersistedQuery) => void) => Promise<T | undefined>;
|
|
54
|
+
persisterGc: () => Promise<void>;
|
|
55
|
+
restoreQueries: (queryClient: QueryClient, filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
56
|
+
removeQueries: (filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
export { experimental_createQueryPersister }
|
|
59
|
+
export { experimental_createQueryPersister as experimental_createQueryPersister_alias_1 }
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {Object} opts - Options for building configurations.
|
|
63
|
+
* @param {string[]} opts.entry - The entry array.
|
|
64
|
+
* @returns {import('tsup').Options}
|
|
65
|
+
*/
|
|
66
|
+
export declare function legacyConfig(opts: {
|
|
67
|
+
entry: string[];
|
|
68
|
+
}): Options;
|
|
69
|
+
|
|
70
|
+
declare type MaybePromise<T> = T | Promise<T>;
|
|
71
|
+
export { MaybePromise }
|
|
72
|
+
export { MaybePromise as MaybePromise_alias_1 }
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {Object} opts - Options for building configurations.
|
|
76
|
+
* @param {string[]} opts.entry - The entry array.
|
|
77
|
+
* @returns {import('tsup').Options}
|
|
78
|
+
*/
|
|
79
|
+
export declare function modernConfig(opts: {
|
|
80
|
+
entry: string[];
|
|
81
|
+
}): Options;
|
|
82
|
+
|
|
83
|
+
declare interface PersistedClient {
|
|
84
|
+
timestamp: number;
|
|
85
|
+
buster: string;
|
|
86
|
+
clientState: DehydratedState;
|
|
87
|
+
}
|
|
88
|
+
export { PersistedClient }
|
|
89
|
+
export { PersistedClient as PersistedClient_alias_1 }
|
|
90
|
+
|
|
91
|
+
declare interface PersistedQuery {
|
|
92
|
+
buster: string;
|
|
93
|
+
queryHash: string;
|
|
94
|
+
queryKey: QueryKey;
|
|
95
|
+
state: QueryState;
|
|
96
|
+
}
|
|
97
|
+
export { PersistedQuery }
|
|
98
|
+
export { PersistedQuery as PersistedQuery_alias_1 }
|
|
99
|
+
|
|
100
|
+
declare interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
101
|
+
/** The max-allowed age of the cache in milliseconds.
|
|
102
|
+
* If a persisted cache is found that is older than this
|
|
103
|
+
* time, it will be discarded */
|
|
104
|
+
maxAge?: number;
|
|
105
|
+
/** The options passed to the hydrate function */
|
|
106
|
+
hydrateOptions?: HydrateOptions;
|
|
107
|
+
}
|
|
108
|
+
export { PersistedQueryClientRestoreOptions }
|
|
109
|
+
export { PersistedQueryClientRestoreOptions as PersistedQueryClientRestoreOptions_alias_1 }
|
|
110
|
+
|
|
111
|
+
declare interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
112
|
+
/** The options passed to the dehydrate function */
|
|
113
|
+
dehydrateOptions?: DehydrateOptions;
|
|
114
|
+
}
|
|
115
|
+
export { PersistedQueryClientSaveOptions }
|
|
116
|
+
export { PersistedQueryClientSaveOptions as PersistedQueryClientSaveOptions_alias_1 }
|
|
117
|
+
|
|
118
|
+
declare interface Persister {
|
|
119
|
+
persistClient: (persistClient: PersistedClient) => Promisable<void>;
|
|
120
|
+
restoreClient: () => Promisable<PersistedClient | undefined>;
|
|
121
|
+
removeClient: () => Promisable<void>;
|
|
122
|
+
}
|
|
123
|
+
export { Persister }
|
|
124
|
+
export { Persister as Persister_alias_1 }
|
|
125
|
+
|
|
126
|
+
declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
127
|
+
export { PERSISTER_KEY_PREFIX }
|
|
128
|
+
export { PERSISTER_KEY_PREFIX as PERSISTER_KEY_PREFIX_alias_1 }
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Restores persisted data to QueryCache and persists further changes.
|
|
132
|
+
*/
|
|
133
|
+
declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
134
|
+
export { persistQueryClient }
|
|
135
|
+
export { persistQueryClient as persistQueryClient_alias_1 }
|
|
136
|
+
|
|
137
|
+
declare interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {
|
|
138
|
+
}
|
|
139
|
+
export { PersistQueryClientOptions }
|
|
140
|
+
export { PersistQueryClientOptions as PersistQueryClientOptions_alias_1 }
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Restores persisted data to the QueryCache
|
|
144
|
+
* - data obtained from persister.restoreClient
|
|
145
|
+
* - data is hydrated using hydrateOptions
|
|
146
|
+
* If data is expired, busted, empty, or throws, it runs persister.removeClient
|
|
147
|
+
*/
|
|
148
|
+
declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions, }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
149
|
+
export { persistQueryClientRestore }
|
|
150
|
+
export { persistQueryClientRestore as persistQueryClientRestore_alias_1 }
|
|
151
|
+
|
|
152
|
+
declare interface PersistQueryClientRootOptions {
|
|
153
|
+
/** The QueryClient to persist */
|
|
154
|
+
queryClient: QueryClient;
|
|
155
|
+
/** The Persister interface for storing and restoring the cache
|
|
156
|
+
* to/from a persisted location */
|
|
157
|
+
persister: Persister;
|
|
158
|
+
/** A unique string that can be used to forcefully
|
|
159
|
+
* invalidate existing caches if they do not share the same buster string */
|
|
160
|
+
buster?: string;
|
|
161
|
+
}
|
|
162
|
+
export { PersistQueryClientRootOptions }
|
|
163
|
+
export { PersistQueryClientRootOptions as PersistQueryClientRootOptions_alias_1 }
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Persists data from the QueryCache
|
|
167
|
+
* - data dehydrated using dehydrateOptions
|
|
168
|
+
* - data is persisted using persister.persistClient
|
|
169
|
+
*/
|
|
170
|
+
declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions, }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
171
|
+
export { persistQueryClientSave }
|
|
172
|
+
export { persistQueryClientSave as persistQueryClientSave_alias_1 }
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Subscribe to QueryCache and MutationCache updates (for persisting)
|
|
176
|
+
* @returns an unsubscribe function (to discontinue monitoring)
|
|
177
|
+
*/
|
|
178
|
+
declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
179
|
+
export { persistQueryClientSubscribe }
|
|
180
|
+
export { persistQueryClientSubscribe as persistQueryClientSubscribe_alias_1 }
|
|
181
|
+
|
|
182
|
+
declare type PersistRetryer = (props: {
|
|
183
|
+
persistedClient: PersistedClient;
|
|
184
|
+
error: Error;
|
|
185
|
+
errorCount: number;
|
|
186
|
+
}) => PersistedClient | undefined;
|
|
187
|
+
export { PersistRetryer }
|
|
188
|
+
export { PersistRetryer as PersistRetryer_alias_1 }
|
|
189
|
+
|
|
190
|
+
declare type Promisable<T> = T | PromiseLike<T>;
|
|
191
|
+
export { Promisable }
|
|
192
|
+
export { Promisable as Promisable_alias_1 }
|
|
193
|
+
|
|
194
|
+
declare const removeOldestQuery: PersistRetryer;
|
|
195
|
+
export { removeOldestQuery }
|
|
196
|
+
export { removeOldestQuery as removeOldestQuery_alias_1 }
|
|
197
|
+
|
|
198
|
+
declare interface StoragePersisterOptions<TStorageValue = string> {
|
|
199
|
+
/** The storage client used for setting and retrieving items from cache.
|
|
200
|
+
* For SSR pass in `undefined`.
|
|
201
|
+
*/
|
|
202
|
+
storage: AsyncStorage<TStorageValue> | undefined | null;
|
|
203
|
+
/**
|
|
204
|
+
* How to serialize the data to storage.
|
|
205
|
+
* @default `JSON.stringify`
|
|
206
|
+
*/
|
|
207
|
+
serialize?: (persistedQuery: PersistedQuery) => MaybePromise<TStorageValue>;
|
|
208
|
+
/**
|
|
209
|
+
* How to deserialize the data from storage.
|
|
210
|
+
* @default `JSON.parse`
|
|
211
|
+
*/
|
|
212
|
+
deserialize?: (cachedString: TStorageValue) => MaybePromise<PersistedQuery>;
|
|
213
|
+
/**
|
|
214
|
+
* A unique string that can be used to forcefully invalidate existing caches,
|
|
215
|
+
* if they do not share the same buster string
|
|
216
|
+
*/
|
|
217
|
+
buster?: string;
|
|
218
|
+
/**
|
|
219
|
+
* The max-allowed age of the cache in milliseconds.
|
|
220
|
+
* If a persisted cache is found that is older than this
|
|
221
|
+
* time, it will be discarded
|
|
222
|
+
* @default 24 hours
|
|
223
|
+
*/
|
|
224
|
+
maxAge?: number;
|
|
225
|
+
/**
|
|
226
|
+
* Prefix to be used for storage key.
|
|
227
|
+
* Storage key is a combination of prefix and query hash in a form of `prefix-queryHash`.
|
|
228
|
+
* @default 'tanstack-query'
|
|
229
|
+
*/
|
|
230
|
+
prefix?: string;
|
|
231
|
+
/**
|
|
232
|
+
* If set to `true`, the query will refetch on successful query restoration if the data is stale.
|
|
233
|
+
* If set to `false`, the query will not refetch on successful query restoration.
|
|
234
|
+
* If set to `'always'`, the query will always refetch on successful query restoration.
|
|
235
|
+
* Defaults to `true`.
|
|
236
|
+
*/
|
|
237
|
+
refetchOnRestore?: boolean | 'always';
|
|
238
|
+
/**
|
|
239
|
+
* Filters to narrow down which Queries should be persisted.
|
|
240
|
+
*/
|
|
241
|
+
filters?: QueryFilters;
|
|
242
|
+
}
|
|
243
|
+
export { StoragePersisterOptions }
|
|
244
|
+
export { StoragePersisterOptions as StoragePersisterOptions_alias_1 }
|
|
245
|
+
|
|
246
|
+
export { }
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/createPersister.ts
|
|
21
|
+
var createPersister_exports = {};
|
|
22
|
+
__export(createPersister_exports, {
|
|
23
|
+
PERSISTER_KEY_PREFIX: () => PERSISTER_KEY_PREFIX,
|
|
24
|
+
experimental_createQueryPersister: () => experimental_createQueryPersister
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(createPersister_exports);
|
|
27
|
+
var import_query_core = require("@tanstack/query-core");
|
|
28
|
+
var PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
29
|
+
function experimental_createQueryPersister({
|
|
30
|
+
storage,
|
|
31
|
+
buster = "",
|
|
32
|
+
maxAge = 1e3 * 60 * 60 * 24,
|
|
33
|
+
serialize = JSON.stringify,
|
|
34
|
+
deserialize = JSON.parse,
|
|
35
|
+
prefix = PERSISTER_KEY_PREFIX,
|
|
36
|
+
refetchOnRestore = true,
|
|
37
|
+
filters
|
|
38
|
+
}) {
|
|
39
|
+
function isExpiredOrBusted(persistedQuery) {
|
|
40
|
+
if (persistedQuery.state.dataUpdatedAt) {
|
|
41
|
+
const queryAge = Date.now() - persistedQuery.state.dataUpdatedAt;
|
|
42
|
+
const expired = queryAge > maxAge;
|
|
43
|
+
const busted = persistedQuery.buster !== buster;
|
|
44
|
+
if (expired || busted) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
async function retrieveQuery(queryHash, afterRestoreMacroTask) {
|
|
52
|
+
if (storage != null) {
|
|
53
|
+
const storageKey = `${prefix}-${queryHash}`;
|
|
54
|
+
try {
|
|
55
|
+
const storedData = await storage.getItem(storageKey);
|
|
56
|
+
if (storedData) {
|
|
57
|
+
let persistedQuery;
|
|
58
|
+
try {
|
|
59
|
+
persistedQuery = await deserialize(storedData);
|
|
60
|
+
} catch {
|
|
61
|
+
await storage.removeItem(storageKey);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
65
|
+
await storage.removeItem(storageKey);
|
|
66
|
+
} else {
|
|
67
|
+
if (afterRestoreMacroTask) {
|
|
68
|
+
import_query_core.notifyManager.schedule(
|
|
69
|
+
() => afterRestoreMacroTask(persistedQuery)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return persistedQuery.state.data;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
if (process.env.NODE_ENV === "development") {
|
|
77
|
+
console.error(err);
|
|
78
|
+
console.warn(
|
|
79
|
+
"Encountered an error attempting to restore query cache from persisted location."
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
await storage.removeItem(storageKey);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
async function persistQueryByKey(queryKey, queryClient) {
|
|
88
|
+
if (storage != null) {
|
|
89
|
+
const query = queryClient.getQueryCache().find({ queryKey });
|
|
90
|
+
if (query) {
|
|
91
|
+
await persistQuery(query);
|
|
92
|
+
} else {
|
|
93
|
+
if (process.env.NODE_ENV === "development") {
|
|
94
|
+
console.warn(
|
|
95
|
+
"Could not find query to be persisted. QueryKey:",
|
|
96
|
+
JSON.stringify(queryKey)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async function persistQuery(query) {
|
|
103
|
+
if (storage != null) {
|
|
104
|
+
const storageKey = `${prefix}-${query.queryHash}`;
|
|
105
|
+
storage.setItem(
|
|
106
|
+
storageKey,
|
|
107
|
+
await serialize({
|
|
108
|
+
state: query.state,
|
|
109
|
+
queryKey: query.queryKey,
|
|
110
|
+
queryHash: query.queryHash,
|
|
111
|
+
buster
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function persisterFn(queryFn, ctx, query) {
|
|
117
|
+
const matchesFilter = filters ? (0, import_query_core.matchQuery)(filters, query) : true;
|
|
118
|
+
if (matchesFilter && query.state.data === void 0 && storage != null) {
|
|
119
|
+
const restoredData = await retrieveQuery(
|
|
120
|
+
query.queryHash,
|
|
121
|
+
(persistedQuery) => {
|
|
122
|
+
query.setState({
|
|
123
|
+
dataUpdatedAt: persistedQuery.state.dataUpdatedAt,
|
|
124
|
+
errorUpdatedAt: persistedQuery.state.errorUpdatedAt
|
|
125
|
+
});
|
|
126
|
+
if (refetchOnRestore === "always" || refetchOnRestore === true && query.isStale()) {
|
|
127
|
+
query.fetch();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
if (restoredData !== void 0) {
|
|
132
|
+
return Promise.resolve(restoredData);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const queryFnResult = await queryFn(ctx);
|
|
136
|
+
if (matchesFilter && storage != null) {
|
|
137
|
+
import_query_core.notifyManager.schedule(() => {
|
|
138
|
+
persistQuery(query);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return Promise.resolve(queryFnResult);
|
|
142
|
+
}
|
|
143
|
+
async function persisterGc() {
|
|
144
|
+
if (storage?.entries) {
|
|
145
|
+
const storageKeyPrefix = `${prefix}-`;
|
|
146
|
+
const entries = await storage.entries();
|
|
147
|
+
for (const [key, value] of entries) {
|
|
148
|
+
if (key.startsWith(storageKeyPrefix)) {
|
|
149
|
+
let persistedQuery;
|
|
150
|
+
try {
|
|
151
|
+
persistedQuery = await deserialize(value);
|
|
152
|
+
} catch {
|
|
153
|
+
await storage.removeItem(key);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
157
|
+
await storage.removeItem(key);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} else if (process.env.NODE_ENV === "development") {
|
|
162
|
+
throw new Error(
|
|
163
|
+
"Provided storage does not implement `entries` method. Garbage collection is not possible without ability to iterate over storage items."
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function restoreQueries(queryClient, filters2 = {}) {
|
|
168
|
+
const { exact, queryKey } = filters2;
|
|
169
|
+
if (storage?.entries) {
|
|
170
|
+
const storageKeyPrefix = `${prefix}-`;
|
|
171
|
+
const entries = await storage.entries();
|
|
172
|
+
for (const [key, value] of entries) {
|
|
173
|
+
if (key.startsWith(storageKeyPrefix)) {
|
|
174
|
+
let persistedQuery;
|
|
175
|
+
try {
|
|
176
|
+
persistedQuery = await deserialize(value);
|
|
177
|
+
} catch {
|
|
178
|
+
await storage.removeItem(key);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (isExpiredOrBusted(persistedQuery)) {
|
|
182
|
+
await storage.removeItem(key);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (queryKey) {
|
|
186
|
+
if (exact) {
|
|
187
|
+
if (persistedQuery.queryHash !== (0, import_query_core.hashKey)(queryKey)) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
} else if (!(0, import_query_core.partialMatchKey)(persistedQuery.queryKey, queryKey)) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
queryClient.setQueryData(
|
|
195
|
+
persistedQuery.queryKey,
|
|
196
|
+
persistedQuery.state.data,
|
|
197
|
+
{
|
|
198
|
+
updatedAt: persistedQuery.state.dataUpdatedAt
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} else if (process.env.NODE_ENV === "development") {
|
|
204
|
+
throw new Error(
|
|
205
|
+
"Provided storage does not implement `entries` method. Restoration of all stored entries is not possible without ability to iterate over storage items."
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
async function removeQueries(filters2 = {}) {
|
|
210
|
+
const { exact, queryKey } = filters2;
|
|
211
|
+
if (storage?.entries) {
|
|
212
|
+
const entries = await storage.entries();
|
|
213
|
+
const storageKeyPrefix = `${prefix}-`;
|
|
214
|
+
for (const [key, value] of entries) {
|
|
215
|
+
if (key.startsWith(storageKeyPrefix)) {
|
|
216
|
+
if (!queryKey) {
|
|
217
|
+
await storage.removeItem(key);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
let persistedQuery;
|
|
221
|
+
try {
|
|
222
|
+
persistedQuery = await deserialize(value);
|
|
223
|
+
} catch {
|
|
224
|
+
await storage.removeItem(key);
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (exact) {
|
|
228
|
+
if (persistedQuery.queryHash !== (0, import_query_core.hashKey)(queryKey)) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
} else if (!(0, import_query_core.partialMatchKey)(persistedQuery.queryKey, queryKey)) {
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
await storage.removeItem(key);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
} else if (process.env.NODE_ENV === "development") {
|
|
238
|
+
throw new Error(
|
|
239
|
+
"Provided storage does not implement `entries` method. Removal of stored entries is not possible without ability to iterate over storage items."
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
persisterFn,
|
|
245
|
+
persistQuery,
|
|
246
|
+
persistQueryByKey,
|
|
247
|
+
retrieveQuery,
|
|
248
|
+
persisterGc,
|
|
249
|
+
restoreQueries,
|
|
250
|
+
removeQueries
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
254
|
+
0 && (module.exports = {
|
|
255
|
+
PERSISTER_KEY_PREFIX,
|
|
256
|
+
experimental_createQueryPersister
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=createPersister.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/createPersister.ts"],"sourcesContent":["import {\n hashKey,\n matchQuery,\n notifyManager,\n partialMatchKey,\n} from '@tanstack/query-core'\nimport type {\n Query,\n QueryClient,\n QueryFilters,\n QueryFunctionContext,\n QueryKey,\n QueryState,\n} from '@tanstack/query-core'\n\nexport interface PersistedQuery {\n buster: string\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport type MaybePromise<T> = T | Promise<T>\n\nexport interface AsyncStorage<TStorageValue = string> {\n getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>\n setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>\n removeItem: (key: string) => MaybePromise<void>\n entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>\n}\n\nexport interface StoragePersisterOptions<TStorageValue = string> {\n /** The storage client used for setting and retrieving items from cache.\n * For SSR pass in `undefined`.\n */\n storage: AsyncStorage<TStorageValue> | undefined | null\n /**\n * How to serialize the data to storage.\n * @default `JSON.stringify`\n */\n serialize?: (persistedQuery: PersistedQuery) => MaybePromise<TStorageValue>\n /**\n * How to deserialize the data from storage.\n * @default `JSON.parse`\n */\n deserialize?: (cachedString: TStorageValue) => MaybePromise<PersistedQuery>\n /**\n * A unique string that can be used to forcefully invalidate existing caches,\n * if they do not share the same buster string\n */\n buster?: string\n /**\n * The max-allowed age of the cache in milliseconds.\n * If a persisted cache is found that is older than this\n * time, it will be discarded\n * @default 24 hours\n */\n maxAge?: number\n /**\n * Prefix to be used for storage key.\n * Storage key is a combination of prefix and query hash in a form of `prefix-queryHash`.\n * @default 'tanstack-query'\n */\n prefix?: string\n /**\n * If set to `true`, the query will refetch on successful query restoration if the data is stale.\n * If set to `false`, the query will not refetch on successful query restoration.\n * If set to `'always'`, the query will always refetch on successful query restoration.\n * Defaults to `true`.\n */\n refetchOnRestore?: boolean | 'always'\n /**\n * Filters to narrow down which Queries should be persisted.\n */\n filters?: QueryFilters\n}\n\nexport const PERSISTER_KEY_PREFIX = 'tanstack-query'\n\n/**\n * Warning: experimental feature.\n * This utility function enables fine-grained query persistence.\n * Simple add it as a `persister` parameter to `useQuery` or `defaultOptions` on `queryClient`.\n *\n * ```\n * useQuery({\n queryKey: ['myKey'],\n queryFn: fetcher,\n persister: createPersister({\n storage: localStorage,\n }),\n })\n ```\n */\nexport function experimental_createQueryPersister<TStorageValue = string>({\n storage,\n buster = '',\n maxAge = 1000 * 60 * 60 * 24,\n serialize = JSON.stringify as Required<\n StoragePersisterOptions<TStorageValue>\n >['serialize'],\n deserialize = JSON.parse as Required<\n StoragePersisterOptions<TStorageValue>\n >['deserialize'],\n prefix = PERSISTER_KEY_PREFIX,\n refetchOnRestore = true,\n filters,\n}: StoragePersisterOptions<TStorageValue>) {\n function isExpiredOrBusted(persistedQuery: PersistedQuery) {\n if (persistedQuery.state.dataUpdatedAt) {\n const queryAge = Date.now() - persistedQuery.state.dataUpdatedAt\n const expired = queryAge > maxAge\n const busted = persistedQuery.buster !== buster\n\n if (expired || busted) {\n return true\n }\n\n return false\n }\n\n return true\n }\n\n async function retrieveQuery<T>(\n queryHash: string,\n afterRestoreMacroTask?: (persistedQuery: PersistedQuery) => void,\n ) {\n if (storage != null) {\n const storageKey = `${prefix}-${queryHash}`\n try {\n const storedData = await storage.getItem(storageKey)\n if (storedData) {\n let persistedQuery: PersistedQuery\n try {\n persistedQuery = await deserialize(storedData)\n } catch {\n await storage.removeItem(storageKey)\n return\n }\n\n if (isExpiredOrBusted(persistedQuery)) {\n await storage.removeItem(storageKey)\n } else {\n if (afterRestoreMacroTask) {\n // Just after restoring we want to get fresh data from the server if it's stale\n notifyManager.schedule(() =>\n afterRestoreMacroTask(persistedQuery),\n )\n }\n // We must resolve the promise here, as otherwise we will have `loading` state in the app until `queryFn` resolves\n return persistedQuery.state.data as T\n }\n }\n } catch (err) {\n if (process.env.NODE_ENV === 'development') {\n console.error(err)\n console.warn(\n 'Encountered an error attempting to restore query cache from persisted location.',\n )\n }\n await storage.removeItem(storageKey)\n }\n }\n\n return\n }\n\n async function persistQueryByKey(\n queryKey: QueryKey,\n queryClient: QueryClient,\n ) {\n if (storage != null) {\n const query = queryClient.getQueryCache().find({ queryKey })\n if (query) {\n await persistQuery(query)\n } else {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n 'Could not find query to be persisted. QueryKey:',\n JSON.stringify(queryKey),\n )\n }\n }\n }\n }\n\n async function persistQuery(query: Query) {\n if (storage != null) {\n const storageKey = `${prefix}-${query.queryHash}`\n storage.setItem(\n storageKey,\n await serialize({\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n buster: buster,\n }),\n )\n }\n }\n\n async function persisterFn<T, TQueryKey extends QueryKey>(\n queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>,\n ctx: QueryFunctionContext<TQueryKey>,\n query: Query,\n ) {\n const matchesFilter = filters ? matchQuery(filters, query) : true\n\n // Try to restore only if we do not have any data in the cache and we have persister defined\n if (matchesFilter && query.state.data === undefined && storage != null) {\n const restoredData = await retrieveQuery(\n query.queryHash,\n (persistedQuery: PersistedQuery) => {\n // Set proper updatedAt, since resolving in the first pass overrides those values\n query.setState({\n dataUpdatedAt: persistedQuery.state.dataUpdatedAt,\n errorUpdatedAt: persistedQuery.state.errorUpdatedAt,\n })\n\n if (\n refetchOnRestore === 'always' ||\n (refetchOnRestore === true && query.isStale())\n ) {\n query.fetch()\n }\n },\n )\n\n if (restoredData !== undefined) {\n return Promise.resolve(restoredData as T)\n }\n }\n\n // If we did not restore, or restoration failed - fetch\n const queryFnResult = await queryFn(ctx)\n\n if (matchesFilter && storage != null) {\n // Persist if we have storage defined, we use timeout to get proper state to be persisted\n notifyManager.schedule(() => {\n persistQuery(query)\n })\n }\n\n return Promise.resolve(queryFnResult)\n }\n\n async function persisterGc() {\n if (storage?.entries) {\n const storageKeyPrefix = `${prefix}-`\n const entries = await storage.entries()\n for (const [key, value] of entries) {\n if (key.startsWith(storageKeyPrefix)) {\n let persistedQuery: PersistedQuery\n try {\n persistedQuery = await deserialize(value)\n } catch {\n await storage.removeItem(key)\n continue\n }\n if (isExpiredOrBusted(persistedQuery)) {\n await storage.removeItem(key)\n }\n }\n }\n } else if (process.env.NODE_ENV === 'development') {\n throw new Error(\n 'Provided storage does not implement `entries` method. Garbage collection is not possible without ability to iterate over storage items.',\n )\n }\n }\n\n async function restoreQueries(\n queryClient: QueryClient,\n filters: Pick<QueryFilters, 'queryKey' | 'exact'> = {},\n ): Promise<void> {\n const { exact, queryKey } = filters\n\n if (storage?.entries) {\n const storageKeyPrefix = `${prefix}-`\n const entries = await storage.entries()\n for (const [key, value] of entries) {\n if (key.startsWith(storageKeyPrefix)) {\n let persistedQuery: PersistedQuery\n try {\n persistedQuery = await deserialize(value)\n } catch {\n await storage.removeItem(key)\n continue\n }\n if (isExpiredOrBusted(persistedQuery)) {\n await storage.removeItem(key)\n continue\n }\n\n if (queryKey) {\n if (exact) {\n if (persistedQuery.queryHash !== hashKey(queryKey)) {\n continue\n }\n } else if (!partialMatchKey(persistedQuery.queryKey, queryKey)) {\n continue\n }\n }\n\n queryClient.setQueryData(\n persistedQuery.queryKey,\n persistedQuery.state.data,\n {\n updatedAt: persistedQuery.state.dataUpdatedAt,\n },\n )\n }\n }\n } else if (process.env.NODE_ENV === 'development') {\n throw new Error(\n 'Provided storage does not implement `entries` method. Restoration of all stored entries is not possible without ability to iterate over storage items.',\n )\n }\n }\n\n async function removeQueries(\n filters: Pick<QueryFilters, 'queryKey' | 'exact'> = {},\n ): Promise<void> {\n const { exact, queryKey } = filters\n\n if (storage?.entries) {\n const entries = await storage.entries()\n const storageKeyPrefix = `${prefix}-`\n for (const [key, value] of entries) {\n if (key.startsWith(storageKeyPrefix)) {\n if (!queryKey) {\n await storage.removeItem(key)\n continue\n }\n\n let persistedQuery: PersistedQuery\n try {\n persistedQuery = await deserialize(value)\n } catch {\n await storage.removeItem(key)\n continue\n }\n\n if (exact) {\n if (persistedQuery.queryHash !== hashKey(queryKey)) {\n continue\n }\n } else if (!partialMatchKey(persistedQuery.queryKey, queryKey)) {\n continue\n }\n\n await storage.removeItem(key)\n }\n }\n } else if (process.env.NODE_ENV === 'development') {\n throw new Error(\n 'Provided storage does not implement `entries` method. Removal of stored entries is not possible without ability to iterate over storage items.',\n )\n }\n }\n\n return {\n persisterFn,\n persistQuery,\n persistQueryByKey,\n retrieveQuery,\n persisterGc,\n restoreQueries,\n removeQueries,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKO;AAwEA,IAAM,uBAAuB;AAiB7B,SAAS,kCAA0D;AAAA,EACxE;AAAA,EACA,SAAS;AAAA,EACT,SAAS,MAAO,KAAK,KAAK;AAAA,EAC1B,YAAY,KAAK;AAAA,EAGjB,cAAc,KAAK;AAAA,EAGnB,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB;AACF,GAA2C;AACzC,WAAS,kBAAkB,gBAAgC;AACzD,QAAI,eAAe,MAAM,eAAe;AACtC,YAAM,WAAW,KAAK,IAAI,IAAI,eAAe,MAAM;AACnD,YAAM,UAAU,WAAW;AAC3B,YAAM,SAAS,eAAe,WAAW;AAEzC,UAAI,WAAW,QAAQ;AACrB,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AAEA,iBAAe,cACb,WACA,uBACA;AACA,QAAI,WAAW,MAAM;AACnB,YAAM,aAAa,GAAG,MAAM,IAAI,SAAS;AACzC,UAAI;AACF,cAAM,aAAa,MAAM,QAAQ,QAAQ,UAAU;AACnD,YAAI,YAAY;AACd,cAAI;AACJ,cAAI;AACF,6BAAiB,MAAM,YAAY,UAAU;AAAA,UAC/C,QAAQ;AACN,kBAAM,QAAQ,WAAW,UAAU;AACnC;AAAA,UACF;AAEA,cAAI,kBAAkB,cAAc,GAAG;AACrC,kBAAM,QAAQ,WAAW,UAAU;AAAA,UACrC,OAAO;AACL,gBAAI,uBAAuB;AAEzB,8CAAc;AAAA,gBAAS,MACrB,sBAAsB,cAAc;AAAA,cACtC;AAAA,YACF;AAEA,mBAAO,eAAe,MAAM;AAAA,UAC9B;AAAA,QACF;AAAA,MACF,SAAS,KAAK;AACZ,YAAI,QAAQ,IAAI,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A,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["filters"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { experimental_createQueryPersister } from './_tsup-dts-rollup.cjs';
|
|
2
|
+
export { PersistedQuery } from './_tsup-dts-rollup.cjs';
|
|
3
|
+
export { MaybePromise } from './_tsup-dts-rollup.cjs';
|
|
4
|
+
export { AsyncStorage } from './_tsup-dts-rollup.cjs';
|
|
5
|
+
export { StoragePersisterOptions } from './_tsup-dts-rollup.cjs';
|
|
6
|
+
export { PERSISTER_KEY_PREFIX } from './_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { experimental_createQueryPersister } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { PersistedQuery } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { MaybePromise } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { AsyncStorage } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { StoragePersisterOptions } from './_tsup-dts-rollup.js';
|
|
6
|
+
export { PERSISTER_KEY_PREFIX } from './_tsup-dts-rollup.js';
|