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
@@ -40,7 +40,7 @@ __export(hooks_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(hooks_exports);
42
42
 
43
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/subscribable.js
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/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/utils.js
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 resolveEnabled(enabled, query) {
80
- return typeof enabled === "function" ? enabled(query) : enabled;
206
+ function resolveQueryBoolean(option, query) {
207
+ return typeof option === "function" ? option(query) : option;
81
208
  }
82
- function replaceEqualDeep(a, b) {
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 || isPlainObject(a) && isPlainObject(b)) {
88
- const aItems = array ? a : Object.keys(a);
89
- const aSize = aItems.length;
90
- const bItems = array ? b : Object.keys(b);
91
- const bSize = bItems.length;
92
- const copy = array ? [] : {};
93
- const aItemsSet = new Set(aItems);
94
- let equalItems = 0;
95
- for (let i = 0; i < bSize; i++) {
96
- const key = array ? i : bItems[i];
97
- if ((!array && aItemsSet.has(key) || array) && a[key] === void 0 && b[key] === void 0) {
98
- copy[key] = void 0;
99
- equalItems++;
100
- } else {
101
- copy[key] = replaceEqualDeep(a[key], b[key]);
102
- if (copy[key] === a[key] && a[key] !== void 0) {
103
- equalItems++;
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
- return aSize === bSize && equalItems === aSize ? a : copy;
236
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
237
+ copy[key] = v;
238
+ if (v === aItem) equalItems++;
108
239
  }
109
- return b;
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/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/focusManager.js
175
- var FocusManager = class extends Subscribable {
176
- #focused;
177
- #cleanup;
178
- #setup;
179
- constructor() {
180
- super();
181
- this.#setup = (onFocus) => {
182
- if (!isServer && window.addEventListener) {
183
- const listener = () => onFocus();
184
- window.addEventListener("visibilitychange", listener, false);
185
- return () => {
186
- window.removeEventListener("visibilitychange", listener);
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
- isOnline() {
283
- return this.#online;
284
- }
285
- };
286
- var onlineManager = new OnlineManager();
320
+ };
321
+ })();
287
322
 
288
- // ../../node_modules/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/thenable.js
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/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/retryer.js
322
- function canFetch(networkMode) {
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/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/query.js
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/.bun/@tanstack+query-core@5.85.6/node_modules/@tanstack/query-core/build/modern/queryObserver.js
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 resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
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 || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
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 || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
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" && !this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
541
- this.#currentThenable.reject(
542
- new Error(
543
- "experimental_prefetchInRender feature flag is not enabled"
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 || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
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: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
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: resolveEnabled(options.enabled, query) !== false
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 (nextResult.status === "error") {
834
+ if (isErrorWithoutData) {
743
835
  thenable.reject(nextResult.error);
744
- } else if (nextResult.data !== void 0) {
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 (nextResult.status === "error" || nextResult.data !== prevThenable.value) {
852
+ if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
761
853
  recreateThenable();
762
854
  }
763
855
  break;
764
856
  case "rejected":
765
- if (nextResult.status !== "error" || nextResult.error !== prevThenable.reason) {
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 resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
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 (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
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 || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
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 resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
1002
+ // ../../node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
911
1003
  var React4 = __toESM(require("react"), 1);
912
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
913
- if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/suspense.js
1027
+ // ../../node_modules/@tanstack/react-query/build/modern/suspense.js
935
1028
  var ensureSuspenseTimers = (defaultedOptions) => {
936
1029
  if (defaultedOptions.suspense) {
937
- const clamp = (value) => value === "static" ? value : Math.max(value ?? 1e3, 1e3);
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(defaultedOptions.gcTime, 1e3);
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
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
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
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 && options.subscribed !== false;
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: client.getQueryCache().get(defaultedOptions.queryHash),
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
- client.getQueryCache().get(defaultedOptions.queryHash)?.promise
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/.bun/@tanstack+react-query@5.85.6+e14d3f224186685e/node_modules/@tanstack/react-query/build/modern/useQuery.js
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
  }