@duxweb/dvha-core 0.0.8 → 0.0.9

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 (44) hide show
  1. package/dist/cjs/components/loader/iframe.cjs +1 -0
  2. package/dist/cjs/hooks/auth.cjs +1 -1
  3. package/dist/cjs/hooks/data.cjs +1 -1
  4. package/dist/cjs/hooks/manage.cjs +1 -1
  5. package/dist/cjs/hooks/menu.cjs +1 -1
  6. package/dist/cjs/hooks/theme.cjs +1 -1
  7. package/dist/cjs/index.cjs +1 -1
  8. package/dist/cjs/provider/app.cjs +1 -1
  9. package/dist/cjs/provider/tab.cjs +1 -1
  10. package/dist/cjs/simple/authProvider.cjs +1 -1
  11. package/dist/cjs/simple/dataProvider.cjs +1 -1
  12. package/dist/cjs/stores/auth.cjs +1 -1
  13. package/dist/cjs/stores/manage.cjs +1 -0
  14. package/dist/cjs/stores/route.cjs +1 -1
  15. package/dist/cjs/stores/tab.cjs +1 -1
  16. package/dist/esm/components/loader/iframe.js +22 -0
  17. package/dist/esm/hooks/auth.js +34 -36
  18. package/dist/esm/hooks/data.js +237 -219
  19. package/dist/esm/hooks/manage.js +16 -18
  20. package/dist/esm/hooks/menu.js +13 -14
  21. package/dist/esm/hooks/theme.js +16 -16
  22. package/dist/esm/index.js +51 -51
  23. package/dist/esm/provider/app.js +58 -55
  24. package/dist/esm/provider/tab.js +11 -10
  25. package/dist/esm/simple/authProvider.js +111 -88
  26. package/dist/esm/simple/dataProvider.js +95 -90
  27. package/dist/esm/stores/auth.js +49 -48
  28. package/dist/esm/stores/manage.js +41 -0
  29. package/dist/esm/stores/route.js +0 -1
  30. package/dist/esm/stores/tab.js +1 -2
  31. package/dist/types/components/loader/index.d.ts +1 -1
  32. package/dist/types/hooks/data.d.ts +17 -2
  33. package/dist/types/hooks/manage.d.ts +1 -1
  34. package/dist/types/simple/authProvider.d.ts +16 -1
  35. package/dist/types/simple/dataProvider.d.ts +4 -1
  36. package/dist/types/stores/auth.d.ts +28 -22
  37. package/dist/types/stores/index.d.ts +1 -0
  38. package/dist/types/stores/manage.d.ts +23 -0
  39. package/dist/types/stores/route.d.ts +0 -2019
  40. package/dist/types/stores/tab.d.ts +1 -830
  41. package/dist/types/types/config.d.ts +1 -2
  42. package/dist/types/types/data.d.ts +1 -0
  43. package/dist/types/types/manage.d.ts +1 -2
  44. package/package.json +2 -2
@@ -1,369 +1,387 @@
1
- import { useQuery as q, useInfiniteQuery as F, useMutation as l, useQueryClient as w } from "@tanstack/vue-query";
2
- import { computed as f, watch as P } from "vue";
3
- import { useGetAuth as g, useError as v } from "./auth.js";
4
- import { useManage as E } from "./manage.js";
1
+ import { useQuery as F, useInfiniteQuery as $, useMutation as P, useQueryClient as w } from "@tanstack/vue-query";
2
+ import { computed as h, watch as a } from "vue";
3
+ import { useGetAuth as y, useError as N } from "./auth.js";
4
+ import { useManage as l } from "./manage.js";
5
5
  function D(t) {
6
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
7
- const { onError: o, options: e, ...r } = t;
6
+ var c;
7
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
8
+ const { onError: o, options: n, ...r } = t;
8
9
  return r;
9
- }), n = q({
10
- queryKey: [t.path, c],
10
+ }), e = F({
11
+ queryKey: [`${(c = i.config) == null ? void 0 : c.name}:${d}:${t.path}`, s],
11
12
  queryFn: () => {
12
- var o;
13
- return (o = i.config.dataProvider) == null ? void 0 : o.getList(c.value, i, s);
13
+ var o, n, r;
14
+ return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.getList(s.value, i, v);
14
15
  },
15
16
  ...t.options
16
- }), u = f(() => n.isFetched ? !1 : n.isFetching);
17
- return P(() => n.isError, () => {
17
+ }), u = h(() => e.isFetched ? !1 : e.isFetching);
18
+ return a(() => e.isError, () => {
18
19
  var o;
19
- d(n.error), (o = t.onError) == null || o.call(t, n.error);
20
+ f(e.error), (o = t.onError) == null || o.call(t, e.error);
20
21
  }), {
21
- ...n,
22
+ ...e,
22
23
  isLoading: u,
23
- data: n.data,
24
- refetch: n.refetch
24
+ data: e.data,
25
+ refetch: e.refetch
25
26
  };
