@stonecrop/stonecrop 0.6.2 → 0.7.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/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/schema-validator.d.ts +132 -0
- package/dist/src/schema-validator.d.ts.map +1 -0
- package/dist/src/schema-validator.js +315 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/stonecrop.d.ts +187 -72
- package/dist/stonecrop.js +1095 -884
- package/dist/stonecrop.js.map +1 -1
- package/dist/stonecrop.umd.cjs +3 -7
- package/dist/stonecrop.umd.cjs.map +1 -1
- package/package.json +20 -20
- package/src/index.ts +9 -0
- package/src/schema-validator.ts +427 -0
package/dist/stonecrop.js
CHANGED
|
@@ -1,574 +1,564 @@
|
|
|
1
|
-
import { hasInjectionContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
let re;
|
|
8
|
-
const ge = (r) => re = r, Ye = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
|
|
1
|
+
import { hasInjectionContext as we, inject as te, getCurrentInstance as Fe, toRaw as Le, computed as B, isRef as re, isReactive as ye, toRef as se, ref as M, reactive as Ee, markRaw as oe, effectScope as Je, nextTick as le, getCurrentScope as Ke, onScopeDispose as Ze, watch as H, toRefs as Pe, onMounted as Ve, readonly as Me, customRef as Ge, toValue as q, shallowRef as xe, unref as Ye, provide as _e } from "vue";
|
|
2
|
+
const Q = typeof window < "u";
|
|
3
|
+
let K;
|
|
4
|
+
const ge = (n) => K = n;
|
|
5
|
+
process.env.NODE_ENV;
|
|
6
|
+
const Oe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
9
7
|
/* istanbul ignore next */
|
|
10
|
-
Symbol()
|
|
8
|
+
/* @__PURE__ */ Symbol()
|
|
11
9
|
);
|
|
12
|
-
function
|
|
13
|
-
return
|
|
10
|
+
function G(n) {
|
|
11
|
+
return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
|
|
14
12
|
}
|
|
15
|
-
var
|
|
16
|
-
(function(
|
|
17
|
-
|
|
18
|
-
})(
|
|
19
|
-
|
|
20
|
-
function Be(r, e) {
|
|
13
|
+
var ie;
|
|
14
|
+
(function(n) {
|
|
15
|
+
n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
|
|
16
|
+
})(ie || (ie = {}));
|
|
17
|
+
function Be(n, e) {
|
|
21
18
|
for (const t in e) {
|
|
22
|
-
const
|
|
23
|
-
if (!(t in
|
|
19
|
+
const r = e[t];
|
|
20
|
+
if (!(t in n))
|
|
24
21
|
continue;
|
|
25
|
-
const o =
|
|
26
|
-
|
|
22
|
+
const o = n[t];
|
|
23
|
+
G(o) && G(r) && !re(r) && !ye(r) ? n[t] = Be(o, r) : n[t] = r;
|
|
27
24
|
}
|
|
28
|
-
return
|
|
25
|
+
return n;
|
|
29
26
|
}
|
|
30
27
|
const je = () => {
|
|
31
28
|
};
|
|
32
|
-
function
|
|
33
|
-
|
|
29
|
+
function Ae(n, e, t, r = je) {
|
|
30
|
+
n.add(e);
|
|
34
31
|
const o = () => {
|
|
35
|
-
|
|
36
|
-
s > -1 && (r.splice(s, 1), n());
|
|
32
|
+
n.delete(e) && r();
|
|
37
33
|
};
|
|
38
|
-
return !t &&
|
|
34
|
+
return !t && Ke() && Ze(o), o;
|
|
39
35
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
36
|
+
function Y(n, ...e) {
|
|
37
|
+
n.forEach((t) => {
|
|
42
38
|
t(...e);
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
|
-
const Qe = (
|
|
46
|
-
function
|
|
47
|
-
|
|
41
|
+
const Qe = (n) => n(), $e = /* @__PURE__ */ Symbol(), me = /* @__PURE__ */ Symbol();
|
|
42
|
+
function Re(n, e) {
|
|
43
|
+
n instanceof Map && e instanceof Map ? e.forEach((t, r) => n.set(r, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n);
|
|
48
44
|
for (const t in e) {
|
|
49
45
|
if (!e.hasOwnProperty(t))
|
|
50
46
|
continue;
|
|
51
|
-
const
|
|
52
|
-
|
|
47
|
+
const r = e[t], o = n[t];
|
|
48
|
+
G(o) && G(r) && n.hasOwnProperty(t) && !re(r) && !ye(r) ? n[t] = Re(o, r) : n[t] = r;
|
|
53
49
|
}
|
|
54
|
-
return
|
|
50
|
+
return n;
|
|
55
51
|
}
|
|
56
|
-
const Xe = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
|
|
52
|
+
const Xe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
57
53
|
/* istanbul ignore next */
|
|
58
|
-
Symbol()
|
|
54
|
+
/* @__PURE__ */ Symbol()
|
|
59
55
|
);
|
|
60
|
-
function et(
|
|
61
|
-
return !
|
|
56
|
+
function et(n) {
|
|
57
|
+
return !G(n) || !Object.prototype.hasOwnProperty.call(n, Xe);
|
|
62
58
|
}
|
|
63
|
-
const { assign:
|
|
64
|
-
function Ie(
|
|
65
|
-
return !!(
|
|
59
|
+
const { assign: W } = Object;
|
|
60
|
+
function Ie(n) {
|
|
61
|
+
return !!(re(n) && n.effect);
|
|
66
62
|
}
|
|
67
|
-
function
|
|
68
|
-
const { state: o, actions: s, getters: i } = e, a = t.state.value[
|
|
63
|
+
function De(n, e, t, r) {
|
|
64
|
+
const { state: o, actions: s, getters: i } = e, a = t.state.value[n];
|
|
69
65
|
let c;
|
|
70
|
-
function
|
|
71
|
-
!a && (process.env.NODE_ENV === "production" || !
|
|
72
|
-
const
|
|
66
|
+
function h() {
|
|
67
|
+
!a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[n] = o ? o() : {});
|
|
68
|
+
const g = process.env.NODE_ENV !== "production" && r ? (
|
|
73
69
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
74
|
-
|
|
75
|
-
) :
|
|
76
|
-
return
|
|
70
|
+
Pe(M(o ? o() : {}).value)
|
|
71
|
+
) : Pe(t.state.value[n]);
|
|
72
|
+
return W(g, s, Object.keys(i || {}).reduce((w, R) => (process.env.NODE_ENV !== "production" && R in g && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${R}" in store "${n}".`), w[R] = oe(B(() => {
|
|
77
73
|
ge(t);
|
|
78
|
-
const $ = t._s.get(
|
|
79
|
-
return i[
|
|
74
|
+
const $ = t._s.get(n);
|
|
75
|
+
return i[R].call($, $);
|
|
80
76
|
})), w), {}));
|
|
81
77
|
}
|
|
82
|
-
return c =
|
|
78
|
+
return c = Ne(n, h, e, t, r, !0), c;
|
|
83
79
|
}
|
|
84
|
-
function
|
|
80
|
+
function Ne(n, e, t = {}, r, o, s) {
|
|
85
81
|
let i;
|
|
86
|
-
const a =
|
|
87
|
-
if (process.env.NODE_ENV !== "production" && !
|
|
82
|
+
const a = W({ actions: {} }, t);
|
|
83
|
+
if (process.env.NODE_ENV !== "production" && !r._e.active)
|
|
88
84
|
throw new Error("Pinia destroyed");
|
|
89
85
|
const c = { deep: !0 };
|
|
90
|
-
process.env.NODE_ENV !== "production" && (c.onTrigger = (
|
|
91
|
-
|
|
86
|
+
process.env.NODE_ENV !== "production" && (c.onTrigger = (l) => {
|
|
87
|
+
h ? $ = l : h == !1 && !v._hotUpdating && (Array.isArray($) ? $.push(l) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
92
88
|
});
|
|
93
|
-
let
|
|
94
|
-
const T =
|
|
95
|
-
!s && !T && (process.env.NODE_ENV === "production" || !o) && (
|
|
96
|
-
const
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
type:
|
|
102
|
-
storeId:
|
|
89
|
+
let h, g, w = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set(), $;
|
|
90
|
+
const T = r.state.value[n];
|
|
91
|
+
!s && !T && (process.env.NODE_ENV === "production" || !o) && (r.state.value[n] = {});
|
|
92
|
+
const L = M({});
|
|
93
|
+
let P;
|
|
94
|
+
function I(l) {
|
|
95
|
+
let u;
|
|
96
|
+
h = g = !1, process.env.NODE_ENV !== "production" && ($ = []), typeof l == "function" ? (l(r.state.value[n]), u = {
|
|
97
|
+
type: ie.patchFunction,
|
|
98
|
+
storeId: n,
|
|
103
99
|
events: $
|
|
104
|
-
}) : (
|
|
105
|
-
type:
|
|
106
|
-
payload:
|
|
107
|
-
storeId:
|
|
100
|
+
}) : (Re(r.state.value[n], l), u = {
|
|
101
|
+
type: ie.patchObject,
|
|
102
|
+
payload: l,
|
|
103
|
+
storeId: n,
|
|
108
104
|
events: $
|
|
109
105
|
});
|
|
110
|
-
const O =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}),
|
|
114
|
-
}
|
|
115
|
-
const
|
|
116
|
-
const { state:
|
|
117
|
-
this.$patch((
|
|
118
|
-
|
|
106
|
+
const O = P = /* @__PURE__ */ Symbol();
|
|
107
|
+
le().then(() => {
|
|
108
|
+
P === O && (h = !0);
|
|
109
|
+
}), g = !0, Y(w, u, r.state.value[n]);
|
|
110
|
+
}
|
|
111
|
+
const N = s ? function() {
|
|
112
|
+
const { state: u } = t, O = u ? u() : {};
|
|
113
|
+
this.$patch((m) => {
|
|
114
|
+
W(m, O);
|
|
119
115
|
});
|
|
120
116
|
} : (
|
|
121
117
|
/* istanbul ignore next */
|
|
122
118
|
process.env.NODE_ENV !== "production" ? () => {
|
|
123
|
-
throw new Error(`🍍: Store "${
|
|
119
|
+
throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
|
|
124
120
|
} : je
|
|
125
121
|
);
|
|
126
|
-
function
|
|
127
|
-
i.stop(), w
|
|
122
|
+
function S() {
|
|
123
|
+
i.stop(), w.clear(), R.clear(), r._s.delete(n);
|
|
128
124
|
}
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
125
|
+
const D = (l, u = "") => {
|
|
126
|
+
if ($e in l)
|
|
127
|
+
return l[me] = u, l;
|
|
132
128
|
const O = function() {
|
|
133
|
-
ge(
|
|
134
|
-
const
|
|
135
|
-
function
|
|
136
|
-
|
|
129
|
+
ge(r);
|
|
130
|
+
const m = Array.from(arguments), f = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
|
|
131
|
+
function A(k) {
|
|
132
|
+
f.add(k);
|
|
137
133
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
134
|
+
function C(k) {
|
|
135
|
+
b.add(k);
|
|
140
136
|
}
|
|
141
|
-
|
|
142
|
-
args:
|
|
137
|
+
Y(R, {
|
|
138
|
+
args: m,
|
|
143
139
|
name: O[me],
|
|
144
|
-
store:
|
|
145
|
-
after:
|
|
146
|
-
onError:
|
|
140
|
+
store: v,
|
|
141
|
+
after: A,
|
|
142
|
+
onError: C
|
|
147
143
|
});
|
|
148
144
|
let j;
|
|
149
145
|
try {
|
|
150
|
-
j =
|
|
151
|
-
} catch (
|
|
152
|
-
throw
|
|
146
|
+
j = l.apply(this && this.$id === n ? this : v, m);
|
|
147
|
+
} catch (k) {
|
|
148
|
+
throw Y(b, k), k;
|
|
153
149
|
}
|
|
154
|
-
return j instanceof Promise ? j.then((
|
|
150
|
+
return j instanceof Promise ? j.then((k) => (Y(f, k), k)).catch((k) => (Y(b, k), Promise.reject(k))) : (Y(f, j), j);
|
|
155
151
|
};
|
|
156
|
-
return O[
|
|
157
|
-
}, E = /* @__PURE__ */
|
|
152
|
+
return O[$e] = !0, O[me] = u, O;
|
|
153
|
+
}, E = /* @__PURE__ */ oe({
|
|
158
154
|
actions: {},
|
|
159
155
|
getters: {},
|
|
160
156
|
state: [],
|
|
161
|
-
hotState:
|
|
162
|
-
}),
|
|
163
|
-
_p:
|
|
157
|
+
hotState: L
|
|
158
|
+
}), _ = {
|
|
159
|
+
_p: r,
|
|
164
160
|
// _s: scope,
|
|
165
|
-
$id:
|
|
166
|
-
$onAction:
|
|
167
|
-
$patch:
|
|
168
|
-
$reset:
|
|
169
|
-
$subscribe(
|
|
170
|
-
const O =
|
|
171
|
-
(
|
|
172
|
-
storeId:
|
|
173
|
-
type:
|
|
161
|
+
$id: n,
|
|
162
|
+
$onAction: Ae.bind(null, R),
|
|
163
|
+
$patch: I,
|
|
164
|
+
$reset: N,
|
|
165
|
+
$subscribe(l, u = {}) {
|
|
166
|
+
const O = Ae(w, l, u.detached, () => m()), m = i.run(() => H(() => r.state.value[n], (f) => {
|
|
167
|
+
(u.flush === "sync" ? g : h) && l({
|
|
168
|
+
storeId: n,
|
|
169
|
+
type: ie.direct,
|
|
174
170
|
events: $
|
|
175
|
-
},
|
|
176
|
-
},
|
|
171
|
+
}, f);
|
|
172
|
+
}, W({}, c, u)));
|
|
177
173
|
return O;
|
|
178
174
|
},
|
|
179
|
-
$dispose:
|
|
180
|
-
},
|
|
175
|
+
$dispose: S
|
|
176
|
+
}, v = Ee(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q ? W(
|
|
181
177
|
{
|
|
182
178
|
_hmrPayload: E,
|
|
183
|
-
_customProperties:
|
|
179
|
+
_customProperties: oe(/* @__PURE__ */ new Set())
|
|
184
180
|
// devtools custom properties
|
|
185
181
|
},
|
|
186
|
-
|
|
182
|
+
_
|
|
187
183
|
// must be added later
|
|
188
184
|
// setupStore
|
|
189
|
-
) :
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
for (const
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
195
|
-
process.env.NODE_ENV !== "production" && o ?
|
|
196
|
-
else if (typeof
|
|
197
|
-
const O = process.env.NODE_ENV !== "production" && o ?
|
|
198
|
-
|
|
199
|
-
} else process.env.NODE_ENV !== "production" && Ie(
|
|
185
|
+
) : _);
|
|
186
|
+
r._s.set(n, v);
|
|
187
|
+
const V = (r._a && r._a.runWithContext || Qe)(() => r._e.run(() => (i = Je()).run(() => e({ action: D }))));
|
|
188
|
+
for (const l in V) {
|
|
189
|
+
const u = V[l];
|
|
190
|
+
if (re(u) && !Ie(u) || ye(u))
|
|
191
|
+
process.env.NODE_ENV !== "production" && o ? L.value[l] = se(V, l) : s || (T && et(u) && (re(u) ? u.value = T[l] : Re(u, T[l])), r.state.value[n][l] = u), process.env.NODE_ENV !== "production" && E.state.push(l);
|
|
192
|
+
else if (typeof u == "function") {
|
|
193
|
+
const O = process.env.NODE_ENV !== "production" && o ? u : D(u, l);
|
|
194
|
+
V[l] = O, process.env.NODE_ENV !== "production" && (E.actions[l] = u), a.actions[l] = u;
|
|
195
|
+
} else process.env.NODE_ENV !== "production" && Ie(u) && (E.getters[l] = s ? (
|
|
200
196
|
// @ts-expect-error
|
|
201
|
-
t.getters[
|
|
202
|
-
) :
|
|
203
|
-
(
|
|
197
|
+
t.getters[l]
|
|
198
|
+
) : u, Q && (V._getters || // @ts-expect-error: same
|
|
199
|
+
(V._getters = oe([]))).push(l));
|
|
204
200
|
}
|
|
205
|
-
if (
|
|
206
|
-
get: () => process.env.NODE_ENV !== "production" && o ?
|
|
207
|
-
set: (
|
|
201
|
+
if (W(v, V), W(Le(v), V), Object.defineProperty(v, "$state", {
|
|
202
|
+
get: () => process.env.NODE_ENV !== "production" && o ? L.value : r.state.value[n],
|
|
203
|
+
set: (l) => {
|
|
208
204
|
if (process.env.NODE_ENV !== "production" && o)
|
|
209
205
|
throw new Error("cannot set hotState");
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
I((u) => {
|
|
207
|
+
W(u, l);
|
|
212
208
|
});
|
|
213
209
|
}
|
|
214
|
-
}), process.env.NODE_ENV !== "production" && (
|
|
215
|
-
|
|
216
|
-
if (
|
|
217
|
-
const O =
|
|
218
|
-
typeof O == "object" &&
|
|
210
|
+
}), process.env.NODE_ENV !== "production" && (v._hotUpdate = oe((l) => {
|
|
211
|
+
v._hotUpdating = !0, l._hmrPayload.state.forEach((u) => {
|
|
212
|
+
if (u in v.$state) {
|
|
213
|
+
const O = l.$state[u], m = v.$state[u];
|
|
214
|
+
typeof O == "object" && G(O) && G(m) ? Be(O, m) : l.$state[u] = m;
|
|
219
215
|
}
|
|
220
|
-
|
|
221
|
-
}), Object.keys(
|
|
222
|
-
|
|
223
|
-
}),
|
|
224
|
-
|
|
216
|
+
v[u] = se(l.$state, u);
|
|
217
|
+
}), Object.keys(v.$state).forEach((u) => {
|
|
218
|
+
u in l.$state || delete v[u];
|
|
219
|
+
}), h = !1, g = !1, r.state.value[n] = se(l._hmrPayload, "hotState"), g = !0, le().then(() => {
|
|
220
|
+
h = !0;
|
|
225
221
|
});
|
|
226
|
-
for (const
|
|
227
|
-
const O = u
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
for (const u in l._hmrPayload.actions) {
|
|
223
|
+
const O = l[u];
|
|
224
|
+
v[u] = //
|
|
225
|
+
D(O, u);
|
|
230
226
|
}
|
|
231
|
-
for (const
|
|
232
|
-
const O =
|
|
227
|
+
for (const u in l._hmrPayload.getters) {
|
|
228
|
+
const O = l._hmrPayload.getters[u], m = s ? (
|
|
233
229
|
// special handling of options api
|
|
234
|
-
B(() => (ge(
|
|
230
|
+
B(() => (ge(r), O.call(v, v)))
|
|
235
231
|
) : O;
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
v[u] = //
|
|
233
|
+
m;
|
|
238
234
|
}
|
|
239
|
-
Object.keys(
|
|
240
|
-
|
|
241
|
-
}), Object.keys(
|
|
242
|
-
|
|
243
|
-
}),
|
|
244
|
-
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
245
|
-
const
|
|
235
|
+
Object.keys(v._hmrPayload.getters).forEach((u) => {
|
|
236
|
+
u in l._hmrPayload.getters || delete v[u];
|
|
237
|
+
}), Object.keys(v._hmrPayload.actions).forEach((u) => {
|
|
238
|
+
u in l._hmrPayload.actions || delete v[u];
|
|
239
|
+
}), v._hmrPayload = l._hmrPayload, v._getters = l._getters, v._hotUpdating = !1;
|
|
240
|
+
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
|
|
241
|
+
const l = {
|
|
246
242
|
writable: !0,
|
|
247
243
|
configurable: !0,
|
|
248
244
|
// avoid warning on devtools trying to display this property
|
|
249
245
|
enumerable: !1
|
|
250
246
|
};
|
|
251
|
-
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((
|
|
252
|
-
Object.defineProperty(
|
|
247
|
+
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((u) => {
|
|
248
|
+
Object.defineProperty(v, u, W({ value: v[u] }, l));
|
|
253
249
|
});
|
|
254
250
|
}
|
|
255
|
-
return
|
|
256
|
-
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
257
|
-
const
|
|
258
|
-
store:
|
|
259
|
-
app:
|
|
260
|
-
pinia:
|
|
251
|
+
return r._p.forEach((l) => {
|
|
252
|
+
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
|
|
253
|
+
const u = i.run(() => l({
|
|
254
|
+
store: v,
|
|
255
|
+
app: r._a,
|
|
256
|
+
pinia: r,
|
|
261
257
|
options: a
|
|
262
258
|
}));
|
|
263
|
-
Object.keys(
|
|
259
|
+
Object.keys(u || {}).forEach((O) => v._customProperties.add(O)), W(v, u);
|
|
264
260
|
} else
|
|
265
|
-
|
|
266
|
-
store:
|
|
267
|
-
app:
|
|
268
|
-
pinia:
|
|
261
|
+
W(v, i.run(() => l({
|
|
262
|
+
store: v,
|
|
263
|
+
app: r._a,
|
|
264
|
+
pinia: r,
|
|
269
265
|
options: a
|
|
270
266
|
})));
|
|
271
|
-
}), process.env.NODE_ENV !== "production" &&
|
|
267
|
+
}), process.env.NODE_ENV !== "production" && v.$state && typeof v.$state == "object" && typeof v.$state.constructor == "function" && !v.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
272
268
|
state: () => new MyClass()
|
|
273
|
-
Found in store "${
|
|
269
|
+
Found in store "${v.$id}".`), T && s && t.hydrate && t.hydrate(v.$state, T), h = !0, g = !0, v;
|
|
274
270
|
}
|
|
275
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
276
271
|
// @__NO_SIDE_EFFECTS__
|
|
277
|
-
function tt(
|
|
278
|
-
let
|
|
272
|
+
function tt(n, e, t) {
|
|
273
|
+
let r;
|
|
279
274
|
const o = typeof e == "function";
|
|
280
|
-
|
|
275
|
+
r = o ? t : e;
|
|
281
276
|
function s(i, a) {
|
|
282
|
-
const c =
|
|
277
|
+
const c = we();
|
|
283
278
|
if (i = // in test mode, ignore the argument provided as we can always retrieve a
|
|
284
279
|
// pinia instance with getActivePinia()
|
|
285
|
-
(process.env.NODE_ENV === "test" &&
|
|
280
|
+
(process.env.NODE_ENV === "test" && K && K._testing ? null : i) || (c ? te(Oe, null) : null), i && ge(i), process.env.NODE_ENV !== "production" && !K)
|
|
286
281
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
287
282
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
288
283
|
This will fail in production.`);
|
|
289
|
-
i =
|
|
290
|
-
const
|
|
284
|
+
i = K, i._s.has(n) || (o ? Ne(n, e, r, i) : De(n, r, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
|
|
285
|
+
const h = i._s.get(n);
|
|
291
286
|
if (process.env.NODE_ENV !== "production" && a) {
|
|
292
|
-
const
|
|
293
|
-
a._hotUpdate(w), delete i.state.value[
|
|
287
|
+
const g = "__hot:" + n, w = o ? Ne(g, e, r, i, !0) : De(g, W({}, r), i, !0);
|
|
288
|
+
a._hotUpdate(w), delete i.state.value[g], i._s.delete(g);
|
|
294
289
|
}
|
|
295
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
290
|
+
if (process.env.NODE_ENV !== "production" && Q) {
|
|
291
|
+
const g = Fe();
|
|
292
|
+
if (g && g.proxy && // avoid adding stores that are just built for hot module replacement
|
|
298
293
|
!a) {
|
|
299
|
-
const w =
|
|
300
|
-
|
|
294
|
+
const w = g.proxy, R = "_pStores" in w ? w._pStores : w._pStores = {};
|
|
295
|
+
R[n] = h;
|
|
301
296
|
}
|
|
302
297
|
}
|
|
303
|
-
return
|
|
298
|
+
return h;
|
|
304
299
|
}
|
|
305
|
-
return s.$id =
|
|
300
|
+
return s.$id = n, s;
|
|
306
301
|
}
|
|
307
|
-
function
|
|
308
|
-
const e =
|
|
309
|
-
for (const
|
|
310
|
-
const o = e[
|
|
311
|
-
o.effect ? t[
|
|
302
|
+
function We(n) {
|
|
303
|
+
const e = Le(n), t = {};
|
|
304
|
+
for (const r in e) {
|
|
305
|
+
const o = e[r];
|
|
306
|
+
o.effect ? t[r] = // ...
|
|
312
307
|
B({
|
|
313
|
-
get: () => r
|
|
308
|
+
get: () => n[r],
|
|
314
309
|
set(s) {
|
|
315
|
-
r
|
|
310
|
+
n[r] = s;
|
|
316
311
|
}
|
|
317
|
-
}) : (
|
|
318
|
-
|
|
312
|
+
}) : (re(o) || ye(o)) && (t[r] = // ---
|
|
313
|
+
se(n, r));
|
|
319
314
|
}
|
|
320
315
|
return t;
|
|
321
316
|
}
|
|
322
|
-
|
|
323
|
-
return Fe() ? (ke(r, e), !0) : !1;
|
|
324
|
-
}
|
|
325
|
-
const nt = typeof window < "u" && typeof document < "u";
|
|
317
|
+
const rt = typeof window < "u" && typeof document < "u";
|
|
326
318
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
327
|
-
const
|
|
319
|
+
const nt = Object.prototype.toString, ot = (n) => nt.call(n) === "[object Object]", Ue = () => {
|
|
328
320
|
};
|
|
329
|
-
function
|
|
330
|
-
if (
|
|
331
|
-
const e =
|
|
321
|
+
function st(...n) {
|
|
322
|
+
if (n.length !== 1) return se(...n);
|
|
323
|
+
const e = n[0];
|
|
332
324
|
return typeof e == "function" ? Me(Ge(() => ({
|
|
333
325
|
get: e,
|
|
334
|
-
set:
|
|
326
|
+
set: Ue
|
|
335
327
|
}))) : M(e);
|
|
336
328
|
}
|
|
337
|
-
function
|
|
338
|
-
function t(...
|
|
329
|
+
function it(n, e) {
|
|
330
|
+
function t(...r) {
|
|
339
331
|
return new Promise((o, s) => {
|
|
340
|
-
Promise.resolve(
|
|
332
|
+
Promise.resolve(n(() => e.apply(this, r), {
|
|
341
333
|
fn: e,
|
|
342
334
|
thisArg: this,
|
|
343
|
-
args:
|
|
335
|
+
args: r
|
|
344
336
|
})).then(o).catch(s);
|
|
345
337
|
});
|
|
346
338
|
}
|
|
347
339
|
return t;
|
|
348
340
|
}
|
|
349
|
-
const ze = (
|
|
350
|
-
function
|
|
351
|
-
const { initialState: t = "active" } = e,
|
|
341
|
+
const ze = (n) => n();
|
|
342
|
+
function at(n = ze, e = {}) {
|
|
343
|
+
const { initialState: t = "active" } = e, r = st(t === "active");
|
|
352
344
|
function o() {
|
|
353
|
-
|
|
345
|
+
r.value = !1;
|
|
354
346
|
}
|
|
355
347
|
function s() {
|
|
356
|
-
|
|
348
|
+
r.value = !0;
|
|
357
349
|
}
|
|
358
350
|
const i = (...a) => {
|
|
359
|
-
|
|
351
|
+
r.value && n(...a);
|
|
360
352
|
};
|
|
361
353
|
return {
|
|
362
|
-
isActive: Me(
|
|
354
|
+
isActive: Me(r),
|
|
363
355
|
pause: o,
|
|
364
356
|
resume: s,
|
|
365
357
|
eventFilter: i
|
|
366
358
|
};
|
|
367
359
|
}
|
|
368
|
-
function
|
|
369
|
-
return Array.isArray(
|
|
360
|
+
function be(n) {
|
|
361
|
+
return Array.isArray(n) ? n : [n];
|
|
370
362
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
363
|
+
function ct(n) {
|
|
364
|
+
return Fe();
|
|
373
365
|
}
|
|
374
|
-
function lt(
|
|
375
|
-
const { eventFilter:
|
|
376
|
-
return H(
|
|
366
|
+
function lt(n, e, t = {}) {
|
|
367
|
+
const { eventFilter: r = ze, ...o } = t;
|
|
368
|
+
return H(n, it(r, e), o);
|
|
377
369
|
}
|
|
378
|
-
function
|
|
379
|
-
const { eventFilter:
|
|
370
|
+
function ut(n, e, t = {}) {
|
|
371
|
+
const { eventFilter: r, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: h } = at(r, { initialState: o });
|
|
380
372
|
return {
|
|
381
|
-
stop: lt(
|
|
373
|
+
stop: lt(n, e, {
|
|
382
374
|
...s,
|
|
383
375
|
eventFilter: i
|
|
384
376
|
}),
|
|
385
377
|
pause: a,
|
|
386
378
|
resume: c,
|
|
387
|
-
isActive:
|
|
379
|
+
isActive: h
|
|
388
380
|
};
|
|
389
381
|
}
|
|
390
|
-
const
|
|
391
|
-
function
|
|
392
|
-
|
|
382
|
+
const ft = ut;
|
|
383
|
+
function dt(n, e = !0, t) {
|
|
384
|
+
ct() ? Ve(n, t) : e ? n() : le(n);
|
|
393
385
|
}
|
|
394
|
-
function
|
|
395
|
-
return H(
|
|
386
|
+
function pt(n, e, t) {
|
|
387
|
+
return H(n, e, {
|
|
396
388
|
...t,
|
|
397
389
|
immediate: !0
|
|
398
390
|
});
|
|
399
391
|
}
|
|
400
|
-
function
|
|
401
|
-
return H(
|
|
392
|
+
function ne(n, e, t) {
|
|
393
|
+
return H(n, (o, s, i) => {
|
|
402
394
|
o && e(o, s, i);
|
|
403
395
|
}, {
|
|
404
396
|
...t,
|
|
405
397
|
once: !1
|
|
406
398
|
});
|
|
407
399
|
}
|
|
408
|
-
const
|
|
409
|
-
function
|
|
400
|
+
const Z = rt ? window : void 0;
|
|
401
|
+
function ht(n) {
|
|
410
402
|
var e;
|
|
411
|
-
const t =
|
|
403
|
+
const t = q(n);
|
|
412
404
|
return (e = t?.$el) !== null && e !== void 0 ? e : t;
|
|
413
405
|
}
|
|
414
|
-
function
|
|
415
|
-
const e =
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
var a, c;
|
|
406
|
+
function X(...n) {
|
|
407
|
+
const e = (r, o, s, i) => (r.addEventListener(o, s, i), () => r.removeEventListener(o, s, i)), t = B(() => {
|
|
408
|
+
const r = be(q(n[0])).filter((o) => o != null);
|
|
409
|
+
return r.every((o) => typeof o != "string") ? r : void 0;
|
|
410
|
+
});
|
|
411
|
+
return pt(() => {
|
|
412
|
+
var r, o;
|
|
422
413
|
return [
|
|
423
|
-
(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
414
|
+
(r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) => ht(s))) !== null && r !== void 0 ? r : [Z].filter((s) => s != null),
|
|
415
|
+
be(q(t.value ? n[1] : n[0])),
|
|
416
|
+
be(Ye(t.value ? n[2] : n[1])),
|
|
417
|
+
q(t.value ? n[3] : n[2])
|
|
427
418
|
];
|
|
428
|
-
}, ([
|
|
429
|
-
if (
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
};
|
|
435
|
-
return rt(t), i;
|
|
419
|
+
}, ([r, o, s, i], a, c) => {
|
|
420
|
+
if (!r?.length || !o?.length || !s?.length) return;
|
|
421
|
+
const h = ot(i) ? { ...i } : i, g = r.flatMap((w) => o.flatMap((R) => s.map(($) => e(w, R, $, h))));
|
|
422
|
+
c(() => {
|
|
423
|
+
g.forEach((w) => w());
|
|
424
|
+
});
|
|
425
|
+
}, { flush: "post" });
|
|
436
426
|
}
|
|
437
|
-
const
|
|
438
|
-
function
|
|
439
|
-
return
|
|
427
|
+
const fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, de = "__vueuse_ssr_handlers__", gt = /* @__PURE__ */ vt();
|
|
428
|
+
function vt() {
|
|
429
|
+
return de in fe || (fe[de] = fe[de] || {}), fe[de];
|
|
440
430
|
}
|
|
441
|
-
function
|
|
442
|
-
return
|
|
431
|
+
function yt(n, e) {
|
|
432
|
+
return gt[n] || e;
|
|
443
433
|
}
|
|
444
|
-
function
|
|
445
|
-
return
|
|
434
|
+
function mt(n) {
|
|
435
|
+
return n == null ? "any" : n instanceof Set ? "set" : n instanceof Map ? "map" : n instanceof Date ? "date" : typeof n == "boolean" ? "boolean" : typeof n == "string" ? "string" : typeof n == "object" ? "object" : Number.isNaN(n) ? "any" : "number";
|
|
446
436
|
}
|
|
447
437
|
const bt = {
|
|
448
438
|
boolean: {
|
|
449
|
-
read: (
|
|
450
|
-
write: (
|
|
439
|
+
read: (n) => n === "true",
|
|
440
|
+
write: (n) => String(n)
|
|
451
441
|
},
|
|
452
442
|
object: {
|
|
453
|
-
read: (
|
|
454
|
-
write: (
|
|
443
|
+
read: (n) => JSON.parse(n),
|
|
444
|
+
write: (n) => JSON.stringify(n)
|
|
455
445
|
},
|
|
456
446
|
number: {
|
|
457
|
-
read: (
|
|
458
|
-
write: (
|
|
447
|
+
read: (n) => Number.parseFloat(n),
|
|
448
|
+
write: (n) => String(n)
|
|
459
449
|
},
|
|
460
450
|
any: {
|
|
461
|
-
read: (
|
|
462
|
-
write: (
|
|
451
|
+
read: (n) => n,
|
|
452
|
+
write: (n) => String(n)
|
|
463
453
|
},
|
|
464
454
|
string: {
|
|
465
|
-
read: (
|
|
466
|
-
write: (
|
|
455
|
+
read: (n) => n,
|
|
456
|
+
write: (n) => String(n)
|
|
467
457
|
},
|
|
468
458
|
map: {
|
|
469
|
-
read: (
|
|
470
|
-
write: (
|
|
459
|
+
read: (n) => new Map(JSON.parse(n)),
|
|
460
|
+
write: (n) => JSON.stringify(Array.from(n.entries()))
|
|
471
461
|
},
|
|
472
462
|
set: {
|
|
473
|
-
read: (
|
|
474
|
-
write: (
|
|
463
|
+
read: (n) => new Set(JSON.parse(n)),
|
|
464
|
+
write: (n) => JSON.stringify(Array.from(n))
|
|
475
465
|
},
|
|
476
466
|
date: {
|
|
477
|
-
read: (
|
|
478
|
-
write: (
|
|
467
|
+
read: (n) => new Date(n),
|
|
468
|
+
write: (n) => n.toISOString()
|
|
479
469
|
}
|
|
480
|
-
},
|
|
481
|
-
function
|
|
470
|
+
}, Te = "vueuse-storage";
|
|
471
|
+
function St(n, e, t, r = {}) {
|
|
482
472
|
var o;
|
|
483
|
-
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults:
|
|
484
|
-
console.error(
|
|
485
|
-
}, initOnMounted: T } =
|
|
473
|
+
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: h = !1, shallow: g, window: w = Z, eventFilter: R, onError: $ = (f) => {
|
|
474
|
+
console.error(f);
|
|
475
|
+
}, initOnMounted: T } = r, L = (g ? xe : M)(e), P = B(() => q(n));
|
|
486
476
|
if (!t) try {
|
|
487
|
-
t =
|
|
488
|
-
} catch (
|
|
489
|
-
$(
|
|
477
|
+
t = yt("getDefaultStorage", () => Z?.localStorage)();
|
|
478
|
+
} catch (f) {
|
|
479
|
+
$(f);
|
|
490
480
|
}
|
|
491
|
-
if (!t) return
|
|
492
|
-
const
|
|
481
|
+
if (!t) return L;
|
|
482
|
+
const I = q(e), N = mt(I), S = (o = r.serializer) !== null && o !== void 0 ? o : bt[N], { pause: D, resume: E } = ft(L, (f) => l(f), {
|
|
493
483
|
flush: s,
|
|
494
484
|
deep: i,
|
|
495
|
-
eventFilter:
|
|
485
|
+
eventFilter: R
|
|
496
486
|
});
|
|
497
|
-
H(
|
|
498
|
-
let
|
|
499
|
-
const
|
|
500
|
-
T && !
|
|
501
|
-
}, x = (
|
|
502
|
-
T && !
|
|
487
|
+
H(P, () => O(), { flush: s });
|
|
488
|
+
let _ = !1;
|
|
489
|
+
const v = (f) => {
|
|
490
|
+
T && !_ || O(f);
|
|
491
|
+
}, x = (f) => {
|
|
492
|
+
T && !_ || m(f);
|
|
503
493
|
};
|
|
504
|
-
w && a && (t instanceof Storage ?
|
|
505
|
-
|
|
494
|
+
w && a && (t instanceof Storage ? X(w, "storage", v, { passive: !0 }) : X(w, Te, x)), T ? dt(() => {
|
|
495
|
+
_ = !0, O();
|
|
506
496
|
}) : O();
|
|
507
|
-
function
|
|
497
|
+
function V(f, b) {
|
|
508
498
|
if (w) {
|
|
509
|
-
const
|
|
510
|
-
key:
|
|
511
|
-
oldValue:
|
|
512
|
-
newValue:
|
|
499
|
+
const A = {
|
|
500
|
+
key: P.value,
|
|
501
|
+
oldValue: f,
|
|
502
|
+
newValue: b,
|
|
513
503
|
storageArea: t
|
|
514
504
|
};
|
|
515
|
-
w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage",
|
|
505
|
+
w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", A) : new CustomEvent(Te, { detail: A }));
|
|
516
506
|
}
|
|
517
507
|
}
|
|
518
|
-
function
|
|
508
|
+
function l(f) {
|
|
519
509
|
try {
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
|
|
510
|
+
const b = t.getItem(P.value);
|
|
511
|
+
if (f == null)
|
|
512
|
+
V(b, null), t.removeItem(P.value);
|
|
523
513
|
else {
|
|
524
|
-
const
|
|
525
|
-
|
|
514
|
+
const A = S.write(f);
|
|
515
|
+
b !== A && (t.setItem(P.value, A), V(b, A));
|
|
526
516
|
}
|
|
527
|
-
} catch (
|
|
528
|
-
$(
|
|
517
|
+
} catch (b) {
|
|
518
|
+
$(b);
|
|
529
519
|
}
|
|
530
520
|
}
|
|
531
|
-
function f
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
return c &&
|
|
535
|
-
if (!
|
|
536
|
-
const
|
|
537
|
-
return typeof
|
|
538
|
-
...
|
|
539
|
-
...
|
|
540
|
-
} :
|
|
541
|
-
} else return typeof
|
|
542
|
-
}
|
|
543
|
-
function O(
|
|
544
|
-
if (!(
|
|
545
|
-
if (
|
|
546
|
-
|
|
521
|
+
function u(f) {
|
|
522
|
+
const b = f ? f.newValue : t.getItem(P.value);
|
|
523
|
+
if (b == null)
|
|
524
|
+
return c && I != null && t.setItem(P.value, S.write(I)), I;
|
|
525
|
+
if (!f && h) {
|
|
526
|
+
const A = S.read(b);
|
|
527
|
+
return typeof h == "function" ? h(A, I) : N === "object" && !Array.isArray(A) ? {
|
|
528
|
+
...I,
|
|
529
|
+
...A
|
|
530
|
+
} : A;
|
|
531
|
+
} else return typeof b != "string" ? b : S.read(b);
|
|
532
|
+
}
|
|
533
|
+
function O(f) {
|
|
534
|
+
if (!(f && f.storageArea !== t)) {
|
|
535
|
+
if (f && f.key == null) {
|
|
536
|
+
L.value = I;
|
|
547
537
|
return;
|
|
548
538
|
}
|
|
549
|
-
if (!(
|
|
550
|
-
|
|
539
|
+
if (!(f && f.key !== P.value)) {
|
|
540
|
+
D();
|
|
551
541
|
try {
|
|
552
|
-
const
|
|
553
|
-
(
|
|
554
|
-
} catch (
|
|
555
|
-
$(
|
|
542
|
+
const b = S.write(L.value);
|
|
543
|
+
(f === void 0 || f?.newValue !== b) && (L.value = u(f));
|
|
544
|
+
} catch (b) {
|
|
545
|
+
$(b);
|
|
556
546
|
} finally {
|
|
557
|
-
|
|
547
|
+
f ? le(E) : E();
|
|
558
548
|
}
|
|
559
549
|
}
|
|
560
550
|
}
|
|
561
551
|
}
|
|
562
|
-
function
|
|
563
|
-
O(
|
|
552
|
+
function m(f) {
|
|
553
|
+
O(f.detail);
|
|
564
554
|
}
|
|
565
|
-
return
|
|
555
|
+
return L;
|
|
566
556
|
}
|
|
567
|
-
function
|
|
568
|
-
const { window:
|
|
569
|
-
return
|
|
557
|
+
function wt(n, e, t = {}) {
|
|
558
|
+
const { window: r = Z } = t;
|
|
559
|
+
return St(n, e, r?.localStorage, t);
|
|
570
560
|
}
|
|
571
|
-
const
|
|
561
|
+
const Et = {
|
|
572
562
|
ctrl: "control",
|
|
573
563
|
command: "meta",
|
|
574
564
|
cmd: "meta",
|
|
@@ -578,142 +568,144 @@ const Ot = {
|
|
|
578
568
|
left: "arrowleft",
|
|
579
569
|
right: "arrowright"
|
|
580
570
|
};
|
|
581
|
-
function
|
|
582
|
-
const { reactive: e = !1, target: t =
|
|
571
|
+
function Ot(n = {}) {
|
|
572
|
+
const { reactive: e = !1, target: t = Z, aliasMap: r = Et, passive: o = !0, onEventFired: s = Ue } = n, i = Ee(/* @__PURE__ */ new Set()), a = {
|
|
583
573
|
toJSON() {
|
|
584
574
|
return {};
|
|
585
575
|
},
|
|
586
576
|
current: i
|
|
587
|
-
}, c = e ?
|
|
588
|
-
["Meta",
|
|
577
|
+
}, c = e ? Ee(a) : a, h = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map([
|
|
578
|
+
["Meta", h],
|
|
589
579
|
["Shift", /* @__PURE__ */ new Set()],
|
|
590
580
|
["Alt", /* @__PURE__ */ new Set()]
|
|
591
581
|
]), w = /* @__PURE__ */ new Set();
|
|
592
|
-
function
|
|
593
|
-
|
|
582
|
+
function R(N, S) {
|
|
583
|
+
N in c && (e ? c[N] = S : c[N].value = S);
|
|
594
584
|
}
|
|
595
585
|
function $() {
|
|
596
586
|
i.clear();
|
|
597
|
-
for (const
|
|
587
|
+
for (const N of w) R(N, !1);
|
|
598
588
|
}
|
|
599
|
-
function T(
|
|
600
|
-
if (!(!
|
|
601
|
-
for (const [E,
|
|
602
|
-
|
|
589
|
+
function T(N, S, D) {
|
|
590
|
+
if (!(!N || typeof S.getModifierState != "function")) {
|
|
591
|
+
for (const [E, _] of g) if (S.getModifierState(E)) {
|
|
592
|
+
D.forEach((v) => _.add(v));
|
|
603
593
|
break;
|
|
604
594
|
}
|
|
605
595
|
}
|
|
606
596
|
}
|
|
607
|
-
function
|
|
608
|
-
if (
|
|
609
|
-
const
|
|
610
|
-
if (!["shift", "alt"].includes(
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
597
|
+
function L(N, S) {
|
|
598
|
+
if (N) return;
|
|
599
|
+
const D = `${S[0].toUpperCase()}${S.slice(1)}`, E = g.get(D);
|
|
600
|
+
if (!["shift", "alt"].includes(S) || !E) return;
|
|
601
|
+
const _ = Array.from(E), v = _.indexOf(S);
|
|
602
|
+
_.forEach((x, V) => {
|
|
603
|
+
V >= v && (i.delete(x), R(x, !1));
|
|
614
604
|
}), E.clear();
|
|
615
605
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
i
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
606
|
+
function P(N, S) {
|
|
607
|
+
var D, E;
|
|
608
|
+
const _ = (D = N.key) === null || D === void 0 ? void 0 : D.toLowerCase(), v = [(E = N.code) === null || E === void 0 ? void 0 : E.toLowerCase(), _].filter(Boolean);
|
|
609
|
+
if (_ !== "") {
|
|
610
|
+
_ && (S ? i.add(_) : i.delete(_));
|
|
611
|
+
for (const x of v)
|
|
612
|
+
w.add(x), R(x, S);
|
|
613
|
+
T(S, N, [...i, ...v]), L(S, _), _ === "meta" && !S && (h.forEach((x) => {
|
|
614
|
+
i.delete(x), R(x, !1);
|
|
615
|
+
}), h.clear());
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
X(t, "keydown", (N) => (P(N, !0), s(N)), { passive: o }), X(t, "keyup", (N) => (P(N, !1), s(N)), { passive: o }), X("blur", $, { passive: o }), X("focus", $, { passive: o });
|
|
619
|
+
const I = new Proxy(c, { get(N, S, D) {
|
|
620
|
+
if (typeof S != "string") return Reflect.get(N, S, D);
|
|
621
|
+
if (S = S.toLowerCase(), S in r && (S = r[S]), !(S in c)) if (/[+_-]/.test(S)) {
|
|
622
|
+
const _ = S.split(/[+_-]/g).map((v) => v.trim());
|
|
623
|
+
c[S] = B(() => _.map((v) => q(I[v])).every(Boolean));
|
|
624
|
+
} else c[S] = xe(!1);
|
|
625
|
+
const E = Reflect.get(N, S, D);
|
|
626
|
+
return e ? q(E) : E;
|
|
635
627
|
} });
|
|
636
|
-
return
|
|
628
|
+
return I;
|
|
637
629
|
}
|
|
638
|
-
function
|
|
630
|
+
function Se() {
|
|
639
631
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
640
632
|
}
|
|
641
|
-
function
|
|
633
|
+
function pe(n) {
|
|
642
634
|
const e = {
|
|
643
|
-
type:
|
|
644
|
-
clientId:
|
|
645
|
-
timestamp:
|
|
635
|
+
type: n.type,
|
|
636
|
+
clientId: n.clientId,
|
|
637
|
+
timestamp: n.timestamp.toISOString()
|
|
646
638
|
};
|
|
647
|
-
return
|
|
648
|
-
...
|
|
649
|
-
timestamp:
|
|
650
|
-
}),
|
|
639
|
+
return n.operation && (e.operation = {
|
|
640
|
+
...n.operation,
|
|
641
|
+
timestamp: n.operation.timestamp.toISOString()
|
|
642
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
651
643
|
...t,
|
|
652
644
|
timestamp: t.timestamp.toISOString()
|
|
653
645
|
}))), e;
|
|
654
646
|
}
|
|
655
|
-
function
|
|
647
|
+
function Rt(n) {
|
|
656
648
|
const e = {
|
|
657
|
-
type:
|
|
658
|
-
clientId:
|
|
659
|
-
timestamp: new Date(
|
|
649
|
+
type: n.type,
|
|
650
|
+
clientId: n.clientId,
|
|
651
|
+
timestamp: new Date(n.timestamp)
|
|
660
652
|
};
|
|
661
|
-
return
|
|
662
|
-
...
|
|
663
|
-
timestamp: new Date(
|
|
664
|
-
}),
|
|
653
|
+
return n.operation && (e.operation = {
|
|
654
|
+
...n.operation,
|
|
655
|
+
timestamp: new Date(n.operation.timestamp)
|
|
656
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
665
657
|
...t,
|
|
666
658
|
timestamp: new Date(t.timestamp)
|
|
667
659
|
}))), e;
|
|
668
660
|
}
|
|
669
661
|
const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
670
|
-
const
|
|
662
|
+
const n = M({
|
|
671
663
|
maxOperations: 100,
|
|
672
664
|
enableCrossTabSync: !0,
|
|
673
665
|
autoSyncInterval: 3e4,
|
|
674
666
|
enablePersistence: !1,
|
|
675
667
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
676
|
-
}), e = M([]), t = M(-1),
|
|
677
|
-
let
|
|
678
|
-
for (let
|
|
679
|
-
|
|
680
|
-
return
|
|
681
|
-
}),
|
|
668
|
+
}), e = M([]), t = M(-1), r = M(Se()), o = M(!1), s = M([]), i = M(null), a = B(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = B(() => t.value < e.value.length - 1), h = B(() => {
|
|
669
|
+
let d = 0;
|
|
670
|
+
for (let p = t.value; p >= 0 && e.value[p]?.reversible; p--)
|
|
671
|
+
d++;
|
|
672
|
+
return d;
|
|
673
|
+
}), g = B(() => e.value.length - 1 - t.value), w = B(() => ({
|
|
682
674
|
canUndo: a.value,
|
|
683
675
|
canRedo: c.value,
|
|
684
|
-
undoCount:
|
|
685
|
-
redoCount:
|
|
676
|
+
undoCount: h.value,
|
|
677
|
+
redoCount: g.value,
|
|
686
678
|
currentIndex: t.value
|
|
687
679
|
}));
|
|
688
|
-
function
|
|
689
|
-
|
|
680
|
+
function R(d) {
|
|
681
|
+
n.value = { ...n.value, ...d }, n.value.enablePersistence && (C(), k()), n.value.enableCrossTabSync && u();
|
|
690
682
|
}
|
|
691
|
-
function $(
|
|
692
|
-
const
|
|
693
|
-
...
|
|
694
|
-
id:
|
|
683
|
+
function $(d, p = "user") {
|
|
684
|
+
const y = {
|
|
685
|
+
...d,
|
|
686
|
+
id: Se(),
|
|
695
687
|
timestamp: /* @__PURE__ */ new Date(),
|
|
696
|
-
source:
|
|
697
|
-
userId:
|
|
688
|
+
source: p,
|
|
689
|
+
userId: n.value.userId
|
|
698
690
|
};
|
|
699
|
-
if (
|
|
700
|
-
return
|
|
691
|
+
if (n.value.operationFilter && !n.value.operationFilter(y))
|
|
692
|
+
return y.id;
|
|
701
693
|
if (o.value)
|
|
702
|
-
return s.value.push(
|
|
703
|
-
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(
|
|
704
|
-
const F = e.value.length -
|
|
694
|
+
return s.value.push(y), y.id;
|
|
695
|
+
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(y), t.value++, n.value.maxOperations && e.value.length > n.value.maxOperations) {
|
|
696
|
+
const F = e.value.length - n.value.maxOperations;
|
|
705
697
|
e.value = e.value.slice(F), t.value -= F;
|
|
706
698
|
}
|
|
707
|
-
return
|
|
699
|
+
return n.value.enableCrossTabSync && O(y), y.id;
|
|
708
700
|
}
|
|
709
701
|
function T() {
|
|
710
|
-
o.value = !0, s.value = [], i.value =
|
|
702
|
+
o.value = !0, s.value = [], i.value = Se();
|
|
711
703
|
}
|
|
712
|
-
function
|
|
704
|
+
function L(d) {
|
|
713
705
|
if (!o.value || s.value.length === 0)
|
|
714
706
|
return o.value = !1, s.value = [], i.value = null, null;
|
|
715
|
-
const
|
|
716
|
-
id:
|
|
707
|
+
const p = i.value, y = s.value.every((U) => U.reversible), F = {
|
|
708
|
+
id: p,
|
|
717
709
|
type: "batch",
|
|
718
710
|
path: "",
|
|
719
711
|
// Batch doesn't have a single path
|
|
@@ -723,192 +715,192 @@ const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
723
715
|
doctype: s.value[0]?.doctype || "",
|
|
724
716
|
timestamp: /* @__PURE__ */ new Date(),
|
|
725
717
|
source: "user",
|
|
726
|
-
reversible:
|
|
727
|
-
irreversibleReason:
|
|
728
|
-
childOperationIds: s.value.map((
|
|
729
|
-
metadata: { description:
|
|
718
|
+
reversible: y,
|
|
719
|
+
irreversibleReason: y ? void 0 : "Contains irreversible operations",
|
|
720
|
+
childOperationIds: s.value.map((U) => U.id),
|
|
721
|
+
metadata: { description: d }
|
|
730
722
|
};
|
|
731
|
-
s.value.forEach((
|
|
732
|
-
|
|
733
|
-
}), e.value.push(...s.value, F), t.value = e.value.length - 1,
|
|
734
|
-
const z =
|
|
723
|
+
s.value.forEach((U) => {
|
|
724
|
+
U.parentOperationId = p;
|
|
725
|
+
}), e.value.push(...s.value, F), t.value = e.value.length - 1, n.value.enableCrossTabSync && m(s.value, F);
|
|
726
|
+
const z = p;
|
|
735
727
|
return o.value = !1, s.value = [], i.value = null, z;
|
|
736
728
|
}
|
|
737
|
-
function
|
|
729
|
+
function P() {
|
|
738
730
|
o.value = !1, s.value = [], i.value = null;
|
|
739
731
|
}
|
|
740
|
-
function
|
|
732
|
+
function I(d) {
|
|
741
733
|
if (!a.value) return !1;
|
|
742
|
-
const
|
|
743
|
-
if (!
|
|
744
|
-
return typeof console < "u" &&
|
|
734
|
+
const p = e.value[t.value];
|
|
735
|
+
if (!p.reversible)
|
|
736
|
+
return typeof console < "u" && p.irreversibleReason && console.warn("Cannot undo irreversible operation:", p.irreversibleReason), !1;
|
|
745
737
|
try {
|
|
746
|
-
if (
|
|
747
|
-
for (let
|
|
748
|
-
const F =
|
|
749
|
-
z &&
|
|
738
|
+
if (p.type === "batch" && p.childOperationIds)
|
|
739
|
+
for (let y = p.childOperationIds.length - 1; y >= 0; y--) {
|
|
740
|
+
const F = p.childOperationIds[y], z = e.value.find((U) => U.id === F);
|
|
741
|
+
z && S(z, d);
|
|
750
742
|
}
|
|
751
743
|
else
|
|
752
|
-
|
|
753
|
-
return t.value--,
|
|
754
|
-
} catch (
|
|
755
|
-
return typeof console < "u" && console.error("Undo failed:",
|
|
744
|
+
S(p, d);
|
|
745
|
+
return t.value--, n.value.enableCrossTabSync && f(p), !0;
|
|
746
|
+
} catch (y) {
|
|
747
|
+
return typeof console < "u" && console.error("Undo failed:", y), !1;
|
|
756
748
|
}
|
|
757
749
|
}
|
|
758
|
-
function
|
|
750
|
+
function N(d) {
|
|
759
751
|
if (!c.value) return !1;
|
|
760
|
-
const
|
|
752
|
+
const p = e.value[t.value + 1];
|
|
761
753
|
try {
|
|
762
|
-
if (
|
|
763
|
-
for (const
|
|
764
|
-
const F = e.value.find((z) => z.id ===
|
|
765
|
-
F &&
|
|
754
|
+
if (p.type === "batch" && p.childOperationIds)
|
|
755
|
+
for (const y of p.childOperationIds) {
|
|
756
|
+
const F = e.value.find((z) => z.id === y);
|
|
757
|
+
F && D(F, d);
|
|
766
758
|
}
|
|
767
759
|
else
|
|
768
|
-
|
|
769
|
-
return t.value++,
|
|
770
|
-
} catch (
|
|
771
|
-
return typeof console < "u" && console.error("Redo failed:",
|
|
760
|
+
D(p, d);
|
|
761
|
+
return t.value++, n.value.enableCrossTabSync && b(p), !0;
|
|
762
|
+
} catch (y) {
|
|
763
|
+
return typeof console < "u" && console.error("Redo failed:", y), !1;
|
|
772
764
|
}
|
|
773
765
|
}
|
|
774
|
-
function
|
|
775
|
-
(
|
|
766
|
+
function S(d, p) {
|
|
767
|
+
(d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.beforeValue, "undo");
|
|
776
768
|
}
|
|
777
|
-
function
|
|
778
|
-
(
|
|
769
|
+
function D(d, p) {
|
|
770
|
+
(d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.afterValue, "redo");
|
|
779
771
|
}
|
|
780
772
|
function E() {
|
|
781
|
-
const
|
|
773
|
+
const d = e.value.filter((y) => y.reversible).length, p = e.value.map((y) => y.timestamp);
|
|
782
774
|
return {
|
|
783
775
|
operations: [...e.value],
|
|
784
776
|
currentIndex: t.value,
|
|
785
777
|
totalOperations: e.value.length,
|
|
786
|
-
reversibleOperations:
|
|
787
|
-
irreversibleOperations: e.value.length -
|
|
788
|
-
oldestOperation:
|
|
789
|
-
newestOperation:
|
|
778
|
+
reversibleOperations: d,
|
|
779
|
+
irreversibleOperations: e.value.length - d,
|
|
780
|
+
oldestOperation: p.length > 0 ? new Date(Math.min(...p.map((y) => y.getTime()))) : void 0,
|
|
781
|
+
newestOperation: p.length > 0 ? new Date(Math.max(...p.map((y) => y.getTime()))) : void 0
|
|
790
782
|
};
|
|
791
783
|
}
|
|
792
|
-
function
|
|
784
|
+
function _() {
|
|
793
785
|
e.value = [], t.value = -1;
|
|
794
786
|
}
|
|
795
|
-
function
|
|
796
|
-
return e.value.filter((
|
|
787
|
+
function v(d, p) {
|
|
788
|
+
return e.value.filter((y) => y.doctype === d && (p === void 0 || y.recordId === p));
|
|
797
789
|
}
|
|
798
|
-
function x(
|
|
799
|
-
const
|
|
800
|
-
|
|
790
|
+
function x(d, p) {
|
|
791
|
+
const y = e.value.find((F) => F.id === d);
|
|
792
|
+
y && (y.reversible = !1, y.irreversibleReason = p);
|
|
801
793
|
}
|
|
802
|
-
function
|
|
803
|
-
const
|
|
794
|
+
function V(d, p, y, F = "success", z) {
|
|
795
|
+
const U = {
|
|
804
796
|
type: "action",
|
|
805
|
-
path:
|
|
797
|
+
path: y && y.length > 0 ? `${d}.${y[0]}` : d,
|
|
806
798
|
fieldname: "",
|
|
807
799
|
beforeValue: null,
|
|
808
800
|
afterValue: null,
|
|
809
|
-
doctype:
|
|
810
|
-
recordId:
|
|
801
|
+
doctype: d,
|
|
802
|
+
recordId: y && y.length > 0 ? y[0] : void 0,
|
|
811
803
|
reversible: !1,
|
|
812
804
|
// Actions are typically not reversible
|
|
813
|
-
actionName:
|
|
814
|
-
actionRecordIds:
|
|
805
|
+
actionName: p,
|
|
806
|
+
actionRecordIds: y,
|
|
815
807
|
actionResult: F,
|
|
816
808
|
actionError: z
|
|
817
809
|
};
|
|
818
|
-
return $(
|
|
819
|
-
}
|
|
820
|
-
let
|
|
821
|
-
function
|
|
822
|
-
typeof window > "u" || !window.BroadcastChannel || (
|
|
823
|
-
const
|
|
824
|
-
if (!
|
|
825
|
-
const
|
|
826
|
-
|
|
810
|
+
return $(U);
|
|
811
|
+
}
|
|
812
|
+
let l = null;
|
|
813
|
+
function u() {
|
|
814
|
+
typeof window > "u" || !window.BroadcastChannel || (l = new BroadcastChannel("stonecrop-operation-log"), l.addEventListener("message", (d) => {
|
|
815
|
+
const p = d.data;
|
|
816
|
+
if (!p || typeof p != "object") return;
|
|
817
|
+
const y = Rt(p);
|
|
818
|
+
y.clientId !== r.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), t.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((F) => ({ ...F, source: "sync" }))), t.value = e.value.length - 1));
|
|
827
819
|
}));
|
|
828
820
|
}
|
|
829
|
-
function O(
|
|
830
|
-
if (!
|
|
831
|
-
const
|
|
821
|
+
function O(d) {
|
|
822
|
+
if (!l) return;
|
|
823
|
+
const p = {
|
|
832
824
|
type: "operation",
|
|
833
|
-
operation:
|
|
834
|
-
clientId:
|
|
825
|
+
operation: d,
|
|
826
|
+
clientId: r.value,
|
|
835
827
|
timestamp: /* @__PURE__ */ new Date()
|
|
836
828
|
};
|
|
837
|
-
|
|
829
|
+
l.postMessage(pe(p));
|
|
838
830
|
}
|
|
839
|
-
function
|
|
840
|
-
if (!
|
|
841
|
-
const
|
|
831
|
+
function m(d, p) {
|
|
832
|
+
if (!l) return;
|
|
833
|
+
const y = {
|
|
842
834
|
type: "operation",
|
|
843
|
-
operations: [...
|
|
844
|
-
clientId:
|
|
835
|
+
operations: [...d, p],
|
|
836
|
+
clientId: r.value,
|
|
845
837
|
timestamp: /* @__PURE__ */ new Date()
|
|
846
838
|
};
|
|
847
|
-
|
|
839
|
+
l.postMessage(pe(y));
|
|
848
840
|
}
|
|
849
|
-
function d
|
|
850
|
-
if (!
|
|
851
|
-
const
|
|
841
|
+
function f(d) {
|
|
842
|
+
if (!l) return;
|
|
843
|
+
const p = {
|
|
852
844
|
type: "undo",
|
|
853
|
-
operation:
|
|
854
|
-
clientId:
|
|
845
|
+
operation: d,
|
|
846
|
+
clientId: r.value,
|
|
855
847
|
timestamp: /* @__PURE__ */ new Date()
|
|
856
848
|
};
|
|
857
|
-
|
|
849
|
+
l.postMessage(pe(p));
|
|
858
850
|
}
|
|
859
|
-
function
|
|
860
|
-
if (!
|
|
861
|
-
const
|
|
851
|
+
function b(d) {
|
|
852
|
+
if (!l) return;
|
|
853
|
+
const p = {
|
|
862
854
|
type: "redo",
|
|
863
|
-
operation:
|
|
864
|
-
clientId:
|
|
855
|
+
operation: d,
|
|
856
|
+
clientId: r.value,
|
|
865
857
|
timestamp: /* @__PURE__ */ new Date()
|
|
866
858
|
};
|
|
867
|
-
|
|
859
|
+
l.postMessage(pe(p));
|
|
868
860
|
}
|
|
869
|
-
const
|
|
861
|
+
const A = wt("stonecrop-ops-operations", null, {
|
|
870
862
|
serializer: {
|
|
871
|
-
read: (
|
|
863
|
+
read: (d) => {
|
|
872
864
|
try {
|
|
873
|
-
return JSON.parse(
|
|
865
|
+
return JSON.parse(d);
|
|
874
866
|
} catch {
|
|
875
867
|
return null;
|
|
876
868
|
}
|
|
877
869
|
},
|
|
878
|
-
write: (
|
|
870
|
+
write: (d) => d ? JSON.stringify(d) : ""
|
|
879
871
|
}
|
|
880
872
|
});
|
|
881
|
-
function
|
|
873
|
+
function C() {
|
|
882
874
|
if (!(typeof window > "u"))
|
|
883
875
|
try {
|
|
884
|
-
const
|
|
885
|
-
|
|
886
|
-
...
|
|
887
|
-
timestamp: new Date(
|
|
888
|
-
})), t.value =
|
|
889
|
-
} catch (
|
|
890
|
-
typeof console < "u" && console.error("Failed to load operations from persistence:",
|
|
876
|
+
const d = A.value;
|
|
877
|
+
d && Array.isArray(d.operations) && (e.value = d.operations.map((p) => ({
|
|
878
|
+
...p,
|
|
879
|
+
timestamp: new Date(p.timestamp)
|
|
880
|
+
})), t.value = d.currentIndex ?? -1);
|
|
881
|
+
} catch (d) {
|
|
882
|
+
typeof console < "u" && console.error("Failed to load operations from persistence:", d);
|
|
891
883
|
}
|
|
892
884
|
}
|
|
893
885
|
function j() {
|
|
894
886
|
if (!(typeof window > "u"))
|
|
895
887
|
try {
|
|
896
|
-
|
|
897
|
-
operations: e.value.map((
|
|
898
|
-
...
|
|
899
|
-
timestamp:
|
|
888
|
+
A.value = {
|
|
889
|
+
operations: e.value.map((d) => ({
|
|
890
|
+
...d,
|
|
891
|
+
timestamp: d.timestamp.toISOString()
|
|
900
892
|
})),
|
|
901
893
|
currentIndex: t.value
|
|
902
894
|
};
|
|
903
|
-
} catch (
|
|
904
|
-
typeof console < "u" && console.error("Failed to save operations to persistence:",
|
|
895
|
+
} catch (d) {
|
|
896
|
+
typeof console < "u" && console.error("Failed to save operations to persistence:", d);
|
|
905
897
|
}
|
|
906
898
|
}
|
|
907
|
-
function
|
|
899
|
+
function k() {
|
|
908
900
|
H(
|
|
909
901
|
[e, t],
|
|
910
902
|
() => {
|
|
911
|
-
|
|
903
|
+
n.value.enablePersistence && j();
|
|
912
904
|
},
|
|
913
905
|
{ deep: !0 }
|
|
914
906
|
);
|
|
@@ -917,30 +909,30 @@ const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
917
909
|
// State
|
|
918
910
|
operations: e,
|
|
919
911
|
currentIndex: t,
|
|
920
|
-
config:
|
|
921
|
-
clientId:
|
|
912
|
+
config: n,
|
|
913
|
+
clientId: r,
|
|
922
914
|
undoRedoState: w,
|
|
923
915
|
// Computed
|
|
924
916
|
canUndo: a,
|
|
925
917
|
canRedo: c,
|
|
926
|
-
undoCount:
|
|
927
|
-
redoCount:
|
|
918
|
+
undoCount: h,
|
|
919
|
+
redoCount: g,
|
|
928
920
|
// Methods
|
|
929
|
-
configure:
|
|
921
|
+
configure: R,
|
|
930
922
|
addOperation: $,
|
|
931
923
|
startBatch: T,
|
|
932
|
-
commitBatch:
|
|
933
|
-
cancelBatch:
|
|
934
|
-
undo:
|
|
935
|
-
redo:
|
|
936
|
-
clear:
|
|
937
|
-
getOperationsFor:
|
|
924
|
+
commitBatch: L,
|
|
925
|
+
cancelBatch: P,
|
|
926
|
+
undo: I,
|
|
927
|
+
redo: N,
|
|
928
|
+
clear: _,
|
|
929
|
+
getOperationsFor: v,
|
|
938
930
|
getSnapshot: E,
|
|
939
931
|
markIrreversible: x,
|
|
940
|
-
logAction:
|
|
932
|
+
logAction: V
|
|
941
933
|
};
|
|
942
934
|
});
|
|
943
|
-
class
|
|
935
|
+
class ae {
|
|
944
936
|
/**
|
|
945
937
|
* The root FieldTriggerEngine instance
|
|
946
938
|
*/
|
|
@@ -961,9 +953,9 @@ class ie {
|
|
|
961
953
|
* @param options - Configuration options for the field trigger engine
|
|
962
954
|
*/
|
|
963
955
|
constructor(e = {}) {
|
|
964
|
-
if (
|
|
965
|
-
return
|
|
966
|
-
|
|
956
|
+
if (ae._root)
|
|
957
|
+
return ae._root;
|
|
958
|
+
ae._root = this, this.options = {
|
|
967
959
|
defaultTimeout: e.defaultTimeout ?? 5e3,
|
|
968
960
|
debug: e.debug ?? !1,
|
|
969
961
|
enableRollback: e.enableRollback ?? !0,
|
|
@@ -992,8 +984,8 @@ class ie {
|
|
|
992
984
|
* @param fieldname - The field name
|
|
993
985
|
* @param enableRollback - Whether to enable rollback
|
|
994
986
|
*/
|
|
995
|
-
setFieldRollback(e, t,
|
|
996
|
-
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t,
|
|
987
|
+
setFieldRollback(e, t, r) {
|
|
988
|
+
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, r);
|
|
997
989
|
}
|
|
998
990
|
/**
|
|
999
991
|
* Get rollback configuration for a specific field trigger
|
|
@@ -1009,25 +1001,25 @@ class ie {
|
|
|
1009
1001
|
*/
|
|
1010
1002
|
registerDoctypeActions(e, t) {
|
|
1011
1003
|
if (!t) return;
|
|
1012
|
-
const
|
|
1004
|
+
const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1013
1005
|
if (typeof t.entrySeq == "function")
|
|
1014
1006
|
t.entrySeq().forEach(([s, i]) => {
|
|
1015
|
-
this.categorizeAction(s, i,
|
|
1007
|
+
this.categorizeAction(s, i, r, o);
|
|
1016
1008
|
});
|
|
1017
1009
|
else if (t instanceof Map)
|
|
1018
1010
|
for (const [s, i] of t)
|
|
1019
|
-
this.categorizeAction(s, i,
|
|
1011
|
+
this.categorizeAction(s, i, r, o);
|
|
1020
1012
|
else t && typeof t == "object" && Object.entries(t).forEach(([s, i]) => {
|
|
1021
|
-
this.categorizeAction(s, i,
|
|
1013
|
+
this.categorizeAction(s, i, r, o);
|
|
1022
1014
|
});
|
|
1023
|
-
this.doctypeActions.set(e,
|
|
1015
|
+
this.doctypeActions.set(e, r), this.doctypeTransitions.set(e, o);
|
|
1024
1016
|
}
|
|
1025
1017
|
/**
|
|
1026
1018
|
* Categorize an action as either a field trigger or XState transition
|
|
1027
1019
|
* Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
|
|
1028
1020
|
*/
|
|
1029
|
-
categorizeAction(e, t,
|
|
1030
|
-
this.isTransitionKey(e) ? o.set(e, t) :
|
|
1021
|
+
categorizeAction(e, t, r, o) {
|
|
1022
|
+
this.isTransitionKey(e) ? o.set(e, t) : r.set(e, t);
|
|
1031
1023
|
}
|
|
1032
1024
|
/**
|
|
1033
1025
|
* Determine if a key represents an XState transition
|
|
@@ -1042,7 +1034,7 @@ class ie {
|
|
|
1042
1034
|
* @param options - Execution options (timeout and enableRollback)
|
|
1043
1035
|
*/
|
|
1044
1036
|
async executeFieldTriggers(e, t = {}) {
|
|
1045
|
-
const { doctype:
|
|
1037
|
+
const { doctype: r, fieldname: o } = e, s = this.findFieldTriggers(r, o);
|
|
1046
1038
|
if (s.length === 0)
|
|
1047
1039
|
return {
|
|
1048
1040
|
path: e.path,
|
|
@@ -1053,48 +1045,48 @@ class ie {
|
|
|
1053
1045
|
rolledBack: !1
|
|
1054
1046
|
};
|
|
1055
1047
|
const i = performance.now(), a = [];
|
|
1056
|
-
let c = !1,
|
|
1057
|
-
const w = this.getFieldRollback(
|
|
1058
|
-
|
|
1059
|
-
for (const
|
|
1048
|
+
let c = !1, h = !1, g;
|
|
1049
|
+
const w = this.getFieldRollback(r, o), R = t.enableRollback ?? w ?? this.options.enableRollback;
|
|
1050
|
+
R && e.store && (g = this.captureSnapshot(e));
|
|
1051
|
+
for (const P of s)
|
|
1060
1052
|
try {
|
|
1061
|
-
const
|
|
1062
|
-
if (a.push(
|
|
1053
|
+
const I = await this.executeAction(P, e, t.timeout);
|
|
1054
|
+
if (a.push(I), !I.success) {
|
|
1063
1055
|
c = !0;
|
|
1064
1056
|
break;
|
|
1065
1057
|
}
|
|
1066
|
-
} catch (
|
|
1067
|
-
const
|
|
1058
|
+
} catch (I) {
|
|
1059
|
+
const S = {
|
|
1068
1060
|
success: !1,
|
|
1069
|
-
error:
|
|
1061
|
+
error: I instanceof Error ? I : new Error(String(I)),
|
|
1070
1062
|
executionTime: 0,
|
|
1071
|
-
action:
|
|
1063
|
+
action: P
|
|
1072
1064
|
};
|
|
1073
|
-
a.push(
|
|
1065
|
+
a.push(S), c = !0;
|
|
1074
1066
|
break;
|
|
1075
1067
|
}
|
|
1076
|
-
if (
|
|
1068
|
+
if (R && c && g && e.store)
|
|
1077
1069
|
try {
|
|
1078
|
-
this.restoreSnapshot(e,
|
|
1079
|
-
} catch (
|
|
1080
|
-
console.error("[FieldTriggers] Rollback failed:",
|
|
1070
|
+
this.restoreSnapshot(e, g), h = !0;
|
|
1071
|
+
} catch (P) {
|
|
1072
|
+
console.error("[FieldTriggers] Rollback failed:", P);
|
|
1081
1073
|
}
|
|
1082
|
-
const $ = performance.now() - i, T = a.filter((
|
|
1074
|
+
const $ = performance.now() - i, T = a.filter((P) => !P.success);
|
|
1083
1075
|
if (T.length > 0 && this.options.errorHandler)
|
|
1084
|
-
for (const
|
|
1076
|
+
for (const P of T)
|
|
1085
1077
|
try {
|
|
1086
|
-
this.options.errorHandler(
|
|
1087
|
-
} catch (
|
|
1088
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1078
|
+
this.options.errorHandler(P.error, e, P.action);
|
|
1079
|
+
} catch (I) {
|
|
1080
|
+
console.error("[FieldTriggers] Error in global error handler:", I);
|
|
1089
1081
|
}
|
|
1090
1082
|
return {
|
|
1091
1083
|
path: e.path,
|
|
1092
1084
|
actionResults: a,
|
|
1093
1085
|
totalExecutionTime: $,
|
|
1094
|
-
allSucceeded: a.every((
|
|
1086
|
+
allSucceeded: a.every((P) => P.success),
|
|
1095
1087
|
stoppedOnError: c,
|
|
1096
|
-
rolledBack:
|
|
1097
|
-
snapshot: this.options.debug &&
|
|
1088
|
+
rolledBack: h,
|
|
1089
|
+
snapshot: this.options.debug && R ? g : void 0
|
|
1098
1090
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1099
1091
|
};
|
|
1100
1092
|
}
|
|
@@ -1105,19 +1097,19 @@ class ie {
|
|
|
1105
1097
|
* @param options - Execution options (timeout)
|
|
1106
1098
|
*/
|
|
1107
1099
|
async executeTransitionActions(e, t = {}) {
|
|
1108
|
-
const { doctype:
|
|
1100
|
+
const { doctype: r, transition: o } = e, s = this.findTransitionActions(r, o);
|
|
1109
1101
|
if (s.length === 0)
|
|
1110
1102
|
return [];
|
|
1111
1103
|
const i = [];
|
|
1112
1104
|
for (const c of s)
|
|
1113
1105
|
try {
|
|
1114
|
-
const
|
|
1115
|
-
if (i.push(
|
|
1106
|
+
const h = await this.executeTransitionAction(c, e, t.timeout);
|
|
1107
|
+
if (i.push(h), !h.success)
|
|
1116
1108
|
break;
|
|
1117
|
-
} catch (
|
|
1109
|
+
} catch (h) {
|
|
1118
1110
|
const w = {
|
|
1119
1111
|
success: !1,
|
|
1120
|
-
error:
|
|
1112
|
+
error: h instanceof Error ? h : new Error(String(h)),
|
|
1121
1113
|
executionTime: 0,
|
|
1122
1114
|
action: c,
|
|
1123
1115
|
transition: o
|
|
@@ -1130,8 +1122,8 @@ class ie {
|
|
|
1130
1122
|
for (const c of a)
|
|
1131
1123
|
try {
|
|
1132
1124
|
this.options.errorHandler(c.error, e, c.action);
|
|
1133
|
-
} catch (
|
|
1134
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1125
|
+
} catch (h) {
|
|
1126
|
+
console.error("[FieldTriggers] Error in global error handler:", h);
|
|
1135
1127
|
}
|
|
1136
1128
|
return i;
|
|
1137
1129
|
}
|
|
@@ -1139,14 +1131,14 @@ class ie {
|
|
|
1139
1131
|
* Find transition actions for a specific doctype and transition
|
|
1140
1132
|
*/
|
|
1141
1133
|
findTransitionActions(e, t) {
|
|
1142
|
-
const
|
|
1143
|
-
return
|
|
1134
|
+
const r = this.doctypeTransitions.get(e);
|
|
1135
|
+
return r ? r.get(t) || [] : [];
|
|
1144
1136
|
}
|
|
1145
1137
|
/**
|
|
1146
1138
|
* Execute a single transition action by name
|
|
1147
1139
|
*/
|
|
1148
|
-
async executeTransitionAction(e, t,
|
|
1149
|
-
const o = performance.now(), s =
|
|
1140
|
+
async executeTransitionAction(e, t, r) {
|
|
1141
|
+
const o = performance.now(), s = r ?? this.options.defaultTimeout;
|
|
1150
1142
|
try {
|
|
1151
1143
|
let i = this.globalTransitionActions.get(e);
|
|
1152
1144
|
if (!i) {
|
|
@@ -1177,10 +1169,10 @@ class ie {
|
|
|
1177
1169
|
* Field triggers are identified by keys that look like field paths (contain dots or match field names)
|
|
1178
1170
|
*/
|
|
1179
1171
|
findFieldTriggers(e, t) {
|
|
1180
|
-
const
|
|
1181
|
-
if (!
|
|
1172
|
+
const r = this.doctypeActions.get(e);
|
|
1173
|
+
if (!r) return [];
|
|
1182
1174
|
const o = [];
|
|
1183
|
-
for (const [s, i] of
|
|
1175
|
+
for (const [s, i] of r)
|
|
1184
1176
|
this.isFieldTriggerKey(s, t) && o.push(...i);
|
|
1185
1177
|
return o;
|
|
1186
1178
|
}
|
|
@@ -1199,11 +1191,11 @@ class ie {
|
|
|
1199
1191
|
* Supports wildcards (*) for dynamic segments
|
|
1200
1192
|
*/
|
|
1201
1193
|
matchFieldPattern(e, t) {
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1194
|
+
const r = e.split("."), o = t.split(".");
|
|
1195
|
+
if (r.length !== o.length)
|
|
1204
1196
|
return !1;
|
|
1205
|
-
for (let s = 0; s <
|
|
1206
|
-
const i =
|
|
1197
|
+
for (let s = 0; s < r.length; s++) {
|
|
1198
|
+
const i = r[s], a = o[s];
|
|
1207
1199
|
if (i !== "*" && i !== a)
|
|
1208
1200
|
return !1;
|
|
1209
1201
|
}
|
|
@@ -1212,8 +1204,8 @@ class ie {
|
|
|
1212
1204
|
/**
|
|
1213
1205
|
* Execute a single action by name
|
|
1214
1206
|
*/
|
|
1215
|
-
async executeAction(e, t,
|
|
1216
|
-
const o = performance.now(), s =
|
|
1207
|
+
async executeAction(e, t, r) {
|
|
1208
|
+
const o = performance.now(), s = r ?? this.options.defaultTimeout;
|
|
1217
1209
|
try {
|
|
1218
1210
|
const i = this.globalActions.get(e);
|
|
1219
1211
|
if (!i)
|
|
@@ -1236,11 +1228,11 @@ class ie {
|
|
|
1236
1228
|
/**
|
|
1237
1229
|
* Execute a function with timeout
|
|
1238
1230
|
*/
|
|
1239
|
-
async executeWithTimeout(e, t,
|
|
1231
|
+
async executeWithTimeout(e, t, r) {
|
|
1240
1232
|
return new Promise((o, s) => {
|
|
1241
1233
|
const i = setTimeout(() => {
|
|
1242
|
-
s(new Error(`Action timeout after ${
|
|
1243
|
-
},
|
|
1234
|
+
s(new Error(`Action timeout after ${r}ms`));
|
|
1235
|
+
}, r);
|
|
1244
1236
|
Promise.resolve(e(t)).then((a) => {
|
|
1245
1237
|
clearTimeout(i), o(a);
|
|
1246
1238
|
}).catch((a) => {
|
|
@@ -1255,8 +1247,8 @@ class ie {
|
|
|
1255
1247
|
captureSnapshot(e) {
|
|
1256
1248
|
if (!(!e.store || !e.doctype || !e.recordId))
|
|
1257
1249
|
try {
|
|
1258
|
-
const t = `${e.doctype}.${e.recordId}`,
|
|
1259
|
-
return !
|
|
1250
|
+
const t = `${e.doctype}.${e.recordId}`, r = e.store.get(t);
|
|
1251
|
+
return !r || typeof r != "object" ? void 0 : JSON.parse(JSON.stringify(r));
|
|
1260
1252
|
} catch (t) {
|
|
1261
1253
|
this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", t);
|
|
1262
1254
|
return;
|
|
@@ -1269,33 +1261,33 @@ class ie {
|
|
|
1269
1261
|
restoreSnapshot(e, t) {
|
|
1270
1262
|
if (!(!e.store || !e.doctype || !e.recordId || !t))
|
|
1271
1263
|
try {
|
|
1272
|
-
const
|
|
1273
|
-
e.store.set(
|
|
1274
|
-
} catch (
|
|
1275
|
-
throw console.error("[FieldTriggers] Failed to restore snapshot:",
|
|
1264
|
+
const r = `${e.doctype}.${e.recordId}`;
|
|
1265
|
+
e.store.set(r, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${r} to previous state`);
|
|
1266
|
+
} catch (r) {
|
|
1267
|
+
throw console.error("[FieldTriggers] Failed to restore snapshot:", r), r;
|
|
1276
1268
|
}
|
|
1277
1269
|
}
|
|
1278
1270
|
}
|
|
1279
|
-
function
|
|
1280
|
-
return new
|
|
1271
|
+
function J(n) {
|
|
1272
|
+
return new ae(n);
|
|
1281
1273
|
}
|
|
1282
|
-
function
|
|
1283
|
-
|
|
1274
|
+
function Tt(n, e) {
|
|
1275
|
+
J().registerAction(n, e);
|
|
1284
1276
|
}
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1277
|
+
function Ct(n, e) {
|
|
1278
|
+
J().registerTransitionAction(n, e);
|
|
1287
1279
|
}
|
|
1288
|
-
function
|
|
1289
|
-
|
|
1280
|
+
function kt(n, e, t) {
|
|
1281
|
+
J().setFieldRollback(n, e, t);
|
|
1290
1282
|
}
|
|
1291
|
-
async function
|
|
1292
|
-
const
|
|
1293
|
-
path: t?.path || (t?.recordId ? `${
|
|
1283
|
+
async function Ft(n, e, t) {
|
|
1284
|
+
const r = J(), o = {
|
|
1285
|
+
path: t?.path || (t?.recordId ? `${n}.${t.recordId}` : n),
|
|
1294
1286
|
fieldname: "",
|
|
1295
1287
|
beforeValue: void 0,
|
|
1296
1288
|
afterValue: void 0,
|
|
1297
1289
|
operation: "set",
|
|
1298
|
-
doctype:
|
|
1290
|
+
doctype: n,
|
|
1299
1291
|
recordId: t?.recordId,
|
|
1300
1292
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1301
1293
|
transition: e,
|
|
@@ -1303,30 +1295,30 @@ async function At(r, e, t) {
|
|
|
1303
1295
|
targetState: t?.targetState,
|
|
1304
1296
|
fsmContext: t?.fsmContext
|
|
1305
1297
|
};
|
|
1306
|
-
return await
|
|
1298
|
+
return await r.executeTransitionActions(o);
|
|
1307
1299
|
}
|
|
1308
|
-
function
|
|
1309
|
-
if (
|
|
1300
|
+
function Lt(n, e) {
|
|
1301
|
+
if (n)
|
|
1310
1302
|
try {
|
|
1311
|
-
ue().markIrreversible(
|
|
1303
|
+
ue().markIrreversible(n, e);
|
|
1312
1304
|
} catch {
|
|
1313
1305
|
}
|
|
1314
1306
|
}
|
|
1315
|
-
function
|
|
1307
|
+
function Ce() {
|
|
1316
1308
|
try {
|
|
1317
1309
|
return ue();
|
|
1318
1310
|
} catch {
|
|
1319
1311
|
return null;
|
|
1320
1312
|
}
|
|
1321
1313
|
}
|
|
1322
|
-
class
|
|
1314
|
+
class ee {
|
|
1323
1315
|
static instance;
|
|
1324
1316
|
/**
|
|
1325
1317
|
* Gets the singleton instance of HST
|
|
1326
1318
|
* @returns The HST singleton instance
|
|
1327
1319
|
*/
|
|
1328
1320
|
static getInstance() {
|
|
1329
|
-
return
|
|
1321
|
+
return ee.instance || (ee.instance = new ee()), ee.instance;
|
|
1330
1322
|
}
|
|
1331
1323
|
/**
|
|
1332
1324
|
* Gets the global registry instance
|
|
@@ -1367,16 +1359,16 @@ class ve {
|
|
|
1367
1359
|
doctype;
|
|
1368
1360
|
parentDoctype;
|
|
1369
1361
|
hst;
|
|
1370
|
-
constructor(e, t,
|
|
1371
|
-
return this.target = e, this.parentPath =
|
|
1362
|
+
constructor(e, t, r = "", o = null, s) {
|
|
1363
|
+
return this.target = e, this.parentPath = r, this.rootNode = o || this, this.doctype = t, this.parentDoctype = s, this.hst = ee.getInstance(), new Proxy(this, {
|
|
1372
1364
|
get(i, a) {
|
|
1373
1365
|
if (a in i) return i[a];
|
|
1374
1366
|
const c = String(a);
|
|
1375
1367
|
return i.getNode(c);
|
|
1376
1368
|
},
|
|
1377
1369
|
set(i, a, c) {
|
|
1378
|
-
const
|
|
1379
|
-
return i.set(
|
|
1370
|
+
const h = String(a);
|
|
1371
|
+
return i.set(h, c), !0;
|
|
1380
1372
|
}
|
|
1381
1373
|
});
|
|
1382
1374
|
}
|
|
@@ -1385,29 +1377,29 @@ class ve {
|
|
|
1385
1377
|
}
|
|
1386
1378
|
// Method to get a tree-wrapped node for navigation
|
|
1387
1379
|
getNode(e) {
|
|
1388
|
-
const t = this.resolvePath(e),
|
|
1380
|
+
const t = this.resolvePath(e), r = this.resolveValue(e), o = t.split(".");
|
|
1389
1381
|
let s = this.doctype;
|
|
1390
|
-
return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof
|
|
1382
|
+
return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new ve(r, s, t, this.rootNode, this.parentDoctype) : new ve(r, s, t, this.rootNode, this.parentDoctype);
|
|
1391
1383
|
}
|
|
1392
|
-
set(e, t,
|
|
1384
|
+
set(e, t, r = "user") {
|
|
1393
1385
|
const o = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
|
|
1394
|
-
if (
|
|
1395
|
-
const i =
|
|
1386
|
+
if (r !== "undo" && r !== "redo") {
|
|
1387
|
+
const i = Ce();
|
|
1396
1388
|
if (i && typeof i.addOperation == "function") {
|
|
1397
|
-
const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype,
|
|
1389
|
+
const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, h = a.length >= 2 ? a[1] : void 0, g = a.slice(2).join(".") || a[a.length - 1], R = t === void 0 && s !== void 0 ? "delete" : "set";
|
|
1398
1390
|
i.addOperation(
|
|
1399
1391
|
{
|
|
1400
|
-
type:
|
|
1392
|
+
type: R,
|
|
1401
1393
|
path: o,
|
|
1402
|
-
fieldname:
|
|
1394
|
+
fieldname: g,
|
|
1403
1395
|
beforeValue: s,
|
|
1404
1396
|
afterValue: t,
|
|
1405
1397
|
doctype: c,
|
|
1406
|
-
recordId:
|
|
1398
|
+
recordId: h,
|
|
1407
1399
|
reversible: !0
|
|
1408
1400
|
// Default to reversible, can be changed by field triggers
|
|
1409
1401
|
},
|
|
1410
|
-
|
|
1402
|
+
r
|
|
1411
1403
|
);
|
|
1412
1404
|
}
|
|
1413
1405
|
}
|
|
@@ -1418,14 +1410,14 @@ class ve {
|
|
|
1418
1410
|
if (e === "")
|
|
1419
1411
|
return !0;
|
|
1420
1412
|
const t = this.parsePath(e);
|
|
1421
|
-
let
|
|
1413
|
+
let r = this.target;
|
|
1422
1414
|
for (let o = 0; o < t.length; o++) {
|
|
1423
1415
|
const s = t[o];
|
|
1424
|
-
if (
|
|
1416
|
+
if (r == null)
|
|
1425
1417
|
return !1;
|
|
1426
1418
|
if (o === t.length - 1)
|
|
1427
|
-
return this.isImmutable(
|
|
1428
|
-
|
|
1419
|
+
return this.isImmutable(r) ? r.has(s) : this.isPiniaStore(r) && r.$state && s in r.$state || s in r;
|
|
1420
|
+
r = this.getProperty(r, s);
|
|
1429
1421
|
}
|
|
1430
1422
|
return !1;
|
|
1431
1423
|
} catch {
|
|
@@ -1454,7 +1446,7 @@ class ve {
|
|
|
1454
1446
|
* Trigger an XState transition with optional context data
|
|
1455
1447
|
*/
|
|
1456
1448
|
async triggerTransition(e, t) {
|
|
1457
|
-
const
|
|
1449
|
+
const r = J(), o = this.parentPath.split(".");
|
|
1458
1450
|
let s = this.doctype, i;
|
|
1459
1451
|
this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), o.length >= 2 && (i = o[1]);
|
|
1460
1452
|
const a = {
|
|
@@ -1472,7 +1464,7 @@ class ve {
|
|
|
1472
1464
|
currentState: t?.currentState,
|
|
1473
1465
|
targetState: t?.targetState,
|
|
1474
1466
|
fsmContext: t?.fsmContext
|
|
1475
|
-
}, c =
|
|
1467
|
+
}, c = Ce();
|
|
1476
1468
|
return c && typeof c.addOperation == "function" && c.addOperation(
|
|
1477
1469
|
{
|
|
1478
1470
|
type: "transition",
|
|
@@ -1492,7 +1484,7 @@ class ve {
|
|
|
1492
1484
|
}
|
|
1493
1485
|
},
|
|
1494
1486
|
"user"
|
|
1495
|
-
), await
|
|
1487
|
+
), await r.executeTransitionActions(a);
|
|
1496
1488
|
}
|
|
1497
1489
|
// Private helper methods
|
|
1498
1490
|
resolvePath(e) {
|
|
@@ -1502,20 +1494,20 @@ class ve {
|
|
|
1502
1494
|
if (e === "")
|
|
1503
1495
|
return this.target;
|
|
1504
1496
|
const t = this.parsePath(e);
|
|
1505
|
-
let
|
|
1497
|
+
let r = this.target;
|
|
1506
1498
|
for (const o of t) {
|
|
1507
|
-
if (
|
|
1499
|
+
if (r == null)
|
|
1508
1500
|
return;
|
|
1509
|
-
|
|
1501
|
+
r = this.getProperty(r, o);
|
|
1510
1502
|
}
|
|
1511
|
-
return
|
|
1503
|
+
return r;
|
|
1512
1504
|
}
|
|
1513
1505
|
updateValue(e, t) {
|
|
1514
1506
|
if (e === "")
|
|
1515
1507
|
throw new Error("Cannot set value on empty path");
|
|
1516
|
-
const
|
|
1508
|
+
const r = this.parsePath(e), o = r.pop();
|
|
1517
1509
|
let s = this.target;
|
|
1518
|
-
for (const i of
|
|
1510
|
+
for (const i of r)
|
|
1519
1511
|
if (s = this.getProperty(s, i), s == null)
|
|
1520
1512
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1521
1513
|
this.setProperty(s, o, t);
|
|
@@ -1523,32 +1515,32 @@ class ve {
|
|
|
1523
1515
|
getProperty(e, t) {
|
|
1524
1516
|
return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
|
|
1525
1517
|
}
|
|
1526
|
-
setProperty(e, t,
|
|
1518
|
+
setProperty(e, t, r) {
|
|
1527
1519
|
if (this.isImmutable(e))
|
|
1528
1520
|
throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
|
|
1529
1521
|
if (this.isPiniaStore(e)) {
|
|
1530
|
-
e.$patch ? e.$patch({ [t]:
|
|
1522
|
+
e.$patch ? e.$patch({ [t]: r }) : e[t] = r;
|
|
1531
1523
|
return;
|
|
1532
1524
|
}
|
|
1533
|
-
e[t] =
|
|
1525
|
+
e[t] = r;
|
|
1534
1526
|
}
|
|
1535
|
-
async triggerFieldActions(e, t,
|
|
1527
|
+
async triggerFieldActions(e, t, r) {
|
|
1536
1528
|
try {
|
|
1537
1529
|
if (!e || typeof e != "string")
|
|
1538
1530
|
return;
|
|
1539
1531
|
const o = e.split(".");
|
|
1540
1532
|
if (o.length < 3)
|
|
1541
1533
|
return;
|
|
1542
|
-
const s =
|
|
1534
|
+
const s = J(), i = o.slice(2).join(".") || o[o.length - 1];
|
|
1543
1535
|
let a = this.doctype;
|
|
1544
1536
|
this.doctype === "StonecropStore" && o.length >= 1 && (a = o[0]);
|
|
1545
1537
|
let c;
|
|
1546
1538
|
o.length >= 2 && (c = o[1]);
|
|
1547
|
-
const
|
|
1539
|
+
const h = {
|
|
1548
1540
|
path: e,
|
|
1549
1541
|
fieldname: i,
|
|
1550
1542
|
beforeValue: t,
|
|
1551
|
-
afterValue:
|
|
1543
|
+
afterValue: r,
|
|
1552
1544
|
operation: "set",
|
|
1553
1545
|
doctype: a,
|
|
1554
1546
|
recordId: c,
|
|
@@ -1556,7 +1548,7 @@ class ve {
|
|
|
1556
1548
|
store: this.rootNode || void 0
|
|
1557
1549
|
// Pass the root store for snapshot/rollback capabilities
|
|
1558
1550
|
};
|
|
1559
|
-
await s.executeFieldTriggers(
|
|
1551
|
+
await s.executeFieldTriggers(h);
|
|
1560
1552
|
} catch (o) {
|
|
1561
1553
|
o instanceof Error && console.warn("Field trigger error:", o.message);
|
|
1562
1554
|
}
|
|
@@ -1570,19 +1562,19 @@ class ve {
|
|
|
1570
1562
|
isImmutable(e) {
|
|
1571
1563
|
if (!e || typeof e != "object")
|
|
1572
1564
|
return !1;
|
|
1573
|
-
const t = "get" in e && typeof e.get == "function",
|
|
1565
|
+
const t = "get" in e && typeof e.get == "function", r = "set" in e && typeof e.set == "function", o = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && t && r;
|
|
1574
1566
|
let i;
|
|
1575
1567
|
try {
|
|
1576
1568
|
const c = e;
|
|
1577
1569
|
if ("constructor" in c && c.constructor && typeof c.constructor == "object" && "name" in c.constructor) {
|
|
1578
|
-
const
|
|
1579
|
-
i = typeof
|
|
1570
|
+
const h = c.constructor.name;
|
|
1571
|
+
i = typeof h == "string" ? h : void 0;
|
|
1580
1572
|
}
|
|
1581
1573
|
} catch {
|
|
1582
1574
|
i = void 0;
|
|
1583
1575
|
}
|
|
1584
|
-
const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t ||
|
|
1585
|
-
return !!(t &&
|
|
1576
|
+
const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t || r);
|
|
1577
|
+
return !!(t && r && o && s || t && r && a);
|
|
1586
1578
|
}
|
|
1587
1579
|
isPrimitive(e) {
|
|
1588
1580
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
|
|
@@ -1591,8 +1583,8 @@ class ve {
|
|
|
1591
1583
|
return e ? e.split(".").filter((t) => t.length > 0) : [];
|
|
1592
1584
|
}
|
|
1593
1585
|
}
|
|
1594
|
-
function
|
|
1595
|
-
return new ve(
|
|
1586
|
+
function Nt(n, e, t) {
|
|
1587
|
+
return new ve(n, e, "", null, t);
|
|
1596
1588
|
}
|
|
1597
1589
|
class He {
|
|
1598
1590
|
hstStore;
|
|
@@ -1622,7 +1614,7 @@ class He {
|
|
|
1622
1614
|
const e = {};
|
|
1623
1615
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1624
1616
|
e[t] = {};
|
|
1625
|
-
}), this.hstStore =
|
|
1617
|
+
}), this.hstStore = Nt(e, "StonecropStore");
|
|
1626
1618
|
}
|
|
1627
1619
|
/**
|
|
1628
1620
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1648,9 +1640,9 @@ class He {
|
|
|
1648
1640
|
* @param recordId - The record ID
|
|
1649
1641
|
* @param recordData - The record data
|
|
1650
1642
|
*/
|
|
1651
|
-
addRecord(e, t,
|
|
1643
|
+
addRecord(e, t, r) {
|
|
1652
1644
|
const o = typeof e == "string" ? e : e.slug;
|
|
1653
|
-
this.ensureDoctypeExists(o), this.hstStore.set(`${o}.${t}`,
|
|
1645
|
+
this.ensureDoctypeExists(o), this.hstStore.set(`${o}.${t}`, r);
|
|
1654
1646
|
}
|
|
1655
1647
|
/**
|
|
1656
1648
|
* Get a specific record
|
|
@@ -1659,9 +1651,9 @@ class He {
|
|
|
1659
1651
|
* @returns HST node for the record or undefined
|
|
1660
1652
|
*/
|
|
1661
1653
|
getRecordById(e, t) {
|
|
1662
|
-
const
|
|
1663
|
-
if (this.ensureDoctypeExists(
|
|
1664
|
-
return this.hstStore.getNode(`${
|
|
1654
|
+
const r = typeof e == "string" ? e : e.slug;
|
|
1655
|
+
if (this.ensureDoctypeExists(r), !(!this.hstStore.has(`${r}.${t}`) || this.hstStore.get(`${r}.${t}`) === void 0))
|
|
1656
|
+
return this.hstStore.getNode(`${r}.${t}`);
|
|
1665
1657
|
}
|
|
1666
1658
|
/**
|
|
1667
1659
|
* Remove a record from the store
|
|
@@ -1669,8 +1661,8 @@ class He {
|
|
|
1669
1661
|
* @param recordId - The record ID
|
|
1670
1662
|
*/
|
|
1671
1663
|
removeRecord(e, t) {
|
|
1672
|
-
const
|
|
1673
|
-
this.ensureDoctypeExists(
|
|
1664
|
+
const r = typeof e == "string" ? e : e.slug;
|
|
1665
|
+
this.ensureDoctypeExists(r), this.hstStore.has(`${r}.${t}`) && this.hstStore.set(`${r}.${t}`, void 0);
|
|
1674
1666
|
}
|
|
1675
1667
|
/**
|
|
1676
1668
|
* Get all record IDs for a doctype
|
|
@@ -1680,8 +1672,8 @@ class He {
|
|
|
1680
1672
|
getRecordIds(e) {
|
|
1681
1673
|
const t = typeof e == "string" ? e : e.slug;
|
|
1682
1674
|
this.ensureDoctypeExists(t);
|
|
1683
|
-
const
|
|
1684
|
-
return !
|
|
1675
|
+
const r = this.hstStore.get(t);
|
|
1676
|
+
return !r || typeof r != "object" ? [] : Object.keys(r).filter((o) => r[o] !== void 0);
|
|
1685
1677
|
}
|
|
1686
1678
|
/**
|
|
1687
1679
|
* Clear all records for a doctype
|
|
@@ -1707,20 +1699,20 @@ class He {
|
|
|
1707
1699
|
* @param action - The action to run
|
|
1708
1700
|
* @param args - Action arguments (typically record IDs)
|
|
1709
1701
|
*/
|
|
1710
|
-
runAction(e, t,
|
|
1711
|
-
const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(
|
|
1712
|
-
let c = "success",
|
|
1702
|
+
runAction(e, t, r) {
|
|
1703
|
+
const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(r) ? r.filter((g) => typeof g == "string") : void 0, a = this.getOperationLogStore();
|
|
1704
|
+
let c = "success", h;
|
|
1713
1705
|
try {
|
|
1714
|
-
s && s.length > 0 && s.forEach((
|
|
1706
|
+
s && s.length > 0 && s.forEach((g) => {
|
|
1715
1707
|
try {
|
|
1716
|
-
new Function("args",
|
|
1708
|
+
new Function("args", g)(r);
|
|
1717
1709
|
} catch (w) {
|
|
1718
|
-
throw c = "failure",
|
|
1710
|
+
throw c = "failure", h = w instanceof Error ? w.message : "Unknown error", w;
|
|
1719
1711
|
}
|
|
1720
1712
|
});
|
|
1721
1713
|
} catch {
|
|
1722
1714
|
} finally {
|
|
1723
|
-
a.logAction(e.doctype, t, i, c,
|
|
1715
|
+
a.logAction(e.doctype, t, i, c, h);
|
|
1724
1716
|
}
|
|
1725
1717
|
}
|
|
1726
1718
|
/**
|
|
@@ -1766,171 +1758,171 @@ class He {
|
|
|
1766
1758
|
return this.hstStore;
|
|
1767
1759
|
}
|
|
1768
1760
|
}
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1771
|
-
const e =
|
|
1772
|
-
() =>
|
|
1761
|
+
function Vt(n) {
|
|
1762
|
+
n || (n = {});
|
|
1763
|
+
const e = n.registry || te("$registry"), t = te("$stonecrop"), r = M(), o = M(), s = M({}), i = M(), a = M(), c = M([]), h = M(-1), g = B(() => r.value?.getOperationLogStore().canUndo ?? !1), w = B(() => r.value?.getOperationLogStore().canRedo ?? !1), R = B(() => r.value?.getOperationLogStore().undoCount ?? 0), $ = B(() => r.value?.getOperationLogStore().redoCount ?? 0), T = B(
|
|
1764
|
+
() => r.value?.getOperationLogStore().undoRedoState ?? {
|
|
1773
1765
|
canUndo: !1,
|
|
1774
1766
|
canRedo: !1,
|
|
1775
1767
|
undoCount: 0,
|
|
1776
1768
|
redoCount: 0,
|
|
1777
1769
|
currentIndex: -1
|
|
1778
1770
|
}
|
|
1779
|
-
),
|
|
1780
|
-
|
|
1781
|
-
},
|
|
1782
|
-
|
|
1783
|
-
},
|
|
1784
|
-
|
|
1785
|
-
}, E = (
|
|
1771
|
+
), L = (m) => r.value?.getOperationLogStore().undo(m) ?? !1, P = (m) => r.value?.getOperationLogStore().redo(m) ?? !1, I = () => {
|
|
1772
|
+
r.value?.getOperationLogStore().startBatch();
|
|
1773
|
+
}, N = (m) => r.value?.getOperationLogStore().commitBatch(m) ?? null, S = () => {
|
|
1774
|
+
r.value?.getOperationLogStore().cancelBatch();
|
|
1775
|
+
}, D = () => {
|
|
1776
|
+
r.value?.getOperationLogStore().clear();
|
|
1777
|
+
}, E = (m, f) => r.value?.getOperationLogStore().getOperationsFor(m, f) ?? [], _ = () => r.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1786
1778
|
operations: [],
|
|
1787
1779
|
currentIndex: -1,
|
|
1788
1780
|
totalOperations: 0,
|
|
1789
1781
|
reversibleOperations: 0,
|
|
1790
1782
|
irreversibleOperations: 0
|
|
1791
|
-
},
|
|
1792
|
-
|
|
1793
|
-
}, x = (
|
|
1794
|
-
|
|
1783
|
+
}, v = (m, f) => {
|
|
1784
|
+
r.value?.getOperationLogStore().markIrreversible(m, f);
|
|
1785
|
+
}, x = (m, f, b, A = "success", C) => r.value?.getOperationLogStore().logAction(m, f, b, A, C) ?? "", V = (m) => {
|
|
1786
|
+
r.value?.getOperationLogStore().configure(m);
|
|
1795
1787
|
};
|
|
1796
|
-
|
|
1788
|
+
Ve(async () => {
|
|
1797
1789
|
if (e) {
|
|
1798
|
-
|
|
1790
|
+
r.value = t || new He(e);
|
|
1799
1791
|
try {
|
|
1800
|
-
const
|
|
1801
|
-
c.value =
|
|
1802
|
-
() =>
|
|
1803
|
-
(
|
|
1804
|
-
c.value =
|
|
1792
|
+
const m = r.value.getOperationLogStore(), f = We(m);
|
|
1793
|
+
c.value = f.operations.value, h.value = f.currentIndex.value, H(
|
|
1794
|
+
() => f.operations.value,
|
|
1795
|
+
(b) => {
|
|
1796
|
+
c.value = b;
|
|
1805
1797
|
}
|
|
1806
1798
|
), H(
|
|
1807
|
-
() =>
|
|
1808
|
-
(
|
|
1809
|
-
|
|
1799
|
+
() => f.currentIndex.value,
|
|
1800
|
+
(b) => {
|
|
1801
|
+
h.value = b;
|
|
1810
1802
|
}
|
|
1811
1803
|
);
|
|
1812
1804
|
} catch {
|
|
1813
1805
|
}
|
|
1814
|
-
if (!
|
|
1815
|
-
const
|
|
1816
|
-
if (!
|
|
1817
|
-
const
|
|
1818
|
-
if (
|
|
1819
|
-
const
|
|
1820
|
-
path:
|
|
1821
|
-
segments:
|
|
1822
|
-
},
|
|
1823
|
-
if (
|
|
1824
|
-
if (e.addDoctype(
|
|
1825
|
-
const j =
|
|
1806
|
+
if (!n.doctype && e.router) {
|
|
1807
|
+
const m = e.router.currentRoute.value;
|
|
1808
|
+
if (!m.path) return;
|
|
1809
|
+
const f = m.path.split("/").filter((A) => A.length > 0), b = f[1]?.toLowerCase();
|
|
1810
|
+
if (f.length > 0) {
|
|
1811
|
+
const A = {
|
|
1812
|
+
path: m.path,
|
|
1813
|
+
segments: f
|
|
1814
|
+
}, C = await e.getMeta?.(A);
|
|
1815
|
+
if (C) {
|
|
1816
|
+
if (e.addDoctype(C), r.value.setup(C), i.value = C, a.value = b, o.value = r.value.getStore(), b && b !== "new") {
|
|
1817
|
+
const j = r.value.getRecordById(C, b);
|
|
1826
1818
|
if (j)
|
|
1827
1819
|
s.value = j.get("") || {};
|
|
1828
1820
|
else
|
|
1829
1821
|
try {
|
|
1830
|
-
await
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1822
|
+
await r.value.getRecord(C, b);
|
|
1823
|
+
const k = r.value.getRecordById(C, b);
|
|
1824
|
+
k && (s.value = k.get("") || {});
|
|
1833
1825
|
} catch {
|
|
1834
|
-
s.value =
|
|
1826
|
+
s.value = he(C);
|
|
1835
1827
|
}
|
|
1836
1828
|
} else
|
|
1837
|
-
s.value =
|
|
1838
|
-
o.value &&
|
|
1829
|
+
s.value = he(C);
|
|
1830
|
+
o.value && ke(C, b || "new", s, o.value), r.value.runAction(C, "load", b ? [b] : void 0);
|
|
1839
1831
|
}
|
|
1840
1832
|
}
|
|
1841
1833
|
}
|
|
1842
|
-
if (
|
|
1843
|
-
o.value =
|
|
1844
|
-
const
|
|
1845
|
-
if (
|
|
1846
|
-
const
|
|
1847
|
-
if (
|
|
1848
|
-
s.value =
|
|
1834
|
+
if (n.doctype) {
|
|
1835
|
+
o.value = r.value.getStore();
|
|
1836
|
+
const m = n.doctype, f = n.recordId;
|
|
1837
|
+
if (f && f !== "new") {
|
|
1838
|
+
const b = r.value.getRecordById(m, f);
|
|
1839
|
+
if (b)
|
|
1840
|
+
s.value = b.get("") || {};
|
|
1849
1841
|
else
|
|
1850
1842
|
try {
|
|
1851
|
-
await
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1843
|
+
await r.value.getRecord(m, f);
|
|
1844
|
+
const A = r.value.getRecordById(m, f);
|
|
1845
|
+
A && (s.value = A.get("") || {});
|
|
1854
1846
|
} catch {
|
|
1855
|
-
s.value =
|
|
1847
|
+
s.value = he(m);
|
|
1856
1848
|
}
|
|
1857
1849
|
} else
|
|
1858
|
-
s.value =
|
|
1859
|
-
o.value &&
|
|
1850
|
+
s.value = he(m);
|
|
1851
|
+
o.value && ke(m, f || "new", s, o.value);
|
|
1860
1852
|
}
|
|
1861
1853
|
}
|
|
1862
1854
|
});
|
|
1863
|
-
const
|
|
1864
|
-
const
|
|
1865
|
-
if (!
|
|
1866
|
-
const
|
|
1867
|
-
return `${
|
|
1868
|
-
},
|
|
1869
|
-
const
|
|
1870
|
-
if (!(!o.value || !
|
|
1855
|
+
const l = (m, f) => {
|
|
1856
|
+
const b = n.doctype || i.value;
|
|
1857
|
+
if (!b) return "";
|
|
1858
|
+
const A = f || n.recordId || a.value || "new";
|
|
1859
|
+
return `${b.slug}.${A}.${m}`;
|
|
1860
|
+
}, u = (m) => {
|
|
1861
|
+
const f = n.doctype || i.value;
|
|
1862
|
+
if (!(!o.value || !r.value || !f))
|
|
1871
1863
|
try {
|
|
1872
|
-
const
|
|
1873
|
-
if (
|
|
1874
|
-
const j =
|
|
1875
|
-
if (o.value.has(`${j}.${
|
|
1876
|
-
const
|
|
1877
|
-
let
|
|
1878
|
-
for (let F = 0; F <
|
|
1879
|
-
if (
|
|
1880
|
-
const z =
|
|
1881
|
-
o.value.set(
|
|
1864
|
+
const b = m.path.split(".");
|
|
1865
|
+
if (b.length >= 2) {
|
|
1866
|
+
const j = b[0], k = b[1];
|
|
1867
|
+
if (o.value.has(`${j}.${k}`) || r.value.addRecord(f, k, { ...s.value }), b.length > 3) {
|
|
1868
|
+
const d = `${j}.${k}`, p = b.slice(2);
|
|
1869
|
+
let y = d;
|
|
1870
|
+
for (let F = 0; F < p.length - 1; F++)
|
|
1871
|
+
if (y += `.${p[F]}`, !o.value.has(y)) {
|
|
1872
|
+
const z = p[F + 1], U = !isNaN(Number(z));
|
|
1873
|
+
o.value.set(y, U ? [] : {});
|
|
1882
1874
|
}
|
|
1883
1875
|
}
|
|
1884
1876
|
}
|
|
1885
|
-
o.value.set(
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1877
|
+
o.value.set(m.path, m.value);
|
|
1878
|
+
const A = m.fieldname.split("."), C = { ...s.value };
|
|
1879
|
+
A.length === 1 ? C[A[0]] = m.value : Pt(C, A, m.value), s.value = C;
|
|
1888
1880
|
} catch {
|
|
1889
1881
|
}
|
|
1890
1882
|
};
|
|
1891
|
-
(
|
|
1883
|
+
(n.doctype || e?.router) && (_e("hstPathProvider", l), _e("hstChangeHandler", u));
|
|
1892
1884
|
const O = {
|
|
1893
1885
|
operations: c,
|
|
1894
|
-
currentIndex:
|
|
1886
|
+
currentIndex: h,
|
|
1895
1887
|
undoRedoState: T,
|
|
1896
|
-
canUndo:
|
|
1888
|
+
canUndo: g,
|
|
1897
1889
|
canRedo: w,
|
|
1898
|
-
undoCount:
|
|
1890
|
+
undoCount: R,
|
|
1899
1891
|
redoCount: $,
|
|
1900
|
-
undo:
|
|
1901
|
-
redo:
|
|
1902
|
-
startBatch:
|
|
1903
|
-
commitBatch:
|
|
1904
|
-
cancelBatch:
|
|
1905
|
-
clear:
|
|
1892
|
+
undo: L,
|
|
1893
|
+
redo: P,
|
|
1894
|
+
startBatch: I,
|
|
1895
|
+
commitBatch: N,
|
|
1896
|
+
cancelBatch: S,
|
|
1897
|
+
clear: D,
|
|
1906
1898
|
getOperationsFor: E,
|
|
1907
|
-
getSnapshot:
|
|
1908
|
-
markIrreversible:
|
|
1899
|
+
getSnapshot: _,
|
|
1900
|
+
markIrreversible: v,
|
|
1909
1901
|
logAction: x,
|
|
1910
|
-
configure:
|
|
1902
|
+
configure: V
|
|
1911
1903
|
};
|
|
1912
|
-
return
|
|
1913
|
-
stonecrop:
|
|
1904
|
+
return n.doctype ? {
|
|
1905
|
+
stonecrop: r,
|
|
1914
1906
|
operationLog: O,
|
|
1915
|
-
provideHSTPath:
|
|
1916
|
-
handleHSTChange:
|
|
1907
|
+
provideHSTPath: l,
|
|
1908
|
+
handleHSTChange: u,
|
|
1917
1909
|
hstStore: o,
|
|
1918
1910
|
formData: s
|
|
1919
|
-
} : !
|
|
1920
|
-
stonecrop:
|
|
1911
|
+
} : !n.doctype && e?.router ? {
|
|
1912
|
+
stonecrop: r,
|
|
1921
1913
|
operationLog: O,
|
|
1922
|
-
provideHSTPath:
|
|
1923
|
-
handleHSTChange:
|
|
1914
|
+
provideHSTPath: l,
|
|
1915
|
+
handleHSTChange: u,
|
|
1924
1916
|
hstStore: o,
|
|
1925
1917
|
formData: s
|
|
1926
1918
|
} : {
|
|
1927
|
-
stonecrop:
|
|
1919
|
+
stonecrop: r,
|
|
1928
1920
|
operationLog: O
|
|
1929
1921
|
};
|
|
1930
1922
|
}
|
|
1931
|
-
function
|
|
1923
|
+
function he(n) {
|
|
1932
1924
|
const e = {};
|
|
1933
|
-
return
|
|
1925
|
+
return n.schema && n.schema.forEach((t) => {
|
|
1934
1926
|
switch ("fieldtype" in t ? t.fieldtype : "Data") {
|
|
1935
1927
|
case "Data":
|
|
1936
1928
|
case "Text":
|
|
@@ -1954,15 +1946,15 @@ function pe(r) {
|
|
|
1954
1946
|
}
|
|
1955
1947
|
}), e;
|
|
1956
1948
|
}
|
|
1957
|
-
function
|
|
1949
|
+
function ke(n, e, t, r) {
|
|
1958
1950
|
H(
|
|
1959
1951
|
t,
|
|
1960
1952
|
(o) => {
|
|
1961
|
-
const s = `${
|
|
1953
|
+
const s = `${n.slug}.${e}`;
|
|
1962
1954
|
Object.keys(o).forEach((i) => {
|
|
1963
1955
|
const a = `${s}.${i}`;
|
|
1964
1956
|
try {
|
|
1965
|
-
|
|
1957
|
+
r.set(a, o[i]);
|
|
1966
1958
|
} catch {
|
|
1967
1959
|
}
|
|
1968
1960
|
});
|
|
@@ -1970,26 +1962,26 @@ function Ce(r, e, t, n) {
|
|
|
1970
1962
|
{ deep: !0 }
|
|
1971
1963
|
);
|
|
1972
1964
|
}
|
|
1973
|
-
function
|
|
1974
|
-
let
|
|
1965
|
+
function Pt(n, e, t) {
|
|
1966
|
+
let r = n;
|
|
1975
1967
|
for (let s = 0; s < e.length - 1; s++) {
|
|
1976
1968
|
const i = e[s];
|
|
1977
|
-
(!(i in
|
|
1969
|
+
(!(i in r) || typeof r[i] != "object") && (r[i] = isNaN(Number(e[s + 1])) ? {} : []), r = r[i];
|
|
1978
1970
|
}
|
|
1979
1971
|
const o = e[e.length - 1];
|
|
1980
|
-
|
|
1972
|
+
r[o] = t;
|
|
1981
1973
|
}
|
|
1982
|
-
function
|
|
1983
|
-
const t =
|
|
1984
|
-
|
|
1985
|
-
const { operations:
|
|
1986
|
-
function
|
|
1974
|
+
function qe(n) {
|
|
1975
|
+
const t = te("$operationLogStore", void 0) || ue();
|
|
1976
|
+
n && t.configure(n);
|
|
1977
|
+
const { operations: r, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: h } = We(t);
|
|
1978
|
+
function g(E) {
|
|
1987
1979
|
return t.undo(E);
|
|
1988
1980
|
}
|
|
1989
1981
|
function w(E) {
|
|
1990
1982
|
return t.redo(E);
|
|
1991
1983
|
}
|
|
1992
|
-
function
|
|
1984
|
+
function R() {
|
|
1993
1985
|
t.startBatch();
|
|
1994
1986
|
}
|
|
1995
1987
|
function $(E) {
|
|
@@ -1998,72 +1990,72 @@ function Je(r) {
|
|
|
1998
1990
|
function T() {
|
|
1999
1991
|
t.cancelBatch();
|
|
2000
1992
|
}
|
|
2001
|
-
function
|
|
1993
|
+
function L() {
|
|
2002
1994
|
t.clear();
|
|
2003
1995
|
}
|
|
2004
|
-
function
|
|
2005
|
-
return t.getOperationsFor(E,
|
|
1996
|
+
function P(E, _) {
|
|
1997
|
+
return t.getOperationsFor(E, _);
|
|
2006
1998
|
}
|
|
2007
|
-
function
|
|
1999
|
+
function I() {
|
|
2008
2000
|
return t.getSnapshot();
|
|
2009
2001
|
}
|
|
2010
|
-
function
|
|
2011
|
-
t.markIrreversible(E,
|
|
2002
|
+
function N(E, _) {
|
|
2003
|
+
t.markIrreversible(E, _);
|
|
2012
2004
|
}
|
|
2013
|
-
function
|
|
2014
|
-
return t.logAction(E,
|
|
2005
|
+
function S(E, _, v, x = "success", V) {
|
|
2006
|
+
return t.logAction(E, _, v, x, V);
|
|
2015
2007
|
}
|
|
2016
|
-
function
|
|
2008
|
+
function D(E) {
|
|
2017
2009
|
t.configure(E);
|
|
2018
2010
|
}
|
|
2019
2011
|
return {
|
|
2020
2012
|
// State
|
|
2021
|
-
operations:
|
|
2013
|
+
operations: r,
|
|
2022
2014
|
currentIndex: o,
|
|
2023
2015
|
undoRedoState: s,
|
|
2024
2016
|
canUndo: i,
|
|
2025
2017
|
canRedo: a,
|
|
2026
2018
|
undoCount: c,
|
|
2027
|
-
redoCount:
|
|
2019
|
+
redoCount: h,
|
|
2028
2020
|
// Methods
|
|
2029
|
-
undo:
|
|
2021
|
+
undo: g,
|
|
2030
2022
|
redo: w,
|
|
2031
|
-
startBatch:
|
|
2023
|
+
startBatch: R,
|
|
2032
2024
|
commitBatch: $,
|
|
2033
2025
|
cancelBatch: T,
|
|
2034
|
-
clear:
|
|
2035
|
-
getOperationsFor:
|
|
2036
|
-
getSnapshot:
|
|
2037
|
-
markIrreversible:
|
|
2038
|
-
logAction:
|
|
2039
|
-
configure:
|
|
2026
|
+
clear: L,
|
|
2027
|
+
getOperationsFor: P,
|
|
2028
|
+
getSnapshot: I,
|
|
2029
|
+
markIrreversible: N,
|
|
2030
|
+
logAction: S,
|
|
2031
|
+
configure: D
|
|
2040
2032
|
};
|
|
2041
2033
|
}
|
|
2042
|
-
function
|
|
2034
|
+
function Mt(n, e = !0) {
|
|
2043
2035
|
if (!e) return;
|
|
2044
|
-
const { undo: t, redo:
|
|
2045
|
-
|
|
2046
|
-
o.value && t(
|
|
2047
|
-
}),
|
|
2048
|
-
o.value && t(
|
|
2049
|
-
}),
|
|
2050
|
-
s.value && n
|
|
2051
|
-
}),
|
|
2052
|
-
s.value && n
|
|
2053
|
-
}),
|
|
2054
|
-
s.value && n
|
|
2036
|
+
const { undo: t, redo: r, canUndo: o, canRedo: s } = qe(), i = Ot();
|
|
2037
|
+
ne(i["Ctrl+Z"], () => {
|
|
2038
|
+
o.value && t(n);
|
|
2039
|
+
}), ne(i["Meta+Z"], () => {
|
|
2040
|
+
o.value && t(n);
|
|
2041
|
+
}), ne(i["Ctrl+Shift+Z"], () => {
|
|
2042
|
+
s.value && r(n);
|
|
2043
|
+
}), ne(i["Meta+Shift+Z"], () => {
|
|
2044
|
+
s.value && r(n);
|
|
2045
|
+
}), ne(i["Ctrl+Y"], () => {
|
|
2046
|
+
s.value && r(n);
|
|
2055
2047
|
});
|
|
2056
2048
|
}
|
|
2057
|
-
async function
|
|
2058
|
-
const { startBatch: t, commitBatch:
|
|
2049
|
+
async function xt(n, e) {
|
|
2050
|
+
const { startBatch: t, commitBatch: r, cancelBatch: o } = qe();
|
|
2059
2051
|
t();
|
|
2060
2052
|
try {
|
|
2061
|
-
return await
|
|
2053
|
+
return await n(), r(e);
|
|
2062
2054
|
} catch (s) {
|
|
2063
2055
|
throw o(), s;
|
|
2064
2056
|
}
|
|
2065
2057
|
}
|
|
2066
|
-
class
|
|
2058
|
+
class Bt {
|
|
2067
2059
|
/**
|
|
2068
2060
|
* The doctype name
|
|
2069
2061
|
* @public
|
|
@@ -2102,8 +2094,8 @@ class Mt {
|
|
|
2102
2094
|
* @param actions - The doctype actions and field triggers
|
|
2103
2095
|
* @param component - Optional Vue component for rendering the doctype
|
|
2104
2096
|
*/
|
|
2105
|
-
constructor(e, t,
|
|
2106
|
-
this.doctype = e, this.schema = t, this.workflow =
|
|
2097
|
+
constructor(e, t, r, o, s) {
|
|
2098
|
+
this.doctype = e, this.schema = t, this.workflow = r, this.actions = o, this.component = s;
|
|
2107
2099
|
}
|
|
2108
2100
|
/**
|
|
2109
2101
|
* Converts the registered doctype string to a slug (kebab-case). The following conversions are made:
|
|
@@ -2125,7 +2117,7 @@ class Mt {
|
|
|
2125
2117
|
return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
2126
2118
|
}
|
|
2127
2119
|
}
|
|
2128
|
-
class
|
|
2120
|
+
class ce {
|
|
2129
2121
|
/**
|
|
2130
2122
|
* The root Registry instance
|
|
2131
2123
|
*/
|
|
@@ -2152,9 +2144,9 @@ class ae {
|
|
|
2152
2144
|
* @param getMeta - Optional function to fetch doctype metadata from an API
|
|
2153
2145
|
*/
|
|
2154
2146
|
constructor(e, t) {
|
|
2155
|
-
if (
|
|
2156
|
-
return
|
|
2157
|
-
|
|
2147
|
+
if (ce._root)
|
|
2148
|
+
return ce._root;
|
|
2149
|
+
ce._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
|
|
2158
2150
|
}
|
|
2159
2151
|
/**
|
|
2160
2152
|
* The getMeta function fetches doctype metadata from an API based on route context
|
|
@@ -2169,7 +2161,7 @@ class ae {
|
|
|
2169
2161
|
*/
|
|
2170
2162
|
addDoctype(e) {
|
|
2171
2163
|
e.doctype in Object.keys(this.registry) || (this.registry[e.slug] = e);
|
|
2172
|
-
const t =
|
|
2164
|
+
const t = J();
|
|
2173
2165
|
t.registerDoctypeActions(e.doctype, e.actions), e.slug !== e.doctype && t.registerDoctypeActions(e.slug, e.actions), e.component && this.router && !this.router.hasRoute(e.doctype) && this.router.addRoute({
|
|
2174
2166
|
path: `/${e.slug}`,
|
|
2175
2167
|
name: e.slug,
|
|
@@ -2189,53 +2181,272 @@ class ae {
|
|
|
2189
2181
|
// }
|
|
2190
2182
|
// }
|
|
2191
2183
|
}
|
|
2192
|
-
async function
|
|
2193
|
-
await
|
|
2184
|
+
async function _t(n, e, t) {
|
|
2185
|
+
await le();
|
|
2194
2186
|
try {
|
|
2195
|
-
await t(
|
|
2187
|
+
await t(n, e);
|
|
2196
2188
|
} catch {
|
|
2197
2189
|
}
|
|
2198
2190
|
}
|
|
2199
|
-
const
|
|
2200
|
-
install: (
|
|
2201
|
-
const t =
|
|
2202
|
-
!t &&
|
|
2203
|
-
const s = new
|
|
2204
|
-
|
|
2191
|
+
const jt = {
|
|
2192
|
+
install: (n, e) => {
|
|
2193
|
+
const t = n.config.globalProperties.$router, r = e?.router, o = t || r;
|
|
2194
|
+
!t && r && n.use(r);
|
|
2195
|
+
const s = new ce(o, e?.getMeta);
|
|
2196
|
+
n.provide("$registry", s), n.config.globalProperties.$registry = s;
|
|
2205
2197
|
const i = new He(s);
|
|
2206
|
-
|
|
2198
|
+
n.provide("$stonecrop", i), n.config.globalProperties.$stonecrop = i;
|
|
2207
2199
|
try {
|
|
2208
|
-
const a =
|
|
2200
|
+
const a = n.config.globalProperties.$pinia;
|
|
2209
2201
|
if (a) {
|
|
2210
2202
|
const c = ue(a);
|
|
2211
|
-
|
|
2203
|
+
n.provide("$operationLogStore", c), n.config.globalProperties.$operationLogStore = c;
|
|
2212
2204
|
}
|
|
2213
2205
|
} catch (a) {
|
|
2214
2206
|
console.warn("Pinia not available - operation log features will be disabled:", a);
|
|
2215
2207
|
}
|
|
2216
2208
|
if (e?.components)
|
|
2217
2209
|
for (const [a, c] of Object.entries(e.components))
|
|
2218
|
-
|
|
2219
|
-
e?.autoInitializeRouter && e.onRouterInitialized &&
|
|
2210
|
+
n.component(a, c);
|
|
2211
|
+
e?.autoInitializeRouter && e.onRouterInitialized && _t(s, i, e.onRouterInitialized);
|
|
2220
2212
|
}
|
|
2221
2213
|
};
|
|
2214
|
+
var At = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(At || {});
|
|
2215
|
+
class $t {
|
|
2216
|
+
options;
|
|
2217
|
+
/**
|
|
2218
|
+
* Creates a new SchemaValidator instance
|
|
2219
|
+
* @param options - Validator configuration options
|
|
2220
|
+
*/
|
|
2221
|
+
constructor(e = {}) {
|
|
2222
|
+
this.options = {
|
|
2223
|
+
registry: e.registry || null,
|
|
2224
|
+
validateLinkTargets: e.validateLinkTargets ?? !0,
|
|
2225
|
+
validateActions: e.validateActions ?? !0,
|
|
2226
|
+
validateWorkflows: e.validateWorkflows ?? !0,
|
|
2227
|
+
validateRequiredProperties: e.validateRequiredProperties ?? !0
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Validates a complete doctype schema
|
|
2232
|
+
* @param doctype - Doctype name
|
|
2233
|
+
* @param schema - Schema fields (List or Array)
|
|
2234
|
+
* @param workflow - Optional workflow configuration
|
|
2235
|
+
* @param actions - Optional actions map
|
|
2236
|
+
* @returns Validation result
|
|
2237
|
+
*/
|
|
2238
|
+
validate(e, t, r, o) {
|
|
2239
|
+
const s = [], i = t ? Array.isArray(t) ? t : t.toArray() : [];
|
|
2240
|
+
if (this.options.validateRequiredProperties && s.push(...this.validateRequiredProperties(e, i)), this.options.validateLinkTargets && this.options.registry && s.push(...this.validateLinkFields(e, i, this.options.registry)), this.options.validateWorkflows && r && s.push(...this.validateWorkflow(e, r)), this.options.validateActions && o) {
|
|
2241
|
+
const g = o instanceof Map ? o : o.toObject();
|
|
2242
|
+
s.push(...this.validateActionRegistration(e, g));
|
|
2243
|
+
}
|
|
2244
|
+
const a = s.filter(
|
|
2245
|
+
(g) => g.severity === "error"
|
|
2246
|
+
/* ERROR */
|
|
2247
|
+
).length, c = s.filter(
|
|
2248
|
+
(g) => g.severity === "warning"
|
|
2249
|
+
/* WARNING */
|
|
2250
|
+
).length, h = s.filter(
|
|
2251
|
+
(g) => g.severity === "info"
|
|
2252
|
+
/* INFO */
|
|
2253
|
+
).length;
|
|
2254
|
+
return {
|
|
2255
|
+
valid: a === 0,
|
|
2256
|
+
issues: s,
|
|
2257
|
+
errorCount: a,
|
|
2258
|
+
warningCount: c,
|
|
2259
|
+
infoCount: h
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* Validates that required schema properties are present
|
|
2264
|
+
* @internal
|
|
2265
|
+
*/
|
|
2266
|
+
validateRequiredProperties(e, t) {
|
|
2267
|
+
const r = [];
|
|
2268
|
+
for (const o of t) {
|
|
2269
|
+
if (!o.fieldname) {
|
|
2270
|
+
r.push({
|
|
2271
|
+
severity: "error",
|
|
2272
|
+
rule: "required-fieldname",
|
|
2273
|
+
message: "Field is missing required property: fieldname",
|
|
2274
|
+
doctype: e,
|
|
2275
|
+
context: { field: o }
|
|
2276
|
+
});
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2279
|
+
if (!o.component && !("fieldtype" in o) && r.push({
|
|
2280
|
+
severity: "error",
|
|
2281
|
+
rule: "required-component-or-fieldtype",
|
|
2282
|
+
message: `Field "${o.fieldname}" must have either component or fieldtype property`,
|
|
2283
|
+
doctype: e,
|
|
2284
|
+
fieldname: o.fieldname
|
|
2285
|
+
}), "schema" in o) {
|
|
2286
|
+
const s = o.schema, i = Array.isArray(s) ? s : s.toArray?.() || [];
|
|
2287
|
+
r.push(...this.validateRequiredProperties(e, i));
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
return r;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Validates Link field targets exist in registry
|
|
2294
|
+
* @internal
|
|
2295
|
+
*/
|
|
2296
|
+
validateLinkFields(e, t, r) {
|
|
2297
|
+
const o = [];
|
|
2298
|
+
for (const s of t) {
|
|
2299
|
+
if (("fieldtype" in s ? s.fieldtype : void 0) === "Link") {
|
|
2300
|
+
const a = "options" in s ? s.options : void 0;
|
|
2301
|
+
if (!a) {
|
|
2302
|
+
o.push({
|
|
2303
|
+
severity: "error",
|
|
2304
|
+
rule: "link-missing-options",
|
|
2305
|
+
message: `Link field "${s.fieldname}" is missing options property (target doctype)`,
|
|
2306
|
+
doctype: e,
|
|
2307
|
+
fieldname: s.fieldname
|
|
2308
|
+
});
|
|
2309
|
+
continue;
|
|
2310
|
+
}
|
|
2311
|
+
const c = typeof a == "string" ? a : "";
|
|
2312
|
+
if (!c) {
|
|
2313
|
+
o.push({
|
|
2314
|
+
severity: "error",
|
|
2315
|
+
rule: "link-invalid-options",
|
|
2316
|
+
message: `Link field "${s.fieldname}" has invalid options format (expected string doctype name)`,
|
|
2317
|
+
doctype: e,
|
|
2318
|
+
fieldname: s.fieldname
|
|
2319
|
+
});
|
|
2320
|
+
continue;
|
|
2321
|
+
}
|
|
2322
|
+
r.registry[c] || r.registry[c.toLowerCase()] || o.push({
|
|
2323
|
+
severity: "error",
|
|
2324
|
+
rule: "link-invalid-target",
|
|
2325
|
+
message: `Link field "${s.fieldname}" references non-existent doctype: "${c}"`,
|
|
2326
|
+
doctype: e,
|
|
2327
|
+
fieldname: s.fieldname,
|
|
2328
|
+
context: { targetDoctype: c }
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
if ("schema" in s) {
|
|
2332
|
+
const a = s.schema, c = Array.isArray(a) ? a : a.toArray?.() || [];
|
|
2333
|
+
o.push(...this.validateLinkFields(e, c, r));
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
return o;
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Validates workflow state machine configuration
|
|
2340
|
+
* @internal
|
|
2341
|
+
*/
|
|
2342
|
+
validateWorkflow(e, t) {
|
|
2343
|
+
const r = [];
|
|
2344
|
+
if (!t.initial && !t.type && r.push({
|
|
2345
|
+
severity: "warning",
|
|
2346
|
+
rule: "workflow-missing-initial",
|
|
2347
|
+
message: "Workflow is missing initial state property",
|
|
2348
|
+
doctype: e
|
|
2349
|
+
}), !t.states || Object.keys(t.states).length === 0)
|
|
2350
|
+
return r.push({
|
|
2351
|
+
severity: "warning",
|
|
2352
|
+
rule: "workflow-no-states",
|
|
2353
|
+
message: "Workflow has no states defined",
|
|
2354
|
+
doctype: e
|
|
2355
|
+
}), r;
|
|
2356
|
+
t.initial && typeof t.initial == "string" && !t.states[t.initial] && r.push({
|
|
2357
|
+
severity: "error",
|
|
2358
|
+
rule: "workflow-invalid-initial",
|
|
2359
|
+
message: `Workflow initial state "${t.initial}" does not exist in states`,
|
|
2360
|
+
doctype: e,
|
|
2361
|
+
context: { initialState: t.initial }
|
|
2362
|
+
});
|
|
2363
|
+
const o = Object.keys(t.states), s = /* @__PURE__ */ new Set();
|
|
2364
|
+
t.initial && typeof t.initial == "string" && s.add(t.initial);
|
|
2365
|
+
for (const [i, a] of Object.entries(t.states)) {
|
|
2366
|
+
const c = a;
|
|
2367
|
+
if (c.on) {
|
|
2368
|
+
for (const [h, g] of Object.entries(c.on))
|
|
2369
|
+
if (typeof g == "string")
|
|
2370
|
+
s.add(g);
|
|
2371
|
+
else if (g && typeof g == "object") {
|
|
2372
|
+
const w = "target" in g ? g.target : void 0;
|
|
2373
|
+
typeof w == "string" ? s.add(w) : Array.isArray(w) && w.forEach((R) => {
|
|
2374
|
+
typeof R == "string" && s.add(R);
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
for (const i of o)
|
|
2380
|
+
s.has(i) || r.push({
|
|
2381
|
+
severity: "warning",
|
|
2382
|
+
rule: "workflow-unreachable-state",
|
|
2383
|
+
message: `Workflow state "${i}" may not be reachable`,
|
|
2384
|
+
doctype: e,
|
|
2385
|
+
context: { stateName: i }
|
|
2386
|
+
});
|
|
2387
|
+
return r;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* Validates that actions are registered in the FieldTriggerEngine
|
|
2391
|
+
* @internal
|
|
2392
|
+
*/
|
|
2393
|
+
validateActionRegistration(e, t) {
|
|
2394
|
+
const r = [], o = J();
|
|
2395
|
+
for (const [s, i] of Object.entries(t)) {
|
|
2396
|
+
if (!Array.isArray(i)) {
|
|
2397
|
+
r.push({
|
|
2398
|
+
severity: "error",
|
|
2399
|
+
rule: "action-invalid-format",
|
|
2400
|
+
message: `Action configuration for "${s}" must be an array`,
|
|
2401
|
+
doctype: e,
|
|
2402
|
+
context: { triggerName: s, actionNames: i }
|
|
2403
|
+
});
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
for (const a of i) {
|
|
2407
|
+
const c = o;
|
|
2408
|
+
c.globalActions?.has(a) || c.globalTransitionActions?.has(a) || r.push({
|
|
2409
|
+
severity: "warning",
|
|
2410
|
+
rule: "action-not-registered",
|
|
2411
|
+
message: `Action "${a}" referenced in "${s}" is not registered in FieldTriggerEngine`,
|
|
2412
|
+
doctype: e,
|
|
2413
|
+
context: { triggerName: s, actionName: a }
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
return r;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
function It(n, e) {
|
|
2421
|
+
return new $t({
|
|
2422
|
+
registry: n,
|
|
2423
|
+
...e
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
function Wt(n, e, t, r, o) {
|
|
2427
|
+
return It(t).validate(n, e, r, o);
|
|
2428
|
+
}
|
|
2222
2429
|
export {
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2430
|
+
Bt as DoctypeMeta,
|
|
2431
|
+
ee as HST,
|
|
2432
|
+
ce as Registry,
|
|
2433
|
+
$t as SchemaValidator,
|
|
2226
2434
|
He as Stonecrop,
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2435
|
+
At as ValidationSeverity,
|
|
2436
|
+
Nt as createHST,
|
|
2437
|
+
It as createValidator,
|
|
2438
|
+
jt as default,
|
|
2439
|
+
J as getGlobalTriggerEngine,
|
|
2440
|
+
Lt as markOperationIrreversible,
|
|
2441
|
+
Tt as registerGlobalAction,
|
|
2442
|
+
Ct as registerTransitionAction,
|
|
2443
|
+
kt as setFieldRollback,
|
|
2444
|
+
Ft as triggerTransition,
|
|
2445
|
+
qe as useOperationLog,
|
|
2236
2446
|
ue as useOperationLogStore,
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2447
|
+
Vt as useStonecrop,
|
|
2448
|
+
Mt as useUndoRedoShortcuts,
|
|
2449
|
+
Wt as validateSchema,
|
|
2450
|
+
xt as withBatch
|
|
2240
2451
|
};
|
|
2241
2452
|
//# sourceMappingURL=stonecrop.js.map
|