@tanstack/query-core 5.91.2 → 5.94.4

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 (295) hide show
  1. package/package.json +1 -1
  2. package/build/legacy/_tsup-dts-rollup.d.cts +0 -2229
  3. package/build/legacy/_tsup-dts-rollup.d.ts +0 -2229
  4. package/build/legacy/chunk-PXG64RU4.js +0 -25
  5. package/build/legacy/chunk-PXG64RU4.js.map +0 -1
  6. package/build/legacy/environmentManager.cjs +0 -48
  7. package/build/legacy/environmentManager.cjs.map +0 -1
  8. package/build/legacy/environmentManager.d.cts +0 -2
  9. package/build/legacy/environmentManager.d.ts +0 -2
  10. package/build/legacy/environmentManager.js +0 -25
  11. package/build/legacy/environmentManager.js.map +0 -1
  12. package/build/legacy/focusManager.cjs +0 -107
  13. package/build/legacy/focusManager.cjs.map +0 -1
  14. package/build/legacy/focusManager.d.cts +0 -2
  15. package/build/legacy/focusManager.d.ts +0 -2
  16. package/build/legacy/focusManager.js +0 -80
  17. package/build/legacy/focusManager.js.map +0 -1
  18. package/build/legacy/hydration.cjs +0 -178
  19. package/build/legacy/hydration.cjs.map +0 -1
  20. package/build/legacy/hydration.d.cts +0 -7
  21. package/build/legacy/hydration.d.ts +0 -7
  22. package/build/legacy/hydration.js +0 -152
  23. package/build/legacy/hydration.js.map +0 -1
  24. package/build/legacy/index.cjs +0 -113
  25. package/build/legacy/index.cjs.map +0 -1
  26. package/build/legacy/index.d.cts +0 -142
  27. package/build/legacy/index.d.ts +0 -142
  28. package/build/legacy/index.js +0 -75
  29. package/build/legacy/index.js.map +0 -1
  30. package/build/legacy/infiniteQueryBehavior.cjs +0 -146
  31. package/build/legacy/infiniteQueryBehavior.cjs.map +0 -1
  32. package/build/legacy/infiniteQueryBehavior.d.cts +0 -3
  33. package/build/legacy/infiniteQueryBehavior.d.ts +0 -3
  34. package/build/legacy/infiniteQueryBehavior.js +0 -126
  35. package/build/legacy/infiniteQueryBehavior.js.map +0 -1
  36. package/build/legacy/infiniteQueryObserver.cjs +0 -93
  37. package/build/legacy/infiniteQueryObserver.cjs.map +0 -1
  38. package/build/legacy/infiniteQueryObserver.d.cts +0 -1
  39. package/build/legacy/infiniteQueryObserver.d.ts +0 -1
  40. package/build/legacy/infiniteQueryObserver.js +0 -74
  41. package/build/legacy/infiniteQueryObserver.js.map +0 -1
  42. package/build/legacy/mutation.cjs +0 -333
  43. package/build/legacy/mutation.cjs.map +0 -1
  44. package/build/legacy/mutation.d.cts +0 -4
  45. package/build/legacy/mutation.d.ts +0 -4
  46. package/build/legacy/mutation.js +0 -306
  47. package/build/legacy/mutation.js.map +0 -1
  48. package/build/legacy/mutationCache.cjs +0 -170
  49. package/build/legacy/mutationCache.cjs.map +0 -1
  50. package/build/legacy/mutationCache.d.cts +0 -2
  51. package/build/legacy/mutationCache.d.ts +0 -2
  52. package/build/legacy/mutationCache.js +0 -137
  53. package/build/legacy/mutationCache.js.map +0 -1
  54. package/build/legacy/mutationObserver.cjs +0 -190
  55. package/build/legacy/mutationObserver.cjs.map +0 -1
  56. package/build/legacy/mutationObserver.d.cts +0 -1
  57. package/build/legacy/mutationObserver.d.ts +0 -1
  58. package/build/legacy/mutationObserver.js +0 -164
  59. package/build/legacy/mutationObserver.js.map +0 -1
  60. package/build/legacy/notifyManager.cjs +0 -113
  61. package/build/legacy/notifyManager.cjs.map +0 -1
  62. package/build/legacy/notifyManager.d.cts +0 -3
  63. package/build/legacy/notifyManager.d.ts +0 -3
  64. package/build/legacy/notifyManager.js +0 -88
  65. package/build/legacy/notifyManager.js.map +0 -1
  66. package/build/legacy/onlineManager.cjs +0 -96
  67. package/build/legacy/onlineManager.cjs.map +0 -1
  68. package/build/legacy/onlineManager.d.cts +0 -2
  69. package/build/legacy/onlineManager.d.ts +0 -2
  70. package/build/legacy/onlineManager.js +0 -69
  71. package/build/legacy/onlineManager.js.map +0 -1
  72. package/build/legacy/queriesObserver.cjs +0 -260
  73. package/build/legacy/queriesObserver.cjs.map +0 -1
  74. package/build/legacy/queriesObserver.d.cts +0 -2
  75. package/build/legacy/queriesObserver.d.ts +0 -2
  76. package/build/legacy/queriesObserver.js +0 -234
  77. package/build/legacy/queriesObserver.js.map +0 -1
  78. package/build/legacy/query.cjs +0 -487
  79. package/build/legacy/query.cjs.map +0 -1
  80. package/build/legacy/query.d.cts +0 -10
  81. package/build/legacy/query.d.ts +0 -10
  82. package/build/legacy/query.js +0 -468
  83. package/build/legacy/query.js.map +0 -1
  84. package/build/legacy/queryCache.cjs +0 -131
  85. package/build/legacy/queryCache.cjs.map +0 -1
  86. package/build/legacy/queryCache.d.cts +0 -3
  87. package/build/legacy/queryCache.d.ts +0 -3
  88. package/build/legacy/queryCache.js +0 -105
  89. package/build/legacy/queryCache.js.map +0 -1
  90. package/build/legacy/queryClient.cjs +0 -349
  91. package/build/legacy/queryClient.cjs.map +0 -1
  92. package/build/legacy/queryClient.d.cts +0 -1
  93. package/build/legacy/queryClient.d.ts +0 -1
  94. package/build/legacy/queryClient.js +0 -324
  95. package/build/legacy/queryClient.js.map +0 -1
  96. package/build/legacy/queryObserver.cjs +0 -516
  97. package/build/legacy/queryObserver.cjs.map +0 -1
  98. package/build/legacy/queryObserver.d.cts +0 -1
  99. package/build/legacy/queryObserver.d.ts +0 -1
  100. package/build/legacy/queryObserver.js +0 -498
  101. package/build/legacy/queryObserver.js.map +0 -1
  102. package/build/legacy/removable.cjs +0 -70
  103. package/build/legacy/removable.cjs.map +0 -1
  104. package/build/legacy/removable.d.cts +0 -1
  105. package/build/legacy/removable.d.ts +0 -1
  106. package/build/legacy/removable.js +0 -44
  107. package/build/legacy/removable.js.map +0 -1
  108. package/build/legacy/retryer.cjs +0 -166
  109. package/build/legacy/retryer.cjs.map +0 -1
  110. package/build/legacy/retryer.d.cts +0 -7
  111. package/build/legacy/retryer.d.ts +0 -7
  112. package/build/legacy/retryer.js +0 -140
  113. package/build/legacy/retryer.js.map +0 -1
  114. package/build/legacy/streamedQuery.cjs +0 -80
  115. package/build/legacy/streamedQuery.cjs.map +0 -1
  116. package/build/legacy/streamedQuery.d.cts +0 -1
  117. package/build/legacy/streamedQuery.d.ts +0 -1
  118. package/build/legacy/streamedQuery.js +0 -57
  119. package/build/legacy/streamedQuery.js.map +0 -1
  120. package/build/legacy/subscribable.cjs +0 -51
  121. package/build/legacy/subscribable.cjs.map +0 -1
  122. package/build/legacy/subscribable.d.cts +0 -1
  123. package/build/legacy/subscribable.d.ts +0 -1
  124. package/build/legacy/subscribable.js +0 -28
  125. package/build/legacy/subscribable.js.map +0 -1
  126. package/build/legacy/thenable.cjs +0 -76
  127. package/build/legacy/thenable.cjs.map +0 -1
  128. package/build/legacy/thenable.d.cts +0 -6
  129. package/build/legacy/thenable.d.ts +0 -6
  130. package/build/legacy/thenable.js +0 -52
  131. package/build/legacy/thenable.js.map +0 -1
  132. package/build/legacy/timeoutManager.cjs +0 -110
  133. package/build/legacy/timeoutManager.cjs.map +0 -1
  134. package/build/legacy/timeoutManager.d.cts +0 -7
  135. package/build/legacy/timeoutManager.d.ts +0 -7
  136. package/build/legacy/timeoutManager.js +0 -81
  137. package/build/legacy/timeoutManager.js.map +0 -1
  138. package/build/legacy/types.cjs +0 -37
  139. package/build/legacy/types.cjs.map +0 -1
  140. package/build/legacy/types.d.cts +0 -95
  141. package/build/legacy/types.d.ts +0 -95
  142. package/build/legacy/types.js +0 -12
  143. package/build/legacy/types.js.map +0 -1
  144. package/build/legacy/utils.cjs +0 -330
  145. package/build/legacy/utils.cjs.map +0 -1
  146. package/build/legacy/utils.d.cts +0 -30
  147. package/build/legacy/utils.d.ts +0 -30
  148. package/build/legacy/utils.js +0 -283
  149. package/build/legacy/utils.js.map +0 -1
  150. package/build/modern/_tsup-dts-rollup.d.cts +0 -2229
  151. package/build/modern/_tsup-dts-rollup.d.ts +0 -2229
  152. package/build/modern/environmentManager.cjs +0 -48
  153. package/build/modern/environmentManager.cjs.map +0 -1
  154. package/build/modern/environmentManager.d.cts +0 -2
  155. package/build/modern/environmentManager.d.ts +0 -2
  156. package/build/modern/environmentManager.js +0 -23
  157. package/build/modern/environmentManager.js.map +0 -1
  158. package/build/modern/focusManager.cjs +0 -93
  159. package/build/modern/focusManager.cjs.map +0 -1
  160. package/build/modern/focusManager.d.cts +0 -2
  161. package/build/modern/focusManager.d.ts +0 -2
  162. package/build/modern/focusManager.js +0 -67
  163. package/build/modern/focusManager.js.map +0 -1
  164. package/build/modern/hydration.cjs +0 -173
  165. package/build/modern/hydration.cjs.map +0 -1
  166. package/build/modern/hydration.d.cts +0 -7
  167. package/build/modern/hydration.d.ts +0 -7
  168. package/build/modern/hydration.js +0 -145
  169. package/build/modern/hydration.js.map +0 -1
  170. package/build/modern/index.cjs +0 -113
  171. package/build/modern/index.cjs.map +0 -1
  172. package/build/modern/index.d.cts +0 -142
  173. package/build/modern/index.d.ts +0 -142
  174. package/build/modern/index.js +0 -73
  175. package/build/modern/index.js.map +0 -1
  176. package/build/modern/infiniteQueryBehavior.cjs +0 -142
  177. package/build/modern/infiniteQueryBehavior.cjs.map +0 -1
  178. package/build/modern/infiniteQueryBehavior.d.cts +0 -3
  179. package/build/modern/infiniteQueryBehavior.d.ts +0 -3
  180. package/build/modern/infiniteQueryBehavior.js +0 -120
  181. package/build/modern/infiniteQueryBehavior.js.map +0 -1
  182. package/build/modern/infiniteQueryObserver.cjs +0 -92
  183. package/build/modern/infiniteQueryObserver.cjs.map +0 -1
  184. package/build/modern/infiniteQueryObserver.d.cts +0 -1
  185. package/build/modern/infiniteQueryObserver.d.ts +0 -1
  186. package/build/modern/infiniteQueryObserver.js +0 -71
  187. package/build/modern/infiniteQueryObserver.js.map +0 -1
  188. package/build/modern/mutation.cjs +0 -307
  189. package/build/modern/mutation.cjs.map +0 -1
  190. package/build/modern/mutation.d.cts +0 -4
  191. package/build/modern/mutation.d.ts +0 -4
  192. package/build/modern/mutation.js +0 -281
  193. package/build/modern/mutation.js.map +0 -1
  194. package/build/modern/mutationCache.cjs +0 -149
  195. package/build/modern/mutationCache.cjs.map +0 -1
  196. package/build/modern/mutationCache.d.cts +0 -2
  197. package/build/modern/mutationCache.d.ts +0 -2
  198. package/build/modern/mutationCache.js +0 -124
  199. package/build/modern/mutationCache.js.map +0 -1
  200. package/build/modern/mutationObserver.cjs +0 -165
  201. package/build/modern/mutationObserver.cjs.map +0 -1
  202. package/build/modern/mutationObserver.d.cts +0 -1
  203. package/build/modern/mutationObserver.d.ts +0 -1
  204. package/build/modern/mutationObserver.js +0 -140
  205. package/build/modern/mutationObserver.js.map +0 -1
  206. package/build/modern/notifyManager.cjs +0 -113
  207. package/build/modern/notifyManager.cjs.map +0 -1
  208. package/build/modern/notifyManager.d.cts +0 -3
  209. package/build/modern/notifyManager.d.ts +0 -3
  210. package/build/modern/notifyManager.js +0 -86
  211. package/build/modern/notifyManager.js.map +0 -1
  212. package/build/modern/onlineManager.cjs +0 -83
  213. package/build/modern/onlineManager.cjs.map +0 -1
  214. package/build/modern/onlineManager.d.cts +0 -2
  215. package/build/modern/onlineManager.d.ts +0 -2
  216. package/build/modern/onlineManager.js +0 -57
  217. package/build/modern/onlineManager.js.map +0 -1
  218. package/build/modern/queriesObserver.cjs +0 -237
  219. package/build/modern/queriesObserver.cjs.map +0 -1
  220. package/build/modern/queriesObserver.d.cts +0 -2
  221. package/build/modern/queriesObserver.d.ts +0 -2
  222. package/build/modern/queriesObserver.js +0 -212
  223. package/build/modern/queriesObserver.js.map +0 -1
  224. package/build/modern/query.cjs +0 -461
  225. package/build/modern/query.cjs.map +0 -1
  226. package/build/modern/query.d.cts +0 -10
  227. package/build/modern/query.d.ts +0 -10
  228. package/build/modern/query.js +0 -443
  229. package/build/modern/query.js.map +0 -1
  230. package/build/modern/queryCache.cjs +0 -122
  231. package/build/modern/queryCache.cjs.map +0 -1
  232. package/build/modern/queryCache.d.cts +0 -3
  233. package/build/modern/queryCache.d.ts +0 -3
  234. package/build/modern/queryCache.js +0 -97
  235. package/build/modern/queryCache.js.map +0 -1
  236. package/build/modern/queryClient.cjs +0 -322
  237. package/build/modern/queryClient.cjs.map +0 -1
  238. package/build/modern/queryClient.d.cts +0 -1
  239. package/build/modern/queryClient.d.ts +0 -1
  240. package/build/modern/queryClient.js +0 -305
  241. package/build/modern/queryClient.js.map +0 -1
  242. package/build/modern/queryObserver.cjs +0 -489
  243. package/build/modern/queryObserver.cjs.map +0 -1
  244. package/build/modern/queryObserver.d.cts +0 -1
  245. package/build/modern/queryObserver.d.ts +0 -1
  246. package/build/modern/queryObserver.js +0 -472
  247. package/build/modern/queryObserver.js.map +0 -1
  248. package/build/modern/removable.cjs +0 -59
  249. package/build/modern/removable.cjs.map +0 -1
  250. package/build/modern/removable.d.cts +0 -1
  251. package/build/modern/removable.d.ts +0 -1
  252. package/build/modern/removable.js +0 -34
  253. package/build/modern/removable.js.map +0 -1
  254. package/build/modern/retryer.cjs +0 -162
  255. package/build/modern/retryer.cjs.map +0 -1
  256. package/build/modern/retryer.d.cts +0 -7
  257. package/build/modern/retryer.d.ts +0 -7
  258. package/build/modern/retryer.js +0 -134
  259. package/build/modern/retryer.js.map +0 -1
  260. package/build/modern/streamedQuery.cjs +0 -80
  261. package/build/modern/streamedQuery.cjs.map +0 -1
  262. package/build/modern/streamedQuery.d.cts +0 -1
  263. package/build/modern/streamedQuery.d.ts +0 -1
  264. package/build/modern/streamedQuery.js +0 -55
  265. package/build/modern/streamedQuery.js.map +0 -1
  266. package/build/modern/subscribable.cjs +0 -51
  267. package/build/modern/subscribable.cjs.map +0 -1
  268. package/build/modern/subscribable.d.cts +0 -1
  269. package/build/modern/subscribable.d.ts +0 -1
  270. package/build/modern/subscribable.js +0 -26
  271. package/build/modern/subscribable.js.map +0 -1
  272. package/build/modern/thenable.cjs +0 -75
  273. package/build/modern/thenable.cjs.map +0 -1
  274. package/build/modern/thenable.d.cts +0 -6
  275. package/build/modern/thenable.d.ts +0 -6
  276. package/build/modern/thenable.js +0 -49
  277. package/build/modern/thenable.js.map +0 -1
  278. package/build/modern/timeoutManager.cjs +0 -98
  279. package/build/modern/timeoutManager.cjs.map +0 -1
  280. package/build/modern/timeoutManager.d.cts +0 -7
  281. package/build/modern/timeoutManager.d.ts +0 -7
  282. package/build/modern/timeoutManager.js +0 -70
  283. package/build/modern/timeoutManager.js.map +0 -1
  284. package/build/modern/types.cjs +0 -37
  285. package/build/modern/types.cjs.map +0 -1
  286. package/build/modern/types.d.cts +0 -95
  287. package/build/modern/types.d.ts +0 -95
  288. package/build/modern/types.js +0 -10
  289. package/build/modern/types.js.map +0 -1
  290. package/build/modern/utils.cjs +0 -330
  291. package/build/modern/utils.cjs.map +0 -1
  292. package/build/modern/utils.d.cts +0 -30
  293. package/build/modern/utils.d.ts +0 -30
  294. package/build/modern/utils.js +0 -281
  295. package/build/modern/utils.js.map +0 -1
