@hortiview/modulebase 1.1.2-alpha.870da389.1 → 2.0.0-alpha.e897c28d.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IsRestoringProvider-Dc5Evyjr.js +6 -0
- package/dist/QueryClientProvider-DZI32rjZ.js +21 -0
- package/dist/api-CSxWxEZl.js +148 -0
- package/dist/{chunk-EVOBXE3Y-B43QN6RE.js → chunk-EVOBXE3Y-BRmUxtwH.js} +126 -127
- package/dist/components/ModuleBase.js +13 -17
- package/dist/components/ModuleCore.js +11398 -9
- package/dist/constants.js +1 -2
- package/dist/defaultQueryClient-Cfsorhtn.js +620 -0
- package/dist/hooks/useBreadcrumbTranslation.js +13 -16
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +5 -5
- package/dist/hooks/useEntity.js +1 -1
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +2 -2
- package/dist/hooks/useSignalRMessages.js +1 -1
- package/dist/lib/components/ModuleBase.d.ts +3 -22
- package/dist/lib/components/ModuleCore.d.ts +3 -17
- package/dist/lib/main.d.ts +0 -3
- package/dist/lib/module-router.d.ts +1 -1
- package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -4
- package/dist/lib/types/BaseProps.d.ts +38 -1
- package/dist/lib/utils/defaultQueryClient.d.ts +2 -0
- package/dist/lib/utils/defaultSignalRClient.d.ts +4 -0
- package/dist/lib/utils/helper.d.ts +1 -2
- package/dist/main.js +56 -187
- package/dist/module-router.js +2 -2
- package/dist/provider/SignalR/SignalRProvider.js +22 -5966
- package/dist/{IsRestoringProvider-SzKJZczp.js → query-DZDIN635.js} +211 -232
- package/dist/stores/BasePropsStore.js +1 -0
- package/dist/{useCustomMutation-9VUQ7NbQ.js → useCustomMutation-C1aVbjpt.js} +13 -12
- package/dist/{useQuery-DUDyh33-.js → useQuery-CUSHkb38.js} +33 -31
- package/dist/utils/api.js +1 -1
- package/dist/utils/baseFetches.js +1 -1
- package/dist/utils/defaultQueryClient.js +4 -0
- package/dist/utils/defaultSignalRClient.js +5949 -0
- package/dist/utils/helper.js +9 -10
- package/package.json +1 -1
- package/dist/ModuleCore-DRMqZO8r.js +0 -12017
- package/dist/api-COabZnyn.js +0 -147
- package/dist/lib/types/ServiceBus.d.ts +0 -17
- package/dist/types/ServiceBus.js +0 -1
package/dist/constants.js
CHANGED
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import { R as v, e as O, n as u, S as m, m as c, c as o, f as g, Q, g as l, i as M, o as d, r as f, j as b, b as y, p, k as w } from "./query-DZDIN635.js";
|
|
2
|
+
var P = class extends v {
|
|
3
|
+
#t;
|
|
4
|
+
#e;
|
|
5
|
+
#s;
|
|
6
|
+
#r;
|
|
7
|
+
constructor(t) {
|
|
8
|
+
super(), this.#t = t.client, this.mutationId = t.mutationId, this.#s = t.mutationCache, this.#e = [], this.state = t.state || x(), this.setOptions(t.options), this.scheduleGc();
|
|
9
|
+
}
|
|
10
|
+
setOptions(t) {
|
|
11
|
+
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
12
|
+
}
|
|
13
|
+
get meta() {
|
|
14
|
+
return this.options.meta;
|
|
15
|
+
}
|
|
16
|
+
addObserver(t) {
|
|
17
|
+
this.#e.includes(t) || (this.#e.push(t), this.clearGcTimeout(), this.#s.notify({
|
|
18
|
+
type: "observerAdded",
|
|
19
|
+
mutation: this,
|
|
20
|
+
observer: t
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
removeObserver(t) {
|
|
24
|
+
this.#e = this.#e.filter((e) => e !== t), this.scheduleGc(), this.#s.notify({
|
|
25
|
+
type: "observerRemoved",
|
|
26
|
+
mutation: this,
|
|
27
|
+
observer: t
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
optionalRemove() {
|
|
31
|
+
this.#e.length || (this.state.status === "pending" ? this.scheduleGc() : this.#s.remove(this));
|
|
32
|
+
}
|
|
33
|
+
continue() {
|
|
34
|
+
return this.#r?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
35
|
+
this.execute(this.state.variables);
|
|
36
|
+
}
|
|
37
|
+
async execute(t) {
|
|
38
|
+
const e = () => {
|
|
39
|
+
this.#i({ type: "continue" });
|
|
40
|
+
}, s = {
|
|
41
|
+
client: this.#t,
|
|
42
|
+
meta: this.options.meta,
|
|
43
|
+
mutationKey: this.options.mutationKey
|
|
44
|
+
};
|
|
45
|
+
this.#r = O({
|
|
46
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t, s) : Promise.reject(new Error("No mutationFn found")),
|
|
47
|
+
onFail: (r, a) => {
|
|
48
|
+
this.#i({ type: "failed", failureCount: r, error: a });
|
|
49
|
+
},
|
|
50
|
+
onPause: () => {
|
|
51
|
+
this.#i({ type: "pause" });
|
|
52
|
+
},
|
|
53
|
+
onContinue: e,
|
|
54
|
+
retry: this.options.retry ?? 0,
|
|
55
|
+
retryDelay: this.options.retryDelay,
|
|
56
|
+
networkMode: this.options.networkMode,
|
|
57
|
+
canRun: () => this.#s.canRun(this)
|
|
58
|
+
});
|
|
59
|
+
const i = this.state.status === "pending", n = !this.#r.canStart();
|
|
60
|
+
try {
|
|
61
|
+
if (i)
|
|
62
|
+
e();
|
|
63
|
+
else {
|
|
64
|
+
this.#i({ type: "pending", variables: t, isPaused: n }), this.#s.config.onMutate && await this.#s.config.onMutate(
|
|
65
|
+
t,
|
|
66
|
+
this,
|
|
67
|
+
s
|
|
68
|
+
);
|
|
69
|
+
const a = await this.options.onMutate?.(
|
|
70
|
+
t,
|
|
71
|
+
s
|
|
72
|
+
);
|
|
73
|
+
a !== this.state.context && this.#i({
|
|
74
|
+
type: "pending",
|
|
75
|
+
context: a,
|
|
76
|
+
variables: t,
|
|
77
|
+
isPaused: n
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const r = await this.#r.start();
|
|
81
|
+
return await this.#s.config.onSuccess?.(
|
|
82
|
+
r,
|
|
83
|
+
t,
|
|
84
|
+
this.state.context,
|
|
85
|
+
this,
|
|
86
|
+
s
|
|
87
|
+
), await this.options.onSuccess?.(
|
|
88
|
+
r,
|
|
89
|
+
t,
|
|
90
|
+
this.state.context,
|
|
91
|
+
s
|
|
92
|
+
), await this.#s.config.onSettled?.(
|
|
93
|
+
r,
|
|
94
|
+
null,
|
|
95
|
+
this.state.variables,
|
|
96
|
+
this.state.context,
|
|
97
|
+
this,
|
|
98
|
+
s
|
|
99
|
+
), await this.options.onSettled?.(
|
|
100
|
+
r,
|
|
101
|
+
null,
|
|
102
|
+
t,
|
|
103
|
+
this.state.context,
|
|
104
|
+
s
|
|
105
|
+
), this.#i({ type: "success", data: r }), r;
|
|
106
|
+
} catch (r) {
|
|
107
|
+
try {
|
|
108
|
+
await this.#s.config.onError?.(
|
|
109
|
+
r,
|
|
110
|
+
t,
|
|
111
|
+
this.state.context,
|
|
112
|
+
this,
|
|
113
|
+
s
|
|
114
|
+
);
|
|
115
|
+
} catch (a) {
|
|
116
|
+
Promise.reject(a);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
await this.options.onError?.(
|
|
120
|
+
r,
|
|
121
|
+
t,
|
|
122
|
+
this.state.context,
|
|
123
|
+
s
|
|
124
|
+
);
|
|
125
|
+
} catch (a) {
|
|
126
|
+
Promise.reject(a);
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
await this.#s.config.onSettled?.(
|
|
130
|
+
void 0,
|
|
131
|
+
r,
|
|
132
|
+
this.state.variables,
|
|
133
|
+
this.state.context,
|
|
134
|
+
this,
|
|
135
|
+
s
|
|
136
|
+
);
|
|
137
|
+
} catch (a) {
|
|
138
|
+
Promise.reject(a);
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
await this.options.onSettled?.(
|
|
142
|
+
void 0,
|
|
143
|
+
r,
|
|
144
|
+
t,
|
|
145
|
+
this.state.context,
|
|
146
|
+
s
|
|
147
|
+
);
|
|
148
|
+
} catch (a) {
|
|
149
|
+
Promise.reject(a);
|
|
150
|
+
}
|
|
151
|
+
throw this.#i({ type: "error", error: r }), r;
|
|
152
|
+
} finally {
|
|
153
|
+
this.#s.runNext(this);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
#i(t) {
|
|
157
|
+
const e = (s) => {
|
|
158
|
+
switch (t.type) {
|
|
159
|
+
case "failed":
|
|
160
|
+
return {
|
|
161
|
+
...s,
|
|
162
|
+
failureCount: t.failureCount,
|
|
163
|
+
failureReason: t.error
|
|
164
|
+
};
|
|
165
|
+
case "pause":
|
|
166
|
+
return {
|
|
167
|
+
...s,
|
|
168
|
+
isPaused: !0
|
|
169
|
+
};
|
|
170
|
+
case "continue":
|
|
171
|
+
return {
|
|
172
|
+
...s,
|
|
173
|
+
isPaused: !1
|
|
174
|
+
};
|
|
175
|
+
case "pending":
|
|
176
|
+
return {
|
|
177
|
+
...s,
|
|
178
|
+
context: t.context,
|
|
179
|
+
data: void 0,
|
|
180
|
+
failureCount: 0,
|
|
181
|
+
failureReason: null,
|
|
182
|
+
error: null,
|
|
183
|
+
isPaused: t.isPaused,
|
|
184
|
+
status: "pending",
|
|
185
|
+
variables: t.variables,
|
|
186
|
+
submittedAt: Date.now()
|
|
187
|
+
};
|
|
188
|
+
case "success":
|
|
189
|
+
return {
|
|
190
|
+
...s,
|
|
191
|
+
data: t.data,
|
|
192
|
+
failureCount: 0,
|
|
193
|
+
failureReason: null,
|
|
194
|
+
error: null,
|
|
195
|
+
status: "success",
|
|
196
|
+
isPaused: !1
|
|
197
|
+
};
|
|
198
|
+
case "error":
|
|
199
|
+
return {
|
|
200
|
+
...s,
|
|
201
|
+
data: void 0,
|
|
202
|
+
error: t.error,
|
|
203
|
+
failureCount: s.failureCount + 1,
|
|
204
|
+
failureReason: t.error,
|
|
205
|
+
isPaused: !1,
|
|
206
|
+
status: "error"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
this.state = e(this.state), u.batch(() => {
|
|
211
|
+
this.#e.forEach((s) => {
|
|
212
|
+
s.onMutationUpdate(t);
|
|
213
|
+
}), this.#s.notify({
|
|
214
|
+
mutation: this,
|
|
215
|
+
type: "updated",
|
|
216
|
+
action: t
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
function x() {
|
|
222
|
+
return {
|
|
223
|
+
context: void 0,
|
|
224
|
+
data: void 0,
|
|
225
|
+
error: null,
|
|
226
|
+
failureCount: 0,
|
|
227
|
+
failureReason: null,
|
|
228
|
+
isPaused: !1,
|
|
229
|
+
status: "idle",
|
|
230
|
+
variables: void 0,
|
|
231
|
+
submittedAt: 0
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
var C = class extends m {
|
|
235
|
+
constructor(t = {}) {
|
|
236
|
+
super(), this.config = t, this.#t = /* @__PURE__ */ new Set(), this.#e = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
237
|
+
}
|
|
238
|
+
#t;
|
|
239
|
+
#e;
|
|
240
|
+
#s;
|
|
241
|
+
build(t, e, s) {
|
|
242
|
+
const i = new P({
|
|
243
|
+
client: t,
|
|
244
|
+
mutationCache: this,
|
|
245
|
+
mutationId: ++this.#s,
|
|
246
|
+
options: t.defaultMutationOptions(e),
|
|
247
|
+
state: s
|
|
248
|
+
});
|
|
249
|
+
return this.add(i), i;
|
|
250
|
+
}
|
|
251
|
+
add(t) {
|
|
252
|
+
this.#t.add(t);
|
|
253
|
+
const e = h(t);
|
|
254
|
+
if (typeof e == "string") {
|
|
255
|
+
const s = this.#e.get(e);
|
|
256
|
+
s ? s.push(t) : this.#e.set(e, [t]);
|
|
257
|
+
}
|
|
258
|
+
this.notify({ type: "added", mutation: t });
|
|
259
|
+
}
|
|
260
|
+
remove(t) {
|
|
261
|
+
if (this.#t.delete(t)) {
|
|
262
|
+
const e = h(t);
|
|
263
|
+
if (typeof e == "string") {
|
|
264
|
+
const s = this.#e.get(e);
|
|
265
|
+
if (s)
|
|
266
|
+
if (s.length > 1) {
|
|
267
|
+
const i = s.indexOf(t);
|
|
268
|
+
i !== -1 && s.splice(i, 1);
|
|
269
|
+
} else s[0] === t && this.#e.delete(e);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
this.notify({ type: "removed", mutation: t });
|
|
273
|
+
}
|
|
274
|
+
canRun(t) {
|
|
275
|
+
const e = h(t);
|
|
276
|
+
if (typeof e == "string") {
|
|
277
|
+
const i = this.#e.get(e)?.find(
|
|
278
|
+
(n) => n.state.status === "pending"
|
|
279
|
+
);
|
|
280
|
+
return !i || i === t;
|
|
281
|
+
} else
|
|
282
|
+
return !0;
|
|
283
|
+
}
|
|
284
|
+
runNext(t) {
|
|
285
|
+
const e = h(t);
|
|
286
|
+
return typeof e == "string" ? this.#e.get(e)?.find((i) => i !== t && i.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
287
|
+
}
|
|
288
|
+
clear() {
|
|
289
|
+
u.batch(() => {
|
|
290
|
+
this.#t.forEach((t) => {
|
|
291
|
+
this.notify({ type: "removed", mutation: t });
|
|
292
|
+
}), this.#t.clear(), this.#e.clear();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
getAll() {
|
|
296
|
+
return Array.from(this.#t);
|
|
297
|
+
}
|
|
298
|
+
find(t) {
|
|
299
|
+
const e = { exact: !0, ...t };
|
|
300
|
+
return this.getAll().find(
|
|
301
|
+
(s) => c(e, s)
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
findAll(t = {}) {
|
|
305
|
+
return this.getAll().filter((e) => c(t, e));
|
|
306
|
+
}
|
|
307
|
+
notify(t) {
|
|
308
|
+
u.batch(() => {
|
|
309
|
+
this.listeners.forEach((e) => {
|
|
310
|
+
e(t);
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
resumePausedMutations() {
|
|
315
|
+
const t = this.getAll().filter((e) => e.state.isPaused);
|
|
316
|
+
return u.batch(
|
|
317
|
+
() => Promise.all(
|
|
318
|
+
t.map((e) => e.continue().catch(o))
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
function h(t) {
|
|
324
|
+
return t.options.scope?.id;
|
|
325
|
+
}
|
|
326
|
+
var A = class extends m {
|
|
327
|
+
constructor(t = {}) {
|
|
328
|
+
super(), this.config = t, this.#t = /* @__PURE__ */ new Map();
|
|
329
|
+
}
|
|
330
|
+
#t;
|
|
331
|
+
build(t, e, s) {
|
|
332
|
+
const i = e.queryKey, n = e.queryHash ?? g(i, e);
|
|
333
|
+
let r = this.get(n);
|
|
334
|
+
return r || (r = new Q({
|
|
335
|
+
client: t,
|
|
336
|
+
queryKey: i,
|
|
337
|
+
queryHash: n,
|
|
338
|
+
options: t.defaultQueryOptions(e),
|
|
339
|
+
state: s,
|
|
340
|
+
defaultOptions: t.getQueryDefaults(i)
|
|
341
|
+
}), this.add(r)), r;
|
|
342
|
+
}
|
|
343
|
+
add(t) {
|
|
344
|
+
this.#t.has(t.queryHash) || (this.#t.set(t.queryHash, t), this.notify({
|
|
345
|
+
type: "added",
|
|
346
|
+
query: t
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
remove(t) {
|
|
350
|
+
const e = this.#t.get(t.queryHash);
|
|
351
|
+
e && (t.destroy(), e === t && this.#t.delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
352
|
+
}
|
|
353
|
+
clear() {
|
|
354
|
+
u.batch(() => {
|
|
355
|
+
this.getAll().forEach((t) => {
|
|
356
|
+
this.remove(t);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
get(t) {
|
|
361
|
+
return this.#t.get(t);
|
|
362
|
+
}
|
|
363
|
+
getAll() {
|
|
364
|
+
return [...this.#t.values()];
|
|
365
|
+
}
|
|
366
|
+
find(t) {
|
|
367
|
+
const e = { exact: !0, ...t };
|
|
368
|
+
return this.getAll().find(
|
|
369
|
+
(s) => l(e, s)
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
findAll(t = {}) {
|
|
373
|
+
const e = this.getAll();
|
|
374
|
+
return Object.keys(t).length > 0 ? e.filter((s) => l(t, s)) : e;
|
|
375
|
+
}
|
|
376
|
+
notify(t) {
|
|
377
|
+
u.batch(() => {
|
|
378
|
+
this.listeners.forEach((e) => {
|
|
379
|
+
e(t);
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
onFocus() {
|
|
384
|
+
u.batch(() => {
|
|
385
|
+
this.getAll().forEach((t) => {
|
|
386
|
+
t.onFocus();
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
onOnline() {
|
|
391
|
+
u.batch(() => {
|
|
392
|
+
this.getAll().forEach((t) => {
|
|
393
|
+
t.onOnline();
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}, D = class {
|
|
398
|
+
#t;
|
|
399
|
+
#e;
|
|
400
|
+
#s;
|
|
401
|
+
#r;
|
|
402
|
+
#i;
|
|
403
|
+
#n;
|
|
404
|
+
#a;
|
|
405
|
+
#u;
|
|
406
|
+
constructor(t = {}) {
|
|
407
|
+
this.#t = t.queryCache || new A(), this.#e = t.mutationCache || new C(), this.#s = t.defaultOptions || {}, this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#n = 0;
|
|
408
|
+
}
|
|
409
|
+
mount() {
|
|
410
|
+
this.#n++, this.#n === 1 && (this.#a = M.subscribe(async (t) => {
|
|
411
|
+
t && (await this.resumePausedMutations(), this.#t.onFocus());
|
|
412
|
+
}), this.#u = d.subscribe(async (t) => {
|
|
413
|
+
t && (await this.resumePausedMutations(), this.#t.onOnline());
|
|
414
|
+
}));
|
|
415
|
+
}
|
|
416
|
+
unmount() {
|
|
417
|
+
this.#n--, this.#n === 0 && (this.#a?.(), this.#a = void 0, this.#u?.(), this.#u = void 0);
|
|
418
|
+
}
|
|
419
|
+
isFetching(t) {
|
|
420
|
+
return this.#t.findAll({ ...t, fetchStatus: "fetching" }).length;
|
|
421
|
+
}
|
|
422
|
+
isMutating(t) {
|
|
423
|
+
return this.#e.findAll({ ...t, status: "pending" }).length;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
427
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
428
|
+
*
|
|
429
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
430
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
431
|
+
*/
|
|
432
|
+
getQueryData(t) {
|
|
433
|
+
const e = this.defaultQueryOptions({ queryKey: t });
|
|
434
|
+
return this.#t.get(e.queryHash)?.state.data;
|
|
435
|
+
}
|
|
436
|
+
ensureQueryData(t) {
|
|
437
|
+
const e = this.defaultQueryOptions(t), s = this.#t.build(this, e), i = s.state.data;
|
|
438
|
+
return i === void 0 ? this.fetchQuery(t) : (t.revalidateIfStale && s.isStaleByTime(f(e.staleTime, s)) && this.prefetchQuery(e), Promise.resolve(i));
|
|
439
|
+
}
|
|
440
|
+
getQueriesData(t) {
|
|
441
|
+
return this.#t.findAll(t).map(({ queryKey: e, state: s }) => {
|
|
442
|
+
const i = s.data;
|
|
443
|
+
return [e, i];
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
setQueryData(t, e, s) {
|
|
447
|
+
const i = this.defaultQueryOptions({ queryKey: t }), r = this.#t.get(
|
|
448
|
+
i.queryHash
|
|
449
|
+
)?.state.data, a = b(e, r);
|
|
450
|
+
if (a !== void 0)
|
|
451
|
+
return this.#t.build(this, i).setData(a, { ...s, manual: !0 });
|
|
452
|
+
}
|
|
453
|
+
setQueriesData(t, e, s) {
|
|
454
|
+
return u.batch(
|
|
455
|
+
() => this.#t.findAll(t).map(({ queryKey: i }) => [
|
|
456
|
+
i,
|
|
457
|
+
this.setQueryData(i, e, s)
|
|
458
|
+
])
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
getQueryState(t) {
|
|
462
|
+
const e = this.defaultQueryOptions({ queryKey: t });
|
|
463
|
+
return this.#t.get(
|
|
464
|
+
e.queryHash
|
|
465
|
+
)?.state;
|
|
466
|
+
}
|
|
467
|
+
removeQueries(t) {
|
|
468
|
+
const e = this.#t;
|
|
469
|
+
u.batch(() => {
|
|
470
|
+
e.findAll(t).forEach((s) => {
|
|
471
|
+
e.remove(s);
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
resetQueries(t, e) {
|
|
476
|
+
const s = this.#t;
|
|
477
|
+
return u.batch(() => (s.findAll(t).forEach((i) => {
|
|
478
|
+
i.reset();
|
|
479
|
+
}), this.refetchQueries(
|
|
480
|
+
{
|
|
481
|
+
type: "active",
|
|
482
|
+
...t
|
|
483
|
+
},
|
|
484
|
+
e
|
|
485
|
+
)));
|
|
486
|
+
}
|
|
487
|
+
cancelQueries(t, e = {}) {
|
|
488
|
+
const s = { revert: !0, ...e }, i = u.batch(
|
|
489
|
+
() => this.#t.findAll(t).map((n) => n.cancel(s))
|
|
490
|
+
);
|
|
491
|
+
return Promise.all(i).then(o).catch(o);
|
|
492
|
+
}
|
|
493
|
+
invalidateQueries(t, e = {}) {
|
|
494
|
+
return u.batch(() => (this.#t.findAll(t).forEach((s) => {
|
|
495
|
+
s.invalidate();
|
|
496
|
+
}), t?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
497
|
+
{
|
|
498
|
+
...t,
|
|
499
|
+
type: t?.refetchType ?? t?.type ?? "active"
|
|
500
|
+
},
|
|
501
|
+
e
|
|
502
|
+
)));
|
|
503
|
+
}
|
|
504
|
+
refetchQueries(t, e = {}) {
|
|
505
|
+
const s = {
|
|
506
|
+
...e,
|
|
507
|
+
cancelRefetch: e.cancelRefetch ?? !0
|
|
508
|
+
}, i = u.batch(
|
|
509
|
+
() => this.#t.findAll(t).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
510
|
+
let r = n.fetch(void 0, s);
|
|
511
|
+
return s.throwOnError || (r = r.catch(o)), n.state.fetchStatus === "paused" ? Promise.resolve() : r;
|
|
512
|
+
})
|
|
513
|
+
);
|
|
514
|
+
return Promise.all(i).then(o);
|
|
515
|
+
}
|
|
516
|
+
fetchQuery(t) {
|
|
517
|
+
const e = this.defaultQueryOptions(t);
|
|
518
|
+
e.retry === void 0 && (e.retry = !1);
|
|
519
|
+
const s = this.#t.build(this, e);
|
|
520
|
+
return s.isStaleByTime(
|
|
521
|
+
f(e.staleTime, s)
|
|
522
|
+
) ? s.fetch(e) : Promise.resolve(s.state.data);
|
|
523
|
+
}
|
|
524
|
+
prefetchQuery(t) {
|
|
525
|
+
return this.fetchQuery(t).then(o).catch(o);
|
|
526
|
+
}
|
|
527
|
+
fetchInfiniteQuery(t) {
|
|
528
|
+
return t._type = "infinite", this.fetchQuery(t);
|
|
529
|
+
}
|
|
530
|
+
prefetchInfiniteQuery(t) {
|
|
531
|
+
return this.fetchInfiniteQuery(t).then(o).catch(o);
|
|
532
|
+
}
|
|
533
|
+
ensureInfiniteQueryData(t) {
|
|
534
|
+
return t._type = "infinite", this.ensureQueryData(t);
|
|
535
|
+
}
|
|
536
|
+
resumePausedMutations() {
|
|
537
|
+
return d.isOnline() ? this.#e.resumePausedMutations() : Promise.resolve();
|
|
538
|
+
}
|
|
539
|
+
getQueryCache() {
|
|
540
|
+
return this.#t;
|
|
541
|
+
}
|
|
542
|
+
getMutationCache() {
|
|
543
|
+
return this.#e;
|
|
544
|
+
}
|
|
545
|
+
getDefaultOptions() {
|
|
546
|
+
return this.#s;
|
|
547
|
+
}
|
|
548
|
+
setDefaultOptions(t) {
|
|
549
|
+
this.#s = t;
|
|
550
|
+
}
|
|
551
|
+
setQueryDefaults(t, e) {
|
|
552
|
+
this.#r.set(y(t), {
|
|
553
|
+
queryKey: t,
|
|
554
|
+
defaultOptions: e
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
getQueryDefaults(t) {
|
|
558
|
+
const e = [...this.#r.values()], s = {};
|
|
559
|
+
return e.forEach((i) => {
|
|
560
|
+
p(t, i.queryKey) && Object.assign(s, i.defaultOptions);
|
|
561
|
+
}), s;
|
|
562
|
+
}
|
|
563
|
+
setMutationDefaults(t, e) {
|
|
564
|
+
this.#i.set(y(t), {
|
|
565
|
+
mutationKey: t,
|
|
566
|
+
defaultOptions: e
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
getMutationDefaults(t) {
|
|
570
|
+
const e = [...this.#i.values()], s = {};
|
|
571
|
+
return e.forEach((i) => {
|
|
572
|
+
p(t, i.mutationKey) && Object.assign(s, i.defaultOptions);
|
|
573
|
+
}), s;
|
|
574
|
+
}
|
|
575
|
+
defaultQueryOptions(t) {
|
|
576
|
+
if (t._defaulted)
|
|
577
|
+
return t;
|
|
578
|
+
const e = {
|
|
579
|
+
...this.#s.queries,
|
|
580
|
+
...this.getQueryDefaults(t.queryKey),
|
|
581
|
+
...t,
|
|
582
|
+
_defaulted: !0
|
|
583
|
+
};
|
|
584
|
+
return e.queryHash || (e.queryHash = g(
|
|
585
|
+
e.queryKey,
|
|
586
|
+
e
|
|
587
|
+
)), e.refetchOnReconnect === void 0 && (e.refetchOnReconnect = e.networkMode !== "always"), e.throwOnError === void 0 && (e.throwOnError = !!e.suspense), !e.networkMode && e.persister && (e.networkMode = "offlineFirst"), e.queryFn === w && (e.enabled = !1), e;
|
|
588
|
+
}
|
|
589
|
+
defaultMutationOptions(t) {
|
|
590
|
+
return t?._defaulted ? t : {
|
|
591
|
+
...this.#s.mutations,
|
|
592
|
+
...t?.mutationKey && this.getMutationDefaults(t.mutationKey),
|
|
593
|
+
...t,
|
|
594
|
+
_defaulted: !0
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
clear() {
|
|
598
|
+
this.#t.clear(), this.#e.clear();
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
const q = new D({
|
|
602
|
+
defaultOptions: {
|
|
603
|
+
mutations: {
|
|
604
|
+
retry: !1
|
|
605
|
+
},
|
|
606
|
+
queries: {
|
|
607
|
+
refetchOnWindowFocus: !1,
|
|
608
|
+
gcTime: 1e3 * 60 * 60 * 24,
|
|
609
|
+
// 24 hours
|
|
610
|
+
staleTime: 60 * 1e3,
|
|
611
|
+
// 60 seconds
|
|
612
|
+
retry: !1
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
export {
|
|
617
|
+
q as M,
|
|
618
|
+
D as Q,
|
|
619
|
+
x as g
|
|
620
|
+
};
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useBasePropsStore as
|
|
3
|
-
const
|
|
4
|
-
const a =
|
|
5
|
-
return
|
|
6
|
-
(r,
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
1
|
+
import { useCallback as n } from "react";
|
|
2
|
+
import { useBasePropsStore as s } from "../stores/BasePropsStore.js";
|
|
3
|
+
const l = () => {
|
|
4
|
+
const a = s((r) => r.addBreadcrumbTranslation);
|
|
5
|
+
return n(
|
|
6
|
+
(r, o) => {
|
|
7
|
+
const e = typeof o == "boolean";
|
|
8
|
+
a?.(
|
|
9
|
+
{ key: r, value: e ? r : o },
|
|
10
|
+
//if boolean hide the translation in the breadcrumb
|
|
11
|
+
e
|
|
12
|
+
);
|
|
16
13
|
},
|
|
17
14
|
[a]
|
|
18
15
|
);
|
|
19
16
|
};
|
|
20
17
|
export {
|
|
21
|
-
|
|
18
|
+
l as useBreadcrumbTranslation
|
|
22
19
|
};
|
package/dist/hooks/useCustom.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { u as x } from "../useCustomMutation-
|
|
1
|
+
import { u as x } from "../useCustomMutation-C1aVbjpt.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../provider/SignalR/SignalRProvider.js";
|
|
5
4
|
import "../stores/BasePropsStore.js";
|
|
6
|
-
import "../
|
|
5
|
+
import "../stores/EnvironmentStore.js";
|
|
6
|
+
import "../utils/defaultSignalRClient.js";
|
|
7
|
+
import "../defaultQueryClient-Cfsorhtn.js";
|
|
7
8
|
import "../utils/fetches.js";
|
|
8
9
|
import "../types/Entities.js";
|
|
9
|
-
import "../api-
|
|
10
|
+
import "../api-CSxWxEZl.js";
|
|
10
11
|
import "../omit-DYPaIq41.js";
|
|
11
|
-
import "../stores/EnvironmentStore.js";
|
|
12
12
|
export {
|
|
13
13
|
x as useCustomMutation
|
|
14
14
|
};
|
package/dist/hooks/useEntity.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as p } from "../useQuery-
|
|
1
|
+
import { u as p } from "../useQuery-CUSHkb38.js";
|
|
2
2
|
import { useMemo as g, useCallback as Q } from "react";
|
|
3
3
|
import { useBasePropsStore as m } from "../stores/BasePropsStore.js";
|
|
4
4
|
import { AllEntitiesTypeResultMap as v } from "../types/Entities.js";
|
package/dist/hooks/useOffline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as y } from "../
|
|
1
|
+
import { u as y } from "../QueryClientProvider-DZI32rjZ.js";
|
|
2
2
|
import { useBasePropsStore as i } from "../stores/BasePropsStore.js";
|
|
3
3
|
import { fetchFromCustomApi as f, getFarmOrgEntities as m, getModuleDependedEntities as d } from "../utils/fetches.js";
|
|
4
4
|
import { getModuleQueryKey as o } from "../utils/helper.js";
|