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.
Files changed (167) hide show
  1. package/dist/backend/adapters/express.d.mts +1 -1
  2. package/dist/backend/adapters/express.d.ts +1 -1
  3. package/dist/backend/adapters/express.js +13482 -7722
  4. package/dist/backend/adapters/express.mjs +5 -5
  5. package/dist/backend/adapters/fetch.d.mts +1 -1
  6. package/dist/backend/adapters/fetch.d.ts +1 -1
  7. package/dist/backend/adapters/fetch.js +13482 -7722
  8. package/dist/backend/adapters/fetch.mjs +5 -5
  9. package/dist/backend/adapters/hono.d.mts +1 -1
  10. package/dist/backend/adapters/hono.d.ts +1 -1
  11. package/dist/backend/adapters/hono.js +13482 -7722
  12. package/dist/backend/adapters/hono.mjs +5 -5
  13. package/dist/backend/adapters/index.d.mts +1 -1
  14. package/dist/backend/adapters/index.d.ts +1 -1
  15. package/dist/backend/adapters/index.js +13482 -7722
  16. package/dist/backend/adapters/index.mjs +8 -8
  17. package/dist/backend/adapters/next.d.mts +1 -1
  18. package/dist/backend/adapters/next.d.ts +1 -1
  19. package/dist/backend/adapters/next.js +13482 -7722
  20. package/dist/backend/adapters/next.mjs +5 -5
  21. package/dist/backend/{authTypes-Bx2brfr_.d.mts → authTypes-DEBvnrRj.d.mts} +20 -1
  22. package/dist/backend/{authTypes-Bx2brfr_.d.ts → authTypes-DEBvnrRj.d.ts} +20 -1
  23. package/dist/backend/{chunk-UYURZ75E.mjs → chunk-4LKEHLXR.mjs} +704 -41
  24. package/dist/backend/{chunk-W7MG3LB3.mjs → chunk-7MRAUIPE.mjs} +1 -1
  25. package/dist/backend/{chunk-7MPQ5TCH.mjs → chunk-DDRD5BKK.mjs} +2 -2
  26. package/dist/backend/{chunk-Z7WSDAEZ.mjs → chunk-EQJ5B7OA.mjs} +13165 -8068
  27. package/dist/backend/{chunk-AYS6GLVO.mjs → chunk-HMGGMVFC.mjs} +1 -1
  28. package/dist/backend/{chunk-5QIIBIZY.mjs → chunk-KXRDZE5L.mjs} +2 -2
  29. package/dist/backend/{chunk-MXD3NPQK.mjs → chunk-SA6MCT5X.mjs} +1 -1
  30. package/dist/backend/{chunk-NSAJNDTG.mjs → chunk-WCZLA72P.mjs} +1 -1
  31. package/dist/backend/core/handlers/coreHandler.d.mts +2 -2
  32. package/dist/backend/core/handlers/coreHandler.d.ts +2 -2
  33. package/dist/backend/core/handlers/coreHandler.js +13482 -7722
  34. package/dist/backend/core/handlers/coreHandler.mjs +3 -3
  35. package/dist/backend/core/handlers/executeRoute.d.mts +2 -2
  36. package/dist/backend/core/handlers/executeRoute.d.ts +2 -2
  37. package/dist/backend/core/handlers/handleRouteByName.d.mts +1 -1
  38. package/dist/backend/core/handlers/handleRouteByName.d.ts +1 -1
  39. package/dist/backend/core/handlers/handleRouteByName.js +13482 -7722
  40. package/dist/backend/core/handlers/handleRouteByName.mjs +3 -3
  41. package/dist/backend/core/handlers/index.d.mts +2 -2
  42. package/dist/backend/core/handlers/index.d.ts +2 -2
  43. package/dist/backend/core/handlers/index.js +13482 -7722
  44. package/dist/backend/core/handlers/index.mjs +4 -4
  45. package/dist/backend/core/handlers/resolveIdentity.d.mts +1 -1
  46. package/dist/backend/core/handlers/resolveIdentity.d.ts +1 -1
  47. package/dist/backend/core/index.d.mts +2 -2
  48. package/dist/backend/core/index.d.ts +2 -2
  49. package/dist/backend/core/index.js +13482 -7722
  50. package/dist/backend/core/index.mjs +4 -4
  51. package/dist/backend/core/routes/index.d.mts +2 -2
  52. package/dist/backend/core/routes/index.d.ts +2 -2
  53. package/dist/backend/core/routes/index.js +704 -41
  54. package/dist/backend/core/routes/index.mjs +1 -1
  55. package/dist/backend/core/routes/routeBuilder.d.mts +2 -2
  56. package/dist/backend/core/routes/routeBuilder.d.ts +2 -2
  57. package/dist/backend/core/routes/routeConfigs.d.mts +2 -2
  58. package/dist/backend/core/routes/routeConfigs.d.ts +2 -2
  59. package/dist/backend/core/routes/routeConfigs.js +704 -41
  60. package/dist/backend/core/routes/routeConfigs.mjs +1 -1
  61. package/dist/backend/core/types/authTypes.d.mts +1 -1
  62. package/dist/backend/core/types/authTypes.d.ts +1 -1
  63. package/dist/backend/core/types/handlerTypes.d.mts +2 -2
  64. package/dist/backend/core/types/handlerTypes.d.ts +2 -2
  65. package/dist/backend/core/types/index.d.mts +2 -2
  66. package/dist/backend/core/types/index.d.ts +2 -2
  67. package/dist/backend/core/types/routeTypes.d.mts +2 -2
  68. package/dist/backend/core/types/routeTypes.d.ts +2 -2
  69. package/dist/backend/index.d.mts +4 -4
  70. package/dist/backend/index.d.ts +4 -4
  71. package/dist/backend/index.js +13482 -7722
  72. package/dist/backend/index.mjs +4 -4
  73. package/dist/backend/{routeTypes-DmFnGvb2.d.mts → routeTypes-Bb3L3YJy.d.mts} +14646 -7926
  74. package/dist/backend/{routeTypes-ChCnBnee.d.ts → routeTypes-BhZ9UovL.d.ts} +14646 -7926
  75. package/dist/better-auth/{chunk-JBU3OM2O.mjs → chunk-4VW7A2HS.mjs} +13166 -8069
  76. package/dist/better-auth/{chunk-ZQA6B5RX.mjs → chunk-B2PHHBLY.mjs} +704 -41
  77. package/dist/better-auth/{chunk-56VTK4JS.mjs → chunk-D3DYQ36C.mjs} +1 -1
  78. package/dist/better-auth/index.js +13888 -8128
  79. package/dist/better-auth/index.mjs +3 -3
  80. package/dist/better-auth/types.d.mts +20 -1
  81. package/dist/better-auth/types.d.ts +20 -1
  82. package/dist/better-auth/utils/createAutumnEndpoint.js +704 -41
  83. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  84. package/dist/better-auth/utils/handleBetterAuthRoute.js +13482 -7722
  85. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  86. package/dist/better-auth/utils/index.js +13888 -8128
  87. package/dist/better-auth/utils/index.mjs +3 -3
  88. package/dist/react/AutumnContext.d.mts +4 -3
  89. package/dist/react/AutumnContext.d.ts +4 -3
  90. package/dist/react/AutumnProvider.js +678 -497
  91. package/dist/react/AutumnProvider.mjs +2 -2
  92. package/dist/react/{chunk-3CXPC6AS.mjs → chunk-6KIRT7EK.mjs} +1 -1
  93. package/dist/react/{chunk-PVCGOFQF.mjs → chunk-AAPQJY55.mjs} +1 -1
  94. package/dist/react/{chunk-N2L457YE.mjs → chunk-DDMHYLY3.mjs} +1 -1
  95. package/dist/react/{chunk-X7BHGQHX.mjs → chunk-ERN74FDW.mjs} +1 -1
  96. package/dist/react/{chunk-P23GII4V.mjs → chunk-FU6VEECB.mjs} +428 -235
  97. package/dist/react/{chunk-C4DMB2FQ.mjs → chunk-JH5BXBEU.mjs} +1 -1
  98. package/dist/react/{chunk-4TB3RHNC.mjs → chunk-M3L6EE7I.mjs} +1 -1
  99. package/dist/react/{chunk-Q3SFYOOM.mjs → chunk-VJDFB54U.mjs} +2 -2
  100. package/dist/react/{chunk-ZLGDHFMS.mjs → chunk-YZ23DM7M.mjs} +1 -1
  101. package/dist/react/client/AutumnClient.d.mts +4 -3
  102. package/dist/react/client/AutumnClient.d.ts +4 -3
  103. package/dist/react/client/IAutumnClient.d.mts +4 -471
  104. package/dist/react/client/IAutumnClient.d.ts +4 -471
  105. package/dist/react/client/index.d.mts +4 -3
  106. package/dist/react/client/index.d.ts +4 -3
  107. package/dist/react/{customer-B9DcViyn.d.mts → customer-Djhe48ql.d.ts} +24 -5
  108. package/dist/react/{customer-DbS31iZc.d.ts → customer-IVcJjz9u.d.mts} +24 -5
  109. package/dist/react/hooks/index.d.mts +4 -3
  110. package/dist/react/hooks/index.d.ts +4 -3
  111. package/dist/react/hooks/index.js +292 -193
  112. package/dist/react/hooks/index.mjs +8 -8
  113. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
  114. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
  115. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
  116. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
  117. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
  118. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
  119. package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
  120. package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
  121. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
  122. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
  123. package/dist/react/hooks/internal/useCustomerActions.d.mts +4 -3
  124. package/dist/react/hooks/internal/useCustomerActions.d.ts +4 -3
  125. package/dist/react/hooks/internal/useCustomerActions.js +1 -1
  126. package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
  127. package/dist/react/hooks/useAggregateEvents.d.mts +17 -17
  128. package/dist/react/hooks/useAggregateEvents.d.ts +17 -17
  129. package/dist/react/hooks/useAggregateEvents.js +292 -193
  130. package/dist/react/hooks/useAggregateEvents.mjs +2 -2
  131. package/dist/react/hooks/useCustomer.d.mts +3 -3
  132. package/dist/react/hooks/useCustomer.d.ts +3 -3
  133. package/dist/react/hooks/useCustomer.js +292 -193
  134. package/dist/react/hooks/useCustomer.mjs +3 -3
  135. package/dist/react/hooks/useEntity.d.mts +2 -2
  136. package/dist/react/hooks/useEntity.d.ts +2 -2
  137. package/dist/react/hooks/useEntity.js +292 -193
  138. package/dist/react/hooks/useEntity.mjs +2 -2
  139. package/dist/react/hooks/useListEvents.d.mts +17 -17
  140. package/dist/react/hooks/useListEvents.d.ts +17 -17
  141. package/dist/react/hooks/useListEvents.js +292 -193
  142. package/dist/react/hooks/useListEvents.mjs +2 -2
  143. package/dist/react/hooks/useListPlans.d.mts +5 -4
  144. package/dist/react/hooks/useListPlans.d.ts +5 -4
  145. package/dist/react/hooks/useListPlans.js +292 -193
  146. package/dist/react/hooks/useListPlans.mjs +2 -2
  147. package/dist/react/hooks/useReferrals.d.mts +2 -2
  148. package/dist/react/hooks/useReferrals.d.ts +2 -2
  149. package/dist/react/hooks/useReferrals.js +292 -193
  150. package/dist/react/hooks/useReferrals.mjs +2 -2
  151. package/dist/react/index.d.mts +4 -3
  152. package/dist/react/index.d.ts +4 -3
  153. package/dist/react/index.js +1586 -1393
  154. package/dist/react/index.mjs +9 -9
  155. package/dist/react/list-plans-op-ByqRxdNR.d.mts +1224 -0
  156. package/dist/react/list-plans-op-D-K2LRZV.d.ts +1224 -0
  157. package/dist/react/{params-B8-s4Q1n.d.ts → params-CFhvUVCf.d.ts} +1605 -199
  158. package/dist/react/{params-BquS51Ut.d.mts → params-D3ra6In7.d.mts} +1605 -199
  159. package/dist/react/plan-DOxbvjQY.d.mts +1496 -0
  160. package/dist/react/plan-DOxbvjQY.d.ts +1496 -0
  161. package/dist/sdk/index.d.mts +19588 -11175
  162. package/dist/sdk/index.d.ts +19588 -11175
  163. package/dist/sdk/index.js +19103 -11652
  164. package/dist/sdk/index.mjs +18149 -11528
  165. package/package.json +1 -1
  166. package/dist/react/plan-BKltGb1S.d.mts +0 -743
  167. package/dist/react/plan-BKltGb1S.d.ts +0 -743