26
27
  }
27
28
  function z(t) {
28
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
29
- const { onError: o, options: e, ...r } = t;
29
+ var c;
30
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
31
+ const { onError: o, options: n, ...r } = t;
30
32
  return r;
31
- }), n = F({
32
- queryKey: [t.path, c],
33
+ }), e = $({
34
+ queryKey: [`${(c = i.config) == null ? void 0 : c.name}:${d}:${t.path}`, s],
33
35
  queryFn: () => {
34
- var o;
35
- return (o = i.config.dataProvider) == null ? void 0 : o.getList(c.value, i, s);
36
+ var o, n, r;
37
+ return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.getList(s.value, i, v);
36
38
  },
37
39
  initialPageParam: 0,
38
- getNextPageParam: (o, e, r) => {
39
- var h;
40
- if (!(!(o != null && o.data) || ((h = o == null ? void 0 : o.data) == null ? void 0 : h.length) === 0))
40
+ getNextPageParam: (o, n, r) => {
41
+ var g;
42
+ if (!(!(o != null && o.data) || ((g = o == null ? void 0 : o.data) == null ? void 0 : g.length) === 0))
41
43
  return r + 1;
42
44
  },
43
- getPreviousPageParam: (o, e, r) => {
45
+ getPreviousPageParam: (o, n, r) => {
44
46
  if (!(r <= 1))
45
47
  return r - 1;
46
48
  },
47
49
  ...t.options
48
- }), u = f(() => n.isFetched ? !1 : n.isFetching);
49
- return P(() => n.isError, () => {
50
+ }), u = h(() => e.isFetched ? !1 : e.isFetching);
51
+ return a(() => e.isError, () => {
50
52
  var o;
51
- d(n.error), (o = t.onError) == null || o.call(t, n.error);
53
+ f(e.error), (o = t.onError) == null || o.call(t, e.error);
52
54
  }), {
53
- ...n,
55
+ ...e,
54
56
  isLoading: u,
55
- data: n.data,
56
- fetchNextPage: n.fetchNextPage,
57
- hasNextPage: n.hasNextPage,
58
- refetch: n.refetch
57
+ data: e.data,
58
+ fetchNextPage: e.fetchNextPage,
59
+ hasNextPage: e.hasNextPage,
60
+ refetch: e.refetch
59
61
  };
60
62
  }
61
63
  function C(t) {
62
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
63
- const { onError: o, options: e, ...r } = t;
64
+ var c;
65
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
66
+ const { onError: o, options: n, ...r } = t;
64
67
  return r;
65
- }), n = q({
66
- queryKey: [t.path, c],
68
+ }), e = F({
69
+ queryKey: [`${(c = i.config) == null ? void 0 : c.name}:${d}:${t.path}`, s],
67
70
  queryFn: () => {
68
- var o;
69
- return (o = i.config.dataProvider) == null ? void 0 : o.getOne(c.value, i, s);
71
+ var o, n, r;
72
+ return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.getOne(s.value, i, v);
70
73
  },
71
74
  ...t.options
72
- }), u = f(() => n.isFetched ? !1 : n.isFetching);
73
- return P(() => n.isError, () => {
75
+ }), u = h(() => e.isFetched ? !1 : e.isFetching);
76
+ return a(() => e.isError, () => {
74
77
  var o;
75
- d(n.error), (o = t.onError) == null || o.call(t, n.error);
78
+ f(e.error), (o = t.onError) == null || o.call(t, e.error);
76
79
  }), {
77
- ...n,
80
+ ...e,
78
81
  isLoading: u,
79
- data: n.data,
80
- refetch: n.refetch
82
+ data: e.data,
83
+ refetch: e.refetch
81
84
  };
82
85
  }
