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
|
@@ -40,7 +40,7 @@ __export(hooks_exports, {
|
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(hooks_exports);
|
|
42
42
|
|
|
43
|
-
// ../../node_modules
|
|
43
|
+
// ../../node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
44
44
|
var Subscribable = class {
|
|
45
45
|
constructor() {
|
|
46
46
|
this.listeners = /* @__PURE__ */ new Set();
|
|
@@ -63,7 +63,134 @@ var Subscribable = class {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
// ../../node_modules
|
|
66
|
+
// ../../node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
67
|
+
var FocusManager = class extends Subscribable {
|
|
68
|
+
#focused;
|
|
69
|
+
#cleanup;
|
|
70
|
+
#setup;
|
|
71
|
+
constructor() {
|
|
72
|
+
super();
|
|
73
|
+
this.#setup = (onFocus) => {
|
|
74
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
75
|
+
const listener = () => onFocus();
|
|
76
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
77
|
+
return () => {
|
|
78
|
+
window.removeEventListener("visibilitychange", listener);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
onSubscribe() {
|
|
85
|
+
if (!this.#cleanup) {
|
|
86
|
+
this.setEventListener(this.#setup);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
onUnsubscribe() {
|
|
90
|
+
if (!this.hasListeners()) {
|
|
91
|
+
this.#cleanup?.();
|
|
92
|
+
this.#cleanup = void 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
setEventListener(setup) {
|
|
96
|
+
this.#setup = setup;
|
|
97
|
+
this.#cleanup?.();
|
|
98
|
+
this.#cleanup = setup((focused) => {
|
|
99
|
+
if (typeof focused === "boolean") {
|
|
100
|
+
this.setFocused(focused);
|
|
101
|
+
} else {
|
|
102
|
+
this.onFocus();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
setFocused(focused) {
|
|
107
|
+
const changed = this.#focused !== focused;
|
|
108
|
+
if (changed) {
|
|
109
|
+
this.#focused = focused;
|
|
110
|
+
this.onFocus();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
onFocus() {
|
|
114
|
+
const isFocused = this.isFocused();
|
|
115
|
+
this.listeners.forEach((listener) => {
|
|
116
|
+
listener(isFocused);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
isFocused() {
|
|
120
|
+
if (typeof this.#focused === "boolean") {
|
|
121
|
+
return this.#focused;
|
|
122
|
+
}
|
|
123
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var focusManager = new FocusManager();
|
|
127
|
+
|
|
128
|
+
// ../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
129
|
+
var defaultTimeoutProvider = {
|
|
130
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
131
|
+
// global setTimeout etc.
|
|
132
|
+
//
|
|
133
|
+
// BAD: `setTimeout: setTimeout`
|
|
134
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
135
|
+
//
|
|
136
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
137
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
138
|
+
// have a hard reference to the original implementation at the time when this
|
|
139
|
+
// file was imported.
|
|
140
|
+
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
141
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
142
|
+
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
143
|
+
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
144
|
+
};
|
|
145
|
+
var TimeoutManager = class {
|
|
146
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
147
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
148
|
+
// would need to support the default provider's concrete timer ID, which is
|
|
149
|
+
// infeasible across environments.
|
|
150
|
+
//
|
|
151
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
152
|
+
// this class is unsafe internally to allow for extension.
|
|
153
|
+
#provider = defaultTimeoutProvider;
|
|
154
|
+
#providerCalled = false;
|
|
155
|
+
setTimeoutProvider(provider) {
|
|
156
|
+
if (process.env.NODE_ENV !== "production") {
|
|
157
|
+
if (this.#providerCalled && provider !== this.#provider) {
|
|
158
|
+
console.error(
|
|
159
|
+
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
160
|
+
{ previous: this.#provider, provider }
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
this.#provider = provider;
|
|
165
|
+
if (process.env.NODE_ENV !== "production") {
|
|
166
|
+
this.#providerCalled = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
setTimeout(callback, delay) {
|
|
170
|
+
if (process.env.NODE_ENV !== "production") {
|
|
171
|
+
this.#providerCalled = true;
|
|
172
|
+
}
|
|
173
|
+
return this.#provider.setTimeout(callback, delay);
|
|
174
|
+
}
|
|
175
|
+
clearTimeout(timeoutId) {
|
|
176
|
+
this.#provider.clearTimeout(timeoutId);
|
|
177
|
+
}
|
|
178
|
+
setInterval(callback, delay) {
|
|
179
|
+
if (process.env.NODE_ENV !== "production") {
|
|
180
|
+
this.#providerCalled = true;
|
|
181
|
+
}
|
|
182
|
+
return this.#provider.setInterval(callback, delay);
|
|
183
|
+
}
|
|
184
|
+
clearInterval(intervalId) {
|
|
185
|
+
this.#provider.clearInterval(intervalId);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
var timeoutManager = new TimeoutManager();
|
|
189
|
+
function systemSetTimeoutZero(callback) {
|
|
190
|
+
setTimeout(callback, 0);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ../../node_modules/@tanstack/query-core/build/modern/utils.js
|
|
67
194
|
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
68
195
|
function noop() {
|
|
69
196
|
}
|
|
@@ -76,37 +203,41 @@ function timeUntilStale(updatedAt, staleTime) {
|
|
|
76
203
|
function resolveStaleTime(staleTime, query) {
|
|
77
204
|
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
78
205
|
}
|
|
79
|
-
function
|
|
80
|
-
return typeof
|
|
206
|
+
function resolveQueryBoolean(option, query) {
|
|
207
|
+
return typeof option === "function" ? option(query) : option;
|
|
81
208
|
}
|
|
82
|
-
|
|
209
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
210
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
83
211
|
if (a === b) {
|
|
84
212
|
return a;
|
|
85
213
|
}
|
|
214
|
+
if (depth > 500) return b;
|
|
86
215
|
const array = isPlainArray(a) && isPlainArray(b);
|
|
87
|
-
if (array
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
216
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
217
|
+
const aItems = array ? a : Object.keys(a);
|
|
218
|
+
const aSize = aItems.length;
|
|
219
|
+
const bItems = array ? b : Object.keys(b);
|
|
220
|
+
const bSize = bItems.length;
|
|
221
|
+
const copy = array ? new Array(bSize) : {};
|
|
222
|
+
let equalItems = 0;
|
|
223
|
+
for (let i = 0; i < bSize; i++) {
|
|
224
|
+
const key = array ? i : bItems[i];
|
|
225
|
+
const aItem = a[key];
|
|
226
|
+
const bItem = b[key];
|
|
227
|
+
if (aItem === bItem) {
|
|
228
|
+
copy[key] = aItem;
|
|
229
|
+
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
233
|
+
copy[key] = bItem;
|
|
234
|
+
continue;
|
|
106
235
|
}
|
|
107
|
-
|
|
236
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
237
|
+
copy[key] = v;
|
|
238
|
+
if (v === aItem) equalItems++;
|
|
108
239
|
}
|
|
109
|
-
return
|
|
240
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
110
241
|
}
|
|
111
242
|
function shallowEqualObjects(a, b) {
|
|
112
243
|
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
@@ -163,7 +294,6 @@ function replaceData(prevData, data, options) {
|
|
|
163
294
|
}
|
|
164
295
|
return data;
|
|
165
296
|
}
|
|
166
|
-
var skipToken = Symbol();
|
|
167
297
|
function shouldThrowError(throwOnError, params) {
|
|
168
298
|
if (typeof throwOnError === "function") {
|
|
169
299
|
return throwOnError(...params);
|
|
@@ -171,121 +301,26 @@ function shouldThrowError(throwOnError, params) {
|
|
|
171
301
|
return !!throwOnError;
|
|
172
302
|
}
|
|
173
303
|
|
|
174
|
-
// ../../node_modules
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
onSubscribe() {
|
|
193
|
-
if (!this.#cleanup) {
|
|
194
|
-
this.setEventListener(this.#setup);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
onUnsubscribe() {
|
|
198
|
-
if (!this.hasListeners()) {
|
|
199
|
-
this.#cleanup?.();
|
|
200
|
-
this.#cleanup = void 0;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
setEventListener(setup) {
|
|
204
|
-
this.#setup = setup;
|
|
205
|
-
this.#cleanup?.();
|
|
206
|
-
this.#cleanup = setup((focused) => {
|
|
207
|
-
if (typeof focused === "boolean") {
|
|
208
|
-
this.setFocused(focused);
|
|
209
|
-
} else {
|
|
210
|
-
this.onFocus();
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
setFocused(focused) {
|
|
215
|
-
const changed = this.#focused !== focused;
|
|
216
|
-
if (changed) {
|
|
217
|
-
this.#focused = focused;
|
|
218
|
-
this.onFocus();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
onFocus() {
|
|
222
|
-
const isFocused = this.isFocused();
|
|
223
|
-
this.listeners.forEach((listener) => {
|
|
224
|
-
listener(isFocused);
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
isFocused() {
|
|
228
|
-
if (typeof this.#focused === "boolean") {
|
|
229
|
-
return this.#focused;
|
|
230
|
-
}
|
|
231
|
-
return globalThis.document?.visibilityState !== "hidden";
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
var focusManager = new FocusManager();
|
|
235
|
-
|
|
236
|
-
// ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
237
|
-
var OnlineManager = class extends Subscribable {
|
|
238
|
-
#online = true;
|
|
239
|
-
#cleanup;
|
|
240
|
-
#setup;
|
|
241
|
-
constructor() {
|
|
242
|
-
super();
|
|
243
|
-
this.#setup = (onOnline) => {
|
|
244
|
-
if (!isServer && window.addEventListener) {
|
|
245
|
-
const onlineListener = () => onOnline(true);
|
|
246
|
-
const offlineListener = () => onOnline(false);
|
|
247
|
-
window.addEventListener("online", onlineListener, false);
|
|
248
|
-
window.addEventListener("offline", offlineListener, false);
|
|
249
|
-
return () => {
|
|
250
|
-
window.removeEventListener("online", onlineListener);
|
|
251
|
-
window.removeEventListener("offline", offlineListener);
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
onSubscribe() {
|
|
258
|
-
if (!this.#cleanup) {
|
|
259
|
-
this.setEventListener(this.#setup);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
onUnsubscribe() {
|
|
263
|
-
if (!this.hasListeners()) {
|
|
264
|
-
this.#cleanup?.();
|
|
265
|
-
this.#cleanup = void 0;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
setEventListener(setup) {
|
|
269
|
-
this.#setup = setup;
|
|
270
|
-
this.#cleanup?.();
|
|
271
|
-
this.#cleanup = setup(this.setOnline.bind(this));
|
|
272
|
-
}
|
|
273
|
-
setOnline(online) {
|
|
274
|
-
const changed = this.#online !== online;
|
|
275
|
-
if (changed) {
|
|
276
|
-
this.#online = online;
|
|
277
|
-
this.listeners.forEach((listener) => {
|
|
278
|
-
listener(online);
|
|
279
|
-
});
|
|
304
|
+
// ../../node_modules/@tanstack/query-core/build/modern/environmentManager.js
|
|
305
|
+
var environmentManager = /* @__PURE__ */ (() => {
|
|
306
|
+
let isServerFn = () => isServer;
|
|
307
|
+
return {
|
|
308
|
+
/**
|
|
309
|
+
* Returns whether the current runtime should be treated as a server environment.
|
|
310
|
+
*/
|
|
311
|
+
isServer() {
|
|
312
|
+
return isServerFn();
|
|
313
|
+
},
|
|
314
|
+
/**
|
|
315
|
+
* Overrides the server check globally.
|
|
316
|
+
*/
|
|
317
|
+
setIsServer(isServerValue) {
|
|
318
|
+
isServerFn = isServerValue;
|
|
280
319
|
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return this.#online;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
var onlineManager = new OnlineManager();
|
|
320
|
+
};
|
|
321
|
+
})();
|
|
287
322
|
|
|
288
|
-
// ../../node_modules
|
|
323
|
+
// ../../node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
289
324
|
function pendingThenable() {
|
|
290
325
|
let resolve;
|
|
291
326
|
let reject;
|
|
@@ -318,13 +353,8 @@ function pendingThenable() {
|
|
|
318
353
|
return thenable;
|
|
319
354
|
}
|
|
320
355
|
|
|
321
|
-
// ../../node_modules
|
|
322
|
-
|
|
323
|
-
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
327
|
-
var defaultScheduler = (cb) => setTimeout(cb, 0);
|
|
356
|
+
// ../../node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
357
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
328
358
|
function createNotifyManager() {
|
|
329
359
|
let queue = [];
|
|
330
360
|
let transactions = 0;
|
|
@@ -403,7 +433,64 @@ function createNotifyManager() {
|
|
|
403
433
|
}
|
|
404
434
|
var notifyManager = createNotifyManager();
|
|
405
435
|
|
|
406
|
-
// ../../node_modules
|
|
436
|
+
// ../../node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
437
|
+
var OnlineManager = class extends Subscribable {
|
|
438
|
+
#online = true;
|
|
439
|
+
#cleanup;
|
|
440
|
+
#setup;
|
|
441
|
+
constructor() {
|
|
442
|
+
super();
|
|
443
|
+
this.#setup = (onOnline) => {
|
|
444
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
445
|
+
const onlineListener = () => onOnline(true);
|
|
446
|
+
const offlineListener = () => onOnline(false);
|
|
447
|
+
window.addEventListener("online", onlineListener, false);
|
|
448
|
+
window.addEventListener("offline", offlineListener, false);
|
|
449
|
+
return () => {
|
|
450
|
+
window.removeEventListener("online", onlineListener);
|
|
451
|
+
window.removeEventListener("offline", offlineListener);
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
return;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
onSubscribe() {
|
|
458
|
+
if (!this.#cleanup) {
|
|
459
|
+
this.setEventListener(this.#setup);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
onUnsubscribe() {
|
|
463
|
+
if (!this.hasListeners()) {
|
|
464
|
+
this.#cleanup?.();
|
|
465
|
+
this.#cleanup = void 0;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
setEventListener(setup) {
|
|
469
|
+
this.#setup = setup;
|
|
470
|
+
this.#cleanup?.();
|
|
471
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
472
|
+
}
|
|
473
|
+
setOnline(online) {
|
|
474
|
+
const changed = this.#online !== online;
|
|
475
|
+
if (changed) {
|
|
476
|
+
this.#online = online;
|
|
477
|
+
this.listeners.forEach((listener) => {
|
|
478
|
+
listener(online);
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
isOnline() {
|
|
483
|
+
return this.#online;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
var onlineManager = new OnlineManager();
|
|
487
|
+
|
|
488
|
+
// ../../node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
489
|
+
function canFetch(networkMode) {
|
|
490
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// ../../node_modules/@tanstack/query-core/build/modern/query.js
|
|
407
494
|
function fetchState(data, options) {
|
|
408
495
|
return {
|
|
409
496
|
fetchFailureCount: 0,
|
|
@@ -416,7 +503,7 @@ function fetchState(data, options) {
|
|
|
416
503
|
};
|
|
417
504
|
}
|
|
418
505
|
|
|
419
|
-
// ../../node_modules
|
|
506
|
+
// ../../node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
420
507
|
var QueryObserver = class extends Subscribable {
|
|
421
508
|
constructor(client, options) {
|
|
422
509
|
super();
|
|
@@ -487,7 +574,7 @@ var QueryObserver = class extends Subscribable {
|
|
|
487
574
|
const prevOptions = this.options;
|
|
488
575
|
const prevQuery = this.#currentQuery;
|
|
489
576
|
this.options = this.#client.defaultQueryOptions(options);
|
|
490
|
-
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof
|
|
577
|
+
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean") {
|
|
491
578
|
throw new Error(
|
|
492
579
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
493
580
|
);
|
|
@@ -511,11 +598,11 @@ var QueryObserver = class extends Subscribable {
|
|
|
511
598
|
this.#executeFetch();
|
|
512
599
|
}
|
|
513
600
|
this.updateResult();
|
|
514
|
-
if (mounted && (this.#currentQuery !== prevQuery ||
|
|
601
|
+
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))) {
|
|
515
602
|
this.#updateStaleTimeout();
|
|
516
603
|
}
|
|
517
604
|
const nextRefetchInterval = this.#computeRefetchInterval();
|
|
518
|
-
if (mounted && (this.#currentQuery !== prevQuery ||
|
|
605
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
|
|
519
606
|
this.#updateRefetchInterval(nextRefetchInterval);
|
|
520
607
|
}
|
|
521
608
|
}
|
|
@@ -537,12 +624,15 @@ var QueryObserver = class extends Subscribable {
|
|
|
537
624
|
get: (target, key) => {
|
|
538
625
|
this.trackProp(key);
|
|
539
626
|
onPropTracked?.(key);
|
|
540
|
-
if (key === "promise"
|
|
541
|
-
this
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
627
|
+
if (key === "promise") {
|
|
628
|
+
this.trackProp("data");
|
|
629
|
+
if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
|
|
630
|
+
this.#currentThenable.reject(
|
|
631
|
+
new Error(
|
|
632
|
+
"experimental_prefetchInRender feature flag is not enabled"
|
|
633
|
+
)
|
|
634
|
+
);
|
|
635
|
+
}
|
|
546
636
|
}
|
|
547
637
|
return Reflect.get(target, key);
|
|
548
638
|
}
|
|
@@ -590,12 +680,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
590
680
|
this.options.staleTime,
|
|
591
681
|
this.#currentQuery
|
|
592
682
|
);
|
|
593
|
-
if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
683
|
+
if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
594
684
|
return;
|
|
595
685
|
}
|
|
596
686
|
const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
|
|
597
687
|
const timeout = time + 1;
|
|
598
|
-
this.#staleTimeoutId = setTimeout(() => {
|
|
688
|
+
this.#staleTimeoutId = timeoutManager.setTimeout(() => {
|
|
599
689
|
if (!this.#currentResult.isStale) {
|
|
600
690
|
this.updateResult();
|
|
601
691
|
}
|
|
@@ -607,10 +697,10 @@ var QueryObserver = class extends Subscribable {
|
|
|
607
697
|
#updateRefetchInterval(nextInterval) {
|
|
608
698
|
this.#clearRefetchInterval();
|
|
609
699
|
this.#currentRefetchInterval = nextInterval;
|
|
610
|
-
if (isServer ||
|
|
700
|
+
if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
611
701
|
return;
|
|
612
702
|
}
|
|
613
|
-
this.#refetchIntervalId = setInterval(() => {
|
|
703
|
+
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
614
704
|
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
615
705
|
this.#executeFetch();
|
|
616
706
|
}
|
|
@@ -621,14 +711,14 @@ var QueryObserver = class extends Subscribable {
|
|
|
621
711
|
this.#updateRefetchInterval(this.#computeRefetchInterval());
|
|
622
712
|
}
|
|
623
713
|
#clearStaleTimeout() {
|
|
624
|
-
if (this.#staleTimeoutId) {
|
|
625
|
-
clearTimeout(this.#staleTimeoutId);
|
|
714
|
+
if (this.#staleTimeoutId !== void 0) {
|
|
715
|
+
timeoutManager.clearTimeout(this.#staleTimeoutId);
|
|
626
716
|
this.#staleTimeoutId = void 0;
|
|
627
717
|
}
|
|
628
718
|
}
|
|
629
719
|
#clearRefetchInterval() {
|
|
630
|
-
if (this.#refetchIntervalId) {
|
|
631
|
-
clearInterval(this.#refetchIntervalId);
|
|
720
|
+
if (this.#refetchIntervalId !== void 0) {
|
|
721
|
+
timeoutManager.clearInterval(this.#refetchIntervalId);
|
|
632
722
|
this.#refetchIntervalId = void 0;
|
|
633
723
|
}
|
|
634
724
|
}
|
|
@@ -723,7 +813,7 @@ var QueryObserver = class extends Subscribable {
|
|
|
723
813
|
failureCount: newState.fetchFailureCount,
|
|
724
814
|
failureReason: newState.fetchFailureReason,
|
|
725
815
|
errorUpdateCount: newState.errorUpdateCount,
|
|
726
|
-
isFetched:
|
|
816
|
+
isFetched: query.isFetched(),
|
|
727
817
|
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
728
818
|
isFetching,
|
|
729
819
|
isRefetching: isFetching && !isPending,
|
|
@@ -734,14 +824,16 @@ var QueryObserver = class extends Subscribable {
|
|
|
734
824
|
isStale: isStale(query, options),
|
|
735
825
|
refetch: this.refetch,
|
|
736
826
|
promise: this.#currentThenable,
|
|
737
|
-
isEnabled:
|
|
827
|
+
isEnabled: resolveQueryBoolean(options.enabled, query) !== false
|
|
738
828
|
};
|
|
739
829
|
const nextResult = result;
|
|
740
830
|
if (this.options.experimental_prefetchInRender) {
|
|
831
|
+
const hasResultData = nextResult.data !== void 0;
|
|
832
|
+
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
741
833
|
const finalizeThenableIfPossible = (thenable) => {
|
|
742
|
-
if (
|
|
834
|
+
if (isErrorWithoutData) {
|
|
743
835
|
thenable.reject(nextResult.error);
|
|
744
|
-
} else if (
|
|
836
|
+
} else if (hasResultData) {
|
|
745
837
|
thenable.resolve(nextResult.data);
|
|
746
838
|
}
|
|
747
839
|
};
|
|
@@ -757,12 +849,12 @@ var QueryObserver = class extends Subscribable {
|
|
|
757
849
|
}
|
|
758
850
|
break;
|
|
759
851
|
case "fulfilled":
|
|
760
|
-
if (
|
|
852
|
+
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
761
853
|
recreateThenable();
|
|
762
854
|
}
|
|
763
855
|
break;
|
|
764
856
|
case "rejected":
|
|
765
|
-
if (
|
|
857
|
+
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
766
858
|
recreateThenable();
|
|
767
859
|
}
|
|
768
860
|
break;
|
|
@@ -839,23 +931,23 @@ var QueryObserver = class extends Subscribable {
|
|
|
839
931
|
}
|
|
840
932
|
};
|
|
841
933
|
function shouldLoadOnMount(query, options) {
|
|
842
|
-
return
|
|
934
|
+
return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
|
|
843
935
|
}
|
|
844
936
|
function shouldFetchOnMount(query, options) {
|
|
845
937
|
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
846
938
|
}
|
|
847
939
|
function shouldFetchOn(query, options, field) {
|
|
848
|
-
if (
|
|
940
|
+
if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
849
941
|
const value = typeof field === "function" ? field(query) : field;
|
|
850
942
|
return value === "always" || value !== false && isStale(query, options);
|
|
851
943
|
}
|
|
852
944
|
return false;
|
|
853
945
|
}
|
|
854
946
|
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
855
|
-
return (query !== prevQuery ||
|
|
947
|
+
return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
856
948
|
}
|
|
857
949
|
function isStale(query, options) {
|
|
858
|
-
return
|
|
950
|
+
return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
859
951
|
}
|
|
860
952
|
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
861
953
|
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
@@ -864,7 +956,7 @@ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
|
864
956
|
return false;
|
|
865
957
|
}
|
|
866
958
|
|
|
867
|
-
// ../../node_modules
|
|
959
|
+
// ../../node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
868
960
|
var React = __toESM(require("react"), 1);
|
|
869
961
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
870
962
|
var QueryClientContext = React.createContext(
|
|
@@ -881,13 +973,13 @@ var useQueryClient = (queryClient) => {
|
|
|
881
973
|
return client;
|
|
882
974
|
};
|
|
883
975
|
|
|
884
|
-
// ../../node_modules
|
|
976
|
+
// ../../node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
885
977
|
var React2 = __toESM(require("react"), 1);
|
|
886
978
|
var IsRestoringContext = React2.createContext(false);
|
|
887
979
|
var useIsRestoring = () => React2.useContext(IsRestoringContext);
|
|
888
980
|
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
889
981
|
|
|
890
|
-
// ../../node_modules
|
|
982
|
+
// ../../node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
891
983
|
var React3 = __toESM(require("react"), 1);
|
|
892
984
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
893
985
|
function createValue() {
|
|
@@ -907,10 +999,11 @@ function createValue() {
|
|
|
907
999
|
var QueryErrorResetBoundaryContext = React3.createContext(createValue());
|
|
908
1000
|
var useQueryErrorResetBoundary = () => React3.useContext(QueryErrorResetBoundaryContext);
|
|
909
1001
|
|
|
910
|
-
// ../../node_modules
|
|
1002
|
+
// ../../node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
911
1003
|
var React4 = __toESM(require("react"), 1);
|
|
912
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
|
913
|
-
|
|
1004
|
+
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
1005
|
+
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
1006
|
+
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
914
1007
|
if (!errorResetBoundary.isReset()) {
|
|
915
1008
|
options.retryOnMount = false;
|
|
916
1009
|
}
|
|
@@ -931,14 +1024,18 @@ var getHasError = ({
|
|
|
931
1024
|
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
932
1025
|
};
|
|
933
1026
|
|
|
934
|
-
// ../../node_modules
|
|
1027
|
+
// ../../node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
935
1028
|
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
936
1029
|
if (defaultedOptions.suspense) {
|
|
937
|
-
const
|
|
1030
|
+
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
1031
|
+
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
938
1032
|
const originalStaleTime = defaultedOptions.staleTime;
|
|
939
1033
|
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
940
1034
|
if (typeof defaultedOptions.gcTime === "number") {
|
|
941
|
-
defaultedOptions.gcTime = Math.max(
|
|
1035
|
+
defaultedOptions.gcTime = Math.max(
|
|
1036
|
+
defaultedOptions.gcTime,
|
|
1037
|
+
MIN_SUSPENSE_TIME_MS
|
|
1038
|
+
);
|
|
942
1039
|
}
|
|
943
1040
|
}
|
|
944
1041
|
};
|
|
@@ -948,7 +1045,7 @@ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observ
|
|
|
948
1045
|
errorResetBoundary.clearReset();
|
|
949
1046
|
});
|
|
950
1047
|
|
|
951
|
-
// ../../node_modules
|
|
1048
|
+
// ../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
952
1049
|
var React5 = __toESM(require("react"), 1);
|
|
953
1050
|
function useBaseQuery(options, Observer, queryClient) {
|
|
954
1051
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -965,6 +1062,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
965
1062
|
client.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
966
1063
|
defaultedOptions
|
|
967
1064
|
);
|
|
1065
|
+
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
968
1066
|
if (process.env.NODE_ENV !== "production") {
|
|
969
1067
|
if (!defaultedOptions.queryFn) {
|
|
970
1068
|
console.error(
|
|
@@ -972,9 +1070,10 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
972
1070
|
);
|
|
973
1071
|
}
|
|
974
1072
|
}
|
|
975
|
-
|
|
1073
|
+
const subscribed = options.subscribed !== false;
|
|
1074
|
+
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : subscribed ? "optimistic" : void 0;
|
|
976
1075
|
ensureSuspenseTimers(defaultedOptions);
|
|
977
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
|
1076
|
+
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
978
1077
|
useClearResetErrorBoundary(errorResetBoundary);
|
|
979
1078
|
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
980
1079
|
const [observer] = React5.useState(
|
|
@@ -984,7 +1083,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
984
1083
|
)
|
|
985
1084
|
);
|
|
986
1085
|
const result = observer.getOptimisticResult(defaultedOptions);
|
|
987
|
-
const shouldSubscribe = !isRestoring &&
|
|
1086
|
+
const shouldSubscribe = !isRestoring && subscribed;
|
|
988
1087
|
React5.useSyncExternalStore(
|
|
989
1088
|
React5.useCallback(
|
|
990
1089
|
(onStoreChange) => {
|
|
@@ -1007,7 +1106,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
1007
1106
|
result,
|
|
1008
1107
|
errorResetBoundary,
|
|
1009
1108
|
throwOnError: defaultedOptions.throwOnError,
|
|
1010
|
-
query
|
|
1109
|
+
query,
|
|
1011
1110
|
suspense: defaultedOptions.suspense
|
|
1012
1111
|
})) {
|
|
1013
1112
|
throw result.error;
|
|
@@ -1017,13 +1116,13 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
1017
1116
|
defaultedOptions,
|
|
1018
1117
|
result
|
|
1019
1118
|
);
|
|
1020
|
-
if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
|
|
1119
|
+
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
|
|
1021
1120
|
const promise = isNewCacheEntry ? (
|
|
1022
1121
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1023
1122
|
fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
|
|
1024
1123
|
) : (
|
|
1025
1124
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
1026
|
-
|
|
1125
|
+
query?.promise
|
|
1027
1126
|
);
|
|
1028
1127
|
promise?.catch(noop).finally(() => {
|
|
1029
1128
|
observer.updateResult();
|
|
@@ -1032,7 +1131,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
1032
1131
|
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
1033
1132
|
}
|
|
1034
1133
|
|
|
1035
|
-
// ../../node_modules
|
|
1134
|
+
// ../../node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
1036
1135
|
function useQuery(options, queryClient) {
|
|
1037
1136
|
return useBaseQuery(options, QueryObserver, queryClient);
|
|
1038
1137
|
}
|