@@ -1,28 +0,0 @@
1
- import "./chunk-PXG64RU4.js";
2
-
3
- // src/subscribable.ts
4
- var Subscribable = class {
5
- constructor() {
6
- this.listeners = /* @__PURE__ */ new Set();
7
- this.subscribe = this.subscribe.bind(this);
8
- }
9
- subscribe(listener) {
10
- this.listeners.add(listener);
11
- this.onSubscribe();
12
- return () => {
13
- this.listeners.delete(listener);
14
- this.onUnsubscribe();
15
- };
16
- }
17
- hasListeners() {
18
- return this.listeners.size > 0;
19
- }
20
- onSubscribe() {
21
- }
22
- onUnsubscribe() {
23
- }
24
- };
25
- export {
26
- Subscribable
27
- };
28
- //# sourceMappingURL=subscribable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/subscribable.ts"],"sourcesContent":["export class Subscribable<TListener extends Function> {\n protected listeners = new Set<TListener>()\n\n constructor() {\n this.subscribe = this.subscribe.bind(this)\n }\n\n subscribe(listener: TListener): () => void {\n this.listeners.add(listener)\n\n this.onSubscribe()\n\n return () => {\n this.listeners.delete(listener)\n this.onUnsubscribe()\n }\n }\n\n hasListeners(): boolean {\n return this.listeners.size > 0\n }\n\n protected onSubscribe(): void {\n // Do nothing\n }\n\n protected onUnsubscribe(): void {\n // Do nothing\n }\n}\n"],"mappings":";;;AAAO,IAAM,eAAN,MAA+C;AAAA,EAGpD,cAAc;AAFd,SAAU,YAAY,oBAAI,IAAe;AAGvC,SAAK,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,EAC3C;AAAA,EAEA,UAAU,UAAiC;AACzC,SAAK,UAAU,IAAI,QAAQ;AAE3B,SAAK,YAAY;AAEjB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO,QAAQ;AAC9B,WAAK,cAAc;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,eAAwB;AACtB,WAAO,KAAK,UAAU,OAAO;AAAA,EAC/B;AAAA,EAEU,cAAoB;AAAA,EAE9B;AAAA,EAEU,gBAAsB;AAAA,EAEhC;AACF;","names":[]}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/thenable.ts
21
- var thenable_exports = {};
22
- __export(thenable_exports, {
23
- pendingThenable: () => pendingThenable,
24
- tryResolveSync: () => tryResolveSync
25
- });
26
- module.exports = __toCommonJS(thenable_exports);
27
- var import_utils = require("./utils.cjs");
28
- function pendingThenable() {
29
- let resolve;
30
- let reject;
31
- const thenable = new Promise((_resolve, _reject) => {
32
- resolve = _resolve;
33
- reject = _reject;
34
- });
35
- thenable.status = "pending";
36
- thenable.catch(() => {
37
- });
38
- function finalize(data) {
39
- Object.assign(thenable, data);
40
- delete thenable.resolve;
41
- delete thenable.reject;
42
- }
43
- thenable.resolve = (value) => {
44
- finalize({
45
- status: "fulfilled",
46
- value
47
- });
48
- resolve(value);
49
- };
50
- thenable.reject = (reason) => {
51
- finalize({
52
- status: "rejected",
53
- reason
54
- });
55
- reject(reason);
56
- };
57
- return thenable;
58
- }
59
- function tryResolveSync(promise) {
60
- var _a;
61
- let data;
62
- (_a = promise.then((result) => {
63
- data = result;
64
- return result;
65
- }, import_utils.noop)) == null ? void 0 : _a.catch(import_utils.noop);
66
- if (data !== void 0) {
67
- return { data };
68
- }
69
- return void 0;
70
- }
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- pendingThenable,
74
- tryResolveSync
75
- });
76
- //# sourceMappingURL=thenable.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/thenable.ts"],"sourcesContent":["/**\n * Thenable types which matches React's types for promises\n *\n * React seemingly uses `.status`, `.value` and `.reason` properties on a promises to optimistically unwrap data from promises\n *\n * @see https://github.com/facebook/react/blob/main/packages/shared/ReactTypes.js#L112-L138\n * @see https://github.com/facebook/react/blob/4f604941569d2e8947ce1460a0b2997e835f37b9/packages/react-debug-tools/src/ReactDebugHooks.js#L224-L227\n */\n\nimport { noop } from './utils'\n\ninterface Fulfilled<T> {\n status: 'fulfilled'\n value: T\n}\ninterface Rejected {\n status: 'rejected'\n reason: unknown\n}\ninterface Pending<T> {\n status: 'pending'\n\n /**\n * Resolve the promise with a value.\n * Will remove the `resolve` and `reject` properties from the promise.\n */\n resolve: (value: T) => void\n /**\n * Reject the promise with a reason.\n * Will remove the `resolve` and `reject` properties from the promise.\n */\n reject: (reason: unknown) => void\n}\n\nexport type FulfilledThenable<T> = Promise<T> & Fulfilled<T>\nexport type RejectedThenable<T> = Promise<T> & Rejected\nexport type PendingThenable<T> = Promise<T> & Pending<T>\n\nexport type Thenable<T> =\n | FulfilledThenable<T>\n | RejectedThenable<T>\n | PendingThenable<T>\n\nexport function pendingThenable<T>(): PendingThenable<T> {\n let resolve: Pending<T>['resolve']\n let reject: Pending<T>['reject']\n // this could use `Promise.withResolvers()` in the future\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve\n reject = _reject\n }) as PendingThenable<T>\n\n thenable.status = 'pending'\n thenable.catch(() => {\n // prevent unhandled rejection errors\n })\n\n function finalize(data: Fulfilled<T> | Rejected) {\n Object.assign(thenable, data)\n\n // clear pending props to avoid calling them twice\n delete (thenable as Partial<PendingThenable<T>>).resolve\n delete (thenable as Partial<PendingThenable<T>>).reject\n }\n\n thenable.resolve = (value) => {\n finalize({\n status: 'fulfilled',\n value,\n })\n\n resolve(value)\n }\n thenable.reject = (reason) => {\n finalize({\n status: 'rejected',\n reason,\n })\n\n reject(reason)\n }\n\n return thenable\n}\n\n/**\n * This function takes a Promise-like input and detects whether the data\n * is synchronously available or not.\n *\n * It does not inspect .status, .value or .reason properties of the promise,\n * as those are not always available, and the .status of React's promises\n * should not be considered part of the public API.\n */\nexport function tryResolveSync(promise: Promise<unknown> | Thenable<unknown>) {\n let data: unknown\n\n promise\n .then((result) => {\n data = result\n return result\n }, noop)\n // .catch can be unavailable on certain kinds of thenable's\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n ?.catch(noop)\n\n if (data !== undefined) {\n return { data }\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,mBAAqB;AAkCd,SAAS,kBAAyC;AACvD,MAAI;AACJ,MAAI;AAEJ,QAAM,WAAW,IAAI,QAAQ,CAAC,UAAU,YAAY;AAClD,cAAU;AACV,aAAS;AAAA,EACX,CAAC;AAED,WAAS,SAAS;AAClB,WAAS,MAAM,MAAM;AAAA,EAErB,CAAC;AAED,WAAS,SAAS,MAA+B;AAC/C,WAAO,OAAO,UAAU,IAAI;AAG5B,WAAQ,SAAyC;AACjD,WAAQ,SAAyC;AAAA,EACnD;AAEA,WAAS,UAAU,CAAC,UAAU;AAC5B,aAAS;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,YAAQ,KAAK;AAAA,EACf;AACA,WAAS,SAAS,CAAC,WAAW;AAC5B,aAAS;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AAAA,EACf;AAEA,SAAO;AACT;AAUO,SAAS,eAAe,SAA+C;AA7F9E;AA8FE,MAAI;AAEJ,gBACG,KAAK,CAAC,WAAW;AAChB,WAAO;AACP,WAAO;AAAA,EACT,GAAG,iBAAI,MAJT,mBAOI,MAAM;AAEV,MAAI,SAAS,QAAW;AACtB,WAAO,EAAE,KAAK;AAAA,EAChB;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +0,0 @@
1
- export { pendingThenable } from './_tsup-dts-rollup.cjs';
2
- export { tryResolveSync } from './_tsup-dts-rollup.cjs';
3
- export { FulfilledThenable } from './_tsup-dts-rollup.cjs';
4
- export { RejectedThenable } from './_tsup-dts-rollup.cjs';
5
- export { PendingThenable } from './_tsup-dts-rollup.cjs';
6
- export { Thenable } from './_tsup-dts-rollup.cjs';
@@ -1,6 +0,0 @@
1
- export { pendingThenable } from './_tsup-dts-rollup.js';
2
- export { tryResolveSync } from './_tsup-dts-rollup.js';
3
- export { FulfilledThenable } from './_tsup-dts-rollup.js';
4
- export { RejectedThenable } from './_tsup-dts-rollup.js';
5
- export { PendingThenable } from './_tsup-dts-rollup.js';
6
- export { Thenable } from './_tsup-dts-rollup.js';
@@ -1,52 +0,0 @@
1
- import "./chunk-PXG64RU4.js";
2
-
3
- // src/thenable.ts
4
- import { noop } from "./utils.js";
5
- function pendingThenable() {
6
- let resolve;
7
- let reject;
8
- const thenable = new Promise((_resolve, _reject) => {
9
- resolve = _resolve;
10
- reject = _reject;
11
- });
12
- thenable.status = "pending";
13
- thenable.catch(() => {
14
- });
15
- function finalize(data) {
16
- Object.assign(thenable, data);
17
- delete thenable.resolve;
18
- delete thenable.reject;
19
- }
20
- thenable.resolve = (value) => {
21
- finalize({
22
- status: "fulfilled",
23
- value
24
- });
25
- resolve(value);
26
- };
27
- thenable.reject = (reason) => {
28
- finalize({
29
- status: "rejected",
30
- reason
31
- });
32
- reject(reason);
33
- };
34
- return thenable;
35
- }
36
- function tryResolveSync(promise) {
37
- var _a;
38
- let data;
39
- (_a = promise.then((result) => {
40
- data = result;
41
- return result;
42
- }, noop)) == null ? void 0 : _a.catch(noop);
43
- if (data !== void 0) {
44
- return { data };
45
- }
46
- return void 0;
47
- }
48
- export {
49
- pendingThenable,
50
- tryResolveSync
51
- };
52
- //# sourceMappingURL=thenable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/thenable.ts"],"sourcesContent":["/**\n * Thenable types which matches React's types for promises\n *\n * React seemingly uses `.status`, `.value` and `.reason` properties on a promises to optimistically unwrap data from promises\n *\n * @see https://github.com/facebook/react/blob/main/packages/shared/ReactTypes.js#L112-L138\n * @see https://github.com/facebook/react/blob/4f604941569d2e8947ce1460a0b2997e835f37b9/packages/react-debug-tools/src/ReactDebugHooks.js#L224-L227\n */\n\nimport { noop } from './utils'\n\ninterface Fulfilled<T> {\n status: 'fulfilled'\n value: T\n}\ninterface Rejected {\n status: 'rejected'\n reason: unknown\n}\ninterface Pending<T> {\n status: 'pending'\n\n /**\n * Resolve the promise with a value.\n * Will remove the `resolve` and `reject` properties from the promise.\n */\n resolve: (value: T) => void\n /**\n * Reject the promise with a reason.\n * Will remove the `resolve` and `reject` properties from the promise.\n */\n reject: (reason: unknown) => void\n}\n\nexport type FulfilledThenable<T> = Promise<T> & Fulfilled<T>\nexport type RejectedThenable<T> = Promise<T> & Rejected\nexport type PendingThenable<T> = Promise<T> & Pending<T>\n\nexport type Thenable<T> =\n | FulfilledThenable<T>\n | RejectedThenable<T>\n | PendingThenable<T>\n\nexport function pendingThenable<T>(): PendingThenable<T> {\n let resolve: Pending<T>['resolve']\n let reject: Pending<T>['reject']\n // this could use `Promise.withResolvers()` in the future\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve\n reject = _reject\n }) as PendingThenable<T>\n\n thenable.status = 'pending'\n thenable.catch(() => {\n // prevent unhandled rejection errors\n })\n\n function finalize(data: Fulfilled<T> | Rejected) {\n Object.assign(thenable, data)\n\n // clear pending props to avoid calling them twice\n delete (thenable as Partial<PendingThenable<T>>).resolve\n delete (thenable as Partial<PendingThenable<T>>).reject\n }\n\n thenable.resolve = (value) => {\n finalize({\n status: 'fulfilled',\n value,\n })\n\n resolve(value)\n }\n thenable.reject = (reason) => {\n finalize({\n status: 'rejected',\n reason,\n })\n\n reject(reason)\n }\n\n return thenable\n}\n\n/**\n * This function takes a Promise-like input and detects whether the data\n * is synchronously available or not.\n *\n * It does not inspect .status, .value or .reason properties of the promise,\n * as those are not always available, and the .status of React's promises\n * should not be considered part of the public API.\n */\nexport function tryResolveSync(promise: Promise<unknown> | Thenable<unknown>) {\n let data: unknown\n\n promise\n .then((result) => {\n data = result\n return result\n }, noop)\n // .catch can be unavailable on certain kinds of thenable's\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n ?.catch(noop)\n\n if (data !== undefined) {\n return { data }\n }\n\n return undefined\n}\n"],"mappings":";;;AASA,SAAS,YAAY;AAkCd,SAAS,kBAAyC;AACvD,MAAI;AACJ,MAAI;AAEJ,QAAM,WAAW,IAAI,QAAQ,CAAC,UAAU,YAAY;AAClD,cAAU;AACV,aAAS;AAAA,EACX,CAAC;AAED,WAAS,SAAS;AAClB,WAAS,MAAM,MAAM;AAAA,EAErB,CAAC;AAED,WAAS,SAAS,MAA+B;AAC/C,WAAO,OAAO,UAAU,IAAI;AAG5B,WAAQ,SAAyC;AACjD,WAAQ,SAAyC;AAAA,EACnD;AAEA,WAAS,UAAU,CAAC,UAAU;AAC5B,aAAS;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,YAAQ,KAAK;AAAA,EACf;AACA,WAAS,SAAS,CAAC,WAAW;AAC5B,aAAS;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AAAA,EACf;AAEA,SAAO;AACT;AAUO,SAAS,eAAe,SAA+C;AA7F9E;AA8FE,MAAI;AAEJ,gBACG,KAAK,CAAC,WAAW;AAChB,WAAO;AACP,WAAO;AAAA,EACT,GAAG,IAAI,MAJT,mBAOI,MAAM;AAEV,MAAI,SAAS,QAAW;AACtB,WAAO,EAAE,KAAK;AAAA,EAChB;AAEA,SAAO;AACT;","names":[]}
@@ -1,110 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __typeError = (msg) => {
7
- throw TypeError(msg);
8
- };
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
23
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
25
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
26
-
27
- // src/timeoutManager.ts
28
- var timeoutManager_exports = {};
29
- __export(timeoutManager_exports, {
30
- TimeoutManager: () => TimeoutManager,
31
- defaultTimeoutProvider: () => defaultTimeoutProvider,
32
- systemSetTimeoutZero: () => systemSetTimeoutZero,
33
- timeoutManager: () => timeoutManager
34
- });
35
- module.exports = __toCommonJS(timeoutManager_exports);
36
- var defaultTimeoutProvider = {
37
- // We need the wrapper function syntax below instead of direct references to
38
- // global setTimeout etc.
39
- //
40
- // BAD: `setTimeout: setTimeout`
41
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
42
- //
43
- // If we use direct references here, then anything that wants to spy on or
44
- // replace the global setTimeout (like tests) won't work since we'll already
45
- // have a hard reference to the original implementation at the time when this
46
- // file was imported.
47
- setTimeout: (callback, delay) => setTimeout(callback, delay),
48
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
49
- setInterval: (callback, delay) => setInterval(callback, delay),
50
- clearInterval: (intervalId) => clearInterval(intervalId)
51
- };
52
- var _provider, _providerCalled;
53
- var TimeoutManager = class {
54
- constructor() {
55
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
56
- // type at app boot; and if we leave that type, then any new timer provider
57
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
58
- //
59
- // We settle for type safety for the TimeoutProvider type, and accept that
60
- // this class is unsafe internally to allow for extension.
61
- __privateAdd(this, _provider, defaultTimeoutProvider);
62
- __privateAdd(this, _providerCalled, false);
63
- }
64
- setTimeoutProvider(provider) {
65
- if (process.env.NODE_ENV !== "production") {
66
- if (__privateGet(this, _providerCalled) && provider !== __privateGet(this, _provider)) {
67
- console.error(
68
- `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
69
- { previous: __privateGet(this, _provider), provider }
70
- );
71
- }
72
- }
73
- __privateSet(this, _provider, provider);
74
- if (process.env.NODE_ENV !== "production") {
75
- __privateSet(this, _providerCalled, false);
76
- }
77
- }
78
- setTimeout(callback, delay) {
79
- if (process.env.NODE_ENV !== "production") {
80
- __privateSet(this, _providerCalled, true);
81
- }
82
- return __privateGet(this, _provider).setTimeout(callback, delay);
83
- }
84
- clearTimeout(timeoutId) {
85
- __privateGet(this, _provider).clearTimeout(timeoutId);
86
- }
87
- setInterval(callback, delay) {
88
- if (process.env.NODE_ENV !== "production") {
89
- __privateSet(this, _providerCalled, true);
90
- }
91
- return __privateGet(this, _provider).setInterval(callback, delay);
92
- }
93
- clearInterval(intervalId) {
94
- __privateGet(this, _provider).clearInterval(intervalId);
95
- }
96
- };
97
- _provider = new WeakMap();
98
- _providerCalled = new WeakMap();
99
- var timeoutManager = new TimeoutManager();
100
- function systemSetTimeoutZero(callback) {
101
- setTimeout(callback, 0);
102
- }
103
- // Annotate the CommonJS export names for ESM import in node:
104
- 0 && (module.exports = {
105
- TimeoutManager,
106
- defaultTimeoutProvider,
107
- systemSetTimeoutZero,
108
- timeoutManager
109
- });
110
- //# sourceMappingURL=timeoutManager.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/timeoutManager.ts"],"sourcesContent":["/**\n * {@link TimeoutManager} does not support passing arguments to the callback.\n *\n * `(_: void)` is the argument type inferred by TypeScript's default typings for\n * `setTimeout(cb, number)`.\n * If we don't accept a single void argument, then\n * `new Promise(resolve => timeoutManager.setTimeout(resolve, N))` is a type error.\n */\nexport type TimeoutCallback = (_: void) => void\n\n/**\n * Wrapping `setTimeout` is awkward from a typing perspective because platform\n * typings may extend the return type of `setTimeout`. For example, NodeJS\n * typings add `NodeJS.Timeout`; but a non-default `timeoutManager` may not be\n * able to return such a type.\n */\nexport type ManagedTimerId = number | { [Symbol.toPrimitive]: () => number }\n\n/**\n * Backend for timer functions.\n */\nexport type TimeoutProvider<TTimerId extends ManagedTimerId = ManagedTimerId> =\n {\n readonly setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId\n readonly clearTimeout: (timeoutId: TTimerId | undefined) => void\n\n readonly setInterval: (callback: TimeoutCallback, delay: number) => TTimerId\n readonly clearInterval: (intervalId: TTimerId | undefined) => void\n }\n\nexport const defaultTimeoutProvider: TimeoutProvider<\n ReturnType<typeof setTimeout>\n> = {\n // We need the wrapper function syntax below instead of direct references to\n // global setTimeout etc.\n //\n // BAD: `setTimeout: setTimeout`\n // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`\n //\n // If we use direct references here, then anything that wants to spy on or\n // replace the global setTimeout (like tests) won't work since we'll already\n // have a hard reference to the original implementation at the time when this\n // file was imported.\n setTimeout: (callback, delay) => setTimeout(callback, delay),\n clearTimeout: (timeoutId) => clearTimeout(timeoutId),\n\n setInterval: (callback, delay) => setInterval(callback, delay),\n clearInterval: (intervalId) => clearInterval(intervalId),\n}\n\n/**\n * Allows customization of how timeouts are created.\n *\n * @tanstack/query-core makes liberal use of timeouts to implement `staleTime`\n * and `gcTime`. The default TimeoutManager provider uses the platform's global\n * `setTimeout` implementation, which is known to have scalability issues with\n * thousands of timeouts on the event loop.\n *\n * If you hit this limitation, consider providing a custom TimeoutProvider that\n * coalesces timeouts.\n */\nexport class TimeoutManager implements Omit<TimeoutProvider, 'name'> {\n // We cannot have TimeoutManager<T> as we must instantiate it with a concrete\n // type at app boot; and if we leave that type, then any new timer provider\n // would need to support ReturnType<typeof setTimeout>, which is infeasible.\n //\n // We settle for type safety for the TimeoutProvider type, and accept that\n // this class is unsafe internally to allow for extension.\n #provider: TimeoutProvider<any> = defaultTimeoutProvider\n #providerCalled = false\n\n setTimeoutProvider<TTimerId extends ManagedTimerId>(\n provider: TimeoutProvider<TTimerId>,\n ): void {\n if (process.env.NODE_ENV !== 'production') {\n if (this.#providerCalled && provider !== this.#provider) {\n // After changing providers, `clearTimeout` will not work as expected for\n // timeouts from the previous provider.\n //\n // Since they may allocate the same timeout ID, clearTimeout may cancel an\n // arbitrary different timeout, or unexpected no-op.\n //\n // We could protect against this by mixing the timeout ID bits\n // deterministically with some per-provider bits.\n //\n // We could internally queue `setTimeout` calls to `TimeoutManager` until\n // some API call to set the initial provider.\n console.error(\n `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,\n { previous: this.#provider, provider },\n )\n }\n }\n\n this.#provider = provider\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = false\n }\n }\n\n setTimeout(callback: TimeoutCallback, delay: number): ManagedTimerId {\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = true\n }\n return this.#provider.setTimeout(callback, delay)\n }\n\n clearTimeout(timeoutId: ManagedTimerId | undefined): void {\n this.#provider.clearTimeout(timeoutId)\n }\n\n setInterval(callback: TimeoutCallback, delay: number): ManagedTimerId {\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = true\n }\n return this.#provider.setInterval(callback, delay)\n }\n\n clearInterval(intervalId: ManagedTimerId | undefined): void {\n this.#provider.clearInterval(intervalId)\n }\n}\n\nexport const timeoutManager = new TimeoutManager()\n\n/**\n * In many cases code wants to delay to the next event loop tick; this is not\n * mediated by {@link timeoutManager}.\n *\n * This function is provided to make auditing the `tanstack/query-core` for\n * incorrect use of system `setTimeout` easier.\n */\nexport function systemSetTimeoutZero(callback: TimeoutCallback): void {\n setTimeout(callback, 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,IAAM,yBAET;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWF,YAAY,CAAC,UAAU,UAAU,WAAW,UAAU,KAAK;AAAA,EAC3D,cAAc,CAAC,cAAc,aAAa,SAAS;AAAA,EAEnD,aAAa,CAAC,UAAU,UAAU,YAAY,UAAU,KAAK;AAAA,EAC7D,eAAe,CAAC,eAAe,cAAc,UAAU;AACzD;AAhDA;AA6DO,IAAM,iBAAN,MAA8D;AAAA,EAA9D;AAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAkC;AAClC,wCAAkB;AAAA;AAAA,EAElB,mBACE,UACM;AACN,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAI,mBAAK,oBAAmB,aAAa,mBAAK,YAAW;AAYvD,gBAAQ;AAAA,UACN;AAAA,UACA,EAAE,UAAU,mBAAK,YAAW,SAAS;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAEA,uBAAK,WAAY;AACjB,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AAAA,EACF;AAAA,EAEA,WAAW,UAA2B,OAA+B;AACnE,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AACA,WAAO,mBAAK,WAAU,WAAW,UAAU,KAAK;AAAA,EAClD;AAAA,EAEA,aAAa,WAA6C;AACxD,uBAAK,WAAU,aAAa,SAAS;AAAA,EACvC;AAAA,EAEA,YAAY,UAA2B,OAA+B;AACpE,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AACA,WAAO,mBAAK,WAAU,YAAY,UAAU,KAAK;AAAA,EACnD;AAAA,EAEA,cAAc,YAA8C;AAC1D,uBAAK,WAAU,cAAc,UAAU;AAAA,EACzC;AACF;AArDE;AACA;AAsDK,IAAM,iBAAiB,IAAI,eAAe;AAS1C,SAAS,qBAAqB,UAAiC;AACpE,aAAW,UAAU,CAAC;AACxB;","names":[]}
@@ -1,7 +0,0 @@
1
- export { systemSetTimeoutZero } from './_tsup-dts-rollup.cjs';
2
- export { TimeoutCallback_alias_1 as TimeoutCallback } from './_tsup-dts-rollup.cjs';
3
- export { ManagedTimerId_alias_1 as ManagedTimerId } from './_tsup-dts-rollup.cjs';
4
- export { TimeoutProvider_alias_1 as TimeoutProvider } from './_tsup-dts-rollup.cjs';
5
- export { defaultTimeoutProvider } from './_tsup-dts-rollup.cjs';
6
- export { TimeoutManager } from './_tsup-dts-rollup.cjs';
7
- export { timeoutManager_alias_1 as timeoutManager } from './_tsup-dts-rollup.cjs';
@@ -1,7 +0,0 @@
1
- export { systemSetTimeoutZero } from './_tsup-dts-rollup.js';
2
- export { TimeoutCallback_alias_1 as TimeoutCallback } from './_tsup-dts-rollup.js';
3
- export { ManagedTimerId_alias_1 as ManagedTimerId } from './_tsup-dts-rollup.js';
4
- export { TimeoutProvider_alias_1 as TimeoutProvider } from './_tsup-dts-rollup.js';
5
- export { defaultTimeoutProvider } from './_tsup-dts-rollup.js';
6
- export { TimeoutManager } from './_tsup-dts-rollup.js';
7
- export { timeoutManager_alias_1 as timeoutManager } from './_tsup-dts-rollup.js';
@@ -1,81 +0,0 @@
1
- import {
2
- __privateAdd,
3
- __privateGet,
4
- __privateSet
5
- } from "./chunk-PXG64RU4.js";
6
-
7
- // src/timeoutManager.ts
8
- var defaultTimeoutProvider = {
9
- // We need the wrapper function syntax below instead of direct references to
10
- // global setTimeout etc.
11
- //
12
- // BAD: `setTimeout: setTimeout`
13
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
14
- //
15
- // If we use direct references here, then anything that wants to spy on or
16
- // replace the global setTimeout (like tests) won't work since we'll already
17
- // have a hard reference to the original implementation at the time when this
18
- // file was imported.
19
- setTimeout: (callback, delay) => setTimeout(callback, delay),
20
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
21
- setInterval: (callback, delay) => setInterval(callback, delay),
22
- clearInterval: (intervalId) => clearInterval(intervalId)
23
- };
24
- var _provider, _providerCalled;
25
- var TimeoutManager = class {
26
- constructor() {
27
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
28
- // type at app boot; and if we leave that type, then any new timer provider
29
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
30
- //
31
- // We settle for type safety for the TimeoutProvider type, and accept that
32
- // this class is unsafe internally to allow for extension.
33
- __privateAdd(this, _provider, defaultTimeoutProvider);
34
- __privateAdd(this, _providerCalled, false);
35
- }
36
- setTimeoutProvider(provider) {
37
- if (process.env.NODE_ENV !== "production") {
38
- if (__privateGet(this, _providerCalled) && provider !== __privateGet(this, _provider)) {
39
- console.error(
40
- `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
41
- { previous: __privateGet(this, _provider), provider }
42
- );
43
- }
44
- }
45
- __privateSet(this, _provider, provider);
46
- if (process.env.NODE_ENV !== "production") {
47
- __privateSet(this, _providerCalled, false);
48
- }
49
- }
50
- setTimeout(callback, delay) {
51
- if (process.env.NODE_ENV !== "production") {
52
- __privateSet(this, _providerCalled, true);
53
- }
54
- return __privateGet(this, _provider).setTimeout(callback, delay);
55
- }
56
- clearTimeout(timeoutId) {
57
- __privateGet(this, _provider).clearTimeout(timeoutId);
58
- }
59
- setInterval(callback, delay) {
60
- if (process.env.NODE_ENV !== "production") {
61
- __privateSet(this, _providerCalled, true);
62
- }
63
- return __privateGet(this, _provider).setInterval(callback, delay);
64
- }
65
- clearInterval(intervalId) {
66
- __privateGet(this, _provider).clearInterval(intervalId);
67
- }
68
- };
69
- _provider = new WeakMap();
70
- _providerCalled = new WeakMap();
71
- var timeoutManager = new TimeoutManager();
72
- function systemSetTimeoutZero(callback) {
73
- setTimeout(callback, 0);
74
- }
75
- export {
76
- TimeoutManager,
77
- defaultTimeoutProvider,
78
- systemSetTimeoutZero,
79
- timeoutManager
80
- };
81
- //# sourceMappingURL=timeoutManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/timeoutManager.ts"],"sourcesContent":["/**\n * {@link TimeoutManager} does not support passing arguments to the callback.\n *\n * `(_: void)` is the argument type inferred by TypeScript's default typings for\n * `setTimeout(cb, number)`.\n * If we don't accept a single void argument, then\n * `new Promise(resolve => timeoutManager.setTimeout(resolve, N))` is a type error.\n */\nexport type TimeoutCallback = (_: void) => void\n\n/**\n * Wrapping `setTimeout` is awkward from a typing perspective because platform\n * typings may extend the return type of `setTimeout`. For example, NodeJS\n * typings add `NodeJS.Timeout`; but a non-default `timeoutManager` may not be\n * able to return such a type.\n */\nexport type ManagedTimerId = number | { [Symbol.toPrimitive]: () => number }\n\n/**\n * Backend for timer functions.\n */\nexport type TimeoutProvider<TTimerId extends ManagedTimerId = ManagedTimerId> =\n {\n readonly setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId\n readonly clearTimeout: (timeoutId: TTimerId | undefined) => void\n\n readonly setInterval: (callback: TimeoutCallback, delay: number) => TTimerId\n readonly clearInterval: (intervalId: TTimerId | undefined) => void\n }\n\nexport const defaultTimeoutProvider: TimeoutProvider<\n ReturnType<typeof setTimeout>\n> = {\n // We need the wrapper function syntax below instead of direct references to\n // global setTimeout etc.\n //\n // BAD: `setTimeout: setTimeout`\n // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`\n //\n // If we use direct references here, then anything that wants to spy on or\n // replace the global setTimeout (like tests) won't work since we'll already\n // have a hard reference to the original implementation at the time when this\n // file was imported.\n setTimeout: (callback, delay) => setTimeout(callback, delay),\n clearTimeout: (timeoutId) => clearTimeout(timeoutId),\n\n setInterval: (callback, delay) => setInterval(callback, delay),\n clearInterval: (intervalId) => clearInterval(intervalId),\n}\n\n/**\n * Allows customization of how timeouts are created.\n *\n * @tanstack/query-core makes liberal use of timeouts to implement `staleTime`\n * and `gcTime`. The default TimeoutManager provider uses the platform's global\n * `setTimeout` implementation, which is known to have scalability issues with\n * thousands of timeouts on the event loop.\n *\n * If you hit this limitation, consider providing a custom TimeoutProvider that\n * coalesces timeouts.\n */\nexport class TimeoutManager implements Omit<TimeoutProvider, 'name'> {\n // We cannot have TimeoutManager<T> as we must instantiate it with a concrete\n // type at app boot; and if we leave that type, then any new timer provider\n // would need to support ReturnType<typeof setTimeout>, which is infeasible.\n //\n // We settle for type safety for the TimeoutProvider type, and accept that\n // this class is unsafe internally to allow for extension.\n #provider: TimeoutProvider<any> = defaultTimeoutProvider\n #providerCalled = false\n\n setTimeoutProvider<TTimerId extends ManagedTimerId>(\n provider: TimeoutProvider<TTimerId>,\n ): void {\n if (process.env.NODE_ENV !== 'production') {\n if (this.#providerCalled && provider !== this.#provider) {\n // After changing providers, `clearTimeout` will not work as expected for\n // timeouts from the previous provider.\n //\n // Since they may allocate the same timeout ID, clearTimeout may cancel an\n // arbitrary different timeout, or unexpected no-op.\n //\n // We could protect against this by mixing the timeout ID bits\n // deterministically with some per-provider bits.\n //\n // We could internally queue `setTimeout` calls to `TimeoutManager` until\n // some API call to set the initial provider.\n console.error(\n `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,\n { previous: this.#provider, provider },\n )\n }\n }\n\n this.#provider = provider\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = false\n }\n }\n\n setTimeout(callback: TimeoutCallback, delay: number): ManagedTimerId {\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = true\n }\n return this.#provider.setTimeout(callback, delay)\n }\n\n clearTimeout(timeoutId: ManagedTimerId | undefined): void {\n this.#provider.clearTimeout(timeoutId)\n }\n\n setInterval(callback: TimeoutCallback, delay: number): ManagedTimerId {\n if (process.env.NODE_ENV !== 'production') {\n this.#providerCalled = true\n }\n return this.#provider.setInterval(callback, delay)\n }\n\n clearInterval(intervalId: ManagedTimerId | undefined): void {\n this.#provider.clearInterval(intervalId)\n }\n}\n\nexport const timeoutManager = new TimeoutManager()\n\n/**\n * In many cases code wants to delay to the next event loop tick; this is not\n * mediated by {@link timeoutManager}.\n *\n * This function is provided to make auditing the `tanstack/query-core` for\n * incorrect use of system `setTimeout` easier.\n */\nexport function systemSetTimeoutZero(callback: TimeoutCallback): void {\n setTimeout(callback, 0)\n}\n"],"mappings":";;;;;;;AA8BO,IAAM,yBAET;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWF,YAAY,CAAC,UAAU,UAAU,WAAW,UAAU,KAAK;AAAA,EAC3D,cAAc,CAAC,cAAc,aAAa,SAAS;AAAA,EAEnD,aAAa,CAAC,UAAU,UAAU,YAAY,UAAU,KAAK;AAAA,EAC7D,eAAe,CAAC,eAAe,cAAc,UAAU;AACzD;AAhDA;AA6DO,IAAM,iBAAN,MAA8D;AAAA,EAA9D;AAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAkC;AAClC,wCAAkB;AAAA;AAAA,EAElB,mBACE,UACM;AACN,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAI,mBAAK,oBAAmB,aAAa,mBAAK,YAAW;AAYvD,gBAAQ;AAAA,UACN;AAAA,UACA,EAAE,UAAU,mBAAK,YAAW,SAAS;AAAA,QACvC;AAAA,MACF;AAAA,IACF;AAEA,uBAAK,WAAY;AACjB,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AAAA,EACF;AAAA,EAEA,WAAW,UAA2B,OAA+B;AACnE,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AACA,WAAO,mBAAK,WAAU,WAAW,UAAU,KAAK;AAAA,EAClD;AAAA,EAEA,aAAa,WAA6C;AACxD,uBAAK,WAAU,aAAa,SAAS;AAAA,EACvC;AAAA,EAEA,YAAY,UAA2B,OAA+B;AACpE,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,yBAAK,iBAAkB;AAAA,IACzB;AACA,WAAO,mBAAK,WAAU,YAAY,UAAU,KAAK;AAAA,EACnD;AAAA,EAEA,cAAc,YAA8C;AAC1D,uBAAK,WAAU,cAAc,UAAU;AAAA,EACzC;AACF;AArDE;AACA;AAsDK,IAAM,iBAAiB,IAAI,eAAe;AAS1C,SAAS,qBAAqB,UAAiC;AACpE,aAAW,UAAU,CAAC;AACxB;","names":[]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/types.ts
21
- var types_exports = {};
22
- __export(types_exports, {
23
- dataTagErrorSymbol: () => dataTagErrorSymbol,
24
- dataTagSymbol: () => dataTagSymbol,
25
- unsetMarker: () => unsetMarker
26
- });
27
- module.exports = __toCommonJS(types_exports);
28
- var dataTagSymbol = /* @__PURE__ */ Symbol("dataTagSymbol");
29
- var dataTagErrorSymbol = /* @__PURE__ */ Symbol("dataTagErrorSymbol");
30
- var unsetMarker = /* @__PURE__ */ Symbol("unsetMarker");
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- dataTagErrorSymbol,
34
- dataTagSymbol,
35
- unsetMarker
36
- });
37
- //# sourceMappingURL=types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport type { QueryClient } from './queryClient'\nimport type { DehydrateOptions, HydrateOptions } from './hydration'\nimport type { MutationState } from './mutation'\nimport type { FetchDirection, Query, QueryBehavior } from './query'\nimport type { RetryDelayValue, RetryValue } from './retryer'\nimport type { QueryFilters, QueryTypeFilter, SkipToken } from './utils'\nimport type { QueryCache } from './queryCache'\nimport type { MutationCache } from './mutationCache'\n\nexport type NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DistributiveOmit<\n TObject,\n TKey extends keyof TObject,\n> = TObject extends any ? Omit<TObject, TKey> : never\n\nexport type OmitKeyof<\n TObject,\n TKey extends TStrictly extends 'safely'\n ?\n | keyof TObject\n | (string & Record<never, never>)\n | (number & Record<never, never>)\n | (symbol & Record<never, never>)\n : keyof TObject,\n TStrictly extends 'strictly' | 'safely' = 'strictly',\n> = Omit<TObject, TKey>\n\nexport type Override<TTargetA, TTargetB> = {\n [AKey in keyof TTargetA]: AKey extends keyof TTargetB\n ? TTargetB[AKey]\n : TTargetA[AKey]\n}\n\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\n\nexport interface Register {\n // defaultError: Error\n // queryMeta: Record<string, unknown>\n // mutationMeta: Record<string, unknown>\n // queryKey: ReadonlyArray<unknown>\n // mutationKey: ReadonlyArray<unknown>\n}\n\nexport type DefaultError = Register extends {\n defaultError: infer TError\n}\n ? TError\n : Error\n\nexport type QueryKey = Register extends {\n queryKey: infer TQueryKey\n}\n ? TQueryKey extends ReadonlyArray<unknown>\n ? TQueryKey\n : TQueryKey extends Array<unknown>\n ? TQueryKey\n : ReadonlyArray<unknown>\n : ReadonlyArray<unknown>\n\nexport const dataTagSymbol = Symbol('dataTagSymbol')\nexport type dataTagSymbol = typeof dataTagSymbol\nexport const dataTagErrorSymbol = Symbol('dataTagErrorSymbol')\nexport type dataTagErrorSymbol = typeof dataTagErrorSymbol\nexport const unsetMarker = Symbol('unsetMarker')\nexport type UnsetMarker = typeof unsetMarker\nexport type AnyDataTag = {\n [dataTagSymbol]: any\n [dataTagErrorSymbol]: any\n}\nexport type DataTag<\n TType,\n TValue,\n TError = UnsetMarker,\n> = TType extends AnyDataTag\n ? TType\n : TType & {\n [dataTagSymbol]: TValue\n [dataTagErrorSymbol]: TError\n }\n\nexport type InferDataFromTag<TQueryFnData, TTaggedQueryKey extends QueryKey> =\n TTaggedQueryKey extends DataTag<unknown, infer TaggedValue, unknown>\n ? TaggedValue\n : TQueryFnData\n\nexport type InferErrorFromTag<TError, TTaggedQueryKey extends QueryKey> =\n TTaggedQueryKey extends DataTag<unknown, unknown, infer TaggedError>\n ? TaggedError extends UnsetMarker\n ? TError\n : TaggedError\n : TError\n\nexport type QueryFunction<\n T = unknown,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = (context: QueryFunctionContext<TQueryKey, TPageParam>) => T | Promise<T>\n\nexport type StaleTime = number | 'static'\n\nexport type StaleTimeFunction<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> =\n | StaleTime\n | ((query: Query<TQueryFnData, TError, TData, TQueryKey>) => StaleTime)\n\nexport type Enabled<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> =\n | boolean\n | ((query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean)\n\nexport type QueryPersister<\n T = unknown,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = [TPageParam] extends [never]\n ? (\n queryFn: QueryFunction<T, TQueryKey, never>,\n context: QueryFunctionContext<TQueryKey>,\n query: Query,\n ) => T | Promise<T>\n : (\n queryFn: QueryFunction<T, TQueryKey, TPageParam>,\n context: QueryFunctionContext<TQueryKey>,\n query: Query,\n ) => T | Promise<T>\n\nexport type QueryFunctionContext<\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = [TPageParam] extends [never]\n ? {\n client: QueryClient\n queryKey: TQueryKey\n signal: AbortSignal\n meta: QueryMeta | undefined\n pageParam?: unknown\n /**\n * @deprecated\n * if you want access to the direction, you can add it to the pageParam\n */\n direction?: unknown\n }\n : {\n client: QueryClient\n queryKey: TQueryKey\n signal: AbortSignal\n pageParam: TPageParam\n /**\n * @deprecated\n * if you want access to the direction, you can add it to the pageParam\n */\n direction: FetchDirection\n meta: QueryMeta | undefined\n }\n\nexport type InitialDataFunction<T> = () => T | undefined\n\ntype NonFunctionGuard<T> = T extends Function ? never : T\n\nexport type PlaceholderDataFunction<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = (\n previousData: TQueryData | undefined,\n previousQuery: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => TQueryData | undefined\n\nexport type QueriesPlaceholderDataFunction<TQueryData> = (\n previousData: undefined,\n previousQuery: undefined,\n) => TQueryData | undefined\n\nexport type QueryKeyHashFunction<TQueryKey extends QueryKey> = (\n queryKey: TQueryKey,\n) => string\n\nexport type GetPreviousPageParamFunction<TPageParam, TQueryFnData = unknown> = (\n firstPage: TQueryFnData,\n allPages: Array<TQueryFnData>,\n firstPageParam: TPageParam,\n allPageParams: Array<TPageParam>,\n) => TPageParam | undefined | null\n\nexport type GetNextPageParamFunction<TPageParam, TQueryFnData = unknown> = (\n lastPage: TQueryFnData,\n allPages: Array<TQueryFnData>,\n lastPageParam: TPageParam,\n allPageParams: Array<TPageParam>,\n) => TPageParam | undefined | null\n\nexport interface InfiniteData<TData, TPageParam = unknown> {\n pages: Array<TData>\n pageParams: Array<TPageParam>\n}\n\nexport type QueryMeta = Register extends {\n queryMeta: infer TQueryMeta\n}\n ? TQueryMeta extends Record<string, unknown>\n ? TQueryMeta\n : Record<string, unknown>\n : Record<string, unknown>\n\nexport type NetworkMode = 'online' | 'always' | 'offlineFirst'\n\nexport type NotifyOnChangeProps =\n | Array<keyof InfiniteQueryObserverResult>\n | 'all'\n | undefined\n | (() => Array<keyof InfiniteQueryObserverResult> | 'all' | undefined)\n\nexport interface QueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> {\n /**\n * If `false`, failed queries will not retry by default.\n * If `true`, failed queries will retry infinitely., failureCount: num\n * If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.\n * If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.\n */\n retry?: RetryValue<TError>\n retryDelay?: RetryDelayValue<TError>\n networkMode?: NetworkMode\n /**\n * The time in milliseconds that unused/inactive cache data remains in memory.\n * When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.\n * When different garbage collection times are specified, the longest one will be used.\n * Setting it to `Infinity` will disable garbage collection.\n */\n gcTime?: number\n queryFn?: QueryFunction<TQueryFnData, TQueryKey, TPageParam> | SkipToken\n persister?: QueryPersister<\n NoInfer<TQueryFnData>,\n NoInfer<TQueryKey>,\n NoInfer<TPageParam>\n >\n queryHash?: string\n queryKey?: TQueryKey\n queryKeyHashFn?: QueryKeyHashFunction<TQueryKey>\n initialData?: TData | InitialDataFunction<TData>\n initialDataUpdatedAt?: number | (() => number | undefined)\n behavior?: QueryBehavior<TQueryFnData, TError, TData, TQueryKey>\n /**\n * Set this to `false` to disable structural sharing between query results.\n * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.\n * Defaults to `true`.\n */\n structuralSharing?:\n | boolean\n | ((oldData: unknown | undefined, newData: unknown) => unknown)\n _defaulted?: boolean\n /**\n * Additional payload to be stored on each query.\n * Use this property to pass information that can be used in other places.\n */\n meta?: QueryMeta\n /**\n * Maximum number of pages to store in the data of an infinite query.\n */\n maxPages?: number\n}\n\nexport interface InitialPageParam<TPageParam = unknown> {\n initialPageParam: TPageParam\n}\n\nexport interface InfiniteQueryPageParamsOptions<\n TQueryFnData = unknown,\n TPageParam = unknown,\n> extends InitialPageParam<TPageParam> {\n /**\n * This function can be set to automatically get the previous cursor for infinite queries.\n * The result will also be used to determine the value of `hasPreviousPage`.\n */\n getPreviousPageParam?: GetPreviousPageParamFunction<TPageParam, TQueryFnData>\n /**\n * This function can be set to automatically get the next cursor for infinite queries.\n * The result will also be used to determine the value of `hasNextPage`.\n */\n getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>\n}\n\nexport type ThrowOnError<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey extends QueryKey,\n> =\n | boolean\n | ((\n error: TError,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n ) => boolean)\n\nexport interface QueryObserverOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> extends WithRequired<\n QueryOptions<TQueryFnData, TError, TQueryData, TQueryKey, TPageParam>,\n 'queryKey'\n> {\n /**\n * Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys.\n * To refetch the query, use the `refetch` method returned from the `useQuery` instance.\n * Accepts a boolean or function that returns a boolean.\n * Defaults to `true`.\n */\n enabled?: Enabled<TQueryFnData, TError, TQueryData, TQueryKey>\n /**\n * The time in milliseconds after data is considered stale.\n * If set to `Infinity`, the data will never be considered stale.\n * If set to a function, the function will be executed with the query to compute a `staleTime`.\n * Defaults to `0`.\n */\n staleTime?: StaleTimeFunction<TQueryFnData, TError, TQueryData, TQueryKey>\n /**\n * If set to a number, the query will continuously refetch at this frequency in milliseconds.\n * If set to a function, the function will be executed with the latest data and query to compute a frequency\n * Defaults to `false`.\n */\n refetchInterval?:\n | number\n | false\n | ((\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n ) => number | false | undefined)\n /**\n * If set to `true`, the query will continue to refetch while their tab/window is in the background.\n * Defaults to `false`.\n */\n refetchIntervalInBackground?: boolean\n /**\n * If set to `true`, the query will refetch on window focus if the data is stale.\n * If set to `false`, the query will not refetch on window focus.\n * If set to `'always'`, the query will always refetch on window focus.\n * If set to a function, the function will be executed with the latest data and query to compute the value.\n * Defaults to `true`.\n */\n refetchOnWindowFocus?:\n | boolean\n | 'always'\n | ((\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n ) => boolean | 'always')\n /**\n * If set to `true`, the query will refetch on reconnect if the data is stale.\n * If set to `false`, the query will not refetch on reconnect.\n * If set to `'always'`, the query will always refetch on reconnect.\n * If set to a function, the function will be executed with the latest data and query to compute the value.\n * Defaults to the value of `networkOnline` (`true`)\n */\n refetchOnReconnect?:\n | boolean\n | 'always'\n | ((\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n ) => boolean | 'always')\n /**\n * If set to `true`, the query will refetch on mount if the data is stale.\n * If set to `false`, will disable additional instances of a query to trigger background refetch.\n * If set to `'always'`, the query will always refetch on mount.\n * If set to a function, the function will be executed with the latest data and query to compute the value\n * Defaults to `true`.\n */\n refetchOnMount?:\n | boolean\n | 'always'\n | ((\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n ) => boolean | 'always')\n /**\n * If set to `false`, the query will not be retried on mount if it contains an error.\n * Defaults to `true`.\n */\n retryOnMount?: boolean\n /**\n * If set, the component will only re-render if any of the listed properties change.\n * When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change.\n * When set to `'all'`, the component will re-render whenever a query is updated.\n * When set to a function, the function will be executed to compute the list of properties.\n * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change.\n */\n notifyOnChangeProps?: NotifyOnChangeProps\n /**\n * Whether errors should be thrown instead of setting the `error` property.\n * If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary.\n * If set to `false` and `suspense` is `false`, errors are returned as state.\n * If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`).\n * Defaults to `false`.\n */\n throwOnError?: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n /**\n * This option can be used to transform or select a part of the data returned by the query function.\n */\n select?: (data: TQueryData) => TData\n /**\n * If set to `true`, the query will suspend when `status === 'pending'`\n * and throw errors when `status === 'error'`.\n * Defaults to `false`.\n */\n suspense?: boolean\n /**\n * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided.\n */\n placeholderData?:\n | NonFunctionGuard<TQueryData>\n | PlaceholderDataFunction<\n NonFunctionGuard<TQueryData>,\n TError,\n NonFunctionGuard<TQueryData>,\n TQueryKey\n >\n\n _optimisticResults?: 'optimistic' | 'isRestoring'\n\n /**\n * Enable prefetching during rendering\n */\n experimental_prefetchInRender?: boolean\n}\n\nexport type WithRequired<TTarget, TKey extends keyof TTarget> = TTarget & {\n [_ in TKey]: {}\n}\n\nexport type DefaultedQueryObserverOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = WithRequired<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n 'throwOnError' | 'refetchOnReconnect' | 'queryHash'\n>\n\nexport interface InfiniteQueryObserverOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>\n extends\n QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n InfiniteData<TQueryFnData, TPageParam>,\n TQueryKey,\n TPageParam\n >,\n InfiniteQueryPageParamsOptions<TQueryFnData, TPageParam> {}\n\nexport type DefaultedInfiniteQueryObserverOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = WithRequired<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'throwOnError' | 'refetchOnReconnect' | 'queryHash'\n>\n\nexport interface FetchQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> extends WithRequired<\n QueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryKey'\n> {\n initialPageParam?: never\n /**\n * The time in milliseconds after data is considered stale.\n * If the data is fresh it will be returned from the cache.\n */\n staleTime?: StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey>\n}\n\nexport interface EnsureQueryDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> extends FetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> {\n revalidateIfStale?: boolean\n}\n\nexport type EnsureInfiniteQueryDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n revalidateIfStale?: boolean\n}\n\ntype FetchInfiniteQueryPages<TQueryFnData = unknown, TPageParam = unknown> =\n | { pages?: never }\n | {\n pages: number\n getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>\n }\n\nexport type FetchInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = Omit<\n FetchQueryOptions<\n TQueryFnData,\n TError,\n InfiniteData<TData, TPageParam>,\n TQueryKey,\n TPageParam\n >,\n 'initialPageParam'\n> &\n InitialPageParam<TPageParam> &\n FetchInfiniteQueryPages<TQueryFnData, TPageParam>\n\nexport interface ResultOptions {\n throwOnError?: boolean\n}\n\nexport interface RefetchOptions extends ResultOptions {\n /**\n * If set to `true`, a currently running request will be cancelled before a new request is made\n *\n * If set to `false`, no refetch will be made if there is already a request running.\n *\n * Defaults to `true`.\n */\n cancelRefetch?: boolean\n}\n\nexport interface InvalidateQueryFilters<\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryFilters<TQueryKey> {\n refetchType?: QueryTypeFilter | 'none'\n}\n\nexport interface RefetchQueryFilters<\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryFilters<TQueryKey> {}\n\nexport interface InvalidateOptions extends RefetchOptions {}\nexport interface ResetOptions extends RefetchOptions {}\n\nexport interface FetchNextPageOptions extends ResultOptions {\n /**\n * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time,\n * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.\n *\n * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved.\n *\n * Defaults to `true`.\n */\n cancelRefetch?: boolean\n}\n\nexport interface FetchPreviousPageOptions extends ResultOptions {\n /**\n * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time,\n * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.\n *\n * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved.\n *\n * Defaults to `true`.\n */\n cancelRefetch?: boolean\n}\n\nexport type QueryStatus = 'pending' | 'error' | 'success'\nexport type FetchStatus = 'fetching' | 'paused' | 'idle'\n\nexport interface QueryObserverBaseResult<\n TData = unknown,\n TError = DefaultError,\n> {\n /**\n * The last successfully resolved data for the query.\n */\n data: TData | undefined\n /**\n * The timestamp for when the query most recently returned the `status` as `\"success\"`.\n */\n dataUpdatedAt: number\n /**\n * The error object for the query, if an error was thrown.\n * - Defaults to `null`.\n */\n error: TError | null\n /**\n * The timestamp for when the query most recently returned the `status` as `\"error\"`.\n */\n errorUpdatedAt: number\n /**\n * The failure count for the query.\n * - Incremented every time the query fails.\n * - Reset to `0` when the query succeeds.\n */\n failureCount: number\n /**\n * The failure reason for the query retry.\n * - Reset to `null` when the query succeeds.\n */\n failureReason: TError | null\n /**\n * The sum of all errors.\n */\n errorUpdateCount: number\n /**\n * A derived boolean from the `status` variable, provided for convenience.\n * - `true` if the query attempt resulted in an error.\n */\n isError: boolean\n /**\n * Will be `true` if the query has been fetched.\n */\n isFetched: boolean\n /**\n * Will be `true` if the query has been fetched after the component mounted.\n * - This property can be used to not show any previously cached data.\n */\n isFetchedAfterMount: boolean\n /**\n * A derived boolean from the `fetchStatus` variable, provided for convenience.\n * - `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.\n */\n isFetching: boolean\n /**\n * Is `true` whenever the first fetch for a query is in-flight.\n * - Is the same as `isFetching && isPending`.\n */\n isLoading: boolean\n /**\n * Will be `pending` if there's no cached data and no query attempt was finished yet.\n */\n isPending: boolean\n /**\n * Will be `true` if the query failed while fetching for the first time.\n */\n isLoadingError: boolean\n /**\n * @deprecated `isInitialLoading` is being deprecated in favor of `isLoading`\n * and will be removed in the next major version.\n */\n isInitialLoading: boolean\n /**\n * A derived boolean from the `fetchStatus` variable, provided for convenience.\n * - The query wanted to fetch, but has been `paused`.\n */\n isPaused: boolean\n /**\n * Will be `true` if the data shown is the placeholder data.\n */\n isPlaceholderData: boolean\n /**\n * Will be `true` if the query failed while refetching.\n */\n isRefetchError: boolean\n /**\n * Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.\n * - Is the same as `isFetching && !isPending`.\n */\n isRefetching: boolean\n /**\n * Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.\n */\n isStale: boolean\n /**\n * A derived boolean from the `status` variable, provided for convenience.\n * - `true` if the query has received a response with no errors and is ready to display its data.\n */\n isSuccess: boolean\n /**\n * `true` if this observer is enabled, `false` otherwise.\n */\n isEnabled: boolean\n /**\n * A function to manually refetch the query.\n */\n refetch: (\n options?: RefetchOptions,\n ) => Promise<QueryObserverResult<TData, TError>>\n /**\n * The status of the query.\n * - Will be:\n * - `pending` if there's no cached data and no query attempt was finished yet.\n * - `error` if the query attempt resulted in an error.\n * - `success` if the query has received a response with no errors and is ready to display its data.\n */\n status: QueryStatus\n /**\n * The fetch status of the query.\n * - `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.\n * - `paused`: The query wanted to fetch, but has been `paused`.\n * - `idle`: The query is not fetching.\n * - See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.\n */\n fetchStatus: FetchStatus\n /**\n * A stable promise that will be resolved with the data of the query.\n * Requires the `experimental_prefetchInRender` feature flag to be enabled.\n * @example\n *\n * ### Enabling the feature flag\n * ```ts\n * const client = new QueryClient({\n * defaultOptions: {\n * queries: {\n * experimental_prefetchInRender: true,\n * },\n * },\n * })\n * ```\n *\n * ### Usage\n * ```tsx\n * import { useQuery } from '@tanstack/react-query'\n * import React from 'react'\n * import { fetchTodos, type Todo } from './api'\n *\n * function TodoList({ query }: { query: UseQueryResult<Todo[], Error> }) {\n * const data = React.use(query.promise)\n *\n * return (\n * <ul>\n * {data.map(todo => (\n * <li key={todo.id}>{todo.title}</li>\n * ))}\n * </ul>\n * )\n * }\n *\n * export function App() {\n * const query = useQuery({ queryKey: ['todos'], queryFn: fetchTodos })\n *\n * return (\n * <>\n * <h1>Todos</h1>\n * <React.Suspense fallback={<div>Loading...</div>}>\n * <TodoList query={query} />\n * </React.Suspense>\n * </>\n * )\n * }\n * ```\n */\n promise: Promise<TData>\n}\n\nexport interface QueryObserverPendingResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: undefined\n error: null\n isError: false\n isPending: true\n isLoadingError: false\n isRefetchError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'pending'\n}\n\nexport interface QueryObserverLoadingResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: undefined\n error: null\n isError: false\n isPending: true\n isLoading: true\n isLoadingError: false\n isRefetchError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'pending'\n}\n\nexport interface QueryObserverLoadingErrorResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: undefined\n error: TError\n isError: true\n isPending: false\n isLoading: false\n isLoadingError: true\n isRefetchError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'error'\n}\n\nexport interface QueryObserverRefetchErrorResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: TData\n error: TError\n isError: true\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: true\n isSuccess: false\n isPlaceholderData: false\n status: 'error'\n}\n\nexport interface QueryObserverSuccessResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: TData\n error: null\n isError: false\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: false\n isSuccess: true\n isPlaceholderData: false\n status: 'success'\n}\n\nexport interface QueryObserverPlaceholderResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n data: TData\n isError: false\n error: null\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: false\n isSuccess: true\n isPlaceholderData: true\n status: 'success'\n}\n\nexport type DefinedQueryObserverResult<\n TData = unknown,\n TError = DefaultError,\n> =\n | QueryObserverRefetchErrorResult<TData, TError>\n | QueryObserverSuccessResult<TData, TError>\n\nexport type QueryObserverResult<TData = unknown, TError = DefaultError> =\n | DefinedQueryObserverResult<TData, TError>\n | QueryObserverLoadingErrorResult<TData, TError>\n | QueryObserverLoadingResult<TData, TError>\n | QueryObserverPendingResult<TData, TError>\n | QueryObserverPlaceholderResult<TData, TError>\n\nexport interface InfiniteQueryObserverBaseResult<\n TData = unknown,\n TError = DefaultError,\n> extends QueryObserverBaseResult<TData, TError> {\n /**\n * This function allows you to fetch the next \"page\" of results.\n */\n fetchNextPage: (\n options?: FetchNextPageOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n /**\n * This function allows you to fetch the previous \"page\" of results.\n */\n fetchPreviousPage: (\n options?: FetchPreviousPageOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n /**\n * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).\n */\n hasNextPage: boolean\n /**\n * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).\n */\n hasPreviousPage: boolean\n /**\n * Will be `true` if the query failed while fetching the next page.\n */\n isFetchNextPageError: boolean\n /**\n * Will be `true` while fetching the next page with `fetchNextPage`.\n */\n isFetchingNextPage: boolean\n /**\n * Will be `true` if the query failed while fetching the previous page.\n */\n isFetchPreviousPageError: boolean\n /**\n * Will be `true` while fetching the previous page with `fetchPreviousPage`.\n */\n isFetchingPreviousPage: boolean\n}\n\nexport interface InfiniteQueryObserverPendingResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: undefined\n error: null\n isError: false\n isPending: true\n isLoadingError: false\n isRefetchError: false\n isFetchNextPageError: false\n isFetchPreviousPageError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'pending'\n}\n\nexport interface InfiniteQueryObserverLoadingResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: undefined\n error: null\n isError: false\n isPending: true\n isLoading: true\n isLoadingError: false\n isRefetchError: false\n isFetchNextPageError: false\n isFetchPreviousPageError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'pending'\n}\n\nexport interface InfiniteQueryObserverLoadingErrorResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: undefined\n error: TError\n isError: true\n isPending: false\n isLoading: false\n isLoadingError: true\n isRefetchError: false\n isFetchNextPageError: false\n isFetchPreviousPageError: false\n isSuccess: false\n isPlaceholderData: false\n status: 'error'\n}\n\nexport interface InfiniteQueryObserverRefetchErrorResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: TData\n error: TError\n isError: true\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: true\n isSuccess: false\n isPlaceholderData: false\n status: 'error'\n}\n\nexport interface InfiniteQueryObserverSuccessResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: TData\n error: null\n isError: false\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: false\n isFetchNextPageError: false\n isFetchPreviousPageError: false\n isSuccess: true\n isPlaceholderData: false\n status: 'success'\n}\n\nexport interface InfiniteQueryObserverPlaceholderResult<\n TData = unknown,\n TError = DefaultError,\n> extends InfiniteQueryObserverBaseResult<TData, TError> {\n data: TData\n isError: false\n error: null\n isPending: false\n isLoading: false\n isLoadingError: false\n isRefetchError: false\n isSuccess: true\n isPlaceholderData: true\n isFetchNextPageError: false\n isFetchPreviousPageError: false\n status: 'success'\n}\n\nexport type DefinedInfiniteQueryObserverResult<\n TData = unknown,\n TError = DefaultError,\n> =\n | InfiniteQueryObserverRefetchErrorResult<TData, TError>\n | InfiniteQueryObserverSuccessResult<TData, TError>\n\nexport type InfiniteQueryObserverResult<\n TData = unknown,\n TError = DefaultError,\n> =\n | DefinedInfiniteQueryObserverResult<TData, TError>\n | InfiniteQueryObserverLoadingErrorResult<TData, TError>\n | InfiniteQueryObserverLoadingResult<TData, TError>\n | InfiniteQueryObserverPendingResult<TData, TError>\n | InfiniteQueryObserverPlaceholderResult<TData, TError>\n\nexport type MutationKey = Register extends {\n mutationKey: infer TMutationKey\n}\n ? TMutationKey extends ReadonlyArray<unknown>\n ? TMutationKey\n : TMutationKey extends Array<unknown>\n ? TMutationKey\n : ReadonlyArray<unknown>\n : ReadonlyArray<unknown>\n\nexport type MutationStatus = 'idle' | 'pending' | 'success' | 'error'\n\nexport type MutationScope = {\n id: string\n}\n\nexport type MutationMeta = Register extends {\n mutationMeta: infer TMutationMeta\n}\n ? TMutationMeta extends Record<string, unknown>\n ? TMutationMeta\n : Record<string, unknown>\n : Record<string, unknown>\n\nexport type MutationFunctionContext = {\n client: QueryClient\n meta: MutationMeta | undefined\n mutationKey?: MutationKey\n}\n\nexport type MutationFunction<TData = unknown, TVariables = unknown> = (\n variables: TVariables,\n context: MutationFunctionContext,\n) => Promise<TData>\n\nexport interface MutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> {\n mutationFn?: MutationFunction<TData, TVariables>\n mutationKey?: MutationKey\n onMutate?: (\n variables: TVariables,\n context: MutationFunctionContext,\n ) => Promise<TOnMutateResult> | TOnMutateResult\n onSuccess?: (\n data: TData,\n variables: TVariables,\n onMutateResult: TOnMutateResult,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onError?: (\n error: TError,\n variables: TVariables,\n onMutateResult: TOnMutateResult | undefined,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onSettled?: (\n data: TData | undefined,\n error: TError | null,\n variables: TVariables,\n onMutateResult: TOnMutateResult | undefined,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n retry?: RetryValue<TError>\n retryDelay?: RetryDelayValue<TError>\n networkMode?: NetworkMode\n gcTime?: number\n _defaulted?: boolean\n meta?: MutationMeta\n scope?: MutationScope\n}\n\nexport interface MutationObserverOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationOptions<TData, TError, TVariables, TOnMutateResult> {\n throwOnError?: boolean | ((error: TError) => boolean)\n}\n\nexport interface MutateOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> {\n onSuccess?: (\n data: TData,\n variables: TVariables,\n onMutateResult: TOnMutateResult | undefined,\n context: MutationFunctionContext,\n ) => void\n onError?: (\n error: TError,\n variables: TVariables,\n onMutateResult: TOnMutateResult | undefined,\n context: MutationFunctionContext,\n ) => void\n onSettled?: (\n data: TData | undefined,\n error: TError | null,\n variables: TVariables,\n onMutateResult: TOnMutateResult | undefined,\n context: MutationFunctionContext,\n ) => void\n}\n\nexport type MutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = (\n variables: TVariables,\n options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,\n) => Promise<TData>\n\nexport interface MutationObserverBaseResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationState<TData, TError, TVariables, TOnMutateResult> {\n /**\n * The last successfully resolved data for the mutation.\n */\n data: TData | undefined\n /**\n * The variables object passed to the `mutationFn`.\n */\n variables: TVariables | undefined\n /**\n * The error object for the mutation, if an error was encountered.\n * - Defaults to `null`.\n */\n error: TError | null\n /**\n * A boolean variable derived from `status`.\n * - `true` if the last mutation attempt resulted in an error.\n */\n isError: boolean\n /**\n * A boolean variable derived from `status`.\n * - `true` if the mutation is in its initial state prior to executing.\n */\n isIdle: boolean\n /**\n * A boolean variable derived from `status`.\n * - `true` if the mutation is currently executing.\n */\n isPending: boolean\n /**\n * A boolean variable derived from `status`.\n * - `true` if the last mutation attempt was successful.\n */\n isSuccess: boolean\n /**\n * The status of the mutation.\n * - Will be:\n * - `idle` initial status prior to the mutation function executing.\n * - `pending` if the mutation is currently executing.\n * - `error` if the last mutation attempt resulted in an error.\n * - `success` if the last mutation attempt was successful.\n */\n status: MutationStatus\n /**\n * The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.\n * @param variables - The variables object to pass to the `mutationFn`.\n * @param options.onSuccess - This function will fire when the mutation is successful and will be passed the mutation's result.\n * @param options.onError - This function will fire if the mutation encounters an error and will be passed the error.\n * @param options.onSettled - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.\n * @remarks\n * - If you make multiple requests, `onSuccess` will fire only after the latest call you've made.\n * - All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.\n */\n mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>\n /**\n * A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).\n */\n reset: () => void\n}\n\nexport interface MutationObserverIdleResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationObserverBaseResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n> {\n data: undefined\n variables: undefined\n error: null\n isError: false\n isIdle: true\n isPending: false\n isSuccess: false\n status: 'idle'\n}\n\nexport interface MutationObserverLoadingResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationObserverBaseResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n> {\n data: undefined\n variables: TVariables\n error: null\n isError: false\n isIdle: false\n isPending: true\n isSuccess: false\n status: 'pending'\n}\n\nexport interface MutationObserverErrorResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationObserverBaseResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n> {\n data: undefined\n error: TError\n variables: TVariables\n isError: true\n isIdle: false\n isPending: false\n isSuccess: false\n status: 'error'\n}\n\nexport interface MutationObserverSuccessResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends MutationObserverBaseResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n> {\n data: TData\n error: null\n variables: TVariables\n isError: false\n isIdle: false\n isPending: false\n isSuccess: true\n status: 'success'\n}\n\nexport type MutationObserverResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> =\n | MutationObserverIdleResult<TData, TError, TVariables, TOnMutateResult>\n | MutationObserverLoadingResult<TData, TError, TVariables, TOnMutateResult>\n | MutationObserverErrorResult<TData, TError, TVariables, TOnMutateResult>\n | MutationObserverSuccessResult<TData, TError, TVariables, TOnMutateResult>\n\nexport interface QueryClientConfig {\n queryCache?: QueryCache\n mutationCache?: MutationCache\n defaultOptions?: DefaultOptions\n}\n\nexport interface DefaultOptions<TError = DefaultError> {\n queries?: OmitKeyof<\n QueryObserverOptions<unknown, TError>,\n 'suspense' | 'queryKey'\n >\n mutations?: MutationObserverOptions<unknown, TError, unknown, unknown>\n hydrate?: HydrateOptions['defaultOptions']\n dehydrate?: DehydrateOptions\n}\n\nexport interface CancelOptions {\n revert?: boolean\n silent?: boolean\n}\n\nexport interface SetDataOptions {\n updatedAt?: number\n}\n\nexport type NotifyEventType =\n | 'added'\n | 'removed'\n | 'updated'\n | 'observerAdded'\n | 'observerRemoved'\n | 'observerResultsUpdated'\n | 'observerOptionsUpdated'\n\nexport interface NotifyEvent {\n type: NotifyEventType\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DO,IAAM,gBAAgB,uBAAO,eAAe;AAE5C,IAAM,qBAAqB,uBAAO,oBAAoB;AAEtD,IAAM,cAAc,uBAAO,aAAa;","names":[]}