@tanstack/vue-query 5.101.4 → 5.102.1
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/README.md +17 -0
- package/build/legacy/devtools/devtools.cjs +203 -258
- package/build/legacy/devtools/devtools.cjs.map +1 -1
- package/build/legacy/devtools/devtools.d.cts +6 -1
- package/build/legacy/devtools/devtools.d.cts.map +1 -0
- package/build/legacy/devtools/devtools.d.ts +6 -1
- package/build/legacy/devtools/devtools.d.ts.map +1 -0
- package/build/legacy/devtools/devtools.js +200 -236
- package/build/legacy/devtools/devtools.js.map +1 -1
- package/build/legacy/devtools/utils.cjs +37 -94
- package/build/legacy/devtools/utils.cjs.map +1 -1
- package/build/legacy/devtools/utils.d.cts +18 -5
- package/build/legacy/devtools/utils.d.cts.map +1 -0
- package/build/legacy/devtools/utils.d.ts +18 -5
- package/build/legacy/devtools/utils.d.ts.map +1 -0
- package/build/legacy/devtools/utils.js +32 -65
- package/build/legacy/devtools/utils.js.map +1 -1
- package/build/legacy/index.cjs +44 -83
- package/build/legacy/index.d.cts +17 -173
- package/build/legacy/index.d.ts +17 -173
- package/build/legacy/index.js +6 -27
- package/build/legacy/infiniteQueryOptions.cjs +6 -30
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +2 -3
- package/build/legacy/infiniteQueryOptions.d.ts +2 -3
- package/build/legacy/infiniteQueryOptions.js +5 -5
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationCache.cjs +13 -37
- package/build/legacy/mutationCache.cjs.map +1 -1
- package/build/legacy/mutationCache.d.cts +10 -1
- package/build/legacy/mutationCache.d.cts.map +1 -0
- package/build/legacy/mutationCache.d.ts +10 -1
- package/build/legacy/mutationCache.d.ts.map +1 -0
- package/build/legacy/mutationCache.js +12 -12
- package/build/legacy/mutationCache.js.map +1 -1
- package/build/legacy/mutationOptions.cjs +6 -30
- package/build/legacy/mutationOptions.cjs.map +1 -1
- package/build/legacy/mutationOptions.d.cts +10 -1
- package/build/legacy/mutationOptions.d.cts.map +1 -0
- package/build/legacy/mutationOptions.d.ts +10 -1
- package/build/legacy/mutationOptions.d.ts.map +1 -0
- package/build/legacy/mutationOptions.js +5 -5
- package/build/legacy/mutationOptions.js.map +1 -1
- package/build/legacy/queryCache.cjs +13 -37
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +10 -1
- package/build/legacy/queryCache.d.cts.map +1 -0
- package/build/legacy/queryCache.d.ts +10 -1
- package/build/legacy/queryCache.d.ts.map +1 -0
- package/build/legacy/queryCache.js +12 -12
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/queryClient-C07d0chJ.d.cts +97 -0
- package/build/legacy/queryClient-C07d0chJ.d.cts.map +1 -0
- package/build/legacy/queryClient-hf6i_vCa.d.ts +97 -0
- package/build/legacy/queryClient-hf6i_vCa.d.ts.map +1 -0
- package/build/legacy/queryClient.cjs +104 -142
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +2 -1
- package/build/legacy/queryClient.d.ts +2 -1
- package/build/legacy/queryClient.js +103 -117
- package/build/legacy/queryClient.js.map +1 -1
- package/build/legacy/queryOptions.cjs +6 -30
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +19 -4
- package/build/legacy/queryOptions.d.cts.map +1 -0
- package/build/legacy/queryOptions.d.ts +19 -4
- package/build/legacy/queryOptions.d.ts.map +1 -0
- package/build/legacy/queryOptions.js +5 -5
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/types-BzZi3_rS.d.cts +33 -0
- package/build/legacy/types-BzZi3_rS.d.cts.map +1 -0
- package/build/legacy/types-BzZi3_rS.d.ts +33 -0
- package/build/legacy/types-BzZi3_rS.d.ts.map +1 -0
- package/build/legacy/types.cjs +0 -19
- package/build/legacy/types.d.cts +2 -11
- package/build/legacy/types.d.ts +2 -11
- package/build/legacy/types.js +1 -1
- package/build/legacy/useBaseQuery.cjs +78 -140
- package/build/legacy/useBaseQuery.cjs.map +1 -1
- package/build/legacy/useBaseQuery.d.cts +2 -2
- package/build/legacy/useBaseQuery.d.ts +2 -2
- package/build/legacy/useBaseQuery.js +76 -124
- package/build/legacy/useBaseQuery.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs +8 -36
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +2 -3
- package/build/legacy/useInfiniteQuery.d.ts +2 -3
- package/build/legacy/useInfiniteQuery.js +6 -10
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +23 -51
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +10 -2
- package/build/legacy/useIsFetching.d.cts.map +1 -0
- package/build/legacy/useIsFetching.d.ts +10 -2
- package/build/legacy/useIsFetching.d.ts.map +1 -0
- package/build/legacy/useIsFetching.js +21 -25
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +42 -76
- package/build/legacy/useMutation.cjs.map +1 -1
- package/build/legacy/useMutation.d.cts +17 -3
- package/build/legacy/useMutation.d.cts.map +1 -0
- package/build/legacy/useMutation.d.ts +17 -3
- package/build/legacy/useMutation.d.ts.map +1 -0
- package/build/legacy/useMutation.js +39 -59
- package/build/legacy/useMutation.js.map +1 -1
- package/build/legacy/useMutationState.cjs +38 -75
- package/build/legacy/useMutationState.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +16 -4
- package/build/legacy/useMutationState.d.cts.map +1 -0
- package/build/legacy/useMutationState.d.ts +16 -4
- package/build/legacy/useMutationState.d.ts.map +1 -0
- package/build/legacy/useMutationState.js +35 -55
- package/build/legacy/useMutationState.js.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.cjs +19 -50
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +11 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +11 -2
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.js +17 -24
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/legacy/usePrefetchQuery.cjs +19 -48
- package/build/legacy/usePrefetchQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchQuery.d.cts +11 -2
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -0
- package/build/legacy/usePrefetchQuery.d.ts +11 -2
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -0
- package/build/legacy/usePrefetchQuery.js +17 -22
- package/build/legacy/usePrefetchQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs +57 -113
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +63 -3
- package/build/legacy/useQueries.d.cts.map +1 -0
- package/build/legacy/useQueries.d.ts +63 -3
- package/build/legacy/useQueries.d.ts.map +1 -0
- package/build/legacy/useQueries.js +55 -96
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs +8 -32
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +2 -6
- package/build/legacy/useQuery.d.ts +2 -6
- package/build/legacy/useQuery.js +6 -6
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useQueryClient.cjs +12 -44
- package/build/legacy/useQueryClient.cjs.map +1 -1
- package/build/legacy/useQueryClient.d.cts +6 -1
- package/build/legacy/useQueryClient.d.cts.map +1 -0
- package/build/legacy/useQueryClient.d.ts +6 -1
- package/build/legacy/useQueryClient.d.ts.map +1 -0
- package/build/legacy/useQueryClient.js +10 -18
- package/build/legacy/useQueryClient.js.map +1 -1
- package/build/legacy/utils.cjs +40 -89
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +11 -6
- package/build/legacy/utils.d.cts.map +1 -0
- package/build/legacy/utils.d.ts +11 -6
- package/build/legacy/utils.d.ts.map +1 -0
- package/build/legacy/utils.js +32 -57
- package/build/legacy/utils.js.map +1 -1
- package/build/legacy/vueQueryPlugin.cjs +61 -103
- package/build/legacy/vueQueryPlugin.cjs.map +1 -1
- package/build/legacy/vueQueryPlugin.d.cts +23 -2
- package/build/legacy/vueQueryPlugin.d.cts.map +1 -0
- package/build/legacy/vueQueryPlugin.d.ts +23 -2
- package/build/legacy/vueQueryPlugin.d.ts.map +1 -0
- package/build/legacy/vueQueryPlugin.js +59 -77
- package/build/legacy/vueQueryPlugin.js.map +1 -1
- package/build/modern/devtools/devtools.cjs +201 -256
- package/build/modern/devtools/devtools.cjs.map +1 -1
- package/build/modern/devtools/devtools.d.cts +6 -1
- package/build/modern/devtools/devtools.d.cts.map +1 -0
- package/build/modern/devtools/devtools.d.ts +6 -1
- package/build/modern/devtools/devtools.d.ts.map +1 -0
- package/build/modern/devtools/devtools.js +198 -234
- package/build/modern/devtools/devtools.js.map +1 -1
- package/build/modern/devtools/utils.cjs +37 -94
- package/build/modern/devtools/utils.cjs.map +1 -1
- package/build/modern/devtools/utils.d.cts +18 -5
- package/build/modern/devtools/utils.d.cts.map +1 -0
- package/build/modern/devtools/utils.d.ts +18 -5
- package/build/modern/devtools/utils.d.ts.map +1 -0
- package/build/modern/devtools/utils.js +32 -65
- package/build/modern/devtools/utils.js.map +1 -1
- package/build/modern/index.cjs +44 -83
- package/build/modern/index.d.cts +17 -173
- package/build/modern/index.d.ts +17 -173
- package/build/modern/index.js +6 -27
- package/build/modern/infiniteQueryOptions.cjs +6 -30
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +2 -3
- package/build/modern/infiniteQueryOptions.d.ts +2 -3
- package/build/modern/infiniteQueryOptions.js +5 -5
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationCache.cjs +13 -37
- package/build/modern/mutationCache.cjs.map +1 -1
- package/build/modern/mutationCache.d.cts +10 -1
- package/build/modern/mutationCache.d.cts.map +1 -0
- package/build/modern/mutationCache.d.ts +10 -1
- package/build/modern/mutationCache.d.ts.map +1 -0
- package/build/modern/mutationCache.js +12 -12
- package/build/modern/mutationCache.js.map +1 -1
- package/build/modern/mutationOptions.cjs +6 -30
- package/build/modern/mutationOptions.cjs.map +1 -1
- package/build/modern/mutationOptions.d.cts +10 -1
- package/build/modern/mutationOptions.d.cts.map +1 -0
- package/build/modern/mutationOptions.d.ts +10 -1
- package/build/modern/mutationOptions.d.ts.map +1 -0
- package/build/modern/mutationOptions.js +5 -5
- package/build/modern/mutationOptions.js.map +1 -1
- package/build/modern/queryCache.cjs +13 -37
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +10 -1
- package/build/modern/queryCache.d.cts.map +1 -0
- package/build/modern/queryCache.d.ts +10 -1
- package/build/modern/queryCache.d.ts.map +1 -0
- package/build/modern/queryCache.js +12 -12
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/queryClient-C07d0chJ.d.cts +97 -0
- package/build/modern/queryClient-C07d0chJ.d.cts.map +1 -0
- package/build/modern/queryClient-hf6i_vCa.d.ts +97 -0
- package/build/modern/queryClient-hf6i_vCa.d.ts.map +1 -0
- package/build/modern/queryClient.cjs +104 -142
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +2 -1
- package/build/modern/queryClient.d.ts +2 -1
- package/build/modern/queryClient.js +103 -117
- package/build/modern/queryClient.js.map +1 -1
- package/build/modern/queryOptions.cjs +6 -30
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +19 -4
- package/build/modern/queryOptions.d.cts.map +1 -0
- package/build/modern/queryOptions.d.ts +19 -4
- package/build/modern/queryOptions.d.ts.map +1 -0
- package/build/modern/queryOptions.js +5 -5
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/types-BzZi3_rS.d.cts +33 -0
- package/build/modern/types-BzZi3_rS.d.cts.map +1 -0
- package/build/modern/types-BzZi3_rS.d.ts +33 -0
- package/build/modern/types-BzZi3_rS.d.ts.map +1 -0
- package/build/modern/types.cjs +0 -19
- package/build/modern/types.d.cts +2 -11
- package/build/modern/types.d.ts +2 -11
- package/build/modern/types.js +1 -1
- package/build/modern/useBaseQuery.cjs +77 -139
- package/build/modern/useBaseQuery.cjs.map +1 -1
- package/build/modern/useBaseQuery.d.cts +2 -2
- package/build/modern/useBaseQuery.d.ts +2 -2
- package/build/modern/useBaseQuery.js +75 -123
- package/build/modern/useBaseQuery.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs +8 -36
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +2 -3
- package/build/modern/useInfiniteQuery.d.ts +2 -3
- package/build/modern/useInfiniteQuery.js +6 -10
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +23 -51
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +10 -2
- package/build/modern/useIsFetching.d.cts.map +1 -0
- package/build/modern/useIsFetching.d.ts +10 -2
- package/build/modern/useIsFetching.d.ts.map +1 -0
- package/build/modern/useIsFetching.js +21 -25
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +42 -76
- package/build/modern/useMutation.cjs.map +1 -1
- package/build/modern/useMutation.d.cts +17 -3
- package/build/modern/useMutation.d.cts.map +1 -0
- package/build/modern/useMutation.d.ts +17 -3
- package/build/modern/useMutation.d.ts.map +1 -0
- package/build/modern/useMutation.js +39 -59
- package/build/modern/useMutation.js.map +1 -1
- package/build/modern/useMutationState.cjs +38 -75
- package/build/modern/useMutationState.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +16 -4
- package/build/modern/useMutationState.d.cts.map +1 -0
- package/build/modern/useMutationState.d.ts +16 -4
- package/build/modern/useMutationState.d.ts.map +1 -0
- package/build/modern/useMutationState.js +35 -55
- package/build/modern/useMutationState.js.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.cjs +19 -50
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts +11 -2
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.d.ts +11 -2
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.js +17 -24
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/modern/usePrefetchQuery.cjs +19 -48
- package/build/modern/usePrefetchQuery.cjs.map +1 -1
- package/build/modern/usePrefetchQuery.d.cts +11 -2
- package/build/modern/usePrefetchQuery.d.cts.map +1 -0
- package/build/modern/usePrefetchQuery.d.ts +11 -2
- package/build/modern/usePrefetchQuery.d.ts.map +1 -0
- package/build/modern/usePrefetchQuery.js +17 -22
- package/build/modern/usePrefetchQuery.js.map +1 -1
- package/build/modern/useQueries.cjs +56 -112
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +63 -3
- package/build/modern/useQueries.d.cts.map +1 -0
- package/build/modern/useQueries.d.ts +63 -3
- package/build/modern/useQueries.d.ts.map +1 -0
- package/build/modern/useQueries.js +54 -95
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs +8 -32
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +2 -6
- package/build/modern/useQuery.d.ts +2 -6
- package/build/modern/useQuery.js +6 -6
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useQueryClient.cjs +12 -44
- package/build/modern/useQueryClient.cjs.map +1 -1
- package/build/modern/useQueryClient.d.cts +6 -1
- package/build/modern/useQueryClient.d.cts.map +1 -0
- package/build/modern/useQueryClient.d.ts +6 -1
- package/build/modern/useQueryClient.d.ts.map +1 -0
- package/build/modern/useQueryClient.js +10 -18
- package/build/modern/useQueryClient.js.map +1 -1
- package/build/modern/utils.cjs +40 -89
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +11 -6
- package/build/modern/utils.d.cts.map +1 -0
- package/build/modern/utils.d.ts +11 -6
- package/build/modern/utils.d.ts.map +1 -0
- package/build/modern/utils.js +32 -57
- package/build/modern/utils.js.map +1 -1
- package/build/modern/vueQueryPlugin.cjs +60 -102
- package/build/modern/vueQueryPlugin.cjs.map +1 -1
- package/build/modern/vueQueryPlugin.d.cts +23 -2
- package/build/modern/vueQueryPlugin.d.cts.map +1 -0
- package/build/modern/vueQueryPlugin.d.ts +23 -2
- package/build/modern/vueQueryPlugin.d.ts.map +1 -0
- package/build/modern/vueQueryPlugin.js +58 -76
- package/build/modern/vueQueryPlugin.js.map +1 -1
- package/package.json +5 -7
- package/src/index.ts +5 -1
- package/src/infiniteQueryOptions.ts +5 -7
- package/src/queryClient.ts +150 -36
- package/src/queryOptions.ts +32 -14
- package/src/useMutation.ts +4 -4
- package/src/useMutationState.ts +33 -8
- package/src/usePrefetchInfiniteQuery.ts +22 -42
- package/src/usePrefetchQuery.ts +29 -5
- package/src/useQuery.ts +19 -9
- package/build/legacy/_tsup-dts-rollup.d.cts +0 -884
- package/build/legacy/_tsup-dts-rollup.d.ts +0 -884
- package/build/legacy/index.cjs.map +0 -1
- package/build/legacy/index.js.map +0 -1
- package/build/legacy/types.cjs.map +0 -1
- package/build/legacy/types.js.map +0 -1
- package/build/modern/_tsup-dts-rollup.d.cts +0 -884
- package/build/modern/_tsup-dts-rollup.d.ts +0 -884
- package/build/modern/index.cjs.map +0 -1
- package/build/modern/index.js.map +0 -1
- package/build/modern/types.cjs.map +0 -1
- package/build/modern/types.js.map +0 -1
|
@@ -1,80 +1,62 @@
|
|
|
1
|
-
// src/vueQueryPlugin.ts
|
|
2
|
-
import { isVue2 } from "vue-demi";
|
|
3
|
-
import { environmentManager } from "@tanstack/query-core";
|
|
4
|
-
import { QueryClient } from "./queryClient.js";
|
|
5
1
|
import { getClientKey } from "./utils.js";
|
|
2
|
+
import { QueryClient as QueryClient$1 } from "./queryClient.js";
|
|
6
3
|
import { setupDevtools } from "./devtools/devtools.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
app.provide(clientKey, client);
|
|
69
|
-
if (process.env.NODE_ENV === "development") {
|
|
70
|
-
if (options.enableDevtoolsV6Plugin) {
|
|
71
|
-
setupDevtools(app, client);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
export {
|
|
78
|
-
VueQueryPlugin
|
|
79
|
-
};
|
|
4
|
+
import { environmentManager } from "@tanstack/query-core";
|
|
5
|
+
import { isVue2 } from "vue-demi";
|
|
6
|
+
//#region src/vueQueryPlugin.ts
|
|
7
|
+
const VueQueryPlugin = { install: (app, options = {}) => {
|
|
8
|
+
const clientKey = getClientKey(options.queryClientKey);
|
|
9
|
+
let client;
|
|
10
|
+
if ("queryClient" in options && options.queryClient) client = options.queryClient;
|
|
11
|
+
else {
|
|
12
|
+
const clientConfig = "queryClientConfig" in options ? options.queryClientConfig : void 0;
|
|
13
|
+
client = new QueryClient$1(clientConfig);
|
|
14
|
+
}
|
|
15
|
+
if (!environmentManager.isServer()) client.mount();
|
|
16
|
+
let persisterUnmount = () => {};
|
|
17
|
+
if (options.clientPersister) {
|
|
18
|
+
if (client.isRestoring) client.isRestoring.value = true;
|
|
19
|
+
const [unmount, promise] = options.clientPersister(client);
|
|
20
|
+
persisterUnmount = unmount;
|
|
21
|
+
promise.then(() => {
|
|
22
|
+
var _options$clientPersis;
|
|
23
|
+
if (client.isRestoring) client.isRestoring.value = false;
|
|
24
|
+
(_options$clientPersis = options.clientPersisterOnSuccess) === null || _options$clientPersis === void 0 || _options$clientPersis.call(options, client);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const cleanup = () => {
|
|
28
|
+
client.unmount();
|
|
29
|
+
persisterUnmount();
|
|
30
|
+
};
|
|
31
|
+
if (app.onUnmount) app.onUnmount(cleanup);
|
|
32
|
+
else {
|
|
33
|
+
const originalUnmount = app.unmount;
|
|
34
|
+
app.unmount = function vueQueryUnmount() {
|
|
35
|
+
cleanup();
|
|
36
|
+
originalUnmount();
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (isVue2) app.mixin({ beforeCreate() {
|
|
40
|
+
if (!this._provided) {
|
|
41
|
+
const provideCache = {};
|
|
42
|
+
Object.defineProperty(this, "_provided", {
|
|
43
|
+
get: () => provideCache,
|
|
44
|
+
set: (v) => Object.assign(provideCache, v)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
this._provided[clientKey] = client;
|
|
48
|
+
if (process.env.NODE_ENV === "development") {
|
|
49
|
+
if (this === this.$root && options.enableDevtoolsV6Plugin) setupDevtools(this, client);
|
|
50
|
+
}
|
|
51
|
+
} });
|
|
52
|
+
else {
|
|
53
|
+
app.provide(clientKey, client);
|
|
54
|
+
if (process.env.NODE_ENV === "development") {
|
|
55
|
+
if (options.enableDevtoolsV6Plugin) setupDevtools(app, client);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} };
|
|
59
|
+
//#endregion
|
|
60
|
+
export { VueQueryPlugin };
|
|
61
|
+
|
|
80
62
|
//# sourceMappingURL=vueQueryPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { environmentManager } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\nimport type { QueryClientConfig } from './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n enableDevtoolsV6Plugin?: boolean\n queryClientKey?: string\n clientPersister?: ClientPersister\n clientPersisterOnSuccess?: (client: QueryClient) => void\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: QueryClientConfig\n}\n\ninterface ClientOptions extends CommonOptions {\n queryClient?: QueryClient\n}\n\nexport type VueQueryPluginOptions = ConfigOptions | ClientOptions\n\nexport const VueQueryPlugin = {\n install: (app: any, options: VueQueryPluginOptions = {}) => {\n const clientKey = getClientKey(options.queryClientKey)\n let client: QueryClient\n\n if ('queryClient' in options && options.queryClient) {\n client = options.queryClient\n } else {\n const clientConfig =\n 'queryClientConfig' in options ? options.queryClientConfig : undefined\n client = new QueryClient(clientConfig)\n }\n\n if (!environmentManager.isServer()) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n if (client.isRestoring) {\n client.isRestoring.value = true\n }\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n if (client.isRestoring) {\n client.isRestoring.value = false\n }\n options.clientPersisterOnSuccess?.(client)\n })\n }\n\n const cleanup = () => {\n client.unmount()\n persisterUnmount()\n }\n\n if (app.onUnmount) {\n app.onUnmount(cleanup)\n } else {\n const originalUnmount = app.unmount\n app.unmount = function vueQueryUnmount() {\n cleanup()\n originalUnmount()\n }\n }\n\n if (isVue2) {\n app.mixin({\n beforeCreate() {\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30\n if (!this._provided) {\n const provideCache = {}\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n })\n }\n\n this._provided[clientKey] = client\n\n if (process.env.NODE_ENV === 'development') {\n if (this === this.$root && options.enableDevtoolsV6Plugin) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n if (options.enableDevtoolsV6Plugin) {\n setupDevtools(app, client)\n }\n }\n }\n },\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vueQueryPlugin.js","names":["QueryClient"],"sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { environmentManager } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\nimport type { QueryClientConfig } from './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n enableDevtoolsV6Plugin?: boolean\n queryClientKey?: string\n clientPersister?: ClientPersister\n clientPersisterOnSuccess?: (client: QueryClient) => void\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: QueryClientConfig\n}\n\ninterface ClientOptions extends CommonOptions {\n queryClient?: QueryClient\n}\n\nexport type VueQueryPluginOptions = ConfigOptions | ClientOptions\n\nexport const VueQueryPlugin = {\n install: (app: any, options: VueQueryPluginOptions = {}) => {\n const clientKey = getClientKey(options.queryClientKey)\n let client: QueryClient\n\n if ('queryClient' in options && options.queryClient) {\n client = options.queryClient\n } else {\n const clientConfig =\n 'queryClientConfig' in options ? options.queryClientConfig : undefined\n client = new QueryClient(clientConfig)\n }\n\n if (!environmentManager.isServer()) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n if (client.isRestoring) {\n client.isRestoring.value = true\n }\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n if (client.isRestoring) {\n client.isRestoring.value = false\n }\n options.clientPersisterOnSuccess?.(client)\n })\n }\n\n const cleanup = () => {\n client.unmount()\n persisterUnmount()\n }\n\n if (app.onUnmount) {\n app.onUnmount(cleanup)\n } else {\n const originalUnmount = app.unmount\n app.unmount = function vueQueryUnmount() {\n cleanup()\n originalUnmount()\n }\n }\n\n if (isVue2) {\n app.mixin({\n beforeCreate() {\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30\n if (!this._provided) {\n const provideCache = {}\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n })\n }\n\n this._provided[clientKey] = client\n\n if (process.env.NODE_ENV === 'development') {\n if (this === this.$root && options.enableDevtoolsV6Plugin) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n if (options.enableDevtoolsV6Plugin) {\n setupDevtools(app, client)\n }\n }\n }\n },\n}\n"],"mappings":";;;;;;AA2BA,MAAa,iBAAiB,EAC5B,UAAU,KAAU,UAAiC,CAAC,MAAM;CAC1D,MAAM,YAAY,aAAa,QAAQ,cAAc;CACrD,IAAI;CAEJ,IAAI,iBAAiB,WAAW,QAAQ,aACtC,SAAS,QAAQ;MACZ;EACL,MAAM,eACJ,uBAAuB,UAAU,QAAQ,oBAAoB,KAAA;EAC/D,SAAS,IAAIA,cAAY,YAAY;CACvC;CAEA,IAAI,CAAC,mBAAmB,SAAS,GAC/B,OAAO,MAAM;CAGf,IAAI,yBAAyB,CAE7B;CAEA,IAAI,QAAQ,iBAAiB;EAC3B,IAAI,OAAO,aACT,OAAO,YAAY,QAAQ;EAE7B,MAAM,CAAC,SAAS,WAAW,QAAQ,gBAAgB,MAAM;EACzD,mBAAmB;EACnB,QAAQ,WAAW;;GACjB,IAAI,OAAO,aACT,OAAO,YAAY,QAAQ;GAE7B,CAAA,wBAAA,QAAQ,8BAAA,QAAA,0BAAA,KAAA,KAAA,sBAAA,KAAA,SAA2B,MAAM;EAC3C,CAAC;CACH;CAEA,MAAM,gBAAgB;EACpB,OAAO,QAAQ;EACf,iBAAiB;CACnB;CAEA,IAAI,IAAI,WACN,IAAI,UAAU,OAAO;MAChB;EACL,MAAM,kBAAkB,IAAI;EAC5B,IAAI,UAAU,SAAS,kBAAkB;GACvC,QAAQ;GACR,gBAAgB;EAClB;CACF;CAEA,IAAI,QACF,IAAI,MAAM,EACR,eAAe;EAEb,IAAI,CAAC,KAAK,WAAW;GACnB,MAAM,eAAe,CAAC;GACtB,OAAO,eAAe,MAAM,aAAa;IACvC,WAAW;IACX,MAAM,MAAM,OAAO,OAAO,cAAc,CAAC;GAC3C,CAAC;EACH;EAEA,KAAK,UAAU,aAAa;EAE5B,IAAI,QAAQ,IAAI,aAAa,eACvB;OAAA,SAAS,KAAK,SAAS,QAAQ,wBACjC,cAAc,MAAM,MAAM;EAAA;CAGhC,EACF,CAAC;MACI;EACL,IAAI,QAAQ,WAAW,MAAM;EAE7B,IAAI,QAAQ,IAAI,aAAa,eACvB;OAAA,QAAQ,wBACV,cAAc,KAAK,MAAM;EAAA;CAG/B;AACF,EACF"}
|
|
@@ -1,259 +1,204 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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/devtools/devtools.ts
|
|
21
|
-
var devtools_exports = {};
|
|
22
|
-
__export(devtools_exports, {
|
|
23
|
-
setupDevtools: () => setupDevtools
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(devtools_exports);
|
|
26
|
-
var import_devtools_api = require("@vue/devtools-api");
|
|
27
|
-
var import_match_sorter_utils = require("@tanstack/match-sorter-utils");
|
|
28
|
-
var import_query_core = require("@tanstack/query-core");
|
|
29
|
-
var import_utils = require("./utils.cjs");
|
|
30
|
-
var pluginId = "vue-query";
|
|
31
|
-
var pluginName = "Vue Query";
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_devtools_utils = require("./utils.cjs");
|
|
3
|
+
let _tanstack_query_core = require("@tanstack/query-core");
|
|
4
|
+
let _vue_devtools_api = require("@vue/devtools-api");
|
|
5
|
+
let _tanstack_match_sorter_utils = require("@tanstack/match-sorter-utils");
|
|
6
|
+
//#region src/devtools/devtools.ts
|
|
7
|
+
const pluginId = "vue-query";
|
|
8
|
+
const pluginName = "Vue Query";
|
|
32
9
|
function setupDevtools(app, queryClient) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
key: "Query status",
|
|
226
|
-
value: (0, import_utils.getQueryStateLabel)(query)
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
key: "Observers",
|
|
230
|
-
value: query.getObserversCount()
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
key: "Last Updated",
|
|
234
|
-
value: new Date(query.state.dataUpdatedAt).toLocaleTimeString()
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"Data Explorer": [
|
|
238
|
-
{
|
|
239
|
-
key: "Data",
|
|
240
|
-
value: query.state.data
|
|
241
|
-
}
|
|
242
|
-
],
|
|
243
|
-
"Query Explorer": [
|
|
244
|
-
{
|
|
245
|
-
key: "Query",
|
|
246
|
-
value: query
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
);
|
|
10
|
+
(0, _vue_devtools_api.setupDevtoolsPlugin)({
|
|
11
|
+
id: pluginId,
|
|
12
|
+
label: pluginName,
|
|
13
|
+
packageName: "vue-query",
|
|
14
|
+
homepage: "https://tanstack.com/query/latest",
|
|
15
|
+
logo: "https://raw.githubusercontent.com/TanStack/query/main/packages/vue-query/media/vue-query.svg",
|
|
16
|
+
app,
|
|
17
|
+
settings: {
|
|
18
|
+
baseSort: {
|
|
19
|
+
type: "choice",
|
|
20
|
+
component: "button-group",
|
|
21
|
+
label: "Sort Cache Entries",
|
|
22
|
+
options: [{
|
|
23
|
+
label: "ASC",
|
|
24
|
+
value: 1
|
|
25
|
+
}, {
|
|
26
|
+
label: "DESC",
|
|
27
|
+
value: -1
|
|
28
|
+
}],
|
|
29
|
+
defaultValue: 1
|
|
30
|
+
},
|
|
31
|
+
sortFn: {
|
|
32
|
+
type: "choice",
|
|
33
|
+
label: "Sort Function",
|
|
34
|
+
options: Object.keys(require_devtools_utils.sortFns).map((key) => ({
|
|
35
|
+
label: key,
|
|
36
|
+
value: key
|
|
37
|
+
})),
|
|
38
|
+
defaultValue: Object.keys(require_devtools_utils.sortFns)[0]
|
|
39
|
+
},
|
|
40
|
+
onlineMode: {
|
|
41
|
+
type: "choice",
|
|
42
|
+
component: "button-group",
|
|
43
|
+
label: "Online mode",
|
|
44
|
+
options: [{
|
|
45
|
+
label: "Online",
|
|
46
|
+
value: 1
|
|
47
|
+
}, {
|
|
48
|
+
label: "Offline",
|
|
49
|
+
value: 0
|
|
50
|
+
}],
|
|
51
|
+
defaultValue: 1
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, (api) => {
|
|
55
|
+
const initialSettings = api.getSettings();
|
|
56
|
+
_tanstack_query_core.onlineManager.setOnline(Boolean(initialSettings.onlineMode.valueOf()));
|
|
57
|
+
const queryCache = queryClient.getQueryCache();
|
|
58
|
+
api.addInspector({
|
|
59
|
+
id: pluginId,
|
|
60
|
+
label: pluginName,
|
|
61
|
+
icon: "api",
|
|
62
|
+
nodeActions: [
|
|
63
|
+
{
|
|
64
|
+
icon: "file_download",
|
|
65
|
+
tooltip: "Refetch",
|
|
66
|
+
action: (queryHash) => {
|
|
67
|
+
queryCache.get(queryHash)?.fetch();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
icon: "alarm",
|
|
72
|
+
tooltip: "Invalidate",
|
|
73
|
+
action: (queryHash) => {
|
|
74
|
+
const query = queryCache.get(queryHash);
|
|
75
|
+
queryClient.invalidateQueries({
|
|
76
|
+
queryKey: query.queryKey,
|
|
77
|
+
exact: true
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
icon: "settings_backup_restore",
|
|
83
|
+
tooltip: "Reset",
|
|
84
|
+
action: (queryHash) => {
|
|
85
|
+
queryCache.get(queryHash)?.reset();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
icon: "delete",
|
|
90
|
+
tooltip: "Remove",
|
|
91
|
+
action: (queryHash) => {
|
|
92
|
+
const query = queryCache.get(queryHash);
|
|
93
|
+
queryCache.remove(query);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
icon: "hourglass_empty",
|
|
98
|
+
tooltip: "Force loading",
|
|
99
|
+
action: (queryHash) => {
|
|
100
|
+
queryCache.get(queryHash).setState({
|
|
101
|
+
data: void 0,
|
|
102
|
+
status: "pending"
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
icon: "error_outline",
|
|
108
|
+
tooltip: "Force error",
|
|
109
|
+
action: (queryHash) => {
|
|
110
|
+
queryCache.get(queryHash).setState({
|
|
111
|
+
data: void 0,
|
|
112
|
+
status: "error",
|
|
113
|
+
error: /* @__PURE__ */ new Error("Unknown error from devtools")
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
api.addTimelineLayer({
|
|
120
|
+
id: pluginId,
|
|
121
|
+
label: pluginName,
|
|
122
|
+
color: 16767308
|
|
123
|
+
});
|
|
124
|
+
queryCache.subscribe((event) => {
|
|
125
|
+
api.sendInspectorTree(pluginId);
|
|
126
|
+
api.sendInspectorState(pluginId);
|
|
127
|
+
if ([
|
|
128
|
+
"added",
|
|
129
|
+
"removed",
|
|
130
|
+
"updated"
|
|
131
|
+
].includes(event.type)) api.addTimelineEvent({
|
|
132
|
+
layerId: pluginId,
|
|
133
|
+
event: {
|
|
134
|
+
title: event.type,
|
|
135
|
+
subtitle: event.query.queryHash,
|
|
136
|
+
time: api.now(),
|
|
137
|
+
data: {
|
|
138
|
+
queryHash: event.query.queryHash,
|
|
139
|
+
...event
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
api.on.setPluginSettings((payload) => {
|
|
145
|
+
if (payload.key === "onlineMode") _tanstack_query_core.onlineManager.setOnline(Boolean(payload.newValue));
|
|
146
|
+
});
|
|
147
|
+
api.on.getInspectorTree((payload) => {
|
|
148
|
+
if (payload.inspectorId === pluginId) {
|
|
149
|
+
const queries = queryCache.getAll();
|
|
150
|
+
const settings = api.getSettings();
|
|
151
|
+
payload.rootNodes = (payload.filter ? queries.filter((item) => (0, _tanstack_match_sorter_utils.rankItem)(item.queryHash, payload.filter).passed) : [...queries]).sort((a, b) => require_devtools_utils.sortFns[settings.sortFn](a, b) * settings.baseSort).map((query) => {
|
|
152
|
+
const stateLabel = require_devtools_utils.getQueryStateLabel(query);
|
|
153
|
+
return {
|
|
154
|
+
id: query.queryHash,
|
|
155
|
+
label: query.queryHash,
|
|
156
|
+
tags: [{
|
|
157
|
+
label: `${stateLabel} [${query.getObserversCount()}]`,
|
|
158
|
+
textColor: require_devtools_utils.getQueryStatusFg(query),
|
|
159
|
+
backgroundColor: require_devtools_utils.getQueryStatusBg(query)
|
|
160
|
+
}]
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
api.on.getInspectorState((payload) => {
|
|
166
|
+
if (payload.inspectorId === pluginId) {
|
|
167
|
+
const query = queryCache.get(payload.nodeId);
|
|
168
|
+
if (!query) return;
|
|
169
|
+
payload.state = {
|
|
170
|
+
" Query Details": [
|
|
171
|
+
{
|
|
172
|
+
key: "Query key",
|
|
173
|
+
value: query.queryHash
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: "Query status",
|
|
177
|
+
value: require_devtools_utils.getQueryStateLabel(query)
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
key: "Observers",
|
|
181
|
+
value: query.getObserversCount()
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "Last Updated",
|
|
185
|
+
value: new Date(query.state.dataUpdatedAt).toLocaleTimeString()
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"Data Explorer": [{
|
|
189
|
+
key: "Data",
|
|
190
|
+
value: query.state.data
|
|
191
|
+
}],
|
|
192
|
+
"Query Explorer": [{
|
|
193
|
+
key: "Query",
|
|
194
|
+
value: query
|
|
195
|
+
}]
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
254
200
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
201
|
+
//#endregion
|
|
202
|
+
exports.setupDevtools = setupDevtools;
|
|
203
|
+
|
|
259
204
|
//# sourceMappingURL=devtools.cjs.map
|