83
86
  function x(t) {
84
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
85
- const { onError: o, options: e, ...r } = t;
87
+ var c;
88
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
89
+ const { onError: o, options: n, ...r } = t;
86
90
  return r;
87
- }), n = q({
88
- queryKey: [t.path, c],
91
+ }), e = F({
92
+ queryKey: [`${(c = i.config) == null ? void 0 : c.name}:${d}:${t.path}`, s],
89
93
  queryFn: () => {
90
- var o;
91
- return (o = i.config.dataProvider) == null ? void 0 : o.getMany(c.value, i, s);
94
+ var o, n, r;
95
+ return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.getMany(s.value, i, v);
92
96
  },
93
97
  ...t.options
94
- }), u = f(() => n.isFetched ? !1 : n.isFetching);
95
- return P(() => n.isError, () => {
98
+ }), u = h(() => e.isFetched ? !1 : e.isFetching);
99
+ return a(() => e.isError, () => {
96
100
  var o;
97
- d(n.error), (o = t.onError) == null || o.call(t, n.error);
101
+ f(e.error), (o = t.onError) == null || o.call(t, e.error);
98
102
  }), {
99
- ...n,
103
+ ...e,
100
104
  isLoading: u,
101
- data: n.data,
102
- refetch: n.refetch
105
+ data: e.data,
106
+ refetch: e.refetch
103
107
  };
104
108
  }
105
109
  function K(t) {
106
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
107
- const { onError: e, options: r, ...h } = t;
108
- return h;
109
- }), u = l({
110
- mutationFn: (e) => {
111
- if (!i.config.dataProvider)
110
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
111
+ const { onError: o, options: n, ...r } = t;
112
+ return r;
113
+ }), u = P({
114
+ mutationFn: (o) => {
115
+ var n, r, g, E;
116
+ if (!((n = i.config) != null && n.dataProvider))
112
117
  throw new Error("Data provider is not initialized");
113
- return i.config.dataProvider.create({
114
- ...n.value,
115
- ...e
116
- }, i, s);
118
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.create({
119
+ ...e.value,
120
+ ...o
121
+ }, i, v);
117
122
  },
118
- onSuccess: (e) => {
119
- var r;
120
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
123
+ onSuccess: (o) => {
124
+ var n;
125
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
121
126
  },
122
- onError: (e) => {
123
- var r;
124
- d(e), (r = t.onError) == null || r.call(t, e);
127
+ onError: (o) => {
128
+ var n;
129
+ f(o), (n = t.onError) == null || n.call(t, o);
125
130
  },
126
131
  ...t.options
127
- }), o = f(() => u.isPending);
132
+ }), c = h(() => u.isPending);
128
133
  return {
129
134
  ...u,
130
- isLoading: o,
135
+ isLoading: c,
131
136
  mutate: u.mutate
132
137
  };
133
138
  }
