@tanstack/vue-query 5.0.0-alpha.81 → 5.0.0-alpha.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/build/lib/__mocks__/useBaseQuery.d.ts +2 -1
  2. package/build/lib/__mocks__/useBaseQuery.d.ts.map +1 -1
  3. package/build/lib/__mocks__/useQueryClient.d.ts +2 -1
  4. package/build/lib/__mocks__/useQueryClient.d.ts.map +1 -1
  5. package/build/lib/devtools/devtools.cjs.map +1 -1
  6. package/build/lib/devtools/devtools.d.ts.map +1 -1
  7. package/build/lib/devtools/devtools.js.map +1 -1
  8. package/build/lib/devtools/devtools.legacy.cjs.map +1 -1
  9. package/build/lib/devtools/devtools.legacy.js.map +1 -1
  10. package/build/lib/mutationCache.cjs.map +1 -1
  11. package/build/lib/mutationCache.d.ts +1 -1
  12. package/build/lib/mutationCache.d.ts.map +1 -1
  13. package/build/lib/mutationCache.js.map +1 -1
  14. package/build/lib/mutationCache.legacy.cjs.map +1 -1
  15. package/build/lib/mutationCache.legacy.js.map +1 -1
  16. package/build/lib/queryCache.cjs.map +1 -1
  17. package/build/lib/queryCache.d.ts +1 -1
  18. package/build/lib/queryCache.d.ts.map +1 -1
  19. package/build/lib/queryCache.js.map +1 -1
  20. package/build/lib/queryCache.legacy.cjs.map +1 -1
  21. package/build/lib/queryCache.legacy.js.map +1 -1
  22. package/build/lib/queryClient.cjs.map +1 -1
  23. package/build/lib/queryClient.d.ts +1 -1
  24. package/build/lib/queryClient.d.ts.map +1 -1
  25. package/build/lib/queryClient.js.map +1 -1
  26. package/build/lib/queryClient.legacy.cjs.map +1 -1
  27. package/build/lib/queryClient.legacy.js.map +1 -1
  28. package/build/lib/useBaseQuery.cjs.map +1 -1
  29. package/build/lib/useBaseQuery.d.ts +1 -1
  30. package/build/lib/useBaseQuery.d.ts.map +1 -1
  31. package/build/lib/useBaseQuery.js.map +1 -1
  32. package/build/lib/useBaseQuery.legacy.cjs.map +1 -1
  33. package/build/lib/useBaseQuery.legacy.js.map +1 -1
  34. package/build/lib/useInfiniteQuery.cjs.map +1 -1
  35. package/build/lib/useInfiniteQuery.d.ts +1 -1
  36. package/build/lib/useInfiniteQuery.d.ts.map +1 -1
  37. package/build/lib/useInfiniteQuery.js.map +1 -1
  38. package/build/lib/useInfiniteQuery.legacy.cjs.map +1 -1
  39. package/build/lib/useInfiniteQuery.legacy.js.map +1 -1
  40. package/build/lib/useIsFetching.cjs.map +1 -1
  41. package/build/lib/useIsFetching.d.ts.map +1 -1
  42. package/build/lib/useIsFetching.js.map +1 -1
  43. package/build/lib/useIsFetching.legacy.cjs.map +1 -1
  44. package/build/lib/useIsFetching.legacy.js.map +1 -1
  45. package/build/lib/useMutation.cjs.map +1 -1
  46. package/build/lib/useMutation.d.ts +2 -2
  47. package/build/lib/useMutation.d.ts.map +1 -1
  48. package/build/lib/useMutation.js.map +1 -1
  49. package/build/lib/useMutation.legacy.cjs.map +1 -1
  50. package/build/lib/useMutation.legacy.js.map +1 -1
  51. package/build/lib/useMutationState.cjs.map +1 -1
  52. package/build/lib/useMutationState.d.ts +2 -2
  53. package/build/lib/useMutationState.d.ts.map +1 -1
  54. package/build/lib/useMutationState.js.map +1 -1
  55. package/build/lib/useMutationState.legacy.cjs.map +1 -1
  56. package/build/lib/useMutationState.legacy.js.map +1 -1
  57. package/build/lib/useQueries.cjs.map +1 -1
  58. package/build/lib/useQueries.d.ts +1 -1
  59. package/build/lib/useQueries.d.ts.map +1 -1
  60. package/build/lib/useQueries.js.map +1 -1
  61. package/build/lib/useQueries.legacy.cjs.map +1 -1
  62. package/build/lib/useQueries.legacy.js.map +1 -1
  63. package/build/lib/useQuery.cjs.map +1 -1
  64. package/build/lib/useQuery.d.ts +1 -1
  65. package/build/lib/useQuery.d.ts.map +1 -1
  66. package/build/lib/useQuery.js.map +1 -1
  67. package/build/lib/useQuery.legacy.cjs.map +1 -1
  68. package/build/lib/useQuery.legacy.js.map +1 -1
  69. package/build/lib/useQueryClient.cjs.map +1 -1
  70. package/build/lib/useQueryClient.d.ts.map +1 -1
  71. package/build/lib/useQueryClient.js.map +1 -1
  72. package/build/lib/useQueryClient.legacy.cjs.map +1 -1
  73. package/build/lib/useQueryClient.legacy.js.map +1 -1
  74. package/build/lib/vueQueryPlugin.cjs.map +1 -1
  75. package/build/lib/vueQueryPlugin.d.ts +1 -1
  76. package/build/lib/vueQueryPlugin.d.ts.map +1 -1
  77. package/build/lib/vueQueryPlugin.js.map +1 -1
  78. package/build/lib/vueQueryPlugin.legacy.cjs.map +1 -1
  79. package/build/lib/vueQueryPlugin.legacy.js.map +1 -1
  80. package/package.json +2 -2
  81. package/src/__mocks__/useBaseQuery.ts +2 -1
  82. package/src/__mocks__/useQueryClient.ts +3 -2
  83. package/src/__tests__/mutationCache.test.ts +1 -1
  84. package/src/__tests__/queryCache.test.ts +1 -1
  85. package/src/__tests__/queryClient.test.ts +1 -1
  86. package/src/__tests__/useInfiniteQuery.test.ts +2 -2
  87. package/src/__tests__/useInfiniteQuery.types.test.tsx +2 -2
  88. package/src/__tests__/useIsFetching.test.ts +2 -2
  89. package/src/__tests__/useIsMutating.test.ts +3 -3
  90. package/src/__tests__/useMutation.test.ts +2 -2
  91. package/src/__tests__/useQueries.test.ts +5 -5
  92. package/src/__tests__/useQuery.test.ts +6 -6
  93. package/src/__tests__/useQueryClient.test.ts +1 -1
  94. package/src/__tests__/utils.test.ts +1 -1
  95. package/src/__tests__/vueQueryPlugin.test.ts +3 -3
  96. package/src/devtools/devtools.ts +3 -3
  97. package/src/mutationCache.ts +2 -2
  98. package/src/queryCache.ts +2 -2
  99. package/src/queryClient.ts +17 -17
  100. package/src/useBaseQuery.ts +7 -7
  101. package/src/useInfiniteQuery.ts +5 -5
  102. package/src/useIsFetching.ts +2 -2
  103. package/src/useMutation.ts +8 -8
  104. package/src/useMutationState.ts +5 -5
  105. package/src/useQueries.ts +7 -7
  106. package/src/useQuery.ts +5 -5
  107. package/src/useQueryClient.ts +1 -1
  108. package/src/vueQueryPlugin.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryClient.cjs","sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport type { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\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"],"names":["useQueryClient","id","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AACnD,EAAA,MAAMC,EAAE,GAAGC,0BAAkB,EAAE,EAAEC,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,kBAAY,CAACN,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMO,WAAW,GAAGC,cAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"useQueryClient.cjs","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"],"names":["useQueryClient","id","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AACnD,EAAA,MAAMC,EAAE,GAAGC,0BAAkB,EAAE,EAAEC,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,kBAAY,CAACN,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMO,WAAW,GAAGC,cAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryClient.d.ts","sourceRoot":"","sources":["../../src/useQueryClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,wBAAgB,cAAc,CAAC,EAAE,SAAK,GAAG,WAAW,CAiBnD"}
1
+ {"version":3,"file":"useQueryClient.d.ts","sourceRoot":"","sources":["../../src/useQueryClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,wBAAgB,cAAc,CAAC,EAAE,SAAK,GAAG,WAAW,CAiBnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryClient.js","sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport type { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\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"],"names":["useQueryClient","id","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AACnD,EAAA,MAAMC,EAAE,GAAGC,kBAAkB,EAAE,EAAEC,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,YAAY,CAACN,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMO,WAAW,GAAGC,MAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"useQueryClient.js","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"],"names":["useQueryClient","id","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AACnD,EAAA,MAAMC,EAAE,GAAGC,kBAAkB,EAAE,EAAEC,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,YAAY,CAACN,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMO,WAAW,GAAGC,MAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryClient.legacy.cjs","sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport type { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\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"],"names":["useQueryClient","id","_getCurrentInstance","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AAAA,EAAA,IAAAC,mBAAA,CAAA;EACnD,MAAMC,EAAE,GAAAD,CAAAA,mBAAA,GAAGE,0BAAkB,EAAE,KAAA,IAAA,GAAA,KAAA,CAAA,GAApBF,mBAAA,CAAsBG,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,kBAAY,CAACP,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMQ,WAAW,GAAGC,cAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"useQueryClient.legacy.cjs","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"],"names":["useQueryClient","id","_getCurrentInstance","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AAAA,EAAA,IAAAC,mBAAA,CAAA;EACnD,MAAMC,EAAE,GAAAD,CAAAA,mBAAA,GAAGE,0BAAkB,EAAE,KAAA,IAAA,GAAA,KAAA,CAAA,GAApBF,mBAAA,CAAsBG,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,kBAAY,CAACP,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMQ,WAAW,GAAGC,cAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryClient.legacy.js","sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { getCurrentInstance, inject } from 'vue-demi'\n\nimport type { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\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"],"names":["useQueryClient","id","_getCurrentInstance","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AAAA,EAAA,IAAAC,mBAAA,CAAA;EACnD,MAAMC,EAAE,GAAAD,CAAAA,mBAAA,GAAGE,kBAAkB,EAAE,KAAA,IAAA,GAAA,KAAA,CAAA,GAApBF,mBAAA,CAAsBG,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,YAAY,CAACP,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMQ,WAAW,GAAGC,MAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"useQueryClient.legacy.js","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"],"names":["useQueryClient","id","_getCurrentInstance","vm","getCurrentInstance","proxy","Error","key","getClientKey","queryClient","inject"],"mappings":";;;AAKO,SAASA,cAAcA,CAACC,EAAE,GAAG,EAAE,EAAe;AAAA,EAAA,IAAAC,mBAAA,CAAA;EACnD,MAAMC,EAAE,GAAAD,CAAAA,mBAAA,GAAGE,kBAAkB,EAAE,KAAA,IAAA,GAAA,KAAA,CAAA,GAApBF,mBAAA,CAAsBG,KAAK,CAAA;EAEtC,IAAI,CAACF,EAAE,EAAE;AACP,IAAA,MAAM,IAAIG,KAAK,CAAC,2DAA2D,CAAC,CAAA;AAC9E,GAAA;AAEA,EAAA,MAAMC,GAAG,GAAGC,YAAY,CAACP,EAAE,CAAC,CAAA;AAC5B,EAAA,MAAMQ,WAAW,GAAGC,MAAM,CAAcH,GAAG,CAAC,CAAA;EAE5C,IAAI,CAACE,WAAW,EAAE;AAChB,IAAA,MAAM,IAAIH,KAAK,CACb,iGACF,CAAC,CAAA;AACH,GAAA;AAEA,EAAA,OAAOG,WAAW,CAAA;AACpB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueQueryPlugin.cjs","sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\nimport type { QueryClientConfig } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,kBAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,uBAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,kBAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,EAAE,CAAA;AAChB,KAAA;IAEA,IAAIC,gBAAgB,GAAGA,MAAM;AAC3B;KACD,CAAA;IAED,IAAIZ,OAAO,CAACa,eAAe,EAAE;AAC3BT,MAAAA,MAAM,CAACU,WAAW,CAACC,KAAK,GAAG,IAAI,CAAA;MAC/B,MAAM,CAACC,OAAO,EAAEC,OAAO,CAAC,GAAGjB,OAAO,CAACa,eAAe,CAACT,MAAM,CAAC,CAAA;AAC1DQ,MAAAA,gBAAgB,GAAGI,OAAO,CAAA;MAC1BC,OAAO,CAACC,IAAI,CAAC,MAAM;AACjBd,QAAAA,MAAM,CAACU,WAAW,CAACC,KAAK,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G,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,sBAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"vueQueryPlugin.cjs","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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,kBAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,uBAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,kBAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,EAAE,CAAA;AAChB,KA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C3C,aAAC,CAAC,CAAA;AACJ,WAAA;AAEA,UAAA,IAAI,CAACN,SAAS,CAACzB,SAAS,CAAC,GAAGG,MAAM,CAAA;AAElC,UAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1C,YAAA,IAAI,IAAI,KAAK,IAAI,CAACC,KAAK,EAAE;AACvBC,cAAAA,sBAAa,CAAC,IAAI,EAAElC,MAAM,CAAC,CAAA;AAC7B,aAAA;AACF,WAAA;AACF,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,sBAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
@@ -1,5 +1,5 @@
1
- import type { QueryClientConfig } from '@tanstack/query-core';
2
1
  import { QueryClient } from './queryClient';
2
+ import type { QueryClientConfig } from '@tanstack/query-core';
3
3
  import type { MaybeRefDeep } from './types';
4
4
  type ClientPersister = (client: QueryClient) => [() => void, Promise<void>];
5
5
  interface CommonOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"vueQueryPlugin.d.ts","sourceRoot":"","sources":["../../src/vueQueryPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;AAE3E,UAAU,aAAa;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,iBAAiB,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;CACpD;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG,aAAa,CAAA;AAEjE,eAAO,MAAM,cAAc;mBACV,GAAG,YAAW,qBAAqB;CAyEnD,CAAA"}
1
+ {"version":3,"file":"vueQueryPlugin.d.ts","sourceRoot":"","sources":["../../src/vueQueryPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,MAAM,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;AAE3E,UAAU,aAAa;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,iBAAiB,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;CACpD;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG,aAAa,CAAA;AAEjE,eAAO,MAAM,cAAc;mBACV,GAAG,YAAW,qBAAqB;CAyEnD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueQueryPlugin.js","sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\nimport type { QueryClientConfig } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,WAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,QAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,EAAE,CAAA;AAChB,KAAA;IAEA,IAAIC,gBAAgB,GAAGA,MAAM;AAC3B;KACD,CAAA;IAED,IAAIZ,OAAO,CAACa,eAAe,EAAE;AAC3BT,MAAAA,MAAM,CAACU,WAAW,CAACC,KAAK,GAAG,IAAI,CAAA;MAC/B,MAAM,CAACC,OAAO,EAAEC,OAAO,CAAC,GAAGjB,OAAO,CAACa,eAAe,CAACT,MAAM,CAAC,CAAA;AAC1DQ,MAAAA,gBAAgB,GAAGI,OAAO,CAAA;MAC1BC,OAAO,CAACC,IAAI,CAAC,MAAM;AACjBd,QAAAA,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KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,aAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"vueQueryPlugin.js","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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,WAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,QAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,E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AEK,CAAC,CAAA;AAC3C,aAAC,CAAC,CAAA;AACJ,WAAA;AAEA,UAAA,IAAI,CAACN,SAAS,CAACzB,SAAS,CAAC,GAAGG,MAAM,CAAA;AAElC,UAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1C,YAAA,IAAI,IAAI,KAAK,IAAI,CAACC,KAAK,EAAE;AACvBC,cAAAA,aAAa,CAAC,IAAI,EAAElC,MAAM,CAAC,CAAA;AAC7B,aAAA;AACF,WAAA;AACF,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,aAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueQueryPlugin.legacy.cjs","sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\nimport type { QueryClientConfig } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,kBAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;A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ACTE,QAAAA,eAAe,EAAE,CAAA;OAClB,CAAA;AACH,KAAA;AAEA,IAAA,IAAIE,cAAM,EAAE;MACVxB,GAAG,CAACyB,KAAK,CAAC;AACRC,QAAAA,YAAYA,GAAG;AACb;AACA,UAAA,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;YACnB,MAAMC,YAAY,GAAG,EAAE,CAAA;AACvBC,YAAAA,MAAM,CAACC,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE;cACvCC,GAAG,EAAEA,MAAMH,YAAY;cACvBI,GAAG,EAAGC,CAAC,IAAKJ,MAAM,CAACK,MAAM,CAACN,YAAY,EAAEK,CAAC,CAAA;AAC3C,aAAC,CAAC,CAAA;AACJ,WAAA;AAEA,UAAA,IAAI,CAACN,SAAS,CAACzB,SAAS,CAAC,GAAGG,MAAM,CAAA;AAElC,UAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1C,YAAA,IAAI,IAAI,KAAK,IAAI,CAACC,KAAK,EAAE;AACvBC,cAAAA,sBAAa,CAAC,IAAI,EAAElC,MAAM,CAAC,CAAA;AAC7B,aAAA;AACF,WAAA;AACF,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,sBAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"vueQueryPlugin.legacy.cjs","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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,kBAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,uBAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,kBAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,EAAE,CAAA;AAChB,KAAA;IAEA,IAAIC,gBAAgB,GAAGA,MAAM;AAC3B;KACD,CAAA;IAED,IAAIZ,OAAO,CAACa,eAAe,EAAE;AAC3BT,MAAAA,MAAM,CAACU,WAAW,CAACC,KAAK,GAAG,IAAI,CAAA;MAC/B,MAAM,CAACC,OAAO,EAAEC,OAAO,CAAC,GAAGjB,OAAO,CAACa,eAAe,CAACT,MAAM,CAAC,CAAA;AAC1DQ,MAAAA,gBAAgB,GAAGI,OAAO,CAAA;MAC1BC,OAAO,CAACC,IAAI,CAAC,MAAM;AACjBd,QAAAA,MAAM,CAACU,WAAW,CAACC,KAAK,GAAG,KAAK,CAAA;AAClC,OAAC,CAAC,CAAA;AACJ,KAA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A;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,sBAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueQueryPlugin.legacy.js","sources":["../../src/vueQueryPlugin.ts"],"sourcesContent":["import { isVue2 } from 'vue-demi'\nimport { isServer } from '@tanstack/query-core'\nimport type { QueryClientConfig } from '@tanstack/query-core'\n\nimport { QueryClient } from './queryClient'\nimport { getClientKey } from './utils'\nimport { setupDevtools } from './devtools/devtools'\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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OAAO,CAACK,WAAW,EAAE;MACnDD,MAAM,GAAGJ,OAAO,CAACK,WAAW,CAAA;AAC9B,KAAC,MAAM;MACL,MAAMC,YAAY,GAChB,mBAAmB,IAAIN,OAAO,GAAGA,OAAO,CAACO,iBAAiB,GAAGC,SAAS,CAAA;AACxEJ,MAAAA,MAAM,GAAG,IAAIK,WAAW,CAACH,YAAY,CAAC,CAAA;AACxC,KAAA;IAEA,IAAI,CAACI,QAAQ,EAAE;MACbN,MAAM,CAACO,KAAK,EAAE,CAAA;AAChB,KAAA;IAEA,IAAIC,gBAAgB,GAAGA,MAAM;AAC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AAA,IAAI,CAACN,SAAS,CAACzB,SAAS,CAAC,GAAGG,MAAM,CAAA;AAElC,UAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1C,YAAA,IAAI,IAAI,KAAK,IAAI,CAACC,KAAK,EAAE;AACvBC,cAAAA,aAAa,CAAC,IAAI,EAAElC,MAAM,CAAC,CAAA;AAC7B,aAAA;AACF,WAAA;AACF,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,aAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"vueQueryPlugin.legacy.js","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"],"names":["VueQueryPlugin","install","app","options","clientKey","getClientKey","queryClientKey","client","queryClient","clientConfig","queryClientConfig","undefined","QueryClient","isServer","mount","persisterUnmount","clientPersister","isRestoring","value","unmount","promise","then","cleanup","onUnmount","originalUnmount","vueQueryUnmount","isVue2","mixin","beforeCreate","_provided","provideCache","Object","defineProperty","get","set","v","assign","process","env","NODE_ENV","$root","setupDevtools","provide"],"mappings":";;;;;;AA0BO,MAAMA,cAAc,GAAG;EAC5BC,OAAO,EAAEA,CAACC,GAAQ,EAAEC,OAA8B,GAAG,EAAE,KAAK;AAC1D,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACF,OAAO,CAACG,cAAc,CAAC,CAAA;AACtD,IAAA,IAAIC,MAAmB,CAAA;AAEvB,IAAA,IAAI,aAAa,IAAIJ,OAAO,IAAIA,OA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;MACVxB,GAAG,CAACyB,KAAK,CAAC;AACRC,QAAAA,YAAYA,GAAG;AACb;AACA,UAAA,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;YACnB,MAAMC,YAAY,GAAG,EAAE,CAAA;AACvBC,YAAAA,MAAM,CAACC,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE;cACvCC,GAAG,EAAEA,MAAMH,YAAY;cACvBI,GAAG,EAAGC,CAAC,IAAKJ,MAAM,CAACK,MAAM,CAACN,YAAY,EAAEK,CAAC,CAAA;AAC3C,aAAC,CAAC,CAAA;AACJ,WAAA;AAEA,UAAA,IAAI,CAACN,SAAS,CAACzB,SAAS,CAAC,GAAGG,MAAM,CAAA;AAElC,UAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1C,YAAA,IAAI,IAAI,KAAK,IAAI,CAACC,KAAK,EAAE;AACvBC,cAAAA,aAAa,CAAC,IAAI,EAAElC,MAAM,CAAC,CAAA;AAC7B,aAAA;AACF,WAAA;AACF,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACLL,MAAAA,GAAG,CAACwC,OAAO,CAACtC,SAAS,EAAEG,MAAM,CAAC,CAAA;AAE9B,MAAA,IAAI8B,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;AAC1CE,QAAAA,aAAa,CAACvC,GAAG,EAAEK,MAAM,CAAC,CAAA;AAC5B,OAAA;AACF,KAAA;AACF,GAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/vue-query",
3
- "version": "5.0.0-alpha.81",
3
+ "version": "5.0.0-alpha.85",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
5
5
  "author": "Damian Osipiuk",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "@tanstack/match-sorter-utils": "^8.8.4",
46
46
  "@vue/devtools-api": "^6.5.0",
47
47
  "vue-demi": "^0.13.11",
48
- "@tanstack/query-core": "5.0.0-alpha.81"
48
+ "@tanstack/query-core": "5.0.0-alpha.85"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@vue/composition-api": "1.7.1",
@@ -1,8 +1,9 @@
1
1
  import { vi } from 'vitest'
2
+ import type { Mock } from 'vitest'
2
3
 
3
4
  const { useBaseQuery: originImpl, unrefQueryArgs: originalParse } =
4
5
  // @ts-expect-error - vitest uses esmodules; tsconfig is not set to use them
5
6
  (await vi.importActual('../useBaseQuery')) as any
6
7
 
7
- export const useBaseQuery = vi.fn(originImpl)
8
+ export const useBaseQuery: Mock<any[], any> = vi.fn(originImpl)
8
9
  export const unrefQueryArgs = originalParse
@@ -1,5 +1,6 @@
1
- import { QueryClient } from '../queryClient'
2
1
  import { vi } from 'vitest'
2
+ import { QueryClient } from '../queryClient'
3
+ import type { Mock } from 'vitest'
3
4
 
4
5
  const queryClient = new QueryClient({
5
6
  defaultOptions: {
@@ -7,4 +8,4 @@ const queryClient = new QueryClient({
7
8
  },
8
9
  })
9
10
 
10
- export const useQueryClient = vi.fn(() => queryClient)
11
+ export const useQueryClient: Mock<[], QueryClient> = vi.fn(() => queryClient)
@@ -1,8 +1,8 @@
1
1
  import { ref } from 'vue-demi'
2
2
  import { MutationCache as MutationCacheOrigin } from '@tanstack/query-core'
3
3
 
4
- import { MutationCache } from '../mutationCache'
5
4
  import { vi } from 'vitest'
5
+ import { MutationCache } from '../mutationCache'
6
6
 
7
7
  describe('MutationCache', () => {
8
8
  beforeAll(() => {
@@ -1,8 +1,8 @@
1
1
  import { ref } from 'vue-demi'
2
2
  import { QueryCache as QueryCacheOrigin } from '@tanstack/query-core'
3
3
 
4
- import { QueryCache } from '../queryCache'
5
4
  import { vi } from 'vitest'
5
+ import { QueryCache } from '../queryCache'
6
6
 
7
7
  describe('QueryCache', () => {
8
8
  beforeAll(() => {
@@ -1,8 +1,8 @@
1
1
  import { ref } from 'vue-demi'
2
2
  import { QueryClient as QueryClientOrigin } from '@tanstack/query-core'
3
3
 
4
- import { QueryClient } from '../queryClient'
5
4
  import { vi } from 'vitest'
5
+ import { QueryClient } from '../queryClient'
6
6
 
7
7
  vi.mock('@tanstack/query-core')
8
8
 
@@ -1,6 +1,6 @@
1
- import { infiniteFetcher, flushPromises } from './test-utils'
2
- import { useInfiniteQuery } from '../useInfiniteQuery'
3
1
  import { vi } from 'vitest'
2
+ import { useInfiniteQuery } from '../useInfiniteQuery'
3
+ import { flushPromises, infiniteFetcher } from './test-utils'
4
4
 
5
5
  vi.mock('../useQueryClient')
6
6
 
@@ -1,8 +1,8 @@
1
- import type { InfiniteData } from '@tanstack/query-core'
2
1
  import { reactive } from 'vue'
3
2
  import { useInfiniteQuery } from '../useInfiniteQuery'
4
- import type { Equal, Expect } from './test-utils'
5
3
  import { doNotExecute, simpleFetcher } from './test-utils'
4
+ import type { Equal, Expect } from './test-utils'
5
+ import type { InfiniteData } from '@tanstack/query-core'
6
6
 
7
7
  describe('Discriminated union return type', () => {
8
8
  it('data should be possibly undefined by default', () => {
@@ -1,9 +1,9 @@
1
1
  import { onScopeDispose, reactive } from 'vue-demi'
2
2
 
3
- import { flushPromises, simpleFetcher } from './test-utils'
3
+ import { vi } from 'vitest'
4
4
  import { useQuery } from '../useQuery'
5
5
  import { useIsFetching } from '../useIsFetching'
6
- import { vi } from 'vitest'
6
+ import { flushPromises, simpleFetcher } from './test-utils'
7
7
  import type { MockedFunction } from 'vitest'
8
8
 
9
9
  vi.mock('../useQueryClient')
@@ -1,11 +1,11 @@
1
1
  import { onScopeDispose, reactive } from 'vue-demi'
2
2
 
3
- import { flushPromises, successMutator } from './test-utils'
3
+ import { vi } from 'vitest'
4
4
  import { useMutation } from '../useMutation'
5
5
  import { useIsMutating, useMutationState } from '../useMutationState'
6
- import { vi } from 'vitest'
7
- import type { MockedFunction } from 'vitest'
8
6
  import { useQueryClient } from '../useQueryClient'
7
+ import { flushPromises, successMutator } from './test-utils'
8
+ import type { MockedFunction } from 'vitest'
9
9
 
10
10
  vi.mock('../useQueryClient')
11
11
 
@@ -1,8 +1,8 @@
1
1
  import { reactive, ref } from 'vue-demi'
2
- import { errorMutator, flushPromises, successMutator } from './test-utils'
2
+ import { vi } from 'vitest'
3
3
  import { useMutation } from '../useMutation'
4
4
  import { useQueryClient } from '../useQueryClient'
5
- import { vi } from 'vitest'
5
+ import { errorMutator, flushPromises, successMutator } from './test-utils'
6
6
 
7
7
  vi.mock('../useQueryClient')
8
8
 
@@ -1,15 +1,15 @@
1
1
  import { onScopeDispose, ref } from 'vue-demi'
2
2
 
3
+ import { vi } from 'vitest'
4
+ import { useQueries } from '../useQueries'
5
+ import { useQueryClient } from '../useQueryClient'
6
+ import { QueryClient } from '../queryClient'
3
7
  import {
4
8
  flushPromises,
9
+ getSimpleFetcherWithReturnData,
5
10
  rejectFetcher,
6
11
  simpleFetcher,
7
- getSimpleFetcherWithReturnData,
8
12
  } from './test-utils'
9
- import { useQueries } from '../useQueries'
10
- import { useQueryClient } from '../useQueryClient'
11
- import { QueryClient } from '../queryClient'
12
- import { vi } from 'vitest'
13
13
  import type { MockedFunction } from 'vitest'
14
14
 
15
15
  vi.mock('../useQueryClient')
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  computed,
3
+ getCurrentInstance,
4
+ onScopeDispose,
3
5
  reactive,
4
6
  ref,
5
- onScopeDispose,
6
- getCurrentInstance,
7
7
  } from 'vue-demi'
8
8
  import { QueryObserver } from '@tanstack/query-core'
9
9
 
10
+ import { vi } from 'vitest'
11
+ import { useQuery } from '../useQuery'
12
+ import { useBaseQuery } from '../useBaseQuery'
10
13
  import {
11
14
  flushPromises,
15
+ getSimpleFetcherWithReturnData,
12
16
  rejectFetcher,
13
17
  simpleFetcher,
14
- getSimpleFetcherWithReturnData,
15
18
  } from './test-utils'
16
- import { useQuery } from '../useQuery'
17
- import { useBaseQuery } from '../useBaseQuery'
18
- import { vi } from 'vitest'
19
19
  import type { Mock, MockedFunction } from 'vitest'
20
20
 
21
21
  vi.mock('../useQueryClient')
@@ -1,7 +1,7 @@
1
1
  import { getCurrentInstance, inject } from 'vue-demi'
2
+ import { vi } from 'vitest'
2
3
  import { useQueryClient } from '../useQueryClient'
3
4
  import { VUE_QUERY_CLIENT } from '../utils'
4
- import { vi } from 'vitest'
5
5
  import type { Mock } from 'vitest'
6
6
 
7
7
  describe('useQueryClient', () => {
@@ -1,5 +1,5 @@
1
- import { updateState, cloneDeep, cloneDeepUnref } from '../utils'
2
1
  import { reactive, ref } from 'vue-demi'
2
+ import { cloneDeep, cloneDeepUnref, updateState } from '../utils'
3
3
 
4
4
  describe('utils', () => {
5
5
  describe('updateState', () => {
@@ -1,14 +1,14 @@
1
- import type { App, ComponentOptions } from 'vue'
2
1
  import { isVue2, isVue3, ref } from 'vue-demi'
3
2
 
3
+ import { vi } from 'vitest'
4
4
  import { QueryClient } from '../queryClient'
5
5
  import { VueQueryPlugin } from '../vueQueryPlugin'
6
6
  import { VUE_QUERY_CLIENT } from '../utils'
7
7
  import { setupDevtools } from '../devtools/devtools'
8
- import { flushPromises } from './test-utils'
9
8
  import { useQuery } from '../useQuery'
10
9
  import { useQueries } from '../useQueries'
11
- import { vi } from 'vitest'
10
+ import { flushPromises } from './test-utils'
11
+ import type { App, ComponentOptions } from 'vue'
12
12
  import type { Mock } from 'vitest'
13
13
 
14
14
  vi.mock('../devtools/devtools')
@@ -1,15 +1,15 @@
1
1
  import { setupDevtoolsPlugin } from '@vue/devtools-api'
2
- import type { CustomInspectorNode } from '@vue/devtools-api'
3
2
  import { rankItem } from '@tanstack/match-sorter-utils'
4
3
  import { onlineManager } from '@tanstack/query-core'
5
- import type { Query, QueryCacheNotifyEvent } from '@tanstack/query-core'
6
- import type { QueryClient } from '../queryClient'
7
4
  import {
8
5
  getQueryStateLabel,
9
6
  getQueryStatusBg,
10
7
  getQueryStatusFg,
11
8
  sortFns,
12
9
  } from './utils'
10
+ import type { CustomInspectorNode } from '@vue/devtools-api'
11
+ import type { Query, QueryCacheNotifyEvent } from '@tanstack/query-core'
12
+ import type { QueryClient } from '../queryClient'
13
13
 
14
14
  const pluginId = 'vue-query'
15
15
  const pluginName = 'Vue Query'
@@ -1,11 +1,11 @@
1
1
  import { MutationCache as MC } from '@tanstack/query-core'
2
+ import { cloneDeepUnref } from './utils'
2
3
  import type {
4
+ DefaultError,
3
5
  Mutation,
4
6
  MutationFilters,
5
- DefaultError,
6
7
  } from '@tanstack/query-core'
7
8
  import type { MaybeRefDeep } from './types'
8
- import { cloneDeepUnref } from './utils'
9
9
 
10
10
  export class MutationCache extends MC {
11
11
  find<
package/src/queryCache.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { QueryCache as QC } from '@tanstack/query-core'
2
+ import { cloneDeepUnref } from './utils'
2
3
  import type {
4
+ DefaultError,
3
5
  Query,
4
6
  QueryFilters,
5
7
  WithRequired,
6
- DefaultError,
7
8
  } from '@tanstack/query-core'
8
9
  import type { MaybeRefDeep } from './types'
9
- import { cloneDeepUnref } from './utils'
10
10
 
11
11
  export class QueryCache extends QC {
12
12
  find<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData>(
@@ -1,32 +1,32 @@
1
1
  import { ref } from 'vue-demi'
2
2
  import { QueryClient as QC } from '@tanstack/query-core'
3
+ import { cloneDeepUnref } from './utils'
4
+ import { QueryCache } from './queryCache'
5
+ import { MutationCache } from './mutationCache'
6
+ import type { MaybeRefDeep } from './types'
3
7
  import type {
4
- QueryKey,
5
- QueryClientConfig,
6
- SetDataOptions,
7
- ResetOptions,
8
8
  CancelOptions,
9
- InvalidateQueryFilters,
10
- InvalidateOptions,
11
- RefetchQueryFilters,
12
- RefetchOptions,
13
- FetchQueryOptions,
9
+ DefaultError,
10
+ DefaultOptions,
14
11
  FetchInfiniteQueryOptions,
12
+ FetchQueryOptions,
15
13
  InfiniteData,
16
- DefaultOptions,
17
- QueryObserverOptions,
14
+ InvalidateOptions,
15
+ InvalidateQueryFilters,
16
+ MutationFilters,
18
17
  MutationKey,
19
18
  MutationObserverOptions,
19
+ QueryClientConfig,
20
20
  QueryFilters,
21
- MutationFilters,
21
+ QueryKey,
22
+ QueryObserverOptions,
22
23
  QueryState,
24
+ RefetchOptions,
25
+ RefetchQueryFilters,
26
+ ResetOptions,
27
+ SetDataOptions,
23
28
  Updater,
24
- DefaultError,
25
29
  } from '@tanstack/query-core'
26
- import type { MaybeRefDeep } from './types'
27
- import { cloneDeepUnref } from './utils'
28
- import { QueryCache } from './queryCache'
29
- import { MutationCache } from './mutationCache'
30
30
 
31
31
  export class QueryClient extends QC {
32
32
  constructor(config: MaybeRefDeep<QueryClientConfig> = {}) {
@@ -1,20 +1,20 @@
1
1
  import {
2
+ computed,
2
3
  onScopeDispose,
3
- toRefs,
4
- readonly,
5
4
  reactive,
5
+ readonly,
6
+ toRefs,
6
7
  watch,
7
- computed,
8
8
  } from 'vue-demi'
9
+ import { useQueryClient } from './useQueryClient'
10
+ import { cloneDeepUnref, updateState } from './utils'
9
11
  import type { ToRefs } from 'vue-demi'
10
12
  import type {
11
- QueryObserver,
13
+ DefaultedQueryObserverOptions,
12
14
  QueryKey,
15
+ QueryObserver,
13
16
  QueryObserverResult,
14
- DefaultedQueryObserverOptions,
15
17
  } from '@tanstack/query-core'
16
- import { useQueryClient } from './useQueryClient'
17
- import { updateState, cloneDeepUnref } from './utils'
18
18
  import type { QueryClient } from './queryClient'
19
19
  import type { UseQueryOptions } from './useQuery'
20
20
  import type { UseInfiniteQueryOptions } from './useInfiniteQuery'
@@ -1,15 +1,15 @@
1
1
  import { InfiniteQueryObserver } from '@tanstack/query-core'
2
+ import { useBaseQuery } from './useBaseQuery'
2
3
  import type {
4
+ DefaultError,
3
5
  InfiniteData,
6
+ InfiniteQueryObserverOptions,
7
+ InfiniteQueryObserverResult,
8
+ QueryKey,
4
9
  QueryObserver,
5
10
  WithRequired,
6
- QueryKey,
7
- InfiniteQueryObserverResult,
8
- InfiniteQueryObserverOptions,
9
- DefaultError,
10
11
  } from '@tanstack/query-core'
11
12
 
12
- import { useBaseQuery } from './useBaseQuery'
13
13
  import type { UseBaseQueryReturnType } from './useBaseQuery'
14
14
 
15
15
  import type { DistributiveOmit, MaybeRefDeep } from './types'
@@ -1,8 +1,8 @@
1
1
  import { computed, onScopeDispose, ref, watch } from 'vue-demi'
2
- import type { Ref } from 'vue-demi'
3
- import type { QueryFilters as QF } from '@tanstack/query-core'
4
2
  import { useQueryClient } from './useQueryClient'
5
3
  import { cloneDeepUnref } from './utils'
4
+ import type { Ref } from 'vue-demi'
5
+ import type { QueryFilters as QF } from '@tanstack/query-core'
6
6
  import type { MaybeRefDeep } from './types'
7
7
  import type { QueryClient } from './queryClient'
8
8
 
@@ -1,23 +1,23 @@
1
1
  import {
2
+ computed,
2
3
  onScopeDispose,
3
4
  reactive,
4
5
  readonly,
5
6
  toRefs,
6
7
  watch,
7
- computed,
8
8
  } from 'vue-demi'
9
+ import { MutationObserver } from '@tanstack/query-core'
10
+ import { cloneDeepUnref, updateState } from './utils'
11
+ import { useQueryClient } from './useQueryClient'
9
12
  import type { ToRefs } from 'vue-demi'
10
13
  import type {
11
- MutateOptions,
14
+ DefaultError,
12
15
  MutateFunction,
13
- MutationObserverResult,
16
+ MutateOptions,
14
17
  MutationObserverOptions,
15
- DefaultError,
18
+ MutationObserverResult,
16
19
  } from '@tanstack/query-core'
17
- import type { MaybeRefDeep, DistributiveOmit } from './types'
18
- import { MutationObserver } from '@tanstack/query-core'
19
- import { cloneDeepUnref, updateState } from './utils'
20
- import { useQueryClient } from './useQueryClient'
20
+ import type { DistributiveOmit, MaybeRefDeep } from './types'
21
21
  import type { QueryClient } from './queryClient'
22
22
 
23
23
  type MutationResult<TData, TError, TVariables, TContext> = DistributiveOmit<