@hortiview/modulebase 0.0.20436 → 1.0.0
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/README.md +3 -2
- package/dist/IsRestoringProvider-CBSZo7ur.js +312 -0
- package/dist/ModuleCore-DuJVrj6v.js +11828 -0
- package/dist/QueryClientProvider-DyiNrPkn.js +514 -0
- package/dist/_commonjsHelpers-ByX85dGu.js +33 -0
- package/dist/api-COabZnyn.js +147 -0
- package/dist/assets/ModuleCore.css +1 -1
- package/dist/chunk-LFPYN7LY-D1ls8FXf.js +8643 -0
- package/dist/components/ModuleBase.js +9 -9
- package/dist/components/ModuleCore.js +1 -1
- package/dist/constants.js +2 -3
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +5 -5
- package/dist/hooks/useEntity.js +30 -30
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +5 -5
- package/dist/hooks/useServiceBus.js +1 -1
- package/dist/hooks/useStores.js +1 -1
- package/dist/{_baseGet-C6jMXSsQ.js → isTypedArray-SkhznY1k.js} +494 -494
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/hooks/useCustom.d.ts +4 -2
- package/dist/lib/hooks/useCustomMutation.d.ts +8 -3
- package/dist/lib/hooks/useEntity.d.ts +6 -0
- package/dist/lib/types/Requests.d.ts +0 -17
- package/dist/lib/utils/api.d.ts +6 -13
- package/dist/lib/utils/baseFetches.d.ts +3 -2
- package/dist/main.js +188 -173
- package/dist/module-router.js +2322 -121
- package/dist/{mutation-DSKlaYzY.js → mutation-CmhiEgfA.js} +101 -56
- package/dist/{omit-C9Qe80rl.js → omit-Do6MFRwA.js} +240 -223
- package/dist/provider/SignalR/SignalRProvider.js +2389 -2824
- package/dist/react-c9FSfB30.js +27 -0
- package/dist/stores/BasePropsStore.js +1 -1
- package/dist/stores/EnvironmentStore.js +1 -1
- package/dist/useMutation-Aoachkw_.js +139 -0
- package/dist/useQuery-DEU_AUtf.js +392 -0
- package/dist/utils/api.js +3 -4
- package/dist/utils/baseFetches.js +18 -14
- package/dist/utils/fetches.js +3 -4
- package/dist/utils/helper.js +13 -13
- package/package.json +17 -13
- package/dist/ModuleCore-DpwHP0IU.js +0 -14973
- package/dist/QueryClientProvider-Beog9TR7.js +0 -437
- package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/api-CogBuK0n.js +0 -473
- package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
- package/dist/isRestoring-CLuxJVSA.js +0 -281
- package/dist/react-QiIgv49H.js +0 -27
- package/dist/useMutation-zu8uxBak.js +0 -97
- package/dist/useQuery-Bj9k9zik.js +0 -395
- package/dist/utils-DxRR_XLb.js +0 -9
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
var
|
|
1
|
+
import { R as r, c as u, n as h } from "./QueryClientProvider-DyiNrPkn.js";
|
|
2
|
+
var l = class extends r {
|
|
3
|
+
#o;
|
|
3
4
|
#e;
|
|
4
5
|
#t;
|
|
5
6
|
#i;
|
|
6
7
|
constructor(t) {
|
|
7
|
-
super(), this.mutationId = t.mutationId, this.#t = t.mutationCache, this.#e = [], this.state = t.state ||
|
|
8
|
+
super(), this.#o = t.client, this.mutationId = t.mutationId, this.#t = t.mutationCache, this.#e = [], this.state = t.state || c(), this.setOptions(t.options), this.scheduleGc();
|
|
8
9
|
}
|
|
9
10
|
setOptions(t) {
|
|
10
11
|
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
@@ -20,7 +21,7 @@ var d = class extends o {
|
|
|
20
21
|
}));
|
|
21
22
|
}
|
|
22
23
|
removeObserver(t) {
|
|
23
|
-
this.#e = this.#e.filter((
|
|
24
|
+
this.#e = this.#e.filter((o) => o !== t), this.scheduleGc(), this.#t.notify({
|
|
24
25
|
type: "observerRemoved",
|
|
25
26
|
mutation: this,
|
|
26
27
|
observer: t
|
|
@@ -34,102 +35,146 @@ var d = class extends o {
|
|
|
34
35
|
this.execute(this.state.variables);
|
|
35
36
|
}
|
|
36
37
|
async execute(t) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const o = () => {
|
|
39
|
+
this.#s({ type: "continue" });
|
|
40
|
+
}, e = {
|
|
41
|
+
client: this.#o,
|
|
42
|
+
meta: this.options.meta,
|
|
43
|
+
mutationKey: this.options.mutationKey
|
|
44
|
+
};
|
|
45
|
+
this.#i = u({
|
|
46
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t, e) : Promise.reject(new Error("No mutationFn found")),
|
|
47
|
+
onFail: (s, i) => {
|
|
48
|
+
this.#s({ type: "failed", failureCount: s, error: i });
|
|
41
49
|
},
|
|
42
50
|
onPause: () => {
|
|
43
51
|
this.#s({ type: "pause" });
|
|
44
52
|
},
|
|
45
|
-
onContinue:
|
|
46
|
-
this.#s({ type: "continue" });
|
|
47
|
-
},
|
|
53
|
+
onContinue: o,
|
|
48
54
|
retry: this.options.retry ?? 0,
|
|
49
55
|
retryDelay: this.options.retryDelay,
|
|
50
56
|
networkMode: this.options.networkMode,
|
|
51
57
|
canRun: () => this.#t.canRun(this)
|
|
52
58
|
});
|
|
53
|
-
const
|
|
59
|
+
const a = this.state.status === "pending", n = !this.#i.canStart();
|
|
54
60
|
try {
|
|
55
|
-
if (
|
|
56
|
-
|
|
61
|
+
if (a)
|
|
62
|
+
o();
|
|
63
|
+
else {
|
|
64
|
+
this.#s({ type: "pending", variables: t, isPaused: n }), this.#t.config.onMutate && await this.#t.config.onMutate(
|
|
65
|
+
t,
|
|
66
|
+
this,
|
|
67
|
+
e
|
|
68
|
+
);
|
|
69
|
+
const i = await this.options.onMutate?.(
|
|
57
70
|
t,
|
|
58
|
-
|
|
71
|
+
e
|
|
59
72
|
);
|
|
60
|
-
|
|
61
|
-
n !== this.state.context && this.#s({
|
|
73
|
+
i !== this.state.context && this.#s({
|
|
62
74
|
type: "pending",
|
|
63
|
-
context:
|
|
75
|
+
context: i,
|
|
64
76
|
variables: t,
|
|
65
|
-
isPaused:
|
|
77
|
+
isPaused: n
|
|
66
78
|
});
|
|
67
79
|
}
|
|
68
|
-
const
|
|
80
|
+
const s = await this.#i.start();
|
|
69
81
|
return await this.#t.config.onSuccess?.(
|
|
70
|
-
|
|
82
|
+
s,
|
|
83
|
+
t,
|
|
84
|
+
this.state.context,
|
|
85
|
+
this,
|
|
86
|
+
e
|
|
87
|
+
), await this.options.onSuccess?.(
|
|
88
|
+
s,
|
|
71
89
|
t,
|
|
72
90
|
this.state.context,
|
|
73
|
-
|
|
74
|
-
), await this
|
|
75
|
-
|
|
91
|
+
e
|
|
92
|
+
), await this.#t.config.onSettled?.(
|
|
93
|
+
s,
|
|
76
94
|
null,
|
|
77
95
|
this.state.variables,
|
|
78
96
|
this.state.context,
|
|
79
|
-
this
|
|
80
|
-
|
|
81
|
-
|
|
97
|
+
this,
|
|
98
|
+
e
|
|
99
|
+
), await this.options.onSettled?.(
|
|
100
|
+
s,
|
|
101
|
+
null,
|
|
102
|
+
t,
|
|
103
|
+
this.state.context,
|
|
104
|
+
e
|
|
105
|
+
), this.#s({ type: "success", data: s }), s;
|
|
106
|
+
} catch (s) {
|
|
82
107
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
108
|
+
await this.#t.config.onError?.(
|
|
109
|
+
s,
|
|
85
110
|
t,
|
|
86
111
|
this.state.context,
|
|
87
|
-
this
|
|
88
|
-
|
|
89
|
-
|
|
112
|
+
this,
|
|
113
|
+
e
|
|
114
|
+
);
|
|
115
|
+
} catch (i) {
|
|
116
|
+
Promise.reject(i);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
await this.options.onError?.(
|
|
120
|
+
s,
|
|
90
121
|
t,
|
|
91
|
-
this.state.context
|
|
92
|
-
|
|
122
|
+
this.state.context,
|
|
123
|
+
e
|
|
124
|
+
);
|
|
125
|
+
} catch (i) {
|
|
126
|
+
Promise.reject(i);
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
await this.#t.config.onSettled?.(
|
|
93
130
|
void 0,
|
|
94
|
-
|
|
131
|
+
s,
|
|
95
132
|
this.state.variables,
|
|
96
133
|
this.state.context,
|
|
97
|
-
this
|
|
98
|
-
|
|
134
|
+
this,
|
|
135
|
+
e
|
|
136
|
+
);
|
|
137
|
+
} catch (i) {
|
|
138
|
+
Promise.reject(i);
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
await this.options.onSettled?.(
|
|
99
142
|
void 0,
|
|
100
|
-
|
|
143
|
+
s,
|
|
101
144
|
t,
|
|
102
|
-
this.state.context
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
145
|
+
this.state.context,
|
|
146
|
+
e
|
|
147
|
+
);
|
|
148
|
+
} catch (i) {
|
|
149
|
+
Promise.reject(i);
|
|
106
150
|
}
|
|
151
|
+
throw this.#s({ type: "error", error: s }), s;
|
|
107
152
|
} finally {
|
|
108
153
|
this.#t.runNext(this);
|
|
109
154
|
}
|
|
110
155
|
}
|
|
111
156
|
#s(t) {
|
|
112
|
-
const
|
|
157
|
+
const o = (e) => {
|
|
113
158
|
switch (t.type) {
|
|
114
159
|
case "failed":
|
|
115
160
|
return {
|
|
116
|
-
...
|
|
161
|
+
...e,
|
|
117
162
|
failureCount: t.failureCount,
|
|
118
163
|
failureReason: t.error
|
|
119
164
|
};
|
|
120
165
|
case "pause":
|
|
121
166
|
return {
|
|
122
|
-
...
|
|
167
|
+
...e,
|
|
123
168
|
isPaused: !0
|
|
124
169
|
};
|
|
125
170
|
case "continue":
|
|
126
171
|
return {
|
|
127
|
-
...
|
|
172
|
+
...e,
|
|
128
173
|
isPaused: !1
|
|
129
174
|
};
|
|
130
175
|
case "pending":
|
|
131
176
|
return {
|
|
132
|
-
...
|
|
177
|
+
...e,
|
|
133
178
|
context: t.context,
|
|
134
179
|
data: void 0,
|
|
135
180
|
failureCount: 0,
|
|
@@ -142,7 +187,7 @@ var d = class extends o {
|
|
|
142
187
|
};
|
|
143
188
|
case "success":
|
|
144
189
|
return {
|
|
145
|
-
...
|
|
190
|
+
...e,
|
|
146
191
|
data: t.data,
|
|
147
192
|
failureCount: 0,
|
|
148
193
|
failureReason: null,
|
|
@@ -152,19 +197,19 @@ var d = class extends o {
|
|
|
152
197
|
};
|
|
153
198
|
case "error":
|
|
154
199
|
return {
|
|
155
|
-
...
|
|
200
|
+
...e,
|
|
156
201
|
data: void 0,
|
|
157
202
|
error: t.error,
|
|
158
|
-
failureCount:
|
|
203
|
+
failureCount: e.failureCount + 1,
|
|
159
204
|
failureReason: t.error,
|
|
160
205
|
isPaused: !1,
|
|
161
206
|
status: "error"
|
|
162
207
|
};
|
|
163
208
|
}
|
|
164
209
|
};
|
|
165
|
-
this.state =
|
|
166
|
-
this.#e.forEach((
|
|
167
|
-
|
|
210
|
+
this.state = o(this.state), h.batch(() => {
|
|
211
|
+
this.#e.forEach((e) => {
|
|
212
|
+
e.onMutationUpdate(t);
|
|
168
213
|
}), this.#t.notify({
|
|
169
214
|
mutation: this,
|
|
170
215
|
type: "updated",
|
|
@@ -173,7 +218,7 @@ var d = class extends o {
|
|
|
173
218
|
});
|
|
174
219
|
}
|
|
175
220
|
};
|
|
176
|
-
function
|
|
221
|
+
function c() {
|
|
177
222
|
return {
|
|
178
223
|
context: void 0,
|
|
179
224
|
data: void 0,
|
|
@@ -187,6 +232,6 @@ function u() {
|
|
|
187
232
|
};
|
|
188
233
|
}
|
|
189
234
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
235
|
+
l as M,
|
|
236
|
+
c as g
|
|
192
237
|
};
|