@tanstack/vue-query 5.92.12 → 5.94.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/package.json +2 -2
  2. package/build/legacy/_tsup-dts-rollup.d.cts +0 -855
  3. package/build/legacy/_tsup-dts-rollup.d.ts +0 -855
  4. package/build/legacy/devtools/devtools.cjs +0 -258
  5. package/build/legacy/devtools/devtools.cjs.map +0 -1
  6. package/build/legacy/devtools/devtools.d.cts +0 -1
  7. package/build/legacy/devtools/devtools.d.ts +0 -1
  8. package/build/legacy/devtools/devtools.js +0 -238
  9. package/build/legacy/devtools/devtools.js.map +0 -1
  10. package/build/legacy/devtools/utils.cjs +0 -105
  11. package/build/legacy/devtools/utils.cjs.map +0 -1
  12. package/build/legacy/devtools/utils.d.cts +0 -5
  13. package/build/legacy/devtools/utils.d.ts +0 -5
  14. package/build/legacy/devtools/utils.js +0 -76
  15. package/build/legacy/devtools/utils.js.map +0 -1
  16. package/build/legacy/index.cjs +0 -75
  17. package/build/legacy/index.cjs.map +0 -1
  18. package/build/legacy/index.d.cts +0 -169
  19. package/build/legacy/index.d.ts +0 -169
  20. package/build/legacy/index.js +0 -34
  21. package/build/legacy/index.js.map +0 -1
  22. package/build/legacy/infiniteQueryOptions.cjs +0 -33
  23. package/build/legacy/infiniteQueryOptions.cjs.map +0 -1
  24. package/build/legacy/infiniteQueryOptions.d.cts +0 -3
  25. package/build/legacy/infiniteQueryOptions.d.ts +0 -3
  26. package/build/legacy/infiniteQueryOptions.js +0 -8
  27. package/build/legacy/infiniteQueryOptions.js.map +0 -1
  28. package/build/legacy/mutationCache.cjs +0 -40
  29. package/build/legacy/mutationCache.cjs.map +0 -1
  30. package/build/legacy/mutationCache.d.cts +0 -1
  31. package/build/legacy/mutationCache.d.ts +0 -1
  32. package/build/legacy/mutationCache.js +0 -15
  33. package/build/legacy/mutationCache.js.map +0 -1
  34. package/build/legacy/queryCache.cjs +0 -40
  35. package/build/legacy/queryCache.cjs.map +0 -1
  36. package/build/legacy/queryCache.d.cts +0 -1
  37. package/build/legacy/queryCache.d.ts +0 -1
  38. package/build/legacy/queryCache.js +0 -15
  39. package/build/legacy/queryCache.js.map +0 -1
  40. package/build/legacy/queryClient.cjs +0 -141
  41. package/build/legacy/queryClient.cjs.map +0 -1
  42. package/build/legacy/queryClient.d.cts +0 -1
  43. package/build/legacy/queryClient.d.ts +0 -1
  44. package/build/legacy/queryClient.js +0 -116
  45. package/build/legacy/queryClient.js.map +0 -1
  46. package/build/legacy/queryOptions.cjs +0 -33
  47. package/build/legacy/queryOptions.cjs.map +0 -1
  48. package/build/legacy/queryOptions.d.cts +0 -1
  49. package/build/legacy/queryOptions.d.ts +0 -1
  50. package/build/legacy/queryOptions.js +0 -8
  51. package/build/legacy/queryOptions.js.map +0 -1
  52. package/build/legacy/types.cjs +0 -19
  53. package/build/legacy/types.cjs.map +0 -1
  54. package/build/legacy/types.d.cts +0 -9
  55. package/build/legacy/types.d.ts +0 -9
  56. package/build/legacy/types.js +0 -1
  57. package/build/legacy/types.js.map +0 -1
  58. package/build/legacy/useBaseQuery.cjs +0 -143
  59. package/build/legacy/useBaseQuery.cjs.map +0 -1
  60. package/build/legacy/useBaseQuery.d.cts +0 -2
  61. package/build/legacy/useBaseQuery.d.ts +0 -2
  62. package/build/legacy/useBaseQuery.js +0 -128
  63. package/build/legacy/useBaseQuery.js.map +0 -1
  64. package/build/legacy/useInfiniteQuery.cjs +0 -39
  65. package/build/legacy/useInfiniteQuery.cjs.map +0 -1
  66. package/build/legacy/useInfiniteQuery.d.cts +0 -3
  67. package/build/legacy/useInfiniteQuery.d.ts +0 -3
  68. package/build/legacy/useInfiniteQuery.js +0 -14
  69. package/build/legacy/useInfiniteQuery.js.map +0 -1
  70. package/build/legacy/useIsFetching.cjs +0 -54
  71. package/build/legacy/useIsFetching.cjs.map +0 -1
  72. package/build/legacy/useIsFetching.d.cts +0 -2
  73. package/build/legacy/useIsFetching.d.ts +0 -2
  74. package/build/legacy/useIsFetching.js +0 -29
  75. package/build/legacy/useIsFetching.js.map +0 -1
  76. package/build/legacy/useMutation.cjs +0 -79
  77. package/build/legacy/useMutation.cjs.map +0 -1
  78. package/build/legacy/useMutation.d.cts +0 -3
  79. package/build/legacy/useMutation.d.ts +0 -3
  80. package/build/legacy/useMutation.js +0 -64
  81. package/build/legacy/useMutation.js.map +0 -1
  82. package/build/legacy/useMutationState.cjs +0 -82
  83. package/build/legacy/useMutationState.cjs.map +0 -1
  84. package/build/legacy/useMutationState.d.cts +0 -4
  85. package/build/legacy/useMutationState.d.ts +0 -4
  86. package/build/legacy/useMutationState.js +0 -63
  87. package/build/legacy/useMutationState.js.map +0 -1
  88. package/build/legacy/useQueries.cjs +0 -115
  89. package/build/legacy/useQueries.cjs.map +0 -1
  90. package/build/legacy/useQueries.d.cts +0 -3
  91. package/build/legacy/useQueries.d.ts +0 -3
  92. package/build/legacy/useQueries.js +0 -99
  93. package/build/legacy/useQueries.js.map +0 -1
  94. package/build/legacy/useQuery.cjs +0 -35
  95. package/build/legacy/useQuery.cjs.map +0 -1
  96. package/build/legacy/useQuery.d.cts +0 -6
  97. package/build/legacy/useQuery.d.ts +0 -6
  98. package/build/legacy/useQuery.js +0 -10
  99. package/build/legacy/useQuery.js.map +0 -1
  100. package/build/legacy/useQueryClient.cjs +0 -47
  101. package/build/legacy/useQueryClient.cjs.map +0 -1
  102. package/build/legacy/useQueryClient.d.cts +0 -1
  103. package/build/legacy/useQueryClient.d.ts +0 -1
  104. package/build/legacy/useQueryClient.js +0 -22
  105. package/build/legacy/useQueryClient.js.map +0 -1
  106. package/build/legacy/utils.cjs +0 -100
  107. package/build/legacy/utils.cjs.map +0 -1
  108. package/build/legacy/utils.d.cts +0 -5
  109. package/build/legacy/utils.d.ts +0 -5
  110. package/build/legacy/utils.js +0 -71
  111. package/build/legacy/utils.js.map +0 -1
  112. package/build/legacy/vueQueryPlugin.cjs +0 -105
  113. package/build/legacy/vueQueryPlugin.cjs.map +0 -1
  114. package/build/legacy/vueQueryPlugin.d.cts +0 -2
  115. package/build/legacy/vueQueryPlugin.d.ts +0 -2
  116. package/build/legacy/vueQueryPlugin.js +0 -80
  117. package/build/legacy/vueQueryPlugin.js.map +0 -1
  118. package/build/modern/_tsup-dts-rollup.d.cts +0 -855
  119. package/build/modern/_tsup-dts-rollup.d.ts +0 -855
  120. package/build/modern/devtools/devtools.cjs +0 -256
  121. package/build/modern/devtools/devtools.cjs.map +0 -1
  122. package/build/modern/devtools/devtools.d.cts +0 -1
  123. package/build/modern/devtools/devtools.d.ts +0 -1
  124. package/build/modern/devtools/devtools.js +0 -236
  125. package/build/modern/devtools/devtools.js.map +0 -1
  126. package/build/modern/devtools/utils.cjs +0 -105
  127. package/build/modern/devtools/utils.cjs.map +0 -1
  128. package/build/modern/devtools/utils.d.cts +0 -5
  129. package/build/modern/devtools/utils.d.ts +0 -5
  130. package/build/modern/devtools/utils.js +0 -76
  131. package/build/modern/devtools/utils.js.map +0 -1
  132. package/build/modern/index.cjs +0 -75
  133. package/build/modern/index.cjs.map +0 -1
  134. package/build/modern/index.d.cts +0 -169
  135. package/build/modern/index.d.ts +0 -169
  136. package/build/modern/index.js +0 -34
  137. package/build/modern/index.js.map +0 -1
  138. package/build/modern/infiniteQueryOptions.cjs +0 -33
  139. package/build/modern/infiniteQueryOptions.cjs.map +0 -1
  140. package/build/modern/infiniteQueryOptions.d.cts +0 -3
  141. package/build/modern/infiniteQueryOptions.d.ts +0 -3
  142. package/build/modern/infiniteQueryOptions.js +0 -8
  143. package/build/modern/infiniteQueryOptions.js.map +0 -1
  144. package/build/modern/mutationCache.cjs +0 -40
  145. package/build/modern/mutationCache.cjs.map +0 -1
  146. package/build/modern/mutationCache.d.cts +0 -1
  147. package/build/modern/mutationCache.d.ts +0 -1
  148. package/build/modern/mutationCache.js +0 -15
  149. package/build/modern/mutationCache.js.map +0 -1
  150. package/build/modern/queryCache.cjs +0 -40
  151. package/build/modern/queryCache.cjs.map +0 -1
  152. package/build/modern/queryCache.d.cts +0 -1
  153. package/build/modern/queryCache.d.ts +0 -1
  154. package/build/modern/queryCache.js +0 -15
  155. package/build/modern/queryCache.js.map +0 -1
  156. package/build/modern/queryClient.cjs +0 -141
  157. package/build/modern/queryClient.cjs.map +0 -1
  158. package/build/modern/queryClient.d.cts +0 -1
  159. package/build/modern/queryClient.d.ts +0 -1
  160. package/build/modern/queryClient.js +0 -116
  161. package/build/modern/queryClient.js.map +0 -1
  162. package/build/modern/queryOptions.cjs +0 -33
  163. package/build/modern/queryOptions.cjs.map +0 -1
  164. package/build/modern/queryOptions.d.cts +0 -1
  165. package/build/modern/queryOptions.d.ts +0 -1
  166. package/build/modern/queryOptions.js +0 -8
  167. package/build/modern/queryOptions.js.map +0 -1
  168. package/build/modern/types.cjs +0 -19
  169. package/build/modern/types.cjs.map +0 -1
  170. package/build/modern/types.d.cts +0 -9
  171. package/build/modern/types.d.ts +0 -9
  172. package/build/modern/types.js +0 -1
  173. package/build/modern/types.js.map +0 -1
  174. package/build/modern/useBaseQuery.cjs +0 -142
  175. package/build/modern/useBaseQuery.cjs.map +0 -1
  176. package/build/modern/useBaseQuery.d.cts +0 -2
  177. package/build/modern/useBaseQuery.d.ts +0 -2
  178. package/build/modern/useBaseQuery.js +0 -127
  179. package/build/modern/useBaseQuery.js.map +0 -1
  180. package/build/modern/useInfiniteQuery.cjs +0 -39
  181. package/build/modern/useInfiniteQuery.cjs.map +0 -1
  182. package/build/modern/useInfiniteQuery.d.cts +0 -3
  183. package/build/modern/useInfiniteQuery.d.ts +0 -3
  184. package/build/modern/useInfiniteQuery.js +0 -14
  185. package/build/modern/useInfiniteQuery.js.map +0 -1
  186. package/build/modern/useIsFetching.cjs +0 -54
  187. package/build/modern/useIsFetching.cjs.map +0 -1
  188. package/build/modern/useIsFetching.d.cts +0 -2
  189. package/build/modern/useIsFetching.d.ts +0 -2
  190. package/build/modern/useIsFetching.js +0 -29
  191. package/build/modern/useIsFetching.js.map +0 -1
  192. package/build/modern/useMutation.cjs +0 -79
  193. package/build/modern/useMutation.cjs.map +0 -1
  194. package/build/modern/useMutation.d.cts +0 -3
  195. package/build/modern/useMutation.d.ts +0 -3
  196. package/build/modern/useMutation.js +0 -64
  197. package/build/modern/useMutation.js.map +0 -1
  198. package/build/modern/useMutationState.cjs +0 -82
  199. package/build/modern/useMutationState.cjs.map +0 -1
  200. package/build/modern/useMutationState.d.cts +0 -4
  201. package/build/modern/useMutationState.d.ts +0 -4
  202. package/build/modern/useMutationState.js +0 -63
  203. package/build/modern/useMutationState.js.map +0 -1
  204. package/build/modern/useQueries.cjs +0 -114
  205. package/build/modern/useQueries.cjs.map +0 -1
  206. package/build/modern/useQueries.d.cts +0 -3
  207. package/build/modern/useQueries.d.ts +0 -3
  208. package/build/modern/useQueries.js +0 -98
  209. package/build/modern/useQueries.js.map +0 -1
  210. package/build/modern/useQuery.cjs +0 -35
  211. package/build/modern/useQuery.cjs.map +0 -1
  212. package/build/modern/useQuery.d.cts +0 -6
  213. package/build/modern/useQuery.d.ts +0 -6
  214. package/build/modern/useQuery.js +0 -10
  215. package/build/modern/useQuery.js.map +0 -1
  216. package/build/modern/useQueryClient.cjs +0 -47
  217. package/build/modern/useQueryClient.cjs.map +0 -1
  218. package/build/modern/useQueryClient.d.cts +0 -1
  219. package/build/modern/useQueryClient.d.ts +0 -1
  220. package/build/modern/useQueryClient.js +0 -22
  221. package/build/modern/useQueryClient.js.map +0 -1
  222. package/build/modern/utils.cjs +0 -100
  223. package/build/modern/utils.cjs.map +0 -1
  224. package/build/modern/utils.d.cts +0 -5
  225. package/build/modern/utils.d.ts +0 -5
  226. package/build/modern/utils.js +0 -71
  227. package/build/modern/utils.js.map +0 -1
  228. package/build/modern/vueQueryPlugin.cjs +0 -104
  229. package/build/modern/vueQueryPlugin.cjs.map +0 -1
  230. package/build/modern/vueQueryPlugin.d.cts +0 -2
  231. package/build/modern/vueQueryPlugin.d.ts +0 -2
  232. package/build/modern/vueQueryPlugin.js +0 -79
  233. package/build/modern/vueQueryPlugin.js.map +0 -1
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/useQueryClient.ts
21
- var useQueryClient_exports = {};
22
- __export(useQueryClient_exports, {
23
- useQueryClient: () => useQueryClient
24
- });
25
- module.exports = __toCommonJS(useQueryClient_exports);
26
- var import_vue_demi = require("vue-demi");
27
- var import_utils = require("./utils.cjs");
28
- function useQueryClient(id = "") {
29
- if (!(0, import_vue_demi.hasInjectionContext)()) {
30
- throw new Error(
31
- "vue-query hooks can only be used inside setup() function or functions that support injection context."
32
- );
33
- }
34
- const key = (0, import_utils.getClientKey)(id);
35
- const queryClient = (0, import_vue_demi.inject)(key);
36
- if (!queryClient) {
37
- throw new Error(
38
- "No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
39
- );
40
- }
41
- return queryClient;
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- useQueryClient
46
- });
47
- //# sourceMappingURL=useQueryClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { hasInjectionContext, inject } from 'vue-demi'\n\nimport { getClientKey } from './utils'\nimport type { QueryClient } from './queryClient'\n\nexport function useQueryClient(id = ''): QueryClient {\n // ensures that `inject()` can be used\n if (!hasInjectionContext()) {\n throw new Error(\n 'vue-query hooks can only be used inside setup() function or functions that support injection context.',\n )\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,sBAA4C;AAE5C,mBAA6B;AAGtB,SAAS,eAAe,KAAK,IAAiB;AAEnD,MAAI,KAAC,qCAAoB,GAAG;AAC1B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;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":[]}
@@ -1 +0,0 @@
1
- export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.js';
@@ -1,22 +0,0 @@
1
- // src/useQueryClient.ts
2
- import { hasInjectionContext, inject } from "vue-demi";
3
- import { getClientKey } from "./utils.js";
4
- function useQueryClient(id = "") {
5
- if (!hasInjectionContext()) {
6
- throw new Error(
7
- "vue-query hooks can only be used inside setup() function or functions that support injection context."
8
- );
9
- }
10
- const key = getClientKey(id);
11
- const queryClient = inject(key);
12
- if (!queryClient) {
13
- throw new Error(
14
- "No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
15
- );
16
- }
17
- return queryClient;
18
- }
19
- export {
20
- useQueryClient
21
- };
22
- //# sourceMappingURL=useQueryClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/useQueryClient.ts"],"sourcesContent":["import { hasInjectionContext, inject } from 'vue-demi'\n\nimport { getClientKey } from './utils'\nimport type { QueryClient } from './queryClient'\n\nexport function useQueryClient(id = ''): QueryClient {\n // ensures that `inject()` can be used\n if (!hasInjectionContext()) {\n throw new Error(\n 'vue-query hooks can only be used inside setup() function or functions that support injection context.',\n )\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,qBAAqB,cAAc;AAE5C,SAAS,oBAAoB;AAGtB,SAAS,eAAe,KAAK,IAAiB;AAEnD,MAAI,CAAC,oBAAoB,GAAG;AAC1B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;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":[]}
@@ -1,100 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/utils.ts
21
- var utils_exports = {};
22
- __export(utils_exports, {
23
- VUE_QUERY_CLIENT: () => VUE_QUERY_CLIENT,
24
- cloneDeep: () => cloneDeep,
25
- cloneDeepUnref: () => cloneDeepUnref,
26
- getClientKey: () => getClientKey,
27
- updateState: () => updateState
28
- });
29
- module.exports = __toCommonJS(utils_exports);
30
- var import_vue_demi = require("vue-demi");
31
- var VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
32
- function getClientKey(key) {
33
- const suffix = key ? `:${key}` : "";
34
- return `${VUE_QUERY_CLIENT}${suffix}`;
35
- }
36
- function updateState(state, update) {
37
- Object.keys(state).forEach((key) => {
38
- state[key] = update[key];
39
- });
40
- }
41
- function _cloneDeep(value, customize, currentKey = "", currentLevel = 0) {
42
- if (customize) {
43
- const result = customize(value, currentKey, currentLevel);
44
- if (result === void 0 && (0, import_vue_demi.isRef)(value)) {
45
- return result;
46
- }
47
- if (result !== void 0) {
48
- return result;
49
- }
50
- }
51
- if (Array.isArray(value)) {
52
- return value.map(
53
- (val, index) => _cloneDeep(val, customize, String(index), currentLevel + 1)
54
- );
55
- }
56
- if (typeof value === "object" && isPlainObject(value)) {
57
- const entries = Object.entries(value).map(([key, val]) => [
58
- key,
59
- _cloneDeep(val, customize, key, currentLevel + 1)
60
- ]);
61
- return Object.fromEntries(entries);
62
- }
63
- return value;
64
- }
65
- function cloneDeep(value, customize) {
66
- return _cloneDeep(value, customize);
67
- }
68
- function cloneDeepUnref(obj, unrefGetters = false) {
69
- return cloneDeep(obj, (val, key, level) => {
70
- if (level === 1 && key === "queryKey") {
71
- return cloneDeepUnref(val, true);
72
- }
73
- if (unrefGetters && isFunction(val)) {
74
- return cloneDeepUnref(val(), unrefGetters);
75
- }
76
- if ((0, import_vue_demi.isRef)(val)) {
77
- return cloneDeepUnref((0, import_vue_demi.unref)(val), unrefGetters);
78
- }
79
- return void 0;
80
- });
81
- }
82
- function isPlainObject(value) {
83
- if (Object.prototype.toString.call(value) !== "[object Object]") {
84
- return false;
85
- }
86
- const prototype = Object.getPrototypeOf(value);
87
- return prototype === null || prototype === Object.prototype;
88
- }
89
- function isFunction(value) {
90
- return typeof value === "function";
91
- }
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- VUE_QUERY_CLIENT,
95
- cloneDeep,
96
- cloneDeepUnref,
97
- getClientKey,
98
- updateState
99
- });
100
- //# sourceMappingURL=utils.cjs.map
@@ -1 +0,0 @@
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, any>,\n update: Record<string, any>,\n): void {\n Object.keys(state).forEach((key) => {\n state[key] = update[key]\n })\n}\n\n// Helper function for cloning deep objects where\n// the level and key is provided to the callback function.\nfunction _cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customize?: (\n val: MaybeRefDeep<T>,\n key: string,\n level: number,\n ) => T | undefined,\n currentKey: string = '',\n currentLevel: number = 0,\n): T {\n if (customize) {\n const result = customize(value, currentKey, currentLevel)\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, index) =>\n _cloneDeep(val, customize, String(index), currentLevel + 1),\n ) 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, customize, key, currentLevel + 1),\n ])\n return Object.fromEntries(entries)\n }\n\n return value as T\n}\n\nexport function cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customize?: (\n val: MaybeRefDeep<T>,\n key: string,\n level: number,\n ) => T | undefined,\n): T {\n return _cloneDeep(value, customize)\n}\n\nexport function cloneDeepUnref<T>(\n obj: MaybeRefDeep<T>,\n unrefGetters = false,\n): T {\n return cloneDeep(obj, (val, key, level) => {\n // Check if we're at the top level and the key is 'queryKey'\n //\n // If so, take the recursive descent where we resolve\n // getters to values as well as refs.\n if (level === 1 && key === 'queryKey') {\n return cloneDeepUnref(val, true)\n }\n\n // Resolve getters to values if specified.\n if (unrefGetters && isFunction(val)) {\n // Cast due to older TS versions not allowing calling\n // on certain intersection types.\n return cloneDeepUnref((val as Function)(), unrefGetters)\n }\n\n // Unref refs and continue to recurse into the value.\n if (isRef(val)) {\n return cloneDeepUnref(unref(val), unrefGetters)\n }\n\n return undefined\n })\n}\n\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\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\nfunction isFunction(value: unknown): value is Function {\n return typeof value === 'function'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6B;AAGtB,IAAM,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;AAIA,SAAS,WACP,OACA,WAKA,aAAqB,IACrB,eAAuB,GACpB;AACH,MAAI,WAAW;AACb,UAAM,SAAS,UAAU,OAAO,YAAY,YAAY;AACxD,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;AAAA,MAAI,CAAC,KAAK,UACrB,WAAW,KAAK,WAAW,OAAO,KAAK,GAAG,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF;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,WAAW,KAAK,WAAW,KAAK,eAAe,CAAC;AAAA,IAClD,CAAC;AACD,WAAO,OAAO,YAAY,OAAO;AAAA,EACnC;AAEA,SAAO;AACT;AAEO,SAAS,UACd,OACA,WAKG;AACH,SAAO,WAAW,OAAO,SAAS;AACpC;AAEO,SAAS,eACd,KACA,eAAe,OACZ;AACH,SAAO,UAAU,KAAK,CAAC,KAAK,KAAK,UAAU;AAKzC,QAAI,UAAU,KAAK,QAAQ,YAAY;AACrC,aAAO,eAAe,KAAK,IAAI;AAAA,IACjC;AAGA,QAAI,gBAAgB,WAAW,GAAG,GAAG;AAGnC,aAAO,eAAgB,IAAiB,GAAG,YAAY;AAAA,IACzD;AAGA,YAAI,uBAAM,GAAG,GAAG;AACd,aAAO,mBAAe,uBAAM,GAAG,GAAG,YAAY;AAAA,IAChD;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAGA,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;AAEA,SAAS,WAAW,OAAmC;AACrD,SAAO,OAAO,UAAU;AAC1B;","names":[]}
@@ -1,5 +0,0 @@
1
- export { getClientKey } from './_tsup-dts-rollup.cjs';
2
- export { updateState } from './_tsup-dts-rollup.cjs';
3
- export { cloneDeep } from './_tsup-dts-rollup.cjs';
4
- export { cloneDeepUnref } from './_tsup-dts-rollup.cjs';
5
- export { VUE_QUERY_CLIENT_alias_1 as VUE_QUERY_CLIENT } from './_tsup-dts-rollup.cjs';
@@ -1,5 +0,0 @@
1
- export { getClientKey } from './_tsup-dts-rollup.js';
2
- export { updateState } from './_tsup-dts-rollup.js';
3
- export { cloneDeep } from './_tsup-dts-rollup.js';
4
- export { cloneDeepUnref } from './_tsup-dts-rollup.js';
5
- export { VUE_QUERY_CLIENT_alias_1 as VUE_QUERY_CLIENT } from './_tsup-dts-rollup.js';
@@ -1,71 +0,0 @@
1
- // src/utils.ts
2
- import { isRef, unref } from "vue-demi";
3
- var VUE_QUERY_CLIENT = "VUE_QUERY_CLIENT";
4
- function getClientKey(key) {
5
- const suffix = key ? `:${key}` : "";
6
- return `${VUE_QUERY_CLIENT}${suffix}`;
7
- }
8
- function updateState(state, update) {
9
- Object.keys(state).forEach((key) => {
10
- state[key] = update[key];
11
- });
12
- }
13
- function _cloneDeep(value, customize, currentKey = "", currentLevel = 0) {
14
- if (customize) {
15
- const result = customize(value, currentKey, currentLevel);
16
- if (result === void 0 && isRef(value)) {
17
- return result;
18
- }
19
- if (result !== void 0) {
20
- return result;
21
- }
22
- }
23
- if (Array.isArray(value)) {
24
- return value.map(
25
- (val, index) => _cloneDeep(val, customize, String(index), currentLevel + 1)
26
- );
27
- }
28
- if (typeof value === "object" && isPlainObject(value)) {
29
- const entries = Object.entries(value).map(([key, val]) => [
30
- key,
31
- _cloneDeep(val, customize, key, currentLevel + 1)
32
- ]);
33
- return Object.fromEntries(entries);
34
- }
35
- return value;
36
- }
37
- function cloneDeep(value, customize) {
38
- return _cloneDeep(value, customize);
39
- }
40
- function cloneDeepUnref(obj, unrefGetters = false) {
41
- return cloneDeep(obj, (val, key, level) => {
42
- if (level === 1 && key === "queryKey") {
43
- return cloneDeepUnref(val, true);
44
- }
45
- if (unrefGetters && isFunction(val)) {
46
- return cloneDeepUnref(val(), unrefGetters);
47
- }
48
- if (isRef(val)) {
49
- return cloneDeepUnref(unref(val), unrefGetters);
50
- }
51
- return void 0;
52
- });
53
- }
54
- function isPlainObject(value) {
55
- if (Object.prototype.toString.call(value) !== "[object Object]") {
56
- return false;
57
- }
58
- const prototype = Object.getPrototypeOf(value);
59
- return prototype === null || prototype === Object.prototype;
60
- }
61
- function isFunction(value) {
62
- return typeof value === "function";
63
- }
64
- export {
65
- VUE_QUERY_CLIENT,
66
- cloneDeep,
67
- cloneDeepUnref,
68
- getClientKey,
69
- updateState
70
- };
71
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
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, any>,\n update: Record<string, any>,\n): void {\n Object.keys(state).forEach((key) => {\n state[key] = update[key]\n })\n}\n\n// Helper function for cloning deep objects where\n// the level and key is provided to the callback function.\nfunction _cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customize?: (\n val: MaybeRefDeep<T>,\n key: string,\n level: number,\n ) => T | undefined,\n currentKey: string = '',\n currentLevel: number = 0,\n): T {\n if (customize) {\n const result = customize(value, currentKey, currentLevel)\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, index) =>\n _cloneDeep(val, customize, String(index), currentLevel + 1),\n ) 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, customize, key, currentLevel + 1),\n ])\n return Object.fromEntries(entries)\n }\n\n return value as T\n}\n\nexport function cloneDeep<T>(\n value: MaybeRefDeep<T>,\n customize?: (\n val: MaybeRefDeep<T>,\n key: string,\n level: number,\n ) => T | undefined,\n): T {\n return _cloneDeep(value, customize)\n}\n\nexport function cloneDeepUnref<T>(\n obj: MaybeRefDeep<T>,\n unrefGetters = false,\n): T {\n return cloneDeep(obj, (val, key, level) => {\n // Check if we're at the top level and the key is 'queryKey'\n //\n // If so, take the recursive descent where we resolve\n // getters to values as well as refs.\n if (level === 1 && key === 'queryKey') {\n return cloneDeepUnref(val, true)\n }\n\n // Resolve getters to values if specified.\n if (unrefGetters && isFunction(val)) {\n // Cast due to older TS versions not allowing calling\n // on certain intersection types.\n return cloneDeepUnref((val as Function)(), unrefGetters)\n }\n\n // Unref refs and continue to recurse into the value.\n if (isRef(val)) {\n return cloneDeepUnref(unref(val), unrefGetters)\n }\n\n return undefined\n })\n}\n\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\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\nfunction isFunction(value: unknown): value is Function {\n return typeof value === 'function'\n}\n"],"mappings":";AAAA,SAAS,OAAO,aAAa;AAGtB,IAAM,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;AAIA,SAAS,WACP,OACA,WAKA,aAAqB,IACrB,eAAuB,GACpB;AACH,MAAI,WAAW;AACb,UAAM,SAAS,UAAU,OAAO,YAAY,YAAY;AACxD,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;AAAA,MAAI,CAAC,KAAK,UACrB,WAAW,KAAK,WAAW,OAAO,KAAK,GAAG,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF;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,WAAW,KAAK,WAAW,KAAK,eAAe,CAAC;AAAA,IAClD,CAAC;AACD,WAAO,OAAO,YAAY,OAAO;AAAA,EACnC;AAEA,SAAO;AACT;AAEO,SAAS,UACd,OACA,WAKG;AACH,SAAO,WAAW,OAAO,SAAS;AACpC;AAEO,SAAS,eACd,KACA,eAAe,OACZ;AACH,SAAO,UAAU,KAAK,CAAC,KAAK,KAAK,UAAU;AAKzC,QAAI,UAAU,KAAK,QAAQ,YAAY;AACrC,aAAO,eAAe,KAAK,IAAI;AAAA,IACjC;AAGA,QAAI,gBAAgB,WAAW,GAAG,GAAG;AAGnC,aAAO,eAAgB,IAAiB,GAAG,YAAY;AAAA,IACzD;AAGA,QAAI,MAAM,GAAG,GAAG;AACd,aAAO,eAAe,MAAM,GAAG,GAAG,YAAY;AAAA,IAChD;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAGA,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;AAEA,SAAS,WAAW,OAAmC;AACrD,SAAO,OAAO,UAAU;AAC1B;","names":[]}
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/vueQueryPlugin.ts
21
- var vueQueryPlugin_exports = {};
22
- __export(vueQueryPlugin_exports, {
23
- VueQueryPlugin: () => VueQueryPlugin
24
- });
25
- module.exports = __toCommonJS(vueQueryPlugin_exports);
26
- var import_vue_demi = require("vue-demi");
27
- var import_query_core = require("@tanstack/query-core");
28
- var import_queryClient = require("./queryClient.cjs");
29
- var import_utils = require("./utils.cjs");
30
- var import_devtools = require("./devtools/devtools.cjs");
31
- var VueQueryPlugin = {
32
- install: (app, options = {}) => {
33
- const clientKey = (0, import_utils.getClientKey)(options.queryClientKey);
34
- let client;
35
- if ("queryClient" in options && options.queryClient) {
36
- client = options.queryClient;
37
- } else {
38
- const clientConfig = "queryClientConfig" in options ? options.queryClientConfig : void 0;
39
- client = new import_queryClient.QueryClient(clientConfig);
40
- }
41
- if (!import_query_core.isServer) {
42
- client.mount();
43
- }
44
- let persisterUnmount = () => {
45
- };
46
- if (options.clientPersister) {
47
- if (client.isRestoring) {
48
- client.isRestoring.value = true;
49
- }
50
- const [unmount, promise] = options.clientPersister(client);
51
- persisterUnmount = unmount;
52
- promise.then(() => {
53
- var _a;
54
- if (client.isRestoring) {
55
- client.isRestoring.value = false;
56
- }
57
- (_a = options.clientPersisterOnSuccess) == null ? void 0 : _a.call(options, client);
58
- });
59
- }
60
- const cleanup = () => {
61
- client.unmount();
62
- persisterUnmount();
63
- };
64
- if (app.onUnmount) {
65
- app.onUnmount(cleanup);
66
- } else {
67
- const originalUnmount = app.unmount;
68
- app.unmount = function vueQueryUnmount() {
69
- cleanup();
70
- originalUnmount();
71
- };
72
- }
73
- if (import_vue_demi.isVue2) {
74
- app.mixin({
75
- beforeCreate() {
76
- if (!this._provided) {
77
- const provideCache = {};
78
- Object.defineProperty(this, "_provided", {
79
- get: () => provideCache,
80
- set: (v) => Object.assign(provideCache, v)
81
- });
82
- }
83
- this._provided[clientKey] = client;
84
- if (process.env.NODE_ENV === "development") {
85
- if (this === this.$root && options.enableDevtoolsV6Plugin) {
86
- (0, import_devtools.setupDevtools)(this, client);
87
- }
88
- }
89
- }
90
- });
91
- } else {
92
- app.provide(clientKey, client);
93
- if (process.env.NODE_ENV === "development") {
94
- if (options.enableDevtoolsV6Plugin) {
95
- (0, import_devtools.setupDevtools)(app, client);
96
- }
97
- }
98
- }
99
- }
100
- };
101
- // Annotate the CommonJS export names for ESM import in node:
102
- 0 && (module.exports = {
103
- VueQueryPlugin
104
- });
105
- //# sourceMappingURL=vueQueryPlugin.cjs.map
@@ -1 +0,0 @@
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 './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n enableDevtoolsV6Plugin?: boolean\n queryClientKey?: string\n clientPersister?: ClientPersister\n clientPersisterOnSuccess?: (client: QueryClient) => void\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: QueryClientConfig\n}\n\ninterface ClientOptions extends CommonOptions {\n queryClient?: QueryClient\n}\n\nexport type VueQueryPluginOptions = ConfigOptions | ClientOptions\n\nexport const VueQueryPlugin = {\n install: (app: any, options: VueQueryPluginOptions = {}) => {\n const clientKey = getClientKey(options.queryClientKey)\n let client: QueryClient\n\n if ('queryClient' in options && options.queryClient) {\n client = options.queryClient\n } else {\n const clientConfig =\n 'queryClientConfig' in options ? options.queryClientConfig : undefined\n client = new QueryClient(clientConfig)\n }\n\n if (!isServer) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n if (client.isRestoring) {\n client.isRestoring.value = true\n }\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n if (client.isRestoring) {\n client.isRestoring.value = false\n }\n options.clientPersisterOnSuccess?.(client)\n })\n }\n\n const cleanup = () => {\n client.unmount()\n persisterUnmount()\n }\n\n if (app.onUnmount) {\n app.onUnmount(cleanup)\n } else {\n const originalUnmount = app.unmount\n app.unmount = function vueQueryUnmount() {\n cleanup()\n originalUnmount()\n }\n }\n\n if (isVue2) {\n app.mixin({\n beforeCreate() {\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30\n if (!this._provided) {\n const provideCache = {}\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n })\n }\n\n this._provided[clientKey] = client\n\n if (process.env.NODE_ENV === 'development') {\n if (this === this.$root && options.enableDevtoolsV6Plugin) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n if (options.enableDevtoolsV6Plugin) {\n setupDevtools(app, client)\n }\n }\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAuB;AACvB,wBAAyB;AAEzB,yBAA4B;AAC5B,mBAA6B;AAC7B,sBAA8B;AAsBvB,IAAM,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,UAAI,OAAO,aAAa;AACtB,eAAO,YAAY,QAAQ;AAAA,MAC7B;AACA,YAAM,CAAC,SAAS,OAAO,IAAI,QAAQ,gBAAgB,MAAM;AACzD,yBAAmB;AACnB,cAAQ,KAAK,MAAM;AAtDzB;AAuDQ,YAAI,OAAO,aAAa;AACtB,iBAAO,YAAY,QAAQ;AAAA,QAC7B;AACA,sBAAQ,6BAAR,iCAAmC;AAAA,MACrC,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,SAAS,QAAQ,wBAAwB;AACzD,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,YAAI,QAAQ,wBAAwB;AAClC,6CAAc,KAAK,MAAM;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export { VueQueryPluginOptions_alias_1 as VueQueryPluginOptions } from './_tsup-dts-rollup.cjs';
2
- export { VueQueryPlugin_alias_1 as VueQueryPlugin } from './_tsup-dts-rollup.cjs';
@@ -1,2 +0,0 @@
1
- export { VueQueryPluginOptions_alias_1 as VueQueryPluginOptions } from './_tsup-dts-rollup.js';
2
- export { VueQueryPlugin_alias_1 as VueQueryPlugin } from './_tsup-dts-rollup.js';
@@ -1,80 +0,0 @@
1
- // src/vueQueryPlugin.ts
2
- import { isVue2 } from "vue-demi";
3
- import { isServer } from "@tanstack/query-core";
4
- import { QueryClient } from "./queryClient.js";
5
- import { getClientKey } from "./utils.js";
6
- import { setupDevtools } from "./devtools/devtools.js";
7
- var VueQueryPlugin = {
8
- install: (app, options = {}) => {
9
- const clientKey = getClientKey(options.queryClientKey);
10
- let client;
11
- if ("queryClient" in options && options.queryClient) {
12
- client = options.queryClient;
13
- } else {
14
- const clientConfig = "queryClientConfig" in options ? options.queryClientConfig : void 0;
15
- client = new QueryClient(clientConfig);
16
- }
17
- if (!isServer) {
18
- client.mount();
19
- }
20
- let persisterUnmount = () => {
21
- };
22
- if (options.clientPersister) {
23
- if (client.isRestoring) {
24
- client.isRestoring.value = true;
25
- }
26
- const [unmount, promise] = options.clientPersister(client);
27
- persisterUnmount = unmount;
28
- promise.then(() => {
29
- var _a;
30
- if (client.isRestoring) {
31
- client.isRestoring.value = false;
32
- }
33
- (_a = options.clientPersisterOnSuccess) == null ? void 0 : _a.call(options, client);
34
- });
35
- }
36
- const cleanup = () => {
37
- client.unmount();
38
- persisterUnmount();
39
- };
40
- if (app.onUnmount) {
41
- app.onUnmount(cleanup);
42
- } else {
43
- const originalUnmount = app.unmount;
44
- app.unmount = function vueQueryUnmount() {
45
- cleanup();
46
- originalUnmount();
47
- };
48
- }
49
- if (isVue2) {
50
- app.mixin({
51
- beforeCreate() {
52
- if (!this._provided) {
53
- const provideCache = {};
54
- Object.defineProperty(this, "_provided", {
55
- get: () => provideCache,
56
- set: (v) => Object.assign(provideCache, v)
57
- });
58
- }
59
- this._provided[clientKey] = client;
60
- if (process.env.NODE_ENV === "development") {
61
- if (this === this.$root && options.enableDevtoolsV6Plugin) {
62
- setupDevtools(this, client);
63
- }
64
- }
65
- }
66
- });
67
- } else {
68
- app.provide(clientKey, client);
69
- if (process.env.NODE_ENV === "development") {
70
- if (options.enableDevtoolsV6Plugin) {
71
- setupDevtools(app, client);
72
- }
73
- }
74
- }
75
- }
76
- };
77
- export {
78
- VueQueryPlugin
79
- };
80
- //# sourceMappingURL=vueQueryPlugin.js.map
@@ -1 +0,0 @@
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 './types'\n\ntype ClientPersister = (client: QueryClient) => [() => void, Promise<void>]\n\ninterface CommonOptions {\n enableDevtoolsV6Plugin?: boolean\n queryClientKey?: string\n clientPersister?: ClientPersister\n clientPersisterOnSuccess?: (client: QueryClient) => void\n}\n\ninterface ConfigOptions extends CommonOptions {\n queryClientConfig?: QueryClientConfig\n}\n\ninterface ClientOptions extends CommonOptions {\n queryClient?: QueryClient\n}\n\nexport type VueQueryPluginOptions = ConfigOptions | ClientOptions\n\nexport const VueQueryPlugin = {\n install: (app: any, options: VueQueryPluginOptions = {}) => {\n const clientKey = getClientKey(options.queryClientKey)\n let client: QueryClient\n\n if ('queryClient' in options && options.queryClient) {\n client = options.queryClient\n } else {\n const clientConfig =\n 'queryClientConfig' in options ? options.queryClientConfig : undefined\n client = new QueryClient(clientConfig)\n }\n\n if (!isServer) {\n client.mount()\n }\n\n let persisterUnmount = () => {\n // noop\n }\n\n if (options.clientPersister) {\n if (client.isRestoring) {\n client.isRestoring.value = true\n }\n const [unmount, promise] = options.clientPersister(client)\n persisterUnmount = unmount\n promise.then(() => {\n if (client.isRestoring) {\n client.isRestoring.value = false\n }\n options.clientPersisterOnSuccess?.(client)\n })\n }\n\n const cleanup = () => {\n client.unmount()\n persisterUnmount()\n }\n\n if (app.onUnmount) {\n app.onUnmount(cleanup)\n } else {\n const originalUnmount = app.unmount\n app.unmount = function vueQueryUnmount() {\n cleanup()\n originalUnmount()\n }\n }\n\n if (isVue2) {\n app.mixin({\n beforeCreate() {\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30\n if (!this._provided) {\n const provideCache = {}\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n })\n }\n\n this._provided[clientKey] = client\n\n if (process.env.NODE_ENV === 'development') {\n if (this === this.$root && options.enableDevtoolsV6Plugin) {\n setupDevtools(this, client)\n }\n }\n },\n })\n } else {\n app.provide(clientKey, client)\n\n if (process.env.NODE_ENV === 'development') {\n if (options.enableDevtoolsV6Plugin) {\n setupDevtools(app, client)\n }\n }\n }\n },\n}\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAsBvB,IAAM,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,UAAI,OAAO,aAAa;AACtB,eAAO,YAAY,QAAQ;AAAA,MAC7B;AACA,YAAM,CAAC,SAAS,OAAO,IAAI,QAAQ,gBAAgB,MAAM;AACzD,yBAAmB;AACnB,cAAQ,KAAK,MAAM;AAtDzB;AAuDQ,YAAI,OAAO,aAAa;AACtB,iBAAO,YAAY,QAAQ;AAAA,QAC7B;AACA,sBAAQ,6BAAR,iCAAmC;AAAA,MACrC,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,SAAS,QAAQ,wBAAwB;AACzD,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,YAAI,QAAQ,wBAAwB;AAClC,wBAAc,KAAK,MAAM;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}