@tanstack/vue-query 5.0.0-alpha.85 → 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/devtools/devtools.cjs +256 -0
- package/build/legacy/devtools/devtools.cjs.map +1 -0
- package/build/legacy/devtools/devtools.d.cts +8 -0
- package/build/legacy/devtools/devtools.d.ts +8 -0
- package/build/legacy/devtools/devtools.js +237 -0
- package/build/legacy/devtools/devtools.js.map +1 -0
- package/build/legacy/devtools/utils.cjs +111 -0
- package/build/legacy/devtools/utils.cjs.map +1 -0
- package/build/legacy/devtools/utils.d.cts +17 -0
- package/build/legacy/devtools/utils.d.ts +17 -0
- package/build/legacy/devtools/utils.js +83 -0
- package/build/legacy/devtools/utils.js.map +1 -0
- package/build/legacy/index.cjs +67 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +14 -0
- package/build/legacy/index.d.ts +14 -0
- package/build/legacy/index.js +29 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/mutationCache.cjs +38 -0
- package/build/legacy/mutationCache.cjs.map +1 -0
- package/build/legacy/mutationCache.d.cts +10 -0
- package/build/legacy/mutationCache.d.ts +10 -0
- package/build/legacy/mutationCache.js +14 -0
- package/build/legacy/mutationCache.js.map +1 -0
- package/build/legacy/queryCache.cjs +38 -0
- package/build/legacy/queryCache.cjs.map +1 -0
- package/build/legacy/queryCache.d.cts +10 -0
- package/build/legacy/queryCache.d.ts +10 -0
- package/build/legacy/queryCache.js +14 -0
- package/build/legacy/queryCache.js.map +1 -0
- package/build/legacy/queryClient.cjs +125 -0
- package/build/legacy/queryClient.cjs.map +1 -0
- package/build/legacy/queryClient.d.cts +31 -0
- package/build/{lib → legacy}/queryClient.d.ts +8 -6
- package/build/{lib/queryClient.legacy.js → legacy/queryClient.js} +32 -15
- package/build/legacy/queryClient.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 +9 -0
- package/build/legacy/types.d.ts +9 -0
- package/build/legacy/types.js +1 -0
- package/build/legacy/types.js.map +1 -0
- package/build/legacy/useBaseQuery.cjs +92 -0
- package/build/legacy/useBaseQuery.cjs.map +1 -0
- package/build/legacy/useBaseQuery.d.cts +5 -0
- package/build/legacy/useBaseQuery.d.ts +5 -0
- package/build/{lib → legacy}/useBaseQuery.js +40 -32
- package/build/legacy/useBaseQuery.js.map +1 -0
- package/build/legacy/useInfiniteQuery.cjs +44 -0
- package/build/legacy/useInfiniteQuery.cjs.map +1 -0
- package/build/legacy/useInfiniteQuery.d.cts +5 -0
- package/build/legacy/useInfiniteQuery.d.ts +5 -0
- package/build/legacy/useInfiniteQuery.js +20 -0
- package/build/legacy/useInfiniteQuery.js.map +1 -0
- package/build/legacy/useIsFetching.cjs +50 -0
- package/build/legacy/useIsFetching.cjs.map +1 -0
- package/build/legacy/useIsFetching.d.cts +9 -0
- package/build/legacy/useIsFetching.d.ts +9 -0
- package/build/{lib → legacy}/useIsFetching.js +14 -12
- package/build/legacy/useIsFetching.js.map +1 -0
- package/build/legacy/useMutation.cjs +64 -0
- package/build/legacy/useMutation.cjs.map +1 -0
- package/build/legacy/useMutation.d.cts +16 -0
- package/build/legacy/useMutation.d.ts +16 -0
- package/build/{lib → legacy}/useMutation.js +23 -15
- package/build/legacy/useMutation.js.map +1 -0
- package/build/legacy/useMutationState.cjs +70 -0
- package/build/legacy/useMutationState.cjs.map +1 -0
- package/build/legacy/useMutationState.d.cts +14 -0
- package/build/legacy/useMutationState.d.ts +14 -0
- package/build/{lib → legacy}/useMutationState.js +22 -17
- package/build/legacy/useMutationState.js.map +1 -0
- package/build/legacy/useQueries.cjs +93 -0
- package/build/legacy/useQueries.cjs.map +1 -0
- package/build/legacy/useQueries.d.cts +57 -0
- package/build/{lib → legacy}/useQueries.d.ts +11 -10
- package/build/legacy/useQueries.js +69 -0
- package/build/legacy/useQueries.js.map +1 -0
- package/build/legacy/useQuery-846c66db.d.ts +40 -0
- package/build/legacy/useQuery-ebff9211.d.ts +40 -0
- package/build/legacy/useQuery.cjs +37 -0
- package/build/legacy/useQuery.cjs.map +1 -0
- package/build/legacy/useQuery.d.cts +5 -0
- package/build/legacy/useQuery.d.ts +5 -0
- package/build/{lib → legacy}/useQuery.js +6 -6
- package/build/legacy/useQuery.js.map +1 -0
- package/build/legacy/useQueryClient.cjs +45 -0
- package/build/legacy/useQueryClient.cjs.map +1 -0
- package/build/legacy/useQueryClient.d.cts +8 -0
- package/build/legacy/useQueryClient.d.ts +8 -0
- package/build/legacy/useQueryClient.js +21 -0
- package/build/legacy/useQueryClient.js.map +1 -0
- package/build/legacy/utils.cjs +84 -0
- package/build/legacy/utils.cjs.map +1 -0
- package/build/legacy/utils.d.cts +10 -0
- package/build/legacy/utils.d.ts +10 -0
- package/build/legacy/utils.js +56 -0
- package/build/legacy/utils.js.map +1 -0
- package/build/legacy/vueQueryPlugin.cjs +95 -0
- package/build/legacy/vueQueryPlugin.cjs.map +1 -0
- package/build/legacy/vueQueryPlugin.d.cts +22 -0
- package/build/{lib → legacy}/vueQueryPlugin.d.ts +9 -7
- package/build/{lib → legacy}/vueQueryPlugin.js +15 -17
- package/build/legacy/vueQueryPlugin.js.map +1 -0
- package/build/modern/devtools/devtools.cjs +254 -0
- package/build/modern/devtools/devtools.cjs.map +1 -0
- package/build/modern/devtools/devtools.d.cts +8 -0
- package/build/modern/devtools/devtools.d.ts +8 -0
- package/build/modern/devtools/devtools.js +235 -0
- package/build/modern/devtools/devtools.js.map +1 -0
- package/build/modern/devtools/utils.cjs +111 -0
- package/build/modern/devtools/utils.cjs.map +1 -0
- package/build/modern/devtools/utils.d.cts +17 -0
- package/build/modern/devtools/utils.d.ts +17 -0
- package/build/modern/devtools/utils.js +83 -0
- package/build/modern/devtools/utils.js.map +1 -0
- package/build/modern/index.cjs +67 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +14 -0
- package/build/modern/index.d.ts +14 -0
- package/build/modern/index.js +29 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/mutationCache.cjs +38 -0
- package/build/modern/mutationCache.cjs.map +1 -0
- package/build/modern/mutationCache.d.cts +10 -0
- package/build/modern/mutationCache.d.ts +10 -0
- package/build/modern/mutationCache.js +14 -0
- package/build/modern/mutationCache.js.map +1 -0
- package/build/modern/queryCache.cjs +38 -0
- package/build/modern/queryCache.cjs.map +1 -0
- package/build/modern/queryCache.d.cts +10 -0
- package/build/modern/queryCache.d.ts +10 -0
- package/build/modern/queryCache.js +14 -0
- package/build/modern/queryCache.js.map +1 -0
- package/build/modern/queryClient.cjs +125 -0
- package/build/modern/queryClient.cjs.map +1 -0
- package/build/modern/queryClient.d.cts +31 -0
- package/build/modern/queryClient.d.ts +31 -0
- package/build/{lib → modern}/queryClient.js +33 -16
- package/build/modern/queryClient.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 +9 -0
- package/build/modern/types.d.ts +9 -0
- package/build/modern/types.js +1 -0
- package/build/modern/types.js.map +1 -0
- package/build/modern/useBaseQuery.cjs +92 -0
- package/build/modern/useBaseQuery.cjs.map +1 -0
- package/build/modern/useBaseQuery.d.cts +5 -0
- package/build/modern/useBaseQuery.d.ts +5 -0
- package/build/modern/useBaseQuery.js +75 -0
- package/build/modern/useBaseQuery.js.map +1 -0
- package/build/modern/useInfiniteQuery.cjs +44 -0
- package/build/modern/useInfiniteQuery.cjs.map +1 -0
- package/build/modern/useInfiniteQuery.d.cts +5 -0
- package/build/modern/useInfiniteQuery.d.ts +5 -0
- package/build/modern/useInfiniteQuery.js +20 -0
- package/build/modern/useInfiniteQuery.js.map +1 -0
- package/build/modern/useIsFetching.cjs +50 -0
- package/build/modern/useIsFetching.cjs.map +1 -0
- package/build/modern/useIsFetching.d.cts +9 -0
- package/build/modern/useIsFetching.d.ts +9 -0
- package/build/{lib/useIsFetching.legacy.js → modern/useIsFetching.js} +14 -12
- package/build/modern/useIsFetching.js.map +1 -0
- package/build/modern/useMutation.cjs +64 -0
- package/build/modern/useMutation.cjs.map +1 -0
- package/build/modern/useMutation.d.cts +16 -0
- package/build/modern/useMutation.d.ts +16 -0
- package/build/{lib/useMutation.legacy.js → modern/useMutation.js} +23 -15
- package/build/modern/useMutation.js.map +1 -0
- package/build/modern/useMutationState.cjs +70 -0
- package/build/modern/useMutationState.cjs.map +1 -0
- package/build/modern/useMutationState.d.cts +14 -0
- package/build/modern/useMutationState.d.ts +14 -0
- package/build/{lib/useMutationState.legacy.js → modern/useMutationState.js} +22 -17
- package/build/modern/useMutationState.js.map +1 -0
- package/build/modern/useQueries.cjs +93 -0
- package/build/modern/useQueries.cjs.map +1 -0
- package/build/modern/useQueries.d.cts +57 -0
- package/build/modern/useQueries.d.ts +57 -0
- package/build/modern/useQueries.js +69 -0
- package/build/modern/useQueries.js.map +1 -0
- package/build/modern/useQuery-846c66db.d.ts +40 -0
- package/build/modern/useQuery-ebff9211.d.ts +40 -0
- package/build/modern/useQuery.cjs +37 -0
- package/build/modern/useQuery.cjs.map +1 -0
- package/build/modern/useQuery.d.cts +5 -0
- package/build/modern/useQuery.d.ts +5 -0
- package/build/modern/useQuery.js +13 -0
- package/build/modern/useQuery.js.map +1 -0
- package/build/modern/useQueryClient.cjs +44 -0
- package/build/modern/useQueryClient.cjs.map +1 -0
- package/build/modern/useQueryClient.d.cts +8 -0
- package/build/modern/useQueryClient.d.ts +8 -0
- package/build/modern/useQueryClient.js +20 -0
- package/build/modern/useQueryClient.js.map +1 -0
- package/build/modern/utils.cjs +84 -0
- package/build/modern/utils.cjs.map +1 -0
- package/build/modern/utils.d.cts +10 -0
- package/build/modern/utils.d.ts +10 -0
- package/build/modern/utils.js +56 -0
- package/build/modern/utils.js.map +1 -0
- package/build/modern/vueQueryPlugin.cjs +95 -0
- package/build/modern/vueQueryPlugin.cjs.map +1 -0
- package/build/modern/vueQueryPlugin.d.cts +22 -0
- package/build/modern/vueQueryPlugin.d.ts +22 -0
- package/build/{lib/vueQueryPlugin.legacy.js → modern/vueQueryPlugin.js} +15 -17
- package/build/modern/vueQueryPlugin.js.map +1 -0
- package/package.json +16 -14
- package/build/lib/__mocks__/useBaseQuery.d.ts +0 -4
- package/build/lib/__mocks__/useBaseQuery.d.ts.map +0 -1
- package/build/lib/__mocks__/useQueryClient.d.ts +0 -4
- package/build/lib/__mocks__/useQueryClient.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__/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__/test-utils.d.ts +0 -13
- package/build/lib/__tests__/test-utils.d.ts.map +0 -1
- package/build/lib/__tests__/useInfiniteQuery.test.d.ts +0 -2
- package/build/lib/__tests__/useInfiniteQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/useInfiniteQuery.types.test.d.ts +0 -2
- package/build/lib/__tests__/useInfiniteQuery.types.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsFetching.test.d.ts +0 -2
- package/build/lib/__tests__/useIsFetching.test.d.ts.map +0 -1
- package/build/lib/__tests__/useIsMutating.test.d.ts +0 -2
- package/build/lib/__tests__/useIsMutating.test.d.ts.map +0 -1
- package/build/lib/__tests__/useMutation.test.d.ts +0 -2
- package/build/lib/__tests__/useMutation.test.d.ts.map +0 -1
- package/build/lib/__tests__/useMutation.types.test.d.ts +0 -2
- package/build/lib/__tests__/useMutation.types.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQueries.test.d.ts +0 -2
- package/build/lib/__tests__/useQueries.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQuery.test.d.ts +0 -2
- package/build/lib/__tests__/useQuery.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQuery.types.test.d.ts +0 -2
- package/build/lib/__tests__/useQuery.types.test.d.ts.map +0 -1
- package/build/lib/__tests__/useQueryClient.test.d.ts +0 -2
- package/build/lib/__tests__/useQueryClient.test.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/__tests__/vueQueryPlugin.test.d.ts +0 -2
- package/build/lib/__tests__/vueQueryPlugin.test.d.ts.map +0 -1
- package/build/lib/devtools/devtools.cjs +0 -197
- package/build/lib/devtools/devtools.cjs.map +0 -1
- package/build/lib/devtools/devtools.d.ts +0 -3
- package/build/lib/devtools/devtools.d.ts.map +0 -1
- package/build/lib/devtools/devtools.js +0 -195
- package/build/lib/devtools/devtools.js.map +0 -1
- package/build/lib/devtools/devtools.legacy.cjs +0 -199
- package/build/lib/devtools/devtools.legacy.cjs.map +0 -1
- package/build/lib/devtools/devtools.legacy.js +0 -197
- package/build/lib/devtools/devtools.legacy.js.map +0 -1
- package/build/lib/devtools/utils.cjs +0 -85
- package/build/lib/devtools/utils.cjs.map +0 -1
- package/build/lib/devtools/utils.d.ts +0 -16
- package/build/lib/devtools/utils.d.ts.map +0 -1
- package/build/lib/devtools/utils.js +0 -79
- package/build/lib/devtools/utils.js.map +0 -1
- package/build/lib/devtools/utils.legacy.cjs +0 -85
- package/build/lib/devtools/utils.legacy.cjs.map +0 -1
- package/build/lib/devtools/utils.legacy.js +0 -79
- package/build/lib/devtools/utils.legacy.js.map +0 -1
- package/build/lib/index.cjs +0 -38
- package/build/lib/index.cjs.map +0 -1
- package/build/lib/index.d.ts +0 -21
- 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 -38
- 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/mutationCache.cjs +0 -16
- package/build/lib/mutationCache.cjs.map +0 -1
- package/build/lib/mutationCache.d.ts +0 -8
- package/build/lib/mutationCache.d.ts.map +0 -1
- package/build/lib/mutationCache.js +0 -14
- package/build/lib/mutationCache.js.map +0 -1
- package/build/lib/mutationCache.legacy.cjs +0 -16
- package/build/lib/mutationCache.legacy.cjs.map +0 -1
- package/build/lib/mutationCache.legacy.js +0 -14
- package/build/lib/mutationCache.legacy.js.map +0 -1
- package/build/lib/queryCache.cjs +0 -16
- package/build/lib/queryCache.cjs.map +0 -1
- package/build/lib/queryCache.d.ts +0 -8
- package/build/lib/queryCache.d.ts.map +0 -1
- package/build/lib/queryCache.js +0 -14
- package/build/lib/queryCache.js.map +0 -1
- package/build/lib/queryCache.legacy.cjs +0 -16
- package/build/lib/queryCache.legacy.cjs.map +0 -1
- package/build/lib/queryCache.legacy.js +0 -14
- package/build/lib/queryCache.legacy.js.map +0 -1
- package/build/lib/queryClient.cjs +0 -86
- package/build/lib/queryClient.cjs.map +0 -1
- package/build/lib/queryClient.d.ts.map +0 -1
- package/build/lib/queryClient.js.map +0 -1
- package/build/lib/queryClient.legacy.cjs +0 -86
- package/build/lib/queryClient.legacy.cjs.map +0 -1
- package/build/lib/queryClient.legacy.js.map +0 -1
- package/build/lib/types.d.ts +0 -7
- package/build/lib/types.d.ts.map +0 -1
- package/build/lib/useBaseQuery.cjs +0 -69
- package/build/lib/useBaseQuery.cjs.map +0 -1
- package/build/lib/useBaseQuery.d.ts +0 -12
- package/build/lib/useBaseQuery.d.ts.map +0 -1
- package/build/lib/useBaseQuery.js.map +0 -1
- package/build/lib/useBaseQuery.legacy.cjs +0 -69
- package/build/lib/useBaseQuery.legacy.cjs.map +0 -1
- package/build/lib/useBaseQuery.legacy.js +0 -67
- package/build/lib/useBaseQuery.legacy.js.map +0 -1
- package/build/lib/useInfiniteQuery.cjs +0 -20
- package/build/lib/useInfiniteQuery.cjs.map +0 -1
- package/build/lib/useInfiniteQuery.d.ts +0 -17
- package/build/lib/useInfiniteQuery.d.ts.map +0 -1
- package/build/lib/useInfiniteQuery.js +0 -18
- package/build/lib/useInfiniteQuery.js.map +0 -1
- package/build/lib/useInfiniteQuery.legacy.cjs +0 -20
- package/build/lib/useInfiniteQuery.legacy.cjs.map +0 -1
- package/build/lib/useInfiniteQuery.legacy.js +0 -18
- package/build/lib/useInfiniteQuery.legacy.js.map +0 -1
- package/build/lib/useIsFetching.cjs +0 -26
- package/build/lib/useIsFetching.cjs.map +0 -1
- package/build/lib/useIsFetching.d.ts +0 -7
- package/build/lib/useIsFetching.d.ts.map +0 -1
- package/build/lib/useIsFetching.js.map +0 -1
- package/build/lib/useIsFetching.legacy.cjs +0 -26
- package/build/lib/useIsFetching.legacy.cjs.map +0 -1
- package/build/lib/useIsFetching.legacy.js.map +0 -1
- package/build/lib/useMutation.cjs +0 -41
- package/build/lib/useMutation.cjs.map +0 -1
- package/build/lib/useMutation.d.ts +0 -15
- package/build/lib/useMutation.d.ts.map +0 -1
- package/build/lib/useMutation.js.map +0 -1
- package/build/lib/useMutation.legacy.cjs +0 -41
- package/build/lib/useMutation.legacy.cjs.map +0 -1
- package/build/lib/useMutation.legacy.js.map +0 -1
- package/build/lib/useMutationState.cjs +0 -43
- package/build/lib/useMutationState.cjs.map +0 -1
- package/build/lib/useMutationState.d.ts +0 -12
- package/build/lib/useMutationState.d.ts.map +0 -1
- package/build/lib/useMutationState.js.map +0 -1
- package/build/lib/useMutationState.legacy.cjs +0 -43
- package/build/lib/useMutationState.legacy.cjs.map +0 -1
- package/build/lib/useMutationState.legacy.js.map +0 -1
- package/build/lib/useQueries.cjs +0 -63
- package/build/lib/useQueries.cjs.map +0 -1
- package/build/lib/useQueries.d.ts.map +0 -1
- package/build/lib/useQueries.js +0 -61
- package/build/lib/useQueries.js.map +0 -1
- package/build/lib/useQueries.legacy.cjs +0 -63
- package/build/lib/useQueries.legacy.cjs.map +0 -1
- package/build/lib/useQueries.legacy.js +0 -61
- package/build/lib/useQueries.legacy.js.map +0 -1
- package/build/lib/useQuery.cjs +0 -15
- package/build/lib/useQuery.cjs.map +0 -1
- package/build/lib/useQuery.d.ts +0 -22
- package/build/lib/useQuery.d.ts.map +0 -1
- package/build/lib/useQuery.js.map +0 -1
- package/build/lib/useQuery.legacy.cjs +0 -15
- package/build/lib/useQuery.legacy.cjs.map +0 -1
- package/build/lib/useQuery.legacy.js +0 -13
- package/build/lib/useQuery.legacy.js.map +0 -1
- package/build/lib/useQueryClient.cjs +0 -20
- package/build/lib/useQueryClient.cjs.map +0 -1
- package/build/lib/useQueryClient.d.ts +0 -3
- package/build/lib/useQueryClient.d.ts.map +0 -1
- package/build/lib/useQueryClient.js +0 -18
- package/build/lib/useQueryClient.js.map +0 -1
- package/build/lib/useQueryClient.legacy.cjs +0 -21
- package/build/lib/useQueryClient.legacy.cjs.map +0 -1
- package/build/lib/useQueryClient.legacy.js +0 -19
- package/build/lib/useQueryClient.legacy.js.map +0 -1
- package/build/lib/utils.cjs +0 -56
- package/build/lib/utils.cjs.map +0 -1
- package/build/lib/utils.d.ts +0 -7
- package/build/lib/utils.d.ts.map +0 -1
- package/build/lib/utils.js +0 -50
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.legacy.cjs +0 -56
- package/build/lib/utils.legacy.cjs.map +0 -1
- package/build/lib/utils.legacy.js +0 -50
- package/build/lib/utils.legacy.js.map +0 -1
- package/build/lib/vueQueryPlugin.cjs +0 -75
- package/build/lib/vueQueryPlugin.cjs.map +0 -1
- package/build/lib/vueQueryPlugin.d.ts.map +0 -1
- package/build/lib/vueQueryPlugin.js.map +0 -1
- package/build/lib/vueQueryPlugin.legacy.cjs +0 -75
- package/build/lib/vueQueryPlugin.legacy.cjs.map +0 -1
- package/build/lib/vueQueryPlugin.legacy.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["import { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type { ToRefs, UnwrapRef } from 'vue-demi'\nimport type {\n DefaultError,\n DefinedQueryObserverResult,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n WithRequired,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\nimport type { DistributiveOmit, MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >]: Property extends 'queryFn'\n ? QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n UnwrapRef<TQueryKey>\n >[Property]\n : MaybeRefDeep<\n WithRequired<\n QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n 'queryKey'\n >[Property]\n >\n}\n\nexport type UseQueryReturnType<TData, TError> = DistributiveOmit<\n UseBaseQueryReturnType<TData, TError>,\n 'refetch'\n> & {\n refetch: QueryObserverResult<TData, TError>['refetch']\n}\n\nexport type UseQueryDefinedReturnType<TData, TError> = DistributiveOmit<\n ToRefs<Readonly<DefinedQueryObserverResult<TData, TError>>>,\n 'refetch'\n> & {\n suspense: () => Promise<QueryObserverResult<TData, TError>>\n refetch: QueryObserverResult<TData, TError>['refetch']\n}\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n > & {\n initialData?: undefined\n },\n queryClient?: QueryClient,\n): UseQueryReturnType<TData, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n > & {\n initialData: TQueryFnData | (() => TQueryFnData)\n },\n queryClient?: QueryClient,\n): UseQueryDefinedReturnType<TData, TError>\n\nexport function useQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n):\n | UseQueryReturnType<TData, TError>\n | UseQueryDefinedReturnType<TData, TError> {\n const result = useBaseQuery(QueryObserver, options, queryClient)\n\n return {\n ...result,\n refetch: result.refetch.value,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA8B;AAC9B,0BAA6B;AAoGtB,SAAS,SAMd,SAOA,aAG2C;AAC3C,QAAM,aAAS,kCAAa,iCAAe,SAAS,WAAW;AAE/D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS,OAAO,QAAQ;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QueryObserver } from "@tanstack/query-core";
|
|
2
|
+
import { useBaseQuery } from "./useBaseQuery";
|
|
3
|
+
function useQuery(options, queryClient) {
|
|
4
|
+
const result = useBaseQuery(QueryObserver, options, queryClient);
|
|
5
|
+
return {
|
|
6
|
+
...result,
|
|
7
|
+
refetch: result.refetch.value
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
useQuery
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["import { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type { ToRefs, UnwrapRef } from 'vue-demi'\nimport type {\n DefaultError,\n DefinedQueryObserverResult,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n WithRequired,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\nimport type { DistributiveOmit, MaybeRefDeep } from './types'\nimport type { QueryClient } from './queryClient'\n\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >]: Property extends 'queryFn'\n ? QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n UnwrapRef<TQueryKey>\n >[Property]\n : MaybeRefDeep<\n WithRequired<\n QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n 'queryKey'\n >[Property]\n >\n}\n\nexport type UseQueryReturnType<TData, TError> = DistributiveOmit<\n UseBaseQueryReturnType<TData, TError>,\n 'refetch'\n> & {\n refetch: QueryObserverResult<TData, TError>['refetch']\n}\n\nexport type UseQueryDefinedReturnType<TData, TError> = DistributiveOmit<\n ToRefs<Readonly<DefinedQueryObserverResult<TData, TError>>>,\n 'refetch'\n> & {\n suspense: () => Promise<QueryObserverResult<TData, TError>>\n refetch: QueryObserverResult<TData, TError>['refetch']\n}\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n > & {\n initialData?: undefined\n },\n queryClient?: QueryClient,\n): UseQueryReturnType<TData, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n > & {\n initialData: TQueryFnData | (() => TQueryFnData)\n },\n queryClient?: QueryClient,\n): UseQueryDefinedReturnType<TData, TError>\n\nexport function useQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey\n >,\n queryClient?: QueryClient,\n):\n | UseQueryReturnType<TData, TError>\n | UseQueryDefinedReturnType<TData, TError> {\n const result = useBaseQuery(QueryObserver, options, queryClient)\n\n return {\n ...result,\n refetch: result.refetch.value,\n }\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAoGtB,SAAS,SAMd,SAOA,aAG2C;AAC3C,QAAM,SAAS,aAAa,eAAe,SAAS,WAAW;AAE/D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS,OAAO,QAAQ;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useQueryClient_exports = {};
|
|
20
|
+
__export(useQueryClient_exports, {
|
|
21
|
+
useQueryClient: () => useQueryClient
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useQueryClient_exports);
|
|
24
|
+
var import_vue_demi = require("vue-demi");
|
|
25
|
+
var import_utils = require("./utils");
|
|
26
|
+
function useQueryClient(id = "") {
|
|
27
|
+
const vm = (0, import_vue_demi.getCurrentInstance)()?.proxy;
|
|
28
|
+
if (!vm) {
|
|
29
|
+
throw new Error("vue-query hooks can only be used inside setup() function.");
|
|
30
|
+
}
|
|
31
|
+
const key = (0, import_utils.getClientKey)(id);
|
|
32
|
+
const queryClient = (0, import_vue_demi.inject)(key);
|
|
33
|
+
if (!queryClient) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return queryClient;
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
useQueryClient
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=useQueryClient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport { getClientKey } from './utils'\nimport type { QueryClient } from './queryClient'\n\nexport function useQueryClient(id = ''): QueryClient {\n const vm = getCurrentInstance()?.proxy\n\n if (!vm) {\n throw new Error('vue-query hooks can only be used inside setup() function.')\n }\n\n const key = getClientKey(id)\n const queryClient = inject<QueryClient>(key)\n\n if (!queryClient) {\n throw new Error(\n \"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.\",\n )\n }\n\n return queryClient\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2C;AAE3C,mBAA6B;AAGtB,SAAS,eAAe,KAAK,IAAiB;AACnD,QAAM,SAAK,oCAAmB,GAAG;AAEjC,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAEA,QAAM,UAAM,2BAAa,EAAE;AAC3B,QAAM,kBAAc,wBAAoB,GAAG;AAE3C,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getCurrentInstance, inject } from "vue-demi";
|
|
2
|
+
import { getClientKey } from "./utils";
|
|
3
|
+
function useQueryClient(id = "") {
|
|
4
|
+
const vm = getCurrentInstance()?.proxy;
|
|
5
|
+
if (!vm) {
|
|
6
|
+
throw new Error("vue-query hooks can only be used inside setup() function.");
|
|
7
|
+
}
|
|
8
|
+
const key = getClientKey(id);
|
|
9
|
+
const queryClient = inject(key);
|
|
10
|
+
if (!queryClient) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return queryClient;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useQueryClient
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useQueryClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport { getClientKey } from './utils'\nimport type { QueryClient } from './queryClient'\n\nexport function useQueryClient(id = ''): QueryClient {\n const vm = getCurrentInstance()?.proxy\n\n if (!vm) {\n throw new Error('vue-query hooks can only be used inside setup() function.')\n }\n\n const key = getClientKey(id)\n const queryClient = inject<QueryClient>(key)\n\n if (!queryClient) {\n throw new Error(\n \"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.\",\n )\n }\n\n return queryClient\n}\n"],"mappings":"AAAA,SAAS,oBAAoB,cAAc;AAE3C,SAAS,oBAAoB;AAGtB,SAAS,eAAe,KAAK,IAAiB;AACnD,QAAM,KAAK,mBAAmB,GAAG;AAEjC,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAEA,QAAM,MAAM,aAAa,EAAE;AAC3B,QAAM,cAAc,OAAoB,GAAG;AAE3C,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
VUE_QUERY_CLIENT: () => VUE_QUERY_CLIENT,
|
|
22
|
+
cloneDeep: () => cloneDeep,
|
|
23
|
+
cloneDeepUnref: () => cloneDeepUnref,
|
|
24
|
+
getClientKey: () => getClientKey,
|
|
25
|
+
updateState: () => updateState
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(utils_exports);
|
|
28
|
+
var import_vue_demi = require("vue-demi");
|
|
29
|
+
const VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
|
|
30
|
+
function getClientKey(key) {
|
|
31
|
+
const suffix = key ? `:${key}` : "";
|
|
32
|
+
return `${VUE_QUERY_CLIENT}${suffix}`;
|
|
33
|
+
}
|
|
34
|
+
function updateState(state, update) {
|
|
35
|
+
Object.keys(state).forEach((key) => {
|
|
36
|
+
state[key] = update[key];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function cloneDeep(value, customizer) {
|
|
40
|
+
if (customizer) {
|
|
41
|
+
const result = customizer(value);
|
|
42
|
+
if (result === void 0 && (0, import_vue_demi.isRef)(value)) {
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
if (result !== void 0) {
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
return value.map((val) => cloneDeep(val, customizer));
|
|
51
|
+
}
|
|
52
|
+
if (typeof value === "object" && isPlainObject(value)) {
|
|
53
|
+
const entries = Object.entries(value).map(([key, val]) => [
|
|
54
|
+
key,
|
|
55
|
+
cloneDeep(val, customizer)
|
|
56
|
+
]);
|
|
57
|
+
return Object.fromEntries(entries);
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function cloneDeepUnref(obj) {
|
|
62
|
+
return cloneDeep(obj, (val) => {
|
|
63
|
+
if ((0, import_vue_demi.isRef)(val)) {
|
|
64
|
+
return cloneDeepUnref((0, import_vue_demi.unref)(val));
|
|
65
|
+
}
|
|
66
|
+
return void 0;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function isPlainObject(value) {
|
|
70
|
+
if (Object.prototype.toString.call(value) !== "[object Object]") {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const prototype = Object.getPrototypeOf(value);
|
|
74
|
+
return prototype === null || prototype === Object.prototype;
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
VUE_QUERY_CLIENT,
|
|
79
|
+
cloneDeep,
|
|
80
|
+
cloneDeepUnref,
|
|
81
|
+
getClientKey,
|
|
82
|
+
updateState
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import { isRef, unref } from 'vue-demi'\nimport type { MaybeRefDeep } from './types'\n\nexport const VUE_QUERY_CLIENT = 'VUE_QUERY_CLIENT'\n\nexport function getClientKey(key?: string) {\n const suffix = key ? `:${key}` : ''\n return `${VUE_QUERY_CLIENT}${suffix}`\n}\n\nexport function updateState(\n state: Record<string, unknown>,\n update: Record<string, any>,\n): void {\n Object.keys(state).forEach((key) => {\n state[key] = update[key]\n })\n}\n\nexport function cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customizer?: (val: MaybeRefDeep<T>) => T | undefined,\n): T {\n if (customizer) {\n const result = customizer(value)\n // If it's a ref of undefined, return undefined\n if (result === undefined && isRef(value)) {\n return result as T\n }\n if (result !== undefined) {\n return result\n }\n }\n\n if (Array.isArray(value)) {\n return value.map((val) => cloneDeep(val, customizer)) as unknown as T\n }\n\n if (typeof value === 'object' && isPlainObject(value)) {\n const entries = Object.entries(value).map(([key, val]) => [\n key,\n cloneDeep(val, customizer),\n ])\n return Object.fromEntries(entries)\n }\n\n return value as T\n}\n\nexport function cloneDeepUnref<T>(obj: MaybeRefDeep<T>): T {\n return cloneDeep(obj, (val) => {\n if (isRef(val)) {\n return cloneDeepUnref(unref(val))\n }\n\n return undefined\n })\n}\n\nfunction isPlainObject(value: unknown): value is Object {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(value)\n return prototype === null || prototype === Object.prototype\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6B;AAGtB,MAAM,mBAAmB;AAEzB,SAAS,aAAa,KAAc;AACzC,QAAM,SAAS,MAAM,IAAI,GAAG,KAAK;AACjC,SAAO,GAAG,gBAAgB,GAAG,MAAM;AACrC;AAEO,SAAS,YACd,OACA,QACM;AACN,SAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,QAAQ;AAClC,UAAM,GAAG,IAAI,OAAO,GAAG;AAAA,EACzB,CAAC;AACH;AAEO,SAAS,UACd,OACA,YACG;AACH,MAAI,YAAY;AACd,UAAM,SAAS,WAAW,KAAK;AAE/B,QAAI,WAAW,cAAa,uBAAM,KAAK,GAAG;AACxC,aAAO;AAAA,IACT;AACA,QAAI,WAAW,QAAW;AACxB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,IAAI,CAAC,QAAQ,UAAU,KAAK,UAAU,CAAC;AAAA,EACtD;AAEA,MAAI,OAAO,UAAU,YAAY,cAAc,KAAK,GAAG;AACrD,UAAM,UAAU,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM;AAAA,MACxD;AAAA,MACA,UAAU,KAAK,UAAU;AAAA,IAC3B,CAAC;AACD,WAAO,OAAO,YAAY,OAAO;AAAA,EACnC;AAEA,SAAO;AACT;AAEO,SAAS,eAAkB,KAAyB;AACzD,SAAO,UAAU,KAAK,CAAC,QAAQ;AAC7B,YAAI,uBAAM,GAAG,GAAG;AACd,aAAO,mBAAe,uBAAM,GAAG,CAAC;AAAA,IAClC;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,cAAc,OAAiC;AACtD,MAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,mBAAmB;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,SAAO,cAAc,QAAQ,cAAc,OAAO;AACpD;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MaybeRefDeep } from './types.cjs';
|
|
2
|
+
import 'vue-demi';
|
|
3
|
+
|
|
4
|
+
declare const VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
|
|
5
|
+
declare function getClientKey(key?: string): string;
|
|
6
|
+
declare function updateState(state: Record<string, unknown>, update: Record<string, any>): void;
|
|
7
|
+
declare function cloneDeep<T>(value: MaybeRefDeep<T>, customizer?: (val: MaybeRefDeep<T>) => T | undefined): T;
|
|
8
|
+
declare function cloneDeepUnref<T>(obj: MaybeRefDeep<T>): T;
|
|
9
|
+
|
|
10
|
+
export { VUE_QUERY_CLIENT, cloneDeep, cloneDeepUnref, getClientKey, updateState };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MaybeRefDeep } from './types.js';
|
|
2
|
+
import 'vue-demi';
|
|
3
|
+
|
|
4
|
+
declare const VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
|
|
5
|
+
declare function getClientKey(key?: string): string;
|
|
6
|
+
declare function updateState(state: Record<string, unknown>, update: Record<string, any>): void;
|
|
7
|
+
declare function cloneDeep<T>(value: MaybeRefDeep<T>, customizer?: (val: MaybeRefDeep<T>) => T | undefined): T;
|
|
8
|
+
declare function cloneDeepUnref<T>(obj: MaybeRefDeep<T>): T;
|
|
9
|
+
|
|
10
|
+
export { VUE_QUERY_CLIENT, cloneDeep, cloneDeepUnref, getClientKey, updateState };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { isRef, unref } from "vue-demi";
|
|
2
|
+
const VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
|
|
3
|
+
function getClientKey(key) {
|
|
4
|
+
const suffix = key ? `:${key}` : "";
|
|
5
|
+
return `${VUE_QUERY_CLIENT}${suffix}`;
|
|
6
|
+
}
|
|
7
|
+
function updateState(state, update) {
|
|
8
|
+
Object.keys(state).forEach((key) => {
|
|
9
|
+
state[key] = update[key];
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function cloneDeep(value, customizer) {
|
|
13
|
+
if (customizer) {
|
|
14
|
+
const result = customizer(value);
|
|
15
|
+
if (result === void 0 && isRef(value)) {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
if (result !== void 0) {
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return value.map((val) => cloneDeep(val, customizer));
|
|
24
|
+
}
|
|
25
|
+
if (typeof value === "object" && isPlainObject(value)) {
|
|
26
|
+
const entries = Object.entries(value).map(([key, val]) => [
|
|
27
|
+
key,
|
|
28
|
+
cloneDeep(val, customizer)
|
|
29
|
+
]);
|
|
30
|
+
return Object.fromEntries(entries);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
function cloneDeepUnref(obj) {
|
|
35
|
+
return cloneDeep(obj, (val) => {
|
|
36
|
+
if (isRef(val)) {
|
|
37
|
+
return cloneDeepUnref(unref(val));
|
|
38
|
+
}
|
|
39
|
+
return void 0;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function isPlainObject(value) {
|
|
43
|
+
if (Object.prototype.toString.call(value) !== "[object Object]") {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const prototype = Object.getPrototypeOf(value);
|
|
47
|
+
return prototype === null || prototype === Object.prototype;
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
VUE_QUERY_CLIENT,
|
|
51
|
+
cloneDeep,
|
|
52
|
+
cloneDeepUnref,
|
|
53
|
+
getClientKey,
|
|
54
|
+
updateState
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import { isRef, unref } from 'vue-demi'\nimport type { MaybeRefDeep } from './types'\n\nexport const VUE_QUERY_CLIENT = 'VUE_QUERY_CLIENT'\n\nexport function getClientKey(key?: string) {\n const suffix = key ? `:${key}` : ''\n return `${VUE_QUERY_CLIENT}${suffix}`\n}\n\nexport function updateState(\n state: Record<string, unknown>,\n update: Record<string, any>,\n): void {\n Object.keys(state).forEach((key) => {\n state[key] = update[key]\n })\n}\n\nexport function cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customizer?: (val: MaybeRefDeep<T>) => T | undefined,\n): T {\n if (customizer) {\n const result = customizer(value)\n // If it's a ref of undefined, return undefined\n if (result === undefined && isRef(value)) {\n return result as T\n }\n if (result !== undefined) {\n return result\n }\n }\n\n if (Array.isArray(value)) {\n return value.map((val) => cloneDeep(val, customizer)) as unknown as T\n }\n\n if (typeof value === 'object' && isPlainObject(value)) {\n const entries = Object.entries(value).map(([key, val]) => [\n key,\n cloneDeep(val, customizer),\n ])\n return Object.fromEntries(entries)\n }\n\n return value as T\n}\n\nexport function cloneDeepUnref<T>(obj: MaybeRefDeep<T>): T {\n return cloneDeep(obj, (val) => {\n if (isRef(val)) {\n return cloneDeepUnref(unref(val))\n }\n\n return undefined\n })\n}\n\nfunction isPlainObject(value: unknown): value is Object {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(value)\n return prototype === null || prototype === Object.prototype\n}\n"],"mappings":"AAAA,SAAS,OAAO,aAAa;AAGtB,MAAM,mBAAmB;AAEzB,SAAS,aAAa,KAAc;AACzC,QAAM,SAAS,MAAM,IAAI,GAAG,KAAK;AACjC,SAAO,GAAG,gBAAgB,GAAG,MAAM;AACrC;AAEO,SAAS,YACd,OACA,QACM;AACN,SAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,QAAQ;AAClC,UAAM,GAAG,IAAI,OAAO,GAAG;AAAA,EACzB,CAAC;AACH;AAEO,SAAS,UACd,OACA,YACG;AACH,MAAI,YAAY;AACd,UAAM,SAAS,WAAW,KAAK;AAE/B,QAAI,WAAW,UAAa,MAAM,KAAK,GAAG;AACxC,aAAO;AAAA,IACT;AACA,QAAI,WAAW,QAAW;AACxB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,IAAI,CAAC,QAAQ,UAAU,KAAK,UAAU,CAAC;AAAA,EACtD;AAEA,MAAI,OAAO,UAAU,YAAY,cAAc,KAAK,GAAG;AACrD,UAAM,UAAU,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM;AAAA,MACxD;AAAA,MACA,UAAU,KAAK,UAAU;AAAA,IAC3B,CAAC;AACD,WAAO,OAAO,YAAY,OAAO;AAAA,EACnC;AAEA,SAAO;AACT;AAEO,SAAS,eAAkB,KAAyB;AACzD,SAAO,UAAU,KAAK,CAAC,QAAQ;AAC7B,QAAI,MAAM,GAAG,GAAG;AACd,aAAO,eAAe,MAAM,GAAG,CAAC;AAAA,IAClC;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,cAAc,OAAiC;AACtD,MAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,mBAAmB;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,SAAO,cAAc,QAAQ,cAAc,OAAO;AACpD;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var vueQueryPlugin_exports = {};
|
|
20
|
+
__export(vueQueryPlugin_exports, {
|
|
21
|
+
VueQueryPlugin: () => VueQueryPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(vueQueryPlugin_exports);
|
|
24
|
+
var import_vue_demi = require("vue-demi");
|
|
25
|
+
var import_query_core = require("@tanstack/query-core");
|
|
26
|
+
var import_queryClient = require("./queryClient");
|
|
27
|
+
var import_utils = require("./utils");
|
|
28
|
+
var import_devtools = require("./devtools/devtools");
|
|
29
|
+
const VueQueryPlugin = {
|
|
30
|
+
install: (app, options = {}) => {
|
|
31
|
+
const clientKey = (0, import_utils.getClientKey)(options.queryClientKey);
|
|
32
|
+
let client;
|
|
33
|
+
if ("queryClient" in options && options.queryClient) {
|
|
34
|
+
client = options.queryClient;
|
|
35
|
+
} else {
|
|
36
|
+
const clientConfig = "queryClientConfig" in options ? options.queryClientConfig : void 0;
|
|
37
|
+
client = new import_queryClient.QueryClient(clientConfig);
|
|
38
|
+
}
|
|
39
|
+
if (!import_query_core.isServer) {
|
|
40
|
+
client.mount();
|
|
41
|
+
}
|
|
42
|
+
let persisterUnmount = () => {
|
|
43
|
+
};
|
|
44
|
+
if (options.clientPersister) {
|
|
45
|
+
client.isRestoring.value = true;
|
|
46
|
+
const [unmount, promise] = options.clientPersister(client);
|
|
47
|
+
persisterUnmount = unmount;
|
|
48
|
+
promise.then(() => {
|
|
49
|
+
client.isRestoring.value = false;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const cleanup = () => {
|
|
53
|
+
client.unmount();
|
|
54
|
+
persisterUnmount();
|
|
55
|
+
};
|
|
56
|
+
if (app.onUnmount) {
|
|
57
|
+
app.onUnmount(cleanup);
|
|
58
|
+
} else {
|
|
59
|
+
const originalUnmount = app.unmount;
|
|
60
|
+
app.unmount = function vueQueryUnmount() {
|
|
61
|
+
cleanup();
|
|
62
|
+
originalUnmount();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (import_vue_demi.isVue2) {
|
|
66
|
+
app.mixin({
|
|
67
|
+
beforeCreate() {
|
|
68
|
+
if (!this._provided) {
|
|
69
|
+
const provideCache = {};
|
|
70
|
+
Object.defineProperty(this, "_provided", {
|
|
71
|
+
get: () => provideCache,
|
|
72
|
+
set: (v) => Object.assign(provideCache, v)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
this._provided[clientKey] = client;
|
|
76
|
+
if (process.env.NODE_ENV === "development") {
|
|
77
|
+
if (this === this.$root) {
|
|
78
|
+
(0, import_devtools.setupDevtools)(this, client);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
app.provide(clientKey, client);
|
|
85
|
+
if (process.env.NODE_ENV === "development") {
|
|
86
|
+
(0, import_devtools.setupDevtools)(app, client);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
VueQueryPlugin
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=vueQueryPlugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\nimport type { QueryClientConfig } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n queryClientKey?: string\n clientPersister?: ClientPersister\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: MaybeRefDeep<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 (!isServer) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n client.isRestoring.value = true\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n client.isRestoring.value = false\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) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n setupDevtools(app, client)\n }\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAuB;AACvB,wBAAyB;AAEzB,yBAA4B;AAC5B,mBAA6B;AAC7B,sBAA8B;AAqBvB,MAAM,iBAAiB;AAAA,EAC5B,SAAS,CAAC,KAAU,UAAiC,CAAC,MAAM;AAC1D,UAAM,gBAAY,2BAAa,QAAQ,cAAc;AACrD,QAAI;AAEJ,QAAI,iBAAiB,WAAW,QAAQ,aAAa;AACnD,eAAS,QAAQ;AAAA,IACnB,OAAO;AACL,YAAM,eACJ,uBAAuB,UAAU,QAAQ,oBAAoB;AAC/D,eAAS,IAAI,+BAAY,YAAY;AAAA,IACvC;AAEA,QAAI,CAAC,4BAAU;AACb,aAAO,MAAM;AAAA,IACf;AAEA,QAAI,mBAAmB,MAAM;AAAA,IAE7B;AAEA,QAAI,QAAQ,iBAAiB;AAC3B,aAAO,YAAY,QAAQ;AAC3B,YAAM,CAAC,SAAS,OAAO,IAAI,QAAQ,gBAAgB,MAAM;AACzD,yBAAmB;AACnB,cAAQ,KAAK,MAAM;AACjB,eAAO,YAAY,QAAQ;AAAA,MAC7B,CAAC;AAAA,IACH;AAEA,UAAM,UAAU,MAAM;AACpB,aAAO,QAAQ;AACf,uBAAiB;AAAA,IACnB;AAEA,QAAI,IAAI,WAAW;AACjB,UAAI,UAAU,OAAO;AAAA,IACvB,OAAO;AACL,YAAM,kBAAkB,IAAI;AAC5B,UAAI,UAAU,SAAS,kBAAkB;AACvC,gBAAQ;AACR,wBAAgB;AAAA,MAClB;AAAA,IACF;AAEA,QAAI,wBAAQ;AACV,UAAI,MAAM;AAAA,QACR,eAAe;AAEb,cAAI,CAAC,KAAK,WAAW;AACnB,kBAAM,eAAe,CAAC;AACtB,mBAAO,eAAe,MAAM,aAAa;AAAA,cACvC,KAAK,MAAM;AAAA,cACX,KAAK,CAAC,MAAM,OAAO,OAAO,cAAc,CAAC;AAAA,YAC3C,CAAC;AAAA,UACH;AAEA,eAAK,UAAU,SAAS,IAAI;AAE5B,cAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,gBAAI,SAAS,KAAK,OAAO;AACvB,iDAAc,MAAM,MAAM;AAAA,YAC5B;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,UAAI,QAAQ,WAAW,MAAM;AAE7B,UAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,2CAAc,KAAK,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QueryClient } from './queryClient.cjs';
|
|
2
|
+
import { QueryClientConfig } from '@tanstack/query-core';
|
|
3
|
+
import { MaybeRefDeep } from './types.cjs';
|
|
4
|
+
import 'vue-demi';
|
|
5
|
+
|
|
6
|
+
type ClientPersister = (client: QueryClient) => [() => void, Promise<void>];
|
|
7
|
+
interface CommonOptions {
|
|
8
|
+
queryClientKey?: string;
|
|
9
|
+
clientPersister?: ClientPersister;
|
|
10
|
+
}
|
|
11
|
+
interface ConfigOptions extends CommonOptions {
|
|
12
|
+
queryClientConfig?: MaybeRefDeep<QueryClientConfig>;
|
|
13
|
+
}
|
|
14
|
+
interface ClientOptions extends CommonOptions {
|
|
15
|
+
queryClient?: QueryClient;
|
|
16
|
+
}
|
|
17
|
+
type VueQueryPluginOptions = ConfigOptions | ClientOptions;
|
|
18
|
+
declare const VueQueryPlugin: {
|
|
19
|
+
install: (app: any, options?: VueQueryPluginOptions) => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { VueQueryPlugin, VueQueryPluginOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QueryClient } from './queryClient.js';
|
|
2
|
+
import { QueryClientConfig } from '@tanstack/query-core';
|
|
3
|
+
import { MaybeRefDeep } from './types.js';
|
|
4
|
+
import 'vue-demi';
|
|
5
|
+
|
|
6
|
+
type ClientPersister = (client: QueryClient) => [() => void, Promise<void>];
|
|
7
|
+
interface CommonOptions {
|
|
8
|
+
queryClientKey?: string;
|
|
9
|
+
clientPersister?: ClientPersister;
|
|
10
|
+
}
|
|
11
|
+
interface ConfigOptions extends CommonOptions {
|
|
12
|
+
queryClientConfig?: MaybeRefDeep<QueryClientConfig>;
|
|
13
|
+
}
|
|
14
|
+
interface ClientOptions extends CommonOptions {
|
|
15
|
+
queryClient?: QueryClient;
|
|
16
|
+
}
|
|
17
|
+
type VueQueryPluginOptions = ConfigOptions | ClientOptions;
|
|
18
|
+
declare const VueQueryPlugin: {
|
|
19
|
+
install: (app: any, options?: VueQueryPluginOptions) => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { VueQueryPlugin, VueQueryPluginOptions };
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import { isVue2 } from
|
|
2
|
-
import { isServer } from
|
|
3
|
-
import { QueryClient } from
|
|
4
|
-
import { getClientKey } from
|
|
5
|
-
import { setupDevtools } from
|
|
6
|
-
|
|
1
|
+
import { isVue2 } from "vue-demi";
|
|
2
|
+
import { isServer } from "@tanstack/query-core";
|
|
3
|
+
import { QueryClient } from "./queryClient";
|
|
4
|
+
import { getClientKey } from "./utils";
|
|
5
|
+
import { setupDevtools } from "./devtools/devtools";
|
|
7
6
|
const VueQueryPlugin = {
|
|
8
7
|
install: (app, options = {}) => {
|
|
9
8
|
const clientKey = getClientKey(options.queryClientKey);
|
|
10
9
|
let client;
|
|
11
|
-
if (
|
|
10
|
+
if ("queryClient" in options && options.queryClient) {
|
|
12
11
|
client = options.queryClient;
|
|
13
12
|
} else {
|
|
14
|
-
const clientConfig =
|
|
13
|
+
const clientConfig = "queryClientConfig" in options ? options.queryClientConfig : void 0;
|
|
15
14
|
client = new QueryClient(clientConfig);
|
|
16
15
|
}
|
|
17
16
|
if (!isServer) {
|
|
18
17
|
client.mount();
|
|
19
18
|
}
|
|
20
19
|
let persisterUnmount = () => {
|
|
21
|
-
// noop
|
|
22
20
|
};
|
|
23
21
|
if (options.clientPersister) {
|
|
24
22
|
client.isRestoring.value = true;
|
|
@@ -44,16 +42,15 @@ const VueQueryPlugin = {
|
|
|
44
42
|
if (isVue2) {
|
|
45
43
|
app.mixin({
|
|
46
44
|
beforeCreate() {
|
|
47
|
-
// HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30
|
|
48
45
|
if (!this._provided) {
|
|
49
46
|
const provideCache = {};
|
|
50
|
-
Object.defineProperty(this,
|
|
47
|
+
Object.defineProperty(this, "_provided", {
|
|
51
48
|
get: () => provideCache,
|
|
52
|
-
set: v => Object.assign(provideCache, v)
|
|
49
|
+
set: (v) => Object.assign(provideCache, v)
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
this._provided[clientKey] = client;
|
|
56
|
-
if (process.env.NODE_ENV ===
|
|
53
|
+
if (process.env.NODE_ENV === "development") {
|
|
57
54
|
if (this === this.$root) {
|
|
58
55
|
setupDevtools(this, client);
|
|
59
56
|
}
|
|
@@ -62,12 +59,13 @@ const VueQueryPlugin = {
|
|
|
62
59
|
});
|
|
63
60
|
} else {
|
|
64
61
|
app.provide(clientKey, client);
|
|
65
|
-
if (process.env.NODE_ENV ===
|
|
62
|
+
if (process.env.NODE_ENV === "development") {
|
|
66
63
|
setupDevtools(app, client);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
export {
|
|
69
|
+
VueQueryPlugin
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=vueQueryPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\nimport type { QueryClientConfig } from '@tanstack/query-core'\nimport type { MaybeRefDeep } from './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n queryClientKey?: string\n clientPersister?: ClientPersister\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: MaybeRefDeep<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 (!isServer) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n client.isRestoring.value = true\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n client.isRestoring.value = false\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) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n setupDevtools(app, client)\n }\n }\n },\n}\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAqBvB,MAAM,iBAAiB;AAAA,EAC5B,SAAS,CAAC,KAAU,UAAiC,CAAC,MAAM;AAC1D,UAAM,YAAY,aAAa,QAAQ,cAAc;AACrD,QAAI;AAEJ,QAAI,iBAAiB,WAAW,QAAQ,aAAa;AACnD,eAAS,QAAQ;AAAA,IACnB,OAAO;AACL,YAAM,eACJ,uBAAuB,UAAU,QAAQ,oBAAoB;AAC/D,eAAS,IAAI,YAAY,YAAY;AAAA,IACvC;AAEA,QAAI,CAAC,UAAU;AACb,aAAO,MAAM;AAAA,IACf;AAEA,QAAI,mBAAmB,MAAM;AAAA,IAE7B;AAEA,QAAI,QAAQ,iBAAiB;AAC3B,aAAO,YAAY,QAAQ;AAC3B,YAAM,CAAC,SAAS,OAAO,IAAI,QAAQ,gBAAgB,MAAM;AACzD,yBAAmB;AACnB,cAAQ,KAAK,MAAM;AACjB,eAAO,YAAY,QAAQ;AAAA,MAC7B,CAAC;AAAA,IACH;AAEA,UAAM,UAAU,MAAM;AACpB,aAAO,QAAQ;AACf,uBAAiB;AAAA,IACnB;AAEA,QAAI,IAAI,WAAW;AACjB,UAAI,UAAU,OAAO;AAAA,IACvB,OAAO;AACL,YAAM,kBAAkB,IAAI;AAC5B,UAAI,UAAU,SAAS,kBAAkB;AACvC,gBAAQ;AACR,wBAAgB;AAAA,MAClB;AAAA,IACF;AAEA,QAAI,QAAQ;AACV,UAAI,MAAM;AAAA,QACR,eAAe;AAEb,cAAI,CAAC,KAAK,WAAW;AACnB,kBAAM,eAAe,CAAC;AACtB,mBAAO,eAAe,MAAM,aAAa;AAAA,cACvC,KAAK,MAAM;AAAA,cACX,KAAK,CAAC,MAAM,OAAO,OAAO,cAAc,CAAC;AAAA,YAC3C,CAAC;AAAA,UACH;AAEA,eAAK,UAAU,SAAS,IAAI;AAE5B,cAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,gBAAI,SAAS,KAAK,OAAO;AACvB,4BAAc,MAAM,MAAM;AAAA,YAC5B;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,UAAI,QAAQ,WAAW,MAAM;AAE7B,UAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,sBAAc,KAAK,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.87",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
|
|
5
5
|
"author": "Damian Osipiuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,15 +15,19 @@
|
|
|
15
15
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
|
-
"types": "build/
|
|
19
|
-
"main": "build/
|
|
20
|
-
"module": "build/
|
|
18
|
+
"types": "build/legacy/index.d.ts",
|
|
19
|
+
"main": "build/legacy/index.cjs",
|
|
20
|
+
"module": "build/legacy/index.js",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./build/modern/index.d.ts",
|
|
25
|
+
"default": "./build/modern/index.js"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./build/modern/index.d.cts",
|
|
29
|
+
"default": "./build/modern/index.cjs"
|
|
30
|
+
}
|
|
27
31
|
},
|
|
28
32
|
"./package.json": "./package.json"
|
|
29
33
|
},
|
|
@@ -38,14 +42,14 @@
|
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
"files": [
|
|
41
|
-
"build
|
|
45
|
+
"build",
|
|
42
46
|
"src"
|
|
43
47
|
],
|
|
44
48
|
"dependencies": {
|
|
45
49
|
"@tanstack/match-sorter-utils": "^8.8.4",
|
|
46
50
|
"@vue/devtools-api": "^6.5.0",
|
|
47
51
|
"vue-demi": "^0.13.11",
|
|
48
|
-
"@tanstack/query-core": "5.0.0-alpha.
|
|
52
|
+
"@tanstack/query-core": "5.0.0-alpha.87"
|
|
49
53
|
},
|
|
50
54
|
"devDependencies": {
|
|
51
55
|
"@vue/composition-api": "1.7.1",
|
|
@@ -71,9 +75,7 @@
|
|
|
71
75
|
"test:2.7": "vue-demi-switch 2.7 vue2.7 && vitest",
|
|
72
76
|
"test:3": "vue-demi-switch 3 && vitest",
|
|
73
77
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
74
|
-
"test:build": "publint --strict",
|
|
75
|
-
"build": "
|
|
76
|
-
"build:rollup": "rollup --config rollup.config.js",
|
|
77
|
-
"build:types": "tsc --emitDeclarationOnly"
|
|
78
|
+
"test:build": "publint --strict && attw --pack",
|
|
79
|
+
"build": "tsup"
|
|
78
80
|
}
|
|
79
81
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseQuery.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/useBaseQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAMlC,eAAO,MAAM,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,CAAqB,CAAA;AAC/D,eAAO,MAAM,cAAc,KAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryClient.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/useQueryClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAQlC,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,CAA4B,CAAA"}
|