@tanstack/react-query-persist-client 4.0.0 → 4.0.2
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/cjs/react-query/build/esm/index.js +301 -0
- package/build/cjs/react-query/build/esm/index.js.map +1 -0
- package/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js +3 -3
- package/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js.map +1 -1
- package/build/esm/index.js +269 -9
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats.json +249 -0
- package/build/types/packages/query-core/src/focusManager.d.ts +16 -0
- package/build/types/packages/query-core/src/hydration.d.ts +34 -0
- package/build/types/packages/query-core/src/index.d.ts +20 -0
- package/build/types/packages/query-core/src/infiniteQueryBehavior.d.ts +15 -0
- package/build/types/packages/query-core/src/infiniteQueryObserver.d.ts +18 -0
- package/build/types/packages/query-core/src/logger.d.ts +8 -0
- package/build/types/packages/query-core/src/mutation.d.ts +70 -0
- package/build/types/packages/query-core/src/mutationCache.d.ts +52 -0
- package/build/types/packages/query-core/src/mutationObserver.d.ts +23 -0
- package/build/types/packages/query-core/src/notifyManager.d.ts +18 -0
- package/build/types/packages/query-core/src/onlineManager.d.ts +16 -0
- package/build/types/packages/query-core/src/queriesObserver.d.ts +23 -0
- package/build/types/packages/query-core/src/query.d.ts +119 -0
- package/build/types/packages/query-core/src/queryCache.d.ts +59 -0
- package/build/types/packages/query-core/src/queryClient.d.ts +65 -0
- package/build/types/packages/query-core/src/queryObserver.d.ts +61 -0
- package/build/types/packages/query-core/src/removable.d.ts +9 -0
- package/build/types/packages/query-core/src/retryer.d.ts +33 -0
- package/build/types/packages/query-core/src/subscribable.d.ts +10 -0
- package/build/types/packages/query-core/src/types.d.ts +417 -0
- package/build/types/packages/query-core/src/utils.d.ts +99 -0
- package/build/types/packages/react-query/src/Hydrate.d.ts +10 -0
- package/build/types/packages/react-query/src/QueryClientProvider.d.ts +24 -0
- package/build/types/packages/react-query/src/QueryErrorResetBoundary.d.ts +12 -0
- package/build/types/packages/react-query/src/index.d.ts +17 -0
- package/build/types/packages/react-query/src/isRestoring.d.ts +3 -0
- package/build/types/packages/react-query/src/reactBatchedUpdates.d.ts +2 -0
- package/build/types/packages/react-query/src/setBatchUpdatesFn.d.ts +1 -0
- package/build/types/packages/react-query/src/types.d.ts +35 -0
- package/build/types/packages/react-query/src/useBaseQuery.d.ts +3 -0
- package/build/types/packages/react-query/src/useInfiniteQuery.d.ts +5 -0
- package/build/types/packages/react-query/src/useIsFetching.d.ts +7 -0
- package/build/types/packages/react-query/src/useIsMutating.d.ts +7 -0
- package/build/types/packages/react-query/src/useMutation.d.ts +6 -0
- package/build/types/packages/react-query/src/useQueries.d.ts +49 -0
- package/build/types/packages/react-query/src/useQuery.d.ts +20 -0
- package/build/types/packages/react-query/src/utils.d.ts +1 -0
- package/build/types/packages/react-query-persist-client/src/PersistQueryClientProvider.d.ts +8 -0
- package/build/types/packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.d.ts +1 -0
- package/build/types/packages/react-query-persist-client/src/__tests__/persist.test.d.ts +1 -0
- package/build/types/packages/react-query-persist-client/src/index.d.ts +3 -0
- package/build/types/packages/react-query-persist-client/src/persist.d.ts +58 -0
- package/build/types/packages/react-query-persist-client/src/retryStrategies.d.ts +7 -0
- package/build/types/tests/utils.d.ts +24 -0
- package/build/umd/index.development.js +274 -14
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +22 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -3
- package/build/cjs/PersistQueryClientProvider.js +0 -83
- package/build/cjs/PersistQueryClientProvider.js.map +0 -1
- package/build/cjs/index.js +0 -27
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/persist.js +0 -119
- package/build/cjs/persist.js.map +0 -1
- package/build/cjs/retryStrategies.js +0 -39
- package/build/cjs/retryStrategies.js.map +0 -1
package/build/stats-html.html
CHANGED
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"query-core/build/esm/index.js","uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"query-core/build/esm/index.js","uid":"00f1-265"},{"name":"react-query-persist-client/src","children":[{"uid":"00f1-267","name":"persist.ts"},{"uid":"00f1-273","name":"PersistQueryClientProvider.tsx"},{"uid":"00f1-275","name":"retryStrategies.ts"},{"uid":"00f1-277","name":"index.ts"}]},{"name":"react-query/build/esm/index.js","uid":"00f1-271"}]},{"uid":"00f1-269","name":"\u0000rollupPluginBabelHelpers.js"}]}],"isRoot":true},"nodeParts":{"00f1-265":{"renderedLength":7970,"gzipLength":1872,"brotliLength":0,"mainUid":"00f1-264"},"00f1-267":{"renderedLength":2704,"gzipLength":803,"brotliLength":0,"mainUid":"00f1-266"},"00f1-269":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"00f1-268"},"00f1-271":{"renderedLength":6581,"gzipLength":1582,"brotliLength":0,"mainUid":"00f1-270"},"00f1-273":{"renderedLength":1146,"gzipLength":425,"brotliLength":0,"mainUid":"00f1-272"},"00f1-275":{"renderedLength":687,"gzipLength":306,"brotliLength":0,"mainUid":"00f1-274"},"00f1-277":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"00f1-276"}},"nodeMetas":{"00f1-264":{"id":"/packages/query-core/build/esm/index.js","moduleParts":{"index.production.js":"00f1-265"},"imported":[],"importedBy":[{"uid":"00f1-266"}]},"00f1-266":{"id":"/packages/react-query-persist-client/src/persist.ts","moduleParts":{"index.production.js":"00f1-267"},"imported":[{"uid":"00f1-264"}],"importedBy":[{"uid":"00f1-276"},{"uid":"00f1-272"}]},"00f1-268":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"00f1-269"},"imported":[],"importedBy":[{"uid":"00f1-272"}]},"00f1-270":{"id":"/packages/react-query/build/esm/index.js","moduleParts":{"index.production.js":"00f1-271"},"imported":[{"uid":"00f1-278"},{"uid":"00f1-279"}],"importedBy":[{"uid":"00f1-272"}]},"00f1-272":{"id":"/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx","moduleParts":{"index.production.js":"00f1-273"},"imported":[{"uid":"00f1-268"},{"uid":"00f1-278"},{"uid":"00f1-266"},{"uid":"00f1-270"}],"importedBy":[{"uid":"00f1-276"}]},"00f1-274":{"id":"/packages/react-query-persist-client/src/retryStrategies.ts","moduleParts":{"index.production.js":"00f1-275"},"imported":[],"importedBy":[{"uid":"00f1-276"}]},"00f1-276":{"id":"/packages/react-query-persist-client/src/index.ts","moduleParts":{"index.production.js":"00f1-277"},"imported":[{"uid":"00f1-266"},{"uid":"00f1-272"},{"uid":"00f1-274"}],"importedBy":[],"isEntry":true},"00f1-278":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"00f1-272"},{"uid":"00f1-270"}],"isExternal":true},"00f1-279":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"00f1-270"}],"isExternal":true}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats.json
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"tree": {
|
|
4
|
+
"name": "root",
|
|
5
|
+
"children": [
|
|
6
|
+
{
|
|
7
|
+
"name": "index.production.js",
|
|
8
|
+
"children": [
|
|
9
|
+
{
|
|
10
|
+
"name": "packages",
|
|
11
|
+
"children": [
|
|
12
|
+
{
|
|
13
|
+
"name": "query-core/build/esm/index.js",
|
|
14
|
+
"uid": "00f1-281"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "react-query-persist-client/src",
|
|
18
|
+
"children": [
|
|
19
|
+
{
|
|
20
|
+
"uid": "00f1-283",
|
|
21
|
+
"name": "persist.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"uid": "00f1-289",
|
|
25
|
+
"name": "PersistQueryClientProvider.tsx"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"uid": "00f1-291",
|
|
29
|
+
"name": "retryStrategies.ts"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"uid": "00f1-293",
|
|
33
|
+
"name": "index.ts"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "react-query/build/esm/index.js",
|
|
39
|
+
"uid": "00f1-287"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"uid": "00f1-285",
|
|
45
|
+
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"isRoot": true
|
|
51
|
+
},
|
|
52
|
+
"nodeParts": {
|
|
53
|
+
"00f1-281": {
|
|
54
|
+
"renderedLength": 7970,
|
|
55
|
+
"gzipLength": 1872,
|
|
56
|
+
"brotliLength": 0,
|
|
57
|
+
"mainUid": "00f1-280"
|
|
58
|
+
},
|
|
59
|
+
"00f1-283": {
|
|
60
|
+
"renderedLength": 2704,
|
|
61
|
+
"gzipLength": 803,
|
|
62
|
+
"brotliLength": 0,
|
|
63
|
+
"mainUid": "00f1-282"
|
|
64
|
+
},
|
|
65
|
+
"00f1-285": {
|
|
66
|
+
"renderedLength": 431,
|
|
67
|
+
"gzipLength": 240,
|
|
68
|
+
"brotliLength": 0,
|
|
69
|
+
"mainUid": "00f1-284"
|
|
70
|
+
},
|
|
71
|
+
"00f1-287": {
|
|
72
|
+
"renderedLength": 6581,
|
|
73
|
+
"gzipLength": 1582,
|
|
74
|
+
"brotliLength": 0,
|
|
75
|
+
"mainUid": "00f1-286"
|
|
76
|
+
},
|
|
77
|
+
"00f1-289": {
|
|
78
|
+
"renderedLength": 1146,
|
|
79
|
+
"gzipLength": 425,
|
|
80
|
+
"brotliLength": 0,
|
|
81
|
+
"mainUid": "00f1-288"
|
|
82
|
+
},
|
|
83
|
+
"00f1-291": {
|
|
84
|
+
"renderedLength": 687,
|
|
85
|
+
"gzipLength": 306,
|
|
86
|
+
"brotliLength": 0,
|
|
87
|
+
"mainUid": "00f1-290"
|
|
88
|
+
},
|
|
89
|
+
"00f1-293": {
|
|
90
|
+
"renderedLength": 0,
|
|
91
|
+
"gzipLength": 0,
|
|
92
|
+
"brotliLength": 0,
|
|
93
|
+
"mainUid": "00f1-292"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"nodeMetas": {
|
|
97
|
+
"00f1-280": {
|
|
98
|
+
"id": "/packages/query-core/build/esm/index.js",
|
|
99
|
+
"moduleParts": {
|
|
100
|
+
"index.production.js": "00f1-281"
|
|
101
|
+
},
|
|
102
|
+
"imported": [],
|
|
103
|
+
"importedBy": [
|
|
104
|
+
{
|
|
105
|
+
"uid": "00f1-282"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"00f1-282": {
|
|
110
|
+
"id": "/packages/react-query-persist-client/src/persist.ts",
|
|
111
|
+
"moduleParts": {
|
|
112
|
+
"index.production.js": "00f1-283"
|
|
113
|
+
},
|
|
114
|
+
"imported": [
|
|
115
|
+
{
|
|
116
|
+
"uid": "00f1-280"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"importedBy": [
|
|
120
|
+
{
|
|
121
|
+
"uid": "00f1-292"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"uid": "00f1-288"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"00f1-284": {
|
|
129
|
+
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
130
|
+
"moduleParts": {
|
|
131
|
+
"index.production.js": "00f1-285"
|
|
132
|
+
},
|
|
133
|
+
"imported": [],
|
|
134
|
+
"importedBy": [
|
|
135
|
+
{
|
|
136
|
+
"uid": "00f1-288"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"00f1-286": {
|
|
141
|
+
"id": "/packages/react-query/build/esm/index.js",
|
|
142
|
+
"moduleParts": {
|
|
143
|
+
"index.production.js": "00f1-287"
|
|
144
|
+
},
|
|
145
|
+
"imported": [
|
|
146
|
+
{
|
|
147
|
+
"uid": "00f1-294"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"uid": "00f1-295"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"importedBy": [
|
|
154
|
+
{
|
|
155
|
+
"uid": "00f1-288"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"00f1-288": {
|
|
160
|
+
"id": "/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx",
|
|
161
|
+
"moduleParts": {
|
|
162
|
+
"index.production.js": "00f1-289"
|
|
163
|
+
},
|
|
164
|
+
"imported": [
|
|
165
|
+
{
|
|
166
|
+
"uid": "00f1-284"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"uid": "00f1-294"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"uid": "00f1-282"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"uid": "00f1-286"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"importedBy": [
|
|
179
|
+
{
|
|
180
|
+
"uid": "00f1-292"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"00f1-290": {
|
|
185
|
+
"id": "/packages/react-query-persist-client/src/retryStrategies.ts",
|
|
186
|
+
"moduleParts": {
|
|
187
|
+
"index.production.js": "00f1-291"
|
|
188
|
+
},
|
|
189
|
+
"imported": [],
|
|
190
|
+
"importedBy": [
|
|
191
|
+
{
|
|
192
|
+
"uid": "00f1-292"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"00f1-292": {
|
|
197
|
+
"id": "/packages/react-query-persist-client/src/index.ts",
|
|
198
|
+
"moduleParts": {
|
|
199
|
+
"index.production.js": "00f1-293"
|
|
200
|
+
},
|
|
201
|
+
"imported": [
|
|
202
|
+
{
|
|
203
|
+
"uid": "00f1-282"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"uid": "00f1-288"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"uid": "00f1-290"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"importedBy": [],
|
|
213
|
+
"isEntry": true
|
|
214
|
+
},
|
|
215
|
+
"00f1-294": {
|
|
216
|
+
"id": "react",
|
|
217
|
+
"moduleParts": {},
|
|
218
|
+
"imported": [],
|
|
219
|
+
"importedBy": [
|
|
220
|
+
{
|
|
221
|
+
"uid": "00f1-288"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"uid": "00f1-286"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"isExternal": true
|
|
228
|
+
},
|
|
229
|
+
"00f1-295": {
|
|
230
|
+
"id": "use-sync-external-store/shim",
|
|
231
|
+
"moduleParts": {},
|
|
232
|
+
"imported": [],
|
|
233
|
+
"importedBy": [
|
|
234
|
+
{
|
|
235
|
+
"uid": "00f1-286"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"isExternal": true
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"env": {
|
|
242
|
+
"rollup": "2.76.0"
|
|
243
|
+
},
|
|
244
|
+
"options": {
|
|
245
|
+
"gzip": true,
|
|
246
|
+
"brotli": false,
|
|
247
|
+
"sourcemap": false
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Subscribable } from './subscribable';
|
|
2
|
+
declare type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined;
|
|
3
|
+
export declare class FocusManager extends Subscribable {
|
|
4
|
+
private focused?;
|
|
5
|
+
private cleanup?;
|
|
6
|
+
private setup;
|
|
7
|
+
constructor();
|
|
8
|
+
protected onSubscribe(): void;
|
|
9
|
+
protected onUnsubscribe(): void;
|
|
10
|
+
setEventListener(setup: SetupFn): void;
|
|
11
|
+
setFocused(focused?: boolean): void;
|
|
12
|
+
onFocus(): void;
|
|
13
|
+
isFocused(): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const focusManager: FocusManager;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { QueryClient } from './queryClient';
|
|
2
|
+
import type { Query, QueryState } from './query';
|
|
3
|
+
import type { MutationKey, MutationOptions, QueryKey, QueryOptions } from './types';
|
|
4
|
+
import type { Mutation, MutationState } from './mutation';
|
|
5
|
+
export interface DehydrateOptions {
|
|
6
|
+
dehydrateMutations?: boolean;
|
|
7
|
+
dehydrateQueries?: boolean;
|
|
8
|
+
shouldDehydrateMutation?: ShouldDehydrateMutationFunction;
|
|
9
|
+
shouldDehydrateQuery?: ShouldDehydrateQueryFunction;
|
|
10
|
+
}
|
|
11
|
+
export interface HydrateOptions {
|
|
12
|
+
defaultOptions?: {
|
|
13
|
+
queries?: QueryOptions;
|
|
14
|
+
mutations?: MutationOptions;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface DehydratedMutation {
|
|
18
|
+
mutationKey?: MutationKey;
|
|
19
|
+
state: MutationState;
|
|
20
|
+
}
|
|
21
|
+
interface DehydratedQuery {
|
|
22
|
+
queryHash: string;
|
|
23
|
+
queryKey: QueryKey;
|
|
24
|
+
state: QueryState;
|
|
25
|
+
}
|
|
26
|
+
export interface DehydratedState {
|
|
27
|
+
mutations: DehydratedMutation[];
|
|
28
|
+
queries: DehydratedQuery[];
|
|
29
|
+
}
|
|
30
|
+
export declare type ShouldDehydrateQueryFunction = (query: Query) => boolean;
|
|
31
|
+
export declare type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean;
|
|
32
|
+
export declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState;
|
|
33
|
+
export declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { CancelledError } from './retryer';
|
|
2
|
+
export { QueryCache } from './queryCache';
|
|
3
|
+
export { QueryClient } from './queryClient';
|
|
4
|
+
export { QueryObserver } from './queryObserver';
|
|
5
|
+
export { QueriesObserver } from './queriesObserver';
|
|
6
|
+
export { InfiniteQueryObserver } from './infiniteQueryObserver';
|
|
7
|
+
export { MutationCache } from './mutationCache';
|
|
8
|
+
export { MutationObserver } from './mutationObserver';
|
|
9
|
+
export { notifyManager } from './notifyManager';
|
|
10
|
+
export { focusManager } from './focusManager';
|
|
11
|
+
export { onlineManager } from './onlineManager';
|
|
12
|
+
export { hashQueryKey, isError, parseQueryArgs, parseFilterArgs, parseMutationFilterArgs, parseMutationArgs, } from './utils';
|
|
13
|
+
export type { MutationFilters, QueryFilters } from './utils';
|
|
14
|
+
export { isCancelledError } from './retryer';
|
|
15
|
+
export { dehydrate, hydrate } from './hydration';
|
|
16
|
+
export * from './types';
|
|
17
|
+
export type { Query } from './query';
|
|
18
|
+
export type { Mutation } from './mutation';
|
|
19
|
+
export type { Logger } from './logger';
|
|
20
|
+
export type { DehydrateOptions, DehydratedState, HydrateOptions, ShouldDehydrateMutationFunction, ShouldDehydrateQueryFunction, } from './hydration';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { QueryBehavior } from './query';
|
|
2
|
+
import type { InfiniteData, QueryOptions } from './types';
|
|
3
|
+
export declare function infiniteQueryBehavior<TQueryFnData, TError, TData>(): QueryBehavior<TQueryFnData, TError, InfiniteData<TData>>;
|
|
4
|
+
export declare function getNextPageParam(options: QueryOptions<any, any>, pages: unknown[]): unknown | undefined;
|
|
5
|
+
export declare function getPreviousPageParam(options: QueryOptions<any, any>, pages: unknown[]): unknown | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if there is a next page.
|
|
8
|
+
* Returns `undefined` if it cannot be determined.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hasNextPage(options: QueryOptions<any, any, any, any>, pages?: unknown): boolean | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if there is a previous page.
|
|
13
|
+
* Returns `undefined` if it cannot be determined.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasPreviousPage(options: QueryOptions<any, any, any, any>, pages?: unknown): boolean | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DefaultedInfiniteQueryObserverOptions, FetchNextPageOptions, FetchPreviousPageOptions, InfiniteData, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, QueryKey } from './types';
|
|
2
|
+
import type { QueryClient } from './queryClient';
|
|
3
|
+
import { NotifyOptions, ObserverFetchOptions, QueryObserver } from './queryObserver';
|
|
4
|
+
import { Query } from './query';
|
|
5
|
+
declare type InfiniteQueryObserverListener<TData, TError> = (result: InfiniteQueryObserverResult<TData, TError>) => void;
|
|
6
|
+
export declare class InfiniteQueryObserver<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserver<TQueryFnData, TError, InfiniteData<TData>, InfiniteData<TQueryData>, TQueryKey> {
|
|
7
|
+
subscribe: (listener?: InfiniteQueryObserverListener<TData, TError>) => () => void;
|
|
8
|
+
getCurrentResult: () => InfiniteQueryObserverResult<TData, TError>;
|
|
9
|
+
protected fetch: (fetchOptions: ObserverFetchOptions) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
|
10
|
+
constructor(client: QueryClient, options: InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>);
|
|
11
|
+
protected bindMethods(): void;
|
|
12
|
+
setOptions(options?: InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, notifyOptions?: NotifyOptions): void;
|
|
13
|
+
getOptimisticResult(options: DefaultedInfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>): InfiniteQueryObserverResult<TData, TError>;
|
|
14
|
+
fetchNextPage({ pageParam, ...options }?: FetchNextPageOptions): Promise<InfiniteQueryObserverResult<TData, TError>>;
|
|
15
|
+
fetchPreviousPage({ pageParam, ...options }?: FetchPreviousPageOptions): Promise<InfiniteQueryObserverResult<TData, TError>>;
|
|
16
|
+
protected createResult(query: Query<TQueryFnData, TError, InfiniteData<TQueryData>, TQueryKey>, options: InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>): InfiniteQueryObserverResult<TData, TError>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MutationOptions, MutationStatus, MutationMeta } from './types';
|
|
2
|
+
import type { MutationCache } from './mutationCache';
|
|
3
|
+
import type { MutationObserver } from './mutationObserver';
|
|
4
|
+
import { Logger } from './logger';
|
|
5
|
+
import { Removable } from './removable';
|
|
6
|
+
interface MutationConfig<TData, TError, TVariables, TContext> {
|
|
7
|
+
mutationId: number;
|
|
8
|
+
mutationCache: MutationCache;
|
|
9
|
+
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
10
|
+
logger?: Logger;
|
|
11
|
+
defaultOptions?: MutationOptions<TData, TError, TVariables, TContext>;
|
|
12
|
+
state?: MutationState<TData, TError, TVariables, TContext>;
|
|
13
|
+
meta?: MutationMeta;
|
|
14
|
+
}
|
|
15
|
+
export interface MutationState<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> {
|
|
16
|
+
context: TContext | undefined;
|
|
17
|
+
data: TData | undefined;
|
|
18
|
+
error: TError | null;
|
|
19
|
+
failureCount: number;
|
|
20
|
+
isPaused: boolean;
|
|
21
|
+
status: MutationStatus;
|
|
22
|
+
variables: TVariables | undefined;
|
|
23
|
+
}
|
|
24
|
+
interface FailedAction {
|
|
25
|
+
type: 'failed';
|
|
26
|
+
}
|
|
27
|
+
interface LoadingAction<TVariables, TContext> {
|
|
28
|
+
type: 'loading';
|
|
29
|
+
variables?: TVariables;
|
|
30
|
+
context?: TContext;
|
|
31
|
+
}
|
|
32
|
+
interface SuccessAction<TData> {
|
|
33
|
+
type: 'success';
|
|
34
|
+
data: TData;
|
|
35
|
+
}
|
|
36
|
+
interface ErrorAction<TError> {
|
|
37
|
+
type: 'error';
|
|
38
|
+
error: TError;
|
|
39
|
+
}
|
|
40
|
+
interface PauseAction {
|
|
41
|
+
type: 'pause';
|
|
42
|
+
}
|
|
43
|
+
interface ContinueAction {
|
|
44
|
+
type: 'continue';
|
|
45
|
+
}
|
|
46
|
+
interface SetStateAction<TData, TError, TVariables, TContext> {
|
|
47
|
+
type: 'setState';
|
|
48
|
+
state: MutationState<TData, TError, TVariables, TContext>;
|
|
49
|
+
}
|
|
50
|
+
export declare type Action<TData, TError, TVariables, TContext> = ContinueAction | ErrorAction<TError> | FailedAction | LoadingAction<TVariables, TContext> | PauseAction | SetStateAction<TData, TError, TVariables, TContext> | SuccessAction<TData>;
|
|
51
|
+
export declare class Mutation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> extends Removable {
|
|
52
|
+
state: MutationState<TData, TError, TVariables, TContext>;
|
|
53
|
+
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
54
|
+
mutationId: number;
|
|
55
|
+
meta: MutationMeta | undefined;
|
|
56
|
+
private observers;
|
|
57
|
+
private mutationCache;
|
|
58
|
+
private logger;
|
|
59
|
+
private retryer?;
|
|
60
|
+
constructor(config: MutationConfig<TData, TError, TVariables, TContext>);
|
|
61
|
+
setState(state: MutationState<TData, TError, TVariables, TContext>): void;
|
|
62
|
+
addObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
63
|
+
removeObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
64
|
+
protected optionalRemove(): void;
|
|
65
|
+
continue(): Promise<TData>;
|
|
66
|
+
execute(): Promise<TData>;
|
|
67
|
+
private dispatch;
|
|
68
|
+
}
|
|
69
|
+
export declare function getDefaultState<TData, TError, TVariables, TContext>(): MutationState<TData, TError, TVariables, TContext>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { MutationObserver } from './mutationObserver';
|
|
2
|
+
import type { MutationOptions } from './types';
|
|
3
|
+
import type { QueryClient } from './queryClient';
|
|
4
|
+
import { Action, Mutation, MutationState } from './mutation';
|
|
5
|
+
import { MutationFilters } from './utils';
|
|
6
|
+
import { Subscribable } from './subscribable';
|
|
7
|
+
interface MutationCacheConfig {
|
|
8
|
+
onError?: (error: unknown, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => void;
|
|
9
|
+
onSuccess?: (data: unknown, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => void;
|
|
10
|
+
onMutate?: (variables: unknown, mutation: Mutation<unknown, unknown, unknown, unknown>) => void;
|
|
11
|
+
}
|
|
12
|
+
interface NotifyEventMutationAdded {
|
|
13
|
+
type: 'added';
|
|
14
|
+
mutation: Mutation<any, any, any, any>;
|
|
15
|
+
}
|
|
16
|
+
interface NotifyEventMutationRemoved {
|
|
17
|
+
type: 'removed';
|
|
18
|
+
mutation: Mutation<any, any, any, any>;
|
|
19
|
+
}
|
|
20
|
+
interface NotifyEventMutationObserverAdded {
|
|
21
|
+
type: 'observerAdded';
|
|
22
|
+
mutation: Mutation<any, any, any, any>;
|
|
23
|
+
observer: MutationObserver<any, any, any>;
|
|
24
|
+
}
|
|
25
|
+
interface NotifyEventMutationObserverRemoved {
|
|
26
|
+
type: 'observerRemoved';
|
|
27
|
+
mutation: Mutation<any, any, any, any>;
|
|
28
|
+
observer: MutationObserver<any, any, any>;
|
|
29
|
+
}
|
|
30
|
+
interface NotifyEventMutationUpdated {
|
|
31
|
+
type: 'updated';
|
|
32
|
+
mutation: Mutation<any, any, any, any>;
|
|
33
|
+
action: Action<any, any, any, any>;
|
|
34
|
+
}
|
|
35
|
+
declare type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationUpdated;
|
|
36
|
+
declare type MutationCacheListener = (event: MutationCacheNotifyEvent) => void;
|
|
37
|
+
export declare class MutationCache extends Subscribable<MutationCacheListener> {
|
|
38
|
+
config: MutationCacheConfig;
|
|
39
|
+
private mutations;
|
|
40
|
+
private mutationId;
|
|
41
|
+
constructor(config?: MutationCacheConfig);
|
|
42
|
+
build<TData, TError, TVariables, TContext>(client: QueryClient, options: MutationOptions<TData, TError, TVariables, TContext>, state?: MutationState<TData, TError, TVariables, TContext>): Mutation<TData, TError, TVariables, TContext>;
|
|
43
|
+
add(mutation: Mutation<any, any, any, any>): void;
|
|
44
|
+
remove(mutation: Mutation<any, any, any, any>): void;
|
|
45
|
+
clear(): void;
|
|
46
|
+
getAll(): Mutation[];
|
|
47
|
+
find<TData = unknown, TError = unknown, TVariables = any, TContext = unknown>(filters: MutationFilters): Mutation<TData, TError, TVariables, TContext> | undefined;
|
|
48
|
+
findAll(filters: MutationFilters): Mutation[];
|
|
49
|
+
notify(event: MutationCacheNotifyEvent): void;
|
|
50
|
+
resumePausedMutations(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from './mutation';
|
|
2
|
+
import type { QueryClient } from './queryClient';
|
|
3
|
+
import { Subscribable } from './subscribable';
|
|
4
|
+
import type { MutateOptions, MutationObserverResult, MutationObserverOptions } from './types';
|
|
5
|
+
declare type MutationObserverListener<TData, TError, TVariables, TContext> = (result: MutationObserverResult<TData, TError, TVariables, TContext>) => void;
|
|
6
|
+
export declare class MutationObserver<TData = unknown, TError = unknown, TVariables = void, TContext = unknown> extends Subscribable<MutationObserverListener<TData, TError, TVariables, TContext>> {
|
|
7
|
+
options: MutationObserverOptions<TData, TError, TVariables, TContext>;
|
|
8
|
+
private client;
|
|
9
|
+
private currentResult;
|
|
10
|
+
private currentMutation?;
|
|
11
|
+
private mutateOptions?;
|
|
12
|
+
constructor(client: QueryClient, options: MutationObserverOptions<TData, TError, TVariables, TContext>);
|
|
13
|
+
protected bindMethods(): void;
|
|
14
|
+
setOptions(options?: MutationObserverOptions<TData, TError, TVariables, TContext>): void;
|
|
15
|
+
protected onUnsubscribe(): void;
|
|
16
|
+
onMutationUpdate(action: Action<TData, TError, TVariables, TContext>): void;
|
|
17
|
+
getCurrentResult(): MutationObserverResult<TData, TError, TVariables, TContext>;
|
|
18
|
+
reset(): void;
|
|
19
|
+
mutate(variables?: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>): Promise<TData>;
|
|
20
|
+
private updateResult;
|
|
21
|
+
private notify;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare type NotifyCallback = () => void;
|
|
2
|
+
declare type NotifyFunction = (callback: () => void) => void;
|
|
3
|
+
declare type BatchNotifyFunction = (callback: () => void) => void;
|
|
4
|
+
export declare function createNotifyManager(): {
|
|
5
|
+
readonly batch: <T>(callback: () => T) => T;
|
|
6
|
+
readonly batchCalls: <T_1 extends Function>(callback: T_1) => T_1;
|
|
7
|
+
readonly schedule: (callback: NotifyCallback) => void;
|
|
8
|
+
readonly setNotifyFunction: (fn: NotifyFunction) => void;
|
|
9
|
+
readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const notifyManager: {
|
|
12
|
+
readonly batch: <T>(callback: () => T) => T;
|
|
13
|
+
readonly batchCalls: <T_1 extends Function>(callback: T_1) => T_1;
|
|
14
|
+
readonly schedule: (callback: NotifyCallback) => void;
|
|
15
|
+
readonly setNotifyFunction: (fn: NotifyFunction) => void;
|
|
16
|
+
readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Subscribable } from './subscribable';
|
|
2
|
+
declare type SetupFn = (setOnline: (online?: boolean) => void) => (() => void) | undefined;
|
|
3
|
+
export declare class OnlineManager extends Subscribable {
|
|
4
|
+
private online?;
|
|
5
|
+
private cleanup?;
|
|
6
|
+
private setup;
|
|
7
|
+
constructor();
|
|
8
|
+
protected onSubscribe(): void;
|
|
9
|
+
protected onUnsubscribe(): void;
|
|
10
|
+
setEventListener(setup: SetupFn): void;
|
|
11
|
+
setOnline(online?: boolean): void;
|
|
12
|
+
onOnline(): void;
|
|
13
|
+
isOnline(): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const onlineManager: OnlineManager;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { QueryObserverOptions, QueryObserverResult } from './types';
|
|
2
|
+
import type { QueryClient } from './queryClient';
|
|
3
|
+
import { NotifyOptions } from './queryObserver';
|
|
4
|
+
import { Subscribable } from './subscribable';
|
|
5
|
+
declare type QueriesObserverListener = (result: QueryObserverResult[]) => void;
|
|
6
|
+
export declare class QueriesObserver extends Subscribable<QueriesObserverListener> {
|
|
7
|
+
private client;
|
|
8
|
+
private result;
|
|
9
|
+
private queries;
|
|
10
|
+
private observers;
|
|
11
|
+
private observersMap;
|
|
12
|
+
constructor(client: QueryClient, queries?: QueryObserverOptions[]);
|
|
13
|
+
protected onSubscribe(): void;
|
|
14
|
+
protected onUnsubscribe(): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
setQueries(queries: QueryObserverOptions[], notifyOptions?: NotifyOptions): void;
|
|
17
|
+
getCurrentResult(): QueryObserverResult[];
|
|
18
|
+
getOptimisticResult(queries: QueryObserverOptions[]): QueryObserverResult[];
|
|
19
|
+
private findMatchingObservers;
|
|
20
|
+
private onUpdate;
|
|
21
|
+
private notify;
|
|
22
|
+
}
|
|
23
|
+
export {};
|