@hortiview/modulebase 0.0.12119 → 0.0.12550
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/QueryClientProvider-Q_mWQTzQ.js +435 -0
- package/dist/{_baseGet-Bh5zJ_C8.js → _baseGet-B7FwMMGI.js} +9 -9
- package/dist/api-D9Lmqe6S.js +458 -0
- package/dist/components/ModuleBase.js +127 -312
- package/dist/hooks/useCustom.d.ts +2 -1
- package/dist/hooks/useCustom.js +15 -13
- package/dist/hooks/useCustomMutation.d.ts +8 -0
- package/dist/hooks/useCustomMutation.js +21 -0
- package/dist/hooks/useEntity.d.ts +3 -9
- package/dist/hooks/useEntity.js +36 -30
- package/dist/hooks/useOption.d.ts +1 -1
- package/dist/hooks/useOption.js +20 -18
- package/dist/hooks/useServiceBus.d.ts +15 -0
- package/dist/hooks/useServiceBus.js +17 -0
- package/dist/hooks/useStores.d.ts +2 -1
- package/dist/hooks/useStores.js +11 -841
- package/dist/main.d.ts +3 -0
- package/dist/main.js +121 -115
- package/dist/mutation-X73nm7Df.js +192 -0
- package/dist/omit-B7MWDtHq.js +835 -0
- package/dist/query-CRIVoEP7.js +277 -0
- package/dist/types/BaseProps.d.ts +3 -0
- package/dist/types/ModuleApi.d.ts +77 -4
- package/dist/types/Requests.d.ts +2 -1
- package/dist/types/ServiceBus.d.ts +17 -0
- package/dist/types/ServiceBus.js +1 -0
- package/dist/useMutation-3rykrmeD.js +97 -0
- package/dist/{useQuery-znAyMQW1.js → useQuery-CwwWze9O.js} +96 -98
- package/dist/utils/api.d.ts +20 -0
- package/dist/utils/api.js +9 -0
- package/dist/utils/baseFetches.d.ts +19 -0
- package/dist/utils/baseFetches.js +19 -0
- package/dist/utils/fetches.d.ts +31 -22
- package/dist/utils/fetches.js +19 -14
- package/dist/utils-DxRR_XLb.js +9 -0
- package/package.json +2 -2
- package/dist/QueryClientProvider-DQv4Y3Qu.js +0 -707
- package/dist/fetches-DUCQo_6B.js +0 -477
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
-
import { S as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { S as R, g as k, n as u, m as q, j as A, a as h, e as H, k as K, l as B, o as j, p as D, q as S, v as L, h as I, w as F, s as U, Q as V } from "../QueryClientProvider-Q_mWQTzQ.js";
|
|
3
|
+
import { Q as W } from "../query-CRIVoEP7.js";
|
|
4
|
+
import { M as X } from "../mutation-X73nm7Df.js";
|
|
5
|
+
import { useState as $, useEffect as b } from "react";
|
|
6
|
+
import { Y as z, h as Y, O as G, aU as J } from "../chunk-IR6S3I6Y-BmDdD3SP.js";
|
|
5
7
|
import { REQUIRED_PROPS as Z } from "../constants.js";
|
|
6
|
-
import { SignalRProvider as
|
|
7
|
-
import { useBasePropsStore as
|
|
8
|
-
import { useEnvironmentStore as
|
|
9
|
-
var
|
|
8
|
+
import { SignalRProvider as x } from "../provider/SignalR/SignalRProvider.js";
|
|
9
|
+
import { useBasePropsStore as M } from "../stores/BasePropsStore.js";
|
|
10
|
+
import { useEnvironmentStore as T } from "../stores/EnvironmentStore.js";
|
|
11
|
+
var ee = class extends R {
|
|
10
12
|
constructor(e = {}) {
|
|
11
13
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
12
14
|
}
|
|
13
15
|
#e;
|
|
14
16
|
build(e, t, s) {
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
return
|
|
17
|
+
const r = t.queryKey, n = t.queryHash ?? k(r, t);
|
|
18
|
+
let i = this.get(n);
|
|
19
|
+
return i || (i = new W({
|
|
18
20
|
client: e,
|
|
19
|
-
queryKey:
|
|
21
|
+
queryKey: r,
|
|
20
22
|
queryHash: n,
|
|
21
23
|
options: e.defaultQueryOptions(t),
|
|
22
24
|
state: s,
|
|
23
|
-
defaultOptions: e.getQueryDefaults(
|
|
24
|
-
}), this.add(
|
|
25
|
+
defaultOptions: e.getQueryDefaults(r)
|
|
26
|
+
}), this.add(i)), i;
|
|
25
27
|
}
|
|
26
28
|
add(e) {
|
|
27
29
|
this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
|
|
@@ -49,12 +51,12 @@ var te = class extends N {
|
|
|
49
51
|
find(e) {
|
|
50
52
|
const t = { exact: !0, ...e };
|
|
51
53
|
return this.getAll().find(
|
|
52
|
-
(s) =>
|
|
54
|
+
(s) => q(t, s)
|
|
53
55
|
);
|
|
54
56
|
}
|
|
55
57
|
findAll(e = {}) {
|
|
56
58
|
const t = this.getAll();
|
|
57
|
-
return Object.keys(e).length > 0 ? t.filter((s) =>
|
|
59
|
+
return Object.keys(e).length > 0 ? t.filter((s) => q(e, s)) : t;
|
|
58
60
|
}
|
|
59
61
|
notify(e) {
|
|
60
62
|
u.batch(() => {
|
|
@@ -77,194 +79,7 @@ var te = class extends N {
|
|
|
77
79
|
});
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
|
-
},
|
|
81
|
-
#e;
|
|
82
|
-
#t;
|
|
83
|
-
#s;
|
|
84
|
-
constructor(e) {
|
|
85
|
-
super(), this.mutationId = e.mutationId, this.#t = e.mutationCache, this.#e = [], this.state = e.state || ie(), this.setOptions(e.options), this.scheduleGc();
|
|
86
|
-
}
|
|
87
|
-
setOptions(e) {
|
|
88
|
-
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
89
|
-
}
|
|
90
|
-
get meta() {
|
|
91
|
-
return this.options.meta;
|
|
92
|
-
}
|
|
93
|
-
addObserver(e) {
|
|
94
|
-
this.#e.includes(e) || (this.#e.push(e), this.clearGcTimeout(), this.#t.notify({
|
|
95
|
-
type: "observerAdded",
|
|
96
|
-
mutation: this,
|
|
97
|
-
observer: e
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
removeObserver(e) {
|
|
101
|
-
this.#e = this.#e.filter((t) => t !== e), this.scheduleGc(), this.#t.notify({
|
|
102
|
-
type: "observerRemoved",
|
|
103
|
-
mutation: this,
|
|
104
|
-
observer: e
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
optionalRemove() {
|
|
108
|
-
this.#e.length || (this.state.status === "pending" ? this.scheduleGc() : this.#t.remove(this));
|
|
109
|
-
}
|
|
110
|
-
continue() {
|
|
111
|
-
return this.#s?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
112
|
-
this.execute(this.state.variables);
|
|
113
|
-
}
|
|
114
|
-
async execute(e) {
|
|
115
|
-
this.#s = K({
|
|
116
|
-
fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
|
|
117
|
-
onFail: (i, n) => {
|
|
118
|
-
this.#i({ type: "failed", failureCount: i, error: n });
|
|
119
|
-
},
|
|
120
|
-
onPause: () => {
|
|
121
|
-
this.#i({ type: "pause" });
|
|
122
|
-
},
|
|
123
|
-
onContinue: () => {
|
|
124
|
-
this.#i({ type: "continue" });
|
|
125
|
-
},
|
|
126
|
-
retry: this.options.retry ?? 0,
|
|
127
|
-
retryDelay: this.options.retryDelay,
|
|
128
|
-
networkMode: this.options.networkMode,
|
|
129
|
-
canRun: () => this.#t.canRun(this)
|
|
130
|
-
});
|
|
131
|
-
const t = this.state.status === "pending", s = !this.#s.canStart();
|
|
132
|
-
try {
|
|
133
|
-
if (!t) {
|
|
134
|
-
this.#i({ type: "pending", variables: e, isPaused: s }), await this.#t.config.onMutate?.(
|
|
135
|
-
e,
|
|
136
|
-
this
|
|
137
|
-
);
|
|
138
|
-
const n = await this.options.onMutate?.(e);
|
|
139
|
-
n !== this.state.context && this.#i({
|
|
140
|
-
type: "pending",
|
|
141
|
-
context: n,
|
|
142
|
-
variables: e,
|
|
143
|
-
isPaused: s
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const i = await this.#s.start();
|
|
147
|
-
return await this.#t.config.onSuccess?.(
|
|
148
|
-
i,
|
|
149
|
-
e,
|
|
150
|
-
this.state.context,
|
|
151
|
-
this
|
|
152
|
-
), await this.options.onSuccess?.(i, e, this.state.context), await this.#t.config.onSettled?.(
|
|
153
|
-
i,
|
|
154
|
-
null,
|
|
155
|
-
this.state.variables,
|
|
156
|
-
this.state.context,
|
|
157
|
-
this
|
|
158
|
-
), await this.options.onSettled?.(i, null, e, this.state.context), this.#i({ type: "success", data: i }), i;
|
|
159
|
-
} catch (i) {
|
|
160
|
-
try {
|
|
161
|
-
throw await this.#t.config.onError?.(
|
|
162
|
-
i,
|
|
163
|
-
e,
|
|
164
|
-
this.state.context,
|
|
165
|
-
this
|
|
166
|
-
), await this.options.onError?.(
|
|
167
|
-
i,
|
|
168
|
-
e,
|
|
169
|
-
this.state.context
|
|
170
|
-
), await this.#t.config.onSettled?.(
|
|
171
|
-
void 0,
|
|
172
|
-
i,
|
|
173
|
-
this.state.variables,
|
|
174
|
-
this.state.context,
|
|
175
|
-
this
|
|
176
|
-
), await this.options.onSettled?.(
|
|
177
|
-
void 0,
|
|
178
|
-
i,
|
|
179
|
-
e,
|
|
180
|
-
this.state.context
|
|
181
|
-
), i;
|
|
182
|
-
} finally {
|
|
183
|
-
this.#i({ type: "error", error: i });
|
|
184
|
-
}
|
|
185
|
-
} finally {
|
|
186
|
-
this.#t.runNext(this);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
#i(e) {
|
|
190
|
-
const t = (s) => {
|
|
191
|
-
switch (e.type) {
|
|
192
|
-
case "failed":
|
|
193
|
-
return {
|
|
194
|
-
...s,
|
|
195
|
-
failureCount: e.failureCount,
|
|
196
|
-
failureReason: e.error
|
|
197
|
-
};
|
|
198
|
-
case "pause":
|
|
199
|
-
return {
|
|
200
|
-
...s,
|
|
201
|
-
isPaused: !0
|
|
202
|
-
};
|
|
203
|
-
case "continue":
|
|
204
|
-
return {
|
|
205
|
-
...s,
|
|
206
|
-
isPaused: !1
|
|
207
|
-
};
|
|
208
|
-
case "pending":
|
|
209
|
-
return {
|
|
210
|
-
...s,
|
|
211
|
-
context: e.context,
|
|
212
|
-
data: void 0,
|
|
213
|
-
failureCount: 0,
|
|
214
|
-
failureReason: null,
|
|
215
|
-
error: null,
|
|
216
|
-
isPaused: e.isPaused,
|
|
217
|
-
status: "pending",
|
|
218
|
-
variables: e.variables,
|
|
219
|
-
submittedAt: Date.now()
|
|
220
|
-
};
|
|
221
|
-
case "success":
|
|
222
|
-
return {
|
|
223
|
-
...s,
|
|
224
|
-
data: e.data,
|
|
225
|
-
failureCount: 0,
|
|
226
|
-
failureReason: null,
|
|
227
|
-
error: null,
|
|
228
|
-
status: "success",
|
|
229
|
-
isPaused: !1
|
|
230
|
-
};
|
|
231
|
-
case "error":
|
|
232
|
-
return {
|
|
233
|
-
...s,
|
|
234
|
-
data: void 0,
|
|
235
|
-
error: e.error,
|
|
236
|
-
failureCount: s.failureCount + 1,
|
|
237
|
-
failureReason: e.error,
|
|
238
|
-
isPaused: !1,
|
|
239
|
-
status: "error"
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
this.state = t(this.state), u.batch(() => {
|
|
244
|
-
this.#e.forEach((s) => {
|
|
245
|
-
s.onMutationUpdate(e);
|
|
246
|
-
}), this.#t.notify({
|
|
247
|
-
mutation: this,
|
|
248
|
-
type: "updated",
|
|
249
|
-
action: e
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
function ie() {
|
|
255
|
-
return {
|
|
256
|
-
context: void 0,
|
|
257
|
-
data: void 0,
|
|
258
|
-
error: null,
|
|
259
|
-
failureCount: 0,
|
|
260
|
-
failureReason: null,
|
|
261
|
-
isPaused: !1,
|
|
262
|
-
status: "idle",
|
|
263
|
-
variables: void 0,
|
|
264
|
-
submittedAt: 0
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
var ne = class extends N {
|
|
82
|
+
}, te = class extends R {
|
|
268
83
|
constructor(e = {}) {
|
|
269
84
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
270
85
|
}
|
|
@@ -272,13 +87,13 @@ var ne = class extends N {
|
|
|
272
87
|
#t;
|
|
273
88
|
#s;
|
|
274
89
|
build(e, t, s) {
|
|
275
|
-
const
|
|
90
|
+
const r = new X({
|
|
276
91
|
mutationCache: this,
|
|
277
92
|
mutationId: ++this.#s,
|
|
278
93
|
options: e.defaultMutationOptions(t),
|
|
279
94
|
state: s
|
|
280
95
|
});
|
|
281
|
-
return this.add(
|
|
96
|
+
return this.add(r), r;
|
|
282
97
|
}
|
|
283
98
|
add(e) {
|
|
284
99
|
this.#e.add(e);
|
|
@@ -296,8 +111,8 @@ var ne = class extends N {
|
|
|
296
111
|
const s = this.#t.get(t);
|
|
297
112
|
if (s)
|
|
298
113
|
if (s.length > 1) {
|
|
299
|
-
const
|
|
300
|
-
|
|
114
|
+
const r = s.indexOf(e);
|
|
115
|
+
r !== -1 && s.splice(r, 1);
|
|
301
116
|
} else s[0] === e && this.#t.delete(t);
|
|
302
117
|
}
|
|
303
118
|
}
|
|
@@ -306,16 +121,16 @@ var ne = class extends N {
|
|
|
306
121
|
canRun(e) {
|
|
307
122
|
const t = O(e);
|
|
308
123
|
if (typeof t == "string") {
|
|
309
|
-
const
|
|
124
|
+
const r = this.#t.get(t)?.find(
|
|
310
125
|
(n) => n.state.status === "pending"
|
|
311
126
|
);
|
|
312
|
-
return !
|
|
127
|
+
return !r || r === e;
|
|
313
128
|
} else
|
|
314
129
|
return !0;
|
|
315
130
|
}
|
|
316
131
|
runNext(e) {
|
|
317
132
|
const t = O(e);
|
|
318
|
-
return typeof t == "string" ? this.#t.get(t)?.find((
|
|
133
|
+
return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
319
134
|
}
|
|
320
135
|
clear() {
|
|
321
136
|
u.batch(() => {
|
|
@@ -355,22 +170,22 @@ var ne = class extends N {
|
|
|
355
170
|
function O(e) {
|
|
356
171
|
return e.options.scope?.id;
|
|
357
172
|
}
|
|
358
|
-
function
|
|
173
|
+
function C(e) {
|
|
359
174
|
return {
|
|
360
175
|
onFetch: (t, s) => {
|
|
361
|
-
const
|
|
362
|
-
let c = { pages: [], pageParams: [] },
|
|
176
|
+
const r = t.options, n = t.fetchOptions?.meta?.fetchMore?.direction, i = t.state.data?.pages || [], f = t.state.data?.pageParams || [];
|
|
177
|
+
let c = { pages: [], pageParams: [] }, d = 0;
|
|
363
178
|
const P = async () => {
|
|
364
|
-
let
|
|
365
|
-
const
|
|
179
|
+
let g = !1;
|
|
180
|
+
const Q = (o) => {
|
|
366
181
|
Object.defineProperty(o, "signal", {
|
|
367
182
|
enumerable: !0,
|
|
368
|
-
get: () => (t.signal.aborted ?
|
|
369
|
-
|
|
183
|
+
get: () => (t.signal.aborted ? g = !0 : t.signal.addEventListener("abort", () => {
|
|
184
|
+
g = !0;
|
|
370
185
|
}), t.signal)
|
|
371
186
|
});
|
|
372
|
-
}, a =
|
|
373
|
-
if (
|
|
187
|
+
}, a = H(t.options, t.fetchOptions), m = async (o, l, p) => {
|
|
188
|
+
if (g)
|
|
374
189
|
return Promise.reject();
|
|
375
190
|
if (l == null && o.pages.length)
|
|
376
191
|
return Promise.resolve(o);
|
|
@@ -378,32 +193,32 @@ function I(e) {
|
|
|
378
193
|
client: t.client,
|
|
379
194
|
queryKey: t.queryKey,
|
|
380
195
|
pageParam: l,
|
|
381
|
-
direction:
|
|
196
|
+
direction: p ? "backward" : "forward",
|
|
382
197
|
meta: t.options.meta
|
|
383
198
|
};
|
|
384
|
-
|
|
199
|
+
Q(v);
|
|
385
200
|
const _ = await a(
|
|
386
201
|
v
|
|
387
|
-
), { maxPages:
|
|
202
|
+
), { maxPages: w } = t.options, E = p ? K : B;
|
|
388
203
|
return {
|
|
389
|
-
pages: E(o.pages, _,
|
|
390
|
-
pageParams: E(o.pageParams, l,
|
|
204
|
+
pages: E(o.pages, _, w),
|
|
205
|
+
pageParams: E(o.pageParams, l, w)
|
|
391
206
|
};
|
|
392
207
|
};
|
|
393
|
-
if (n &&
|
|
394
|
-
const o = n === "backward", l = o ?
|
|
395
|
-
pages:
|
|
396
|
-
pageParams:
|
|
397
|
-
}, v = l(
|
|
398
|
-
c = await m(
|
|
208
|
+
if (n && i.length) {
|
|
209
|
+
const o = n === "backward", l = o ? se : N, p = {
|
|
210
|
+
pages: i,
|
|
211
|
+
pageParams: f
|
|
212
|
+
}, v = l(r, p);
|
|
213
|
+
c = await m(p, v, o);
|
|
399
214
|
} else {
|
|
400
|
-
const o = e ??
|
|
215
|
+
const o = e ?? i.length;
|
|
401
216
|
do {
|
|
402
|
-
const l =
|
|
403
|
-
if (
|
|
217
|
+
const l = d === 0 ? f[0] ?? r.initialPageParam : N(r, c);
|
|
218
|
+
if (d > 0 && l == null)
|
|
404
219
|
break;
|
|
405
|
-
c = await m(c, l),
|
|
406
|
-
} while (
|
|
220
|
+
c = await m(c, l), d++;
|
|
221
|
+
} while (d < o);
|
|
407
222
|
}
|
|
408
223
|
return c;
|
|
409
224
|
};
|
|
@@ -420,39 +235,39 @@ function I(e) {
|
|
|
420
235
|
}
|
|
421
236
|
};
|
|
422
237
|
}
|
|
423
|
-
function
|
|
424
|
-
const
|
|
238
|
+
function N(e, { pages: t, pageParams: s }) {
|
|
239
|
+
const r = t.length - 1;
|
|
425
240
|
return t.length > 0 ? e.getNextPageParam(
|
|
426
|
-
t[
|
|
241
|
+
t[r],
|
|
427
242
|
t,
|
|
428
|
-
s[
|
|
243
|
+
s[r],
|
|
429
244
|
s
|
|
430
245
|
) : void 0;
|
|
431
246
|
}
|
|
432
|
-
function
|
|
247
|
+
function se(e, { pages: t, pageParams: s }) {
|
|
433
248
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
434
249
|
}
|
|
435
|
-
var
|
|
250
|
+
var re = class {
|
|
436
251
|
#e;
|
|
437
252
|
#t;
|
|
438
253
|
#s;
|
|
254
|
+
#n;
|
|
439
255
|
#i;
|
|
440
256
|
#r;
|
|
441
|
-
#n;
|
|
442
257
|
#a;
|
|
443
258
|
#u;
|
|
444
259
|
constructor(e = {}) {
|
|
445
|
-
this.#e = e.queryCache || new
|
|
260
|
+
this.#e = e.queryCache || new ee(), this.#t = e.mutationCache || new te(), this.#s = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#r = 0;
|
|
446
261
|
}
|
|
447
262
|
mount() {
|
|
448
|
-
this.#
|
|
263
|
+
this.#r++, this.#r === 1 && (this.#a = j.subscribe(async (e) => {
|
|
449
264
|
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
450
265
|
}), this.#u = D.subscribe(async (e) => {
|
|
451
266
|
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
452
267
|
}));
|
|
453
268
|
}
|
|
454
269
|
unmount() {
|
|
455
|
-
this.#
|
|
270
|
+
this.#r--, this.#r === 0 && (this.#a?.(), this.#a = void 0, this.#u?.(), this.#u = void 0);
|
|
456
271
|
}
|
|
457
272
|
isFetching(e) {
|
|
458
273
|
return this.#e.findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
@@ -465,27 +280,27 @@ var ae = class {
|
|
|
465
280
|
return this.#e.get(t.queryHash)?.state.data;
|
|
466
281
|
}
|
|
467
282
|
ensureQueryData(e) {
|
|
468
|
-
const t = this.defaultQueryOptions(e), s = this.#e.build(this, t),
|
|
469
|
-
return
|
|
283
|
+
const t = this.defaultQueryOptions(e), s = this.#e.build(this, t), r = s.state.data;
|
|
284
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(S(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
470
285
|
}
|
|
471
286
|
getQueriesData(e) {
|
|
472
287
|
return this.#e.findAll(e).map(({ queryKey: t, state: s }) => {
|
|
473
|
-
const
|
|
474
|
-
return [t,
|
|
288
|
+
const r = s.data;
|
|
289
|
+
return [t, r];
|
|
475
290
|
});
|
|
476
291
|
}
|
|
477
292
|
setQueryData(e, t, s) {
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
)?.state.data,
|
|
481
|
-
if (
|
|
482
|
-
return this.#e.build(this,
|
|
293
|
+
const r = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(
|
|
294
|
+
r.queryHash
|
|
295
|
+
)?.state.data, f = L(t, i);
|
|
296
|
+
if (f !== void 0)
|
|
297
|
+
return this.#e.build(this, r).setData(f, { ...s, manual: !0 });
|
|
483
298
|
}
|
|
484
299
|
setQueriesData(e, t, s) {
|
|
485
300
|
return u.batch(
|
|
486
|
-
() => this.#e.findAll(e).map(({ queryKey:
|
|
487
|
-
|
|
488
|
-
this.setQueryData(
|
|
301
|
+
() => this.#e.findAll(e).map(({ queryKey: r }) => [
|
|
302
|
+
r,
|
|
303
|
+
this.setQueryData(r, t, s)
|
|
489
304
|
])
|
|
490
305
|
);
|
|
491
306
|
}
|
|
@@ -504,64 +319,65 @@ var ae = class {
|
|
|
504
319
|
});
|
|
505
320
|
}
|
|
506
321
|
resetQueries(e, t) {
|
|
507
|
-
const s = this.#e
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
322
|
+
const s = this.#e;
|
|
323
|
+
return u.batch(() => (s.findAll(e).forEach((r) => {
|
|
324
|
+
r.reset();
|
|
325
|
+
}), this.refetchQueries(
|
|
326
|
+
{
|
|
327
|
+
type: "active",
|
|
328
|
+
...e
|
|
329
|
+
},
|
|
330
|
+
t
|
|
331
|
+
)));
|
|
514
332
|
}
|
|
515
333
|
cancelQueries(e, t = {}) {
|
|
516
|
-
const s = { revert: !0, ...t },
|
|
334
|
+
const s = { revert: !0, ...t }, r = u.batch(
|
|
517
335
|
() => this.#e.findAll(e).map((n) => n.cancel(s))
|
|
518
336
|
);
|
|
519
|
-
return Promise.all(
|
|
337
|
+
return Promise.all(r).then(h).catch(h);
|
|
520
338
|
}
|
|
521
339
|
invalidateQueries(e, t = {}) {
|
|
522
|
-
return u.batch(() => {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
return Promise.resolve();
|
|
527
|
-
const s = {
|
|
340
|
+
return u.batch(() => (this.#e.findAll(e).forEach((s) => {
|
|
341
|
+
s.invalidate();
|
|
342
|
+
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
343
|
+
{
|
|
528
344
|
...e,
|
|
529
345
|
type: e?.refetchType ?? e?.type ?? "active"
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
346
|
+
},
|
|
347
|
+
t
|
|
348
|
+
)));
|
|
533
349
|
}
|
|
534
350
|
refetchQueries(e, t = {}) {
|
|
535
351
|
const s = {
|
|
536
352
|
...t,
|
|
537
353
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
538
|
-
},
|
|
354
|
+
}, r = u.batch(
|
|
539
355
|
() => this.#e.findAll(e).filter((n) => !n.isDisabled()).map((n) => {
|
|
540
|
-
let
|
|
541
|
-
return s.throwOnError || (
|
|
356
|
+
let i = n.fetch(void 0, s);
|
|
357
|
+
return s.throwOnError || (i = i.catch(h)), n.state.fetchStatus === "paused" ? Promise.resolve() : i;
|
|
542
358
|
})
|
|
543
359
|
);
|
|
544
|
-
return Promise.all(
|
|
360
|
+
return Promise.all(r).then(h);
|
|
545
361
|
}
|
|
546
362
|
fetchQuery(e) {
|
|
547
363
|
const t = this.defaultQueryOptions(e);
|
|
548
364
|
t.retry === void 0 && (t.retry = !1);
|
|
549
365
|
const s = this.#e.build(this, t);
|
|
550
366
|
return s.isStaleByTime(
|
|
551
|
-
|
|
367
|
+
S(t.staleTime, s)
|
|
552
368
|
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
553
369
|
}
|
|
554
370
|
prefetchQuery(e) {
|
|
555
371
|
return this.fetchQuery(e).then(h).catch(h);
|
|
556
372
|
}
|
|
557
373
|
fetchInfiniteQuery(e) {
|
|
558
|
-
return e.behavior =
|
|
374
|
+
return e.behavior = C(e.pages), this.fetchQuery(e);
|
|
559
375
|
}
|
|
560
376
|
prefetchInfiniteQuery(e) {
|
|
561
377
|
return this.fetchInfiniteQuery(e).then(h).catch(h);
|
|
562
378
|
}
|
|
563
379
|
ensureInfiniteQueryData(e) {
|
|
564
|
-
return e.behavior =
|
|
380
|
+
return e.behavior = C(e.pages), this.ensureQueryData(e);
|
|
565
381
|
}
|
|
566
382
|
resumePausedMutations() {
|
|
567
383
|
return D.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
@@ -579,28 +395,27 @@ var ae = class {
|
|
|
579
395
|
this.#s = e;
|
|
580
396
|
}
|
|
581
397
|
setQueryDefaults(e, t) {
|
|
582
|
-
this.#
|
|
398
|
+
this.#n.set(I(e), {
|
|
583
399
|
queryKey: e,
|
|
584
400
|
defaultOptions: t
|
|
585
401
|
});
|
|
586
402
|
}
|
|
587
403
|
getQueryDefaults(e) {
|
|
588
|
-
const t = [...this.#
|
|
589
|
-
return t.forEach((
|
|
590
|
-
F(e,
|
|
404
|
+
const t = [...this.#n.values()], s = {};
|
|
405
|
+
return t.forEach((r) => {
|
|
406
|
+
F(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
591
407
|
}), s;
|
|
592
408
|
}
|
|
593
409
|
setMutationDefaults(e, t) {
|
|
594
|
-
this.#
|
|
410
|
+
this.#i.set(I(e), {
|
|
595
411
|
mutationKey: e,
|
|
596
412
|
defaultOptions: t
|
|
597
413
|
});
|
|
598
414
|
}
|
|
599
415
|
getMutationDefaults(e) {
|
|
600
|
-
const t = [...this.#
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
F(e, i.mutationKey) && (s = { ...s, ...i.defaultOptions });
|
|
416
|
+
const t = [...this.#i.values()], s = {};
|
|
417
|
+
return t.forEach((r) => {
|
|
418
|
+
F(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
604
419
|
}), s;
|
|
605
420
|
}
|
|
606
421
|
defaultQueryOptions(e) {
|
|
@@ -615,7 +430,7 @@ var ae = class {
|
|
|
615
430
|
return t.queryHash || (t.queryHash = k(
|
|
616
431
|
t.queryKey,
|
|
617
432
|
t
|
|
618
|
-
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn ===
|
|
433
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === U && (t.enabled = !1), t;
|
|
619
434
|
}
|
|
620
435
|
defaultMutationOptions(e) {
|
|
621
436
|
return e?._defaulted ? e : {
|
|
@@ -629,7 +444,7 @@ var ae = class {
|
|
|
629
444
|
this.#e.clear(), this.#t.clear();
|
|
630
445
|
}
|
|
631
446
|
};
|
|
632
|
-
const
|
|
447
|
+
const ne = new re({
|
|
633
448
|
defaultOptions: {
|
|
634
449
|
mutations: {
|
|
635
450
|
retry: !1
|
|
@@ -643,26 +458,26 @@ const ue = new ae({
|
|
|
643
458
|
retry: !1
|
|
644
459
|
}
|
|
645
460
|
}
|
|
646
|
-
}),
|
|
647
|
-
const e =
|
|
648
|
-
|
|
461
|
+
}), ie = () => {
|
|
462
|
+
const e = M((s) => s.currentNavigationPath), t = J();
|
|
463
|
+
b(() => {
|
|
649
464
|
e && t(e, { replace: !0 });
|
|
650
465
|
}, [e, t]);
|
|
651
|
-
},
|
|
466
|
+
}, ae = () => (ie(), /* @__PURE__ */ y(G, {})), Oe = ({
|
|
652
467
|
props: e,
|
|
653
468
|
routes: t,
|
|
654
469
|
env: s = void 0,
|
|
655
|
-
useSignalR:
|
|
656
|
-
queryClient: n =
|
|
470
|
+
useSignalR: r = !1,
|
|
471
|
+
queryClient: n = ne
|
|
657
472
|
}) => {
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
const a =
|
|
661
|
-
if (
|
|
473
|
+
const i = M((a) => a.setBaseProps), f = M((a) => a.modulePermissionToken), c = T((a) => a.setEnvironment), d = T((a) => a.addEnvironment), [P, g] = $(!1);
|
|
474
|
+
b(() => {
|
|
475
|
+
const a = he();
|
|
476
|
+
if (g(!a), a && c(a), !s) return;
|
|
662
477
|
const m = s[a?.ENVIRONMENT];
|
|
663
|
-
m &&
|
|
664
|
-
}, [
|
|
665
|
-
|
|
478
|
+
m && d(m);
|
|
479
|
+
}, [d, s, c]), b(() => {
|
|
480
|
+
g(!ue(e)), i(e);
|
|
666
481
|
}, [
|
|
667
482
|
e.currentLanguage,
|
|
668
483
|
e.currentLanguageId,
|
|
@@ -671,26 +486,26 @@ const ue = new ae({
|
|
|
671
486
|
e.currentNavigationPath,
|
|
672
487
|
e.sourcePath
|
|
673
488
|
]);
|
|
674
|
-
const
|
|
489
|
+
const Q = z([
|
|
675
490
|
{
|
|
676
491
|
path: e.basePath,
|
|
677
492
|
children: t,
|
|
678
|
-
element: /* @__PURE__ */ y(
|
|
493
|
+
element: /* @__PURE__ */ y(ae, {})
|
|
679
494
|
}
|
|
680
495
|
]);
|
|
681
|
-
return P ? /* @__PURE__ */ y("div", { children: "TODO: Show fancy error" }) :
|
|
682
|
-
},
|
|
496
|
+
return P ? /* @__PURE__ */ y("div", { children: "TODO: Show fancy error" }) : f ? /* @__PURE__ */ y(V, { client: n, children: /* @__PURE__ */ y(x, { enabled: r, children: /* @__PURE__ */ y(Y, { router: Q }) }) }) : /* @__PURE__ */ y("div", { children: "TODO: Show fancy Loadingspinner" });
|
|
497
|
+
}, ue = (e) => Z.every((t) => oe(t, e)), oe = (e, t) => {
|
|
683
498
|
if (!t[e]) {
|
|
684
499
|
if (t.throwError)
|
|
685
500
|
return t.throwError(`Missing required prop: ${e}`, 404), !1;
|
|
686
501
|
throw new Error(`Missing required prop: ${e}`);
|
|
687
502
|
}
|
|
688
503
|
return !0;
|
|
689
|
-
},
|
|
504
|
+
}, he = () => {
|
|
690
505
|
const e = window.__env__;
|
|
691
506
|
if (e && (e.API_PREFIX = "/api/v8.0", !!e.COMMON_API && e.MODULE_AUTH_API && e.API_PREFIX && e.ENVIRONMENT))
|
|
692
507
|
return e;
|
|
693
508
|
};
|
|
694
509
|
export {
|
|
695
|
-
|
|
510
|
+
Oe as ModuleBase
|
|
696
511
|
};
|