@tanstack/query-persist-client-core 5.103.2 → 5.104.0
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/createPersister.d.cts +6 -7
- package/build/legacy/createPersister.d.cts.map +1 -1
- package/build/legacy/createPersister.d.ts +6 -7
- package/build/legacy/createPersister.d.ts.map +1 -1
- package/build/legacy/persist.d.cts +11 -12
- package/build/legacy/persist.d.cts.map +1 -1
- package/build/legacy/persist.d.ts +11 -12
- package/build/legacy/persist.d.ts.map +1 -1
- package/build/legacy/retryStrategies.d.cts +2 -3
- package/build/legacy/retryStrategies.d.cts.map +1 -1
- package/build/legacy/retryStrategies.d.ts +2 -3
- package/build/legacy/retryStrategies.d.ts.map +1 -1
- package/build/modern/createPersister.d.cts +6 -7
- package/build/modern/createPersister.d.cts.map +1 -1
- package/build/modern/createPersister.d.ts +6 -7
- package/build/modern/createPersister.d.ts.map +1 -1
- package/build/modern/persist.d.cts +11 -12
- package/build/modern/persist.d.cts.map +1 -1
- package/build/modern/persist.d.ts +11 -12
- package/build/modern/persist.d.ts.map +1 -1
- package/build/modern/retryStrategies.d.cts +2 -3
- package/build/modern/retryStrategies.d.cts.map +1 -1
- package/build/modern/retryStrategies.d.ts +2 -3
- package/build/modern/retryStrategies.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Query, QueryClient, QueryFilters, QueryFunctionContext, QueryKey, QueryState } from "@tanstack/query-core";
|
|
2
2
|
//#region src/createPersister.d.ts
|
|
3
|
-
interface PersistedQuery {
|
|
3
|
+
export interface PersistedQuery {
|
|
4
4
|
buster: string;
|
|
5
5
|
queryHash: string;
|
|
6
6
|
queryKey: QueryKey;
|
|
7
7
|
state: QueryState;
|
|
8
8
|
}
|
|
9
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
-
interface AsyncStorage<TStorageValue = string> {
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
export interface AsyncStorage<TStorageValue = string> {
|
|
11
11
|
getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>;
|
|
12
12
|
setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>;
|
|
13
13
|
removeItem: (key: string) => MaybePromise<void>;
|
|
14
14
|
entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>;
|
|
15
15
|
}
|
|
16
|
-
interface StoragePersisterOptions<TStorageValue = string> {
|
|
16
|
+
export interface StoragePersisterOptions<TStorageValue = string> {
|
|
17
17
|
/** The storage client used for setting and retrieving items from cache.
|
|
18
18
|
* For SSR pass in `undefined`.
|
|
19
19
|
*/
|
|
@@ -59,7 +59,7 @@ interface StoragePersisterOptions<TStorageValue = string> {
|
|
|
59
59
|
*/
|
|
60
60
|
filters?: QueryFilters;
|
|
61
61
|
}
|
|
62
|
-
declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
62
|
+
export declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
63
63
|
/**
|
|
64
64
|
* Warning: experimental feature.
|
|
65
65
|
* This utility function enables fine-grained query persistence.
|
|
@@ -75,7 +75,7 @@ declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
|
75
75
|
})
|
|
76
76
|
```
|
|
77
77
|
*/
|
|
78
|
-
declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
78
|
+
export declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
79
79
|
persisterFn: <T, TQueryKey extends QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>, ctx: QueryFunctionContext<TQueryKey>, query: Query) => Promise<T>;
|
|
80
80
|
persistQuery: (query: Query) => Promise<void>;
|
|
81
81
|
persistQueryByKey: (queryKey: QueryKey, queryClient: QueryClient) => Promise<void>;
|
|
@@ -85,5 +85,4 @@ declare function experimental_createQueryPersister<TStorageValue = string>({ sto
|
|
|
85
85
|
removeQueries: (filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
86
86
|
};
|
|
87
87
|
//#endregion
|
|
88
|
-
export { AsyncStorage, MaybePromise, PERSISTER_KEY_PREFIX, PersistedQuery, StoragePersisterOptions, experimental_createQueryPersister };
|
|
89
88
|
//# sourceMappingURL=createPersister.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPersister.d.cts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createPersister.d.cts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;iBAeiB;EACf;EACA;EACA,UAAU;EACV,OAAO;;YAGG,aAAa,KAAK,IAAI,QAAQ;iBAEzB,aAAa;EAC5B,UAAU,gBAAgB,aAAa;EACvC,UAAU,aAAa,OAAO,kBAAkB;EAChD,aAAa,gBAAgB;EAC7B,gBAAgB,aAAa,OAAO,aAAa,OAAO;;iBAGzC,wBAAwB;;;;EAIvC,SAAS,aAAa;;;;;EAKtB,aAAa,gBAAgB,mBAAmB,aAAa;;;;;EAK7D,eAAe,cAAc,kBAAkB,aAAa;;;;;EAK5D;;;;;;;EAOA;;;;;;EAMA;;;;;;;;EAQA;;;;EAIA,UAAU;;qBAGC;;;;;;;;;;;;;;;;wBAiBG,kCAAkC,0BAChD,SACA,QACA,QACA,WAGA,aAGA,QACA,kBACA,WACC,wBAAwB;EA+FE,cAAA,GAAG,kBAAkB,UAAQ,UAC5C,SAAS,qBAAqB,eAAe,IAAI,QAAQ,IAAE,KAChE,qBAAqB,YAAU,OAC7B,UAAK,QAAA;EAlBqB,eAAA,OAAA,UAAK;EAlB5B,oBAAA,UAAA,UAAQ,aACL,gBAAW;EA9CG,gBAAA,GAAC,mBACX,yBACQ,gBAAgB,4BAAuB,QAAA;;EAmJnD,iBAAA,aAAA,aAAW,UACf,KAAK,wCACb;EA+CQ,gBAAA,UAAA,KAAK,wCACb"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Query, QueryClient, QueryFilters, QueryFunctionContext, QueryKey, QueryState } from "@tanstack/query-core";
|
|
2
2
|
//#region src/createPersister.d.ts
|
|
3
|
-
interface PersistedQuery {
|
|
3
|
+
export interface PersistedQuery {
|
|
4
4
|
buster: string;
|
|
5
5
|
queryHash: string;
|
|
6
6
|
queryKey: QueryKey;
|
|
7
7
|
state: QueryState;
|
|
8
8
|
}
|
|
9
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
-
interface AsyncStorage<TStorageValue = string> {
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
export interface AsyncStorage<TStorageValue = string> {
|
|
11
11
|
getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>;
|
|
12
12
|
setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>;
|
|
13
13
|
removeItem: (key: string) => MaybePromise<void>;
|
|
14
14
|
entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>;
|
|
15
15
|
}
|
|
16
|
-
interface StoragePersisterOptions<TStorageValue = string> {
|
|
16
|
+
export interface StoragePersisterOptions<TStorageValue = string> {
|
|
17
17
|
/** The storage client used for setting and retrieving items from cache.
|
|
18
18
|
* For SSR pass in `undefined`.
|
|
19
19
|
*/
|
|
@@ -59,7 +59,7 @@ interface StoragePersisterOptions<TStorageValue = string> {
|
|
|
59
59
|
*/
|
|
60
60
|
filters?: QueryFilters;
|
|
61
61
|
}
|
|
62
|
-
declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
62
|
+
export declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
63
63
|
/**
|
|
64
64
|
* Warning: experimental feature.
|
|
65
65
|
* This utility function enables fine-grained query persistence.
|
|
@@ -75,7 +75,7 @@ declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
|
75
75
|
})
|
|
76
76
|
```
|
|
77
77
|
*/
|
|
78
|
-
declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
78
|
+
export declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
79
79
|
persisterFn: <T, TQueryKey extends QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>, ctx: QueryFunctionContext<TQueryKey>, query: Query) => Promise<T>;
|
|
80
80
|
persistQuery: (query: Query) => Promise<void>;
|
|
81
81
|
persistQueryByKey: (queryKey: QueryKey, queryClient: QueryClient) => Promise<void>;
|
|
@@ -85,5 +85,4 @@ declare function experimental_createQueryPersister<TStorageValue = string>({ sto
|
|
|
85
85
|
removeQueries: (filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
86
86
|
};
|
|
87
87
|
//#endregion
|
|
88
|
-
export { AsyncStorage, MaybePromise, PERSISTER_KEY_PREFIX, PersistedQuery, StoragePersisterOptions, experimental_createQueryPersister };
|
|
89
88
|
//# sourceMappingURL=createPersister.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPersister.d.ts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createPersister.d.ts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;iBAeiB;EACf;EACA;EACA,UAAU;EACV,OAAO;;YAGG,aAAa,KAAK,IAAI,QAAQ;iBAEzB,aAAa;EAC5B,UAAU,gBAAgB,aAAa;EACvC,UAAU,aAAa,OAAO,kBAAkB;EAChD,aAAa,gBAAgB;EAC7B,gBAAgB,aAAa,OAAO,aAAa,OAAO;;iBAGzC,wBAAwB;;;;EAIvC,SAAS,aAAa;;;;;EAKtB,aAAa,gBAAgB,mBAAmB,aAAa;;;;;EAK7D,eAAe,cAAc,kBAAkB,aAAa;;;;;EAK5D;;;;;;;EAOA;;;;;;EAMA;;;;;;;;EAQA;;;;EAIA,UAAU;;qBAGC;;;;;;;;;;;;;;;;wBAiBG,kCAAkC,0BAChD,SACA,QACA,QACA,WAGA,aAGA,QACA,kBACA,WACC,wBAAwB;EA+FE,cAAA,GAAG,kBAAkB,UAAQ,UAC5C,SAAS,qBAAqB,eAAe,IAAI,QAAQ,IAAE,KAChE,qBAAqB,YAAU,OAC7B,UAAK,QAAA;EAlBqB,eAAA,OAAA,UAAK;EAlB5B,oBAAA,UAAA,UAAQ,aACL,gBAAW;EA9CG,gBAAA,GAAC,mBACX,yBACQ,gBAAgB,4BAAuB,QAAA;;EAmJnD,iBAAA,aAAA,aAAW,UACf,KAAK,wCACb;EA+CQ,gBAAA,UAAA,KAAK,wCACb"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DehydrateOptions, DehydratedState, HydrateOptions, QueryClient } from "@tanstack/query-core";
|
|
2
2
|
//#region src/persist.d.ts
|
|
3
|
-
type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
-
interface Persister {
|
|
3
|
+
export type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
+
export interface Persister {
|
|
5
5
|
persistClient: (persistClient: PersistedClient) => Promisable<void>;
|
|
6
6
|
restoreClient: () => Promisable<PersistedClient | undefined>;
|
|
7
7
|
removeClient: () => Promisable<void>;
|
|
8
8
|
}
|
|
9
|
-
interface PersistedClient {
|
|
9
|
+
export interface PersistedClient {
|
|
10
10
|
timestamp: number;
|
|
11
11
|
buster: string;
|
|
12
12
|
clientState: DehydratedState;
|
|
13
13
|
}
|
|
14
|
-
interface PersistQueryClientRootOptions {
|
|
14
|
+
export interface PersistQueryClientRootOptions {
|
|
15
15
|
/** The QueryClient to persist */
|
|
16
16
|
queryClient: QueryClient;
|
|
17
17
|
/** The Persister interface for storing and restoring the cache
|
|
@@ -21,7 +21,7 @@ interface PersistQueryClientRootOptions {
|
|
|
21
21
|
* invalidate existing caches if they do not share the same buster string */
|
|
22
22
|
buster?: string;
|
|
23
23
|
}
|
|
24
|
-
interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
24
|
+
export interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
25
25
|
/** The max-allowed age of the cache in milliseconds.
|
|
26
26
|
* If a persisted cache is found that is older than this
|
|
27
27
|
* time, it will be discarded */
|
|
@@ -29,33 +29,32 @@ interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptio
|
|
|
29
29
|
/** The options passed to the hydrate function */
|
|
30
30
|
hydrateOptions?: HydrateOptions;
|
|
31
31
|
}
|
|
32
|
-
interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
32
|
+
export interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
33
33
|
/** The options passed to the dehydrate function */
|
|
34
34
|
dehydrateOptions?: DehydrateOptions;
|
|
35
35
|
}
|
|
36
|
-
interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
36
|
+
export interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
37
37
|
/**
|
|
38
38
|
* Restores persisted data to the QueryCache
|
|
39
39
|
* - data obtained from persister.restoreClient
|
|
40
40
|
* - data is hydrated using hydrateOptions
|
|
41
41
|
* If data is expired, busted, empty, or throws, it runs persister.removeClient
|
|
42
42
|
*/
|
|
43
|
-
declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
43
|
+
export declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Persists data from the QueryCache
|
|
46
46
|
* - data dehydrated using dehydrateOptions
|
|
47
47
|
* - data is persisted using persister.persistClient
|
|
48
48
|
*/
|
|
49
|
-
declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
49
|
+
export declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Subscribe to QueryCache and MutationCache updates (for persisting)
|
|
52
52
|
* @returns an unsubscribe function (to discontinue monitoring)
|
|
53
53
|
*/
|
|
54
|
-
declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
54
|
+
export declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
55
55
|
/**
|
|
56
56
|
* Restores persisted data to QueryCache and persists further changes.
|
|
57
57
|
*/
|
|
58
|
-
declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
58
|
+
export declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
59
59
|
//#endregion
|
|
60
|
-
export { PersistQueryClientOptions, PersistQueryClientRootOptions, PersistedClient, PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, Persister, Promisable, persistQueryClient, persistQueryClientRestore, persistQueryClientSave, persistQueryClientSubscribe };
|
|
61
60
|
//# sourceMappingURL=persist.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.cts","names":[],"sources":["../../src/persist.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"persist.d.cts","names":[],"sources":["../../src/persist.ts"],"mappings":";;YASY,WAAW,KAAK,IAAI,YAAY;iBAE3B;EACf,gBAAgB,eAAe,oBAAoB;EACnD,qBAAqB,WAAW;EAChC,oBAAoB;;iBAGL;EACf;EACA;EACA,aAAa;;iBAGE;;EAEf,aAAa;;;EAGb,WAAW;;;EAGX;;iBAGe,2CAA2C;;;;EAI1D;;EAEA,iBAAiB;;iBAGF,wCAAwC;;EAEvD,mBAAmB;;iBAGJ,kCAEb,oCACA,iCACA;;;;;;;wBAkBkB,4BACpB,aACA,WACA,QACA,QACA,kBACC,qCAAkC;;;;;;wBAoCf,yBACpB,aACA,WACA,QACA,oBACC,kCAA+B;;;;;wBAclB,4BACd,OAAO;;;;wBA2BO,mBACd,OAAO,yCACO"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DehydrateOptions, DehydratedState, HydrateOptions, QueryClient } from "@tanstack/query-core";
|
|
2
2
|
//#region src/persist.d.ts
|
|
3
|
-
type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
-
interface Persister {
|
|
3
|
+
export type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
+
export interface Persister {
|
|
5
5
|
persistClient: (persistClient: PersistedClient) => Promisable<void>;
|
|
6
6
|
restoreClient: () => Promisable<PersistedClient | undefined>;
|
|
7
7
|
removeClient: () => Promisable<void>;
|
|
8
8
|
}
|
|
9
|
-
interface PersistedClient {
|
|
9
|
+
export interface PersistedClient {
|
|
10
10
|
timestamp: number;
|
|
11
11
|
buster: string;
|
|
12
12
|
clientState: DehydratedState;
|
|
13
13
|
}
|
|
14
|
-
interface PersistQueryClientRootOptions {
|
|
14
|
+
export interface PersistQueryClientRootOptions {
|
|
15
15
|
/** The QueryClient to persist */
|
|
16
16
|
queryClient: QueryClient;
|
|
17
17
|
/** The Persister interface for storing and restoring the cache
|
|
@@ -21,7 +21,7 @@ interface PersistQueryClientRootOptions {
|
|
|
21
21
|
* invalidate existing caches if they do not share the same buster string */
|
|
22
22
|
buster?: string;
|
|
23
23
|
}
|
|
24
|
-
interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
24
|
+
export interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
25
25
|
/** The max-allowed age of the cache in milliseconds.
|
|
26
26
|
* If a persisted cache is found that is older than this
|
|
27
27
|
* time, it will be discarded */
|
|
@@ -29,33 +29,32 @@ interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptio
|
|
|
29
29
|
/** The options passed to the hydrate function */
|
|
30
30
|
hydrateOptions?: HydrateOptions;
|
|
31
31
|
}
|
|
32
|
-
interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
32
|
+
export interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
33
33
|
/** The options passed to the dehydrate function */
|
|
34
34
|
dehydrateOptions?: DehydrateOptions;
|
|
35
35
|
}
|
|
36
|
-
interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
36
|
+
export interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
37
37
|
/**
|
|
38
38
|
* Restores persisted data to the QueryCache
|
|
39
39
|
* - data obtained from persister.restoreClient
|
|
40
40
|
* - data is hydrated using hydrateOptions
|
|
41
41
|
* If data is expired, busted, empty, or throws, it runs persister.removeClient
|
|
42
42
|
*/
|
|
43
|
-
declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
43
|
+
export declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Persists data from the QueryCache
|
|
46
46
|
* - data dehydrated using dehydrateOptions
|
|
47
47
|
* - data is persisted using persister.persistClient
|
|
48
48
|
*/
|
|
49
|
-
declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
49
|
+
export declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Subscribe to QueryCache and MutationCache updates (for persisting)
|
|
52
52
|
* @returns an unsubscribe function (to discontinue monitoring)
|
|
53
53
|
*/
|
|
54
|
-
declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
54
|
+
export declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
55
55
|
/**
|
|
56
56
|
* Restores persisted data to QueryCache and persists further changes.
|
|
57
57
|
*/
|
|
58
|
-
declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
58
|
+
export declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
59
59
|
//#endregion
|
|
60
|
-
export { PersistQueryClientOptions, PersistQueryClientRootOptions, PersistedClient, PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, Persister, Promisable, persistQueryClient, persistQueryClientRestore, persistQueryClientSave, persistQueryClientSubscribe };
|
|
61
60
|
//# sourceMappingURL=persist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.ts","names":[],"sources":["../../src/persist.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"persist.d.ts","names":[],"sources":["../../src/persist.ts"],"mappings":";;YASY,WAAW,KAAK,IAAI,YAAY;iBAE3B;EACf,gBAAgB,eAAe,oBAAoB;EACnD,qBAAqB,WAAW;EAChC,oBAAoB;;iBAGL;EACf;EACA;EACA,aAAa;;iBAGE;;EAEf,aAAa;;;EAGb,WAAW;;;EAGX;;iBAGe,2CAA2C;;;;EAI1D;;EAEA,iBAAiB;;iBAGF,wCAAwC;;EAEvD,mBAAmB;;iBAGJ,kCAEb,oCACA,iCACA;;;;;;;wBAkBkB,4BACpB,aACA,WACA,QACA,QACA,kBACC,qCAAkC;;;;;;wBAoCf,yBACpB,aACA,WACA,QACA,oBACC,kCAA+B;;;;;wBAclB,4BACd,OAAO;;;;wBA2BO,mBACd,OAAO,yCACO"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PersistedClient } from "./persist.cjs";
|
|
2
2
|
//#region src/retryStrategies.d.ts
|
|
3
|
-
type PersistRetryer = (props: {
|
|
3
|
+
export type PersistRetryer = (props: {
|
|
4
4
|
persistedClient: PersistedClient;
|
|
5
5
|
error: Error;
|
|
6
6
|
errorCount: number;
|
|
7
7
|
}) => PersistedClient | undefined;
|
|
8
|
-
declare const removeOldestQuery: PersistRetryer;
|
|
8
|
+
export declare const removeOldestQuery: PersistRetryer;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { PersistRetryer, removeOldestQuery };
|
|
11
10
|
//# sourceMappingURL=retryStrategies.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryStrategies.d.cts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"retryStrategies.d.cts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;YAEY,kBAAkB;EAC5B,iBAAiB;EACjB,OAAO;EACP;MACI;qBAEO,mBAAmB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PersistedClient } from "./persist.js";
|
|
2
2
|
//#region src/retryStrategies.d.ts
|
|
3
|
-
type PersistRetryer = (props: {
|
|
3
|
+
export type PersistRetryer = (props: {
|
|
4
4
|
persistedClient: PersistedClient;
|
|
5
5
|
error: Error;
|
|
6
6
|
errorCount: number;
|
|
7
7
|
}) => PersistedClient | undefined;
|
|
8
|
-
declare const removeOldestQuery: PersistRetryer;
|
|
8
|
+
export declare const removeOldestQuery: PersistRetryer;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { PersistRetryer, removeOldestQuery };
|
|
11
10
|
//# sourceMappingURL=retryStrategies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryStrategies.d.ts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"retryStrategies.d.ts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;YAEY,kBAAkB;EAC5B,iBAAiB;EACjB,OAAO;EACP;MACI;qBAEO,mBAAmB"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Query, QueryClient, QueryFilters, QueryFunctionContext, QueryKey, QueryState } from "@tanstack/query-core";
|
|
2
2
|
//#region src/createPersister.d.ts
|
|
3
|
-
interface PersistedQuery {
|
|
3
|
+
export interface PersistedQuery {
|
|
4
4
|
buster: string;
|
|
5
5
|
queryHash: string;
|
|
6
6
|
queryKey: QueryKey;
|
|
7
7
|
state: QueryState;
|
|
8
8
|
}
|
|
9
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
-
interface AsyncStorage<TStorageValue = string> {
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
export interface AsyncStorage<TStorageValue = string> {
|
|
11
11
|
getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>;
|
|
12
12
|
setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>;
|
|
13
13
|
removeItem: (key: string) => MaybePromise<void>;
|
|
14
14
|
entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>;
|
|
15
15
|
}
|
|
16
|
-
interface StoragePersisterOptions<TStorageValue = string> {
|
|
16
|
+
export interface StoragePersisterOptions<TStorageValue = string> {
|
|
17
17
|
/** The storage client used for setting and retrieving items from cache.
|
|
18
18
|
* For SSR pass in `undefined`.
|
|
19
19
|
*/
|
|
@@ -59,7 +59,7 @@ interface StoragePersisterOptions<TStorageValue = string> {
|
|
|
59
59
|
*/
|
|
60
60
|
filters?: QueryFilters;
|
|
61
61
|
}
|
|
62
|
-
declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
62
|
+
export declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
63
63
|
/**
|
|
64
64
|
* Warning: experimental feature.
|
|
65
65
|
* This utility function enables fine-grained query persistence.
|
|
@@ -75,7 +75,7 @@ declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
|
75
75
|
})
|
|
76
76
|
```
|
|
77
77
|
*/
|
|
78
|
-
declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
78
|
+
export declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
79
79
|
persisterFn: <T, TQueryKey extends QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>, ctx: QueryFunctionContext<TQueryKey>, query: Query) => Promise<T>;
|
|
80
80
|
persistQuery: (query: Query) => Promise<void>;
|
|
81
81
|
persistQueryByKey: (queryKey: QueryKey, queryClient: QueryClient) => Promise<void>;
|
|
@@ -85,5 +85,4 @@ declare function experimental_createQueryPersister<TStorageValue = string>({ sto
|
|
|
85
85
|
removeQueries: (filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
86
86
|
};
|
|
87
87
|
//#endregion
|
|
88
|
-
export { AsyncStorage, MaybePromise, PERSISTER_KEY_PREFIX, PersistedQuery, StoragePersisterOptions, experimental_createQueryPersister };
|
|
89
88
|
//# sourceMappingURL=createPersister.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPersister.d.cts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createPersister.d.cts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;iBAeiB;EACf;EACA;EACA,UAAU;EACV,OAAO;;YAGG,aAAa,KAAK,IAAI,QAAQ;iBAEzB,aAAa;EAC5B,UAAU,gBAAgB,aAAa;EACvC,UAAU,aAAa,OAAO,kBAAkB;EAChD,aAAa,gBAAgB;EAC7B,gBAAgB,aAAa,OAAO,aAAa,OAAO;;iBAGzC,wBAAwB;;;;EAIvC,SAAS,aAAa;;;;;EAKtB,aAAa,gBAAgB,mBAAmB,aAAa;;;;;EAK7D,eAAe,cAAc,kBAAkB,aAAa;;;;;EAK5D;;;;;;;EAOA;;;;;;EAMA;;;;;;;;EAQA;;;;EAIA,UAAU;;qBAGC;;;;;;;;;;;;;;;;wBAiBG,kCAAkC,0BAChD,SACA,QACA,QACA,WAGA,aAGA,QACA,kBACA,WACC,wBAAwB;EA+FE,cAAA,GAAG,kBAAkB,UAAQ,UAC5C,SAAS,qBAAqB,eAAe,IAAI,QAAQ,IAAE,KAChE,qBAAqB,YAAU,OAC7B,UAAK,QAAA;EAlBqB,eAAA,OAAA,UAAK;EAlB5B,oBAAA,UAAA,UAAQ,aACL,gBAAW;EA9CG,gBAAA,GAAC,mBACX,yBACQ,gBAAgB,4BAAuB,QAAA;;EAmJnD,iBAAA,aAAA,aAAW,UACf,KAAK,wCACb;EA+CQ,gBAAA,UAAA,KAAK,wCACb"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Query, QueryClient, QueryFilters, QueryFunctionContext, QueryKey, QueryState } from "@tanstack/query-core";
|
|
2
2
|
//#region src/createPersister.d.ts
|
|
3
|
-
interface PersistedQuery {
|
|
3
|
+
export interface PersistedQuery {
|
|
4
4
|
buster: string;
|
|
5
5
|
queryHash: string;
|
|
6
6
|
queryKey: QueryKey;
|
|
7
7
|
state: QueryState;
|
|
8
8
|
}
|
|
9
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
-
interface AsyncStorage<TStorageValue = string> {
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
export interface AsyncStorage<TStorageValue = string> {
|
|
11
11
|
getItem: (key: string) => MaybePromise<TStorageValue | undefined | null>;
|
|
12
12
|
setItem: (key: string, value: TStorageValue) => MaybePromise<unknown>;
|
|
13
13
|
removeItem: (key: string) => MaybePromise<void>;
|
|
14
14
|
entries?: () => MaybePromise<Array<[key: string, value: TStorageValue]>>;
|
|
15
15
|
}
|
|
16
|
-
interface StoragePersisterOptions<TStorageValue = string> {
|
|
16
|
+
export interface StoragePersisterOptions<TStorageValue = string> {
|
|
17
17
|
/** The storage client used for setting and retrieving items from cache.
|
|
18
18
|
* For SSR pass in `undefined`.
|
|
19
19
|
*/
|
|
@@ -59,7 +59,7 @@ interface StoragePersisterOptions<TStorageValue = string> {
|
|
|
59
59
|
*/
|
|
60
60
|
filters?: QueryFilters;
|
|
61
61
|
}
|
|
62
|
-
declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
62
|
+
export declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
63
63
|
/**
|
|
64
64
|
* Warning: experimental feature.
|
|
65
65
|
* This utility function enables fine-grained query persistence.
|
|
@@ -75,7 +75,7 @@ declare const PERSISTER_KEY_PREFIX = "tanstack-query";
|
|
|
75
75
|
})
|
|
76
76
|
```
|
|
77
77
|
*/
|
|
78
|
-
declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
78
|
+
export declare function experimental_createQueryPersister<TStorageValue = string>({ storage, buster, maxAge, serialize, deserialize, prefix, refetchOnRestore, filters }: StoragePersisterOptions<TStorageValue>): {
|
|
79
79
|
persisterFn: <T, TQueryKey extends QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => T | Promise<T>, ctx: QueryFunctionContext<TQueryKey>, query: Query) => Promise<T>;
|
|
80
80
|
persistQuery: (query: Query) => Promise<void>;
|
|
81
81
|
persistQueryByKey: (queryKey: QueryKey, queryClient: QueryClient) => Promise<void>;
|
|
@@ -85,5 +85,4 @@ declare function experimental_createQueryPersister<TStorageValue = string>({ sto
|
|
|
85
85
|
removeQueries: (filters?: Pick<QueryFilters, "queryKey" | "exact">) => Promise<void>;
|
|
86
86
|
};
|
|
87
87
|
//#endregion
|
|
88
|
-
export { AsyncStorage, MaybePromise, PERSISTER_KEY_PREFIX, PersistedQuery, StoragePersisterOptions, experimental_createQueryPersister };
|
|
89
88
|
//# sourceMappingURL=createPersister.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPersister.d.ts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createPersister.d.ts","names":[],"sources":["../../src/createPersister.ts"],"mappings":";;iBAeiB;EACf;EACA;EACA,UAAU;EACV,OAAO;;YAGG,aAAa,KAAK,IAAI,QAAQ;iBAEzB,aAAa;EAC5B,UAAU,gBAAgB,aAAa;EACvC,UAAU,aAAa,OAAO,kBAAkB;EAChD,aAAa,gBAAgB;EAC7B,gBAAgB,aAAa,OAAO,aAAa,OAAO;;iBAGzC,wBAAwB;;;;EAIvC,SAAS,aAAa;;;;;EAKtB,aAAa,gBAAgB,mBAAmB,aAAa;;;;;EAK7D,eAAe,cAAc,kBAAkB,aAAa;;;;;EAK5D;;;;;;;EAOA;;;;;;EAMA;;;;;;;;EAQA;;;;EAIA,UAAU;;qBAGC;;;;;;;;;;;;;;;;wBAiBG,kCAAkC,0BAChD,SACA,QACA,QACA,WAGA,aAGA,QACA,kBACA,WACC,wBAAwB;EA+FE,cAAA,GAAG,kBAAkB,UAAQ,UAC5C,SAAS,qBAAqB,eAAe,IAAI,QAAQ,IAAE,KAChE,qBAAqB,YAAU,OAC7B,UAAK,QAAA;EAlBqB,eAAA,OAAA,UAAK;EAlB5B,oBAAA,UAAA,UAAQ,aACL,gBAAW;EA9CG,gBAAA,GAAC,mBACX,yBACQ,gBAAgB,4BAAuB,QAAA;;EAmJnD,iBAAA,aAAA,aAAW,UACf,KAAK,wCACb;EA+CQ,gBAAA,UAAA,KAAK,wCACb"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DehydrateOptions, DehydratedState, HydrateOptions, QueryClient } from "@tanstack/query-core";
|
|
2
2
|
//#region src/persist.d.ts
|
|
3
|
-
type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
-
interface Persister {
|
|
3
|
+
export type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
+
export interface Persister {
|
|
5
5
|
persistClient: (persistClient: PersistedClient) => Promisable<void>;
|
|
6
6
|
restoreClient: () => Promisable<PersistedClient | undefined>;
|
|
7
7
|
removeClient: () => Promisable<void>;
|
|
8
8
|
}
|
|
9
|
-
interface PersistedClient {
|
|
9
|
+
export interface PersistedClient {
|
|
10
10
|
timestamp: number;
|
|
11
11
|
buster: string;
|
|
12
12
|
clientState: DehydratedState;
|
|
13
13
|
}
|
|
14
|
-
interface PersistQueryClientRootOptions {
|
|
14
|
+
export interface PersistQueryClientRootOptions {
|
|
15
15
|
/** The QueryClient to persist */
|
|
16
16
|
queryClient: QueryClient;
|
|
17
17
|
/** The Persister interface for storing and restoring the cache
|
|
@@ -21,7 +21,7 @@ interface PersistQueryClientRootOptions {
|
|
|
21
21
|
* invalidate existing caches if they do not share the same buster string */
|
|
22
22
|
buster?: string;
|
|
23
23
|
}
|
|
24
|
-
interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
24
|
+
export interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
25
25
|
/** The max-allowed age of the cache in milliseconds.
|
|
26
26
|
* If a persisted cache is found that is older than this
|
|
27
27
|
* time, it will be discarded */
|
|
@@ -29,33 +29,32 @@ interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptio
|
|
|
29
29
|
/** The options passed to the hydrate function */
|
|
30
30
|
hydrateOptions?: HydrateOptions;
|
|
31
31
|
}
|
|
32
|
-
interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
32
|
+
export interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
33
33
|
/** The options passed to the dehydrate function */
|
|
34
34
|
dehydrateOptions?: DehydrateOptions;
|
|
35
35
|
}
|
|
36
|
-
interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
36
|
+
export interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
37
37
|
/**
|
|
38
38
|
* Restores persisted data to the QueryCache
|
|
39
39
|
* - data obtained from persister.restoreClient
|
|
40
40
|
* - data is hydrated using hydrateOptions
|
|
41
41
|
* If data is expired, busted, empty, or throws, it runs persister.removeClient
|
|
42
42
|
*/
|
|
43
|
-
declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
43
|
+
export declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Persists data from the QueryCache
|
|
46
46
|
* - data dehydrated using dehydrateOptions
|
|
47
47
|
* - data is persisted using persister.persistClient
|
|
48
48
|
*/
|
|
49
|
-
declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
49
|
+
export declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Subscribe to QueryCache and MutationCache updates (for persisting)
|
|
52
52
|
* @returns an unsubscribe function (to discontinue monitoring)
|
|
53
53
|
*/
|
|
54
|
-
declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
54
|
+
export declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
55
55
|
/**
|
|
56
56
|
* Restores persisted data to QueryCache and persists further changes.
|
|
57
57
|
*/
|
|
58
|
-
declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
58
|
+
export declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
59
59
|
//#endregion
|
|
60
|
-
export { PersistQueryClientOptions, PersistQueryClientRootOptions, PersistedClient, PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, Persister, Promisable, persistQueryClient, persistQueryClientRestore, persistQueryClientSave, persistQueryClientSubscribe };
|
|
61
60
|
//# sourceMappingURL=persist.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.cts","names":[],"sources":["../../src/persist.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"persist.d.cts","names":[],"sources":["../../src/persist.ts"],"mappings":";;YASY,WAAW,KAAK,IAAI,YAAY;iBAE3B;EACf,gBAAgB,eAAe,oBAAoB;EACnD,qBAAqB,WAAW;EAChC,oBAAoB;;iBAGL;EACf;EACA;EACA,aAAa;;iBAGE;;EAEf,aAAa;;;EAGb,WAAW;;;EAGX;;iBAGe,2CAA2C;;;;EAI1D;;EAEA,iBAAiB;;iBAGF,wCAAwC;;EAEvD,mBAAmB;;iBAGJ,kCAEb,oCACA,iCACA;;;;;;;wBAkBkB,4BACpB,aACA,WACA,QACA,QACA,kBACC,qCAAkC;;;;;;wBAoCf,yBACpB,aACA,WACA,QACA,oBACC,kCAA+B;;;;;wBAclB,4BACd,OAAO;;;;wBA2BO,mBACd,OAAO,yCACO"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DehydrateOptions, DehydratedState, HydrateOptions, QueryClient } from "@tanstack/query-core";
|
|
2
2
|
//#region src/persist.d.ts
|
|
3
|
-
type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
-
interface Persister {
|
|
3
|
+
export type Promisable<T> = T | PromiseLike<T>;
|
|
4
|
+
export interface Persister {
|
|
5
5
|
persistClient: (persistClient: PersistedClient) => Promisable<void>;
|
|
6
6
|
restoreClient: () => Promisable<PersistedClient | undefined>;
|
|
7
7
|
removeClient: () => Promisable<void>;
|
|
8
8
|
}
|
|
9
|
-
interface PersistedClient {
|
|
9
|
+
export interface PersistedClient {
|
|
10
10
|
timestamp: number;
|
|
11
11
|
buster: string;
|
|
12
12
|
clientState: DehydratedState;
|
|
13
13
|
}
|
|
14
|
-
interface PersistQueryClientRootOptions {
|
|
14
|
+
export interface PersistQueryClientRootOptions {
|
|
15
15
|
/** The QueryClient to persist */
|
|
16
16
|
queryClient: QueryClient;
|
|
17
17
|
/** The Persister interface for storing and restoring the cache
|
|
@@ -21,7 +21,7 @@ interface PersistQueryClientRootOptions {
|
|
|
21
21
|
* invalidate existing caches if they do not share the same buster string */
|
|
22
22
|
buster?: string;
|
|
23
23
|
}
|
|
24
|
-
interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
24
|
+
export interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptions {
|
|
25
25
|
/** The max-allowed age of the cache in milliseconds.
|
|
26
26
|
* If a persisted cache is found that is older than this
|
|
27
27
|
* time, it will be discarded */
|
|
@@ -29,33 +29,32 @@ interface PersistedQueryClientRestoreOptions extends PersistQueryClientRootOptio
|
|
|
29
29
|
/** The options passed to the hydrate function */
|
|
30
30
|
hydrateOptions?: HydrateOptions;
|
|
31
31
|
}
|
|
32
|
-
interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
32
|
+
export interface PersistedQueryClientSaveOptions extends PersistQueryClientRootOptions {
|
|
33
33
|
/** The options passed to the dehydrate function */
|
|
34
34
|
dehydrateOptions?: DehydrateOptions;
|
|
35
35
|
}
|
|
36
|
-
interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
36
|
+
export interface PersistQueryClientOptions extends PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, PersistQueryClientRootOptions {}
|
|
37
37
|
/**
|
|
38
38
|
* Restores persisted data to the QueryCache
|
|
39
39
|
* - data obtained from persister.restoreClient
|
|
40
40
|
* - data is hydrated using hydrateOptions
|
|
41
41
|
* If data is expired, busted, empty, or throws, it runs persister.removeClient
|
|
42
42
|
*/
|
|
43
|
-
declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
43
|
+
export declare function persistQueryClientRestore({ queryClient, persister, maxAge, buster, hydrateOptions }: PersistedQueryClientRestoreOptions): Promise<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Persists data from the QueryCache
|
|
46
46
|
* - data dehydrated using dehydrateOptions
|
|
47
47
|
* - data is persisted using persister.persistClient
|
|
48
48
|
*/
|
|
49
|
-
declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
49
|
+
export declare function persistQueryClientSave({ queryClient, persister, buster, dehydrateOptions }: PersistedQueryClientSaveOptions): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Subscribe to QueryCache and MutationCache updates (for persisting)
|
|
52
52
|
* @returns an unsubscribe function (to discontinue monitoring)
|
|
53
53
|
*/
|
|
54
|
-
declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
54
|
+
export declare function persistQueryClientSubscribe(props: PersistedQueryClientSaveOptions): () => void;
|
|
55
55
|
/**
|
|
56
56
|
* Restores persisted data to QueryCache and persists further changes.
|
|
57
57
|
*/
|
|
58
|
-
declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
58
|
+
export declare function persistQueryClient(props: PersistQueryClientOptions): [() => void, Promise<void>];
|
|
59
59
|
//#endregion
|
|
60
|
-
export { PersistQueryClientOptions, PersistQueryClientRootOptions, PersistedClient, PersistedQueryClientRestoreOptions, PersistedQueryClientSaveOptions, Persister, Promisable, persistQueryClient, persistQueryClientRestore, persistQueryClientSave, persistQueryClientSubscribe };
|
|
61
60
|
//# sourceMappingURL=persist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persist.d.ts","names":[],"sources":["../../src/persist.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"persist.d.ts","names":[],"sources":["../../src/persist.ts"],"mappings":";;YASY,WAAW,KAAK,IAAI,YAAY;iBAE3B;EACf,gBAAgB,eAAe,oBAAoB;EACnD,qBAAqB,WAAW;EAChC,oBAAoB;;iBAGL;EACf;EACA;EACA,aAAa;;iBAGE;;EAEf,aAAa;;;EAGb,WAAW;;;EAGX;;iBAGe,2CAA2C;;;;EAI1D;;EAEA,iBAAiB;;iBAGF,wCAAwC;;EAEvD,mBAAmB;;iBAGJ,kCAEb,oCACA,iCACA;;;;;;;wBAkBkB,4BACpB,aACA,WACA,QACA,QACA,kBACC,qCAAkC;;;;;;wBAoCf,yBACpB,aACA,WACA,QACA,oBACC,kCAA+B;;;;;wBAclB,4BACd,OAAO;;;;wBA2BO,mBACd,OAAO,yCACO"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PersistedClient } from "./persist.cjs";
|
|
2
2
|
//#region src/retryStrategies.d.ts
|
|
3
|
-
type PersistRetryer = (props: {
|
|
3
|
+
export type PersistRetryer = (props: {
|
|
4
4
|
persistedClient: PersistedClient;
|
|
5
5
|
error: Error;
|
|
6
6
|
errorCount: number;
|
|
7
7
|
}) => PersistedClient | undefined;
|
|
8
|
-
declare const removeOldestQuery: PersistRetryer;
|
|
8
|
+
export declare const removeOldestQuery: PersistRetryer;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { PersistRetryer, removeOldestQuery };
|
|
11
10
|
//# sourceMappingURL=retryStrategies.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryStrategies.d.cts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"retryStrategies.d.cts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;YAEY,kBAAkB;EAC5B,iBAAiB;EACjB,OAAO;EACP;MACI;qBAEO,mBAAmB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PersistedClient } from "./persist.js";
|
|
2
2
|
//#region src/retryStrategies.d.ts
|
|
3
|
-
type PersistRetryer = (props: {
|
|
3
|
+
export type PersistRetryer = (props: {
|
|
4
4
|
persistedClient: PersistedClient;
|
|
5
5
|
error: Error;
|
|
6
6
|
errorCount: number;
|
|
7
7
|
}) => PersistedClient | undefined;
|
|
8
|
-
declare const removeOldestQuery: PersistRetryer;
|
|
8
|
+
export declare const removeOldestQuery: PersistRetryer;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { PersistRetryer, removeOldestQuery };
|
|
11
10
|
//# sourceMappingURL=retryStrategies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryStrategies.d.ts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"retryStrategies.d.ts","names":[],"sources":["../../src/retryStrategies.ts"],"mappings":";;YAEY,kBAAkB;EAC5B,iBAAiB;EACjB,OAAO;EACP;MACI;qBAEO,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-persist-client-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.104.0",
|
|
4
4
|
"description": "Set of utilities for interacting with persisters, which can save your queryClient for later use",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"!src/__tests__"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@tanstack/query-core": "5.
|
|
43
|
+
"@tanstack/query-core": "5.104.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"@tanstack/query-test-utils": "0.0.0",
|
|
47
|
+
"npm-run-all2": "^9.0.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"clean": "premove ./build ./coverage ./dist-ts ./.cache/test-types",
|