134
- function N(t) {
135
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
136
- const { onError: e, options: r, ...h } = t;
137
- return h;
138
- }), u = l({
139
- mutationFn: (e) => {
140
- if (!i.config.dataProvider)
139
+ function Q(t) {
140
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
141
+ const { onError: o, options: n, ...r } = t;
142
+ return r;
143
+ }), u = P({
144
+ mutationFn: (o) => {
145
+ var n, r, g, E;
146
+ if (!((n = i.config) != null && n.dataProvider))
141
147
  throw new Error("Data provider is not initialized");
142
- return i.config.dataProvider.createMany({
143
- ...n.value,
144
- ...e
145
- }, i, s);
148
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.createMany({
149
+ ...e.value,
150
+ ...o
151
+ }, i, v);
146
152
  },
147
- onSuccess: (e) => {
148
- var r;
149
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
153
+ onSuccess: (o) => {
154
+ var n;
155
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
150
156
  },
151
- onError: (e) => {
152
- var r;
153
- d(e), (r = t.onError) == null || r.call(t, e);
157
+ onError: (o) => {
158
+ var n;
159
+ f(o), (n = t.onError) == null || n.call(t, o);
154
160
  },
155
161
  ...t.options
156
- }), o = f(() => u.isPending);
162
+ }), c = h(() => u.isPending);
157
163
  return {
158
164
  ...u,
159
- isLoading: o,
165
+ isLoading: c,
160
166
  mutate: u.mutate
161
167
  };
162
168
  }
163
- function Q(t) {
164
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
165
- const { onError: e, options: r, ...h } = t;
166
- return h;
167
- }), u = l({
168
- mutationFn: (e) => {
169
- if (!i.config.dataProvider)
169
+ function k(t) {
170
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
171
+ const { onError: o, options: n, ...r } = t;
172
+ return r;
173
+ }), u = P({
174
+ mutationFn: (o) => {
175
+ var n, r, g, E;
176
+ if (!((n = i.config) != null && n.dataProvider))
170
177
  throw new Error("Data provider is not initialized");
171
- return i.config.dataProvider.update({
172
- ...n.value,
173
- ...e
174
- }, i, s);
178
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.update({
179
+ ...e.value,
180
+ ...o
181
+ }, i, v);
175
182
  },
176
- onSuccess: (e) => {
177
- var r;
178
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
183
+ onSuccess: (o) => {
184
+ var n;
185
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
179
186
  },
180
- onError: (e) => {
181
- var r;
182
- d(e), (r = t.onError) == null || r.call(t, e);
187
+ onError: (o) => {
188
+ var n;
189
+ f(o), (n = t.onError) == null || n.call(t, o);
183
190
  },
184
191
  ...t.options
185
- }), o = f(() => u.isPending);
192
+ }), c = h(() => u.isPending);
186
193
  return {
187
194
  ...u,
188
- isLoading: o,
195
+ isLoading: c,
189
196
  mutate: u.mutate
190
197
  };
191
198
  }
192
199
  function I(t) {
193
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
194
- const { onError: e, options: r, ...h } = t;
195
- return h;
196
- }), u = l({
197
- mutationFn: (e) => {
198
- if (!i.config.dataProvider)
200
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
201
+ const { onError: o, options: n, ...r } = t;
202
+ return r;
203
+ }), u = P({
204
+ mutationFn: (o) => {
205
+ var n, r, g, E;
206
+ if (!((n = i.config) != null && n.dataProvider))
199
207
  throw new Error("Data provider is not initialized");
200
- return i.config.dataProvider.updateMany({
201
- ...n.value,
202
- ...e
203
- }, i, s);
208
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.updateMany({
209
+ ...e.value,
210
+ ...o
211
+ }, i, v);
204
212
  },
205
- onSuccess: (e) => {
206
- var r;
207
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
213
+ onSuccess: (o) => {
214
+ var n;
215
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
208
216
  },
209
- onError: (e) => {
210
- var r;
211
- d(e), (r = t.onError) == null || r.call(t, e);
217
+ onError: (o) => {
218
+ var n;
219
+ f(o), (n = t.onError) == null || n.call(t, o);
212
220
  },
213
221
  ...t.options
214
- }), o = f(() => u.isPending);
222
+ }), c = h(() => u.isPending);
215
223
  return {
216
224
  ...u,
217
- isLoading: o,
225
+ isLoading: c,
218
226
  mutate: u.mutate
219
227
  };
220
228
  }
221
229
  function O(t) {
222
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
223
- const { onError: e, options: r, ...h } = t;
224
- return h;
225
- }), u = l({
226
- mutationFn: (e) => {
227
- if (!i.config.dataProvider)
230
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
231
+ const { onError: o, options: n, ...r } = t;
232
+ return r;
233
+ }), u = P({
234
+ mutationFn: (o) => {
235
+ var n, r, g, E;
236
+ if (!((n = i.config) != null && n.dataProvider))
228
237
  throw new Error("Data provider is not initialized");
229
- return i.config.dataProvider.deleteOne({
230
- ...n.value,
231
- ...e
232
- }, i, s);
238
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.deleteOne({
239
+ ...e.value,
240
+ ...o
241
+ }, i, v);
233
242
  },
234
- onSuccess: (e) => {
235
- var r;
236
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
243
+ onSuccess: (o) => {
244
+ var n;
245
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
237
246
  },
238
- onError: (e) => {
239
- var r;
240
- d(e), (r = t.onError) == null || r.call(t, e);
247
+ onError: (o) => {
248
+ var n;
249
+ f(o), (n = t.onError) == null || n.call(t, o);
241
250
  },
242
251
  ...t.options
243
- }), o = f(() => u.isPending);
252
+ }), c = h(() => u.isPending);
244
253
  return {
245
254
  ...u,
246
- isLoading: o,
255
+ isLoading: c,
247
256
  mutate: u.mutate
248
257
  };
249
258
  }
