@farcaster/create-mini-app 0.0.7 → 0.0.8
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +7 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +20 -2
- package/dist/init.js.map +1 -1
- package/init.ts +22 -2
- package/package.json +3 -1
- package/templates/default/README.md +19 -0
- package/asd/README.md +0 -1
- package/asd/biome.json +0 -13
- package/asd/index.html +0 -12
- package/asd/package.json +0 -30
- package/asd/public/.well-known/farcaster.json +0 -1
- package/asd/src/App.tsx +0 -67
- package/asd/src/index.css +0 -21
- package/asd/src/main.tsx +0 -21
- package/asd/src/vite-env.d.ts +0 -1
- package/asd/src/wagmi.ts +0 -18
- package/asd/tsconfig.json +0 -25
- package/asd/tsconfig.node.json +0 -10
- package/asd/vite.config.ts +0 -10
- package/templates/default/node_modules/.bin/biome +0 -17
- package/templates/default/node_modules/.bin/browserslist +0 -17
- package/templates/default/node_modules/.bin/esbuild +0 -17
- package/templates/default/node_modules/.bin/terser +0 -17
- package/templates/default/node_modules/.bin/tsc +0 -17
- package/templates/default/node_modules/.bin/tsserver +0 -17
- package/templates/default/node_modules/.bin/vite +0 -17
- package/templates/default/node_modules/.bin/wagmi +0 -17
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js +0 -84
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-sdk.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js +0 -1936
- package/templates/default/node_modules/.vite/deps/@farcaster_frame-wagmi-connector.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js +0 -96
- package/templates/default/node_modules/.vite/deps/@tanstack_react-query.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/_metadata.json +0 -139
- package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js +0 -17
- package/templates/default/node_modules/.vite/deps/ccip-JTEXJDV5.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js +0 -14
- package/templates/default/node_modules/.vite/deps/ccip-LLOJAQYN.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js +0 -2601
- package/templates/default/node_modules/.vite/deps/chunk-2KW72IQL.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js +0 -286
- package/templates/default/node_modules/.vite/deps/chunk-2ULAEEW3.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js +0 -1906
- package/templates/default/node_modules/.vite/deps/chunk-3MMZATWV.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js +0 -3183
- package/templates/default/node_modules/.vite/deps/chunk-6WYSWNQJ.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js +0 -21628
- package/templates/default/node_modules/.vite/deps/chunk-AJPHOYQK.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js +0 -2221
- package/templates/default/node_modules/.vite/deps/chunk-HP7M7ER3.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js +0 -928
- package/templates/default/node_modules/.vite/deps/chunk-JDAHWTZP.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js +0 -58
- package/templates/default/node_modules/.vite/deps/chunk-OOB7NECH.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js +0 -190
- package/templates/default/node_modules/.vite/deps/chunk-OYL52S4H.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js +0 -1085
- package/templates/default/node_modules/.vite/deps/chunk-P2SCV6N5.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js +0 -3246
- package/templates/default/node_modules/.vite/deps/chunk-P727YSDY.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js +0 -278
- package/templates/default/node_modules/.vite/deps/chunk-PH77EFIP.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js +0 -4416
- package/templates/default/node_modules/.vite/deps/chunk-PK65EOOR.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js +0 -36187
- package/templates/default/node_modules/.vite/deps/chunk-PPRY4ZGR.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js +0 -832
- package/templates/default/node_modules/.vite/deps/chunk-Q3UTC4SW.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js +0 -815
- package/templates/default/node_modules/.vite/deps/chunk-R2PSY44V.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js +0 -60
- package/templates/default/node_modules/.vite/deps/chunk-WOOG5QLI.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js +0 -21
- package/templates/default/node_modules/.vite/deps/native-J7PVLWWX.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js +0 -21
- package/templates/default/node_modules/.vite/deps/native-UTGEKOTD.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/package.json +0 -3
- package/templates/default/node_modules/.vite/deps/react-dom.js +0 -7
- package/templates/default/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react-dom_client.js +0 -39
- package/templates/default/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react.js +0 -6
- package/templates/default/node_modules/.vite/deps/react.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
- package/templates/default/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
- package/templates/default/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js +0 -14
- package/templates/default/node_modules/.vite/deps/secp256k1-HB6OVCEM.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js +0 -16
- package/templates/default/node_modules/.vite/deps/secp256k1-YI5SRKAE.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/wagmi.js +0 -12147
- package/templates/default/node_modules/.vite/deps/wagmi.js.map +0 -7
- package/templates/default/node_modules/.vite/deps/wagmi_chains.js +0 -16355
- package/templates/default/node_modules/.vite/deps/wagmi_chains.js.map +0 -7
|
@@ -1,3183 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
require_jsx_runtime
|
|
3
|
-
} from "./chunk-JDAHWTZP.js";
|
|
4
|
-
import {
|
|
5
|
-
require_react
|
|
6
|
-
} from "./chunk-3MMZATWV.js";
|
|
7
|
-
import {
|
|
8
|
-
__privateAdd,
|
|
9
|
-
__privateGet,
|
|
10
|
-
__privateMethod,
|
|
11
|
-
__privateSet,
|
|
12
|
-
__privateWrapper,
|
|
13
|
-
__toESM
|
|
14
|
-
} from "./chunk-WOOG5QLI.js";
|
|
15
|
-
|
|
16
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
17
|
-
var Subscribable = class {
|
|
18
|
-
constructor() {
|
|
19
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
20
|
-
this.subscribe = this.subscribe.bind(this);
|
|
21
|
-
}
|
|
22
|
-
subscribe(listener) {
|
|
23
|
-
this.listeners.add(listener);
|
|
24
|
-
this.onSubscribe();
|
|
25
|
-
return () => {
|
|
26
|
-
this.listeners.delete(listener);
|
|
27
|
-
this.onUnsubscribe();
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
hasListeners() {
|
|
31
|
-
return this.listeners.size > 0;
|
|
32
|
-
}
|
|
33
|
-
onSubscribe() {
|
|
34
|
-
}
|
|
35
|
-
onUnsubscribe() {
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
40
|
-
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
41
|
-
function noop() {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
function functionalUpdate(updater, input) {
|
|
45
|
-
return typeof updater === "function" ? updater(input) : updater;
|
|
46
|
-
}
|
|
47
|
-
function isValidTimeout(value) {
|
|
48
|
-
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
49
|
-
}
|
|
50
|
-
function timeUntilStale(updatedAt, staleTime) {
|
|
51
|
-
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
52
|
-
}
|
|
53
|
-
function resolveStaleTime(staleTime, query) {
|
|
54
|
-
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
55
|
-
}
|
|
56
|
-
function matchQuery(filters, query) {
|
|
57
|
-
const {
|
|
58
|
-
type = "all",
|
|
59
|
-
exact,
|
|
60
|
-
fetchStatus,
|
|
61
|
-
predicate,
|
|
62
|
-
queryKey,
|
|
63
|
-
stale
|
|
64
|
-
} = filters;
|
|
65
|
-
if (queryKey) {
|
|
66
|
-
if (exact) {
|
|
67
|
-
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
} else if (!partialMatchKey(query.queryKey, queryKey)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (type !== "all") {
|
|
75
|
-
const isActive = query.isActive();
|
|
76
|
-
if (type === "active" && !isActive) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
if (type === "inactive" && isActive) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (typeof stale === "boolean" && query.isStale() !== stale) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
if (predicate && !predicate(query)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
function matchMutation(filters, mutation) {
|
|
95
|
-
const { exact, status, predicate, mutationKey } = filters;
|
|
96
|
-
if (mutationKey) {
|
|
97
|
-
if (!mutation.options.mutationKey) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (exact) {
|
|
101
|
-
if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (status && mutation.state.status !== status) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
if (predicate && !predicate(mutation)) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
function hashQueryKeyByOptions(queryKey, options) {
|
|
117
|
-
const hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashKey;
|
|
118
|
-
return hashFn(queryKey);
|
|
119
|
-
}
|
|
120
|
-
function hashKey(queryKey) {
|
|
121
|
-
return JSON.stringify(
|
|
122
|
-
queryKey,
|
|
123
|
-
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
124
|
-
result[key] = val[key];
|
|
125
|
-
return result;
|
|
126
|
-
}, {}) : val
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function partialMatchKey(a, b) {
|
|
130
|
-
if (a === b) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
if (typeof a !== typeof b) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
137
|
-
return !Object.keys(b).some((key) => !partialMatchKey(a[key], b[key]));
|
|
138
|
-
}
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
function replaceEqualDeep(a, b) {
|
|
142
|
-
if (a === b) {
|
|
143
|
-
return a;
|
|
144
|
-
}
|
|
145
|
-
const array = isPlainArray(a) && isPlainArray(b);
|
|
146
|
-
if (array || isPlainObject(a) && isPlainObject(b)) {
|
|
147
|
-
const aItems = array ? a : Object.keys(a);
|
|
148
|
-
const aSize = aItems.length;
|
|
149
|
-
const bItems = array ? b : Object.keys(b);
|
|
150
|
-
const bSize = bItems.length;
|
|
151
|
-
const copy = array ? [] : {};
|
|
152
|
-
let equalItems = 0;
|
|
153
|
-
for (let i = 0; i < bSize; i++) {
|
|
154
|
-
const key = array ? i : bItems[i];
|
|
155
|
-
if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {
|
|
156
|
-
copy[key] = void 0;
|
|
157
|
-
equalItems++;
|
|
158
|
-
} else {
|
|
159
|
-
copy[key] = replaceEqualDeep(a[key], b[key]);
|
|
160
|
-
if (copy[key] === a[key] && a[key] !== void 0) {
|
|
161
|
-
equalItems++;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
166
|
-
}
|
|
167
|
-
return b;
|
|
168
|
-
}
|
|
169
|
-
function shallowEqualObjects(a, b) {
|
|
170
|
-
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
for (const key in a) {
|
|
174
|
-
if (a[key] !== b[key]) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
function isPlainArray(value) {
|
|
181
|
-
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
182
|
-
}
|
|
183
|
-
function isPlainObject(o) {
|
|
184
|
-
if (!hasObjectPrototype(o)) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
const ctor = o.constructor;
|
|
188
|
-
if (ctor === void 0) {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
const prot = ctor.prototype;
|
|
192
|
-
if (!hasObjectPrototype(prot)) {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
function hasObjectPrototype(o) {
|
|
204
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
205
|
-
}
|
|
206
|
-
function sleep(ms) {
|
|
207
|
-
return new Promise((resolve) => {
|
|
208
|
-
setTimeout(resolve, ms);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function replaceData(prevData, data, options) {
|
|
212
|
-
if (typeof options.structuralSharing === "function") {
|
|
213
|
-
return options.structuralSharing(prevData, data);
|
|
214
|
-
} else if (options.structuralSharing !== false) {
|
|
215
|
-
return replaceEqualDeep(prevData, data);
|
|
216
|
-
}
|
|
217
|
-
return data;
|
|
218
|
-
}
|
|
219
|
-
function keepPreviousData(previousData) {
|
|
220
|
-
return previousData;
|
|
221
|
-
}
|
|
222
|
-
function addToEnd(items, item, max = 0) {
|
|
223
|
-
const newItems = [...items, item];
|
|
224
|
-
return max && newItems.length > max ? newItems.slice(1) : newItems;
|
|
225
|
-
}
|
|
226
|
-
function addToStart(items, item, max = 0) {
|
|
227
|
-
const newItems = [item, ...items];
|
|
228
|
-
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
229
|
-
}
|
|
230
|
-
var skipToken = Symbol();
|
|
231
|
-
var ensureQueryFn = (options, fetchOptions) => {
|
|
232
|
-
if (true) {
|
|
233
|
-
if (options.queryFn === skipToken) {
|
|
234
|
-
console.error(
|
|
235
|
-
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
if (!options.queryFn && (fetchOptions == null ? void 0 : fetchOptions.initialPromise)) {
|
|
240
|
-
return () => fetchOptions.initialPromise;
|
|
241
|
-
}
|
|
242
|
-
if (!options.queryFn || options.queryFn === skipToken) {
|
|
243
|
-
return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
|
|
244
|
-
}
|
|
245
|
-
return options.queryFn;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
249
|
-
var _focused, _cleanup, _setup, _a;
|
|
250
|
-
var FocusManager = (_a = class extends Subscribable {
|
|
251
|
-
constructor() {
|
|
252
|
-
super();
|
|
253
|
-
__privateAdd(this, _focused);
|
|
254
|
-
__privateAdd(this, _cleanup);
|
|
255
|
-
__privateAdd(this, _setup);
|
|
256
|
-
__privateSet(this, _setup, (onFocus) => {
|
|
257
|
-
if (!isServer && window.addEventListener) {
|
|
258
|
-
const listener = () => onFocus();
|
|
259
|
-
window.addEventListener("visibilitychange", listener, false);
|
|
260
|
-
return () => {
|
|
261
|
-
window.removeEventListener("visibilitychange", listener);
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
return;
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
onSubscribe() {
|
|
268
|
-
if (!__privateGet(this, _cleanup)) {
|
|
269
|
-
this.setEventListener(__privateGet(this, _setup));
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
onUnsubscribe() {
|
|
273
|
-
var _a12;
|
|
274
|
-
if (!this.hasListeners()) {
|
|
275
|
-
(_a12 = __privateGet(this, _cleanup)) == null ? void 0 : _a12.call(this);
|
|
276
|
-
__privateSet(this, _cleanup, void 0);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
setEventListener(setup) {
|
|
280
|
-
var _a12;
|
|
281
|
-
__privateSet(this, _setup, setup);
|
|
282
|
-
(_a12 = __privateGet(this, _cleanup)) == null ? void 0 : _a12.call(this);
|
|
283
|
-
__privateSet(this, _cleanup, setup((focused) => {
|
|
284
|
-
if (typeof focused === "boolean") {
|
|
285
|
-
this.setFocused(focused);
|
|
286
|
-
} else {
|
|
287
|
-
this.onFocus();
|
|
288
|
-
}
|
|
289
|
-
}));
|
|
290
|
-
}
|
|
291
|
-
setFocused(focused) {
|
|
292
|
-
const changed = __privateGet(this, _focused) !== focused;
|
|
293
|
-
if (changed) {
|
|
294
|
-
__privateSet(this, _focused, focused);
|
|
295
|
-
this.onFocus();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
onFocus() {
|
|
299
|
-
const isFocused = this.isFocused();
|
|
300
|
-
this.listeners.forEach((listener) => {
|
|
301
|
-
listener(isFocused);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
isFocused() {
|
|
305
|
-
var _a12;
|
|
306
|
-
if (typeof __privateGet(this, _focused) === "boolean") {
|
|
307
|
-
return __privateGet(this, _focused);
|
|
308
|
-
}
|
|
309
|
-
return ((_a12 = globalThis.document) == null ? void 0 : _a12.visibilityState) !== "hidden";
|
|
310
|
-
}
|
|
311
|
-
}, _focused = new WeakMap(), _cleanup = new WeakMap(), _setup = new WeakMap(), _a);
|
|
312
|
-
var focusManager = new FocusManager();
|
|
313
|
-
|
|
314
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
315
|
-
var _online, _cleanup2, _setup2, _a2;
|
|
316
|
-
var OnlineManager = (_a2 = class extends Subscribable {
|
|
317
|
-
constructor() {
|
|
318
|
-
super();
|
|
319
|
-
__privateAdd(this, _online, true);
|
|
320
|
-
__privateAdd(this, _cleanup2);
|
|
321
|
-
__privateAdd(this, _setup2);
|
|
322
|
-
__privateSet(this, _setup2, (onOnline) => {
|
|
323
|
-
if (!isServer && window.addEventListener) {
|
|
324
|
-
const onlineListener = () => onOnline(true);
|
|
325
|
-
const offlineListener = () => onOnline(false);
|
|
326
|
-
window.addEventListener("online", onlineListener, false);
|
|
327
|
-
window.addEventListener("offline", offlineListener, false);
|
|
328
|
-
return () => {
|
|
329
|
-
window.removeEventListener("online", onlineListener);
|
|
330
|
-
window.removeEventListener("offline", offlineListener);
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
return;
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
onSubscribe() {
|
|
337
|
-
if (!__privateGet(this, _cleanup2)) {
|
|
338
|
-
this.setEventListener(__privateGet(this, _setup2));
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
onUnsubscribe() {
|
|
342
|
-
var _a12;
|
|
343
|
-
if (!this.hasListeners()) {
|
|
344
|
-
(_a12 = __privateGet(this, _cleanup2)) == null ? void 0 : _a12.call(this);
|
|
345
|
-
__privateSet(this, _cleanup2, void 0);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
setEventListener(setup) {
|
|
349
|
-
var _a12;
|
|
350
|
-
__privateSet(this, _setup2, setup);
|
|
351
|
-
(_a12 = __privateGet(this, _cleanup2)) == null ? void 0 : _a12.call(this);
|
|
352
|
-
__privateSet(this, _cleanup2, setup(this.setOnline.bind(this)));
|
|
353
|
-
}
|
|
354
|
-
setOnline(online) {
|
|
355
|
-
const changed = __privateGet(this, _online) !== online;
|
|
356
|
-
if (changed) {
|
|
357
|
-
__privateSet(this, _online, online);
|
|
358
|
-
this.listeners.forEach((listener) => {
|
|
359
|
-
listener(online);
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
isOnline() {
|
|
364
|
-
return __privateGet(this, _online);
|
|
365
|
-
}
|
|
366
|
-
}, _online = new WeakMap(), _cleanup2 = new WeakMap(), _setup2 = new WeakMap(), _a2);
|
|
367
|
-
var onlineManager = new OnlineManager();
|
|
368
|
-
|
|
369
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
370
|
-
function defaultRetryDelay(failureCount) {
|
|
371
|
-
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
372
|
-
}
|
|
373
|
-
function canFetch(networkMode) {
|
|
374
|
-
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
375
|
-
}
|
|
376
|
-
var CancelledError = class {
|
|
377
|
-
constructor(options) {
|
|
378
|
-
this.revert = options == null ? void 0 : options.revert;
|
|
379
|
-
this.silent = options == null ? void 0 : options.silent;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
function isCancelledError(value) {
|
|
383
|
-
return value instanceof CancelledError;
|
|
384
|
-
}
|
|
385
|
-
function createRetryer(config) {
|
|
386
|
-
let isRetryCancelled = false;
|
|
387
|
-
let failureCount = 0;
|
|
388
|
-
let isResolved = false;
|
|
389
|
-
let continueFn;
|
|
390
|
-
let promiseResolve;
|
|
391
|
-
let promiseReject;
|
|
392
|
-
const promise = new Promise((outerResolve, outerReject) => {
|
|
393
|
-
promiseResolve = outerResolve;
|
|
394
|
-
promiseReject = outerReject;
|
|
395
|
-
});
|
|
396
|
-
const cancel = (cancelOptions) => {
|
|
397
|
-
var _a12;
|
|
398
|
-
if (!isResolved) {
|
|
399
|
-
reject(new CancelledError(cancelOptions));
|
|
400
|
-
(_a12 = config.abort) == null ? void 0 : _a12.call(config);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
const cancelRetry = () => {
|
|
404
|
-
isRetryCancelled = true;
|
|
405
|
-
};
|
|
406
|
-
const continueRetry = () => {
|
|
407
|
-
isRetryCancelled = false;
|
|
408
|
-
};
|
|
409
|
-
const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
|
|
410
|
-
const canStart = () => canFetch(config.networkMode) && config.canRun();
|
|
411
|
-
const resolve = (value) => {
|
|
412
|
-
var _a12;
|
|
413
|
-
if (!isResolved) {
|
|
414
|
-
isResolved = true;
|
|
415
|
-
(_a12 = config.onSuccess) == null ? void 0 : _a12.call(config, value);
|
|
416
|
-
continueFn == null ? void 0 : continueFn();
|
|
417
|
-
promiseResolve(value);
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
const reject = (value) => {
|
|
421
|
-
var _a12;
|
|
422
|
-
if (!isResolved) {
|
|
423
|
-
isResolved = true;
|
|
424
|
-
(_a12 = config.onError) == null ? void 0 : _a12.call(config, value);
|
|
425
|
-
continueFn == null ? void 0 : continueFn();
|
|
426
|
-
promiseReject(value);
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
const pause = () => {
|
|
430
|
-
return new Promise((continueResolve) => {
|
|
431
|
-
var _a12;
|
|
432
|
-
continueFn = (value) => {
|
|
433
|
-
if (isResolved || canContinue()) {
|
|
434
|
-
continueResolve(value);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
(_a12 = config.onPause) == null ? void 0 : _a12.call(config);
|
|
438
|
-
}).then(() => {
|
|
439
|
-
var _a12;
|
|
440
|
-
continueFn = void 0;
|
|
441
|
-
if (!isResolved) {
|
|
442
|
-
(_a12 = config.onContinue) == null ? void 0 : _a12.call(config);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
const run = () => {
|
|
447
|
-
if (isResolved) {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
let promiseOrValue;
|
|
451
|
-
const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
|
|
452
|
-
try {
|
|
453
|
-
promiseOrValue = initialPromise ?? config.fn();
|
|
454
|
-
} catch (error) {
|
|
455
|
-
promiseOrValue = Promise.reject(error);
|
|
456
|
-
}
|
|
457
|
-
Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
|
|
458
|
-
var _a12;
|
|
459
|
-
if (isResolved) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
const retry = config.retry ?? (isServer ? 0 : 3);
|
|
463
|
-
const retryDelay = config.retryDelay ?? defaultRetryDelay;
|
|
464
|
-
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
465
|
-
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
466
|
-
if (isRetryCancelled || !shouldRetry) {
|
|
467
|
-
reject(error);
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
failureCount++;
|
|
471
|
-
(_a12 = config.onFail) == null ? void 0 : _a12.call(config, failureCount, error);
|
|
472
|
-
sleep(delay).then(() => {
|
|
473
|
-
return canContinue() ? void 0 : pause();
|
|
474
|
-
}).then(() => {
|
|
475
|
-
if (isRetryCancelled) {
|
|
476
|
-
reject(error);
|
|
477
|
-
} else {
|
|
478
|
-
run();
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
return {
|
|
484
|
-
promise,
|
|
485
|
-
cancel,
|
|
486
|
-
continue: () => {
|
|
487
|
-
continueFn == null ? void 0 : continueFn();
|
|
488
|
-
return promise;
|
|
489
|
-
},
|
|
490
|
-
cancelRetry,
|
|
491
|
-
continueRetry,
|
|
492
|
-
canStart,
|
|
493
|
-
start: () => {
|
|
494
|
-
if (canStart()) {
|
|
495
|
-
run();
|
|
496
|
-
} else {
|
|
497
|
-
pause().then(run);
|
|
498
|
-
}
|
|
499
|
-
return promise;
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
505
|
-
function createNotifyManager() {
|
|
506
|
-
let queue = [];
|
|
507
|
-
let transactions = 0;
|
|
508
|
-
let notifyFn = (callback) => {
|
|
509
|
-
callback();
|
|
510
|
-
};
|
|
511
|
-
let batchNotifyFn = (callback) => {
|
|
512
|
-
callback();
|
|
513
|
-
};
|
|
514
|
-
let scheduleFn = (cb) => setTimeout(cb, 0);
|
|
515
|
-
const setScheduler = (fn) => {
|
|
516
|
-
scheduleFn = fn;
|
|
517
|
-
};
|
|
518
|
-
const batch = (callback) => {
|
|
519
|
-
let result;
|
|
520
|
-
transactions++;
|
|
521
|
-
try {
|
|
522
|
-
result = callback();
|
|
523
|
-
} finally {
|
|
524
|
-
transactions--;
|
|
525
|
-
if (!transactions) {
|
|
526
|
-
flush();
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
return result;
|
|
530
|
-
};
|
|
531
|
-
const schedule = (callback) => {
|
|
532
|
-
if (transactions) {
|
|
533
|
-
queue.push(callback);
|
|
534
|
-
} else {
|
|
535
|
-
scheduleFn(() => {
|
|
536
|
-
notifyFn(callback);
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
const batchCalls = (callback) => {
|
|
541
|
-
return (...args) => {
|
|
542
|
-
schedule(() => {
|
|
543
|
-
callback(...args);
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
const flush = () => {
|
|
548
|
-
const originalQueue = queue;
|
|
549
|
-
queue = [];
|
|
550
|
-
if (originalQueue.length) {
|
|
551
|
-
scheduleFn(() => {
|
|
552
|
-
batchNotifyFn(() => {
|
|
553
|
-
originalQueue.forEach((callback) => {
|
|
554
|
-
notifyFn(callback);
|
|
555
|
-
});
|
|
556
|
-
});
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
const setNotifyFunction = (fn) => {
|
|
561
|
-
notifyFn = fn;
|
|
562
|
-
};
|
|
563
|
-
const setBatchNotifyFunction = (fn) => {
|
|
564
|
-
batchNotifyFn = fn;
|
|
565
|
-
};
|
|
566
|
-
return {
|
|
567
|
-
batch,
|
|
568
|
-
batchCalls,
|
|
569
|
-
schedule,
|
|
570
|
-
setNotifyFunction,
|
|
571
|
-
setBatchNotifyFunction,
|
|
572
|
-
setScheduler
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
var notifyManager = createNotifyManager();
|
|
576
|
-
|
|
577
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/removable.js
|
|
578
|
-
var _gcTimeout, _a3;
|
|
579
|
-
var Removable = (_a3 = class {
|
|
580
|
-
constructor() {
|
|
581
|
-
__privateAdd(this, _gcTimeout);
|
|
582
|
-
}
|
|
583
|
-
destroy() {
|
|
584
|
-
this.clearGcTimeout();
|
|
585
|
-
}
|
|
586
|
-
scheduleGc() {
|
|
587
|
-
this.clearGcTimeout();
|
|
588
|
-
if (isValidTimeout(this.gcTime)) {
|
|
589
|
-
__privateSet(this, _gcTimeout, setTimeout(() => {
|
|
590
|
-
this.optionalRemove();
|
|
591
|
-
}, this.gcTime));
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
updateGcTime(newGcTime) {
|
|
595
|
-
this.gcTime = Math.max(
|
|
596
|
-
this.gcTime || 0,
|
|
597
|
-
newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
clearGcTimeout() {
|
|
601
|
-
if (__privateGet(this, _gcTimeout)) {
|
|
602
|
-
clearTimeout(__privateGet(this, _gcTimeout));
|
|
603
|
-
__privateSet(this, _gcTimeout, void 0);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}, _gcTimeout = new WeakMap(), _a3);
|
|
607
|
-
|
|
608
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/query.js
|
|
609
|
-
var _initialState, _revertState, _cache, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, dispatch_fn, _a4;
|
|
610
|
-
var Query = (_a4 = class extends Removable {
|
|
611
|
-
constructor(config) {
|
|
612
|
-
super();
|
|
613
|
-
__privateAdd(this, _Query_instances);
|
|
614
|
-
__privateAdd(this, _initialState);
|
|
615
|
-
__privateAdd(this, _revertState);
|
|
616
|
-
__privateAdd(this, _cache);
|
|
617
|
-
__privateAdd(this, _retryer);
|
|
618
|
-
__privateAdd(this, _defaultOptions);
|
|
619
|
-
__privateAdd(this, _abortSignalConsumed);
|
|
620
|
-
__privateSet(this, _abortSignalConsumed, false);
|
|
621
|
-
__privateSet(this, _defaultOptions, config.defaultOptions);
|
|
622
|
-
this.setOptions(config.options);
|
|
623
|
-
this.observers = [];
|
|
624
|
-
__privateSet(this, _cache, config.cache);
|
|
625
|
-
this.queryKey = config.queryKey;
|
|
626
|
-
this.queryHash = config.queryHash;
|
|
627
|
-
__privateSet(this, _initialState, config.state || getDefaultState(this.options));
|
|
628
|
-
this.state = __privateGet(this, _initialState);
|
|
629
|
-
this.scheduleGc();
|
|
630
|
-
}
|
|
631
|
-
get meta() {
|
|
632
|
-
return this.options.meta;
|
|
633
|
-
}
|
|
634
|
-
get promise() {
|
|
635
|
-
var _a12;
|
|
636
|
-
return (_a12 = __privateGet(this, _retryer)) == null ? void 0 : _a12.promise;
|
|
637
|
-
}
|
|
638
|
-
setOptions(options) {
|
|
639
|
-
this.options = { ...__privateGet(this, _defaultOptions), ...options };
|
|
640
|
-
this.updateGcTime(this.options.gcTime);
|
|
641
|
-
}
|
|
642
|
-
optionalRemove() {
|
|
643
|
-
if (!this.observers.length && this.state.fetchStatus === "idle") {
|
|
644
|
-
__privateGet(this, _cache).remove(this);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
setData(newData, options) {
|
|
648
|
-
const data = replaceData(this.state.data, newData, this.options);
|
|
649
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, {
|
|
650
|
-
data,
|
|
651
|
-
type: "success",
|
|
652
|
-
dataUpdatedAt: options == null ? void 0 : options.updatedAt,
|
|
653
|
-
manual: options == null ? void 0 : options.manual
|
|
654
|
-
});
|
|
655
|
-
return data;
|
|
656
|
-
}
|
|
657
|
-
setState(state, setStateOptions) {
|
|
658
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "setState", state, setStateOptions });
|
|
659
|
-
}
|
|
660
|
-
cancel(options) {
|
|
661
|
-
var _a12, _b;
|
|
662
|
-
const promise = (_a12 = __privateGet(this, _retryer)) == null ? void 0 : _a12.promise;
|
|
663
|
-
(_b = __privateGet(this, _retryer)) == null ? void 0 : _b.cancel(options);
|
|
664
|
-
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
665
|
-
}
|
|
666
|
-
destroy() {
|
|
667
|
-
super.destroy();
|
|
668
|
-
this.cancel({ silent: true });
|
|
669
|
-
}
|
|
670
|
-
reset() {
|
|
671
|
-
this.destroy();
|
|
672
|
-
this.setState(__privateGet(this, _initialState));
|
|
673
|
-
}
|
|
674
|
-
isActive() {
|
|
675
|
-
return this.observers.some((observer) => observer.options.enabled !== false);
|
|
676
|
-
}
|
|
677
|
-
isDisabled() {
|
|
678
|
-
return this.getObserversCount() > 0 && !this.isActive();
|
|
679
|
-
}
|
|
680
|
-
isStale() {
|
|
681
|
-
if (this.state.isInvalidated) {
|
|
682
|
-
return true;
|
|
683
|
-
}
|
|
684
|
-
if (this.getObserversCount() > 0) {
|
|
685
|
-
return this.observers.some(
|
|
686
|
-
(observer) => observer.getCurrentResult().isStale
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
return this.state.data === void 0;
|
|
690
|
-
}
|
|
691
|
-
isStaleByTime(staleTime = 0) {
|
|
692
|
-
return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
693
|
-
}
|
|
694
|
-
onFocus() {
|
|
695
|
-
var _a12;
|
|
696
|
-
const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
697
|
-
observer == null ? void 0 : observer.refetch({ cancelRefetch: false });
|
|
698
|
-
(_a12 = __privateGet(this, _retryer)) == null ? void 0 : _a12.continue();
|
|
699
|
-
}
|
|
700
|
-
onOnline() {
|
|
701
|
-
var _a12;
|
|
702
|
-
const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
|
|
703
|
-
observer == null ? void 0 : observer.refetch({ cancelRefetch: false });
|
|
704
|
-
(_a12 = __privateGet(this, _retryer)) == null ? void 0 : _a12.continue();
|
|
705
|
-
}
|
|
706
|
-
addObserver(observer) {
|
|
707
|
-
if (!this.observers.includes(observer)) {
|
|
708
|
-
this.observers.push(observer);
|
|
709
|
-
this.clearGcTimeout();
|
|
710
|
-
__privateGet(this, _cache).notify({ type: "observerAdded", query: this, observer });
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
removeObserver(observer) {
|
|
714
|
-
if (this.observers.includes(observer)) {
|
|
715
|
-
this.observers = this.observers.filter((x) => x !== observer);
|
|
716
|
-
if (!this.observers.length) {
|
|
717
|
-
if (__privateGet(this, _retryer)) {
|
|
718
|
-
if (__privateGet(this, _abortSignalConsumed)) {
|
|
719
|
-
__privateGet(this, _retryer).cancel({ revert: true });
|
|
720
|
-
} else {
|
|
721
|
-
__privateGet(this, _retryer).cancelRetry();
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
this.scheduleGc();
|
|
725
|
-
}
|
|
726
|
-
__privateGet(this, _cache).notify({ type: "observerRemoved", query: this, observer });
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
getObserversCount() {
|
|
730
|
-
return this.observers.length;
|
|
731
|
-
}
|
|
732
|
-
invalidate() {
|
|
733
|
-
if (!this.state.isInvalidated) {
|
|
734
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "invalidate" });
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
fetch(options, fetchOptions) {
|
|
738
|
-
var _a12, _b, _c;
|
|
739
|
-
if (this.state.fetchStatus !== "idle") {
|
|
740
|
-
if (this.state.data !== void 0 && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {
|
|
741
|
-
this.cancel({ silent: true });
|
|
742
|
-
} else if (__privateGet(this, _retryer)) {
|
|
743
|
-
__privateGet(this, _retryer).continueRetry();
|
|
744
|
-
return __privateGet(this, _retryer).promise;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
if (options) {
|
|
748
|
-
this.setOptions(options);
|
|
749
|
-
}
|
|
750
|
-
if (!this.options.queryFn) {
|
|
751
|
-
const observer = this.observers.find((x) => x.options.queryFn);
|
|
752
|
-
if (observer) {
|
|
753
|
-
this.setOptions(observer.options);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (true) {
|
|
757
|
-
if (!Array.isArray(this.options.queryKey)) {
|
|
758
|
-
console.error(
|
|
759
|
-
`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
|
|
760
|
-
);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
const abortController = new AbortController();
|
|
764
|
-
const addSignalProperty = (object) => {
|
|
765
|
-
Object.defineProperty(object, "signal", {
|
|
766
|
-
enumerable: true,
|
|
767
|
-
get: () => {
|
|
768
|
-
__privateSet(this, _abortSignalConsumed, true);
|
|
769
|
-
return abortController.signal;
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
};
|
|
773
|
-
const fetchFn = () => {
|
|
774
|
-
const queryFn = ensureQueryFn(this.options, fetchOptions);
|
|
775
|
-
const queryFnContext = {
|
|
776
|
-
queryKey: this.queryKey,
|
|
777
|
-
meta: this.meta
|
|
778
|
-
};
|
|
779
|
-
addSignalProperty(queryFnContext);
|
|
780
|
-
__privateSet(this, _abortSignalConsumed, false);
|
|
781
|
-
if (this.options.persister) {
|
|
782
|
-
return this.options.persister(
|
|
783
|
-
queryFn,
|
|
784
|
-
queryFnContext,
|
|
785
|
-
this
|
|
786
|
-
);
|
|
787
|
-
}
|
|
788
|
-
return queryFn(queryFnContext);
|
|
789
|
-
};
|
|
790
|
-
const context = {
|
|
791
|
-
fetchOptions,
|
|
792
|
-
options: this.options,
|
|
793
|
-
queryKey: this.queryKey,
|
|
794
|
-
state: this.state,
|
|
795
|
-
fetchFn
|
|
796
|
-
};
|
|
797
|
-
addSignalProperty(context);
|
|
798
|
-
(_a12 = this.options.behavior) == null ? void 0 : _a12.onFetch(
|
|
799
|
-
context,
|
|
800
|
-
this
|
|
801
|
-
);
|
|
802
|
-
__privateSet(this, _revertState, this.state);
|
|
803
|
-
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((_b = context.fetchOptions) == null ? void 0 : _b.meta)) {
|
|
804
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "fetch", meta: (_c = context.fetchOptions) == null ? void 0 : _c.meta });
|
|
805
|
-
}
|
|
806
|
-
const onError = (error) => {
|
|
807
|
-
var _a13, _b2, _c2, _d;
|
|
808
|
-
if (!(isCancelledError(error) && error.silent)) {
|
|
809
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, {
|
|
810
|
-
type: "error",
|
|
811
|
-
error
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
if (!isCancelledError(error)) {
|
|
815
|
-
(_b2 = (_a13 = __privateGet(this, _cache).config).onError) == null ? void 0 : _b2.call(
|
|
816
|
-
_a13,
|
|
817
|
-
error,
|
|
818
|
-
this
|
|
819
|
-
);
|
|
820
|
-
(_d = (_c2 = __privateGet(this, _cache).config).onSettled) == null ? void 0 : _d.call(
|
|
821
|
-
_c2,
|
|
822
|
-
this.state.data,
|
|
823
|
-
error,
|
|
824
|
-
this
|
|
825
|
-
);
|
|
826
|
-
}
|
|
827
|
-
if (!this.isFetchingOptimistic) {
|
|
828
|
-
this.scheduleGc();
|
|
829
|
-
}
|
|
830
|
-
this.isFetchingOptimistic = false;
|
|
831
|
-
};
|
|
832
|
-
__privateSet(this, _retryer, createRetryer({
|
|
833
|
-
initialPromise: fetchOptions == null ? void 0 : fetchOptions.initialPromise,
|
|
834
|
-
fn: context.fetchFn,
|
|
835
|
-
abort: abortController.abort.bind(abortController),
|
|
836
|
-
onSuccess: (data) => {
|
|
837
|
-
var _a13, _b2, _c2, _d;
|
|
838
|
-
if (data === void 0) {
|
|
839
|
-
if (true) {
|
|
840
|
-
console.error(
|
|
841
|
-
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
onError(new Error(`${this.queryHash} data is undefined`));
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
this.setData(data);
|
|
848
|
-
(_b2 = (_a13 = __privateGet(this, _cache).config).onSuccess) == null ? void 0 : _b2.call(_a13, data, this);
|
|
849
|
-
(_d = (_c2 = __privateGet(this, _cache).config).onSettled) == null ? void 0 : _d.call(
|
|
850
|
-
_c2,
|
|
851
|
-
data,
|
|
852
|
-
this.state.error,
|
|
853
|
-
this
|
|
854
|
-
);
|
|
855
|
-
if (!this.isFetchingOptimistic) {
|
|
856
|
-
this.scheduleGc();
|
|
857
|
-
}
|
|
858
|
-
this.isFetchingOptimistic = false;
|
|
859
|
-
},
|
|
860
|
-
onError,
|
|
861
|
-
onFail: (failureCount, error) => {
|
|
862
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "failed", failureCount, error });
|
|
863
|
-
},
|
|
864
|
-
onPause: () => {
|
|
865
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "pause" });
|
|
866
|
-
},
|
|
867
|
-
onContinue: () => {
|
|
868
|
-
__privateMethod(this, _Query_instances, dispatch_fn).call(this, { type: "continue" });
|
|
869
|
-
},
|
|
870
|
-
retry: context.options.retry,
|
|
871
|
-
retryDelay: context.options.retryDelay,
|
|
872
|
-
networkMode: context.options.networkMode,
|
|
873
|
-
canRun: () => true
|
|
874
|
-
}));
|
|
875
|
-
return __privateGet(this, _retryer).start();
|
|
876
|
-
}
|
|
877
|
-
}, _initialState = new WeakMap(), _revertState = new WeakMap(), _cache = new WeakMap(), _retryer = new WeakMap(), _defaultOptions = new WeakMap(), _abortSignalConsumed = new WeakMap(), _Query_instances = new WeakSet(), dispatch_fn = function(action) {
|
|
878
|
-
const reducer = (state) => {
|
|
879
|
-
switch (action.type) {
|
|
880
|
-
case "failed":
|
|
881
|
-
return {
|
|
882
|
-
...state,
|
|
883
|
-
fetchFailureCount: action.failureCount,
|
|
884
|
-
fetchFailureReason: action.error
|
|
885
|
-
};
|
|
886
|
-
case "pause":
|
|
887
|
-
return {
|
|
888
|
-
...state,
|
|
889
|
-
fetchStatus: "paused"
|
|
890
|
-
};
|
|
891
|
-
case "continue":
|
|
892
|
-
return {
|
|
893
|
-
...state,
|
|
894
|
-
fetchStatus: "fetching"
|
|
895
|
-
};
|
|
896
|
-
case "fetch":
|
|
897
|
-
return {
|
|
898
|
-
...state,
|
|
899
|
-
...fetchState(state.data, this.options),
|
|
900
|
-
fetchMeta: action.meta ?? null
|
|
901
|
-
};
|
|
902
|
-
case "success":
|
|
903
|
-
return {
|
|
904
|
-
...state,
|
|
905
|
-
data: action.data,
|
|
906
|
-
dataUpdateCount: state.dataUpdateCount + 1,
|
|
907
|
-
dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),
|
|
908
|
-
error: null,
|
|
909
|
-
isInvalidated: false,
|
|
910
|
-
status: "success",
|
|
911
|
-
...!action.manual && {
|
|
912
|
-
fetchStatus: "idle",
|
|
913
|
-
fetchFailureCount: 0,
|
|
914
|
-
fetchFailureReason: null
|
|
915
|
-
}
|
|
916
|
-
};
|
|
917
|
-
case "error":
|
|
918
|
-
const error = action.error;
|
|
919
|
-
if (isCancelledError(error) && error.revert && __privateGet(this, _revertState)) {
|
|
920
|
-
return { ...__privateGet(this, _revertState), fetchStatus: "idle" };
|
|
921
|
-
}
|
|
922
|
-
return {
|
|
923
|
-
...state,
|
|
924
|
-
error,
|
|
925
|
-
errorUpdateCount: state.errorUpdateCount + 1,
|
|
926
|
-
errorUpdatedAt: Date.now(),
|
|
927
|
-
fetchFailureCount: state.fetchFailureCount + 1,
|
|
928
|
-
fetchFailureReason: error,
|
|
929
|
-
fetchStatus: "idle",
|
|
930
|
-
status: "error"
|
|
931
|
-
};
|
|
932
|
-
case "invalidate":
|
|
933
|
-
return {
|
|
934
|
-
...state,
|
|
935
|
-
isInvalidated: true
|
|
936
|
-
};
|
|
937
|
-
case "setState":
|
|
938
|
-
return {
|
|
939
|
-
...state,
|
|
940
|
-
...action.state
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
this.state = reducer(this.state);
|
|
945
|
-
notifyManager.batch(() => {
|
|
946
|
-
this.observers.forEach((observer) => {
|
|
947
|
-
observer.onQueryUpdate();
|
|
948
|
-
});
|
|
949
|
-
__privateGet(this, _cache).notify({ query: this, type: "updated", action });
|
|
950
|
-
});
|
|
951
|
-
}, _a4);
|
|
952
|
-
function fetchState(data, options) {
|
|
953
|
-
return {
|
|
954
|
-
fetchFailureCount: 0,
|
|
955
|
-
fetchFailureReason: null,
|
|
956
|
-
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
957
|
-
...data === void 0 && {
|
|
958
|
-
error: null,
|
|
959
|
-
status: "pending"
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function getDefaultState(options) {
|
|
964
|
-
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
965
|
-
const hasData = data !== void 0;
|
|
966
|
-
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
967
|
-
return {
|
|
968
|
-
data,
|
|
969
|
-
dataUpdateCount: 0,
|
|
970
|
-
dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
|
|
971
|
-
error: null,
|
|
972
|
-
errorUpdateCount: 0,
|
|
973
|
-
errorUpdatedAt: 0,
|
|
974
|
-
fetchFailureCount: 0,
|
|
975
|
-
fetchFailureReason: null,
|
|
976
|
-
fetchMeta: null,
|
|
977
|
-
isInvalidated: false,
|
|
978
|
-
status: hasData ? "success" : "pending",
|
|
979
|
-
fetchStatus: "idle"
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
984
|
-
var _queries, _a5;
|
|
985
|
-
var QueryCache = (_a5 = class extends Subscribable {
|
|
986
|
-
constructor(config = {}) {
|
|
987
|
-
super();
|
|
988
|
-
__privateAdd(this, _queries);
|
|
989
|
-
this.config = config;
|
|
990
|
-
__privateSet(this, _queries, /* @__PURE__ */ new Map());
|
|
991
|
-
}
|
|
992
|
-
build(client, options, state) {
|
|
993
|
-
const queryKey = options.queryKey;
|
|
994
|
-
const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
|
|
995
|
-
let query = this.get(queryHash);
|
|
996
|
-
if (!query) {
|
|
997
|
-
query = new Query({
|
|
998
|
-
cache: this,
|
|
999
|
-
queryKey,
|
|
1000
|
-
queryHash,
|
|
1001
|
-
options: client.defaultQueryOptions(options),
|
|
1002
|
-
state,
|
|
1003
|
-
defaultOptions: client.getQueryDefaults(queryKey)
|
|
1004
|
-
});
|
|
1005
|
-
this.add(query);
|
|
1006
|
-
}
|
|
1007
|
-
return query;
|
|
1008
|
-
}
|
|
1009
|
-
add(query) {
|
|
1010
|
-
if (!__privateGet(this, _queries).has(query.queryHash)) {
|
|
1011
|
-
__privateGet(this, _queries).set(query.queryHash, query);
|
|
1012
|
-
this.notify({
|
|
1013
|
-
type: "added",
|
|
1014
|
-
query
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
remove(query) {
|
|
1019
|
-
const queryInMap = __privateGet(this, _queries).get(query.queryHash);
|
|
1020
|
-
if (queryInMap) {
|
|
1021
|
-
query.destroy();
|
|
1022
|
-
if (queryInMap === query) {
|
|
1023
|
-
__privateGet(this, _queries).delete(query.queryHash);
|
|
1024
|
-
}
|
|
1025
|
-
this.notify({ type: "removed", query });
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
clear() {
|
|
1029
|
-
notifyManager.batch(() => {
|
|
1030
|
-
this.getAll().forEach((query) => {
|
|
1031
|
-
this.remove(query);
|
|
1032
|
-
});
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
get(queryHash) {
|
|
1036
|
-
return __privateGet(this, _queries).get(queryHash);
|
|
1037
|
-
}
|
|
1038
|
-
getAll() {
|
|
1039
|
-
return [...__privateGet(this, _queries).values()];
|
|
1040
|
-
}
|
|
1041
|
-
find(filters) {
|
|
1042
|
-
const defaultedFilters = { exact: true, ...filters };
|
|
1043
|
-
return this.getAll().find(
|
|
1044
|
-
(query) => matchQuery(defaultedFilters, query)
|
|
1045
|
-
);
|
|
1046
|
-
}
|
|
1047
|
-
findAll(filters = {}) {
|
|
1048
|
-
const queries = this.getAll();
|
|
1049
|
-
return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
|
|
1050
|
-
}
|
|
1051
|
-
notify(event) {
|
|
1052
|
-
notifyManager.batch(() => {
|
|
1053
|
-
this.listeners.forEach((listener) => {
|
|
1054
|
-
listener(event);
|
|
1055
|
-
});
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
onFocus() {
|
|
1059
|
-
notifyManager.batch(() => {
|
|
1060
|
-
this.getAll().forEach((query) => {
|
|
1061
|
-
query.onFocus();
|
|
1062
|
-
});
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
onOnline() {
|
|
1066
|
-
notifyManager.batch(() => {
|
|
1067
|
-
this.getAll().forEach((query) => {
|
|
1068
|
-
query.onOnline();
|
|
1069
|
-
});
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
}, _queries = new WeakMap(), _a5);
|
|
1073
|
-
|
|
1074
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
1075
|
-
var _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _a6;
|
|
1076
|
-
var Mutation = (_a6 = class extends Removable {
|
|
1077
|
-
constructor(config) {
|
|
1078
|
-
super();
|
|
1079
|
-
__privateAdd(this, _Mutation_instances);
|
|
1080
|
-
__privateAdd(this, _observers);
|
|
1081
|
-
__privateAdd(this, _mutationCache);
|
|
1082
|
-
__privateAdd(this, _retryer2);
|
|
1083
|
-
this.mutationId = config.mutationId;
|
|
1084
|
-
__privateSet(this, _mutationCache, config.mutationCache);
|
|
1085
|
-
__privateSet(this, _observers, []);
|
|
1086
|
-
this.state = config.state || getDefaultState2();
|
|
1087
|
-
this.setOptions(config.options);
|
|
1088
|
-
this.scheduleGc();
|
|
1089
|
-
}
|
|
1090
|
-
setOptions(options) {
|
|
1091
|
-
this.options = options;
|
|
1092
|
-
this.updateGcTime(this.options.gcTime);
|
|
1093
|
-
}
|
|
1094
|
-
get meta() {
|
|
1095
|
-
return this.options.meta;
|
|
1096
|
-
}
|
|
1097
|
-
addObserver(observer) {
|
|
1098
|
-
if (!__privateGet(this, _observers).includes(observer)) {
|
|
1099
|
-
__privateGet(this, _observers).push(observer);
|
|
1100
|
-
this.clearGcTimeout();
|
|
1101
|
-
__privateGet(this, _mutationCache).notify({
|
|
1102
|
-
type: "observerAdded",
|
|
1103
|
-
mutation: this,
|
|
1104
|
-
observer
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
removeObserver(observer) {
|
|
1109
|
-
__privateSet(this, _observers, __privateGet(this, _observers).filter((x) => x !== observer));
|
|
1110
|
-
this.scheduleGc();
|
|
1111
|
-
__privateGet(this, _mutationCache).notify({
|
|
1112
|
-
type: "observerRemoved",
|
|
1113
|
-
mutation: this,
|
|
1114
|
-
observer
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
optionalRemove() {
|
|
1118
|
-
if (!__privateGet(this, _observers).length) {
|
|
1119
|
-
if (this.state.status === "pending") {
|
|
1120
|
-
this.scheduleGc();
|
|
1121
|
-
} else {
|
|
1122
|
-
__privateGet(this, _mutationCache).remove(this);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
continue() {
|
|
1127
|
-
var _a12;
|
|
1128
|
-
return ((_a12 = __privateGet(this, _retryer2)) == null ? void 0 : _a12.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1129
|
-
this.execute(this.state.variables);
|
|
1130
|
-
}
|
|
1131
|
-
async execute(variables) {
|
|
1132
|
-
var _a12, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1133
|
-
__privateSet(this, _retryer2, createRetryer({
|
|
1134
|
-
fn: () => {
|
|
1135
|
-
if (!this.options.mutationFn) {
|
|
1136
|
-
return Promise.reject(new Error("No mutationFn found"));
|
|
1137
|
-
}
|
|
1138
|
-
return this.options.mutationFn(variables);
|
|
1139
|
-
},
|
|
1140
|
-
onFail: (failureCount, error) => {
|
|
1141
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "failed", failureCount, error });
|
|
1142
|
-
},
|
|
1143
|
-
onPause: () => {
|
|
1144
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "pause" });
|
|
1145
|
-
},
|
|
1146
|
-
onContinue: () => {
|
|
1147
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "continue" });
|
|
1148
|
-
},
|
|
1149
|
-
retry: this.options.retry ?? 0,
|
|
1150
|
-
retryDelay: this.options.retryDelay,
|
|
1151
|
-
networkMode: this.options.networkMode,
|
|
1152
|
-
canRun: () => __privateGet(this, _mutationCache).canRun(this)
|
|
1153
|
-
}));
|
|
1154
|
-
const restored = this.state.status === "pending";
|
|
1155
|
-
const isPaused = !__privateGet(this, _retryer2).canStart();
|
|
1156
|
-
try {
|
|
1157
|
-
if (!restored) {
|
|
1158
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "pending", variables, isPaused });
|
|
1159
|
-
await ((_b = (_a12 = __privateGet(this, _mutationCache).config).onMutate) == null ? void 0 : _b.call(
|
|
1160
|
-
_a12,
|
|
1161
|
-
variables,
|
|
1162
|
-
this
|
|
1163
|
-
));
|
|
1164
|
-
const context = await ((_d = (_c = this.options).onMutate) == null ? void 0 : _d.call(_c, variables));
|
|
1165
|
-
if (context !== this.state.context) {
|
|
1166
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, {
|
|
1167
|
-
type: "pending",
|
|
1168
|
-
context,
|
|
1169
|
-
variables,
|
|
1170
|
-
isPaused
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
const data = await __privateGet(this, _retryer2).start();
|
|
1175
|
-
await ((_f = (_e = __privateGet(this, _mutationCache).config).onSuccess) == null ? void 0 : _f.call(
|
|
1176
|
-
_e,
|
|
1177
|
-
data,
|
|
1178
|
-
variables,
|
|
1179
|
-
this.state.context,
|
|
1180
|
-
this
|
|
1181
|
-
));
|
|
1182
|
-
await ((_h = (_g = this.options).onSuccess) == null ? void 0 : _h.call(_g, data, variables, this.state.context));
|
|
1183
|
-
await ((_j = (_i = __privateGet(this, _mutationCache).config).onSettled) == null ? void 0 : _j.call(
|
|
1184
|
-
_i,
|
|
1185
|
-
data,
|
|
1186
|
-
null,
|
|
1187
|
-
this.state.variables,
|
|
1188
|
-
this.state.context,
|
|
1189
|
-
this
|
|
1190
|
-
));
|
|
1191
|
-
await ((_l = (_k = this.options).onSettled) == null ? void 0 : _l.call(_k, data, null, variables, this.state.context));
|
|
1192
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "success", data });
|
|
1193
|
-
return data;
|
|
1194
|
-
} catch (error) {
|
|
1195
|
-
try {
|
|
1196
|
-
await ((_n = (_m = __privateGet(this, _mutationCache).config).onError) == null ? void 0 : _n.call(
|
|
1197
|
-
_m,
|
|
1198
|
-
error,
|
|
1199
|
-
variables,
|
|
1200
|
-
this.state.context,
|
|
1201
|
-
this
|
|
1202
|
-
));
|
|
1203
|
-
await ((_p = (_o = this.options).onError) == null ? void 0 : _p.call(
|
|
1204
|
-
_o,
|
|
1205
|
-
error,
|
|
1206
|
-
variables,
|
|
1207
|
-
this.state.context
|
|
1208
|
-
));
|
|
1209
|
-
await ((_r = (_q = __privateGet(this, _mutationCache).config).onSettled) == null ? void 0 : _r.call(
|
|
1210
|
-
_q,
|
|
1211
|
-
void 0,
|
|
1212
|
-
error,
|
|
1213
|
-
this.state.variables,
|
|
1214
|
-
this.state.context,
|
|
1215
|
-
this
|
|
1216
|
-
));
|
|
1217
|
-
await ((_t = (_s = this.options).onSettled) == null ? void 0 : _t.call(
|
|
1218
|
-
_s,
|
|
1219
|
-
void 0,
|
|
1220
|
-
error,
|
|
1221
|
-
variables,
|
|
1222
|
-
this.state.context
|
|
1223
|
-
));
|
|
1224
|
-
throw error;
|
|
1225
|
-
} finally {
|
|
1226
|
-
__privateMethod(this, _Mutation_instances, dispatch_fn2).call(this, { type: "error", error });
|
|
1227
|
-
}
|
|
1228
|
-
} finally {
|
|
1229
|
-
__privateGet(this, _mutationCache).runNext(this);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}, _observers = new WeakMap(), _mutationCache = new WeakMap(), _retryer2 = new WeakMap(), _Mutation_instances = new WeakSet(), dispatch_fn2 = function(action) {
|
|
1233
|
-
const reducer = (state) => {
|
|
1234
|
-
switch (action.type) {
|
|
1235
|
-
case "failed":
|
|
1236
|
-
return {
|
|
1237
|
-
...state,
|
|
1238
|
-
failureCount: action.failureCount,
|
|
1239
|
-
failureReason: action.error
|
|
1240
|
-
};
|
|
1241
|
-
case "pause":
|
|
1242
|
-
return {
|
|
1243
|
-
...state,
|
|
1244
|
-
isPaused: true
|
|
1245
|
-
};
|
|
1246
|
-
case "continue":
|
|
1247
|
-
return {
|
|
1248
|
-
...state,
|
|
1249
|
-
isPaused: false
|
|
1250
|
-
};
|
|
1251
|
-
case "pending":
|
|
1252
|
-
return {
|
|
1253
|
-
...state,
|
|
1254
|
-
context: action.context,
|
|
1255
|
-
data: void 0,
|
|
1256
|
-
failureCount: 0,
|
|
1257
|
-
failureReason: null,
|
|
1258
|
-
error: null,
|
|
1259
|
-
isPaused: action.isPaused,
|
|
1260
|
-
status: "pending",
|
|
1261
|
-
variables: action.variables,
|
|
1262
|
-
submittedAt: Date.now()
|
|
1263
|
-
};
|
|
1264
|
-
case "success":
|
|
1265
|
-
return {
|
|
1266
|
-
...state,
|
|
1267
|
-
data: action.data,
|
|
1268
|
-
failureCount: 0,
|
|
1269
|
-
failureReason: null,
|
|
1270
|
-
error: null,
|
|
1271
|
-
status: "success",
|
|
1272
|
-
isPaused: false
|
|
1273
|
-
};
|
|
1274
|
-
case "error":
|
|
1275
|
-
return {
|
|
1276
|
-
...state,
|
|
1277
|
-
data: void 0,
|
|
1278
|
-
error: action.error,
|
|
1279
|
-
failureCount: state.failureCount + 1,
|
|
1280
|
-
failureReason: action.error,
|
|
1281
|
-
isPaused: false,
|
|
1282
|
-
status: "error"
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
this.state = reducer(this.state);
|
|
1287
|
-
notifyManager.batch(() => {
|
|
1288
|
-
__privateGet(this, _observers).forEach((observer) => {
|
|
1289
|
-
observer.onMutationUpdate(action);
|
|
1290
|
-
});
|
|
1291
|
-
__privateGet(this, _mutationCache).notify({
|
|
1292
|
-
mutation: this,
|
|
1293
|
-
type: "updated",
|
|
1294
|
-
action
|
|
1295
|
-
});
|
|
1296
|
-
});
|
|
1297
|
-
}, _a6);
|
|
1298
|
-
function getDefaultState2() {
|
|
1299
|
-
return {
|
|
1300
|
-
context: void 0,
|
|
1301
|
-
data: void 0,
|
|
1302
|
-
error: null,
|
|
1303
|
-
failureCount: 0,
|
|
1304
|
-
failureReason: null,
|
|
1305
|
-
isPaused: false,
|
|
1306
|
-
status: "idle",
|
|
1307
|
-
variables: void 0,
|
|
1308
|
-
submittedAt: 0
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
1313
|
-
var _mutations, _mutationId, _a7;
|
|
1314
|
-
var MutationCache = (_a7 = class extends Subscribable {
|
|
1315
|
-
constructor(config = {}) {
|
|
1316
|
-
super();
|
|
1317
|
-
__privateAdd(this, _mutations);
|
|
1318
|
-
__privateAdd(this, _mutationId);
|
|
1319
|
-
this.config = config;
|
|
1320
|
-
__privateSet(this, _mutations, /* @__PURE__ */ new Map());
|
|
1321
|
-
__privateSet(this, _mutationId, Date.now());
|
|
1322
|
-
}
|
|
1323
|
-
build(client, options, state) {
|
|
1324
|
-
const mutation = new Mutation({
|
|
1325
|
-
mutationCache: this,
|
|
1326
|
-
mutationId: ++__privateWrapper(this, _mutationId)._,
|
|
1327
|
-
options: client.defaultMutationOptions(options),
|
|
1328
|
-
state
|
|
1329
|
-
});
|
|
1330
|
-
this.add(mutation);
|
|
1331
|
-
return mutation;
|
|
1332
|
-
}
|
|
1333
|
-
add(mutation) {
|
|
1334
|
-
const scope = scopeFor(mutation);
|
|
1335
|
-
const mutations = __privateGet(this, _mutations).get(scope) ?? [];
|
|
1336
|
-
mutations.push(mutation);
|
|
1337
|
-
__privateGet(this, _mutations).set(scope, mutations);
|
|
1338
|
-
this.notify({ type: "added", mutation });
|
|
1339
|
-
}
|
|
1340
|
-
remove(mutation) {
|
|
1341
|
-
var _a12;
|
|
1342
|
-
const scope = scopeFor(mutation);
|
|
1343
|
-
if (__privateGet(this, _mutations).has(scope)) {
|
|
1344
|
-
const mutations = (_a12 = __privateGet(this, _mutations).get(scope)) == null ? void 0 : _a12.filter((x) => x !== mutation);
|
|
1345
|
-
if (mutations) {
|
|
1346
|
-
if (mutations.length === 0) {
|
|
1347
|
-
__privateGet(this, _mutations).delete(scope);
|
|
1348
|
-
} else {
|
|
1349
|
-
__privateGet(this, _mutations).set(scope, mutations);
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
this.notify({ type: "removed", mutation });
|
|
1354
|
-
}
|
|
1355
|
-
canRun(mutation) {
|
|
1356
|
-
var _a12;
|
|
1357
|
-
const firstPendingMutation = (_a12 = __privateGet(this, _mutations).get(scopeFor(mutation))) == null ? void 0 : _a12.find((m) => m.state.status === "pending");
|
|
1358
|
-
return !firstPendingMutation || firstPendingMutation === mutation;
|
|
1359
|
-
}
|
|
1360
|
-
runNext(mutation) {
|
|
1361
|
-
var _a12;
|
|
1362
|
-
const foundMutation = (_a12 = __privateGet(this, _mutations).get(scopeFor(mutation))) == null ? void 0 : _a12.find((m) => m !== mutation && m.state.isPaused);
|
|
1363
|
-
return (foundMutation == null ? void 0 : foundMutation.continue()) ?? Promise.resolve();
|
|
1364
|
-
}
|
|
1365
|
-
clear() {
|
|
1366
|
-
notifyManager.batch(() => {
|
|
1367
|
-
this.getAll().forEach((mutation) => {
|
|
1368
|
-
this.remove(mutation);
|
|
1369
|
-
});
|
|
1370
|
-
});
|
|
1371
|
-
}
|
|
1372
|
-
getAll() {
|
|
1373
|
-
return [...__privateGet(this, _mutations).values()].flat();
|
|
1374
|
-
}
|
|
1375
|
-
find(filters) {
|
|
1376
|
-
const defaultedFilters = { exact: true, ...filters };
|
|
1377
|
-
return this.getAll().find(
|
|
1378
|
-
(mutation) => matchMutation(defaultedFilters, mutation)
|
|
1379
|
-
);
|
|
1380
|
-
}
|
|
1381
|
-
findAll(filters = {}) {
|
|
1382
|
-
return this.getAll().filter((mutation) => matchMutation(filters, mutation));
|
|
1383
|
-
}
|
|
1384
|
-
notify(event) {
|
|
1385
|
-
notifyManager.batch(() => {
|
|
1386
|
-
this.listeners.forEach((listener) => {
|
|
1387
|
-
listener(event);
|
|
1388
|
-
});
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
resumePausedMutations() {
|
|
1392
|
-
const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
|
|
1393
|
-
return notifyManager.batch(
|
|
1394
|
-
() => Promise.all(
|
|
1395
|
-
pausedMutations.map((mutation) => mutation.continue().catch(noop))
|
|
1396
|
-
)
|
|
1397
|
-
);
|
|
1398
|
-
}
|
|
1399
|
-
}, _mutations = new WeakMap(), _mutationId = new WeakMap(), _a7);
|
|
1400
|
-
function scopeFor(mutation) {
|
|
1401
|
-
var _a12;
|
|
1402
|
-
return ((_a12 = mutation.options.scope) == null ? void 0 : _a12.id) ?? String(mutation.mutationId);
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
1406
|
-
function infiniteQueryBehavior(pages) {
|
|
1407
|
-
return {
|
|
1408
|
-
onFetch: (context, query) => {
|
|
1409
|
-
const fetchFn = async () => {
|
|
1410
|
-
var _a12, _b, _c, _d, _e;
|
|
1411
|
-
const options = context.options;
|
|
1412
|
-
const direction = (_c = (_b = (_a12 = context.fetchOptions) == null ? void 0 : _a12.meta) == null ? void 0 : _b.fetchMore) == null ? void 0 : _c.direction;
|
|
1413
|
-
const oldPages = ((_d = context.state.data) == null ? void 0 : _d.pages) || [];
|
|
1414
|
-
const oldPageParams = ((_e = context.state.data) == null ? void 0 : _e.pageParams) || [];
|
|
1415
|
-
const empty = { pages: [], pageParams: [] };
|
|
1416
|
-
let cancelled = false;
|
|
1417
|
-
const addSignalProperty = (object) => {
|
|
1418
|
-
Object.defineProperty(object, "signal", {
|
|
1419
|
-
enumerable: true,
|
|
1420
|
-
get: () => {
|
|
1421
|
-
if (context.signal.aborted) {
|
|
1422
|
-
cancelled = true;
|
|
1423
|
-
} else {
|
|
1424
|
-
context.signal.addEventListener("abort", () => {
|
|
1425
|
-
cancelled = true;
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
return context.signal;
|
|
1429
|
-
}
|
|
1430
|
-
});
|
|
1431
|
-
};
|
|
1432
|
-
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
1433
|
-
const fetchPage = async (data, param, previous) => {
|
|
1434
|
-
if (cancelled) {
|
|
1435
|
-
return Promise.reject();
|
|
1436
|
-
}
|
|
1437
|
-
if (param == null && data.pages.length) {
|
|
1438
|
-
return Promise.resolve(data);
|
|
1439
|
-
}
|
|
1440
|
-
const queryFnContext = {
|
|
1441
|
-
queryKey: context.queryKey,
|
|
1442
|
-
pageParam: param,
|
|
1443
|
-
direction: previous ? "backward" : "forward",
|
|
1444
|
-
meta: context.options.meta
|
|
1445
|
-
};
|
|
1446
|
-
addSignalProperty(queryFnContext);
|
|
1447
|
-
const page = await queryFn(
|
|
1448
|
-
queryFnContext
|
|
1449
|
-
);
|
|
1450
|
-
const { maxPages } = context.options;
|
|
1451
|
-
const addTo = previous ? addToStart : addToEnd;
|
|
1452
|
-
return {
|
|
1453
|
-
pages: addTo(data.pages, page, maxPages),
|
|
1454
|
-
pageParams: addTo(data.pageParams, param, maxPages)
|
|
1455
|
-
};
|
|
1456
|
-
};
|
|
1457
|
-
let result;
|
|
1458
|
-
if (direction && oldPages.length) {
|
|
1459
|
-
const previous = direction === "backward";
|
|
1460
|
-
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
1461
|
-
const oldData = {
|
|
1462
|
-
pages: oldPages,
|
|
1463
|
-
pageParams: oldPageParams
|
|
1464
|
-
};
|
|
1465
|
-
const param = pageParamFn(options, oldData);
|
|
1466
|
-
result = await fetchPage(oldData, param, previous);
|
|
1467
|
-
} else {
|
|
1468
|
-
result = await fetchPage(
|
|
1469
|
-
empty,
|
|
1470
|
-
oldPageParams[0] ?? options.initialPageParam
|
|
1471
|
-
);
|
|
1472
|
-
const remainingPages = pages ?? oldPages.length;
|
|
1473
|
-
for (let i = 1; i < remainingPages; i++) {
|
|
1474
|
-
const param = getNextPageParam(options, result);
|
|
1475
|
-
result = await fetchPage(result, param);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
return result;
|
|
1479
|
-
};
|
|
1480
|
-
if (context.options.persister) {
|
|
1481
|
-
context.fetchFn = () => {
|
|
1482
|
-
var _a12, _b;
|
|
1483
|
-
return (_b = (_a12 = context.options).persister) == null ? void 0 : _b.call(
|
|
1484
|
-
_a12,
|
|
1485
|
-
fetchFn,
|
|
1486
|
-
{
|
|
1487
|
-
queryKey: context.queryKey,
|
|
1488
|
-
meta: context.options.meta,
|
|
1489
|
-
signal: context.signal
|
|
1490
|
-
},
|
|
1491
|
-
query
|
|
1492
|
-
);
|
|
1493
|
-
};
|
|
1494
|
-
} else {
|
|
1495
|
-
context.fetchFn = fetchFn;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
}
|
|
1500
|
-
function getNextPageParam(options, { pages, pageParams }) {
|
|
1501
|
-
const lastIndex = pages.length - 1;
|
|
1502
|
-
return options.getNextPageParam(
|
|
1503
|
-
pages[lastIndex],
|
|
1504
|
-
pages,
|
|
1505
|
-
pageParams[lastIndex],
|
|
1506
|
-
pageParams
|
|
1507
|
-
);
|
|
1508
|
-
}
|
|
1509
|
-
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
1510
|
-
var _a12;
|
|
1511
|
-
return (_a12 = options.getPreviousPageParam) == null ? void 0 : _a12.call(
|
|
1512
|
-
options,
|
|
1513
|
-
pages[0],
|
|
1514
|
-
pages,
|
|
1515
|
-
pageParams[0],
|
|
1516
|
-
pageParams
|
|
1517
|
-
);
|
|
1518
|
-
}
|
|
1519
|
-
function hasNextPage(options, data) {
|
|
1520
|
-
if (!data)
|
|
1521
|
-
return false;
|
|
1522
|
-
return getNextPageParam(options, data) != null;
|
|
1523
|
-
}
|
|
1524
|
-
function hasPreviousPage(options, data) {
|
|
1525
|
-
if (!data || !options.getPreviousPageParam)
|
|
1526
|
-
return false;
|
|
1527
|
-
return getPreviousPageParam(options, data) != null;
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
1531
|
-
var _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _a8;
|
|
1532
|
-
var QueryClient = (_a8 = class {
|
|
1533
|
-
constructor(config = {}) {
|
|
1534
|
-
__privateAdd(this, _queryCache);
|
|
1535
|
-
__privateAdd(this, _mutationCache2);
|
|
1536
|
-
__privateAdd(this, _defaultOptions2);
|
|
1537
|
-
__privateAdd(this, _queryDefaults);
|
|
1538
|
-
__privateAdd(this, _mutationDefaults);
|
|
1539
|
-
__privateAdd(this, _mountCount);
|
|
1540
|
-
__privateAdd(this, _unsubscribeFocus);
|
|
1541
|
-
__privateAdd(this, _unsubscribeOnline);
|
|
1542
|
-
__privateSet(this, _queryCache, config.queryCache || new QueryCache());
|
|
1543
|
-
__privateSet(this, _mutationCache2, config.mutationCache || new MutationCache());
|
|
1544
|
-
__privateSet(this, _defaultOptions2, config.defaultOptions || {});
|
|
1545
|
-
__privateSet(this, _queryDefaults, /* @__PURE__ */ new Map());
|
|
1546
|
-
__privateSet(this, _mutationDefaults, /* @__PURE__ */ new Map());
|
|
1547
|
-
__privateSet(this, _mountCount, 0);
|
|
1548
|
-
}
|
|
1549
|
-
mount() {
|
|
1550
|
-
__privateWrapper(this, _mountCount)._++;
|
|
1551
|
-
if (__privateGet(this, _mountCount) !== 1)
|
|
1552
|
-
return;
|
|
1553
|
-
__privateSet(this, _unsubscribeFocus, focusManager.subscribe(async (focused) => {
|
|
1554
|
-
if (focused) {
|
|
1555
|
-
await this.resumePausedMutations();
|
|
1556
|
-
__privateGet(this, _queryCache).onFocus();
|
|
1557
|
-
}
|
|
1558
|
-
}));
|
|
1559
|
-
__privateSet(this, _unsubscribeOnline, onlineManager.subscribe(async (online) => {
|
|
1560
|
-
if (online) {
|
|
1561
|
-
await this.resumePausedMutations();
|
|
1562
|
-
__privateGet(this, _queryCache).onOnline();
|
|
1563
|
-
}
|
|
1564
|
-
}));
|
|
1565
|
-
}
|
|
1566
|
-
unmount() {
|
|
1567
|
-
var _a12, _b;
|
|
1568
|
-
__privateWrapper(this, _mountCount)._--;
|
|
1569
|
-
if (__privateGet(this, _mountCount) !== 0)
|
|
1570
|
-
return;
|
|
1571
|
-
(_a12 = __privateGet(this, _unsubscribeFocus)) == null ? void 0 : _a12.call(this);
|
|
1572
|
-
__privateSet(this, _unsubscribeFocus, void 0);
|
|
1573
|
-
(_b = __privateGet(this, _unsubscribeOnline)) == null ? void 0 : _b.call(this);
|
|
1574
|
-
__privateSet(this, _unsubscribeOnline, void 0);
|
|
1575
|
-
}
|
|
1576
|
-
isFetching(filters) {
|
|
1577
|
-
return __privateGet(this, _queryCache).findAll({ ...filters, fetchStatus: "fetching" }).length;
|
|
1578
|
-
}
|
|
1579
|
-
isMutating(filters) {
|
|
1580
|
-
return __privateGet(this, _mutationCache2).findAll({ ...filters, status: "pending" }).length;
|
|
1581
|
-
}
|
|
1582
|
-
getQueryData(queryKey) {
|
|
1583
|
-
var _a12;
|
|
1584
|
-
const options = this.defaultQueryOptions({ queryKey });
|
|
1585
|
-
return (_a12 = __privateGet(this, _queryCache).get(options.queryHash)) == null ? void 0 : _a12.state.data;
|
|
1586
|
-
}
|
|
1587
|
-
ensureQueryData(options) {
|
|
1588
|
-
const cachedData = this.getQueryData(options.queryKey);
|
|
1589
|
-
if (cachedData === void 0)
|
|
1590
|
-
return this.fetchQuery(options);
|
|
1591
|
-
else {
|
|
1592
|
-
const defaultedOptions = this.defaultQueryOptions(options);
|
|
1593
|
-
const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
|
|
1594
|
-
if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
|
|
1595
|
-
void this.prefetchQuery(defaultedOptions);
|
|
1596
|
-
}
|
|
1597
|
-
return Promise.resolve(cachedData);
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
getQueriesData(filters) {
|
|
1601
|
-
return __privateGet(this, _queryCache).findAll(filters).map(({ queryKey, state }) => {
|
|
1602
|
-
const data = state.data;
|
|
1603
|
-
return [queryKey, data];
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
setQueryData(queryKey, updater, options) {
|
|
1607
|
-
const defaultedOptions = this.defaultQueryOptions({ queryKey });
|
|
1608
|
-
const query = __privateGet(this, _queryCache).get(
|
|
1609
|
-
defaultedOptions.queryHash
|
|
1610
|
-
);
|
|
1611
|
-
const prevData = query == null ? void 0 : query.state.data;
|
|
1612
|
-
const data = functionalUpdate(updater, prevData);
|
|
1613
|
-
if (data === void 0) {
|
|
1614
|
-
return void 0;
|
|
1615
|
-
}
|
|
1616
|
-
return __privateGet(this, _queryCache).build(this, defaultedOptions).setData(data, { ...options, manual: true });
|
|
1617
|
-
}
|
|
1618
|
-
setQueriesData(filters, updater, options) {
|
|
1619
|
-
return notifyManager.batch(
|
|
1620
|
-
() => __privateGet(this, _queryCache).findAll(filters).map(({ queryKey }) => [
|
|
1621
|
-
queryKey,
|
|
1622
|
-
this.setQueryData(queryKey, updater, options)
|
|
1623
|
-
])
|
|
1624
|
-
);
|
|
1625
|
-
}
|
|
1626
|
-
getQueryState(queryKey) {
|
|
1627
|
-
var _a12;
|
|
1628
|
-
const options = this.defaultQueryOptions({ queryKey });
|
|
1629
|
-
return (_a12 = __privateGet(this, _queryCache).get(options.queryHash)) == null ? void 0 : _a12.state;
|
|
1630
|
-
}
|
|
1631
|
-
removeQueries(filters) {
|
|
1632
|
-
const queryCache = __privateGet(this, _queryCache);
|
|
1633
|
-
notifyManager.batch(() => {
|
|
1634
|
-
queryCache.findAll(filters).forEach((query) => {
|
|
1635
|
-
queryCache.remove(query);
|
|
1636
|
-
});
|
|
1637
|
-
});
|
|
1638
|
-
}
|
|
1639
|
-
resetQueries(filters, options) {
|
|
1640
|
-
const queryCache = __privateGet(this, _queryCache);
|
|
1641
|
-
const refetchFilters = {
|
|
1642
|
-
type: "active",
|
|
1643
|
-
...filters
|
|
1644
|
-
};
|
|
1645
|
-
return notifyManager.batch(() => {
|
|
1646
|
-
queryCache.findAll(filters).forEach((query) => {
|
|
1647
|
-
query.reset();
|
|
1648
|
-
});
|
|
1649
|
-
return this.refetchQueries(refetchFilters, options);
|
|
1650
|
-
});
|
|
1651
|
-
}
|
|
1652
|
-
cancelQueries(filters = {}, cancelOptions = {}) {
|
|
1653
|
-
const defaultedCancelOptions = { revert: true, ...cancelOptions };
|
|
1654
|
-
const promises = notifyManager.batch(
|
|
1655
|
-
() => __privateGet(this, _queryCache).findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
|
|
1656
|
-
);
|
|
1657
|
-
return Promise.all(promises).then(noop).catch(noop);
|
|
1658
|
-
}
|
|
1659
|
-
invalidateQueries(filters = {}, options = {}) {
|
|
1660
|
-
return notifyManager.batch(() => {
|
|
1661
|
-
__privateGet(this, _queryCache).findAll(filters).forEach((query) => {
|
|
1662
|
-
query.invalidate();
|
|
1663
|
-
});
|
|
1664
|
-
if (filters.refetchType === "none") {
|
|
1665
|
-
return Promise.resolve();
|
|
1666
|
-
}
|
|
1667
|
-
const refetchFilters = {
|
|
1668
|
-
...filters,
|
|
1669
|
-
type: filters.refetchType ?? filters.type ?? "active"
|
|
1670
|
-
};
|
|
1671
|
-
return this.refetchQueries(refetchFilters, options);
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
refetchQueries(filters = {}, options) {
|
|
1675
|
-
const fetchOptions = {
|
|
1676
|
-
...options,
|
|
1677
|
-
cancelRefetch: (options == null ? void 0 : options.cancelRefetch) ?? true
|
|
1678
|
-
};
|
|
1679
|
-
const promises = notifyManager.batch(
|
|
1680
|
-
() => __privateGet(this, _queryCache).findAll(filters).filter((query) => !query.isDisabled()).map((query) => {
|
|
1681
|
-
let promise = query.fetch(void 0, fetchOptions);
|
|
1682
|
-
if (!fetchOptions.throwOnError) {
|
|
1683
|
-
promise = promise.catch(noop);
|
|
1684
|
-
}
|
|
1685
|
-
return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
|
|
1686
|
-
})
|
|
1687
|
-
);
|
|
1688
|
-
return Promise.all(promises).then(noop);
|
|
1689
|
-
}
|
|
1690
|
-
fetchQuery(options) {
|
|
1691
|
-
const defaultedOptions = this.defaultQueryOptions(options);
|
|
1692
|
-
if (defaultedOptions.retry === void 0) {
|
|
1693
|
-
defaultedOptions.retry = false;
|
|
1694
|
-
}
|
|
1695
|
-
const query = __privateGet(this, _queryCache).build(this, defaultedOptions);
|
|
1696
|
-
return query.isStaleByTime(
|
|
1697
|
-
resolveStaleTime(defaultedOptions.staleTime, query)
|
|
1698
|
-
) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
1699
|
-
}
|
|
1700
|
-
prefetchQuery(options) {
|
|
1701
|
-
return this.fetchQuery(options).then(noop).catch(noop);
|
|
1702
|
-
}
|
|
1703
|
-
fetchInfiniteQuery(options) {
|
|
1704
|
-
options.behavior = infiniteQueryBehavior(options.pages);
|
|
1705
|
-
return this.fetchQuery(options);
|
|
1706
|
-
}
|
|
1707
|
-
prefetchInfiniteQuery(options) {
|
|
1708
|
-
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
1709
|
-
}
|
|
1710
|
-
resumePausedMutations() {
|
|
1711
|
-
if (onlineManager.isOnline()) {
|
|
1712
|
-
return __privateGet(this, _mutationCache2).resumePausedMutations();
|
|
1713
|
-
}
|
|
1714
|
-
return Promise.resolve();
|
|
1715
|
-
}
|
|
1716
|
-
getQueryCache() {
|
|
1717
|
-
return __privateGet(this, _queryCache);
|
|
1718
|
-
}
|
|
1719
|
-
getMutationCache() {
|
|
1720
|
-
return __privateGet(this, _mutationCache2);
|
|
1721
|
-
}
|
|
1722
|
-
getDefaultOptions() {
|
|
1723
|
-
return __privateGet(this, _defaultOptions2);
|
|
1724
|
-
}
|
|
1725
|
-
setDefaultOptions(options) {
|
|
1726
|
-
__privateSet(this, _defaultOptions2, options);
|
|
1727
|
-
}
|
|
1728
|
-
setQueryDefaults(queryKey, options) {
|
|
1729
|
-
__privateGet(this, _queryDefaults).set(hashKey(queryKey), {
|
|
1730
|
-
queryKey,
|
|
1731
|
-
defaultOptions: options
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
getQueryDefaults(queryKey) {
|
|
1735
|
-
const defaults = [...__privateGet(this, _queryDefaults).values()];
|
|
1736
|
-
let result = {};
|
|
1737
|
-
defaults.forEach((queryDefault) => {
|
|
1738
|
-
if (partialMatchKey(queryKey, queryDefault.queryKey)) {
|
|
1739
|
-
result = { ...result, ...queryDefault.defaultOptions };
|
|
1740
|
-
}
|
|
1741
|
-
});
|
|
1742
|
-
return result;
|
|
1743
|
-
}
|
|
1744
|
-
setMutationDefaults(mutationKey, options) {
|
|
1745
|
-
__privateGet(this, _mutationDefaults).set(hashKey(mutationKey), {
|
|
1746
|
-
mutationKey,
|
|
1747
|
-
defaultOptions: options
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
getMutationDefaults(mutationKey) {
|
|
1751
|
-
const defaults = [...__privateGet(this, _mutationDefaults).values()];
|
|
1752
|
-
let result = {};
|
|
1753
|
-
defaults.forEach((queryDefault) => {
|
|
1754
|
-
if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
|
|
1755
|
-
result = { ...result, ...queryDefault.defaultOptions };
|
|
1756
|
-
}
|
|
1757
|
-
});
|
|
1758
|
-
return result;
|
|
1759
|
-
}
|
|
1760
|
-
defaultQueryOptions(options) {
|
|
1761
|
-
if (options._defaulted) {
|
|
1762
|
-
return options;
|
|
1763
|
-
}
|
|
1764
|
-
const defaultedOptions = {
|
|
1765
|
-
...__privateGet(this, _defaultOptions2).queries,
|
|
1766
|
-
...this.getQueryDefaults(options.queryKey),
|
|
1767
|
-
...options,
|
|
1768
|
-
_defaulted: true
|
|
1769
|
-
};
|
|
1770
|
-
if (!defaultedOptions.queryHash) {
|
|
1771
|
-
defaultedOptions.queryHash = hashQueryKeyByOptions(
|
|
1772
|
-
defaultedOptions.queryKey,
|
|
1773
|
-
defaultedOptions
|
|
1774
|
-
);
|
|
1775
|
-
}
|
|
1776
|
-
if (defaultedOptions.refetchOnReconnect === void 0) {
|
|
1777
|
-
defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
|
|
1778
|
-
}
|
|
1779
|
-
if (defaultedOptions.throwOnError === void 0) {
|
|
1780
|
-
defaultedOptions.throwOnError = !!defaultedOptions.suspense;
|
|
1781
|
-
}
|
|
1782
|
-
if (!defaultedOptions.networkMode && defaultedOptions.persister) {
|
|
1783
|
-
defaultedOptions.networkMode = "offlineFirst";
|
|
1784
|
-
}
|
|
1785
|
-
if (defaultedOptions.enabled !== true && defaultedOptions.queryFn === skipToken) {
|
|
1786
|
-
defaultedOptions.enabled = false;
|
|
1787
|
-
}
|
|
1788
|
-
return defaultedOptions;
|
|
1789
|
-
}
|
|
1790
|
-
defaultMutationOptions(options) {
|
|
1791
|
-
if (options == null ? void 0 : options._defaulted) {
|
|
1792
|
-
return options;
|
|
1793
|
-
}
|
|
1794
|
-
return {
|
|
1795
|
-
...__privateGet(this, _defaultOptions2).mutations,
|
|
1796
|
-
...(options == null ? void 0 : options.mutationKey) && this.getMutationDefaults(options.mutationKey),
|
|
1797
|
-
...options,
|
|
1798
|
-
_defaulted: true
|
|
1799
|
-
};
|
|
1800
|
-
}
|
|
1801
|
-
clear() {
|
|
1802
|
-
__privateGet(this, _queryCache).clear();
|
|
1803
|
-
__privateGet(this, _mutationCache2).clear();
|
|
1804
|
-
}
|
|
1805
|
-
}, _queryCache = new WeakMap(), _mutationCache2 = new WeakMap(), _defaultOptions2 = new WeakMap(), _queryDefaults = new WeakMap(), _mutationDefaults = new WeakMap(), _mountCount = new WeakMap(), _unsubscribeFocus = new WeakMap(), _unsubscribeOnline = new WeakMap(), _a8);
|
|
1806
|
-
|
|
1807
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
1808
|
-
var _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _a9;
|
|
1809
|
-
var QueryObserver = (_a9 = class extends Subscribable {
|
|
1810
|
-
constructor(client, options) {
|
|
1811
|
-
super();
|
|
1812
|
-
__privateAdd(this, _QueryObserver_instances);
|
|
1813
|
-
__privateAdd(this, _client);
|
|
1814
|
-
__privateAdd(this, _currentQuery);
|
|
1815
|
-
__privateAdd(this, _currentQueryInitialState);
|
|
1816
|
-
__privateAdd(this, _currentResult);
|
|
1817
|
-
__privateAdd(this, _currentResultState);
|
|
1818
|
-
__privateAdd(this, _currentResultOptions);
|
|
1819
|
-
__privateAdd(this, _selectError);
|
|
1820
|
-
__privateAdd(this, _selectFn);
|
|
1821
|
-
__privateAdd(this, _selectResult);
|
|
1822
|
-
// This property keeps track of the last query with defined data.
|
|
1823
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
1824
|
-
__privateAdd(this, _lastQueryWithDefinedData);
|
|
1825
|
-
__privateAdd(this, _staleTimeoutId);
|
|
1826
|
-
__privateAdd(this, _refetchIntervalId);
|
|
1827
|
-
__privateAdd(this, _currentRefetchInterval);
|
|
1828
|
-
__privateAdd(this, _trackedProps, /* @__PURE__ */ new Set());
|
|
1829
|
-
this.options = options;
|
|
1830
|
-
__privateSet(this, _client, client);
|
|
1831
|
-
__privateSet(this, _selectError, null);
|
|
1832
|
-
this.bindMethods();
|
|
1833
|
-
this.setOptions(options);
|
|
1834
|
-
}
|
|
1835
|
-
bindMethods() {
|
|
1836
|
-
this.refetch = this.refetch.bind(this);
|
|
1837
|
-
}
|
|
1838
|
-
onSubscribe() {
|
|
1839
|
-
if (this.listeners.size === 1) {
|
|
1840
|
-
__privateGet(this, _currentQuery).addObserver(this);
|
|
1841
|
-
if (shouldFetchOnMount(__privateGet(this, _currentQuery), this.options)) {
|
|
1842
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
1843
|
-
} else {
|
|
1844
|
-
this.updateResult();
|
|
1845
|
-
}
|
|
1846
|
-
__privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
onUnsubscribe() {
|
|
1850
|
-
if (!this.hasListeners()) {
|
|
1851
|
-
this.destroy();
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
shouldFetchOnReconnect() {
|
|
1855
|
-
return shouldFetchOn(
|
|
1856
|
-
__privateGet(this, _currentQuery),
|
|
1857
|
-
this.options,
|
|
1858
|
-
this.options.refetchOnReconnect
|
|
1859
|
-
);
|
|
1860
|
-
}
|
|
1861
|
-
shouldFetchOnWindowFocus() {
|
|
1862
|
-
return shouldFetchOn(
|
|
1863
|
-
__privateGet(this, _currentQuery),
|
|
1864
|
-
this.options,
|
|
1865
|
-
this.options.refetchOnWindowFocus
|
|
1866
|
-
);
|
|
1867
|
-
}
|
|
1868
|
-
destroy() {
|
|
1869
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
1870
|
-
__privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
|
|
1871
|
-
__privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
|
|
1872
|
-
__privateGet(this, _currentQuery).removeObserver(this);
|
|
1873
|
-
}
|
|
1874
|
-
setOptions(options, notifyOptions) {
|
|
1875
|
-
const prevOptions = this.options;
|
|
1876
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
1877
|
-
this.options = __privateGet(this, _client).defaultQueryOptions(options);
|
|
1878
|
-
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean") {
|
|
1879
|
-
throw new Error("Expected enabled to be a boolean");
|
|
1880
|
-
}
|
|
1881
|
-
__privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
|
|
1882
|
-
__privateGet(this, _currentQuery).setOptions(this.options);
|
|
1883
|
-
if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
|
|
1884
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
1885
|
-
type: "observerOptionsUpdated",
|
|
1886
|
-
query: __privateGet(this, _currentQuery),
|
|
1887
|
-
observer: this
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
const mounted = this.hasListeners();
|
|
1891
|
-
if (mounted && shouldFetchOptionally(
|
|
1892
|
-
__privateGet(this, _currentQuery),
|
|
1893
|
-
prevQuery,
|
|
1894
|
-
this.options,
|
|
1895
|
-
prevOptions
|
|
1896
|
-
)) {
|
|
1897
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
1898
|
-
}
|
|
1899
|
-
this.updateResult(notifyOptions);
|
|
1900
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || this.options.enabled !== prevOptions.enabled || resolveStaleTime(this.options.staleTime, __privateGet(this, _currentQuery)) !== resolveStaleTime(prevOptions.staleTime, __privateGet(this, _currentQuery)))) {
|
|
1901
|
-
__privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
|
|
1902
|
-
}
|
|
1903
|
-
const nextRefetchInterval = __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this);
|
|
1904
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== __privateGet(this, _currentRefetchInterval))) {
|
|
1905
|
-
__privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, nextRefetchInterval);
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
getOptimisticResult(options) {
|
|
1909
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), options);
|
|
1910
|
-
const result = this.createResult(query, options);
|
|
1911
|
-
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
1912
|
-
__privateSet(this, _currentResult, result);
|
|
1913
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
1914
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
1915
|
-
}
|
|
1916
|
-
return result;
|
|
1917
|
-
}
|
|
1918
|
-
getCurrentResult() {
|
|
1919
|
-
return __privateGet(this, _currentResult);
|
|
1920
|
-
}
|
|
1921
|
-
trackResult(result, onPropTracked) {
|
|
1922
|
-
const trackedResult = {};
|
|
1923
|
-
Object.keys(result).forEach((key) => {
|
|
1924
|
-
Object.defineProperty(trackedResult, key, {
|
|
1925
|
-
configurable: false,
|
|
1926
|
-
enumerable: true,
|
|
1927
|
-
get: () => {
|
|
1928
|
-
this.trackProp(key);
|
|
1929
|
-
onPropTracked == null ? void 0 : onPropTracked(key);
|
|
1930
|
-
return result[key];
|
|
1931
|
-
}
|
|
1932
|
-
});
|
|
1933
|
-
});
|
|
1934
|
-
return trackedResult;
|
|
1935
|
-
}
|
|
1936
|
-
trackProp(key) {
|
|
1937
|
-
__privateGet(this, _trackedProps).add(key);
|
|
1938
|
-
}
|
|
1939
|
-
getCurrentQuery() {
|
|
1940
|
-
return __privateGet(this, _currentQuery);
|
|
1941
|
-
}
|
|
1942
|
-
refetch({ ...options } = {}) {
|
|
1943
|
-
return this.fetch({
|
|
1944
|
-
...options
|
|
1945
|
-
});
|
|
1946
|
-
}
|
|
1947
|
-
fetchOptimistic(options) {
|
|
1948
|
-
const defaultedOptions = __privateGet(this, _client).defaultQueryOptions(options);
|
|
1949
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), defaultedOptions);
|
|
1950
|
-
query.isFetchingOptimistic = true;
|
|
1951
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
1952
|
-
}
|
|
1953
|
-
fetch(fetchOptions) {
|
|
1954
|
-
return __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this, {
|
|
1955
|
-
...fetchOptions,
|
|
1956
|
-
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
1957
|
-
}).then(() => {
|
|
1958
|
-
this.updateResult();
|
|
1959
|
-
return __privateGet(this, _currentResult);
|
|
1960
|
-
});
|
|
1961
|
-
}
|
|
1962
|
-
createResult(query, options) {
|
|
1963
|
-
var _a12;
|
|
1964
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
1965
|
-
const prevOptions = this.options;
|
|
1966
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
1967
|
-
const prevResultState = __privateGet(this, _currentResultState);
|
|
1968
|
-
const prevResultOptions = __privateGet(this, _currentResultOptions);
|
|
1969
|
-
const queryChange = query !== prevQuery;
|
|
1970
|
-
const queryInitialState = queryChange ? query.state : __privateGet(this, _currentQueryInitialState);
|
|
1971
|
-
const { state } = query;
|
|
1972
|
-
let newState = { ...state };
|
|
1973
|
-
let isPlaceholderData = false;
|
|
1974
|
-
let data;
|
|
1975
|
-
if (options._optimisticResults) {
|
|
1976
|
-
const mounted = this.hasListeners();
|
|
1977
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
1978
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
1979
|
-
if (fetchOnMount || fetchOptionally) {
|
|
1980
|
-
newState = {
|
|
1981
|
-
...newState,
|
|
1982
|
-
...fetchState(state.data, query.options)
|
|
1983
|
-
};
|
|
1984
|
-
}
|
|
1985
|
-
if (options._optimisticResults === "isRestoring") {
|
|
1986
|
-
newState.fetchStatus = "idle";
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
let { error, errorUpdatedAt, status } = newState;
|
|
1990
|
-
if (options.select && newState.data !== void 0) {
|
|
1991
|
-
if (prevResult && newState.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === __privateGet(this, _selectFn)) {
|
|
1992
|
-
data = __privateGet(this, _selectResult);
|
|
1993
|
-
} else {
|
|
1994
|
-
try {
|
|
1995
|
-
__privateSet(this, _selectFn, options.select);
|
|
1996
|
-
data = options.select(newState.data);
|
|
1997
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
|
|
1998
|
-
__privateSet(this, _selectResult, data);
|
|
1999
|
-
__privateSet(this, _selectError, null);
|
|
2000
|
-
} catch (selectError) {
|
|
2001
|
-
__privateSet(this, _selectError, selectError);
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
} else {
|
|
2005
|
-
data = newState.data;
|
|
2006
|
-
}
|
|
2007
|
-
if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
|
|
2008
|
-
let placeholderData;
|
|
2009
|
-
if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
2010
|
-
placeholderData = prevResult.data;
|
|
2011
|
-
} else {
|
|
2012
|
-
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
|
|
2013
|
-
(_a12 = __privateGet(this, _lastQueryWithDefinedData)) == null ? void 0 : _a12.state.data,
|
|
2014
|
-
__privateGet(this, _lastQueryWithDefinedData)
|
|
2015
|
-
) : options.placeholderData;
|
|
2016
|
-
if (options.select && placeholderData !== void 0) {
|
|
2017
|
-
try {
|
|
2018
|
-
placeholderData = options.select(placeholderData);
|
|
2019
|
-
__privateSet(this, _selectError, null);
|
|
2020
|
-
} catch (selectError) {
|
|
2021
|
-
__privateSet(this, _selectError, selectError);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
if (placeholderData !== void 0) {
|
|
2026
|
-
status = "success";
|
|
2027
|
-
data = replaceData(
|
|
2028
|
-
prevResult == null ? void 0 : prevResult.data,
|
|
2029
|
-
placeholderData,
|
|
2030
|
-
options
|
|
2031
|
-
);
|
|
2032
|
-
isPlaceholderData = true;
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
if (__privateGet(this, _selectError)) {
|
|
2036
|
-
error = __privateGet(this, _selectError);
|
|
2037
|
-
data = __privateGet(this, _selectResult);
|
|
2038
|
-
errorUpdatedAt = Date.now();
|
|
2039
|
-
status = "error";
|
|
2040
|
-
}
|
|
2041
|
-
const isFetching = newState.fetchStatus === "fetching";
|
|
2042
|
-
const isPending = status === "pending";
|
|
2043
|
-
const isError = status === "error";
|
|
2044
|
-
const isLoading = isPending && isFetching;
|
|
2045
|
-
const hasData = data !== void 0;
|
|
2046
|
-
const result = {
|
|
2047
|
-
status,
|
|
2048
|
-
fetchStatus: newState.fetchStatus,
|
|
2049
|
-
isPending,
|
|
2050
|
-
isSuccess: status === "success",
|
|
2051
|
-
isError,
|
|
2052
|
-
isInitialLoading: isLoading,
|
|
2053
|
-
isLoading,
|
|
2054
|
-
data,
|
|
2055
|
-
dataUpdatedAt: newState.dataUpdatedAt,
|
|
2056
|
-
error,
|
|
2057
|
-
errorUpdatedAt,
|
|
2058
|
-
failureCount: newState.fetchFailureCount,
|
|
2059
|
-
failureReason: newState.fetchFailureReason,
|
|
2060
|
-
errorUpdateCount: newState.errorUpdateCount,
|
|
2061
|
-
isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
|
|
2062
|
-
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
2063
|
-
isFetching,
|
|
2064
|
-
isRefetching: isFetching && !isPending,
|
|
2065
|
-
isLoadingError: isError && !hasData,
|
|
2066
|
-
isPaused: newState.fetchStatus === "paused",
|
|
2067
|
-
isPlaceholderData,
|
|
2068
|
-
isRefetchError: isError && hasData,
|
|
2069
|
-
isStale: isStale(query, options),
|
|
2070
|
-
refetch: this.refetch
|
|
2071
|
-
};
|
|
2072
|
-
return result;
|
|
2073
|
-
}
|
|
2074
|
-
updateResult(notifyOptions) {
|
|
2075
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
2076
|
-
const nextResult = this.createResult(__privateGet(this, _currentQuery), this.options);
|
|
2077
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
2078
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
2079
|
-
if (__privateGet(this, _currentResultState).data !== void 0) {
|
|
2080
|
-
__privateSet(this, _lastQueryWithDefinedData, __privateGet(this, _currentQuery));
|
|
2081
|
-
}
|
|
2082
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
2083
|
-
return;
|
|
2084
|
-
}
|
|
2085
|
-
__privateSet(this, _currentResult, nextResult);
|
|
2086
|
-
const defaultNotifyOptions = {};
|
|
2087
|
-
const shouldNotifyListeners = () => {
|
|
2088
|
-
if (!prevResult) {
|
|
2089
|
-
return true;
|
|
2090
|
-
}
|
|
2091
|
-
const { notifyOnChangeProps } = this.options;
|
|
2092
|
-
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
2093
|
-
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !__privateGet(this, _trackedProps).size) {
|
|
2094
|
-
return true;
|
|
2095
|
-
}
|
|
2096
|
-
const includedProps = new Set(
|
|
2097
|
-
notifyOnChangePropsValue ?? __privateGet(this, _trackedProps)
|
|
2098
|
-
);
|
|
2099
|
-
if (this.options.throwOnError) {
|
|
2100
|
-
includedProps.add("error");
|
|
2101
|
-
}
|
|
2102
|
-
return Object.keys(__privateGet(this, _currentResult)).some((key) => {
|
|
2103
|
-
const typedKey = key;
|
|
2104
|
-
const changed = __privateGet(this, _currentResult)[typedKey] !== prevResult[typedKey];
|
|
2105
|
-
return changed && includedProps.has(typedKey);
|
|
2106
|
-
});
|
|
2107
|
-
};
|
|
2108
|
-
if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
|
|
2109
|
-
defaultNotifyOptions.listeners = true;
|
|
2110
|
-
}
|
|
2111
|
-
__privateMethod(this, _QueryObserver_instances, notify_fn).call(this, { ...defaultNotifyOptions, ...notifyOptions });
|
|
2112
|
-
}
|
|
2113
|
-
onQueryUpdate() {
|
|
2114
|
-
this.updateResult();
|
|
2115
|
-
if (this.hasListeners()) {
|
|
2116
|
-
__privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
}, _client = new WeakMap(), _currentQuery = new WeakMap(), _currentQueryInitialState = new WeakMap(), _currentResult = new WeakMap(), _currentResultState = new WeakMap(), _currentResultOptions = new WeakMap(), _selectError = new WeakMap(), _selectFn = new WeakMap(), _selectResult = new WeakMap(), _lastQueryWithDefinedData = new WeakMap(), _staleTimeoutId = new WeakMap(), _refetchIntervalId = new WeakMap(), _currentRefetchInterval = new WeakMap(), _trackedProps = new WeakMap(), _QueryObserver_instances = new WeakSet(), executeFetch_fn = function(fetchOptions) {
|
|
2120
|
-
__privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
|
|
2121
|
-
let promise = __privateGet(this, _currentQuery).fetch(
|
|
2122
|
-
this.options,
|
|
2123
|
-
fetchOptions
|
|
2124
|
-
);
|
|
2125
|
-
if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
|
|
2126
|
-
promise = promise.catch(noop);
|
|
2127
|
-
}
|
|
2128
|
-
return promise;
|
|
2129
|
-
}, updateStaleTimeout_fn = function() {
|
|
2130
|
-
__privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
|
|
2131
|
-
const staleTime = resolveStaleTime(
|
|
2132
|
-
this.options.staleTime,
|
|
2133
|
-
__privateGet(this, _currentQuery)
|
|
2134
|
-
);
|
|
2135
|
-
if (isServer || __privateGet(this, _currentResult).isStale || !isValidTimeout(staleTime)) {
|
|
2136
|
-
return;
|
|
2137
|
-
}
|
|
2138
|
-
const time = timeUntilStale(__privateGet(this, _currentResult).dataUpdatedAt, staleTime);
|
|
2139
|
-
const timeout = time + 1;
|
|
2140
|
-
__privateSet(this, _staleTimeoutId, setTimeout(() => {
|
|
2141
|
-
if (!__privateGet(this, _currentResult).isStale) {
|
|
2142
|
-
this.updateResult();
|
|
2143
|
-
}
|
|
2144
|
-
}, timeout));
|
|
2145
|
-
}, computeRefetchInterval_fn = function() {
|
|
2146
|
-
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(__privateGet(this, _currentQuery)) : this.options.refetchInterval) ?? false;
|
|
2147
|
-
}, updateRefetchInterval_fn = function(nextInterval) {
|
|
2148
|
-
__privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
|
|
2149
|
-
__privateSet(this, _currentRefetchInterval, nextInterval);
|
|
2150
|
-
if (isServer || this.options.enabled === false || !isValidTimeout(__privateGet(this, _currentRefetchInterval)) || __privateGet(this, _currentRefetchInterval) === 0) {
|
|
2151
|
-
return;
|
|
2152
|
-
}
|
|
2153
|
-
__privateSet(this, _refetchIntervalId, setInterval(() => {
|
|
2154
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
2155
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
2156
|
-
}
|
|
2157
|
-
}, __privateGet(this, _currentRefetchInterval)));
|
|
2158
|
-
}, updateTimers_fn = function() {
|
|
2159
|
-
__privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
|
|
2160
|
-
__privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this));
|
|
2161
|
-
}, clearStaleTimeout_fn = function() {
|
|
2162
|
-
if (__privateGet(this, _staleTimeoutId)) {
|
|
2163
|
-
clearTimeout(__privateGet(this, _staleTimeoutId));
|
|
2164
|
-
__privateSet(this, _staleTimeoutId, void 0);
|
|
2165
|
-
}
|
|
2166
|
-
}, clearRefetchInterval_fn = function() {
|
|
2167
|
-
if (__privateGet(this, _refetchIntervalId)) {
|
|
2168
|
-
clearInterval(__privateGet(this, _refetchIntervalId));
|
|
2169
|
-
__privateSet(this, _refetchIntervalId, void 0);
|
|
2170
|
-
}
|
|
2171
|
-
}, updateQuery_fn = function() {
|
|
2172
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), this.options);
|
|
2173
|
-
if (query === __privateGet(this, _currentQuery)) {
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
2177
|
-
__privateSet(this, _currentQuery, query);
|
|
2178
|
-
__privateSet(this, _currentQueryInitialState, query.state);
|
|
2179
|
-
if (this.hasListeners()) {
|
|
2180
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
2181
|
-
query.addObserver(this);
|
|
2182
|
-
}
|
|
2183
|
-
}, notify_fn = function(notifyOptions) {
|
|
2184
|
-
notifyManager.batch(() => {
|
|
2185
|
-
if (notifyOptions.listeners) {
|
|
2186
|
-
this.listeners.forEach((listener) => {
|
|
2187
|
-
listener(__privateGet(this, _currentResult));
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
2191
|
-
query: __privateGet(this, _currentQuery),
|
|
2192
|
-
type: "observerResultsUpdated"
|
|
2193
|
-
});
|
|
2194
|
-
});
|
|
2195
|
-
}, _a9);
|
|
2196
|
-
function shouldLoadOnMount(query, options) {
|
|
2197
|
-
return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
|
|
2198
|
-
}
|
|
2199
|
-
function shouldFetchOnMount(query, options) {
|
|
2200
|
-
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
2201
|
-
}
|
|
2202
|
-
function shouldFetchOn(query, options, field) {
|
|
2203
|
-
if (options.enabled !== false) {
|
|
2204
|
-
const value = typeof field === "function" ? field(query) : field;
|
|
2205
|
-
return value === "always" || value !== false && isStale(query, options);
|
|
2206
|
-
}
|
|
2207
|
-
return false;
|
|
2208
|
-
}
|
|
2209
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
2210
|
-
return (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
2211
|
-
}
|
|
2212
|
-
function isStale(query, options) {
|
|
2213
|
-
return options.enabled !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
2214
|
-
}
|
|
2215
|
-
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
2216
|
-
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
2217
|
-
return true;
|
|
2218
|
-
}
|
|
2219
|
-
return false;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/queriesObserver.js
|
|
2223
|
-
function difference(array1, array2) {
|
|
2224
|
-
return array1.filter((x) => !array2.includes(x));
|
|
2225
|
-
}
|
|
2226
|
-
function replaceAt(array, index, value) {
|
|
2227
|
-
const copy = array.slice(0);
|
|
2228
|
-
copy[index] = value;
|
|
2229
|
-
return copy;
|
|
2230
|
-
}
|
|
2231
|
-
var _client2, _result, _queries2, _observers2, _combinedResult, _lastCombine, _lastResult, _QueriesObserver_instances, combineResult_fn, findMatchingObservers_fn, onUpdate_fn, notify_fn2, _a10;
|
|
2232
|
-
var QueriesObserver = (_a10 = class extends Subscribable {
|
|
2233
|
-
constructor(client, queries, _options) {
|
|
2234
|
-
super();
|
|
2235
|
-
__privateAdd(this, _QueriesObserver_instances);
|
|
2236
|
-
__privateAdd(this, _client2);
|
|
2237
|
-
__privateAdd(this, _result);
|
|
2238
|
-
__privateAdd(this, _queries2);
|
|
2239
|
-
__privateAdd(this, _observers2);
|
|
2240
|
-
__privateAdd(this, _combinedResult);
|
|
2241
|
-
__privateAdd(this, _lastCombine);
|
|
2242
|
-
__privateAdd(this, _lastResult);
|
|
2243
|
-
__privateSet(this, _client2, client);
|
|
2244
|
-
__privateSet(this, _queries2, []);
|
|
2245
|
-
__privateSet(this, _observers2, []);
|
|
2246
|
-
__privateSet(this, _result, []);
|
|
2247
|
-
this.setQueries(queries);
|
|
2248
|
-
}
|
|
2249
|
-
onSubscribe() {
|
|
2250
|
-
if (this.listeners.size === 1) {
|
|
2251
|
-
__privateGet(this, _observers2).forEach((observer) => {
|
|
2252
|
-
observer.subscribe((result) => {
|
|
2253
|
-
__privateMethod(this, _QueriesObserver_instances, onUpdate_fn).call(this, observer, result);
|
|
2254
|
-
});
|
|
2255
|
-
});
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
onUnsubscribe() {
|
|
2259
|
-
if (!this.listeners.size) {
|
|
2260
|
-
this.destroy();
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
destroy() {
|
|
2264
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
2265
|
-
__privateGet(this, _observers2).forEach((observer) => {
|
|
2266
|
-
observer.destroy();
|
|
2267
|
-
});
|
|
2268
|
-
}
|
|
2269
|
-
setQueries(queries, _options, notifyOptions) {
|
|
2270
|
-
__privateSet(this, _queries2, queries);
|
|
2271
|
-
notifyManager.batch(() => {
|
|
2272
|
-
const prevObservers = __privateGet(this, _observers2);
|
|
2273
|
-
const newObserverMatches = __privateMethod(this, _QueriesObserver_instances, findMatchingObservers_fn).call(this, __privateGet(this, _queries2));
|
|
2274
|
-
newObserverMatches.forEach(
|
|
2275
|
-
(match) => match.observer.setOptions(match.defaultedQueryOptions, notifyOptions)
|
|
2276
|
-
);
|
|
2277
|
-
const newObservers = newObserverMatches.map((match) => match.observer);
|
|
2278
|
-
const newResult = newObservers.map(
|
|
2279
|
-
(observer) => observer.getCurrentResult()
|
|
2280
|
-
);
|
|
2281
|
-
const hasIndexChange = newObservers.some(
|
|
2282
|
-
(observer, index) => observer !== prevObservers[index]
|
|
2283
|
-
);
|
|
2284
|
-
if (prevObservers.length === newObservers.length && !hasIndexChange) {
|
|
2285
|
-
return;
|
|
2286
|
-
}
|
|
2287
|
-
__privateSet(this, _observers2, newObservers);
|
|
2288
|
-
__privateSet(this, _result, newResult);
|
|
2289
|
-
if (!this.hasListeners()) {
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
difference(prevObservers, newObservers).forEach((observer) => {
|
|
2293
|
-
observer.destroy();
|
|
2294
|
-
});
|
|
2295
|
-
difference(newObservers, prevObservers).forEach((observer) => {
|
|
2296
|
-
observer.subscribe((result) => {
|
|
2297
|
-
__privateMethod(this, _QueriesObserver_instances, onUpdate_fn).call(this, observer, result);
|
|
2298
|
-
});
|
|
2299
|
-
});
|
|
2300
|
-
__privateMethod(this, _QueriesObserver_instances, notify_fn2).call(this);
|
|
2301
|
-
});
|
|
2302
|
-
}
|
|
2303
|
-
getCurrentResult() {
|
|
2304
|
-
return __privateGet(this, _result);
|
|
2305
|
-
}
|
|
2306
|
-
getQueries() {
|
|
2307
|
-
return __privateGet(this, _observers2).map((observer) => observer.getCurrentQuery());
|
|
2308
|
-
}
|
|
2309
|
-
getObservers() {
|
|
2310
|
-
return __privateGet(this, _observers2);
|
|
2311
|
-
}
|
|
2312
|
-
getOptimisticResult(queries, combine) {
|
|
2313
|
-
const matches = __privateMethod(this, _QueriesObserver_instances, findMatchingObservers_fn).call(this, queries);
|
|
2314
|
-
const result = matches.map(
|
|
2315
|
-
(match) => match.observer.getOptimisticResult(match.defaultedQueryOptions)
|
|
2316
|
-
);
|
|
2317
|
-
return [
|
|
2318
|
-
result,
|
|
2319
|
-
(r) => {
|
|
2320
|
-
return __privateMethod(this, _QueriesObserver_instances, combineResult_fn).call(this, r ?? result, combine);
|
|
2321
|
-
},
|
|
2322
|
-
() => {
|
|
2323
|
-
return matches.map((match, index) => {
|
|
2324
|
-
const observerResult = result[index];
|
|
2325
|
-
return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {
|
|
2326
|
-
matches.forEach((m) => {
|
|
2327
|
-
m.observer.trackProp(accessedProp);
|
|
2328
|
-
});
|
|
2329
|
-
}) : observerResult;
|
|
2330
|
-
});
|
|
2331
|
-
}
|
|
2332
|
-
];
|
|
2333
|
-
}
|
|
2334
|
-
}, _client2 = new WeakMap(), _result = new WeakMap(), _queries2 = new WeakMap(), _observers2 = new WeakMap(), _combinedResult = new WeakMap(), _lastCombine = new WeakMap(), _lastResult = new WeakMap(), _QueriesObserver_instances = new WeakSet(), combineResult_fn = function(input, combine) {
|
|
2335
|
-
if (combine) {
|
|
2336
|
-
if (!__privateGet(this, _combinedResult) || __privateGet(this, _result) !== __privateGet(this, _lastResult) || combine !== __privateGet(this, _lastCombine)) {
|
|
2337
|
-
__privateSet(this, _lastCombine, combine);
|
|
2338
|
-
__privateSet(this, _lastResult, __privateGet(this, _result));
|
|
2339
|
-
__privateSet(this, _combinedResult, replaceEqualDeep(
|
|
2340
|
-
__privateGet(this, _combinedResult),
|
|
2341
|
-
combine(input)
|
|
2342
|
-
));
|
|
2343
|
-
}
|
|
2344
|
-
return __privateGet(this, _combinedResult);
|
|
2345
|
-
}
|
|
2346
|
-
return input;
|
|
2347
|
-
}, findMatchingObservers_fn = function(queries) {
|
|
2348
|
-
const prevObservers = __privateGet(this, _observers2);
|
|
2349
|
-
const prevObserversMap = new Map(
|
|
2350
|
-
prevObservers.map((observer) => [observer.options.queryHash, observer])
|
|
2351
|
-
);
|
|
2352
|
-
const defaultedQueryOptions = queries.map(
|
|
2353
|
-
(options) => __privateGet(this, _client2).defaultQueryOptions(options)
|
|
2354
|
-
);
|
|
2355
|
-
const matchingObservers = defaultedQueryOptions.flatMap((defaultedOptions) => {
|
|
2356
|
-
const match = prevObserversMap.get(defaultedOptions.queryHash);
|
|
2357
|
-
if (match != null) {
|
|
2358
|
-
return [{ defaultedQueryOptions: defaultedOptions, observer: match }];
|
|
2359
|
-
}
|
|
2360
|
-
return [];
|
|
2361
|
-
});
|
|
2362
|
-
const matchedQueryHashes = new Set(
|
|
2363
|
-
matchingObservers.map((match) => match.defaultedQueryOptions.queryHash)
|
|
2364
|
-
);
|
|
2365
|
-
const unmatchedQueries = defaultedQueryOptions.filter(
|
|
2366
|
-
(defaultedOptions) => !matchedQueryHashes.has(defaultedOptions.queryHash)
|
|
2367
|
-
);
|
|
2368
|
-
const getObserver = (options) => {
|
|
2369
|
-
const defaultedOptions = __privateGet(this, _client2).defaultQueryOptions(options);
|
|
2370
|
-
const currentObserver = __privateGet(this, _observers2).find(
|
|
2371
|
-
(o) => o.options.queryHash === defaultedOptions.queryHash
|
|
2372
|
-
);
|
|
2373
|
-
return currentObserver ?? new QueryObserver(__privateGet(this, _client2), defaultedOptions);
|
|
2374
|
-
};
|
|
2375
|
-
const newOrReusedObservers = unmatchedQueries.map((options) => {
|
|
2376
|
-
return {
|
|
2377
|
-
defaultedQueryOptions: options,
|
|
2378
|
-
observer: getObserver(options)
|
|
2379
|
-
};
|
|
2380
|
-
});
|
|
2381
|
-
const sortMatchesByOrderOfQueries = (a, b) => defaultedQueryOptions.indexOf(a.defaultedQueryOptions) - defaultedQueryOptions.indexOf(b.defaultedQueryOptions);
|
|
2382
|
-
return matchingObservers.concat(newOrReusedObservers).sort(sortMatchesByOrderOfQueries);
|
|
2383
|
-
}, onUpdate_fn = function(observer, result) {
|
|
2384
|
-
const index = __privateGet(this, _observers2).indexOf(observer);
|
|
2385
|
-
if (index !== -1) {
|
|
2386
|
-
__privateSet(this, _result, replaceAt(__privateGet(this, _result), index, result));
|
|
2387
|
-
__privateMethod(this, _QueriesObserver_instances, notify_fn2).call(this);
|
|
2388
|
-
}
|
|
2389
|
-
}, notify_fn2 = function() {
|
|
2390
|
-
notifyManager.batch(() => {
|
|
2391
|
-
this.listeners.forEach((listener) => {
|
|
2392
|
-
listener(__privateGet(this, _result));
|
|
2393
|
-
});
|
|
2394
|
-
});
|
|
2395
|
-
}, _a10);
|
|
2396
|
-
|
|
2397
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js
|
|
2398
|
-
var InfiniteQueryObserver = class extends QueryObserver {
|
|
2399
|
-
constructor(client, options) {
|
|
2400
|
-
super(client, options);
|
|
2401
|
-
}
|
|
2402
|
-
bindMethods() {
|
|
2403
|
-
super.bindMethods();
|
|
2404
|
-
this.fetchNextPage = this.fetchNextPage.bind(this);
|
|
2405
|
-
this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
|
|
2406
|
-
}
|
|
2407
|
-
setOptions(options, notifyOptions) {
|
|
2408
|
-
super.setOptions(
|
|
2409
|
-
{
|
|
2410
|
-
...options,
|
|
2411
|
-
behavior: infiniteQueryBehavior()
|
|
2412
|
-
},
|
|
2413
|
-
notifyOptions
|
|
2414
|
-
);
|
|
2415
|
-
}
|
|
2416
|
-
getOptimisticResult(options) {
|
|
2417
|
-
options.behavior = infiniteQueryBehavior();
|
|
2418
|
-
return super.getOptimisticResult(options);
|
|
2419
|
-
}
|
|
2420
|
-
fetchNextPage(options) {
|
|
2421
|
-
return this.fetch({
|
|
2422
|
-
...options,
|
|
2423
|
-
meta: {
|
|
2424
|
-
fetchMore: { direction: "forward" }
|
|
2425
|
-
}
|
|
2426
|
-
});
|
|
2427
|
-
}
|
|
2428
|
-
fetchPreviousPage(options) {
|
|
2429
|
-
return this.fetch({
|
|
2430
|
-
...options,
|
|
2431
|
-
meta: {
|
|
2432
|
-
fetchMore: { direction: "backward" }
|
|
2433
|
-
}
|
|
2434
|
-
});
|
|
2435
|
-
}
|
|
2436
|
-
createResult(query, options) {
|
|
2437
|
-
var _a12, _b;
|
|
2438
|
-
const { state } = query;
|
|
2439
|
-
const parentResult = super.createResult(query, options);
|
|
2440
|
-
const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
|
|
2441
|
-
const fetchDirection = (_b = (_a12 = state.fetchMeta) == null ? void 0 : _a12.fetchMore) == null ? void 0 : _b.direction;
|
|
2442
|
-
const isFetchNextPageError = isError && fetchDirection === "forward";
|
|
2443
|
-
const isFetchingNextPage = isFetching && fetchDirection === "forward";
|
|
2444
|
-
const isFetchPreviousPageError = isError && fetchDirection === "backward";
|
|
2445
|
-
const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
|
|
2446
|
-
const result = {
|
|
2447
|
-
...parentResult,
|
|
2448
|
-
fetchNextPage: this.fetchNextPage,
|
|
2449
|
-
fetchPreviousPage: this.fetchPreviousPage,
|
|
2450
|
-
hasNextPage: hasNextPage(options, state.data),
|
|
2451
|
-
hasPreviousPage: hasPreviousPage(options, state.data),
|
|
2452
|
-
isFetchNextPageError,
|
|
2453
|
-
isFetchingNextPage,
|
|
2454
|
-
isFetchPreviousPageError,
|
|
2455
|
-
isFetchingPreviousPage,
|
|
2456
|
-
isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
|
|
2457
|
-
isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage
|
|
2458
|
-
};
|
|
2459
|
-
return result;
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
|
|
2463
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
2464
|
-
var _client3, _currentResult2, _currentMutation, _mutateOptions, _MutationObserver_instances, updateResult_fn, notify_fn3, _a11;
|
|
2465
|
-
var MutationObserver = (_a11 = class extends Subscribable {
|
|
2466
|
-
constructor(client, options) {
|
|
2467
|
-
super();
|
|
2468
|
-
__privateAdd(this, _MutationObserver_instances);
|
|
2469
|
-
__privateAdd(this, _client3);
|
|
2470
|
-
__privateAdd(this, _currentResult2);
|
|
2471
|
-
__privateAdd(this, _currentMutation);
|
|
2472
|
-
__privateAdd(this, _mutateOptions);
|
|
2473
|
-
__privateSet(this, _client3, client);
|
|
2474
|
-
this.setOptions(options);
|
|
2475
|
-
this.bindMethods();
|
|
2476
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
2477
|
-
}
|
|
2478
|
-
bindMethods() {
|
|
2479
|
-
this.mutate = this.mutate.bind(this);
|
|
2480
|
-
this.reset = this.reset.bind(this);
|
|
2481
|
-
}
|
|
2482
|
-
setOptions(options) {
|
|
2483
|
-
var _a12;
|
|
2484
|
-
const prevOptions = this.options;
|
|
2485
|
-
this.options = __privateGet(this, _client3).defaultMutationOptions(options);
|
|
2486
|
-
if (!shallowEqualObjects(this.options, prevOptions)) {
|
|
2487
|
-
__privateGet(this, _client3).getMutationCache().notify({
|
|
2488
|
-
type: "observerOptionsUpdated",
|
|
2489
|
-
mutation: __privateGet(this, _currentMutation),
|
|
2490
|
-
observer: this
|
|
2491
|
-
});
|
|
2492
|
-
}
|
|
2493
|
-
if ((prevOptions == null ? void 0 : prevOptions.mutationKey) && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
|
|
2494
|
-
this.reset();
|
|
2495
|
-
} else if (((_a12 = __privateGet(this, _currentMutation)) == null ? void 0 : _a12.state.status) === "pending") {
|
|
2496
|
-
__privateGet(this, _currentMutation).setOptions(this.options);
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2499
|
-
onUnsubscribe() {
|
|
2500
|
-
var _a12;
|
|
2501
|
-
if (!this.hasListeners()) {
|
|
2502
|
-
(_a12 = __privateGet(this, _currentMutation)) == null ? void 0 : _a12.removeObserver(this);
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
onMutationUpdate(action) {
|
|
2506
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
2507
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn3).call(this, action);
|
|
2508
|
-
}
|
|
2509
|
-
getCurrentResult() {
|
|
2510
|
-
return __privateGet(this, _currentResult2);
|
|
2511
|
-
}
|
|
2512
|
-
reset() {
|
|
2513
|
-
var _a12;
|
|
2514
|
-
(_a12 = __privateGet(this, _currentMutation)) == null ? void 0 : _a12.removeObserver(this);
|
|
2515
|
-
__privateSet(this, _currentMutation, void 0);
|
|
2516
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
2517
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn3).call(this);
|
|
2518
|
-
}
|
|
2519
|
-
mutate(variables, options) {
|
|
2520
|
-
var _a12;
|
|
2521
|
-
__privateSet(this, _mutateOptions, options);
|
|
2522
|
-
(_a12 = __privateGet(this, _currentMutation)) == null ? void 0 : _a12.removeObserver(this);
|
|
2523
|
-
__privateSet(this, _currentMutation, __privateGet(this, _client3).getMutationCache().build(__privateGet(this, _client3), this.options));
|
|
2524
|
-
__privateGet(this, _currentMutation).addObserver(this);
|
|
2525
|
-
return __privateGet(this, _currentMutation).execute(variables);
|
|
2526
|
-
}
|
|
2527
|
-
}, _client3 = new WeakMap(), _currentResult2 = new WeakMap(), _currentMutation = new WeakMap(), _mutateOptions = new WeakMap(), _MutationObserver_instances = new WeakSet(), updateResult_fn = function() {
|
|
2528
|
-
var _a12;
|
|
2529
|
-
const state = ((_a12 = __privateGet(this, _currentMutation)) == null ? void 0 : _a12.state) ?? getDefaultState2();
|
|
2530
|
-
__privateSet(this, _currentResult2, {
|
|
2531
|
-
...state,
|
|
2532
|
-
isPending: state.status === "pending",
|
|
2533
|
-
isSuccess: state.status === "success",
|
|
2534
|
-
isError: state.status === "error",
|
|
2535
|
-
isIdle: state.status === "idle",
|
|
2536
|
-
mutate: this.mutate,
|
|
2537
|
-
reset: this.reset
|
|
2538
|
-
});
|
|
2539
|
-
}, notify_fn3 = function(action) {
|
|
2540
|
-
notifyManager.batch(() => {
|
|
2541
|
-
var _a12, _b, _c, _d, _e, _f, _g, _h;
|
|
2542
|
-
if (__privateGet(this, _mutateOptions) && this.hasListeners()) {
|
|
2543
|
-
const variables = __privateGet(this, _currentResult2).variables;
|
|
2544
|
-
const context = __privateGet(this, _currentResult2).context;
|
|
2545
|
-
if ((action == null ? void 0 : action.type) === "success") {
|
|
2546
|
-
(_b = (_a12 = __privateGet(this, _mutateOptions)).onSuccess) == null ? void 0 : _b.call(_a12, action.data, variables, context);
|
|
2547
|
-
(_d = (_c = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _d.call(_c, action.data, null, variables, context);
|
|
2548
|
-
} else if ((action == null ? void 0 : action.type) === "error") {
|
|
2549
|
-
(_f = (_e = __privateGet(this, _mutateOptions)).onError) == null ? void 0 : _f.call(_e, action.error, variables, context);
|
|
2550
|
-
(_h = (_g = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _h.call(
|
|
2551
|
-
_g,
|
|
2552
|
-
void 0,
|
|
2553
|
-
action.error,
|
|
2554
|
-
variables,
|
|
2555
|
-
context
|
|
2556
|
-
);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
this.listeners.forEach((listener) => {
|
|
2560
|
-
listener(__privateGet(this, _currentResult2));
|
|
2561
|
-
});
|
|
2562
|
-
});
|
|
2563
|
-
}, _a11);
|
|
2564
|
-
|
|
2565
|
-
// ../../../../node_modules/.pnpm/@tanstack+query-core@5.45.0/node_modules/@tanstack/query-core/build/modern/hydration.js
|
|
2566
|
-
function dehydrateMutation(mutation) {
|
|
2567
|
-
return {
|
|
2568
|
-
mutationKey: mutation.options.mutationKey,
|
|
2569
|
-
state: mutation.state,
|
|
2570
|
-
...mutation.options.scope && { scope: mutation.options.scope },
|
|
2571
|
-
...mutation.meta && { meta: mutation.meta }
|
|
2572
|
-
};
|
|
2573
|
-
}
|
|
2574
|
-
function dehydrateQuery(query) {
|
|
2575
|
-
var _a12;
|
|
2576
|
-
return {
|
|
2577
|
-
state: query.state,
|
|
2578
|
-
queryKey: query.queryKey,
|
|
2579
|
-
queryHash: query.queryHash,
|
|
2580
|
-
...query.state.status === "pending" && {
|
|
2581
|
-
promise: (_a12 = query.promise) == null ? void 0 : _a12.catch((error) => {
|
|
2582
|
-
if (true) {
|
|
2583
|
-
console.error(
|
|
2584
|
-
`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`
|
|
2585
|
-
);
|
|
2586
|
-
}
|
|
2587
|
-
return Promise.reject(new Error("redacted"));
|
|
2588
|
-
})
|
|
2589
|
-
},
|
|
2590
|
-
...query.meta && { meta: query.meta }
|
|
2591
|
-
};
|
|
2592
|
-
}
|
|
2593
|
-
function defaultShouldDehydrateMutation(mutation) {
|
|
2594
|
-
return mutation.state.isPaused;
|
|
2595
|
-
}
|
|
2596
|
-
function defaultShouldDehydrateQuery(query) {
|
|
2597
|
-
return query.state.status === "success";
|
|
2598
|
-
}
|
|
2599
|
-
function dehydrate(client, options = {}) {
|
|
2600
|
-
var _a12, _b;
|
|
2601
|
-
const filterMutation = options.shouldDehydrateMutation ?? ((_a12 = client.getDefaultOptions().dehydrate) == null ? void 0 : _a12.shouldDehydrateMutation) ?? defaultShouldDehydrateMutation;
|
|
2602
|
-
const mutations = client.getMutationCache().getAll().flatMap(
|
|
2603
|
-
(mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []
|
|
2604
|
-
);
|
|
2605
|
-
const filterQuery = options.shouldDehydrateQuery ?? ((_b = client.getDefaultOptions().dehydrate) == null ? void 0 : _b.shouldDehydrateQuery) ?? defaultShouldDehydrateQuery;
|
|
2606
|
-
const queries = client.getQueryCache().getAll().flatMap((query) => filterQuery(query) ? [dehydrateQuery(query)] : []);
|
|
2607
|
-
return { mutations, queries };
|
|
2608
|
-
}
|
|
2609
|
-
function hydrate(client, dehydratedState, options) {
|
|
2610
|
-
if (typeof dehydratedState !== "object" || dehydratedState === null) {
|
|
2611
|
-
return;
|
|
2612
|
-
}
|
|
2613
|
-
const mutationCache = client.getMutationCache();
|
|
2614
|
-
const queryCache = client.getQueryCache();
|
|
2615
|
-
const mutations = dehydratedState.mutations || [];
|
|
2616
|
-
const queries = dehydratedState.queries || [];
|
|
2617
|
-
mutations.forEach(({ state, ...mutationOptions }) => {
|
|
2618
|
-
var _a12, _b;
|
|
2619
|
-
mutationCache.build(
|
|
2620
|
-
client,
|
|
2621
|
-
{
|
|
2622
|
-
...(_a12 = client.getDefaultOptions().hydrate) == null ? void 0 : _a12.mutations,
|
|
2623
|
-
...(_b = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b.mutations,
|
|
2624
|
-
...mutationOptions
|
|
2625
|
-
},
|
|
2626
|
-
state
|
|
2627
|
-
);
|
|
2628
|
-
});
|
|
2629
|
-
queries.forEach(({ queryKey, state, queryHash, meta, promise }) => {
|
|
2630
|
-
var _a12, _b, _c;
|
|
2631
|
-
let query = queryCache.get(queryHash);
|
|
2632
|
-
if (query) {
|
|
2633
|
-
if (query.state.dataUpdatedAt < state.dataUpdatedAt) {
|
|
2634
|
-
const { fetchStatus: _ignored, ...dehydratedQueryState } = state;
|
|
2635
|
-
query.setState(dehydratedQueryState);
|
|
2636
|
-
}
|
|
2637
|
-
} else {
|
|
2638
|
-
query = queryCache.build(
|
|
2639
|
-
client,
|
|
2640
|
-
{
|
|
2641
|
-
...(_a12 = client.getDefaultOptions().hydrate) == null ? void 0 : _a12.queries,
|
|
2642
|
-
...(_b = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b.queries,
|
|
2643
|
-
queryKey,
|
|
2644
|
-
queryHash,
|
|
2645
|
-
meta
|
|
2646
|
-
},
|
|
2647
|
-
// Reset fetch status to idle to avoid
|
|
2648
|
-
// query being stuck in fetching state upon hydration
|
|
2649
|
-
{
|
|
2650
|
-
...state,
|
|
2651
|
-
fetchStatus: "idle"
|
|
2652
|
-
}
|
|
2653
|
-
);
|
|
2654
|
-
}
|
|
2655
|
-
if (promise) {
|
|
2656
|
-
const transformPromise = (_c = client.getDefaultOptions().hydrate) == null ? void 0 : _c.transformPromise;
|
|
2657
|
-
const initialPromise = (transformPromise == null ? void 0 : transformPromise(Promise.resolve(promise))) ?? promise;
|
|
2658
|
-
void query.fetch(void 0, { initialPromise });
|
|
2659
|
-
}
|
|
2660
|
-
});
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useQueries.js
|
|
2664
|
-
var React5 = __toESM(require_react(), 1);
|
|
2665
|
-
|
|
2666
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
2667
|
-
var React = __toESM(require_react(), 1);
|
|
2668
|
-
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
2669
|
-
var QueryClientContext = React.createContext(
|
|
2670
|
-
void 0
|
|
2671
|
-
);
|
|
2672
|
-
var useQueryClient = (queryClient) => {
|
|
2673
|
-
const client = React.useContext(QueryClientContext);
|
|
2674
|
-
if (queryClient) {
|
|
2675
|
-
return queryClient;
|
|
2676
|
-
}
|
|
2677
|
-
if (!client) {
|
|
2678
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
2679
|
-
}
|
|
2680
|
-
return client;
|
|
2681
|
-
};
|
|
2682
|
-
var QueryClientProvider = ({
|
|
2683
|
-
client,
|
|
2684
|
-
children
|
|
2685
|
-
}) => {
|
|
2686
|
-
React.useEffect(() => {
|
|
2687
|
-
client.mount();
|
|
2688
|
-
return () => {
|
|
2689
|
-
client.unmount();
|
|
2690
|
-
};
|
|
2691
|
-
}, [client]);
|
|
2692
|
-
return (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children });
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/isRestoring.js
|
|
2696
|
-
var React2 = __toESM(require_react(), 1);
|
|
2697
|
-
var IsRestoringContext = React2.createContext(false);
|
|
2698
|
-
var useIsRestoring = () => React2.useContext(IsRestoringContext);
|
|
2699
|
-
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
2700
|
-
|
|
2701
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
2702
|
-
var React3 = __toESM(require_react(), 1);
|
|
2703
|
-
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
2704
|
-
function createValue() {
|
|
2705
|
-
let isReset = false;
|
|
2706
|
-
return {
|
|
2707
|
-
clearReset: () => {
|
|
2708
|
-
isReset = false;
|
|
2709
|
-
},
|
|
2710
|
-
reset: () => {
|
|
2711
|
-
isReset = true;
|
|
2712
|
-
},
|
|
2713
|
-
isReset: () => {
|
|
2714
|
-
return isReset;
|
|
2715
|
-
}
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
var QueryErrorResetBoundaryContext = React3.createContext(createValue());
|
|
2719
|
-
var useQueryErrorResetBoundary = () => React3.useContext(QueryErrorResetBoundaryContext);
|
|
2720
|
-
var QueryErrorResetBoundary = ({
|
|
2721
|
-
children
|
|
2722
|
-
}) => {
|
|
2723
|
-
const [value] = React3.useState(() => createValue());
|
|
2724
|
-
return (0, import_jsx_runtime2.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children });
|
|
2725
|
-
};
|
|
2726
|
-
|
|
2727
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
2728
|
-
var React4 = __toESM(require_react(), 1);
|
|
2729
|
-
|
|
2730
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/utils.js
|
|
2731
|
-
function shouldThrowError(throwError, params) {
|
|
2732
|
-
if (typeof throwError === "function") {
|
|
2733
|
-
return throwError(...params);
|
|
2734
|
-
}
|
|
2735
|
-
return !!throwError;
|
|
2736
|
-
}
|
|
2737
|
-
function noop2() {
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
2741
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
|
2742
|
-
if (options.suspense || options.throwOnError) {
|
|
2743
|
-
if (!errorResetBoundary.isReset()) {
|
|
2744
|
-
options.retryOnMount = false;
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
};
|
|
2748
|
-
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
2749
|
-
React4.useEffect(() => {
|
|
2750
|
-
errorResetBoundary.clearReset();
|
|
2751
|
-
}, [errorResetBoundary]);
|
|
2752
|
-
};
|
|
2753
|
-
var getHasError = ({
|
|
2754
|
-
result,
|
|
2755
|
-
errorResetBoundary,
|
|
2756
|
-
throwOnError,
|
|
2757
|
-
query
|
|
2758
|
-
}) => {
|
|
2759
|
-
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && shouldThrowError(throwOnError, [result.error, query]);
|
|
2760
|
-
};
|
|
2761
|
-
|
|
2762
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
2763
|
-
var defaultThrowOnError = (_error, query) => query.state.data === void 0;
|
|
2764
|
-
var ensureStaleTime = (defaultedOptions) => {
|
|
2765
|
-
if (defaultedOptions.suspense) {
|
|
2766
|
-
if (typeof defaultedOptions.staleTime !== "number") {
|
|
2767
|
-
defaultedOptions.staleTime = 1e3;
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
};
|
|
2771
|
-
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
2772
|
-
var shouldSuspend = (defaultedOptions, result) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && result.isPending;
|
|
2773
|
-
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
2774
|
-
errorResetBoundary.clearReset();
|
|
2775
|
-
});
|
|
2776
|
-
|
|
2777
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useQueries.js
|
|
2778
|
-
function useQueries({
|
|
2779
|
-
queries,
|
|
2780
|
-
...options
|
|
2781
|
-
}, queryClient) {
|
|
2782
|
-
const client = useQueryClient(queryClient);
|
|
2783
|
-
const isRestoring = useIsRestoring();
|
|
2784
|
-
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
2785
|
-
const defaultedQueries = React5.useMemo(
|
|
2786
|
-
() => queries.map((opts) => {
|
|
2787
|
-
const defaultedOptions = client.defaultQueryOptions(
|
|
2788
|
-
opts
|
|
2789
|
-
);
|
|
2790
|
-
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
2791
|
-
return defaultedOptions;
|
|
2792
|
-
}),
|
|
2793
|
-
[queries, client, isRestoring]
|
|
2794
|
-
);
|
|
2795
|
-
defaultedQueries.forEach((query) => {
|
|
2796
|
-
ensureStaleTime(query);
|
|
2797
|
-
ensurePreventErrorBoundaryRetry(query, errorResetBoundary);
|
|
2798
|
-
});
|
|
2799
|
-
useClearResetErrorBoundary(errorResetBoundary);
|
|
2800
|
-
const [observer] = React5.useState(
|
|
2801
|
-
() => new QueriesObserver(
|
|
2802
|
-
client,
|
|
2803
|
-
defaultedQueries,
|
|
2804
|
-
options
|
|
2805
|
-
)
|
|
2806
|
-
);
|
|
2807
|
-
const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(
|
|
2808
|
-
defaultedQueries,
|
|
2809
|
-
options.combine
|
|
2810
|
-
);
|
|
2811
|
-
React5.useSyncExternalStore(
|
|
2812
|
-
React5.useCallback(
|
|
2813
|
-
(onStoreChange) => isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
2814
|
-
[observer, isRestoring]
|
|
2815
|
-
),
|
|
2816
|
-
() => observer.getCurrentResult(),
|
|
2817
|
-
() => observer.getCurrentResult()
|
|
2818
|
-
);
|
|
2819
|
-
React5.useEffect(() => {
|
|
2820
|
-
observer.setQueries(
|
|
2821
|
-
defaultedQueries,
|
|
2822
|
-
options,
|
|
2823
|
-
{
|
|
2824
|
-
listeners: false
|
|
2825
|
-
}
|
|
2826
|
-
);
|
|
2827
|
-
}, [defaultedQueries, options, observer]);
|
|
2828
|
-
const shouldAtLeastOneSuspend = optimisticResult.some(
|
|
2829
|
-
(result, index) => shouldSuspend(defaultedQueries[index], result)
|
|
2830
|
-
);
|
|
2831
|
-
const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => {
|
|
2832
|
-
const opts = defaultedQueries[index];
|
|
2833
|
-
if (opts) {
|
|
2834
|
-
const queryObserver = new QueryObserver(client, opts);
|
|
2835
|
-
if (shouldSuspend(opts, result)) {
|
|
2836
|
-
return fetchOptimistic(opts, queryObserver, errorResetBoundary);
|
|
2837
|
-
} else if (willFetch(result, isRestoring)) {
|
|
2838
|
-
void fetchOptimistic(opts, queryObserver, errorResetBoundary);
|
|
2839
|
-
}
|
|
2840
|
-
}
|
|
2841
|
-
return [];
|
|
2842
|
-
}) : [];
|
|
2843
|
-
if (suspensePromises.length > 0) {
|
|
2844
|
-
throw Promise.all(suspensePromises);
|
|
2845
|
-
}
|
|
2846
|
-
const firstSingleResultWhichShouldThrow = optimisticResult.find(
|
|
2847
|
-
(result, index) => {
|
|
2848
|
-
const query = defaultedQueries[index];
|
|
2849
|
-
return query && getHasError({
|
|
2850
|
-
result,
|
|
2851
|
-
errorResetBoundary,
|
|
2852
|
-
throwOnError: query.throwOnError,
|
|
2853
|
-
query: client.getQueryCache().get(query.queryHash)
|
|
2854
|
-
});
|
|
2855
|
-
}
|
|
2856
|
-
);
|
|
2857
|
-
if (firstSingleResultWhichShouldThrow == null ? void 0 : firstSingleResultWhichShouldThrow.error) {
|
|
2858
|
-
throw firstSingleResultWhichShouldThrow.error;
|
|
2859
|
-
}
|
|
2860
|
-
return getCombinedResult(trackResult());
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
2864
|
-
var React6 = __toESM(require_react(), 1);
|
|
2865
|
-
function useBaseQuery(options, Observer, queryClient) {
|
|
2866
|
-
if (true) {
|
|
2867
|
-
if (typeof options !== "object" || Array.isArray(options)) {
|
|
2868
|
-
throw new Error(
|
|
2869
|
-
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
2870
|
-
);
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
const client = useQueryClient(queryClient);
|
|
2874
|
-
const isRestoring = useIsRestoring();
|
|
2875
|
-
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
2876
|
-
const defaultedOptions = client.defaultQueryOptions(options);
|
|
2877
|
-
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
2878
|
-
ensureStaleTime(defaultedOptions);
|
|
2879
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
|
2880
|
-
useClearResetErrorBoundary(errorResetBoundary);
|
|
2881
|
-
const [observer] = React6.useState(
|
|
2882
|
-
() => new Observer(
|
|
2883
|
-
client,
|
|
2884
|
-
defaultedOptions
|
|
2885
|
-
)
|
|
2886
|
-
);
|
|
2887
|
-
const result = observer.getOptimisticResult(defaultedOptions);
|
|
2888
|
-
React6.useSyncExternalStore(
|
|
2889
|
-
React6.useCallback(
|
|
2890
|
-
(onStoreChange) => {
|
|
2891
|
-
const unsubscribe = isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange));
|
|
2892
|
-
observer.updateResult();
|
|
2893
|
-
return unsubscribe;
|
|
2894
|
-
},
|
|
2895
|
-
[observer, isRestoring]
|
|
2896
|
-
),
|
|
2897
|
-
() => observer.getCurrentResult(),
|
|
2898
|
-
() => observer.getCurrentResult()
|
|
2899
|
-
);
|
|
2900
|
-
React6.useEffect(() => {
|
|
2901
|
-
observer.setOptions(defaultedOptions, { listeners: false });
|
|
2902
|
-
}, [defaultedOptions, observer]);
|
|
2903
|
-
if (shouldSuspend(defaultedOptions, result)) {
|
|
2904
|
-
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
2905
|
-
}
|
|
2906
|
-
if (getHasError({
|
|
2907
|
-
result,
|
|
2908
|
-
errorResetBoundary,
|
|
2909
|
-
throwOnError: defaultedOptions.throwOnError,
|
|
2910
|
-
query: client.getQueryCache().get(defaultedOptions.queryHash)
|
|
2911
|
-
})) {
|
|
2912
|
-
throw result.error;
|
|
2913
|
-
}
|
|
2914
|
-
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
2915
|
-
}
|
|
2916
|
-
|
|
2917
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
2918
|
-
function useQuery(options, queryClient) {
|
|
2919
|
-
return useBaseQuery(options, QueryObserver, queryClient);
|
|
2920
|
-
}
|
|
2921
|
-
|
|
2922
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
|
|
2923
|
-
function useSuspenseQuery(options, queryClient) {
|
|
2924
|
-
if (true) {
|
|
2925
|
-
if (options.queryFn === skipToken) {
|
|
2926
|
-
console.error("skipToken is not allowed for useSuspenseQuery");
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
return useBaseQuery(
|
|
2930
|
-
{
|
|
2931
|
-
...options,
|
|
2932
|
-
enabled: true,
|
|
2933
|
-
suspense: true,
|
|
2934
|
-
throwOnError: defaultThrowOnError,
|
|
2935
|
-
placeholderData: void 0
|
|
2936
|
-
},
|
|
2937
|
-
QueryObserver,
|
|
2938
|
-
queryClient
|
|
2939
|
-
);
|
|
2940
|
-
}
|
|
2941
|
-
|
|
2942
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js
|
|
2943
|
-
function useSuspenseInfiniteQuery(options, queryClient) {
|
|
2944
|
-
return useBaseQuery(
|
|
2945
|
-
{
|
|
2946
|
-
...options,
|
|
2947
|
-
enabled: true,
|
|
2948
|
-
suspense: true,
|
|
2949
|
-
throwOnError: defaultThrowOnError
|
|
2950
|
-
},
|
|
2951
|
-
InfiniteQueryObserver,
|
|
2952
|
-
queryClient
|
|
2953
|
-
);
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js
|
|
2957
|
-
function useSuspenseQueries(options, queryClient) {
|
|
2958
|
-
return useQueries(
|
|
2959
|
-
{
|
|
2960
|
-
...options,
|
|
2961
|
-
queries: options.queries.map((query) => ({
|
|
2962
|
-
...query,
|
|
2963
|
-
suspense: true,
|
|
2964
|
-
throwOnError: defaultThrowOnError,
|
|
2965
|
-
enabled: true,
|
|
2966
|
-
placeholderData: void 0
|
|
2967
|
-
}))
|
|
2968
|
-
},
|
|
2969
|
-
queryClient
|
|
2970
|
-
);
|
|
2971
|
-
}
|
|
2972
|
-
|
|
2973
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/queryOptions.js
|
|
2974
|
-
function queryOptions(options) {
|
|
2975
|
-
return options;
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
|
|
2979
|
-
function infiniteQueryOptions(options) {
|
|
2980
|
-
return options;
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js
|
|
2984
|
-
var React7 = __toESM(require_react(), 1);
|
|
2985
|
-
var HydrationBoundary = ({
|
|
2986
|
-
children,
|
|
2987
|
-
options = {},
|
|
2988
|
-
state,
|
|
2989
|
-
queryClient
|
|
2990
|
-
}) => {
|
|
2991
|
-
const client = useQueryClient(queryClient);
|
|
2992
|
-
const [hydrationQueue, setHydrationQueue] = React7.useState();
|
|
2993
|
-
const optionsRef = React7.useRef(options);
|
|
2994
|
-
optionsRef.current = options;
|
|
2995
|
-
React7.useMemo(() => {
|
|
2996
|
-
if (state) {
|
|
2997
|
-
if (typeof state !== "object") {
|
|
2998
|
-
return;
|
|
2999
|
-
}
|
|
3000
|
-
const queryCache = client.getQueryCache();
|
|
3001
|
-
const queries = state.queries || [];
|
|
3002
|
-
const newQueries = [];
|
|
3003
|
-
const existingQueries = [];
|
|
3004
|
-
for (const dehydratedQuery of queries) {
|
|
3005
|
-
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
3006
|
-
if (!existingQuery) {
|
|
3007
|
-
newQueries.push(dehydratedQuery);
|
|
3008
|
-
} else {
|
|
3009
|
-
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt;
|
|
3010
|
-
const queryAlreadyQueued = hydrationQueue == null ? void 0 : hydrationQueue.find(
|
|
3011
|
-
(query) => query.queryHash === dehydratedQuery.queryHash
|
|
3012
|
-
);
|
|
3013
|
-
if (hydrationIsNewer && (!queryAlreadyQueued || dehydratedQuery.state.dataUpdatedAt > queryAlreadyQueued.state.dataUpdatedAt)) {
|
|
3014
|
-
existingQueries.push(dehydratedQuery);
|
|
3015
|
-
}
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
if (newQueries.length > 0) {
|
|
3019
|
-
hydrate(client, { queries: newQueries }, optionsRef.current);
|
|
3020
|
-
}
|
|
3021
|
-
if (existingQueries.length > 0) {
|
|
3022
|
-
setHydrationQueue(
|
|
3023
|
-
(prev) => prev ? [...prev, ...existingQueries] : existingQueries
|
|
3024
|
-
);
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
}, [client, hydrationQueue, state]);
|
|
3028
|
-
React7.useEffect(() => {
|
|
3029
|
-
if (hydrationQueue) {
|
|
3030
|
-
hydrate(client, { queries: hydrationQueue }, optionsRef.current);
|
|
3031
|
-
setHydrationQueue(void 0);
|
|
3032
|
-
}
|
|
3033
|
-
}, [client, hydrationQueue]);
|
|
3034
|
-
return children;
|
|
3035
|
-
};
|
|
3036
|
-
|
|
3037
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useIsFetching.js
|
|
3038
|
-
var React8 = __toESM(require_react(), 1);
|
|
3039
|
-
function useIsFetching(filters, queryClient) {
|
|
3040
|
-
const client = useQueryClient(queryClient);
|
|
3041
|
-
const queryCache = client.getQueryCache();
|
|
3042
|
-
return React8.useSyncExternalStore(
|
|
3043
|
-
React8.useCallback(
|
|
3044
|
-
(onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
3045
|
-
[queryCache]
|
|
3046
|
-
),
|
|
3047
|
-
() => client.isFetching(filters),
|
|
3048
|
-
() => client.isFetching(filters)
|
|
3049
|
-
);
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useMutationState.js
|
|
3053
|
-
var React9 = __toESM(require_react(), 1);
|
|
3054
|
-
function useIsMutating(filters, queryClient) {
|
|
3055
|
-
const client = useQueryClient(queryClient);
|
|
3056
|
-
return useMutationState(
|
|
3057
|
-
{ filters: { ...filters, status: "pending" } },
|
|
3058
|
-
client
|
|
3059
|
-
).length;
|
|
3060
|
-
}
|
|
3061
|
-
function getResult(mutationCache, options) {
|
|
3062
|
-
return mutationCache.findAll(options.filters).map(
|
|
3063
|
-
(mutation) => options.select ? options.select(mutation) : mutation.state
|
|
3064
|
-
);
|
|
3065
|
-
}
|
|
3066
|
-
function useMutationState(options = {}, queryClient) {
|
|
3067
|
-
const mutationCache = useQueryClient(queryClient).getMutationCache();
|
|
3068
|
-
const optionsRef = React9.useRef(options);
|
|
3069
|
-
const result = React9.useRef(null);
|
|
3070
|
-
if (!result.current) {
|
|
3071
|
-
result.current = getResult(mutationCache, options);
|
|
3072
|
-
}
|
|
3073
|
-
React9.useEffect(() => {
|
|
3074
|
-
optionsRef.current = options;
|
|
3075
|
-
});
|
|
3076
|
-
return React9.useSyncExternalStore(
|
|
3077
|
-
React9.useCallback(
|
|
3078
|
-
(onStoreChange) => mutationCache.subscribe(() => {
|
|
3079
|
-
const nextResult = replaceEqualDeep(
|
|
3080
|
-
result.current,
|
|
3081
|
-
getResult(mutationCache, optionsRef.current)
|
|
3082
|
-
);
|
|
3083
|
-
if (result.current !== nextResult) {
|
|
3084
|
-
result.current = nextResult;
|
|
3085
|
-
notifyManager.schedule(onStoreChange);
|
|
3086
|
-
}
|
|
3087
|
-
}),
|
|
3088
|
-
[mutationCache]
|
|
3089
|
-
),
|
|
3090
|
-
() => result.current,
|
|
3091
|
-
() => result.current
|
|
3092
|
-
);
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3095
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
3096
|
-
var React10 = __toESM(require_react(), 1);
|
|
3097
|
-
function useMutation(options, queryClient) {
|
|
3098
|
-
const client = useQueryClient(queryClient);
|
|
3099
|
-
const [observer] = React10.useState(
|
|
3100
|
-
() => new MutationObserver(
|
|
3101
|
-
client,
|
|
3102
|
-
options
|
|
3103
|
-
)
|
|
3104
|
-
);
|
|
3105
|
-
React10.useEffect(() => {
|
|
3106
|
-
observer.setOptions(options);
|
|
3107
|
-
}, [observer, options]);
|
|
3108
|
-
const result = React10.useSyncExternalStore(
|
|
3109
|
-
React10.useCallback(
|
|
3110
|
-
(onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
3111
|
-
[observer]
|
|
3112
|
-
),
|
|
3113
|
-
() => observer.getCurrentResult(),
|
|
3114
|
-
() => observer.getCurrentResult()
|
|
3115
|
-
);
|
|
3116
|
-
const mutate = React10.useCallback(
|
|
3117
|
-
(variables, mutateOptions) => {
|
|
3118
|
-
observer.mutate(variables, mutateOptions).catch(noop2);
|
|
3119
|
-
},
|
|
3120
|
-
[observer]
|
|
3121
|
-
);
|
|
3122
|
-
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
|
|
3123
|
-
throw result.error;
|
|
3124
|
-
}
|
|
3125
|
-
return { ...result, mutate, mutateAsync: result.mutate };
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
|
-
// ../../../../node_modules/.pnpm/@tanstack+react-query@5.45.1_react@18.3.1/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js
|
|
3129
|
-
function useInfiniteQuery(options, queryClient) {
|
|
3130
|
-
return useBaseQuery(
|
|
3131
|
-
options,
|
|
3132
|
-
InfiniteQueryObserver,
|
|
3133
|
-
queryClient
|
|
3134
|
-
);
|
|
3135
|
-
}
|
|
3136
|
-
|
|
3137
|
-
export {
|
|
3138
|
-
isServer,
|
|
3139
|
-
matchQuery,
|
|
3140
|
-
matchMutation,
|
|
3141
|
-
hashKey,
|
|
3142
|
-
replaceEqualDeep,
|
|
3143
|
-
keepPreviousData,
|
|
3144
|
-
skipToken,
|
|
3145
|
-
focusManager,
|
|
3146
|
-
onlineManager,
|
|
3147
|
-
CancelledError,
|
|
3148
|
-
isCancelledError,
|
|
3149
|
-
notifyManager,
|
|
3150
|
-
Query,
|
|
3151
|
-
QueryCache,
|
|
3152
|
-
MutationCache,
|
|
3153
|
-
QueryClient,
|
|
3154
|
-
QueryObserver,
|
|
3155
|
-
QueriesObserver,
|
|
3156
|
-
InfiniteQueryObserver,
|
|
3157
|
-
MutationObserver,
|
|
3158
|
-
defaultShouldDehydrateMutation,
|
|
3159
|
-
defaultShouldDehydrateQuery,
|
|
3160
|
-
dehydrate,
|
|
3161
|
-
hydrate,
|
|
3162
|
-
QueryClientContext,
|
|
3163
|
-
useQueryClient,
|
|
3164
|
-
QueryClientProvider,
|
|
3165
|
-
useIsRestoring,
|
|
3166
|
-
IsRestoringProvider,
|
|
3167
|
-
useQueryErrorResetBoundary,
|
|
3168
|
-
QueryErrorResetBoundary,
|
|
3169
|
-
useQueries,
|
|
3170
|
-
useQuery,
|
|
3171
|
-
useSuspenseQuery,
|
|
3172
|
-
useSuspenseInfiniteQuery,
|
|
3173
|
-
useSuspenseQueries,
|
|
3174
|
-
queryOptions,
|
|
3175
|
-
infiniteQueryOptions,
|
|
3176
|
-
HydrationBoundary,
|
|
3177
|
-
useIsFetching,
|
|
3178
|
-
useIsMutating,
|
|
3179
|
-
useMutationState,
|
|
3180
|
-
useMutation,
|
|
3181
|
-
useInfiniteQuery
|
|
3182
|
-
};
|
|
3183
|
-
//# sourceMappingURL=chunk-6WYSWNQJ.js.map
|