@hortiview/modulebase 1.1.0 → 1.1.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-SzKJZczp.js +931 -0
- package/dist/{ModuleCore-U32BXXin.js → ModuleCore-DRMqZO8r.js} +1388 -1158
- package/dist/components/ModuleBase.js +1 -1
- package/dist/components/ModuleCore.js +1 -1
- package/dist/constants.js +2 -2
- package/dist/hooks/useBreadcrumbTranslation.js +13 -14
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +4 -15
- package/dist/hooks/useEntity.js +1 -1
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +1 -1
- package/dist/lib/hooks/useStores.d.ts +2 -33
- package/dist/lib/main.d.ts +2 -4
- package/dist/lib/module-router.d.ts +1 -1
- package/dist/lib/types/BaseProps.d.ts +3 -6
- package/dist/main.js +145 -149
- package/dist/module-router.js +132 -138
- package/dist/{useMutation-a0q2LJY6.js → useCustomMutation-9VUQ7NbQ.js} +40 -20
- package/dist/{useQuery-Cepqe-Ee.js → useQuery-DUDyh33-.js} +9 -10
- package/dist/utils/helper.js +1 -1
- package/package.json +1 -1
- package/dist/IsRestoringProvider-BfrdLTDw.js +0 -410
- package/dist/QueryClientProvider-Bak-4BVu.js +0 -531
- package/dist/hooks/useServiceBus.js +0 -25
- package/dist/lib/hooks/useServiceBus.d.ts +0 -19
- package/dist/lib/types/Deprecated.d.ts +0 -103
- package/dist/mutation-DztCHC7y.js +0 -237
- package/dist/types/Deprecated.js +0 -1
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import * as T from "react";
|
|
2
|
-
import { jsx as R } from "react/jsx-runtime";
|
|
3
|
-
var L = class {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
6
|
-
}
|
|
7
|
-
subscribe(e) {
|
|
8
|
-
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
9
|
-
this.listeners.delete(e), this.onUnsubscribe();
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
hasListeners() {
|
|
13
|
-
return this.listeners.size > 0;
|
|
14
|
-
}
|
|
15
|
-
onSubscribe() {
|
|
16
|
-
}
|
|
17
|
-
onUnsubscribe() {
|
|
18
|
-
}
|
|
19
|
-
}, D = class extends L {
|
|
20
|
-
#e;
|
|
21
|
-
#t;
|
|
22
|
-
#r;
|
|
23
|
-
constructor() {
|
|
24
|
-
super(), this.#r = (e) => {
|
|
25
|
-
if (typeof window < "u" && window.addEventListener) {
|
|
26
|
-
const t = () => e();
|
|
27
|
-
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
28
|
-
window.removeEventListener("visibilitychange", t);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
onSubscribe() {
|
|
34
|
-
this.#t || this.setEventListener(this.#r);
|
|
35
|
-
}
|
|
36
|
-
onUnsubscribe() {
|
|
37
|
-
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
38
|
-
}
|
|
39
|
-
setEventListener(e) {
|
|
40
|
-
this.#r = e, this.#t?.(), this.#t = e((t) => {
|
|
41
|
-
typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
setFocused(e) {
|
|
45
|
-
this.#e !== e && (this.#e = e, this.onFocus());
|
|
46
|
-
}
|
|
47
|
-
onFocus() {
|
|
48
|
-
const e = this.isFocused();
|
|
49
|
-
this.listeners.forEach((t) => {
|
|
50
|
-
t(e);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
isFocused() {
|
|
54
|
-
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
55
|
-
}
|
|
56
|
-
}, Q = new D(), K = {
|
|
57
|
-
// We need the wrapper function syntax below instead of direct references to
|
|
58
|
-
// global setTimeout etc.
|
|
59
|
-
//
|
|
60
|
-
// BAD: `setTimeout: setTimeout`
|
|
61
|
-
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
62
|
-
//
|
|
63
|
-
// If we use direct references here, then anything that wants to spy on or
|
|
64
|
-
// replace the global setTimeout (like tests) won't work since we'll already
|
|
65
|
-
// have a hard reference to the original implementation at the time when this
|
|
66
|
-
// file was imported.
|
|
67
|
-
setTimeout: (e, t) => setTimeout(e, t),
|
|
68
|
-
clearTimeout: (e) => clearTimeout(e),
|
|
69
|
-
setInterval: (e, t) => setInterval(e, t),
|
|
70
|
-
clearInterval: (e) => clearInterval(e)
|
|
71
|
-
}, A = class {
|
|
72
|
-
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
73
|
-
// type at app boot; and if we leave that type, then any new timer provider
|
|
74
|
-
// would need to support the default provider's concrete timer ID, which is
|
|
75
|
-
// infeasible across environments.
|
|
76
|
-
//
|
|
77
|
-
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
78
|
-
// this class is unsafe internally to allow for extension.
|
|
79
|
-
#e = K;
|
|
80
|
-
#t = !1;
|
|
81
|
-
setTimeoutProvider(e) {
|
|
82
|
-
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
|
|
83
|
-
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
84
|
-
{ previous: this.#e, provider: e }
|
|
85
|
-
), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
|
|
86
|
-
}
|
|
87
|
-
setTimeout(e, t) {
|
|
88
|
-
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
|
|
89
|
-
}
|
|
90
|
-
clearTimeout(e) {
|
|
91
|
-
this.#e.clearTimeout(e);
|
|
92
|
-
}
|
|
93
|
-
setInterval(e, t) {
|
|
94
|
-
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
|
|
95
|
-
}
|
|
96
|
-
clearInterval(e) {
|
|
97
|
-
this.#e.clearInterval(e);
|
|
98
|
-
}
|
|
99
|
-
}, g = new A();
|
|
100
|
-
function V(e) {
|
|
101
|
-
setTimeout(e, 0);
|
|
102
|
-
}
|
|
103
|
-
var z = typeof window > "u" || "Deno" in globalThis;
|
|
104
|
-
function F() {
|
|
105
|
-
}
|
|
106
|
-
function te(e, t) {
|
|
107
|
-
return typeof e == "function" ? e(t) : e;
|
|
108
|
-
}
|
|
109
|
-
function _(e) {
|
|
110
|
-
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
111
|
-
}
|
|
112
|
-
function re(e, t) {
|
|
113
|
-
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
114
|
-
}
|
|
115
|
-
function ne(e, t) {
|
|
116
|
-
return typeof e == "function" ? e(t) : e;
|
|
117
|
-
}
|
|
118
|
-
function se(e, t) {
|
|
119
|
-
return typeof e == "function" ? e(t) : e;
|
|
120
|
-
}
|
|
121
|
-
function ie(e, t) {
|
|
122
|
-
const {
|
|
123
|
-
type: r = "all",
|
|
124
|
-
exact: n,
|
|
125
|
-
fetchStatus: s,
|
|
126
|
-
predicate: o,
|
|
127
|
-
queryKey: c,
|
|
128
|
-
stale: i
|
|
129
|
-
} = e;
|
|
130
|
-
if (c) {
|
|
131
|
-
if (n) {
|
|
132
|
-
if (t.queryHash !== U(c, t.options))
|
|
133
|
-
return !1;
|
|
134
|
-
} else if (!j(t.queryKey, c))
|
|
135
|
-
return !1;
|
|
136
|
-
}
|
|
137
|
-
if (r !== "all") {
|
|
138
|
-
const u = t.isActive();
|
|
139
|
-
if (r === "active" && !u || r === "inactive" && u)
|
|
140
|
-
return !1;
|
|
141
|
-
}
|
|
142
|
-
return !(typeof i == "boolean" && t.isStale() !== i || s && s !== t.state.fetchStatus || o && !o(t));
|
|
143
|
-
}
|
|
144
|
-
function oe(e, t) {
|
|
145
|
-
const { exact: r, status: n, predicate: s, mutationKey: o } = e;
|
|
146
|
-
if (o) {
|
|
147
|
-
if (!t.options.mutationKey)
|
|
148
|
-
return !1;
|
|
149
|
-
if (r) {
|
|
150
|
-
if (S(t.options.mutationKey) !== S(o))
|
|
151
|
-
return !1;
|
|
152
|
-
} else if (!j(t.options.mutationKey, o))
|
|
153
|
-
return !1;
|
|
154
|
-
}
|
|
155
|
-
return !(n && t.state.status !== n || s && !s(t));
|
|
156
|
-
}
|
|
157
|
-
function U(e, t) {
|
|
158
|
-
return (t?.queryKeyHashFn || S)(e);
|
|
159
|
-
}
|
|
160
|
-
function S(e) {
|
|
161
|
-
return JSON.stringify(
|
|
162
|
-
e,
|
|
163
|
-
(t, r) => O(r) ? Object.keys(r).sort().reduce((n, s) => (n[s] = r[s], n), {}) : r
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
function j(e, t) {
|
|
167
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((r) => j(e[r], t[r])) : !1;
|
|
168
|
-
}
|
|
169
|
-
var G = Object.prototype.hasOwnProperty;
|
|
170
|
-
function E(e, t, r = 0) {
|
|
171
|
-
if (e === t)
|
|
172
|
-
return e;
|
|
173
|
-
if (r > 500) return t;
|
|
174
|
-
const n = P(e) && P(t);
|
|
175
|
-
if (!n && !(O(e) && O(t))) return t;
|
|
176
|
-
const o = (n ? e : Object.keys(e)).length, c = n ? t : Object.keys(t), i = c.length, u = n ? new Array(i) : {};
|
|
177
|
-
let v = 0;
|
|
178
|
-
for (let f = 0; f < i; f++) {
|
|
179
|
-
const h = n ? f : c[f], l = e[h], d = t[h];
|
|
180
|
-
if (l === d) {
|
|
181
|
-
u[h] = l, (n ? f < o : G.call(e, h)) && v++;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
if (l === null || d === null || typeof l != "object" || typeof d != "object") {
|
|
185
|
-
u[h] = d;
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
const m = E(l, d, r + 1);
|
|
189
|
-
u[h] = m, m === l && v++;
|
|
190
|
-
}
|
|
191
|
-
return o === i && v === o ? e : u;
|
|
192
|
-
}
|
|
193
|
-
function ue(e, t) {
|
|
194
|
-
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
195
|
-
return !1;
|
|
196
|
-
for (const r in e)
|
|
197
|
-
if (e[r] !== t[r])
|
|
198
|
-
return !1;
|
|
199
|
-
return !0;
|
|
200
|
-
}
|
|
201
|
-
function P(e) {
|
|
202
|
-
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
203
|
-
}
|
|
204
|
-
function O(e) {
|
|
205
|
-
if (!N(e))
|
|
206
|
-
return !1;
|
|
207
|
-
const t = e.constructor;
|
|
208
|
-
if (t === void 0)
|
|
209
|
-
return !0;
|
|
210
|
-
const r = t.prototype;
|
|
211
|
-
return !(!N(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
212
|
-
}
|
|
213
|
-
function N(e) {
|
|
214
|
-
return Object.prototype.toString.call(e) === "[object Object]";
|
|
215
|
-
}
|
|
216
|
-
function H(e) {
|
|
217
|
-
return new Promise((t) => {
|
|
218
|
-
g.setTimeout(t, e);
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
function ae(e, t, r) {
|
|
222
|
-
if (typeof r.structuralSharing == "function")
|
|
223
|
-
return r.structuralSharing(e, t);
|
|
224
|
-
if (r.structuralSharing !== !1) {
|
|
225
|
-
if (process.env.NODE_ENV !== "production")
|
|
226
|
-
try {
|
|
227
|
-
return E(e, t);
|
|
228
|
-
} catch (n) {
|
|
229
|
-
throw console.error(
|
|
230
|
-
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`
|
|
231
|
-
), n;
|
|
232
|
-
}
|
|
233
|
-
return E(e, t);
|
|
234
|
-
}
|
|
235
|
-
return t;
|
|
236
|
-
}
|
|
237
|
-
function ce(e, t, r = 0) {
|
|
238
|
-
const n = [...e, t];
|
|
239
|
-
return r && n.length > r ? n.slice(1) : n;
|
|
240
|
-
}
|
|
241
|
-
function le(e, t, r = 0) {
|
|
242
|
-
const n = [t, ...e];
|
|
243
|
-
return r && n.length > r ? n.slice(0, -1) : n;
|
|
244
|
-
}
|
|
245
|
-
var I = /* @__PURE__ */ Symbol();
|
|
246
|
-
function fe(e, t) {
|
|
247
|
-
return process.env.NODE_ENV !== "production" && e.queryFn === I && console.error(
|
|
248
|
-
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
249
|
-
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === I ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
250
|
-
}
|
|
251
|
-
function he(e, t) {
|
|
252
|
-
return typeof e == "function" ? e(...t) : !!e;
|
|
253
|
-
}
|
|
254
|
-
function de(e, t, r) {
|
|
255
|
-
let n = !1, s;
|
|
256
|
-
return Object.defineProperty(e, "signal", {
|
|
257
|
-
enumerable: !0,
|
|
258
|
-
get: () => (s ??= t(), n || (n = !0, s.aborted ? r() : s.addEventListener("abort", r, { once: !0 })), s)
|
|
259
|
-
}), e;
|
|
260
|
-
}
|
|
261
|
-
var M = /* @__PURE__ */ (() => {
|
|
262
|
-
let e = () => z;
|
|
263
|
-
return {
|
|
264
|
-
/**
|
|
265
|
-
* Returns whether the current runtime should be treated as a server environment.
|
|
266
|
-
*/
|
|
267
|
-
isServer() {
|
|
268
|
-
return e();
|
|
269
|
-
},
|
|
270
|
-
/**
|
|
271
|
-
* Overrides the server check globally.
|
|
272
|
-
*/
|
|
273
|
-
setIsServer(t) {
|
|
274
|
-
e = t;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
})();
|
|
278
|
-
function B() {
|
|
279
|
-
let e, t;
|
|
280
|
-
const r = new Promise((s, o) => {
|
|
281
|
-
e = s, t = o;
|
|
282
|
-
});
|
|
283
|
-
r.status = "pending", r.catch(() => {
|
|
284
|
-
});
|
|
285
|
-
function n(s) {
|
|
286
|
-
Object.assign(r, s), delete r.resolve, delete r.reject;
|
|
287
|
-
}
|
|
288
|
-
return r.resolve = (s) => {
|
|
289
|
-
n({
|
|
290
|
-
status: "fulfilled",
|
|
291
|
-
value: s
|
|
292
|
-
}), e(s);
|
|
293
|
-
}, r.reject = (s) => {
|
|
294
|
-
n({
|
|
295
|
-
status: "rejected",
|
|
296
|
-
reason: s
|
|
297
|
-
}), t(s);
|
|
298
|
-
}, r;
|
|
299
|
-
}
|
|
300
|
-
function ye(e) {
|
|
301
|
-
let t;
|
|
302
|
-
if (e.then((r) => (t = r, r), F)?.catch(F), t !== void 0)
|
|
303
|
-
return { data: t };
|
|
304
|
-
}
|
|
305
|
-
var $ = V;
|
|
306
|
-
function J() {
|
|
307
|
-
let e = [], t = 0, r = (i) => {
|
|
308
|
-
i();
|
|
309
|
-
}, n = (i) => {
|
|
310
|
-
i();
|
|
311
|
-
}, s = $;
|
|
312
|
-
const o = (i) => {
|
|
313
|
-
t ? e.push(i) : s(() => {
|
|
314
|
-
r(i);
|
|
315
|
-
});
|
|
316
|
-
}, c = () => {
|
|
317
|
-
const i = e;
|
|
318
|
-
e = [], i.length && s(() => {
|
|
319
|
-
n(() => {
|
|
320
|
-
i.forEach((u) => {
|
|
321
|
-
r(u);
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
};
|
|
326
|
-
return {
|
|
327
|
-
batch: (i) => {
|
|
328
|
-
let u;
|
|
329
|
-
t++;
|
|
330
|
-
try {
|
|
331
|
-
u = i();
|
|
332
|
-
} finally {
|
|
333
|
-
t--, t || c();
|
|
334
|
-
}
|
|
335
|
-
return u;
|
|
336
|
-
},
|
|
337
|
-
/**
|
|
338
|
-
* All calls to the wrapped function will be batched.
|
|
339
|
-
*/
|
|
340
|
-
batchCalls: (i) => (...u) => {
|
|
341
|
-
o(() => {
|
|
342
|
-
i(...u);
|
|
343
|
-
});
|
|
344
|
-
},
|
|
345
|
-
schedule: o,
|
|
346
|
-
/**
|
|
347
|
-
* Use this method to set a custom notify function.
|
|
348
|
-
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
349
|
-
*/
|
|
350
|
-
setNotifyFunction: (i) => {
|
|
351
|
-
r = i;
|
|
352
|
-
},
|
|
353
|
-
/**
|
|
354
|
-
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
355
|
-
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
356
|
-
*/
|
|
357
|
-
setBatchNotifyFunction: (i) => {
|
|
358
|
-
n = i;
|
|
359
|
-
},
|
|
360
|
-
setScheduler: (i) => {
|
|
361
|
-
s = i;
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
var ve = J(), Z = class extends L {
|
|
366
|
-
#e = !0;
|
|
367
|
-
#t;
|
|
368
|
-
#r;
|
|
369
|
-
constructor() {
|
|
370
|
-
super(), this.#r = (e) => {
|
|
371
|
-
if (typeof window < "u" && window.addEventListener) {
|
|
372
|
-
const t = () => e(!0), r = () => e(!1);
|
|
373
|
-
return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
|
|
374
|
-
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
onSubscribe() {
|
|
380
|
-
this.#t || this.setEventListener(this.#r);
|
|
381
|
-
}
|
|
382
|
-
onUnsubscribe() {
|
|
383
|
-
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
384
|
-
}
|
|
385
|
-
setEventListener(e) {
|
|
386
|
-
this.#r = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
|
|
387
|
-
}
|
|
388
|
-
setOnline(e) {
|
|
389
|
-
this.#e !== e && (this.#e = e, this.listeners.forEach((r) => {
|
|
390
|
-
r(e);
|
|
391
|
-
}));
|
|
392
|
-
}
|
|
393
|
-
isOnline() {
|
|
394
|
-
return this.#e;
|
|
395
|
-
}
|
|
396
|
-
}, C = new Z();
|
|
397
|
-
function W(e) {
|
|
398
|
-
return Math.min(1e3 * 2 ** e, 3e4);
|
|
399
|
-
}
|
|
400
|
-
function X(e) {
|
|
401
|
-
return (e ?? "online") === "online" ? C.isOnline() : !0;
|
|
402
|
-
}
|
|
403
|
-
var Y = class extends Error {
|
|
404
|
-
constructor(e) {
|
|
405
|
-
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
function me(e) {
|
|
409
|
-
let t = !1, r = 0, n;
|
|
410
|
-
const s = B(), o = () => s.status !== "pending", c = (a) => {
|
|
411
|
-
if (!o()) {
|
|
412
|
-
const p = new Y(a);
|
|
413
|
-
l(p), e.onCancel?.(p);
|
|
414
|
-
}
|
|
415
|
-
}, i = () => {
|
|
416
|
-
t = !0;
|
|
417
|
-
}, u = () => {
|
|
418
|
-
t = !1;
|
|
419
|
-
}, v = () => Q.isFocused() && (e.networkMode === "always" || C.isOnline()) && e.canRun(), f = () => X(e.networkMode) && e.canRun(), h = (a) => {
|
|
420
|
-
o() || (n?.(), s.resolve(a));
|
|
421
|
-
}, l = (a) => {
|
|
422
|
-
o() || (n?.(), s.reject(a));
|
|
423
|
-
}, d = () => new Promise((a) => {
|
|
424
|
-
n = (p) => {
|
|
425
|
-
(o() || v()) && a(p);
|
|
426
|
-
}, e.onPause?.();
|
|
427
|
-
}).then(() => {
|
|
428
|
-
n = void 0, o() || e.onContinue?.();
|
|
429
|
-
}), m = () => {
|
|
430
|
-
if (o())
|
|
431
|
-
return;
|
|
432
|
-
let a;
|
|
433
|
-
const p = r === 0 ? e.initialPromise : void 0;
|
|
434
|
-
try {
|
|
435
|
-
a = p ?? e.fn();
|
|
436
|
-
} catch (y) {
|
|
437
|
-
a = Promise.reject(y);
|
|
438
|
-
}
|
|
439
|
-
Promise.resolve(a).then(h).catch((y) => {
|
|
440
|
-
if (o())
|
|
441
|
-
return;
|
|
442
|
-
const b = e.retry ?? (M.isServer() ? 0 : 3), w = e.retryDelay ?? W, q = typeof w == "function" ? w(r, y) : w, x = b === !0 || typeof b == "number" && r < b || typeof b == "function" && b(r, y);
|
|
443
|
-
if (t || !x) {
|
|
444
|
-
l(y);
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
r++, e.onFail?.(r, y), H(q).then(() => v() ? void 0 : d()).then(() => {
|
|
448
|
-
t ? l(y) : m();
|
|
449
|
-
});
|
|
450
|
-
});
|
|
451
|
-
};
|
|
452
|
-
return {
|
|
453
|
-
promise: s,
|
|
454
|
-
status: () => s.status,
|
|
455
|
-
cancel: c,
|
|
456
|
-
continue: () => (n?.(), s),
|
|
457
|
-
cancelRetry: i,
|
|
458
|
-
continueRetry: u,
|
|
459
|
-
canStart: f,
|
|
460
|
-
start: () => (f() ? m() : d().then(m), s)
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
var pe = class {
|
|
464
|
-
#e;
|
|
465
|
-
destroy() {
|
|
466
|
-
this.clearGcTimeout();
|
|
467
|
-
}
|
|
468
|
-
scheduleGc() {
|
|
469
|
-
this.clearGcTimeout(), _(this.gcTime) && (this.#e = g.setTimeout(() => {
|
|
470
|
-
this.optionalRemove();
|
|
471
|
-
}, this.gcTime));
|
|
472
|
-
}
|
|
473
|
-
updateGcTime(e) {
|
|
474
|
-
this.gcTime = Math.max(
|
|
475
|
-
this.gcTime || 0,
|
|
476
|
-
e ?? (M.isServer() ? 1 / 0 : 300 * 1e3)
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
clearGcTimeout() {
|
|
480
|
-
this.#e !== void 0 && (g.clearTimeout(this.#e), this.#e = void 0);
|
|
481
|
-
}
|
|
482
|
-
}, k = T.createContext(
|
|
483
|
-
void 0
|
|
484
|
-
), be = (e) => {
|
|
485
|
-
const t = T.useContext(k);
|
|
486
|
-
if (e)
|
|
487
|
-
return e;
|
|
488
|
-
if (!t)
|
|
489
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
490
|
-
return t;
|
|
491
|
-
}, we = ({
|
|
492
|
-
client: e,
|
|
493
|
-
children: t
|
|
494
|
-
}) => (T.useEffect(() => (e.mount(), () => {
|
|
495
|
-
e.unmount();
|
|
496
|
-
}), [e]), /* @__PURE__ */ R(k.Provider, { value: e, children: t }));
|
|
497
|
-
export {
|
|
498
|
-
C as A,
|
|
499
|
-
te as B,
|
|
500
|
-
Y as C,
|
|
501
|
-
j as D,
|
|
502
|
-
we as Q,
|
|
503
|
-
pe as R,
|
|
504
|
-
L as S,
|
|
505
|
-
F as a,
|
|
506
|
-
he as b,
|
|
507
|
-
me as c,
|
|
508
|
-
le as d,
|
|
509
|
-
fe as e,
|
|
510
|
-
ce as f,
|
|
511
|
-
de as g,
|
|
512
|
-
S as h,
|
|
513
|
-
se as i,
|
|
514
|
-
I as j,
|
|
515
|
-
ne as k,
|
|
516
|
-
X as l,
|
|
517
|
-
M as m,
|
|
518
|
-
ve as n,
|
|
519
|
-
_ as o,
|
|
520
|
-
B as p,
|
|
521
|
-
g as q,
|
|
522
|
-
ae as r,
|
|
523
|
-
ue as s,
|
|
524
|
-
re as t,
|
|
525
|
-
be as u,
|
|
526
|
-
Q as v,
|
|
527
|
-
ye as w,
|
|
528
|
-
oe as x,
|
|
529
|
-
U as y,
|
|
530
|
-
ie as z
|
|
531
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { u as n } from "../useMutation-a0q2LJY6.js";
|
|
2
|
-
import { useBasePropsStore as r } from "../stores/BasePropsStore.js";
|
|
3
|
-
const a = ({
|
|
4
|
-
authenticationKey: i,
|
|
5
|
-
queue: s,
|
|
6
|
-
topic: o
|
|
7
|
-
}) => {
|
|
8
|
-
const e = r((t) => t.serviceBusNotification), c = r((t) => t.throwError);
|
|
9
|
-
if (!e)
|
|
10
|
-
throw c?.("serviceBusNotification is not defined", 400);
|
|
11
|
-
return n({
|
|
12
|
-
mutationFn: (t) => e(t, i, s, o)
|
|
13
|
-
});
|
|
14
|
-
}, N = () => {
|
|
15
|
-
const i = r((o) => o.riseNotification), s = r((o) => o.throwError);
|
|
16
|
-
if (!i)
|
|
17
|
-
throw s?.("riseNotification is not defined", 400);
|
|
18
|
-
return n({
|
|
19
|
-
mutationFn: (o) => i(o)
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
N as useNotification,
|
|
24
|
-
a as useServiceBus
|
|
25
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import { BaseResponse } from '../types/Requests';
|
|
3
|
-
import { AlertServiceBusMessage } from '../types/ServiceBus';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param authenticationKey SASToken, that will be provided by the vendor portal of HortiView
|
|
7
|
-
* @param queue url of the service bus queue
|
|
8
|
-
* @param topic topic of the service bus, where the message will be sent to
|
|
9
|
-
* @deprecated use useNotification instead
|
|
10
|
-
*/
|
|
11
|
-
export declare const useServiceBus: ({ authenticationKey, queue, topic, }: {
|
|
12
|
-
authenticationKey: string;
|
|
13
|
-
queue: string;
|
|
14
|
-
topic: string;
|
|
15
|
-
}) => UseMutationResult<BaseResponse<unknown>, Error, AlertServiceBusMessage, unknown>;
|
|
16
|
-
/**
|
|
17
|
-
* create a notification in the service bus
|
|
18
|
-
*/
|
|
19
|
-
export declare const useNotification: () => UseMutationResult<BaseResponse<unknown>, Error, AlertServiceBusMessage, unknown>;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { AlertServiceBusMessage } from './ServiceBus';
|
|
2
|
-
import { SystemMessage } from './SystemMessage';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated should not be used anymore, will be removed in the near future (max 2 months)
|
|
5
|
-
*/
|
|
6
|
-
export type DeprecatedBaseProps = {
|
|
7
|
-
/**
|
|
8
|
-
* AlertRules, only for AlertRuleForcer to test
|
|
9
|
-
*/
|
|
10
|
-
allAlertRules?: {
|
|
11
|
-
[moduleId: string]: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated use module-api and `modulePermissionToken` instead
|
|
15
|
-
*/
|
|
16
|
-
token?: string;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Not needed anymore
|
|
19
|
-
*/
|
|
20
|
-
config?: RemoteComponentConfig;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated
|
|
23
|
-
*/
|
|
24
|
-
addNotification?: (notification: OldAlertDto) => void;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use `riseNotification` instead
|
|
27
|
-
*/
|
|
28
|
-
serviceBusNotification?: (message: AlertServiceBusMessage, //currently only used for alerts
|
|
29
|
-
apiKey: string, queue: string, topic: string) => Promise<unknown>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use `showMessage` instead
|
|
32
|
-
*/
|
|
33
|
-
addMessage?: (message: SystemMessage) => void;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use `addBreadcrumbTranslation` instead
|
|
36
|
-
*/
|
|
37
|
-
addTranslation?: (translation: {
|
|
38
|
-
key: string;
|
|
39
|
-
value: string;
|
|
40
|
-
}, hide?: boolean) => void;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use `navigateInHortiview` instead
|
|
43
|
-
*/
|
|
44
|
-
navigateTo?: (path: string) => void;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated modules need to call their own rules directly
|
|
47
|
-
*/
|
|
48
|
-
alertRules?: string;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated should not be used anymore
|
|
52
|
-
*/
|
|
53
|
-
export type RemoteComponentConfig = {
|
|
54
|
-
isBaseModule?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* The relative path to the shared module, e.g. ./MyModule
|
|
57
|
-
*/
|
|
58
|
-
module: string;
|
|
59
|
-
/**
|
|
60
|
-
* The path to the remote container entry. The url were the app is running or the path to location of the remote js file, e.g. http://localhost:3000/remoteEntry.js
|
|
61
|
-
*/
|
|
62
|
-
path: string;
|
|
63
|
-
/**
|
|
64
|
-
* name of the remote app, like sprayingbook
|
|
65
|
-
*/
|
|
66
|
-
scope: string;
|
|
67
|
-
/**
|
|
68
|
-
* name of the module
|
|
69
|
-
*/
|
|
70
|
-
name?: string;
|
|
71
|
-
/**
|
|
72
|
-
* name of the icon
|
|
73
|
-
*/
|
|
74
|
-
icon?: string;
|
|
75
|
-
/**
|
|
76
|
-
* if the module has an error
|
|
77
|
-
*/
|
|
78
|
-
error?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* the short name of the module
|
|
81
|
-
*/
|
|
82
|
-
shortName: string;
|
|
83
|
-
/**
|
|
84
|
-
* the id of the module - used as alias
|
|
85
|
-
*/
|
|
86
|
-
id: string;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated should not be used anymore
|
|
90
|
-
*/
|
|
91
|
-
export type OldAlertDto = {
|
|
92
|
-
id: string;
|
|
93
|
-
farmOrganizationId: string;
|
|
94
|
-
moduleName: string;
|
|
95
|
-
criteriaIcon?: string | null | JSX.Element;
|
|
96
|
-
criteriaName: string;
|
|
97
|
-
description: string | JSX.Element;
|
|
98
|
-
timeStamp: Date;
|
|
99
|
-
isRead: boolean;
|
|
100
|
-
isSnoozed: boolean;
|
|
101
|
-
title: string;
|
|
102
|
-
link?: string;
|
|
103
|
-
};
|