250
259
  function _(t) {
251
- const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
252
- const { onError: e, options: r, ...h } = t;
253
- return h;
254
- }), u = l({
255
- mutationFn: (e) => {
256
- if (!i.config.dataProvider)
260
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = q(), e = h(() => {
261
+ const { onError: o, options: n, ...r } = t;
262
+ return r;
263
+ }), u = P({
264
+ mutationFn: (o) => {
265
+ var n, r, g, E;
266
+ if (!((n = i.config) != null && n.dataProvider))
257
267
  throw new Error("Data provider is not initialized");
258
- return i.config.dataProvider.deleteMany({
259
- ...n.value,
260
- ...e
261
- }, i, s);
268
+ return (E = (g = (r = i.config) == null ? void 0 : r.dataProvider) == null ? void 0 : g[d]) == null ? void 0 : E.deleteMany({
269
+ ...e.value,
270
+ ...o
271
+ }, i, v);
262
272
  },
263
- onSuccess: (e) => {
264
- var r;
265
- (r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
273
+ onSuccess: (o) => {
274
+ var n;
275
+ (n = t.onSuccess) == null || n.call(t, o), t.path && s(t.path);
266
276
  },
267
- onError: (e) => {
268
- var r;
269
- d(e), (r = t.onError) == null || r.call(t, e);
277
+ onError: (o) => {
278
+ var n;
279
+ f(o), (n = t.onError) == null || n.call(t, o);
270
280
  },
271
281
  ...t.options
272
- }), o = f(() => u.isPending);
282
+ }), c = h(() => u.isPending);
273
283
  return {
274
284
  ...u,
275
- isLoading: o,
285
+ isLoading: c,
276
286
  mutate: u.mutate
277
287
  };
278
288
  }
279
- function a(t) {
280
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
281
- const { onError: o, options: e, ...r } = t;
289
+ function U(t) {
290
+ var c;
291
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
292
+ const { onError: o, options: n, ...r } = t;
282
293
  return r;
283
- }), n = q({
284
- queryKey: [t.path, c],
294
+ }), e = F({
295
+ queryKey: [`${(c = i.config) == null ? void 0 : c.name}:${d}:${t.path}`, s],
285
296
  queryFn: () => {
286
- var o;
287
- return (o = i.config.dataProvider) == null ? void 0 : o.custom(c.value, i, s);
297
+ var o, n, r;
298
+ return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.custom(s.value, i, v);
288
299
  },
289
300
  ...t.options
290
- }), u = f(() => n.isFetched ? !1 : n.isFetching);
291
- return P(() => n.isError, () => {
301
+ }), u = h(() => e.isFetched ? !1 : e.isFetching);
302
+ return a(() => e.isError, () => {
292
303
  var o;
293
- d(n.error), (o = t.onError) == null || o.call(t, n.error);
304
+ f(e.error), (o = t.onError) == null || o.call(t, e.error);
294
305
  }), {
295
- ...n,
306
+ ...e,
296
307
  isLoading: u,
297
- data: n.data,
298
- refetch: n.refetch
308
+ data: e.data,
309
+ refetch: e.refetch
299
310
  };
300
311
  }
301
- function U(t) {
302
- const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
303
- const { onError: o, options: e, ...r } = t;
304
- return r;
305
- }), n = l({
306
- mutationFn: (o) => {
307
- if (!i.config.dataProvider)
312
+ function G(t) {
313
+ const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), s = h(() => {
314
+ const { onError: c, options: o, ...n } = t;
315
+ return n;
316
+ }), e = P({
317
+ mutationFn: (c) => {
318
+ var o, n, r, g;
319
+ if (!((o = i.config) != null && o.dataProvider))
308
320
  throw new Error("Data provider is not initialized");
309
- return i.config.dataProvider.custom({
310
- ...c.value,
311
- ...o
312
- }, i, s);
321
+ return (g = (r = (n = i.config) == null ? void 0 : n.dataProvider) == null ? void 0 : r[d]) == null ? void 0 : g.custom({
322
+ ...s.value,
323
+ ...c
324
+ }, i, v);
313
325
  },
314
- onSuccess: (o) => {
315
- var e;
316
- (e = t.onSuccess) == null || e.call(t, o);
326
+ onSuccess: (c) => {
327
+ var o;
328
+ (o = t.onSuccess) == null || o.call(t, c);
317
329
  },
318
- onError: (o) => {
319
- var e;
320
- d(o), (e = t.onError) == null || e.call(t, o);
330
+ onError: (c) => {
331
+ var o;
332
+ f(c), (o = t.onError) == null || o.call(t, c);
321
333
  },
322
334
  ...t.options
323
- }), u = f(() => n.isPending);
335
+ }), u = h(() => e.isPending);
324
336
  return {
325
- ...n,
337
+ ...e,
326
338
  isLoading: u,
327
- mutate: n.mutate
339
+ mutate: e.mutate
328
340
  };
329
341
  }
330
- function k() {
331
- const t = E(), i = g();
342
+ function b() {
343
+ const t = l(), i = y();
332
344
  return {
333
345
  request: (d) => {
334
- var c;
335
- if (!t.config.dataProvider)
346
+ var s, e, u, c;
347
+ if (!((s = t.config) != null && s.dataProvider))
336
348
  throw new Error("Data provider is not initialized");
337
- return (c = t.config.dataProvider) == null ? void 0 : c.custom({
349
+ const f = d.providerName || "default";
350
+ return (c = (u = (e = t.config) == null ? void 0 : e.dataProvider) == null ? void 0 : u[f]) == null ? void 0 : c.custom({
338
351
  ...d
339
352
  }, t, i);
340
353
  }
341
354
  };
342
355
  }
343
- function y() {
344
- const t = w();
356
+ function q() {
357
+ const t = w(), i = l();
345
358
  return {
346
- invalidate: (s) => {
347
- let d = s;
348
- Array.isArray(s) || (d = [s]), t.invalidateQueries({
349
- queryKey: d
350
- });
359
+ invalidate: (d, f) => {
360
+ var e;
361
+ let s = d;
362
+ Array.isArray(d) || (s = [d]);
363
+ for (const u of s) {
364
+ const c = `${(e = i.config) == null ? void 0 : e.name}:${f || "default"}:${u}`;
365
+ t.invalidateQueries({
366
+ queryKey: [c]
367
+ });
368
+ }
351
369
  }
352
370
  };
353
371
  }
354
372
  export {
355
- k as useClient,
373
+ b as useClient,
356
374
  K as useCreate,
357
- N as useCreateMany,
358
- a as useCustom,
359
- U as useCustomMutation,
375
+ Q as useCreateMany,
376
+ U as useCustom,
377
+ G as useCustomMutation,
360
378
  O as useDelete,
361
379
  _ as useDeleteMany,
362
380
  z as useInfiniteList,
363
- y as useInvalidate,
381
+ q as useInvalidate,
364
382
  D as useList,
365
383
  x as useMany,
366
384
  C as useOne,
367
- Q as useUpdate,
385
+ k as useUpdate,
368
386
  I as useUpdateMany
369
387
  };
@@ -1,24 +1,22 @@
1
- import { cloneDeep as u, trim as l, trimStart as a } from "lodash-es";
2
- import { inject as d } from "vue";
3
- import { useConfig as s } from "./config.js";
4
- function P(i) {
5
- var p;
6
- const r = s(), o = d("dux.manage");
7
- if (i || (i = o == null ? void 0 : o.value), !i)
1
+ import { trimStart as c } from "lodash-es";
2
+ import { inject as p } from "vue";
3
+ import "pinia";
4
+ import { useManageStore as s } from "../stores/manage.js";
5
+ function w(o) {
6
+ const e = p("dux.manage");
7
+ if (o || (o = e == null ? void 0 : e.value), !o)
8
8
  throw new Error("manage name is not defined");
9
- const t = u((p = r.manages) == null ? void 0 : p.find((e) => e.name === i));
10
- if (!t)
11
- throw new Error(`manage ${i} is not defined`);
12
- const n = [];
13
- return t.title && n.push(t.title), r.title && n.push(r.title), t.title = n.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme }, t.authProvider = (t == null ? void 0 : t.authProvider) || r.authProvider, t.dataProvider = (t == null ? void 0 : t.dataProvider) || r.dataProvider, t.layoutComponent = {
14
- ...r.layoutComponent,
15
- ...t.layoutComponent
16
- }, t.apiUrl = r != null && r.apiUrl ? `${r.apiUrl}/${l(t.apiUrl, "/")}` : t.apiUrl, t.apiUrl = l(t.apiUrl, "/"), {
9
+ const { config: t } = s(o);
10
+ return {
17
11
  config: t,
18
- getRoutePath: (e) => `${t.routePrefix}/${a(e || "", "/")}`,
19
- getApiUrl: (e) => `${t.apiUrl}/${a(e || "", "/")}`
12
+ getRoutePath: (i) => `${t == null ? void 0 : t.routePrefix}/${c(i || "", "/")}`,
13
+ getApiUrl: (i, f) => {
14
+ var n, u;
15
+ const r = (n = t == null ? void 0 : t.dataProvider) == null ? void 0 : n[f || "default"];
16
+ return ((u = r == null ? void 0 : r.apiUrl) == null ? void 0 : u.call(r, i)) || "";
17
+ }
20
18
  };
21
19
  }
22
20
  export {
23
- P as useManage
21
+ w as useManage
24
22
  };