autumn-js 1.2.32 → 1.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/adapters/express.d.mts +1 -1
- package/dist/backend/adapters/express.d.ts +1 -1
- package/dist/backend/adapters/express.js +13482 -7722
- package/dist/backend/adapters/express.mjs +5 -5
- package/dist/backend/adapters/fetch.d.mts +1 -1
- package/dist/backend/adapters/fetch.d.ts +1 -1
- package/dist/backend/adapters/fetch.js +13482 -7722
- package/dist/backend/adapters/fetch.mjs +5 -5
- package/dist/backend/adapters/hono.d.mts +1 -1
- package/dist/backend/adapters/hono.d.ts +1 -1
- package/dist/backend/adapters/hono.js +13482 -7722
- package/dist/backend/adapters/hono.mjs +5 -5
- package/dist/backend/adapters/index.d.mts +1 -1
- package/dist/backend/adapters/index.d.ts +1 -1
- package/dist/backend/adapters/index.js +13482 -7722
- package/dist/backend/adapters/index.mjs +8 -8
- package/dist/backend/adapters/next.d.mts +1 -1
- package/dist/backend/adapters/next.d.ts +1 -1
- package/dist/backend/adapters/next.js +13482 -7722
- package/dist/backend/adapters/next.mjs +5 -5
- package/dist/backend/{authTypes-Bx2brfr_.d.mts → authTypes-DEBvnrRj.d.mts} +20 -1
- package/dist/backend/{authTypes-Bx2brfr_.d.ts → authTypes-DEBvnrRj.d.ts} +20 -1
- package/dist/backend/{chunk-UYURZ75E.mjs → chunk-4LKEHLXR.mjs} +704 -41
- package/dist/backend/{chunk-W7MG3LB3.mjs → chunk-7MRAUIPE.mjs} +1 -1
- package/dist/backend/{chunk-7MPQ5TCH.mjs → chunk-DDRD5BKK.mjs} +2 -2
- package/dist/backend/{chunk-Z7WSDAEZ.mjs → chunk-EQJ5B7OA.mjs} +13165 -8068
- package/dist/backend/{chunk-AYS6GLVO.mjs → chunk-HMGGMVFC.mjs} +1 -1
- package/dist/backend/{chunk-5QIIBIZY.mjs → chunk-KXRDZE5L.mjs} +2 -2
- package/dist/backend/{chunk-MXD3NPQK.mjs → chunk-SA6MCT5X.mjs} +1 -1
- package/dist/backend/{chunk-NSAJNDTG.mjs → chunk-WCZLA72P.mjs} +1 -1
- package/dist/backend/core/handlers/coreHandler.d.mts +2 -2
- package/dist/backend/core/handlers/coreHandler.d.ts +2 -2
- package/dist/backend/core/handlers/coreHandler.js +13482 -7722
- package/dist/backend/core/handlers/coreHandler.mjs +3 -3
- package/dist/backend/core/handlers/executeRoute.d.mts +2 -2
- package/dist/backend/core/handlers/executeRoute.d.ts +2 -2
- package/dist/backend/core/handlers/handleRouteByName.d.mts +1 -1
- package/dist/backend/core/handlers/handleRouteByName.d.ts +1 -1
- package/dist/backend/core/handlers/handleRouteByName.js +13482 -7722
- package/dist/backend/core/handlers/handleRouteByName.mjs +3 -3
- package/dist/backend/core/handlers/index.d.mts +2 -2
- package/dist/backend/core/handlers/index.d.ts +2 -2
- package/dist/backend/core/handlers/index.js +13482 -7722
- package/dist/backend/core/handlers/index.mjs +4 -4
- package/dist/backend/core/handlers/resolveIdentity.d.mts +1 -1
- package/dist/backend/core/handlers/resolveIdentity.d.ts +1 -1
- package/dist/backend/core/index.d.mts +2 -2
- package/dist/backend/core/index.d.ts +2 -2
- package/dist/backend/core/index.js +13482 -7722
- package/dist/backend/core/index.mjs +4 -4
- package/dist/backend/core/routes/index.d.mts +2 -2
- package/dist/backend/core/routes/index.d.ts +2 -2
- package/dist/backend/core/routes/index.js +704 -41
- package/dist/backend/core/routes/index.mjs +1 -1
- package/dist/backend/core/routes/routeBuilder.d.mts +2 -2
- package/dist/backend/core/routes/routeBuilder.d.ts +2 -2
- package/dist/backend/core/routes/routeConfigs.d.mts +2 -2
- package/dist/backend/core/routes/routeConfigs.d.ts +2 -2
- package/dist/backend/core/routes/routeConfigs.js +704 -41
- package/dist/backend/core/routes/routeConfigs.mjs +1 -1
- package/dist/backend/core/types/authTypes.d.mts +1 -1
- package/dist/backend/core/types/authTypes.d.ts +1 -1
- package/dist/backend/core/types/handlerTypes.d.mts +2 -2
- package/dist/backend/core/types/handlerTypes.d.ts +2 -2
- package/dist/backend/core/types/index.d.mts +2 -2
- package/dist/backend/core/types/index.d.ts +2 -2
- package/dist/backend/core/types/routeTypes.d.mts +2 -2
- package/dist/backend/core/types/routeTypes.d.ts +2 -2
- package/dist/backend/index.d.mts +4 -4
- package/dist/backend/index.d.ts +4 -4
- package/dist/backend/index.js +13482 -7722
- package/dist/backend/index.mjs +4 -4
- package/dist/backend/{routeTypes-DmFnGvb2.d.mts → routeTypes-Bb3L3YJy.d.mts} +14646 -7926
- package/dist/backend/{routeTypes-ChCnBnee.d.ts → routeTypes-BhZ9UovL.d.ts} +14646 -7926
- package/dist/better-auth/{chunk-JBU3OM2O.mjs → chunk-4VW7A2HS.mjs} +13166 -8069
- package/dist/better-auth/{chunk-ZQA6B5RX.mjs → chunk-B2PHHBLY.mjs} +704 -41
- package/dist/better-auth/{chunk-56VTK4JS.mjs → chunk-D3DYQ36C.mjs} +1 -1
- package/dist/better-auth/index.js +13888 -8128
- package/dist/better-auth/index.mjs +3 -3
- package/dist/better-auth/types.d.mts +20 -1
- package/dist/better-auth/types.d.ts +20 -1
- package/dist/better-auth/utils/createAutumnEndpoint.js +704 -41
- package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
- package/dist/better-auth/utils/handleBetterAuthRoute.js +13482 -7722
- package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
- package/dist/better-auth/utils/index.js +13888 -8128
- package/dist/better-auth/utils/index.mjs +3 -3
- package/dist/react/AutumnContext.d.mts +4 -3
- package/dist/react/AutumnContext.d.ts +4 -3
- package/dist/react/AutumnProvider.js +678 -497
- package/dist/react/AutumnProvider.mjs +2 -2
- package/dist/react/{chunk-3CXPC6AS.mjs → chunk-6KIRT7EK.mjs} +1 -1
- package/dist/react/{chunk-PVCGOFQF.mjs → chunk-AAPQJY55.mjs} +1 -1
- package/dist/react/{chunk-N2L457YE.mjs → chunk-DDMHYLY3.mjs} +1 -1
- package/dist/react/{chunk-X7BHGQHX.mjs → chunk-ERN74FDW.mjs} +1 -1
- package/dist/react/{chunk-P23GII4V.mjs → chunk-FU6VEECB.mjs} +428 -235
- package/dist/react/{chunk-C4DMB2FQ.mjs → chunk-JH5BXBEU.mjs} +1 -1
- package/dist/react/{chunk-4TB3RHNC.mjs → chunk-M3L6EE7I.mjs} +1 -1
- package/dist/react/{chunk-Q3SFYOOM.mjs → chunk-VJDFB54U.mjs} +2 -2
- package/dist/react/{chunk-ZLGDHFMS.mjs → chunk-YZ23DM7M.mjs} +1 -1
- package/dist/react/client/AutumnClient.d.mts +4 -3
- package/dist/react/client/AutumnClient.d.ts +4 -3
- package/dist/react/client/IAutumnClient.d.mts +4 -471
- package/dist/react/client/IAutumnClient.d.ts +4 -471
- package/dist/react/client/index.d.mts +4 -3
- package/dist/react/client/index.d.ts +4 -3
- package/dist/react/{customer-B9DcViyn.d.mts → customer-Djhe48ql.d.ts} +24 -5
- package/dist/react/{customer-DbS31iZc.d.ts → customer-IVcJjz9u.d.mts} +24 -5
- package/dist/react/hooks/index.d.mts +4 -3
- package/dist/react/hooks/index.d.ts +4 -3
- package/dist/react/hooks/index.js +292 -193
- package/dist/react/hooks/index.mjs +8 -8
- package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
- package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
- package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
- package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
- package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
- package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
- package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
- package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
- package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
- package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
- package/dist/react/hooks/internal/useCustomerActions.d.mts +4 -3
- package/dist/react/hooks/internal/useCustomerActions.d.ts +4 -3
- package/dist/react/hooks/internal/useCustomerActions.js +1 -1
- package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
- package/dist/react/hooks/useAggregateEvents.d.mts +17 -17
- package/dist/react/hooks/useAggregateEvents.d.ts +17 -17
- package/dist/react/hooks/useAggregateEvents.js +292 -193
- package/dist/react/hooks/useAggregateEvents.mjs +2 -2
- package/dist/react/hooks/useCustomer.d.mts +3 -3
- package/dist/react/hooks/useCustomer.d.ts +3 -3
- package/dist/react/hooks/useCustomer.js +292 -193
- package/dist/react/hooks/useCustomer.mjs +3 -3
- package/dist/react/hooks/useEntity.d.mts +2 -2
- package/dist/react/hooks/useEntity.d.ts +2 -2
- package/dist/react/hooks/useEntity.js +292 -193
- package/dist/react/hooks/useEntity.mjs +2 -2
- package/dist/react/hooks/useListEvents.d.mts +17 -17
- package/dist/react/hooks/useListEvents.d.ts +17 -17
- package/dist/react/hooks/useListEvents.js +292 -193
- package/dist/react/hooks/useListEvents.mjs +2 -2
- package/dist/react/hooks/useListPlans.d.mts +5 -4
- package/dist/react/hooks/useListPlans.d.ts +5 -4
- package/dist/react/hooks/useListPlans.js +292 -193
- package/dist/react/hooks/useListPlans.mjs +2 -2
- package/dist/react/hooks/useReferrals.d.mts +2 -2
- package/dist/react/hooks/useReferrals.d.ts +2 -2
- package/dist/react/hooks/useReferrals.js +292 -193
- package/dist/react/hooks/useReferrals.mjs +2 -2
- package/dist/react/index.d.mts +4 -3
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +1586 -1393
- package/dist/react/index.mjs +9 -9
- package/dist/react/list-plans-op-ByqRxdNR.d.mts +1224 -0
- package/dist/react/list-plans-op-D-K2LRZV.d.ts +1224 -0
- package/dist/react/{params-B8-s4Q1n.d.ts → params-CFhvUVCf.d.ts} +1605 -199
- package/dist/react/{params-BquS51Ut.d.mts → params-D3ra6In7.d.mts} +1605 -199
- package/dist/react/plan-DOxbvjQY.d.mts +1496 -0
- package/dist/react/plan-DOxbvjQY.d.ts +1496 -0
- package/dist/sdk/index.d.mts +19588 -11175
- package/dist/sdk/index.d.ts +19588 -11175
- package/dist/sdk/index.js +19103 -11652
- package/dist/sdk/index.mjs +18149 -11528
- package/package.json +1 -1
- package/dist/react/plan-BKltGb1S.d.mts +0 -743
- package/dist/react/plan-BKltGb1S.d.ts +0 -743
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// ../../node_modules
|
|
3
|
+
// ../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
4
|
+
var defaultTimeoutProvider = {
|
|
5
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
6
|
+
// global setTimeout etc.
|
|
7
|
+
//
|
|
8
|
+
// BAD: `setTimeout: setTimeout`
|
|
9
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
10
|
+
//
|
|
11
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
12
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
13
|
+
// have a hard reference to the original implementation at the time when this
|
|
14
|
+
// file was imported.
|
|
15
|
+
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
16
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
17
|
+
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
18
|
+
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
19
|
+
};
|
|
20
|
+
var TimeoutManager = class {
|
|
21
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
22
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
23
|
+
// would need to support the default provider's concrete timer ID, which is
|
|
24
|
+
// infeasible across environments.
|
|
25
|
+
//
|
|
26
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
27
|
+
// this class is unsafe internally to allow for extension.
|
|
28
|
+
#provider = defaultTimeoutProvider;
|
|
29
|
+
#providerCalled = false;
|
|
30
|
+
setTimeoutProvider(provider) {
|
|
31
|
+
if (process.env.NODE_ENV !== "production") {
|
|
32
|
+
if (this.#providerCalled && provider !== this.#provider) {
|
|
33
|
+
console.error(
|
|
34
|
+
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
35
|
+
{ previous: this.#provider, provider }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
this.#provider = provider;
|
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
|
41
|
+
this.#providerCalled = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
setTimeout(callback, delay) {
|
|
45
|
+
if (process.env.NODE_ENV !== "production") {
|
|
46
|
+
this.#providerCalled = true;
|
|
47
|
+
}
|
|
48
|
+
return this.#provider.setTimeout(callback, delay);
|
|
49
|
+
}
|
|
50
|
+
clearTimeout(timeoutId) {
|
|
51
|
+
this.#provider.clearTimeout(timeoutId);
|
|
52
|
+
}
|
|
53
|
+
setInterval(callback, delay) {
|
|
54
|
+
if (process.env.NODE_ENV !== "production") {
|
|
55
|
+
this.#providerCalled = true;
|
|
56
|
+
}
|
|
57
|
+
return this.#provider.setInterval(callback, delay);
|
|
58
|
+
}
|
|
59
|
+
clearInterval(intervalId) {
|
|
60
|
+
this.#provider.clearInterval(intervalId);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var timeoutManager = new TimeoutManager();
|
|
64
|
+
function systemSetTimeoutZero(callback) {
|
|
65
|
+
setTimeout(callback, 0);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ../../node_modules/@tanstack/query-core/build/modern/utils.js
|
|
4
69
|
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
5
70
|
function noop() {
|
|
6
71
|
}
|
|
@@ -16,8 +81,8 @@ function timeUntilStale(updatedAt, staleTime) {
|
|
|
16
81
|
function resolveStaleTime(staleTime, query) {
|
|
17
82
|
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
18
83
|
}
|
|
19
|
-
function
|
|
20
|
-
return typeof
|
|
84
|
+
function resolveQueryBoolean(option, query) {
|
|
85
|
+
return typeof option === "function" ? option(query) : option;
|
|
21
86
|
}
|
|
22
87
|
function matchQuery(filters, query) {
|
|
23
88
|
const {
|
|
@@ -104,34 +169,38 @@ function partialMatchKey(a, b) {
|
|
|
104
169
|
}
|
|
105
170
|
return false;
|
|
106
171
|
}
|
|
107
|
-
|
|
172
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
173
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
108
174
|
if (a === b) {
|
|
109
175
|
return a;
|
|
110
176
|
}
|
|
177
|
+
if (depth > 500) return b;
|
|
111
178
|
const array = isPlainArray(a) && isPlainArray(b);
|
|
112
|
-
if (array
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
179
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
180
|
+
const aItems = array ? a : Object.keys(a);
|
|
181
|
+
const aSize = aItems.length;
|
|
182
|
+
const bItems = array ? b : Object.keys(b);
|
|
183
|
+
const bSize = bItems.length;
|
|
184
|
+
const copy = array ? new Array(bSize) : {};
|
|
185
|
+
let equalItems = 0;
|
|
186
|
+
for (let i = 0; i < bSize; i++) {
|
|
187
|
+
const key = array ? i : bItems[i];
|
|
188
|
+
const aItem = a[key];
|
|
189
|
+
const bItem = b[key];
|
|
190
|
+
if (aItem === bItem) {
|
|
191
|
+
copy[key] = aItem;
|
|
192
|
+
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
196
|
+
copy[key] = bItem;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
200
|
+
copy[key] = v;
|
|
201
|
+
if (v === aItem) equalItems++;
|
|
202
|
+
}
|
|
203
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
135
204
|
}
|
|
136
205
|
function shallowEqualObjects(a, b) {
|
|
137
206
|
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
@@ -172,7 +241,7 @@ function hasObjectPrototype(o) {
|
|
|
172
241
|
}
|
|
173
242
|
function sleep(timeout) {
|
|
174
243
|
return new Promise((resolve) => {
|
|
175
|
-
setTimeout(resolve, timeout);
|
|
244
|
+
timeoutManager.setTimeout(resolve, timeout);
|
|
176
245
|
});
|
|
177
246
|
}
|
|
178
247
|
function replaceData(prevData, data, options) {
|
|
@@ -201,7 +270,7 @@ function addToStart(items, item, max = 0) {
|
|
|
201
270
|
const newItems = [item, ...items];
|
|
202
271
|
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
203
272
|
}
|
|
204
|
-
var skipToken = Symbol();
|
|
273
|
+
var skipToken = /* @__PURE__ */ Symbol();
|
|
205
274
|
function ensureQueryFn(options, fetchOptions) {
|
|
206
275
|
if (process.env.NODE_ENV !== "production") {
|
|
207
276
|
if (options.queryFn === skipToken) {
|
|
@@ -224,9 +293,30 @@ function shouldThrowError(throwOnError, params) {
|
|
|
224
293
|
}
|
|
225
294
|
return !!throwOnError;
|
|
226
295
|
}
|
|
296
|
+
function addConsumeAwareSignal(object, getSignal, onCancelled) {
|
|
297
|
+
let consumed = false;
|
|
298
|
+
let signal;
|
|
299
|
+
Object.defineProperty(object, "signal", {
|
|
300
|
+
enumerable: true,
|
|
301
|
+
get: () => {
|
|
302
|
+
signal ??= getSignal();
|
|
303
|
+
if (consumed) {
|
|
304
|
+
return signal;
|
|
305
|
+
}
|
|
306
|
+
consumed = true;
|
|
307
|
+
if (signal.aborted) {
|
|
308
|
+
onCancelled();
|
|
309
|
+
} else {
|
|
310
|
+
signal.addEventListener("abort", onCancelled, { once: true });
|
|
311
|
+
}
|
|
312
|
+
return signal;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
return object;
|
|
316
|
+
}
|
|
227
317
|
|
|
228
|
-
// ../../node_modules
|
|
229
|
-
var defaultScheduler =
|
|
318
|
+
// ../../node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
319
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
230
320
|
function createNotifyManager() {
|
|
231
321
|
let queue = [];
|
|
232
322
|
let transactions = 0;
|
|
@@ -305,7 +395,7 @@ function createNotifyManager() {
|
|
|
305
395
|
}
|
|
306
396
|
var notifyManager = createNotifyManager();
|
|
307
397
|
|
|
308
|
-
// ../../node_modules
|
|
398
|
+
// ../../node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
309
399
|
var Subscribable = class {
|
|
310
400
|
constructor() {
|
|
311
401
|
this.listeners = /* @__PURE__ */ new Set();
|
|
@@ -328,7 +418,7 @@ var Subscribable = class {
|
|
|
328
418
|
}
|
|
329
419
|
};
|
|
330
420
|
|
|
331
|
-
// ../../node_modules
|
|
421
|
+
// ../../node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
332
422
|
var FocusManager = class extends Subscribable {
|
|
333
423
|
#focused;
|
|
334
424
|
#cleanup;
|
|
@@ -336,7 +426,7 @@ var FocusManager = class extends Subscribable {
|
|
|
336
426
|
constructor() {
|
|
337
427
|
super();
|
|
338
428
|
this.#setup = (onFocus) => {
|
|
339
|
-
if (
|
|
429
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
340
430
|
const listener = () => onFocus();
|
|
341
431
|
window.addEventListener("visibilitychange", listener, false);
|
|
342
432
|
return () => {
|
|
@@ -390,7 +480,7 @@ var FocusManager = class extends Subscribable {
|
|
|
390
480
|
};
|
|
391
481
|
var focusManager = new FocusManager();
|
|
392
482
|
|
|
393
|
-
// ../../node_modules
|
|
483
|
+
// ../../node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
394
484
|
var OnlineManager = class extends Subscribable {
|
|
395
485
|
#online = true;
|
|
396
486
|
#cleanup;
|
|
@@ -398,7 +488,7 @@ var OnlineManager = class extends Subscribable {
|
|
|
398
488
|
constructor() {
|
|
399
489
|
super();
|
|
400
490
|
this.#setup = (onOnline) => {
|
|
401
|
-
if (
|
|
491
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
402
492
|
const onlineListener = () => onOnline(true);
|
|
403
493
|
const offlineListener = () => onOnline(false);
|
|
404
494
|
window.addEventListener("online", onlineListener, false);
|
|
@@ -442,7 +532,7 @@ var OnlineManager = class extends Subscribable {
|
|
|
442
532
|
};
|
|
443
533
|
var onlineManager = new OnlineManager();
|
|
444
534
|
|
|
445
|
-
// ../../node_modules
|
|
535
|
+
// ../../node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
446
536
|
function pendingThenable() {
|
|
447
537
|
let resolve;
|
|
448
538
|
let reject;
|
|
@@ -475,7 +565,26 @@ function pendingThenable() {
|
|
|
475
565
|
return thenable;
|
|
476
566
|
}
|
|
477
567
|
|
|
478
|
-
// ../../node_modules
|
|
568
|
+
// ../../node_modules/@tanstack/query-core/build/modern/environmentManager.js
|
|
569
|
+
var environmentManager = /* @__PURE__ */ (() => {
|
|
570
|
+
let isServerFn = () => isServer;
|
|
571
|
+
return {
|
|
572
|
+
/**
|
|
573
|
+
* Returns whether the current runtime should be treated as a server environment.
|
|
574
|
+
*/
|
|
575
|
+
isServer() {
|
|
576
|
+
return isServerFn();
|
|
577
|
+
},
|
|
578
|
+
/**
|
|
579
|
+
* Overrides the server check globally.
|
|
580
|
+
*/
|
|
581
|
+
setIsServer(isServerValue) {
|
|
582
|
+
isServerFn = isServerValue;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
})();
|
|
586
|
+
|
|
587
|
+
// ../../node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
479
588
|
function defaultRetryDelay(failureCount) {
|
|
480
589
|
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
481
590
|
}
|
|
@@ -552,7 +661,7 @@ function createRetryer(config) {
|
|
|
552
661
|
if (isResolved()) {
|
|
553
662
|
return;
|
|
554
663
|
}
|
|
555
|
-
const retry = config.retry ?? (isServer ? 0 : 3);
|
|
664
|
+
const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);
|
|
556
665
|
const retryDelay = config.retryDelay ?? defaultRetryDelay;
|
|
557
666
|
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
558
667
|
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
@@ -595,7 +704,7 @@ function createRetryer(config) {
|
|
|
595
704
|
};
|
|
596
705
|
}
|
|
597
706
|
|
|
598
|
-
// ../../node_modules
|
|
707
|
+
// ../../node_modules/@tanstack/query-core/build/modern/removable.js
|
|
599
708
|
var Removable = class {
|
|
600
709
|
#gcTimeout;
|
|
601
710
|
destroy() {
|
|
@@ -604,7 +713,7 @@ var Removable = class {
|
|
|
604
713
|
scheduleGc() {
|
|
605
714
|
this.clearGcTimeout();
|
|
606
715
|
if (isValidTimeout(this.gcTime)) {
|
|
607
|
-
this.#gcTimeout = setTimeout(() => {
|
|
716
|
+
this.#gcTimeout = timeoutManager.setTimeout(() => {
|
|
608
717
|
this.optionalRemove();
|
|
609
718
|
}, this.gcTime);
|
|
610
719
|
}
|
|
@@ -612,19 +721,121 @@ var Removable = class {
|
|
|
612
721
|
updateGcTime(newGcTime) {
|
|
613
722
|
this.gcTime = Math.max(
|
|
614
723
|
this.gcTime || 0,
|
|
615
|
-
newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
|
|
724
|
+
newGcTime ?? (environmentManager.isServer() ? Infinity : 5 * 60 * 1e3)
|
|
616
725
|
);
|
|
617
726
|
}
|
|
618
727
|
clearGcTimeout() {
|
|
619
|
-
if (this.#gcTimeout) {
|
|
620
|
-
clearTimeout(this.#gcTimeout);
|
|
728
|
+
if (this.#gcTimeout !== void 0) {
|
|
729
|
+
timeoutManager.clearTimeout(this.#gcTimeout);
|
|
621
730
|
this.#gcTimeout = void 0;
|
|
622
731
|
}
|
|
623
732
|
}
|
|
624
733
|
};
|
|
625
734
|
|
|
626
|
-
// ../../node_modules
|
|
735
|
+
// ../../node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
736
|
+
function infiniteQueryBehavior(pages) {
|
|
737
|
+
return {
|
|
738
|
+
onFetch: (context, query) => {
|
|
739
|
+
const options = context.options;
|
|
740
|
+
const direction = context.fetchOptions?.meta?.fetchMore?.direction;
|
|
741
|
+
const oldPages = context.state.data?.pages || [];
|
|
742
|
+
const oldPageParams = context.state.data?.pageParams || [];
|
|
743
|
+
let result = { pages: [], pageParams: [] };
|
|
744
|
+
let currentPage = 0;
|
|
745
|
+
const fetchFn = async () => {
|
|
746
|
+
let cancelled = false;
|
|
747
|
+
const addSignalProperty = (object) => {
|
|
748
|
+
addConsumeAwareSignal(
|
|
749
|
+
object,
|
|
750
|
+
() => context.signal,
|
|
751
|
+
() => cancelled = true
|
|
752
|
+
);
|
|
753
|
+
};
|
|
754
|
+
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
755
|
+
const fetchPage = async (data, param, previous) => {
|
|
756
|
+
if (cancelled) {
|
|
757
|
+
return Promise.reject(context.signal.reason);
|
|
758
|
+
}
|
|
759
|
+
if (param == null && data.pages.length) {
|
|
760
|
+
return Promise.resolve(data);
|
|
761
|
+
}
|
|
762
|
+
const createQueryFnContext = () => {
|
|
763
|
+
const queryFnContext2 = {
|
|
764
|
+
client: context.client,
|
|
765
|
+
queryKey: context.queryKey,
|
|
766
|
+
pageParam: param,
|
|
767
|
+
direction: previous ? "backward" : "forward",
|
|
768
|
+
meta: context.options.meta
|
|
769
|
+
};
|
|
770
|
+
addSignalProperty(queryFnContext2);
|
|
771
|
+
return queryFnContext2;
|
|
772
|
+
};
|
|
773
|
+
const queryFnContext = createQueryFnContext();
|
|
774
|
+
const page = await queryFn(queryFnContext);
|
|
775
|
+
const { maxPages } = context.options;
|
|
776
|
+
const addTo = previous ? addToStart : addToEnd;
|
|
777
|
+
return {
|
|
778
|
+
pages: addTo(data.pages, page, maxPages),
|
|
779
|
+
pageParams: addTo(data.pageParams, param, maxPages)
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
if (direction && oldPages.length) {
|
|
783
|
+
const previous = direction === "backward";
|
|
784
|
+
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
785
|
+
const oldData = {
|
|
786
|
+
pages: oldPages,
|
|
787
|
+
pageParams: oldPageParams
|
|
788
|
+
};
|
|
789
|
+
const param = pageParamFn(options, oldData);
|
|
790
|
+
result = await fetchPage(oldData, param, previous);
|
|
791
|
+
} else {
|
|
792
|
+
const remainingPages = pages ?? oldPages.length;
|
|
793
|
+
do {
|
|
794
|
+
const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
|
|
795
|
+
if (currentPage > 0 && param == null) {
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
result = await fetchPage(result, param);
|
|
799
|
+
currentPage++;
|
|
800
|
+
} while (currentPage < remainingPages);
|
|
801
|
+
}
|
|
802
|
+
return result;
|
|
803
|
+
};
|
|
804
|
+
if (context.options.persister) {
|
|
805
|
+
context.fetchFn = () => {
|
|
806
|
+
return context.options.persister?.(
|
|
807
|
+
fetchFn,
|
|
808
|
+
{
|
|
809
|
+
client: context.client,
|
|
810
|
+
queryKey: context.queryKey,
|
|
811
|
+
meta: context.options.meta,
|
|
812
|
+
signal: context.signal
|
|
813
|
+
},
|
|
814
|
+
query
|
|
815
|
+
);
|
|
816
|
+
};
|
|
817
|
+
} else {
|
|
818
|
+
context.fetchFn = fetchFn;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function getNextPageParam(options, { pages, pageParams }) {
|
|
824
|
+
const lastIndex = pages.length - 1;
|
|
825
|
+
return pages.length > 0 ? options.getNextPageParam(
|
|
826
|
+
pages[lastIndex],
|
|
827
|
+
pages,
|
|
828
|
+
pageParams[lastIndex],
|
|
829
|
+
pageParams
|
|
830
|
+
) : void 0;
|
|
831
|
+
}
|
|
832
|
+
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
833
|
+
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// ../../node_modules/@tanstack/query-core/build/modern/query.js
|
|
627
837
|
var Query = class extends Removable {
|
|
838
|
+
#queryType;
|
|
628
839
|
#initialState;
|
|
629
840
|
#revertState;
|
|
630
841
|
#cache;
|
|
@@ -649,12 +860,27 @@ var Query = class extends Removable {
|
|
|
649
860
|
get meta() {
|
|
650
861
|
return this.options.meta;
|
|
651
862
|
}
|
|
863
|
+
get queryType() {
|
|
864
|
+
return this.#queryType;
|
|
865
|
+
}
|
|
652
866
|
get promise() {
|
|
653
867
|
return this.#retryer?.promise;
|
|
654
868
|
}
|
|
655
869
|
setOptions(options) {
|
|
656
870
|
this.options = { ...this.#defaultOptions, ...options };
|
|
871
|
+
if (options?._type) {
|
|
872
|
+
this.#queryType = options._type;
|
|
873
|
+
}
|
|
657
874
|
this.updateGcTime(this.options.gcTime);
|
|
875
|
+
if (this.state && this.state.data === void 0) {
|
|
876
|
+
const defaultState = getDefaultState(this.options);
|
|
877
|
+
if (defaultState.data !== void 0) {
|
|
878
|
+
this.setState(
|
|
879
|
+
successState(defaultState.data, defaultState.dataUpdatedAt)
|
|
880
|
+
);
|
|
881
|
+
this.#initialState = defaultState;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
658
884
|
}
|
|
659
885
|
optionalRemove() {
|
|
660
886
|
if (!this.observers.length && this.state.fetchStatus === "idle") {
|
|
@@ -671,8 +897,8 @@ var Query = class extends Removable {
|
|
|
671
897
|
});
|
|
672
898
|
return data;
|
|
673
899
|
}
|
|
674
|
-
setState(state
|
|
675
|
-
this.#dispatch({ type: "setState", state
|
|
900
|
+
setState(state) {
|
|
901
|
+
this.#dispatch({ type: "setState", state });
|
|
676
902
|
}
|
|
677
903
|
cancel(options) {
|
|
678
904
|
const promise = this.#retryer?.promise;
|
|
@@ -683,20 +909,26 @@ var Query = class extends Removable {
|
|
|
683
909
|
super.destroy();
|
|
684
910
|
this.cancel({ silent: true });
|
|
685
911
|
}
|
|
912
|
+
get resetState() {
|
|
913
|
+
return this.#initialState;
|
|
914
|
+
}
|
|
686
915
|
reset() {
|
|
687
916
|
this.destroy();
|
|
688
|
-
this.setState(this
|
|
917
|
+
this.setState(this.resetState);
|
|
689
918
|
}
|
|
690
919
|
isActive() {
|
|
691
920
|
return this.observers.some(
|
|
692
|
-
(observer) =>
|
|
921
|
+
(observer) => resolveQueryBoolean(observer.options.enabled, this) !== false
|
|
693
922
|
);
|
|
694
923
|
}
|
|
695
924
|
isDisabled() {
|
|
696
925
|
if (this.getObserversCount() > 0) {
|
|
697
926
|
return !this.isActive();
|
|
698
927
|
}
|
|
699
|
-
return this.options.queryFn === skipToken || this.
|
|
928
|
+
return this.options.queryFn === skipToken || !this.isFetched();
|
|
929
|
+
}
|
|
930
|
+
isFetched() {
|
|
931
|
+
return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
|
|
700
932
|
}
|
|
701
933
|
isStatic() {
|
|
702
934
|
if (this.getObserversCount() > 0) {
|
|
@@ -748,7 +980,7 @@ var Query = class extends Removable {
|
|
|
748
980
|
this.observers = this.observers.filter((x) => x !== observer);
|
|
749
981
|
if (!this.observers.length) {
|
|
750
982
|
if (this.#retryer) {
|
|
751
|
-
if (this.#abortSignalConsumed) {
|
|
983
|
+
if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) {
|
|
752
984
|
this.#retryer.cancel({ revert: true });
|
|
753
985
|
} else {
|
|
754
986
|
this.#retryer.cancelRetry();
|
|
@@ -762,13 +994,16 @@ var Query = class extends Removable {
|
|
|
762
994
|
getObserversCount() {
|
|
763
995
|
return this.observers.length;
|
|
764
996
|
}
|
|
997
|
+
#isInitialPausedFetch() {
|
|
998
|
+
return this.state.fetchStatus === "paused" && this.state.status === "pending";
|
|
999
|
+
}
|
|
765
1000
|
invalidate() {
|
|
766
1001
|
if (!this.state.isInvalidated) {
|
|
767
1002
|
this.#dispatch({ type: "invalidate" });
|
|
768
1003
|
}
|
|
769
1004
|
}
|
|
770
1005
|
async fetch(options, fetchOptions) {
|
|
771
|
-
if (this.state.fetchStatus !== "idle" && // If the promise in the
|
|
1006
|
+
if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
|
|
772
1007
|
// re-start the fetch; there is a chance that the query is still in a
|
|
773
1008
|
// pending state when that happens
|
|
774
1009
|
this.#retryer?.status() !== "rejected") {
|
|
@@ -840,7 +1075,10 @@ var Query = class extends Removable {
|
|
|
840
1075
|
return context2;
|
|
841
1076
|
};
|
|
842
1077
|
const context = createFetchContext();
|
|
843
|
-
|
|
1078
|
+
const behavior = this.#queryType === "infinite" ? infiniteQueryBehavior(
|
|
1079
|
+
this.options.pages
|
|
1080
|
+
) : this.options.behavior;
|
|
1081
|
+
behavior?.onFetch(context, this);
|
|
844
1082
|
this.#revertState = this.state;
|
|
845
1083
|
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
846
1084
|
this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
|
|
@@ -946,12 +1184,8 @@ var Query = class extends Removable {
|
|
|
946
1184
|
case "success":
|
|
947
1185
|
const newState = {
|
|
948
1186
|
...state,
|
|
949
|
-
data
|
|
1187
|
+
...successState(action.data, action.dataUpdatedAt),
|
|
950
1188
|
dataUpdateCount: state.dataUpdateCount + 1,
|
|
951
|
-
dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),
|
|
952
|
-
error: null,
|
|
953
|
-
isInvalidated: false,
|
|
954
|
-
status: "success",
|
|
955
1189
|
...!action.manual && {
|
|
956
1190
|
fetchStatus: "idle",
|
|
957
1191
|
fetchFailureCount: 0,
|
|
@@ -970,7 +1204,10 @@ var Query = class extends Removable {
|
|
|
970
1204
|
fetchFailureCount: state.fetchFailureCount + 1,
|
|
971
1205
|
fetchFailureReason: error,
|
|
972
1206
|
fetchStatus: "idle",
|
|
973
|
-
status: "error"
|
|
1207
|
+
status: "error",
|
|
1208
|
+
// flag existing data as invalidated if we get a background error
|
|
1209
|
+
// note that "no data" always means stale so we can set unconditionally here
|
|
1210
|
+
isInvalidated: true
|
|
974
1211
|
};
|
|
975
1212
|
case "invalidate":
|
|
976
1213
|
return {
|
|
@@ -1004,6 +1241,15 @@ function fetchState(data, options) {
|
|
|
1004
1241
|
}
|
|
1005
1242
|
};
|
|
1006
1243
|
}
|
|
1244
|
+
function successState(data, dataUpdatedAt) {
|
|
1245
|
+
return {
|
|
1246
|
+
data,
|
|
1247
|
+
dataUpdatedAt: dataUpdatedAt ?? Date.now(),
|
|
1248
|
+
error: null,
|
|
1249
|
+
isInvalidated: false,
|
|
1250
|
+
status: "success"
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1007
1253
|
function getDefaultState(options) {
|
|
1008
1254
|
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
1009
1255
|
const hasData = data !== void 0;
|
|
@@ -1024,7 +1270,7 @@ function getDefaultState(options) {
|
|
|
1024
1270
|
};
|
|
1025
1271
|
}
|
|
1026
1272
|
|
|
1027
|
-
// ../../node_modules
|
|
1273
|
+
// ../../node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
1028
1274
|
var QueryCache = class extends Subscribable {
|
|
1029
1275
|
constructor(config = {}) {
|
|
1030
1276
|
super();
|
|
@@ -1114,13 +1360,15 @@ var QueryCache = class extends Subscribable {
|
|
|
1114
1360
|
}
|
|
1115
1361
|
};
|
|
1116
1362
|
|
|
1117
|
-
// ../../node_modules
|
|
1363
|
+
// ../../node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
1118
1364
|
var Mutation = class extends Removable {
|
|
1365
|
+
#client;
|
|
1119
1366
|
#observers;
|
|
1120
1367
|
#mutationCache;
|
|
1121
1368
|
#retryer;
|
|
1122
1369
|
constructor(config) {
|
|
1123
1370
|
super();
|
|
1371
|
+
this.#client = config.client;
|
|
1124
1372
|
this.mutationId = config.mutationId;
|
|
1125
1373
|
this.#mutationCache = config.mutationCache;
|
|
1126
1374
|
this.#observers = [];
|
|
@@ -1172,12 +1420,17 @@ var Mutation = class extends Removable {
|
|
|
1172
1420
|
const onContinue = () => {
|
|
1173
1421
|
this.#dispatch({ type: "continue" });
|
|
1174
1422
|
};
|
|
1423
|
+
const mutationFnContext = {
|
|
1424
|
+
client: this.#client,
|
|
1425
|
+
meta: this.options.meta,
|
|
1426
|
+
mutationKey: this.options.mutationKey
|
|
1427
|
+
};
|
|
1175
1428
|
this.#retryer = createRetryer({
|
|
1176
1429
|
fn: () => {
|
|
1177
1430
|
if (!this.options.mutationFn) {
|
|
1178
1431
|
return Promise.reject(new Error("No mutationFn found"));
|
|
1179
1432
|
}
|
|
1180
|
-
return this.options.mutationFn(variables);
|
|
1433
|
+
return this.options.mutationFn(variables, mutationFnContext);
|
|
1181
1434
|
},
|
|
1182
1435
|
onFail: (failureCount, error) => {
|
|
1183
1436
|
this.#dispatch({ type: "failed", failureCount, error });
|
|
@@ -1198,11 +1451,17 @@ var Mutation = class extends Removable {
|
|
|
1198
1451
|
onContinue();
|
|
1199
1452
|
} else {
|
|
1200
1453
|
this.#dispatch({ type: "pending", variables, isPaused });
|
|
1201
|
-
|
|
1454
|
+
if (this.#mutationCache.config.onMutate) {
|
|
1455
|
+
await this.#mutationCache.config.onMutate(
|
|
1456
|
+
variables,
|
|
1457
|
+
this,
|
|
1458
|
+
mutationFnContext
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
const context = await this.options.onMutate?.(
|
|
1202
1462
|
variables,
|
|
1203
|
-
|
|
1463
|
+
mutationFnContext
|
|
1204
1464
|
);
|
|
1205
|
-
const context = await this.options.onMutate?.(variables);
|
|
1206
1465
|
if (context !== this.state.context) {
|
|
1207
1466
|
this.#dispatch({
|
|
1208
1467
|
type: "pending",
|
|
@@ -1217,17 +1476,30 @@ var Mutation = class extends Removable {
|
|
|
1217
1476
|
data,
|
|
1218
1477
|
variables,
|
|
1219
1478
|
this.state.context,
|
|
1220
|
-
this
|
|
1479
|
+
this,
|
|
1480
|
+
mutationFnContext
|
|
1481
|
+
);
|
|
1482
|
+
await this.options.onSuccess?.(
|
|
1483
|
+
data,
|
|
1484
|
+
variables,
|
|
1485
|
+
this.state.context,
|
|
1486
|
+
mutationFnContext
|
|
1221
1487
|
);
|
|
1222
|
-
await this.options.onSuccess?.(data, variables, this.state.context);
|
|
1223
1488
|
await this.#mutationCache.config.onSettled?.(
|
|
1224
1489
|
data,
|
|
1225
1490
|
null,
|
|
1226
1491
|
this.state.variables,
|
|
1227
1492
|
this.state.context,
|
|
1228
|
-
this
|
|
1493
|
+
this,
|
|
1494
|
+
mutationFnContext
|
|
1495
|
+
);
|
|
1496
|
+
await this.options.onSettled?.(
|
|
1497
|
+
data,
|
|
1498
|
+
null,
|
|
1499
|
+
variables,
|
|
1500
|
+
this.state.context,
|
|
1501
|
+
mutationFnContext
|
|
1229
1502
|
);
|
|
1230
|
-
await this.options.onSettled?.(data, null, variables, this.state.context);
|
|
1231
1503
|
this.#dispatch({ type: "success", data });
|
|
1232
1504
|
return data;
|
|
1233
1505
|
} catch (error) {
|
|
@@ -1236,30 +1508,47 @@ var Mutation = class extends Removable {
|
|
|
1236
1508
|
error,
|
|
1237
1509
|
variables,
|
|
1238
1510
|
this.state.context,
|
|
1239
|
-
this
|
|
1511
|
+
this,
|
|
1512
|
+
mutationFnContext
|
|
1240
1513
|
);
|
|
1514
|
+
} catch (e) {
|
|
1515
|
+
void Promise.reject(e);
|
|
1516
|
+
}
|
|
1517
|
+
try {
|
|
1241
1518
|
await this.options.onError?.(
|
|
1242
1519
|
error,
|
|
1243
1520
|
variables,
|
|
1244
|
-
this.state.context
|
|
1521
|
+
this.state.context,
|
|
1522
|
+
mutationFnContext
|
|
1245
1523
|
);
|
|
1524
|
+
} catch (e) {
|
|
1525
|
+
void Promise.reject(e);
|
|
1526
|
+
}
|
|
1527
|
+
try {
|
|
1246
1528
|
await this.#mutationCache.config.onSettled?.(
|
|
1247
1529
|
void 0,
|
|
1248
1530
|
error,
|
|
1249
1531
|
this.state.variables,
|
|
1250
1532
|
this.state.context,
|
|
1251
|
-
this
|
|
1533
|
+
this,
|
|
1534
|
+
mutationFnContext
|
|
1252
1535
|
);
|
|
1536
|
+
} catch (e) {
|
|
1537
|
+
void Promise.reject(e);
|
|
1538
|
+
}
|
|
1539
|
+
try {
|
|
1253
1540
|
await this.options.onSettled?.(
|
|
1254
1541
|
void 0,
|
|
1255
1542
|
error,
|
|
1256
1543
|
variables,
|
|
1257
|
-
this.state.context
|
|
1544
|
+
this.state.context,
|
|
1545
|
+
mutationFnContext
|
|
1258
1546
|
);
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
this.#dispatch({ type: "error", error });
|
|
1547
|
+
} catch (e) {
|
|
1548
|
+
void Promise.reject(e);
|
|
1262
1549
|
}
|
|
1550
|
+
this.#dispatch({ type: "error", error });
|
|
1551
|
+
throw error;
|
|
1263
1552
|
} finally {
|
|
1264
1553
|
this.#mutationCache.runNext(this);
|
|
1265
1554
|
}
|
|
@@ -1345,7 +1634,7 @@ function getDefaultState2() {
|
|
|
1345
1634
|
};
|
|
1346
1635
|
}
|
|
1347
1636
|
|
|
1348
|
-
// ../../node_modules
|
|
1637
|
+
// ../../node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
1349
1638
|
var MutationCache = class extends Subscribable {
|
|
1350
1639
|
constructor(config = {}) {
|
|
1351
1640
|
super();
|
|
@@ -1359,6 +1648,7 @@ var MutationCache = class extends Subscribable {
|
|
|
1359
1648
|
#mutationId;
|
|
1360
1649
|
build(client, options, state) {
|
|
1361
1650
|
const mutation = new Mutation({
|
|
1651
|
+
client,
|
|
1362
1652
|
mutationCache: this,
|
|
1363
1653
|
mutationId: ++this.#mutationId,
|
|
1364
1654
|
options: client.defaultMutationOptions(options),
|
|
@@ -1461,116 +1751,7 @@ function scopeFor(mutation) {
|
|
|
1461
1751
|
return mutation.options.scope?.id;
|
|
1462
1752
|
}
|
|
1463
1753
|
|
|
1464
|
-
// ../../node_modules
|
|
1465
|
-
function infiniteQueryBehavior(pages) {
|
|
1466
|
-
return {
|
|
1467
|
-
onFetch: (context, query) => {
|
|
1468
|
-
const options = context.options;
|
|
1469
|
-
const direction = context.fetchOptions?.meta?.fetchMore?.direction;
|
|
1470
|
-
const oldPages = context.state.data?.pages || [];
|
|
1471
|
-
const oldPageParams = context.state.data?.pageParams || [];
|
|
1472
|
-
let result = { pages: [], pageParams: [] };
|
|
1473
|
-
let currentPage = 0;
|
|
1474
|
-
const fetchFn = async () => {
|
|
1475
|
-
let cancelled = false;
|
|
1476
|
-
const addSignalProperty = (object) => {
|
|
1477
|
-
Object.defineProperty(object, "signal", {
|
|
1478
|
-
enumerable: true,
|
|
1479
|
-
get: () => {
|
|
1480
|
-
if (context.signal.aborted) {
|
|
1481
|
-
cancelled = true;
|
|
1482
|
-
} else {
|
|
1483
|
-
context.signal.addEventListener("abort", () => {
|
|
1484
|
-
cancelled = true;
|
|
1485
|
-
});
|
|
1486
|
-
}
|
|
1487
|
-
return context.signal;
|
|
1488
|
-
}
|
|
1489
|
-
});
|
|
1490
|
-
};
|
|
1491
|
-
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
1492
|
-
const fetchPage = async (data, param, previous) => {
|
|
1493
|
-
if (cancelled) {
|
|
1494
|
-
return Promise.reject();
|
|
1495
|
-
}
|
|
1496
|
-
if (param == null && data.pages.length) {
|
|
1497
|
-
return Promise.resolve(data);
|
|
1498
|
-
}
|
|
1499
|
-
const createQueryFnContext = () => {
|
|
1500
|
-
const queryFnContext2 = {
|
|
1501
|
-
client: context.client,
|
|
1502
|
-
queryKey: context.queryKey,
|
|
1503
|
-
pageParam: param,
|
|
1504
|
-
direction: previous ? "backward" : "forward",
|
|
1505
|
-
meta: context.options.meta
|
|
1506
|
-
};
|
|
1507
|
-
addSignalProperty(queryFnContext2);
|
|
1508
|
-
return queryFnContext2;
|
|
1509
|
-
};
|
|
1510
|
-
const queryFnContext = createQueryFnContext();
|
|
1511
|
-
const page = await queryFn(queryFnContext);
|
|
1512
|
-
const { maxPages } = context.options;
|
|
1513
|
-
const addTo = previous ? addToStart : addToEnd;
|
|
1514
|
-
return {
|
|
1515
|
-
pages: addTo(data.pages, page, maxPages),
|
|
1516
|
-
pageParams: addTo(data.pageParams, param, maxPages)
|
|
1517
|
-
};
|
|
1518
|
-
};
|
|
1519
|
-
if (direction && oldPages.length) {
|
|
1520
|
-
const previous = direction === "backward";
|
|
1521
|
-
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
1522
|
-
const oldData = {
|
|
1523
|
-
pages: oldPages,
|
|
1524
|
-
pageParams: oldPageParams
|
|
1525
|
-
};
|
|
1526
|
-
const param = pageParamFn(options, oldData);
|
|
1527
|
-
result = await fetchPage(oldData, param, previous);
|
|
1528
|
-
} else {
|
|
1529
|
-
const remainingPages = pages ?? oldPages.length;
|
|
1530
|
-
do {
|
|
1531
|
-
const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
|
|
1532
|
-
if (currentPage > 0 && param == null) {
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
result = await fetchPage(result, param);
|
|
1536
|
-
currentPage++;
|
|
1537
|
-
} while (currentPage < remainingPages);
|
|
1538
|
-
}
|
|
1539
|
-
return result;
|
|
1540
|
-
};
|
|
1541
|
-
if (context.options.persister) {
|
|
1542
|
-
context.fetchFn = () => {
|
|
1543
|
-
return context.options.persister?.(
|
|
1544
|
-
fetchFn,
|
|
1545
|
-
{
|
|
1546
|
-
client: context.client,
|
|
1547
|
-
queryKey: context.queryKey,
|
|
1548
|
-
meta: context.options.meta,
|
|
1549
|
-
signal: context.signal
|
|
1550
|
-
},
|
|
1551
|
-
query
|
|
1552
|
-
);
|
|
1553
|
-
};
|
|
1554
|
-
} else {
|
|
1555
|
-
context.fetchFn = fetchFn;
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
}
|
|
1560
|
-
function getNextPageParam(options, { pages, pageParams }) {
|
|
1561
|
-
const lastIndex = pages.length - 1;
|
|
1562
|
-
return pages.length > 0 ? options.getNextPageParam(
|
|
1563
|
-
pages[lastIndex],
|
|
1564
|
-
pages,
|
|
1565
|
-
pageParams[lastIndex],
|
|
1566
|
-
pageParams
|
|
1567
|
-
) : void 0;
|
|
1568
|
-
}
|
|
1569
|
-
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
1570
|
-
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
// ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
1754
|
+
// ../../node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
1574
1755
|
var QueryClient = class {
|
|
1575
1756
|
#queryCache;
|
|
1576
1757
|
#mutationCache;
|
|
@@ -1750,14 +1931,14 @@ var QueryClient = class {
|
|
|
1750
1931
|
return this.fetchQuery(options).then(noop).catch(noop);
|
|
1751
1932
|
}
|
|
1752
1933
|
fetchInfiniteQuery(options) {
|
|
1753
|
-
options.
|
|
1934
|
+
options._type = "infinite";
|
|
1754
1935
|
return this.fetchQuery(options);
|
|
1755
1936
|
}
|
|
1756
1937
|
prefetchInfiniteQuery(options) {
|
|
1757
1938
|
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
1758
1939
|
}
|
|
1759
1940
|
ensureInfiniteQueryData(options) {
|
|
1760
|
-
options.
|
|
1941
|
+
options._type = "infinite";
|
|
1761
1942
|
return this.ensureQueryData(options);
|
|
1762
1943
|
}
|
|
1763
1944
|
resumePausedMutations() {
|
|
@@ -1857,7 +2038,7 @@ var QueryClient = class {
|
|
|
1857
2038
|
}
|
|
1858
2039
|
};
|
|
1859
2040
|
|
|
1860
|
-
// ../../node_modules
|
|
2041
|
+
// ../../node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
1861
2042
|
var QueryObserver = class extends Subscribable {
|
|
1862
2043
|
constructor(client, options) {
|
|
1863
2044
|
super();
|
|
@@ -1928,7 +2109,7 @@ var QueryObserver = class extends Subscribable {
|
|
|
1928
2109
|
const prevOptions = this.options;
|
|
1929
2110
|
const prevQuery = this.#currentQuery;
|
|
1930
2111
|
this.options = this.#client.defaultQueryOptions(options);
|
|
1931
|
-
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof
|
|
2112
|
+
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean") {
|
|
1932
2113
|
throw new Error(
|
|
1933
2114
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
1934
2115
|
);
|
|
@@ -1952,11 +2133,11 @@ var QueryObserver = class extends Subscribable {
|
|
|
1952
2133
|
this.#executeFetch();
|
|
1953
2134
|
}
|
|
1954
2135
|
this.updateResult();
|
|
1955
|
-
if (mounted && (this.#currentQuery !== prevQuery ||
|
|
2136
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
|
|
1956
2137
|
this.#updateStaleTimeout();
|
|
1957
2138
|
}
|
|
1958
2139
|
const nextRefetchInterval = this.#computeRefetchInterval();
|
|
1959
|
-
if (mounted && (this.#currentQuery !== prevQuery ||
|
|
2140
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
|
|
1960
2141
|
this.#updateRefetchInterval(nextRefetchInterval);
|
|
1961
2142
|
}
|
|
1962
2143
|
}
|
|
@@ -1978,12 +2159,15 @@ var QueryObserver = class extends Subscribable {
|
|
|
1978
2159
|
get: (target, key) => {
|
|
1979
2160
|
this.trackProp(key);
|
|
1980
2161
|
onPropTracked?.(key);
|
|
1981
|
-
if (key === "promise"
|
|
1982
|
-
this
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
2162
|
+
if (key === "promise") {
|
|
2163
|
+
this.trackProp("data");
|
|
2164
|
+
if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
|
|
2165
|
+
this.#currentThenable.reject(
|
|
2166
|
+
new Error(
|
|
2167
|
+
"experimental_prefetchInRender feature flag is not enabled"
|
|
2168
|
+
)
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
1987
2171
|
}
|
|
1988
2172
|
return Reflect.get(target, key);
|
|
1989
2173
|
}
|
|
@@ -2031,12 +2215,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
2031
2215
|
this.options.staleTime,
|
|
2032
2216
|
this.#currentQuery
|
|
2033
2217
|
);
|
|
2034
|
-
if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
2218
|
+
if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
2035
2219
|
return;
|
|
2036
2220
|
}
|
|
2037
2221
|
const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
|
|
2038
2222
|
const timeout = time + 1;
|
|
2039
|
-
this.#staleTimeoutId = setTimeout(() => {
|
|
2223
|
+
this.#staleTimeoutId = timeoutManager.setTimeout(() => {
|
|
2040
2224
|
if (!this.#currentResult.isStale) {
|
|
2041
2225
|
this.updateResult();
|
|
2042
2226
|
}
|
|
@@ -2048,10 +2232,10 @@ var QueryObserver = class extends Subscribable {
|
|
|
2048
2232
|
#updateRefetchInterval(nextInterval) {
|
|
2049
2233
|
this.#clearRefetchInterval();
|
|
2050
2234
|
this.#currentRefetchInterval = nextInterval;
|
|
2051
|
-
if (isServer ||
|
|
2235
|
+
if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
2052
2236
|
return;
|
|
2053
2237
|
}
|
|
2054
|
-
this.#refetchIntervalId = setInterval(() => {
|
|
2238
|
+
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
2055
2239
|
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
2056
2240
|
this.#executeFetch();
|
|
2057
2241
|
}
|
|
@@ -2062,14 +2246,14 @@ var QueryObserver = class extends Subscribable {
|
|
|
2062
2246
|
this.#updateRefetchInterval(this.#computeRefetchInterval());
|
|
2063
2247
|
}
|
|
2064
2248
|
#clearStaleTimeout() {
|
|
2065
|
-
if (this.#staleTimeoutId) {
|
|
2066
|
-
clearTimeout(this.#staleTimeoutId);
|
|
2249
|
+
if (this.#staleTimeoutId !== void 0) {
|
|
2250
|
+
timeoutManager.clearTimeout(this.#staleTimeoutId);
|
|
2067
2251
|
this.#staleTimeoutId = void 0;
|
|
2068
2252
|
}
|
|
2069
2253
|
}
|
|
2070
2254
|
#clearRefetchInterval() {
|
|
2071
|
-
if (this.#refetchIntervalId) {
|
|
2072
|
-
clearInterval(this.#refetchIntervalId);
|
|
2255
|
+
if (this.#refetchIntervalId !== void 0) {
|
|
2256
|
+
timeoutManager.clearInterval(this.#refetchIntervalId);
|
|
2073
2257
|
this.#refetchIntervalId = void 0;
|
|
2074
2258
|
}
|
|
2075
2259
|
}
|
|
@@ -2164,7 +2348,7 @@ var QueryObserver = class extends Subscribable {
|
|
|
2164
2348
|
failureCount: newState.fetchFailureCount,
|
|
2165
2349
|
failureReason: newState.fetchFailureReason,
|
|
2166
2350
|
errorUpdateCount: newState.errorUpdateCount,
|
|
2167
|
-
isFetched:
|
|
2351
|
+
isFetched: query.isFetched(),
|
|
2168
2352
|
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
2169
2353
|
isFetching,
|
|
2170
2354
|
isRefetching: isFetching && !isPending,
|
|
@@ -2175,14 +2359,16 @@ var QueryObserver = class extends Subscribable {
|
|
|
2175
2359
|
isStale: isStale(query, options),
|
|
2176
2360
|
refetch: this.refetch,
|
|
2177
2361
|
promise: this.#currentThenable,
|
|
2178
|
-
isEnabled:
|
|
2362
|
+
isEnabled: resolveQueryBoolean(options.enabled, query) !== false
|
|
2179
2363
|
};
|
|
2180
2364
|
const nextResult = result;
|
|
2181
2365
|
if (this.options.experimental_prefetchInRender) {
|
|
2366
|
+
const hasResultData = nextResult.data !== void 0;
|
|
2367
|
+
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
2182
2368
|
const finalizeThenableIfPossible = (thenable) => {
|
|
2183
|
-
if (
|
|
2369
|
+
if (isErrorWithoutData) {
|
|
2184
2370
|
thenable.reject(nextResult.error);
|
|
2185
|
-
} else if (
|
|
2371
|
+
} else if (hasResultData) {
|
|
2186
2372
|
thenable.resolve(nextResult.data);
|
|
2187
2373
|
}
|
|
2188
2374
|
};
|
|
@@ -2198,12 +2384,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
2198
2384
|
}
|
|
2199
2385
|
break;
|
|
2200
2386
|
case "fulfilled":
|
|
2201
|
-
if (
|
|
2387
|
+
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
2202
2388
|
recreateThenable();
|
|
2203
2389
|
}
|
|
2204
2390
|
break;
|
|
2205
2391
|
case "rejected":
|
|
2206
|
-
if (
|
|
2392
|
+
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
2207
2393
|
recreateThenable();
|
|
2208
2394
|
}
|
|
2209
2395
|
break;
|
|
@@ -2280,23 +2466,23 @@ var QueryObserver = class extends Subscribable {
|
|
|
2280
2466
|
}
|
|
2281
2467
|
};
|
|
2282
2468
|
function shouldLoadOnMount(query, options) {
|
|
2283
|
-
return
|
|
2469
|
+
return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
|
|
2284
2470
|
}
|
|
2285
2471
|
function shouldFetchOnMount(query, options) {
|
|
2286
2472
|
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
2287
2473
|
}
|
|
2288
2474
|
function shouldFetchOn(query, options, field) {
|
|
2289
|
-
if (
|
|
2475
|
+
if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
2290
2476
|
const value = typeof field === "function" ? field(query) : field;
|
|
2291
2477
|
return value === "always" || value !== false && isStale(query, options);
|
|
2292
2478
|
}
|
|
2293
2479
|
return false;
|
|
2294
2480
|
}
|
|
2295
2481
|
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
2296
|
-
return (query !== prevQuery ||
|
|
2482
|
+
return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
2297
2483
|
}
|
|
2298
2484
|
function isStale(query, options) {
|
|
2299
|
-
return
|
|
2485
|
+
return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
2300
2486
|
}
|
|
2301
2487
|
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
2302
2488
|
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
@@ -2305,7 +2491,7 @@ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
|
2305
2491
|
return false;
|
|
2306
2492
|
}
|
|
2307
2493
|
|
|
2308
|
-
// ../../node_modules
|
|
2494
|
+
// ../../node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
2309
2495
|
import * as React from "react";
|
|
2310
2496
|
import { jsx } from "react/jsx-runtime";
|
|
2311
2497
|
var QueryClientContext = React.createContext(
|
|
@@ -2334,10 +2520,10 @@ var QueryClientProvider = ({
|
|
|
2334
2520
|
return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children });
|
|
2335
2521
|
};
|
|
2336
2522
|
|
|
2337
|
-
// ../../node_modules
|
|
2523
|
+
// ../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
2338
2524
|
import * as React5 from "react";
|
|
2339
2525
|
|
|
2340
|
-
// ../../node_modules
|
|
2526
|
+
// ../../node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
2341
2527
|
import * as React2 from "react";
|
|
2342
2528
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2343
2529
|
function createValue() {
|
|
@@ -2357,10 +2543,11 @@ function createValue() {
|
|
|
2357
2543
|
var QueryErrorResetBoundaryContext = React2.createContext(createValue());
|
|
2358
2544
|
var useQueryErrorResetBoundary = () => React2.useContext(QueryErrorResetBoundaryContext);
|
|
2359
2545
|
|
|
2360
|
-
// ../../node_modules
|
|
2546
|
+
// ../../node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
2361
2547
|
import * as React3 from "react";
|
|
2362
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
|
2363
|
-
|
|
2548
|
+
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
2549
|
+
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
2550
|
+
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
2364
2551
|
if (!errorResetBoundary.isReset()) {
|
|
2365
2552
|
options.retryOnMount = false;
|
|
2366
2553
|
}
|
|
@@ -2381,20 +2568,24 @@ var getHasError = ({
|
|
|
2381
2568
|
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
2382
2569
|
};
|
|
2383
2570
|
|
|
2384
|
-
// ../../node_modules
|
|
2571
|
+
// ../../node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
2385
2572
|
import * as React4 from "react";
|
|
2386
2573
|
var IsRestoringContext = React4.createContext(false);
|
|
2387
2574
|
var useIsRestoring = () => React4.useContext(IsRestoringContext);
|
|
2388
2575
|
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
2389
2576
|
|
|
2390
|
-
// ../../node_modules
|
|
2577
|
+
// ../../node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
2391
2578
|
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
2392
2579
|
if (defaultedOptions.suspense) {
|
|
2393
|
-
const
|
|
2580
|
+
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
2581
|
+
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
2394
2582
|
const originalStaleTime = defaultedOptions.staleTime;
|
|
2395
2583
|
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
2396
2584
|
if (typeof defaultedOptions.gcTime === "number") {
|
|
2397
|
-
defaultedOptions.gcTime = Math.max(
|
|
2585
|
+
defaultedOptions.gcTime = Math.max(
|
|
2586
|
+
defaultedOptions.gcTime,
|
|
2587
|
+
MIN_SUSPENSE_TIME_MS
|
|
2588
|
+
);
|
|
2398
2589
|
}
|
|
2399
2590
|
}
|
|
2400
2591
|
};
|
|
@@ -2404,7 +2595,7 @@ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observ
|
|
|
2404
2595
|
errorResetBoundary.clearReset();
|
|
2405
2596
|
});
|
|
2406
2597
|
|
|
2407
|
-
// ../../node_modules
|
|
2598
|
+
// ../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
2408
2599
|
function useBaseQuery(options, Observer, queryClient) {
|
|
2409
2600
|
if (process.env.NODE_ENV !== "production") {
|
|
2410
2601
|
if (typeof options !== "object" || Array.isArray(options)) {
|
|
@@ -2420,6 +2611,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2420
2611
|
client.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
2421
2612
|
defaultedOptions
|
|
2422
2613
|
);
|
|
2614
|
+
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
2423
2615
|
if (process.env.NODE_ENV !== "production") {
|
|
2424
2616
|
if (!defaultedOptions.queryFn) {
|
|
2425
2617
|
console.error(
|
|
@@ -2427,9 +2619,10 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2427
2619
|
);
|
|
2428
2620
|
}
|
|
2429
2621
|
}
|
|
2430
|
-
|
|
2622
|
+
const subscribed = options.subscribed !== false;
|
|
2623
|
+
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : subscribed ? "optimistic" : void 0;
|
|
2431
2624
|
ensureSuspenseTimers(defaultedOptions);
|
|
2432
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
|
2625
|
+
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
2433
2626
|
useClearResetErrorBoundary(errorResetBoundary);
|
|
2434
2627
|
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
2435
2628
|
const [observer] = React5.useState(
|
|
@@ -2439,7 +2632,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2439
2632
|
)
|
|
2440
2633
|
);
|
|
2441
2634
|
const result = observer.getOptimisticResult(defaultedOptions);
|
|
2442
|
-
const shouldSubscribe = !isRestoring &&
|
|
2635
|
+
const shouldSubscribe = !isRestoring && subscribed;
|
|
2443
2636
|
React5.useSyncExternalStore(
|
|
2444
2637
|
React5.useCallback(
|
|
2445
2638
|
(onStoreChange) => {
|
|
@@ -2462,7 +2655,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2462
2655
|
result,
|
|
2463
2656
|
errorResetBoundary,
|
|
2464
2657
|
throwOnError: defaultedOptions.throwOnError,
|
|
2465
|
-
query
|
|
2658
|
+
query,
|
|
2466
2659
|
suspense: defaultedOptions.suspense
|
|
2467
2660
|
})) {
|
|
2468
2661
|
throw result.error;
|
|
@@ -2472,13 +2665,13 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2472
2665
|
defaultedOptions,
|
|
2473
2666
|
result
|
|
2474
2667
|
);
|
|
2475
|
-
if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
|
|
2668
|
+
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
|
|
2476
2669
|
const promise = isNewCacheEntry ? (
|
|
2477
2670
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
2478
2671
|
fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
|
|
2479
2672
|
) : (
|
|
2480
2673
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
2481
|
-
|
|
2674
|
+
query?.promise
|
|
2482
2675
|
);
|
|
2483
2676
|
promise?.catch(noop).finally(() => {
|
|
2484
2677
|
observer.updateResult();
|
|
@@ -2487,7 +2680,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
2487
2680
|
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
2488
2681
|
}
|
|
2489
2682
|
|
|
2490
|
-
// ../../node_modules
|
|
2683
|
+
// ../../node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
2491
2684
|
function useQuery(options, queryClient) {
|
|
2492
2685
|
return useBaseQuery(options, QueryObserver, queryClient);
|
|
2493
2686
|
}
|