@tanstack/query-core 5.0.0-alpha.86 → 5.0.0-alpha.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/focusManager.cjs +116 -0
- package/build/legacy/focusManager.cjs.map +1 -0
- package/build/legacy/focusManager.d.cts +16 -0
- package/build/{lib → legacy}/focusManager.d.ts +6 -5
- package/build/legacy/focusManager.js +91 -0
- package/build/legacy/focusManager.js.map +1 -0
- package/build/legacy/hydration.cjs +109 -0
- package/build/legacy/hydration.cjs.map +1 -0
- package/build/legacy/hydration.d.cts +35 -0
- package/build/legacy/hydration.d.ts +35 -0
- package/build/legacy/hydration.js +82 -0
- package/build/legacy/hydration.js.map +1 -0
- package/build/legacy/index.cjs +85 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +9 -0
- package/build/legacy/index.d.ts +9 -0
- package/build/legacy/index.js +50 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/infiniteQueryBehavior.cjs +141 -0
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -0
- package/build/legacy/infiniteQueryBehavior.d.cts +15 -0
- package/build/legacy/infiniteQueryBehavior.d.ts +15 -0
- package/build/legacy/infiniteQueryBehavior.js +115 -0
- package/build/legacy/infiniteQueryBehavior.js.map +1 -0
- package/build/legacy/infiniteQueryObserver.cjs +88 -0
- package/build/legacy/infiniteQueryObserver.cjs.map +1 -0
- package/build/legacy/infiniteQueryObserver.d.cts +19 -0
- package/build/{lib → legacy}/infiniteQueryObserver.d.ts +7 -8
- package/build/{lib/infiniteQueryObserver.legacy.js → legacy/infiniteQueryObserver.js} +24 -32
- package/build/legacy/infiniteQueryObserver.js.map +1 -0
- package/build/legacy/mutation.cjs +297 -0
- package/build/legacy/mutation.cjs.map +1 -0
- package/build/legacy/mutation.d.cts +3 -0
- package/build/legacy/mutation.d.ts +3 -0
- package/build/legacy/mutation.js +272 -0
- package/build/legacy/mutation.js.map +1 -0
- package/build/legacy/mutationCache.cjs +133 -0
- package/build/legacy/mutationCache.cjs.map +1 -0
- package/build/legacy/mutationCache.d.cts +3 -0
- package/build/legacy/mutationCache.d.ts +3 -0
- package/build/legacy/mutationCache.js +109 -0
- package/build/legacy/mutationCache.js.map +1 -0
- package/build/legacy/mutationObserver.cjs +171 -0
- package/build/legacy/mutationObserver.cjs.map +1 -0
- package/build/legacy/mutationObserver.d.cts +3 -0
- package/build/legacy/mutationObserver.d.ts +3 -0
- package/build/legacy/mutationObserver.js +147 -0
- package/build/legacy/mutationObserver.js.map +1 -0
- package/build/legacy/notifyManager.cjs +97 -0
- package/build/legacy/notifyManager.cjs.map +1 -0
- package/build/legacy/notifyManager.d.cts +20 -0
- package/build/{lib → legacy}/notifyManager.d.ts +4 -4
- package/build/{lib → legacy}/notifyManager.js +14 -31
- package/build/legacy/notifyManager.js.map +1 -0
- package/build/legacy/onlineManager.cjs +106 -0
- package/build/legacy/onlineManager.cjs.map +1 -0
- package/build/legacy/onlineManager.d.cts +16 -0
- package/build/{lib → legacy}/onlineManager.d.ts +6 -5
- package/build/legacy/onlineManager.js +81 -0
- package/build/legacy/onlineManager.js.map +1 -0
- package/build/legacy/queriesObserver.cjs +242 -0
- package/build/legacy/queriesObserver.cjs.map +1 -0
- package/build/legacy/queriesObserver.d.cts +26 -0
- package/build/{lib → legacy}/queriesObserver.d.ts +10 -11
- package/build/legacy/queriesObserver.js +218 -0
- package/build/legacy/queriesObserver.js.map +1 -0
- package/build/legacy/query.cjs +423 -0
- package/build/legacy/query.cjs.map +1 -0
- package/build/legacy/query.d.cts +3 -0
- package/build/legacy/query.d.ts +3 -0
- package/build/legacy/query.js +399 -0
- package/build/legacy/query.js.map +1 -0
- package/build/legacy/queryCache.cjs +140 -0
- package/build/legacy/queryCache.cjs.map +1 -0
- package/build/legacy/queryCache.d.cts +3 -0
- package/build/legacy/queryCache.d.ts +3 -0
- package/build/legacy/queryCache.js +116 -0
- package/build/legacy/queryCache.js.map +1 -0
- package/build/legacy/queryClient-4ba6364e.d.ts +916 -0
- package/build/legacy/queryClient-d615ed9f.d.ts +916 -0
- package/build/legacy/queryClient.cjs +322 -0
- package/build/legacy/queryClient.cjs.map +1 -0
- package/build/legacy/queryClient.d.cts +3 -0
- package/build/legacy/queryClient.d.ts +3 -0
- package/build/legacy/queryClient.js +304 -0
- package/build/legacy/queryClient.js.map +1 -0
- package/build/legacy/queryObserver.cjs +501 -0
- package/build/legacy/queryObserver.cjs.map +1 -0
- package/build/legacy/queryObserver.d.cts +3 -0
- package/build/legacy/queryObserver.d.ts +3 -0
- package/build/legacy/queryObserver.js +484 -0
- package/build/legacy/queryObserver.js.map +1 -0
- package/build/legacy/removable.cjs +77 -0
- package/build/legacy/removable.cjs.map +1 -0
- package/build/legacy/removable.d.cts +11 -0
- package/build/{lib → legacy}/removable.d.ts +3 -2
- package/build/legacy/removable.js +53 -0
- package/build/legacy/removable.js.map +1 -0
- package/build/legacy/retryer.cjs +169 -0
- package/build/legacy/retryer.cjs.map +1 -0
- package/build/legacy/retryer.d.cts +3 -0
- package/build/legacy/retryer.d.ts +3 -0
- package/build/{lib/retryer.legacy.js → legacy/retryer.js} +37 -48
- package/build/legacy/retryer.js.map +1 -0
- package/build/legacy/subscribable.cjs +49 -0
- package/build/legacy/subscribable.cjs.map +1 -0
- package/build/legacy/subscribable.d.cts +11 -0
- package/build/{lib → legacy}/subscribable.d.ts +3 -3
- package/build/{lib → legacy}/subscribable.js +5 -6
- package/build/legacy/subscribable.js.map +1 -0
- package/build/legacy/types.cjs +17 -0
- package/build/legacy/types.cjs.map +1 -0
- package/build/legacy/types.d.cts +3 -0
- package/build/legacy/types.d.ts +3 -0
- package/build/legacy/types.js +1 -0
- package/build/legacy/types.js.map +1 -0
- package/build/{lib/utils.legacy.cjs → legacy/utils.cjs} +92 -93
- package/build/legacy/utils.cjs.map +1 -0
- package/build/legacy/utils.d.cts +3 -0
- package/build/legacy/utils.d.ts +3 -0
- package/build/{lib/utils.legacy.js → legacy/utils.js} +49 -72
- package/build/legacy/utils.js.map +1 -0
- package/build/modern/focusManager.cjs +91 -0
- package/build/modern/focusManager.cjs.map +1 -0
- package/build/modern/focusManager.d.cts +16 -0
- package/build/modern/focusManager.d.ts +16 -0
- package/build/modern/focusManager.js +66 -0
- package/build/modern/focusManager.js.map +1 -0
- package/build/modern/hydration.cjs +107 -0
- package/build/modern/hydration.cjs.map +1 -0
- package/build/modern/hydration.d.cts +35 -0
- package/build/modern/hydration.d.ts +35 -0
- package/build/modern/hydration.js +80 -0
- package/build/modern/hydration.js.map +1 -0
- package/build/modern/index.cjs +85 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +9 -0
- package/build/modern/index.d.ts +9 -0
- package/build/modern/index.js +50 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/infiniteQueryBehavior.cjs +138 -0
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -0
- package/build/modern/infiniteQueryBehavior.d.cts +15 -0
- package/build/modern/infiniteQueryBehavior.d.ts +15 -0
- package/build/{lib → modern}/infiniteQueryBehavior.js +46 -53
- package/build/modern/infiniteQueryBehavior.js.map +1 -0
- package/build/modern/infiniteQueryObserver.cjs +87 -0
- package/build/modern/infiniteQueryObserver.cjs.map +1 -0
- package/build/modern/infiniteQueryObserver.d.cts +19 -0
- package/build/modern/infiniteQueryObserver.d.ts +19 -0
- package/build/{lib → modern}/infiniteQueryObserver.js +23 -31
- package/build/modern/infiniteQueryObserver.js.map +1 -0
- package/build/modern/mutation.cjs +259 -0
- package/build/modern/mutation.cjs.map +1 -0
- package/build/modern/mutation.d.cts +3 -0
- package/build/modern/mutation.d.ts +3 -0
- package/build/{lib → modern}/mutation.js +86 -86
- package/build/modern/mutation.js.map +1 -0
- package/build/modern/mutationCache.cjs +103 -0
- package/build/modern/mutationCache.cjs.map +1 -0
- package/build/modern/mutationCache.d.cts +3 -0
- package/build/modern/mutationCache.d.ts +3 -0
- package/build/modern/mutationCache.js +79 -0
- package/build/modern/mutationCache.js.map +1 -0
- package/build/modern/mutationObserver.cjs +132 -0
- package/build/modern/mutationObserver.cjs.map +1 -0
- package/build/modern/mutationObserver.d.cts +3 -0
- package/build/modern/mutationObserver.d.ts +3 -0
- package/build/{lib → modern}/mutationObserver.js +44 -32
- package/build/modern/mutationObserver.js.map +1 -0
- package/build/modern/notifyManager.cjs +97 -0
- package/build/modern/notifyManager.cjs.map +1 -0
- package/build/modern/notifyManager.d.cts +20 -0
- package/build/modern/notifyManager.d.ts +20 -0
- package/build/{lib/notifyManager.legacy.js → modern/notifyManager.js} +14 -31
- package/build/modern/notifyManager.js.map +1 -0
- package/build/modern/onlineManager.cjs +82 -0
- package/build/modern/onlineManager.cjs.map +1 -0
- package/build/modern/onlineManager.d.cts +16 -0
- package/build/modern/onlineManager.d.ts +16 -0
- package/build/{lib → modern}/onlineManager.js +14 -17
- package/build/modern/onlineManager.js.map +1 -0
- package/build/modern/queriesObserver.cjs +202 -0
- package/build/modern/queriesObserver.cjs.map +1 -0
- package/build/modern/queriesObserver.d.cts +26 -0
- package/build/modern/queriesObserver.d.ts +26 -0
- package/build/{lib → modern}/queriesObserver.js +69 -50
- package/build/modern/queriesObserver.js.map +1 -0
- package/build/{lib → modern}/query.cjs +143 -186
- package/build/modern/query.cjs.map +1 -0
- package/build/modern/query.d.cts +3 -0
- package/build/modern/query.d.ts +3 -0
- package/build/{lib → modern}/query.js +110 -175
- package/build/modern/query.js.map +1 -0
- package/build/modern/queryCache.cjs +120 -0
- package/build/modern/queryCache.cjs.map +1 -0
- package/build/modern/queryCache.d.cts +3 -0
- package/build/modern/queryCache.d.ts +3 -0
- package/build/{lib → modern}/queryCache.js +21 -29
- package/build/modern/queryCache.js.map +1 -0
- package/build/modern/queryClient-4ba6364e.d.ts +916 -0
- package/build/modern/queryClient-d615ed9f.d.ts +916 -0
- package/build/modern/queryClient.cjs +284 -0
- package/build/modern/queryClient.cjs.map +1 -0
- package/build/modern/queryClient.d.cts +3 -0
- package/build/modern/queryClient.d.ts +3 -0
- package/build/{lib → modern}/queryClient.js +77 -94
- package/build/modern/queryClient.js.map +1 -0
- package/build/{lib → modern}/queryObserver.cjs +133 -149
- package/build/modern/queryObserver.cjs.map +1 -0
- package/build/modern/queryObserver.d.cts +3 -0
- package/build/modern/queryObserver.d.ts +3 -0
- package/build/{lib → modern}/queryObserver.js +107 -138
- package/build/modern/queryObserver.js.map +1 -0
- package/build/modern/removable.cjs +55 -0
- package/build/modern/removable.cjs.map +1 -0
- package/build/modern/removable.d.cts +11 -0
- package/build/modern/removable.d.ts +11 -0
- package/build/{lib → modern}/removable.js +10 -8
- package/build/modern/removable.js.map +1 -0
- package/build/{lib → modern}/retryer.cjs +50 -44
- package/build/modern/retryer.cjs.map +1 -0
- package/build/modern/retryer.d.cts +3 -0
- package/build/modern/retryer.d.ts +3 -0
- package/build/{lib → modern}/retryer.js +23 -39
- package/build/modern/retryer.js.map +1 -0
- package/build/modern/subscribable.cjs +49 -0
- package/build/modern/subscribable.cjs.map +1 -0
- package/build/modern/subscribable.d.cts +11 -0
- package/build/modern/subscribable.d.ts +11 -0
- package/build/{lib/subscribable.legacy.js → modern/subscribable.js} +5 -6
- package/build/modern/subscribable.js.map +1 -0
- package/build/modern/types.cjs +17 -0
- package/build/modern/types.cjs.map +1 -0
- package/build/modern/types.d.cts +3 -0
- package/build/modern/types.d.ts +3 -0
- package/build/modern/types.js +1 -0
- package/build/modern/types.js.map +1 -0
- package/build/{lib → modern}/utils.cjs +92 -93
- package/build/modern/utils.cjs.map +1 -0
- package/build/modern/utils.d.cts +3 -0
- package/build/modern/utils.d.ts +3 -0
- package/build/{lib → modern}/utils.js +49 -72
- package/build/modern/utils.js.map +1 -0
- package/package.json +15 -13
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs +0 -16
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.cjs.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js +0 -13
- package/build/lib/_virtual/_rollupPluginBabelHelpers.legacy.js.map +0 -1
- package/build/lib/focusManager.cjs +0 -75
- package/build/lib/focusManager.cjs.map +0 -1
- package/build/lib/focusManager.d.ts.map +0 -1
- package/build/lib/focusManager.js +0 -72
- package/build/lib/focusManager.js.map +0 -1
- package/build/lib/focusManager.legacy.cjs +0 -91
- package/build/lib/focusManager.legacy.cjs.map +0 -1
- package/build/lib/focusManager.legacy.js +0 -88
- package/build/lib/focusManager.legacy.js.map +0 -1
- package/build/lib/hydration.cjs +0 -97
- package/build/lib/hydration.cjs.map +0 -1
- package/build/lib/hydration.d.ts +0 -35
- package/build/lib/hydration.d.ts.map +0 -1
- package/build/lib/hydration.js +0 -92
- package/build/lib/hydration.js.map +0 -1
- package/build/lib/hydration.legacy.cjs +0 -100
- package/build/lib/hydration.legacy.cjs.map +0 -1
- package/build/lib/hydration.legacy.js +0 -95
- package/build/lib/hydration.legacy.js.map +0 -1
- package/build/lib/index.cjs +0 -40
- package/build/lib/index.cjs.map +0 -1
- package/build/lib/index.d.ts +0 -22
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/index.js +0 -14
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.legacy.cjs +0 -40
- package/build/lib/index.legacy.cjs.map +0 -1
- package/build/lib/index.legacy.js +0 -14
- package/build/lib/index.legacy.js.map +0 -1
- package/build/lib/infiniteQueryBehavior.cjs +0 -123
- package/build/lib/infiniteQueryBehavior.cjs.map +0 -1
- package/build/lib/infiniteQueryBehavior.d.ts +0 -12
- package/build/lib/infiniteQueryBehavior.d.ts.map +0 -1
- package/build/lib/infiniteQueryBehavior.js.map +0 -1
- package/build/lib/infiniteQueryBehavior.legacy.cjs +0 -125
- package/build/lib/infiniteQueryBehavior.legacy.cjs.map +0 -1
- package/build/lib/infiniteQueryBehavior.legacy.js +0 -121
- package/build/lib/infiniteQueryBehavior.legacy.js.map +0 -1
- package/build/lib/infiniteQueryObserver.cjs +0 -77
- package/build/lib/infiniteQueryObserver.cjs.map +0 -1
- package/build/lib/infiniteQueryObserver.d.ts.map +0 -1
- package/build/lib/infiniteQueryObserver.js.map +0 -1
- package/build/lib/infiniteQueryObserver.legacy.cjs +0 -78
- package/build/lib/infiniteQueryObserver.legacy.cjs.map +0 -1
- package/build/lib/infiniteQueryObserver.legacy.js.map +0 -1
- package/build/lib/mutation.cjs +0 -237
- package/build/lib/mutation.cjs.map +0 -1
- package/build/lib/mutation.d.ts +0 -64
- package/build/lib/mutation.d.ts.map +0 -1
- package/build/lib/mutation.js.map +0 -1
- package/build/lib/mutation.legacy.cjs +0 -262
- package/build/lib/mutation.legacy.cjs.map +0 -1
- package/build/lib/mutation.legacy.js +0 -259
- package/build/lib/mutation.legacy.js.map +0 -1
- package/build/lib/mutationCache.cjs +0 -85
- package/build/lib/mutationCache.cjs.map +0 -1
- package/build/lib/mutationCache.d.ts +0 -59
- package/build/lib/mutationCache.d.ts.map +0 -1
- package/build/lib/mutationCache.js +0 -83
- package/build/lib/mutationCache.js.map +0 -1
- package/build/lib/mutationCache.legacy.cjs +0 -98
- package/build/lib/mutationCache.legacy.cjs.map +0 -1
- package/build/lib/mutationCache.legacy.js +0 -96
- package/build/lib/mutationCache.legacy.js.map +0 -1
- package/build/lib/mutationObserver.cjs +0 -98
- package/build/lib/mutationObserver.cjs.map +0 -1
- package/build/lib/mutationObserver.d.ts +0 -19
- package/build/lib/mutationObserver.d.ts.map +0 -1
- package/build/lib/mutationObserver.js.map +0 -1
- package/build/lib/mutationObserver.legacy.cjs +0 -128
- package/build/lib/mutationObserver.legacy.cjs.map +0 -1
- package/build/lib/mutationObserver.legacy.js +0 -126
- package/build/lib/mutationObserver.legacy.js.map +0 -1
- package/build/lib/notifyManager.cjs +0 -92
- package/build/lib/notifyManager.cjs.map +0 -1
- package/build/lib/notifyManager.d.ts.map +0 -1
- package/build/lib/notifyManager.js.map +0 -1
- package/build/lib/notifyManager.legacy.cjs +0 -92
- package/build/lib/notifyManager.legacy.cjs.map +0 -1
- package/build/lib/notifyManager.legacy.js.map +0 -1
- package/build/lib/onlineManager.cjs +0 -63
- package/build/lib/onlineManager.cjs.map +0 -1
- package/build/lib/onlineManager.d.ts.map +0 -1
- package/build/lib/onlineManager.js.map +0 -1
- package/build/lib/onlineManager.legacy.cjs +0 -78
- package/build/lib/onlineManager.legacy.cjs.map +0 -1
- package/build/lib/onlineManager.legacy.js +0 -75
- package/build/lib/onlineManager.legacy.js.map +0 -1
- package/build/lib/queriesObserver.cjs +0 -161
- package/build/lib/queriesObserver.cjs.map +0 -1
- package/build/lib/queriesObserver.d.ts.map +0 -1
- package/build/lib/queriesObserver.js.map +0 -1
- package/build/lib/queriesObserver.legacy.cjs +0 -207
- package/build/lib/queriesObserver.legacy.cjs.map +0 -1
- package/build/lib/queriesObserver.legacy.js +0 -205
- package/build/lib/queriesObserver.legacy.js.map +0 -1
- package/build/lib/query.cjs.map +0 -1
- package/build/lib/query.d.ts +0 -115
- package/build/lib/query.d.ts.map +0 -1
- package/build/lib/query.js.map +0 -1
- package/build/lib/query.legacy.cjs +0 -471
- package/build/lib/query.legacy.cjs.map +0 -1
- package/build/lib/query.legacy.js +0 -469
- package/build/lib/query.legacy.js.map +0 -1
- package/build/lib/queryCache.cjs +0 -106
- package/build/lib/queryCache.cjs.map +0 -1
- package/build/lib/queryCache.d.ts +0 -71
- package/build/lib/queryCache.d.ts.map +0 -1
- package/build/lib/queryCache.js.map +0 -1
- package/build/lib/queryCache.legacy.cjs +0 -111
- package/build/lib/queryCache.legacy.cjs.map +0 -1
- package/build/lib/queryCache.legacy.js +0 -109
- package/build/lib/queryCache.legacy.js.map +0 -1
- package/build/lib/queryClient.cjs +0 -285
- package/build/lib/queryClient.cjs.map +0 -1
- package/build/lib/queryClient.d.ts +0 -41
- package/build/lib/queryClient.d.ts.map +0 -1
- package/build/lib/queryClient.js.map +0 -1
- package/build/lib/queryClient.legacy.cjs +0 -322
- package/build/lib/queryClient.legacy.cjs.map +0 -1
- package/build/lib/queryClient.legacy.js +0 -320
- package/build/lib/queryClient.legacy.js.map +0 -1
- package/build/lib/queryObserver.cjs.map +0 -1
- package/build/lib/queryObserver.d.ts +0 -35
- package/build/lib/queryObserver.d.ts.map +0 -1
- package/build/lib/queryObserver.js.map +0 -1
- package/build/lib/queryObserver.legacy.cjs +0 -561
- package/build/lib/queryObserver.legacy.cjs.map +0 -1
- package/build/lib/queryObserver.legacy.js +0 -559
- package/build/lib/queryObserver.legacy.js.map +0 -1
- package/build/lib/removable.cjs +0 -31
- package/build/lib/removable.cjs.map +0 -1
- package/build/lib/removable.d.ts.map +0 -1
- package/build/lib/removable.js.map +0 -1
- package/build/lib/removable.legacy.cjs +0 -38
- package/build/lib/removable.legacy.cjs.map +0 -1
- package/build/lib/removable.legacy.js +0 -36
- package/build/lib/removable.legacy.js.map +0 -1
- package/build/lib/retryer.cjs.map +0 -1
- package/build/lib/retryer.d.ts +0 -34
- package/build/lib/retryer.d.ts.map +0 -1
- package/build/lib/retryer.js.map +0 -1
- package/build/lib/retryer.legacy.cjs +0 -158
- package/build/lib/retryer.legacy.cjs.map +0 -1
- package/build/lib/retryer.legacy.js.map +0 -1
- package/build/lib/subscribable.cjs +0 -28
- package/build/lib/subscribable.cjs.map +0 -1
- package/build/lib/subscribable.d.ts.map +0 -1
- package/build/lib/subscribable.js.map +0 -1
- package/build/lib/subscribable.legacy.cjs +0 -28
- package/build/lib/subscribable.legacy.cjs.map +0 -1
- package/build/lib/subscribable.legacy.js.map +0 -1
- package/build/lib/tests/focusManager.test.d.ts +0 -2
- package/build/lib/tests/focusManager.test.d.ts.map +0 -1
- package/build/lib/tests/hydration.test.d.ts +0 -2
- package/build/lib/tests/hydration.test.d.ts.map +0 -1
- package/build/lib/tests/infiniteQueryBehavior.test.d.ts +0 -2
- package/build/lib/tests/infiniteQueryBehavior.test.d.ts.map +0 -1
- package/build/lib/tests/infiniteQueryObserver.test.d.ts +0 -2
- package/build/lib/tests/infiniteQueryObserver.test.d.ts.map +0 -1
- package/build/lib/tests/mutationCache.test.d.ts +0 -2
- package/build/lib/tests/mutationCache.test.d.ts.map +0 -1
- package/build/lib/tests/mutationObserver.test.d.ts +0 -2
- package/build/lib/tests/mutationObserver.test.d.ts.map +0 -1
- package/build/lib/tests/mutations.test.d.ts +0 -2
- package/build/lib/tests/mutations.test.d.ts.map +0 -1
- package/build/lib/tests/notifyManager.test.d.ts +0 -2
- package/build/lib/tests/notifyManager.test.d.ts.map +0 -1
- package/build/lib/tests/onlineManager.test.d.ts +0 -2
- package/build/lib/tests/onlineManager.test.d.ts.map +0 -1
- package/build/lib/tests/queriesObserver.test.d.ts +0 -2
- package/build/lib/tests/queriesObserver.test.d.ts.map +0 -1
- package/build/lib/tests/query.test.d.ts +0 -2
- package/build/lib/tests/query.test.d.ts.map +0 -1
- package/build/lib/tests/queryCache.test.d.ts +0 -2
- package/build/lib/tests/queryCache.test.d.ts.map +0 -1
- package/build/lib/tests/queryClient.test.d.ts +0 -2
- package/build/lib/tests/queryClient.test.d.ts.map +0 -1
- package/build/lib/tests/queryObserver.test.d.ts +0 -2
- package/build/lib/tests/queryObserver.test.d.ts.map +0 -1
- package/build/lib/tests/utils.d.ts +0 -17
- package/build/lib/tests/utils.d.ts.map +0 -1
- package/build/lib/tests/utils.test.d.ts +0 -2
- package/build/lib/tests/utils.test.d.ts.map +0 -1
- package/build/lib/types.d.ts +0 -437
- package/build/lib/types.d.ts.map +0 -1
- package/build/lib/utils.cjs.map +0 -1
- package/build/lib/utils.d.ts +0 -90
- package/build/lib/utils.d.ts.map +0 -1
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.legacy.cjs.map +0 -1
- package/build/lib/utils.legacy.js.map +0 -1
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { notifyManager } from
|
|
3
|
-
import { createRetryer, isCancelledError
|
|
4
|
-
import { Removable } from
|
|
5
|
-
|
|
6
|
-
// TYPES
|
|
7
|
-
|
|
8
|
-
// CLASS
|
|
9
|
-
|
|
1
|
+
import { noop, replaceData, timeUntilStale } from "./utils";
|
|
2
|
+
import { notifyManager } from "./notifyManager";
|
|
3
|
+
import { canFetch, createRetryer, isCancelledError } from "./retryer";
|
|
4
|
+
import { Removable } from "./removable";
|
|
10
5
|
class Query extends Removable {
|
|
11
|
-
#initialState;
|
|
12
|
-
#revertState;
|
|
13
|
-
#cache;
|
|
14
|
-
#promise;
|
|
15
|
-
#retryer;
|
|
16
|
-
#observers;
|
|
17
|
-
#defaultOptions;
|
|
18
|
-
#abortSignalConsumed;
|
|
19
6
|
constructor(config) {
|
|
20
7
|
super();
|
|
21
8
|
this.#abortSignalConsumed = false;
|
|
@@ -29,39 +16,38 @@ class Query extends Removable {
|
|
|
29
16
|
this.state = this.#initialState;
|
|
30
17
|
this.scheduleGc();
|
|
31
18
|
}
|
|
19
|
+
#initialState;
|
|
20
|
+
#revertState;
|
|
21
|
+
#cache;
|
|
22
|
+
#promise;
|
|
23
|
+
#retryer;
|
|
24
|
+
#observers;
|
|
25
|
+
#defaultOptions;
|
|
26
|
+
#abortSignalConsumed;
|
|
32
27
|
get meta() {
|
|
33
28
|
return this.options.meta;
|
|
34
29
|
}
|
|
35
30
|
#setOptions(options) {
|
|
36
|
-
this.options = {
|
|
37
|
-
...this.#defaultOptions,
|
|
38
|
-
...options
|
|
39
|
-
};
|
|
31
|
+
this.options = { ...this.#defaultOptions, ...options };
|
|
40
32
|
this.updateGcTime(this.options.gcTime);
|
|
41
33
|
}
|
|
42
34
|
optionalRemove() {
|
|
43
|
-
if (!this.#observers.length && this.state.fetchStatus ===
|
|
35
|
+
if (!this.#observers.length && this.state.fetchStatus === "idle") {
|
|
44
36
|
this.#cache.remove(this);
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
39
|
setData(newData, options) {
|
|
48
40
|
const data = replaceData(this.state.data, newData, this.options);
|
|
49
|
-
|
|
50
|
-
// Set data and mark it as cached
|
|
51
41
|
this.#dispatch({
|
|
52
42
|
data,
|
|
53
|
-
type:
|
|
43
|
+
type: "success",
|
|
54
44
|
dataUpdatedAt: options?.updatedAt,
|
|
55
45
|
manual: options?.manual
|
|
56
46
|
});
|
|
57
47
|
return data;
|
|
58
48
|
}
|
|
59
49
|
setState(state, setStateOptions) {
|
|
60
|
-
this.#dispatch({
|
|
61
|
-
type: 'setState',
|
|
62
|
-
state,
|
|
63
|
-
setStateOptions
|
|
64
|
-
});
|
|
50
|
+
this.#dispatch({ type: "setState", state, setStateOptions });
|
|
65
51
|
}
|
|
66
52
|
cancel(options) {
|
|
67
53
|
const promise = this.#promise;
|
|
@@ -70,79 +56,57 @@ class Query extends Removable {
|
|
|
70
56
|
}
|
|
71
57
|
destroy() {
|
|
72
58
|
super.destroy();
|
|
73
|
-
this.cancel({
|
|
74
|
-
silent: true
|
|
75
|
-
});
|
|
59
|
+
this.cancel({ silent: true });
|
|
76
60
|
}
|
|
77
61
|
reset() {
|
|
78
62
|
this.destroy();
|
|
79
63
|
this.setState(this.#initialState);
|
|
80
64
|
}
|
|
81
65
|
isActive() {
|
|
82
|
-
return this.#observers.some(
|
|
66
|
+
return this.#observers.some(
|
|
67
|
+
(observer) => observer.options.enabled !== false
|
|
68
|
+
);
|
|
83
69
|
}
|
|
84
70
|
isDisabled() {
|
|
85
71
|
return this.getObserversCount() > 0 && !this.isActive();
|
|
86
72
|
}
|
|
87
73
|
isStale() {
|
|
88
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.#observers.some(observer => observer.getCurrentResult().isStale);
|
|
74
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.#observers.some((observer) => observer.getCurrentResult().isStale);
|
|
89
75
|
}
|
|
90
76
|
isStaleByTime(staleTime = 0) {
|
|
91
77
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
92
78
|
}
|
|
93
79
|
onFocus() {
|
|
94
|
-
const observer = this.#observers.find(x => x.shouldFetchOnWindowFocus());
|
|
95
|
-
observer?.refetch({
|
|
96
|
-
cancelRefetch: false
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Continue fetch if currently paused
|
|
80
|
+
const observer = this.#observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
81
|
+
observer?.refetch({ cancelRefetch: false });
|
|
100
82
|
this.#retryer?.continue();
|
|
101
83
|
}
|
|
102
84
|
onOnline() {
|
|
103
|
-
const observer = this.#observers.find(x => x.shouldFetchOnReconnect());
|
|
104
|
-
observer?.refetch({
|
|
105
|
-
cancelRefetch: false
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// Continue fetch if currently paused
|
|
85
|
+
const observer = this.#observers.find((x) => x.shouldFetchOnReconnect());
|
|
86
|
+
observer?.refetch({ cancelRefetch: false });
|
|
109
87
|
this.#retryer?.continue();
|
|
110
88
|
}
|
|
111
89
|
addObserver(observer) {
|
|
112
90
|
if (!this.#observers.includes(observer)) {
|
|
113
91
|
this.#observers.push(observer);
|
|
114
|
-
|
|
115
|
-
// Stop the query from being garbage collected
|
|
116
92
|
this.clearGcTimeout();
|
|
117
|
-
this.#cache.notify({
|
|
118
|
-
type: 'observerAdded',
|
|
119
|
-
query: this,
|
|
120
|
-
observer
|
|
121
|
-
});
|
|
93
|
+
this.#cache.notify({ type: "observerAdded", query: this, observer });
|
|
122
94
|
}
|
|
123
95
|
}
|
|
124
96
|
removeObserver(observer) {
|
|
125
97
|
if (this.#observers.includes(observer)) {
|
|
126
|
-
this.#observers = this.#observers.filter(x => x !== observer);
|
|
98
|
+
this.#observers = this.#observers.filter((x) => x !== observer);
|
|
127
99
|
if (!this.#observers.length) {
|
|
128
|
-
// If the transport layer does not support cancellation
|
|
129
|
-
// we'll let the query continue so the result can be cached
|
|
130
100
|
if (this.#retryer) {
|
|
131
101
|
if (this.#abortSignalConsumed) {
|
|
132
|
-
this.#retryer.cancel({
|
|
133
|
-
revert: true
|
|
134
|
-
});
|
|
102
|
+
this.#retryer.cancel({ revert: true });
|
|
135
103
|
} else {
|
|
136
104
|
this.#retryer.cancelRetry();
|
|
137
105
|
}
|
|
138
106
|
}
|
|
139
107
|
this.scheduleGc();
|
|
140
108
|
}
|
|
141
|
-
this.#cache.notify({
|
|
142
|
-
type: 'observerRemoved',
|
|
143
|
-
query: this,
|
|
144
|
-
observer
|
|
145
|
-
});
|
|
109
|
+
this.#cache.notify({ type: "observerRemoved", query: this, observer });
|
|
146
110
|
}
|
|
147
111
|
}
|
|
148
112
|
getObserversCount() {
|
|
@@ -150,57 +114,41 @@ class Query extends Removable {
|
|
|
150
114
|
}
|
|
151
115
|
invalidate() {
|
|
152
116
|
if (!this.state.isInvalidated) {
|
|
153
|
-
this.#dispatch({
|
|
154
|
-
type: 'invalidate'
|
|
155
|
-
});
|
|
117
|
+
this.#dispatch({ type: "invalidate" });
|
|
156
118
|
}
|
|
157
119
|
}
|
|
158
120
|
fetch(options, fetchOptions) {
|
|
159
|
-
if (this.state.fetchStatus !==
|
|
121
|
+
if (this.state.fetchStatus !== "idle") {
|
|
160
122
|
if (this.state.dataUpdatedAt && fetchOptions?.cancelRefetch) {
|
|
161
|
-
|
|
162
|
-
this.cancel({
|
|
163
|
-
silent: true
|
|
164
|
-
});
|
|
123
|
+
this.cancel({ silent: true });
|
|
165
124
|
} else if (this.#promise) {
|
|
166
|
-
// make sure that retries that were potentially cancelled due to unmounts can continue
|
|
167
125
|
this.#retryer?.continueRetry();
|
|
168
|
-
// Return current promise if we are already fetching
|
|
169
126
|
return this.#promise;
|
|
170
127
|
}
|
|
171
128
|
}
|
|
172
|
-
|
|
173
|
-
// Update config if passed, otherwise the config from the last execution is used
|
|
174
129
|
if (options) {
|
|
175
130
|
this.#setOptions(options);
|
|
176
131
|
}
|
|
177
|
-
|
|
178
|
-
// Use the options from the first observer with a query function if no function is found.
|
|
179
|
-
// This can happen when the query is hydrated or created with setQueryData.
|
|
180
132
|
if (!this.options.queryFn) {
|
|
181
|
-
const observer = this.#observers.find(x => x.options.queryFn);
|
|
133
|
+
const observer = this.#observers.find((x) => x.options.queryFn);
|
|
182
134
|
if (observer) {
|
|
183
135
|
this.#setOptions(observer.options);
|
|
184
136
|
}
|
|
185
137
|
}
|
|
186
|
-
if (process.env.NODE_ENV !==
|
|
138
|
+
if (process.env.NODE_ENV !== "production") {
|
|
187
139
|
if (!Array.isArray(this.options.queryKey)) {
|
|
188
|
-
console.error(
|
|
140
|
+
console.error(
|
|
141
|
+
`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
|
|
142
|
+
);
|
|
189
143
|
}
|
|
190
144
|
}
|
|
191
145
|
const abortController = new AbortController();
|
|
192
|
-
|
|
193
|
-
// Create query function context
|
|
194
146
|
const queryFnContext = {
|
|
195
147
|
queryKey: this.queryKey,
|
|
196
148
|
meta: this.meta
|
|
197
149
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// which sets abortSignalConsumed to true when the signal
|
|
201
|
-
// is read.
|
|
202
|
-
const addSignalProperty = object => {
|
|
203
|
-
Object.defineProperty(object, 'signal', {
|
|
150
|
+
const addSignalProperty = (object) => {
|
|
151
|
+
Object.defineProperty(object, "signal", {
|
|
204
152
|
enumerable: true,
|
|
205
153
|
get: () => {
|
|
206
154
|
this.#abortSignalConsumed = true;
|
|
@@ -209,17 +157,17 @@ class Query extends Removable {
|
|
|
209
157
|
});
|
|
210
158
|
};
|
|
211
159
|
addSignalProperty(queryFnContext);
|
|
212
|
-
|
|
213
|
-
// Create fetch function
|
|
214
160
|
const fetchFn = () => {
|
|
215
161
|
if (!this.options.queryFn) {
|
|
216
|
-
return Promise.reject(
|
|
162
|
+
return Promise.reject(
|
|
163
|
+
new Error(`Missing queryFn: '${this.options.queryHash}'`)
|
|
164
|
+
);
|
|
217
165
|
}
|
|
218
166
|
this.#abortSignalConsumed = false;
|
|
219
|
-
return this.options.queryFn(
|
|
167
|
+
return this.options.queryFn(
|
|
168
|
+
queryFnContext
|
|
169
|
+
);
|
|
220
170
|
};
|
|
221
|
-
|
|
222
|
-
// Trigger behavior hook
|
|
223
171
|
const context = {
|
|
224
172
|
fetchOptions,
|
|
225
173
|
options: this.options,
|
|
@@ -228,78 +176,70 @@ class Query extends Removable {
|
|
|
228
176
|
fetchFn
|
|
229
177
|
};
|
|
230
178
|
addSignalProperty(context);
|
|
231
|
-
this.options.behavior?.onFetch(
|
|
232
|
-
|
|
233
|
-
|
|
179
|
+
this.options.behavior?.onFetch(
|
|
180
|
+
context
|
|
181
|
+
);
|
|
234
182
|
this.#revertState = this.state;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (this.state.fetchStatus === 'idle' || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
238
|
-
this.#dispatch({
|
|
239
|
-
type: 'fetch',
|
|
240
|
-
meta: context.fetchOptions?.meta
|
|
241
|
-
});
|
|
183
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
184
|
+
this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
|
|
242
185
|
}
|
|
243
|
-
const onError = error => {
|
|
244
|
-
// Optimistically update state if needed
|
|
186
|
+
const onError = (error) => {
|
|
245
187
|
if (!(isCancelledError(error) && error.silent)) {
|
|
246
188
|
this.#dispatch({
|
|
247
|
-
type:
|
|
248
|
-
error
|
|
189
|
+
type: "error",
|
|
190
|
+
error
|
|
249
191
|
});
|
|
250
192
|
}
|
|
251
193
|
if (!isCancelledError(error)) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
194
|
+
this.#cache.config.onError?.(
|
|
195
|
+
error,
|
|
196
|
+
this
|
|
197
|
+
);
|
|
198
|
+
this.#cache.config.onSettled?.(
|
|
199
|
+
this.state.data,
|
|
200
|
+
error,
|
|
201
|
+
this
|
|
202
|
+
);
|
|
255
203
|
}
|
|
256
204
|
if (!this.isFetchingOptimistic) {
|
|
257
|
-
// Schedule query gc after fetching
|
|
258
205
|
this.scheduleGc();
|
|
259
206
|
}
|
|
260
207
|
this.isFetchingOptimistic = false;
|
|
261
208
|
};
|
|
262
|
-
|
|
263
|
-
// Try to fetch the data
|
|
264
209
|
this.#retryer = createRetryer({
|
|
265
210
|
fn: context.fetchFn,
|
|
266
211
|
abort: abortController.abort.bind(abortController),
|
|
267
|
-
onSuccess: data => {
|
|
268
|
-
if (typeof data ===
|
|
269
|
-
if (process.env.NODE_ENV !==
|
|
270
|
-
console.error(
|
|
212
|
+
onSuccess: (data) => {
|
|
213
|
+
if (typeof data === "undefined") {
|
|
214
|
+
if (process.env.NODE_ENV !== "production") {
|
|
215
|
+
console.error(
|
|
216
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
217
|
+
);
|
|
271
218
|
}
|
|
272
219
|
onError(new Error(`${this.queryHash} data is undefined`));
|
|
273
220
|
return;
|
|
274
221
|
}
|
|
275
222
|
this.setData(data);
|
|
276
|
-
|
|
277
|
-
// Notify cache callback
|
|
278
223
|
this.#cache.config.onSuccess?.(data, this);
|
|
279
|
-
this.#cache.config.onSettled?.(
|
|
224
|
+
this.#cache.config.onSettled?.(
|
|
225
|
+
data,
|
|
226
|
+
this.state.error,
|
|
227
|
+
this
|
|
228
|
+
);
|
|
280
229
|
if (!this.isFetchingOptimistic) {
|
|
281
|
-
// Schedule query gc after fetching
|
|
282
230
|
this.scheduleGc();
|
|
283
231
|
}
|
|
284
232
|
this.isFetchingOptimistic = false;
|
|
285
233
|
},
|
|
286
234
|
onError,
|
|
287
235
|
onFail: (failureCount, error) => {
|
|
288
|
-
this.#dispatch({
|
|
289
|
-
type: 'failed',
|
|
290
|
-
failureCount,
|
|
291
|
-
error
|
|
292
|
-
});
|
|
236
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
293
237
|
},
|
|
294
238
|
onPause: () => {
|
|
295
|
-
this.#dispatch({
|
|
296
|
-
type: 'pause'
|
|
297
|
-
});
|
|
239
|
+
this.#dispatch({ type: "pause" });
|
|
298
240
|
},
|
|
299
241
|
onContinue: () => {
|
|
300
|
-
this.#dispatch({
|
|
301
|
-
type: 'continue'
|
|
302
|
-
});
|
|
242
|
+
this.#dispatch({ type: "continue" });
|
|
303
243
|
},
|
|
304
244
|
retry: context.options.retry,
|
|
305
245
|
retryDelay: context.options.retryDelay,
|
|
@@ -309,37 +249,37 @@ class Query extends Removable {
|
|
|
309
249
|
return this.#promise;
|
|
310
250
|
}
|
|
311
251
|
#dispatch(action) {
|
|
312
|
-
const reducer = state => {
|
|
252
|
+
const reducer = (state) => {
|
|
313
253
|
switch (action.type) {
|
|
314
|
-
case
|
|
254
|
+
case "failed":
|
|
315
255
|
return {
|
|
316
256
|
...state,
|
|
317
257
|
fetchFailureCount: action.failureCount,
|
|
318
258
|
fetchFailureReason: action.error
|
|
319
259
|
};
|
|
320
|
-
case
|
|
260
|
+
case "pause":
|
|
321
261
|
return {
|
|
322
262
|
...state,
|
|
323
|
-
fetchStatus:
|
|
263
|
+
fetchStatus: "paused"
|
|
324
264
|
};
|
|
325
|
-
case
|
|
265
|
+
case "continue":
|
|
326
266
|
return {
|
|
327
267
|
...state,
|
|
328
|
-
fetchStatus:
|
|
268
|
+
fetchStatus: "fetching"
|
|
329
269
|
};
|
|
330
|
-
case
|
|
270
|
+
case "fetch":
|
|
331
271
|
return {
|
|
332
272
|
...state,
|
|
333
273
|
fetchFailureCount: 0,
|
|
334
274
|
fetchFailureReason: null,
|
|
335
275
|
fetchMeta: action.meta ?? null,
|
|
336
|
-
fetchStatus: canFetch(this.options.networkMode) ?
|
|
337
|
-
|
|
276
|
+
fetchStatus: canFetch(this.options.networkMode) ? "fetching" : "paused",
|
|
277
|
+
...!state.dataUpdatedAt && {
|
|
338
278
|
error: null,
|
|
339
|
-
status:
|
|
340
|
-
}
|
|
279
|
+
status: "pending"
|
|
280
|
+
}
|
|
341
281
|
};
|
|
342
|
-
case
|
|
282
|
+
case "success":
|
|
343
283
|
return {
|
|
344
284
|
...state,
|
|
345
285
|
data: action.data,
|
|
@@ -347,36 +287,34 @@ class Query extends Removable {
|
|
|
347
287
|
dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),
|
|
348
288
|
error: null,
|
|
349
289
|
isInvalidated: false,
|
|
350
|
-
status:
|
|
351
|
-
|
|
352
|
-
fetchStatus:
|
|
290
|
+
status: "success",
|
|
291
|
+
...!action.manual && {
|
|
292
|
+
fetchStatus: "idle",
|
|
353
293
|
fetchFailureCount: 0,
|
|
354
294
|
fetchFailureReason: null
|
|
355
|
-
}
|
|
295
|
+
}
|
|
356
296
|
};
|
|
357
|
-
case
|
|
297
|
+
case "error":
|
|
358
298
|
const error = action.error;
|
|
359
299
|
if (isCancelledError(error) && error.revert && this.#revertState) {
|
|
360
|
-
return {
|
|
361
|
-
...this.#revertState
|
|
362
|
-
};
|
|
300
|
+
return { ...this.#revertState };
|
|
363
301
|
}
|
|
364
302
|
return {
|
|
365
303
|
...state,
|
|
366
|
-
error
|
|
304
|
+
error,
|
|
367
305
|
errorUpdateCount: state.errorUpdateCount + 1,
|
|
368
306
|
errorUpdatedAt: Date.now(),
|
|
369
307
|
fetchFailureCount: state.fetchFailureCount + 1,
|
|
370
308
|
fetchFailureReason: error,
|
|
371
|
-
fetchStatus:
|
|
372
|
-
status:
|
|
309
|
+
fetchStatus: "idle",
|
|
310
|
+
status: "error"
|
|
373
311
|
};
|
|
374
|
-
case
|
|
312
|
+
case "invalidate":
|
|
375
313
|
return {
|
|
376
314
|
...state,
|
|
377
315
|
isInvalidated: true
|
|
378
316
|
};
|
|
379
|
-
case
|
|
317
|
+
case "setState":
|
|
380
318
|
return {
|
|
381
319
|
...state,
|
|
382
320
|
...action.state
|
|
@@ -385,21 +323,17 @@ class Query extends Removable {
|
|
|
385
323
|
};
|
|
386
324
|
this.state = reducer(this.state);
|
|
387
325
|
notifyManager.batch(() => {
|
|
388
|
-
this.#observers.forEach(observer => {
|
|
326
|
+
this.#observers.forEach((observer) => {
|
|
389
327
|
observer.onQueryUpdate();
|
|
390
328
|
});
|
|
391
|
-
this.#cache.notify({
|
|
392
|
-
query: this,
|
|
393
|
-
type: 'updated',
|
|
394
|
-
action
|
|
395
|
-
});
|
|
329
|
+
this.#cache.notify({ query: this, type: "updated", action });
|
|
396
330
|
});
|
|
397
331
|
}
|
|
398
332
|
}
|
|
399
333
|
function getDefaultState(options) {
|
|
400
|
-
const data = typeof options.initialData ===
|
|
401
|
-
const hasData = typeof data !==
|
|
402
|
-
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt ===
|
|
334
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
335
|
+
const hasData = typeof data !== "undefined";
|
|
336
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
403
337
|
return {
|
|
404
338
|
data,
|
|
405
339
|
dataUpdateCount: 0,
|
|
@@ -411,10 +345,11 @@ function getDefaultState(options) {
|
|
|
411
345
|
fetchFailureReason: null,
|
|
412
346
|
fetchMeta: null,
|
|
413
347
|
isInvalidated: false,
|
|
414
|
-
status: hasData ?
|
|
415
|
-
fetchStatus:
|
|
348
|
+
status: hasData ? "success" : "pending",
|
|
349
|
+
fetchStatus: "idle"
|
|
416
350
|
};
|
|
417
351
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
352
|
+
export {
|
|
353
|
+
Query
|
|
354
|
+
};
|
|
355
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/query.ts"],"sourcesContent":["import { noop, replaceData, timeUntilStale } from './utils'\nimport { notifyManager } from './notifyManager'\nimport { canFetch, createRetryer, isCancelledError } from './retryer'\nimport { Removable } from './removable'\nimport type {\n CancelOptions,\n DefaultError,\n FetchStatus,\n InitialDataFunction,\n QueryFunctionContext,\n QueryKey,\n QueryMeta,\n QueryOptions,\n QueryStatus,\n SetDataOptions,\n} from './types'\nimport type { QueryCache } from './queryCache'\nimport type { QueryObserver } from './queryObserver'\nimport type { Retryer } from './retryer'\n\n// TYPES\n\ninterface QueryConfig<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n cache: QueryCache\n queryKey: TQueryKey\n queryHash: string\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n defaultOptions?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n state?: QueryState<TData, TError>\n}\n\nexport interface QueryState<TData = unknown, TError = DefaultError> {\n data: TData | undefined\n dataUpdateCount: number\n dataUpdatedAt: number\n error: TError | null\n errorUpdateCount: number\n errorUpdatedAt: number\n fetchFailureCount: number\n fetchFailureReason: TError | null\n fetchMeta: FetchMeta | null\n isInvalidated: boolean\n status: QueryStatus\n fetchStatus: FetchStatus\n}\n\nexport interface FetchContext<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n fetchFn: () => unknown | Promise<unknown>\n fetchOptions?: FetchOptions\n signal: AbortSignal\n options: QueryOptions<TQueryFnData, TError, TData, any>\n queryKey: TQueryKey\n state: QueryState<TData, TError>\n}\n\nexport interface QueryBehavior<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n onFetch: (\n context: FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n ) => void\n}\n\nexport type FetchDirection = 'forward' | 'backward'\n\nexport interface FetchMeta {\n fetchMore?: { direction: FetchDirection }\n}\n\nexport interface FetchOptions {\n cancelRefetch?: boolean\n meta?: FetchMeta\n}\n\ninterface FailedAction<TError> {\n type: 'failed'\n failureCount: number\n error: TError\n}\n\ninterface FetchAction {\n type: 'fetch'\n meta?: FetchMeta\n}\n\ninterface SuccessAction<TData> {\n data: TData | undefined\n type: 'success'\n dataUpdatedAt?: number\n manual?: boolean\n}\n\ninterface ErrorAction<TError> {\n type: 'error'\n error: TError\n}\n\ninterface InvalidateAction {\n type: 'invalidate'\n}\n\ninterface PauseAction {\n type: 'pause'\n}\n\ninterface ContinueAction {\n type: 'continue'\n}\n\ninterface SetStateAction<TData, TError> {\n type: 'setState'\n state: Partial<QueryState<TData, TError>>\n setStateOptions?: SetStateOptions\n}\n\nexport type Action<TData, TError> =\n | ContinueAction\n | ErrorAction<TError>\n | FailedAction<TError>\n | FetchAction\n | InvalidateAction\n | PauseAction\n | SetStateAction<TData, TError>\n | SuccessAction<TData>\n\nexport interface SetStateOptions {\n meta?: any\n}\n\n// CLASS\n\nexport class Query<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends Removable {\n queryKey: TQueryKey\n queryHash: string\n options!: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n state: QueryState<TData, TError>\n isFetchingOptimistic?: boolean\n\n #initialState: QueryState<TData, TError>\n #revertState?: QueryState<TData, TError>\n #cache: QueryCache\n #promise?: Promise<TData>\n #retryer?: Retryer<TData>\n #observers: QueryObserver<any, any, any, any, any>[]\n #defaultOptions?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>\n #abortSignalConsumed: boolean\n\n constructor(config: QueryConfig<TQueryFnData, TError, TData, TQueryKey>) {\n super()\n\n this.#abortSignalConsumed = false\n this.#defaultOptions = config.defaultOptions\n this.#setOptions(config.options)\n this.#observers = []\n this.#cache = config.cache\n this.queryKey = config.queryKey\n this.queryHash = config.queryHash\n this.#initialState = config.state || getDefaultState(this.options)\n this.state = this.#initialState\n this.scheduleGc()\n }\n get meta(): QueryMeta | undefined {\n return this.options.meta\n }\n\n #setOptions(\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): void {\n this.options = { ...this.#defaultOptions, ...options }\n\n this.updateGcTime(this.options.gcTime)\n }\n\n protected optionalRemove() {\n if (!this.#observers.length && this.state.fetchStatus === 'idle') {\n this.#cache.remove(this)\n }\n }\n\n setData(\n newData: TData,\n options?: SetDataOptions & { manual: boolean },\n ): TData {\n const data = replaceData(this.state.data, newData, this.options)\n\n // Set data and mark it as cached\n this.#dispatch({\n data,\n type: 'success',\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual,\n })\n\n return data\n }\n\n setState(\n state: Partial<QueryState<TData, TError>>,\n setStateOptions?: SetStateOptions,\n ): void {\n this.#dispatch({ type: 'setState', state, setStateOptions })\n }\n\n cancel(options?: CancelOptions): Promise<void> {\n const promise = this.#promise\n this.#retryer?.cancel(options)\n return promise ? promise.then(noop).catch(noop) : Promise.resolve()\n }\n\n destroy(): void {\n super.destroy()\n\n this.cancel({ silent: true })\n }\n\n reset(): void {\n this.destroy()\n this.setState(this.#initialState)\n }\n\n isActive(): boolean {\n return this.#observers.some(\n (observer) => observer.options.enabled !== false,\n )\n }\n\n isDisabled(): boolean {\n return this.getObserversCount() > 0 && !this.isActive()\n }\n\n isStale(): boolean {\n return (\n this.state.isInvalidated ||\n !this.state.dataUpdatedAt ||\n this.#observers.some((observer) => observer.getCurrentResult().isStale)\n )\n }\n\n isStaleByTime(staleTime = 0): boolean {\n return (\n this.state.isInvalidated ||\n !this.state.dataUpdatedAt ||\n !timeUntilStale(this.state.dataUpdatedAt, staleTime)\n )\n }\n\n onFocus(): void {\n const observer = this.#observers.find((x) => x.shouldFetchOnWindowFocus())\n\n observer?.refetch({ cancelRefetch: false })\n\n // Continue fetch if currently paused\n this.#retryer?.continue()\n }\n\n onOnline(): void {\n const observer = this.#observers.find((x) => x.shouldFetchOnReconnect())\n\n observer?.refetch({ cancelRefetch: false })\n\n // Continue fetch if currently paused\n this.#retryer?.continue()\n }\n\n addObserver(observer: QueryObserver<any, any, any, any, any>): void {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer)\n\n // Stop the query from being garbage collected\n this.clearGcTimeout()\n\n this.#cache.notify({ type: 'observerAdded', query: this, observer })\n }\n }\n\n removeObserver(observer: QueryObserver<any, any, any, any, any>): void {\n if (this.#observers.includes(observer)) {\n this.#observers = this.#observers.filter((x) => x !== observer)\n\n if (!this.#observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({ revert: true })\n } else {\n this.#retryer.cancelRetry()\n }\n }\n\n this.scheduleGc()\n }\n\n this.#cache.notify({ type: 'observerRemoved', query: this, observer })\n }\n }\n\n getObserversCount(): number {\n return this.#observers.length\n }\n\n invalidate(): void {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: 'invalidate' })\n }\n }\n\n fetch(\n options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n fetchOptions?: FetchOptions,\n ): Promise<TData> {\n if (this.state.fetchStatus !== 'idle') {\n if (this.state.dataUpdatedAt && fetchOptions?.cancelRefetch) {\n // Silently cancel current fetch if the user wants to cancel refetches\n this.cancel({ silent: true })\n } else if (this.#promise) {\n // make sure that retries that were potentially cancelled due to unmounts can continue\n this.#retryer?.continueRetry()\n // Return current promise if we are already fetching\n return this.#promise\n }\n }\n\n // Update config if passed, otherwise the config from the last execution is used\n if (options) {\n this.#setOptions(options)\n }\n\n // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n if (!this.options.queryFn) {\n const observer = this.#observers.find((x) => x.options.queryFn)\n if (observer) {\n this.#setOptions(observer.options)\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`,\n )\n }\n }\n\n const abortController = new AbortController()\n\n // Create query function context\n const queryFnContext: Omit<QueryFunctionContext<TQueryKey>, 'signal'> = {\n queryKey: this.queryKey,\n meta: this.meta,\n }\n\n // Adds an enumerable signal property to the object that\n // which sets abortSignalConsumed to true when the signal\n // is read.\n const addSignalProperty = (object: unknown) => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true\n return abortController.signal\n },\n })\n }\n\n addSignalProperty(queryFnContext)\n\n // Create fetch function\n const fetchFn = () => {\n if (!this.options.queryFn) {\n return Promise.reject(\n new Error(`Missing queryFn: '${this.options.queryHash}'`),\n )\n }\n this.#abortSignalConsumed = false\n return this.options.queryFn(\n queryFnContext as QueryFunctionContext<TQueryKey>,\n )\n }\n\n // Trigger behavior hook\n const context: Omit<\n FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n 'signal'\n > = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn,\n }\n\n addSignalProperty(context)\n\n this.options.behavior?.onFetch(\n context as FetchContext<TQueryFnData, TError, TData, TQueryKey>,\n )\n\n // Store state in case the current fetch needs to be reverted\n this.#revertState = this.state\n\n // Set to fetching state if not already in it\n if (\n this.state.fetchStatus === 'idle' ||\n this.state.fetchMeta !== context.fetchOptions?.meta\n ) {\n this.#dispatch({ type: 'fetch', meta: context.fetchOptions?.meta })\n }\n\n const onError = (error: TError | { silent?: boolean }) => {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n this.#dispatch({\n type: 'error',\n error: error as TError,\n })\n }\n\n if (!isCancelledError(error)) {\n // Notify cache callback\n this.#cache.config.onError?.(\n error as any,\n this as Query<any, any, any, any>,\n )\n this.#cache.config.onSettled?.(\n this.state.data,\n error as any,\n this as Query<any, any, any, any>,\n )\n }\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc()\n }\n this.isFetchingOptimistic = false\n }\n\n // Try to fetch the data\n this.#retryer = createRetryer({\n fn: context.fetchFn as () => Promise<TData>,\n abort: abortController.abort.bind(abortController),\n onSuccess: (data) => {\n if (typeof data === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`,\n )\n }\n onError(new Error(`${this.queryHash} data is undefined`) as any)\n return\n }\n\n this.setData(data)\n\n // Notify cache callback\n this.#cache.config.onSuccess?.(data, this as Query<any, any, any, any>)\n this.#cache.config.onSettled?.(\n data,\n this.state.error as any,\n this as Query<any, any, any, any>,\n )\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc()\n }\n this.isFetchingOptimistic = false\n },\n onError,\n onFail: (failureCount, error) => {\n this.#dispatch({ type: 'failed', failureCount, error })\n },\n onPause: () => {\n this.#dispatch({ type: 'pause' })\n },\n onContinue: () => {\n this.#dispatch({ type: 'continue' })\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n })\n\n this.#promise = this.#retryer.promise\n\n return this.#promise\n }\n\n #dispatch(action: Action<TData, TError>): void {\n const reducer = (\n state: QueryState<TData, TError>,\n ): QueryState<TData, TError> => {\n switch (action.type) {\n case 'failed':\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error,\n }\n case 'pause':\n return {\n ...state,\n fetchStatus: 'paused',\n }\n case 'continue':\n return {\n ...state,\n fetchStatus: 'fetching',\n }\n case 'fetch':\n return {\n ...state,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: action.meta ?? null,\n fetchStatus: canFetch(this.options.networkMode)\n ? 'fetching'\n : 'paused',\n ...(!state.dataUpdatedAt && {\n error: null,\n status: 'pending',\n }),\n }\n case 'success':\n return {\n ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: 'success',\n ...(!action.manual && {\n fetchStatus: 'idle',\n fetchFailureCount: 0,\n fetchFailureReason: null,\n }),\n }\n case 'error':\n const error = action.error as unknown\n\n if (isCancelledError(error) && error.revert && this.#revertState) {\n return { ...this.#revertState }\n }\n\n return {\n ...state,\n error: error as TError,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error as TError,\n fetchStatus: 'idle',\n status: 'error',\n }\n case 'invalidate':\n return {\n ...state,\n isInvalidated: true,\n }\n case 'setState':\n return {\n ...state,\n ...action.state,\n }\n }\n }\n\n this.state = reducer(this.state)\n\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onQueryUpdate()\n })\n\n this.#cache.notify({ query: this, type: 'updated', action })\n })\n }\n}\n\nfunction getDefaultState<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n>(\n options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): QueryState<TData, TError> {\n const data =\n typeof options.initialData === 'function'\n ? (options.initialData as InitialDataFunction<TData>)()\n : options.initialData\n\n const hasData = typeof data !== 'undefined'\n\n const initialDataUpdatedAt = hasData\n ? typeof options.initialDataUpdatedAt === 'function'\n ? (options.initialDataUpdatedAt as () => number | undefined)()\n : options.initialDataUpdatedAt\n : 0\n\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? 'success' : 'pending',\n fetchStatus: 'idle',\n }\n}\n"],"mappings":"AAAA,SAAS,MAAM,aAAa,sBAAsB;AAClD,SAAS,qBAAqB;AAC9B,SAAS,UAAU,eAAe,wBAAwB;AAC1D,SAAS,iBAAiB;AA6InB,MAAM,cAKH,UAAU;AAAA,EAgBlB,YAAY,QAA6D;AACvE,UAAM;AAEN,SAAK,uBAAuB;AAC5B,SAAK,kBAAkB,OAAO;AAC9B,SAAK,YAAY,OAAO,OAAO;AAC/B,SAAK,aAAa,CAAC;AACnB,SAAK,SAAS,OAAO;AACrB,SAAK,WAAW,OAAO;AACvB,SAAK,YAAY,OAAO;AACxB,SAAK,gBAAgB,OAAO,SAAS,gBAAgB,KAAK,OAAO;AACjE,SAAK,QAAQ,KAAK;AAClB,SAAK,WAAW;AAAA,EAClB;AAAA,EAtBA;AAAA,EACA;AAAA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