@@ -36,7 +36,7 @@ __export(useCustomer_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(useCustomer_exports);
38
38
 
39
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/subscribable.js
39
+ // ../../node_modules/@tanstack/query-core/build/modern/subscribable.js
40
40
  var Subscribable = class {
41
41
  constructor() {
42
42
  this.listeners = /* @__PURE__ */ new Set();
@@ -59,7 +59,134 @@ var Subscribable = class {
59
59
  }
60
60
  };
61
61
 
62
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/utils.js
62
+ // ../../node_modules/@tanstack/query-core/build/modern/focusManager.js
63
+ var FocusManager = class extends Subscribable {
64
+ #focused;
65
+ #cleanup;
66
+ #setup;
67
+ constructor() {
68
+ super();
69
+ this.#setup = (onFocus) => {
70
+ if (typeof window !== "undefined" && window.addEventListener) {
71
+ const listener = () => onFocus();
72
+ window.addEventListener("visibilitychange", listener, false);
73
+ return () => {
74
+ window.removeEventListener("visibilitychange", listener);
75
+ };
76
+ }
77
+ return;
78
+ };
79
+ }
80
+ onSubscribe() {
81
+ if (!this.#cleanup) {
82
+ this.setEventListener(this.#setup);
83
+ }
84
+ }
85
+ onUnsubscribe() {
86
+ if (!this.hasListeners()) {
87
+ this.#cleanup?.();
88
+ this.#cleanup = void 0;
89
+ }
90
+ }
91
+ setEventListener(setup) {
92
+ this.#setup = setup;
93
+ this.#cleanup?.();
94
+ this.#cleanup = setup((focused) => {
95
+ if (typeof focused === "boolean") {
96
+ this.setFocused(focused);
97
+ } else {
98
+ this.onFocus();
99
+ }
100
+ });
101
+ }
102
+ setFocused(focused) {
103
+ const changed = this.#focused !== focused;
104
+ if (changed) {
105
+ this.#focused = focused;
106
+ this.onFocus();
107
+ }
108
+ }
109
+ onFocus() {
110
+ const isFocused = this.isFocused();
111
+ this.listeners.forEach((listener) => {
112
+ listener(isFocused);
113
+ });
114
+ }
115
+ isFocused() {
116
+ if (typeof this.#focused === "boolean") {
117
+ return this.#focused;
118
+ }
119
+ return globalThis.document?.visibilityState !== "hidden";
120
+ }
121
+ };
122
+ var focusManager = new FocusManager();
123
+
124
+ // ../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js
125
+ var defaultTimeoutProvider = {
126
+ // We need the wrapper function syntax below instead of direct references to
127
+ // global setTimeout etc.
128
+ //
129
+ // BAD: `setTimeout: setTimeout`
130
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
131
+ //
132
+ // If we use direct references here, then anything that wants to spy on or
133
+ // replace the global setTimeout (like tests) won't work since we'll already
134
+ // have a hard reference to the original implementation at the time when this
135
+ // file was imported.
136
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
137
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId),
138
+ setInterval: (callback, delay) => setInterval(callback, delay),
139
+ clearInterval: (intervalId) => clearInterval(intervalId)
140
+ };
141
+ var TimeoutManager = class {
142
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
143
+ // type at app boot; and if we leave that type, then any new timer provider
144
+ // would need to support the default provider's concrete timer ID, which is
145
+ // infeasible across environments.
146
+ //
147
+ // We settle for type safety for the TimeoutProvider type, and accept that
148
+ // this class is unsafe internally to allow for extension.
149
+ #provider = defaultTimeoutProvider;
150
+ #providerCalled = false;
151
+ setTimeoutProvider(provider) {
152
+ if (process.env.NODE_ENV !== "production") {
153
+ if (this.#providerCalled && provider !== this.#provider) {
154
+ console.error(
155
+ `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
156
+ { previous: this.#provider, provider }
157
+ );
158
+ }
159
+ }
160
+ this.#provider = provider;
161
+ if (process.env.NODE_ENV !== "production") {
162
+ this.#providerCalled = false;
163
+ }
164
+ }
165
+ setTimeout(callback, delay) {
166
+ if (process.env.NODE_ENV !== "production") {
167
+ this.#providerCalled = true;
168
+ }
169
+ return this.#provider.setTimeout(callback, delay);
170
+ }
171
+ clearTimeout(timeoutId) {
172
+ this.#provider.clearTimeout(timeoutId);
173
+ }
174
+ setInterval(callback, delay) {
175
+ if (process.env.NODE_ENV !== "production") {
176
+ this.#providerCalled = true;
177
+ }
178
+ return this.#provider.setInterval(callback, delay);
179
+ }
180
+ clearInterval(intervalId) {
181
+ this.#provider.clearInterval(intervalId);
182
+ }
183
+ };
184
+ var timeoutManager = new TimeoutManager();
185
+ function systemSetTimeoutZero(callback) {
186
+ setTimeout(callback, 0);
187
+ }
188
+
189
+ // ../../node_modules/@tanstack/query-core/build/modern/utils.js
63
190
  var isServer = typeof window === "undefined" || "Deno" in globalThis;
64
191
  function noop() {
65
192
  }
@@ -72,37 +199,41 @@ function timeUntilStale(updatedAt, staleTime) {
72
199
  function resolveStaleTime(staleTime, query) {
73
200
  return typeof staleTime === "function" ? staleTime(query) : staleTime;
74
201
  }
75
- function resolveEnabled(enabled, query) {
76
- return typeof enabled === "function" ? enabled(query) : enabled;
202
+ function resolveQueryBoolean(option, query) {
203
+ return typeof option === "function" ? option(query) : option;
77
204
  }
78
- function replaceEqualDeep(a, b) {
205
+ var hasOwn = Object.prototype.hasOwnProperty;
206
+ function replaceEqualDeep(a, b, depth = 0) {
79
207
  if (a === b) {
80
208
  return a;
81
209
  }
210
+ if (depth > 500) return b;
82
211
  const array = isPlainArray(a) && isPlainArray(b);
83
- if (array || isPlainObject(a) && isPlainObject(b)) {
84
- const aItems = array ? a : Object.keys(a);
85
- const aSize = aItems.length;
86
- const bItems = array ? b : Object.keys(b);
87
- const bSize = bItems.length;
88
- const copy = array ? [] : {};
89
- const aItemsSet = new Set(aItems);
90
- let equalItems = 0;
91
- for (let i = 0; i < bSize; i++) {
92
- const key = array ? i : bItems[i];
93
- if ((!array && aItemsSet.has(key) || array) && a[key] === void 0 && b[key] === void 0) {
94
- copy[key] = void 0;
95
- equalItems++;
96
- } else {
97
- copy[key] = replaceEqualDeep(a[key], b[key]);
98
- if (copy[key] === a[key] && a[key] !== void 0) {
99
- equalItems++;
100
- }
101
- }
212
+ if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
213
+ const aItems = array ? a : Object.keys(a);
214
+ const aSize = aItems.length;
215
+ const bItems = array ? b : Object.keys(b);
216
+ const bSize = bItems.length;
217
+ const copy = array ? new Array(bSize) : {};
218
+ let equalItems = 0;
219
+ for (let i = 0; i < bSize; i++) {
220
+ const key = array ? i : bItems[i];
221
+ const aItem = a[key];
222
+ const bItem = b[key];
223
+ if (aItem === bItem) {
224
+ copy[key] = aItem;
225
+ if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
226
+ continue;
227
+ }
228
+ if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
229
+ copy[key] = bItem;
230
+ continue;
102
231
  }
103
- return aSize === bSize && equalItems === aSize ? a : copy;
232
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
233
+ copy[key] = v;
234
+ if (v === aItem) equalItems++;
104
235
  }
105
- return b;
236
+ return aSize === bSize && equalItems === aSize ? a : copy;
106
237
  }
107
238
  function shallowEqualObjects(a, b) {
108
239
  if (!b || Object.keys(a).length !== Object.keys(b).length) {
@@ -159,7 +290,6 @@ function replaceData(prevData, data, options) {
159
290
  }
160
291
  return data;
161
292
  }
162
- var skipToken = Symbol();
163
293
  function shouldThrowError(throwOnError, params) {
164
294
  if (typeof throwOnError === "function") {
165
295
  return throwOnError(...params);
@@ -167,121 +297,26 @@ function shouldThrowError(throwOnError, params) {
167
297
  return !!throwOnError;
168
298
  }
169
299
 
170
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/focusManager.js
171
- var FocusManager = class extends Subscribable {
172
- #focused;
173
- #cleanup;
174
- #setup;
175
- constructor() {
176
- super();
177
- this.#setup = (onFocus) => {
178
- if (!isServer && window.addEventListener) {
179
- const listener = () => onFocus();
180
- window.addEventListener("visibilitychange", listener, false);
181
- return () => {
182
- window.removeEventListener("visibilitychange", listener);
183
- };
184
- }
185
- return;
186
- };
187
- }
188
- onSubscribe() {
189
- if (!this.#cleanup) {
190
- this.setEventListener(this.#setup);
191
- }
192
- }
193
- onUnsubscribe() {
194
- if (!this.hasListeners()) {
195
- this.#cleanup?.();
196
- this.#cleanup = void 0;
197
- }
198
- }
199
- setEventListener(setup) {
200
- this.#setup = setup;
201
- this.#cleanup?.();
202
- this.#cleanup = setup((focused) => {
203
- if (typeof focused === "boolean") {
204
- this.setFocused(focused);
205
- } else {
206
- this.onFocus();
207
- }
208
- });
209
- }
210
- setFocused(focused) {
211
- const changed = this.#focused !== focused;
212
- if (changed) {
213
- this.#focused = focused;
214
- this.onFocus();
215
- }
216
- }
217
- onFocus() {
218
- const isFocused = this.isFocused();
219
- this.listeners.forEach((listener) => {
220
- listener(isFocused);
221
- });
222
- }
223
- isFocused() {
224
- if (typeof this.#focused === "boolean") {
225
- return this.#focused;
226
- }
227
- return globalThis.document?.visibilityState !== "hidden";
228
- }
229
- };
230
- var focusManager = new FocusManager();
231
-
232
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/onlineManager.js
233
- var OnlineManager = class extends Subscribable {
234
- #online = true;
235
- #cleanup;
236
- #setup;
237
- constructor() {
238
- super();
239
- this.#setup = (onOnline) => {
240
- if (!isServer && window.addEventListener) {
241
- const onlineListener = () => onOnline(true);
242
- const offlineListener = () => onOnline(false);
243
- window.addEventListener("online", onlineListener, false);
244
- window.addEventListener("offline", offlineListener, false);
245
- return () => {
246
- window.removeEventListener("online", onlineListener);
247
- window.removeEventListener("offline", offlineListener);
248
- };
249
- }
250
- return;
251
- };
252
- }
253
- onSubscribe() {
254
- if (!this.#cleanup) {
255
- this.setEventListener(this.#setup);
256
- }
257
- }
258
- onUnsubscribe() {
259
- if (!this.hasListeners()) {
260
- this.#cleanup?.();
261
- this.#cleanup = void 0;
262
- }
263
- }
264
- setEventListener(setup) {
265
- this.#setup = setup;
266
- this.#cleanup?.();
267
- this.#cleanup = setup(this.setOnline.bind(this));
268
- }
269
- setOnline(online) {
270
- const changed = this.#online !== online;
271
- if (changed) {
272
- this.#online = online;
273
- this.listeners.forEach((listener) => {
274
- listener(online);
275
- });
300
+ // ../../node_modules/@tanstack/query-core/build/modern/environmentManager.js
301
+ var environmentManager = /* @__PURE__ */ (() => {
302
+ let isServerFn = () => isServer;
303
+ return {
304
+ /**
305
+ * Returns whether the current runtime should be treated as a server environment.
306
+ */
307
+ isServer() {
308
+ return isServerFn();
309
+ },
310
+ /**
311
+ * Overrides the server check globally.
312
+ */
313
+ setIsServer(isServerValue) {
314
+ isServerFn = isServerValue;
276
315
  }
277
- }
278
- isOnline() {
279
- return this.#online;
280
- }
281
- };
282
- var onlineManager = new OnlineManager();
316
+ };
317
+ })();
283
318
 
284
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/thenable.js
319
+ // ../../node_modules/@tanstack/query-core/build/modern/thenable.js
285
320
  function pendingThenable() {
286
321
  let resolve;
287
322
  let reject;
@@ -314,13 +349,8 @@ function pendingThenable() {
314
349
  return thenable;
315
350
  }
316
351
 
317
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/retryer.js
318
- function canFetch(networkMode) {
319
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
320
- }
321
-
322
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/notifyManager.js
323
- var defaultScheduler = (cb) => setTimeout(cb, 0);
352
+ // ../../node_modules/@tanstack/query-core/build/modern/notifyManager.js
353
+ var defaultScheduler = systemSetTimeoutZero;
324
354
  function createNotifyManager() {
325
355
  let queue = [];
326
356
  let transactions = 0;
@@ -399,7 +429,64 @@ function createNotifyManager() {
399
429
  }
400
430
  var notifyManager = createNotifyManager();
401
431
 
402
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/query.js
432
+ // ../../node_modules/@tanstack/query-core/build/modern/onlineManager.js
433
+ var OnlineManager = class extends Subscribable {
434
+ #online = true;
435
+ #cleanup;
436
+ #setup;
437
+ constructor() {
438
+ super();
439
+ this.#setup = (onOnline) => {
440
+ if (typeof window !== "undefined" && window.addEventListener) {
441
+ const onlineListener = () => onOnline(true);
442
+ const offlineListener = () => onOnline(false);
443
+ window.addEventListener("online", onlineListener, false);
444
+ window.addEventListener("offline", offlineListener, false);
445
+ return () => {
446
+ window.removeEventListener("online", onlineListener);
447
+ window.removeEventListener("offline", offlineListener);
448
+ };
449
+ }
450
+ return;
451
+ };
452
+ }
453
+ onSubscribe() {
454
+ if (!this.#cleanup) {
455
+ this.setEventListener(this.#setup);
456
+ }
457
+ }
458
+ onUnsubscribe() {
459
+ if (!this.hasListeners()) {
460
+ this.#cleanup?.();
461
+ this.#cleanup = void 0;
462
+ }
463
+ }
464
+ setEventListener(setup) {
465
+ this.#setup = setup;
466
+ this.#cleanup?.();
467
+ this.#cleanup = setup(this.setOnline.bind(this));
468
+ }
469
+ setOnline(online) {
470
+ const changed = this.#online !== online;
471
+ if (changed) {
472
+ this.#online = online;
473
+ this.listeners.forEach((listener) => {
474
+ listener(online);
475
+ });
476
+ }
477
+ }
478
+ isOnline() {
479
+ return this.#online;
480
+ }
481
+ };
482
+ var onlineManager = new OnlineManager();
483
+
484
+ // ../../node_modules/@tanstack/query-core/build/modern/retryer.js
485
+ function canFetch(networkMode) {
486
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
487
+ }
488
+
489
+ // ../../node_modules/@tanstack/query-core/build/modern/query.js
403
490
  function fetchState(data, options) {
404
491
  return {
405
492
  fetchFailureCount: 0,
@@ -412,7 +499,7 @@ function fetchState(data, options) {
412
499
  };
413
500
  }
414
501
 
415
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/queryObserver.js
502
+ // ../../node_modules/@tanstack/query-core/build/modern/queryObserver.js
416
503
  var QueryObserver = class extends Subscribable {
417
504
  constructor(client, options) {
418
505
  super();
@@ -483,7 +570,7 @@ var QueryObserver = class extends Subscribable {
483
570
  const prevOptions = this.options;
484
571
  const prevQuery = this.#currentQuery;
485
572
  this.options = this.#client.defaultQueryOptions(options);
486
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
573
+ if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== "boolean") {
487
574
  throw new Error(
488
575
  "Expected enabled to be a boolean or a callback that returns a boolean"
489
576
  );
@@ -507,11 +594,11 @@ var QueryObserver = class extends Subscribable {
507
594
  this.#executeFetch();
508
595
  }
509
596
  this.updateResult();
510
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
597
+ 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))) {
511
598
  this.#updateStaleTimeout();
512
599
  }
513
600
  const nextRefetchInterval = this.#computeRefetchInterval();
514
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
601
+ if (mounted && (this.#currentQuery !== prevQuery || resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== resolveQueryBoolean(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
515
602
  this.#updateRefetchInterval(nextRefetchInterval);
516
603
  }
517
604
  }
@@ -533,12 +620,15 @@ var QueryObserver = class extends Subscribable {
533
620
  get: (target, key) => {
534
621
  this.trackProp(key);
535
622
  onPropTracked?.(key);
536
- if (key === "promise" && !this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
537
- this.#currentThenable.reject(
538
- new Error(
539
- "experimental_prefetchInRender feature flag is not enabled"
540
- )
541
- );
623
+ if (key === "promise") {
624
+ this.trackProp("data");
625
+ if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
626
+ this.#currentThenable.reject(
627
+ new Error(
628
+ "experimental_prefetchInRender feature flag is not enabled"
629
+ )
630
+ );
631
+ }
542
632
  }
543
633
  return Reflect.get(target, key);
544
634
  }
@@ -586,12 +676,12 @@ var QueryObserver = class extends Subscribable {
586
676
  this.options.staleTime,
587
677
  this.#currentQuery
588
678
  );
589
- if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
679
+ if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
590
680
  return;
591
681
  }
592
682
  const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
593
683
  const timeout = time + 1;
594
- this.#staleTimeoutId = setTimeout(() => {
684
+ this.#staleTimeoutId = timeoutManager.setTimeout(() => {
595
685
  if (!this.#currentResult.isStale) {
596
686
  this.updateResult();
597
687
  }
@@ -603,10 +693,10 @@ var QueryObserver = class extends Subscribable {
603
693
  #updateRefetchInterval(nextInterval) {
604
694
  this.#clearRefetchInterval();
605
695
  this.#currentRefetchInterval = nextInterval;
606
- if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
696
+ if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
607
697
  return;
608
698
  }
609
- this.#refetchIntervalId = setInterval(() => {
699
+ this.#refetchIntervalId = timeoutManager.setInterval(() => {
610
700
  if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
611
701
  this.#executeFetch();
612
702
  }
@@ -617,14 +707,14 @@ var QueryObserver = class extends Subscribable {
617
707
  this.#updateRefetchInterval(this.#computeRefetchInterval());
618
708
  }
619
709
  #clearStaleTimeout() {
620
- if (this.#staleTimeoutId) {
621
- clearTimeout(this.#staleTimeoutId);
710
+ if (this.#staleTimeoutId !== void 0) {
711
+ timeoutManager.clearTimeout(this.#staleTimeoutId);
622
712
  this.#staleTimeoutId = void 0;
623
713
  }
624
714
  }
625
715
  #clearRefetchInterval() {
626
- if (this.#refetchIntervalId) {
627
- clearInterval(this.#refetchIntervalId);
716
+ if (this.#refetchIntervalId !== void 0) {
717
+ timeoutManager.clearInterval(this.#refetchIntervalId);
628
718
  this.#refetchIntervalId = void 0;
629
719
  }
630
720
  }
@@ -719,7 +809,7 @@ var QueryObserver = class extends Subscribable {
719
809
  failureCount: newState.fetchFailureCount,
720
810
  failureReason: newState.fetchFailureReason,
721
811
  errorUpdateCount: newState.errorUpdateCount,
722
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
812
+ isFetched: query.isFetched(),
723
813
  isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
724
814
  isFetching,
725
815
  isRefetching: isFetching && !isPending,
@@ -730,14 +820,16 @@ var QueryObserver = class extends Subscribable {
730
820
  isStale: isStale(query, options),
731
821
  refetch: this.refetch,
732
822
  promise: this.#currentThenable,
733
- isEnabled: resolveEnabled(options.enabled, query) !== false
823
+ isEnabled: resolveQueryBoolean(options.enabled, query) !== false
734
824
  };
735
825
  const nextResult = result;
736
826
  if (this.options.experimental_prefetchInRender) {
827
+ const hasResultData = nextResult.data !== void 0;
828
+ const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
737
829
  const finalizeThenableIfPossible = (thenable) => {
738
- if (nextResult.status === "error") {
830
+ if (isErrorWithoutData) {
739
831
  thenable.reject(nextResult.error);
740
- } else if (nextResult.data !== void 0) {
832
+ } else if (hasResultData) {
741
833
  thenable.resolve(nextResult.data);
742
834
  }
743
835
  };
@@ -753,12 +845,12 @@ var QueryObserver = class extends Subscribable {
753
845
  }
754
846
  break;
755
847
  case "fulfilled":
756
- if (nextResult.status === "error" || nextResult.data !== prevThenable.value) {
848
+ if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
757
849
  recreateThenable();
758
850
  }
759
851
  break;
760
852
  case "rejected":
761
- if (nextResult.status !== "error" || nextResult.error !== prevThenable.reason) {
853
+ if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
762
854
  recreateThenable();
763
855
  }
764
856
  break;
@@ -835,23 +927,23 @@ var QueryObserver = class extends Subscribable {
835
927
  }
836
928
  };
837
929
  function shouldLoadOnMount(query, options) {
838
- return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
930
+ return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
839
931
  }
840
932
  function shouldFetchOnMount(query, options) {
841
933
  return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
842
934
  }
843
935
  function shouldFetchOn(query, options, field) {
844
- if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
936
+ if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
845
937
  const value = typeof field === "function" ? field(query) : field;
846
938
  return value === "always" || value !== false && isStale(query, options);
847
939
  }
848
940
  return false;
849
941
  }
850
942
  function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
851
- return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
943
+ return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
852
944
  }
853
945
  function isStale(query, options) {
854
- return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
946
+ return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
855
947
  }
856
948
  function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
857
949
  if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
@@ -860,7 +952,7 @@ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
860
952
  return false;
861
953
  }
862
954
 
863
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
955
+ // ../../node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
864
956
  var React = __toESM(require("react"), 1);
865
957
  var import_jsx_runtime = require("react/jsx-runtime");
866
958
  var QueryClientContext = React.createContext(
@@ -877,13 +969,13 @@ var useQueryClient = (queryClient) => {
877
969
  return client;
878
970
  };
879
971
 
880
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
972
+ // ../../node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
881
973
  var React2 = __toESM(require("react"), 1);
882
974
  var IsRestoringContext = React2.createContext(false);
883
975
  var useIsRestoring = () => React2.useContext(IsRestoringContext);
884
976
  var IsRestoringProvider = IsRestoringContext.Provider;
885
977
 
886
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
978
+ // ../../node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
887
979
  var React3 = __toESM(require("react"), 1);
888
980
  var import_jsx_runtime2 = require("react/jsx-runtime");
889
981
  function createValue() {
@@ -903,10 +995,11 @@ function createValue() {
903
995
  var QueryErrorResetBoundaryContext = React3.createContext(createValue());
904
996
  var useQueryErrorResetBoundary = () => React3.useContext(QueryErrorResetBoundaryContext);
905
997
 
906
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
998
+ // ../../node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
907
999
  var React4 = __toESM(require("react"), 1);
908
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
909
- if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
1000
+ var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
1001
+ const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
1002
+ if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
910
1003
  if (!errorResetBoundary.isReset()) {
911
1004
  options.retryOnMount = false;
912
1005
  }
@@ -927,14 +1020,18 @@ var getHasError = ({
927
1020
  return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
928
1021
  };
929
1022
 
930
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/suspense.js
1023
+ // ../../node_modules/@tanstack/react-query/build/modern/suspense.js
931
1024
  var ensureSuspenseTimers = (defaultedOptions) => {
932
1025
  if (defaultedOptions.suspense) {
933
- const clamp = (value) => value === "static" ? value : Math.max(value ?? 1e3, 1e3);
1026
+ const MIN_SUSPENSE_TIME_MS = 1e3;
1027
+ const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
934
1028
  const originalStaleTime = defaultedOptions.staleTime;
935
1029
  defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
936
1030
  if (typeof defaultedOptions.gcTime === "number") {
937
- defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3);
1031
+ defaultedOptions.gcTime = Math.max(
1032
+ defaultedOptions.gcTime,
1033
+ MIN_SUSPENSE_TIME_MS
1034
+ );
938
1035
  }
939
1036
  }
940
1037
  };
@@ -944,7 +1041,7 @@ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observ
944
1041
  errorResetBoundary.clearReset();
945
1042
  });
946
1043
 
947
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
1044
+ // ../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
948
1045
  var React5 = __toESM(require("react"), 1);
949
1046
  function useBaseQuery(options, Observer, queryClient) {
950
1047
  if (process.env.NODE_ENV !== "production") {
@@ -961,6 +1058,7 @@ function useBaseQuery(options, Observer, queryClient) {
961
1058
  client.getDefaultOptions().queries?._experimental_beforeQuery?.(
962
1059
  defaultedOptions
963
1060
  );
1061
+ const query = client.getQueryCache().get(defaultedOptions.queryHash);
964
1062
  if (process.env.NODE_ENV !== "production") {
965
1063
  if (!defaultedOptions.queryFn) {
966
1064
  console.error(
@@ -968,9 +1066,10 @@ function useBaseQuery(options, Observer, queryClient) {
968
1066
  );
969
1067
  }
970
1068
  }
971
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
1069
+ const subscribed = options.subscribed !== false;
1070
+ defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : subscribed ? "optimistic" : void 0;
972
1071
  ensureSuspenseTimers(defaultedOptions);
973
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
1072
+ ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
974
1073
  useClearResetErrorBoundary(errorResetBoundary);
975
1074
  const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
976
1075
  const [observer] = React5.useState(
@@ -980,7 +1079,7 @@ function useBaseQuery(options, Observer, queryClient) {
980
1079
  )
981
1080
  );
982
1081
  const result = observer.getOptimisticResult(defaultedOptions);
983
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
1082
+ const shouldSubscribe = !isRestoring && subscribed;
984
1083
  React5.useSyncExternalStore(
985
1084
  React5.useCallback(
986
1085
  (onStoreChange) => {
@@ -1003,7 +1102,7 @@ function useBaseQuery(options, Observer, queryClient) {
1003
1102
  result,
1004
1103
  errorResetBoundary,
1005
1104
  throwOnError: defaultedOptions.throwOnError,
1006
- query: client.getQueryCache().get(defaultedOptions.queryHash),
1105
+ query,
1007
1106
  suspense: defaultedOptions.suspense
1008
1107
  })) {
1009
1108
  throw result.error;
@@ -1013,13 +1112,13 @@ function useBaseQuery(options, Observer, queryClient) {
1013
1112
  defaultedOptions,
1014
1113
  result
1015
1114
  );
1016
- if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
1115
+ if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
1017
1116
  const promise = isNewCacheEntry ? (
1018
1117
  // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1019
1118
  fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
1020
1119
  ) : (
1021
1120
  // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1022
- client.getQueryCache().get(defaultedOptions.queryHash)?.promise
1121
+ query?.promise
1023
1122
  );
1024
1123
  promise?.catch(noop).finally(() => {
1025
1124
  observer.updateResult();
@@ -1028,7 +1127,7 @@ function useBaseQuery(options, Observer, queryClient) {
1028
1127
  return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
1029
1128
  }
1030
1129
 
1031
- // ../../node_modules/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/useQuery.js
1130
+ // ../../node_modules/@tanstack/react-query/build/modern/useQuery.js
1032
1131
  function useQuery(options, queryClient) {
1033
1132
  return useBaseQuery(options, QueryObserver, queryClient);
1034
1133
  }