@voltro/client 0.62.3 → 0.64.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/CHANGELOG.md +104 -0
- package/dist/index.d.ts +153 -25
- package/dist/index.js +1129 -850
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Cause as
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as C } from "./formData-He_L4ozH.js";
|
|
2
|
+
import { createContext as w, createElement as T, useCallback as E, useContext as ee, useDebugValue as te, useEffect as D, useMemo as O, useRef as k, useState as A, useSyncExternalStore as j } from "react";
|
|
3
|
+
import { Cause as M, Context as ne, Duration as re, Effect as N, Exit as P, Fiber as ie, Layer as F, ManagedRuntime as I, Option as L, Schedule as R, Schema as ae, Stream as z } from "effect";
|
|
4
4
|
import * as oe from "@effect/platform/Headers";
|
|
5
5
|
import { RpcClient as se, RpcClientError as ce, RpcSerialization as le } from "@effect/rpc";
|
|
6
6
|
import { applyRowPatch as ue, fieldIssuesOf as de, pluginTag as fe } from "@voltro/protocol";
|
|
@@ -16,7 +16,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
16
16
|
} catch {}
|
|
17
17
|
}, ye = (e) => (_e.add(e), () => {
|
|
18
18
|
_e.delete(e);
|
|
19
|
-
}), be = /* @__PURE__ */ new WeakMap(), xe = (e, t) => ((typeof e == "object" && e || typeof e == "function") && be.set(e, t), e),
|
|
19
|
+
}), be = /* @__PURE__ */ new WeakMap(), xe = (e, t) => ((typeof e == "object" && e || typeof e == "function") && be.set(e, t), e), V = (e, t) => {
|
|
20
20
|
if ((typeof e != "object" || !e) && typeof e != "function") return t;
|
|
21
21
|
let n = be.get(e);
|
|
22
22
|
if (n !== void 0) return n;
|
|
@@ -25,89 +25,89 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
25
25
|
} catch {
|
|
26
26
|
return t;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, Se = "voltro.client-diagnostics.v1", H = 400, Ce = 240, we = Symbol.for("@voltro/client/diagnostics"), Te = globalThis, Ee = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), U = Te[we] ?? (Te[we] = {
|
|
29
29
|
sessionStartedAt: Date.now(),
|
|
30
|
-
monotonicStartedAt:
|
|
30
|
+
monotonicStartedAt: Ee(),
|
|
31
31
|
sequence: 0,
|
|
32
32
|
dropped: 0,
|
|
33
33
|
storage: void 0,
|
|
34
34
|
events: [],
|
|
35
35
|
loadedStorage: !1,
|
|
36
36
|
listeners: /* @__PURE__ */ new Set()
|
|
37
|
-
}),
|
|
37
|
+
}), De = (e) => e.length <= Ce ? e : `${e.slice(0, Ce)}…`, Oe = (e) => {
|
|
38
38
|
let t = {};
|
|
39
|
-
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = typeof r == "string" ?
|
|
39
|
+
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = typeof r == "string" ? De(r) : r);
|
|
40
40
|
return t;
|
|
41
|
-
},
|
|
41
|
+
}, ke = (e) => {
|
|
42
42
|
if (typeof e != "object" || !e) return !1;
|
|
43
43
|
let t = e;
|
|
44
44
|
return typeof t.sequence == "number" && typeof t.at == "number" && typeof t.elapsedMs == "number" && typeof t.api == "string" && typeof t.kind == "string" && typeof t.fields == "object" && t.fields !== null;
|
|
45
|
-
},
|
|
46
|
-
if (
|
|
47
|
-
|
|
45
|
+
}, Ae = () => {
|
|
46
|
+
if (U.storage !== void 0) try {
|
|
47
|
+
U.storage.setItem(Se, JSON.stringify({
|
|
48
48
|
version: 1,
|
|
49
|
-
sessionStartedAt:
|
|
50
|
-
sequence:
|
|
51
|
-
dropped:
|
|
52
|
-
events:
|
|
49
|
+
sessionStartedAt: U.sessionStartedAt,
|
|
50
|
+
sequence: U.sequence,
|
|
51
|
+
dropped: U.dropped,
|
|
52
|
+
events: U.events
|
|
53
53
|
}));
|
|
54
54
|
} catch {}
|
|
55
|
-
},
|
|
56
|
-
for (let e of
|
|
55
|
+
}, je = () => {
|
|
56
|
+
for (let e of U.listeners) try {
|
|
57
57
|
e();
|
|
58
58
|
} catch {}
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
61
|
-
|
|
59
|
+
}, Me = (e) => {
|
|
60
|
+
if (U.storage = e, !U.loadedStorage) {
|
|
61
|
+
U.loadedStorage = !0;
|
|
62
62
|
try {
|
|
63
|
-
let t = e.getItem(
|
|
63
|
+
let t = e.getItem(Se);
|
|
64
64
|
if (t !== null) {
|
|
65
|
-
let e = JSON.parse(t), n = Array.isArray(e.events) ? e.events.filter(
|
|
65
|
+
let e = JSON.parse(t), n = Array.isArray(e.events) ? e.events.filter(ke) : [], r = Math.max(typeof e.sequence == "number" ? e.sequence : 0, 0, ...n.map((e) => e.sequence)), i = U.events.map((e, t) => ({
|
|
66
66
|
...e,
|
|
67
67
|
sequence: r + t + 1
|
|
68
|
-
})), a = [...n, ...i], o = Math.max(0, a.length -
|
|
69
|
-
|
|
68
|
+
})), a = [...n, ...i], o = Math.max(0, a.length - H), s = typeof e.dropped == "number" ? e.dropped : 0;
|
|
69
|
+
U.dropped = U.dropped + s + o, U.events = a.slice(-400), U.sequence = Math.max(r + i.length, ...U.events.map((e) => e.sequence)), typeof e.sessionStartedAt == "number" && (U.sessionStartedAt = Math.min(U.sessionStartedAt, e.sessionStartedAt));
|
|
70
70
|
}
|
|
71
71
|
} catch {}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
73
|
+
Ae();
|
|
74
|
+
}, Ne = () => {
|
|
75
|
+
U.storage = void 0;
|
|
76
|
+
}, W = (e, t, n = {}) => {
|
|
77
77
|
let r = {
|
|
78
|
-
sequence: ++
|
|
78
|
+
sequence: ++U.sequence,
|
|
79
79
|
at: Date.now(),
|
|
80
|
-
elapsedMs: Math.max(0, Math.round(
|
|
81
|
-
api:
|
|
80
|
+
elapsedMs: Math.max(0, Math.round(Ee() - U.monotonicStartedAt)),
|
|
81
|
+
api: De(e),
|
|
82
82
|
kind: t,
|
|
83
|
-
fields:
|
|
83
|
+
fields: Oe(n)
|
|
84
84
|
};
|
|
85
|
-
return
|
|
86
|
-
},
|
|
85
|
+
return U.events.push(r), U.events.length > H && (U.events.splice(0, U.events.length - H), U.dropped += 1), Ae(), je(), r;
|
|
86
|
+
}, Pe = (e) => ({
|
|
87
87
|
version: 1,
|
|
88
88
|
generatedAt: Date.now(),
|
|
89
|
-
sessionStartedAt:
|
|
90
|
-
persisted:
|
|
91
|
-
dropped:
|
|
92
|
-
events: e === void 0 ? [...
|
|
93
|
-
}),
|
|
94
|
-
|
|
89
|
+
sessionStartedAt: U.sessionStartedAt,
|
|
90
|
+
persisted: U.storage !== void 0,
|
|
91
|
+
dropped: U.dropped,
|
|
92
|
+
events: e === void 0 ? [...U.events] : U.events.filter((t) => t.api === e)
|
|
93
|
+
}), Fe = () => {
|
|
94
|
+
U.events = [], U.dropped = 0;
|
|
95
95
|
try {
|
|
96
|
-
|
|
96
|
+
U.storage?.removeItem(Se);
|
|
97
97
|
} catch {}
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
}),
|
|
98
|
+
je();
|
|
99
|
+
}, Ie = (e) => (U.listeners.add(e), () => {
|
|
100
|
+
U.listeners.delete(e);
|
|
101
|
+
}), G = (e) => {
|
|
102
102
|
let t = (e) => e == null ? "null" : typeof e == "string" ? JSON.stringify(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? `[${e.map(t).join(",")}]` : typeof e == "object" ? `{${Object.keys(e).sort().map((n) => `${JSON.stringify(n)}:${t(e[n])}`).join(",")}}` : String(e);
|
|
103
103
|
return t(e);
|
|
104
|
-
},
|
|
104
|
+
}, Le = Object.freeze({
|
|
105
105
|
data: void 0,
|
|
106
106
|
revision: -1,
|
|
107
107
|
emittedAt: void 0,
|
|
108
108
|
error: void 0,
|
|
109
109
|
pendingPatches: 0
|
|
110
|
-
}),
|
|
110
|
+
}), Re = 5e3, ze = (e, t, n) => {
|
|
111
111
|
if (e._tag === "error") return !1;
|
|
112
112
|
if (e._tag === "delta") return !0;
|
|
113
113
|
try {
|
|
@@ -115,21 +115,21 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
115
115
|
} catch {
|
|
116
116
|
return !1;
|
|
117
117
|
}
|
|
118
|
-
},
|
|
118
|
+
}, Be = 0, Ve = () => `patch_${++Be}`, He = (e, t) => {
|
|
119
119
|
let n = e;
|
|
120
120
|
for (let e of t.split(".")) {
|
|
121
121
|
if (typeof n != "object" || !n) return;
|
|
122
122
|
n = n[e];
|
|
123
123
|
}
|
|
124
124
|
return n;
|
|
125
|
-
},
|
|
125
|
+
}, Ue = (e, t, n) => {
|
|
126
126
|
let r = t.split("."), i = (e) => typeof e == "object" && e && !Array.isArray(e) ? { ...e } : {}, a = i(e), o = a;
|
|
127
127
|
for (let e = 0; e < r.length - 1; e += 1) o[r[e]] = i(o[r[e]]), o = o[r[e]];
|
|
128
128
|
return o[r[r.length - 1]] = n, a;
|
|
129
|
-
},
|
|
129
|
+
}, We = (e, t) => {
|
|
130
130
|
let n = e.by ?? "id", r = e.identify ? e.identify(t) : typeof t[n] == "string" ? t[n] : typeof t.id == "string" ? t.id : void 0, i = r === void 0 ? [] : Array.isArray(r) ? r : [r];
|
|
131
131
|
return i.length === 0 ? null : new Set(i);
|
|
132
|
-
},
|
|
132
|
+
}, Ge = (e, t, n) => {
|
|
133
133
|
let r = e.path, i = e.by ?? "id";
|
|
134
134
|
if (e.op === "insert") {
|
|
135
135
|
let a = e.shapeItem ?? e.shape, o = a ? {
|
|
@@ -142,11 +142,11 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
142
142
|
optimistic: !0
|
|
143
143
|
}, s = e.order ?? "append";
|
|
144
144
|
return (e) => {
|
|
145
|
-
let t = Array.isArray(
|
|
146
|
-
return
|
|
145
|
+
let t = Array.isArray(He(e, r)) ? He(e, r) : [];
|
|
146
|
+
return Ue(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
let a =
|
|
149
|
+
let a = We(e, t);
|
|
150
150
|
if (a === null) return null;
|
|
151
151
|
if (e.op === "update") {
|
|
152
152
|
let n = e.shapeItem ?? e.shape, o = n ? (e) => ({
|
|
@@ -160,24 +160,24 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
160
160
|
optimistic: !0
|
|
161
161
|
});
|
|
162
162
|
return (e) => {
|
|
163
|
-
let t =
|
|
163
|
+
let t = He(e, r);
|
|
164
164
|
if (!Array.isArray(t)) {
|
|
165
165
|
if (typeof t != "object" || !t) return e;
|
|
166
166
|
let n = t;
|
|
167
|
-
return a.has(n[i]) ?
|
|
167
|
+
return a.has(n[i]) ? Ue(e, r, o(n)) : e;
|
|
168
168
|
}
|
|
169
|
-
return
|
|
169
|
+
return Ue(e, r, t.map((e) => a.has(e[i]) ? o(e) : e));
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
return (e) => {
|
|
173
|
-
let t = Array.isArray(
|
|
174
|
-
return
|
|
173
|
+
let t = Array.isArray(He(e, r)) ? He(e, r) : [];
|
|
174
|
+
return Ue(e, r, t.filter((e) => !a.has(e[i])));
|
|
175
175
|
};
|
|
176
|
-
},
|
|
176
|
+
}, Ke = (e, t, n) => {
|
|
177
177
|
if (e.op === "insert") return n;
|
|
178
178
|
let r = t.id;
|
|
179
179
|
return typeof r == "string" && r.length > 0 ? r : null;
|
|
180
|
-
},
|
|
180
|
+
}, qe = (e, t, n, r) => {
|
|
181
181
|
let { anchorColumn: i, targetColumn: a } = e, o = new Set(n.map((e) => String(e)));
|
|
182
182
|
return (e) => {
|
|
183
183
|
if (!Array.isArray(e)) return e;
|
|
@@ -208,8 +208,8 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
208
208
|
}));
|
|
209
209
|
return c ? n : e;
|
|
210
210
|
};
|
|
211
|
-
},
|
|
212
|
-
if (e.path !== void 0) return
|
|
211
|
+
}, Je = (e, t, n) => {
|
|
212
|
+
if (e.path !== void 0) return Ge(e, t, n);
|
|
213
213
|
switch (e.op) {
|
|
214
214
|
case "insert": {
|
|
215
215
|
let r = e.shape ? {
|
|
@@ -227,7 +227,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
case "update": {
|
|
230
|
-
let n =
|
|
230
|
+
let n = We(e, t);
|
|
231
231
|
if (n === null) return null;
|
|
232
232
|
let r = e.shape, i = r ? (e) => ({
|
|
233
233
|
...r(t, e),
|
|
@@ -250,7 +250,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
case "delete": {
|
|
253
|
-
let n =
|
|
253
|
+
let n = We(e, t);
|
|
254
254
|
return n === null ? null : (e) => {
|
|
255
255
|
if (!Array.isArray(e)) {
|
|
256
256
|
let t = e;
|
|
@@ -260,8 +260,9 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, Ye = 5e3, Xe = 15e3, Ze = class {
|
|
264
264
|
entries = /* @__PURE__ */ new Map();
|
|
265
|
+
successor;
|
|
265
266
|
inactiveTtlMs;
|
|
266
267
|
onChangeHook;
|
|
267
268
|
errorBus;
|
|
@@ -270,10 +271,10 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
270
271
|
apiName;
|
|
271
272
|
recoveryStuckMs;
|
|
272
273
|
constructor(e = {}) {
|
|
273
|
-
this.inactiveTtlMs = e.inactiveTtlMs ??
|
|
274
|
+
this.inactiveTtlMs = e.inactiveTtlMs ?? Ye, this.onChangeHook = e.onChange, this.errorBus = e.errorBus, this.mirror = e.mirror, this.mergeCell = e.mergeCell, this.apiName = e.apiName, this.recoveryStuckMs = e.recoveryStuckMs ?? Xe;
|
|
274
275
|
}
|
|
275
276
|
diagnose(e, t, n = {}) {
|
|
276
|
-
this.apiName !== void 0 &&
|
|
277
|
+
this.apiName !== void 0 && W(this.apiName, e, {
|
|
277
278
|
tag: t.tag ?? "unknown",
|
|
278
279
|
revision: t.state.baseRevision,
|
|
279
280
|
subscribers: t.subscribers.size,
|
|
@@ -282,21 +283,22 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
282
283
|
});
|
|
283
284
|
}
|
|
284
285
|
subscribe(e, t, n, r, i = {}) {
|
|
285
|
-
let a =
|
|
286
|
+
let a = G(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
|
|
286
287
|
return s && s.evictionTimer !== null && (clearTimeout(s.evictionTimer), s.evictionTimer = null), s ? (s.fiber === null && (s.fetch = t, s.runtime = n, this.startFiber(s, t, n)), s.source === void 0 && i.source !== void 0 && (s.source = i.source)) : s = this.create(a, o, t, n, i.source), s.subscribers.add(r), {
|
|
287
288
|
getSnapshot: () => this.getSnapshot(a),
|
|
288
289
|
unsubscribe: () => this.unsubscribe(a, r)
|
|
289
290
|
};
|
|
290
291
|
}
|
|
291
292
|
update(e, t, n) {
|
|
292
|
-
let r =
|
|
293
|
+
let r = G(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
|
|
293
294
|
a ||= this.createStub(r, i);
|
|
294
295
|
let o = {
|
|
295
|
-
id:
|
|
296
|
+
id: Ve(),
|
|
296
297
|
mutationId: n,
|
|
297
|
-
reducer: t
|
|
298
|
+
reducer: t,
|
|
299
|
+
baseMovesAtApply: a.baseMoves
|
|
298
300
|
};
|
|
299
|
-
return a.state.patches.push(o), this.invalidate(a), {
|
|
301
|
+
return a.state.patches.push(o), this.invalidate(a), this.successor?.update(e, t, n), {
|
|
300
302
|
patchId: o.id,
|
|
301
303
|
revert: () => this.revertPatch(r, o.id)
|
|
302
304
|
};
|
|
@@ -306,34 +308,41 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
306
308
|
for (let i of this.entries.values()) {
|
|
307
309
|
if (i.tag !== e) continue;
|
|
308
310
|
let a = {
|
|
309
|
-
id: `forTag-${++
|
|
311
|
+
id: `forTag-${++Be}`,
|
|
310
312
|
mutationId: n,
|
|
311
|
-
reducer: t
|
|
313
|
+
reducer: t,
|
|
314
|
+
baseMovesAtApply: i.baseMoves
|
|
312
315
|
};
|
|
313
316
|
i.state.patches.push(a), this.invalidate(i), r++;
|
|
314
317
|
}
|
|
315
|
-
return { patchedCount: r };
|
|
318
|
+
return this.successor?.forTag(e, t, n), { patchedCount: r };
|
|
316
319
|
}
|
|
317
320
|
revertByMutation(e) {
|
|
318
321
|
for (let t of this.entries.values()) {
|
|
319
322
|
let n = t.state.patches.length;
|
|
320
323
|
t.state.patches = t.state.patches.filter((t) => t.mutationId !== e), t.state.patches.length !== n && this.invalidate(t);
|
|
321
324
|
}
|
|
325
|
+
this.successor?.revertByMutation(e);
|
|
322
326
|
}
|
|
323
327
|
confirmByMutation(e) {
|
|
324
328
|
let t = !1;
|
|
325
|
-
for (let n of this.entries.values())
|
|
326
|
-
|
|
329
|
+
for (let n of this.entries.values()) {
|
|
330
|
+
let r = n.state.patches.filter((t) => t.mutationId === e && t.confirmed !== !0 && n.baseMoves > t.baseMovesAtApply);
|
|
331
|
+
r.length > 0 && (n.state.patches = n.state.patches.filter((e) => !r.includes(e)), this.invalidate(n));
|
|
332
|
+
for (let r of n.state.patches) r.mutationId === e && r.confirmed !== !0 && (r.confirmed = !0, t = !0);
|
|
333
|
+
}
|
|
334
|
+
t && setTimeout(() => this.resyncUnechoedMutation(e), Re), this.successor?.confirmByMutation(e);
|
|
327
335
|
}
|
|
328
336
|
resyncUnechoedMutation(e) {
|
|
329
337
|
for (let t of this.entries.values()) {
|
|
330
338
|
if (!t.state.patches.some((t) => t.mutationId === e && t.confirmed === !0)) continue;
|
|
331
|
-
let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${
|
|
339
|
+
let n = t.tag ?? t.key, r = `optimistic patch for ${n} got no superseding server event within ${Re}ms — the write is confirmed, so the preview is KEPT. Check reactivity for this query's source table.`;
|
|
332
340
|
this.errorBus?.emit({
|
|
333
341
|
source: "subscription",
|
|
334
342
|
tag: n,
|
|
335
343
|
error: Error(r),
|
|
336
344
|
kind: "client",
|
|
345
|
+
outcome: "not-applicable",
|
|
337
346
|
...t.traceId === void 0 ? {} : { traceId: t.traceId }
|
|
338
347
|
}), console.warn(`[voltro] ${r}`, {
|
|
339
348
|
mutationId: e,
|
|
@@ -342,7 +351,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
342
351
|
}
|
|
343
352
|
}
|
|
344
353
|
autoApply(e, t, n) {
|
|
345
|
-
let r = `optimistic-${n}-${++
|
|
354
|
+
let r = `optimistic-${n}-${++Be}`;
|
|
346
355
|
for (let i of e) {
|
|
347
356
|
for (let e of this.entries.values()) {
|
|
348
357
|
if (!(Array.isArray(e.source) ? e.source.includes(i.table) : e.source === i.table)) continue;
|
|
@@ -356,12 +365,13 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
356
365
|
if (!n) continue;
|
|
357
366
|
}
|
|
358
367
|
if (e.computed && i.op === "insert" && i.path === void 0) continue;
|
|
359
|
-
let a =
|
|
368
|
+
let a = Je(i, t, r);
|
|
360
369
|
if (a === null) continue;
|
|
361
370
|
let o = {
|
|
362
371
|
id: `${r}-${e.key}`,
|
|
363
372
|
mutationId: n,
|
|
364
|
-
reducer: a
|
|
373
|
+
reducer: a,
|
|
374
|
+
baseMovesAtApply: e.baseMoves
|
|
365
375
|
};
|
|
366
376
|
e.state.patches.push(o), this.invalidate(e);
|
|
367
377
|
}
|
|
@@ -369,18 +379,20 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
369
379
|
if (e !== void 0) for (let [a, o] of Object.entries(e)) {
|
|
370
380
|
let e = t[a];
|
|
371
381
|
if (!Array.isArray(e)) continue;
|
|
372
|
-
let s =
|
|
382
|
+
let s = Ke(i, t, r);
|
|
373
383
|
if (s !== null) for (let t of this.entries.values()) {
|
|
374
384
|
if (!(Array.isArray(t.source) ? t.source.includes(o.junction) : t.source === o.junction) || t.computed) continue;
|
|
375
|
-
let i =
|
|
385
|
+
let i = qe(o, s, e.map((e) => String(e)), `${r}-${a}`);
|
|
376
386
|
t.state.patches.push({
|
|
377
387
|
id: `${r}-${a}-${t.key}`,
|
|
378
388
|
mutationId: n,
|
|
379
|
-
reducer: i
|
|
389
|
+
reducer: i,
|
|
390
|
+
baseMovesAtApply: t.baseMoves
|
|
380
391
|
}), this.invalidate(t);
|
|
381
392
|
}
|
|
382
393
|
}
|
|
383
394
|
}
|
|
395
|
+
this.successor?.autoApply(e, t, n);
|
|
384
396
|
}
|
|
385
397
|
revertPatch(e, t) {
|
|
386
398
|
let n = this.entries.get(e);
|
|
@@ -389,10 +401,10 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
389
401
|
n.state.patches = n.state.patches.filter((e) => e.id !== t), n.state.patches.length !== r && this.invalidate(n);
|
|
390
402
|
}
|
|
391
403
|
peek(e) {
|
|
392
|
-
return this.getSnapshot(
|
|
404
|
+
return this.getSnapshot(G(e));
|
|
393
405
|
}
|
|
394
406
|
getEntry(e) {
|
|
395
|
-
return this.entries.get(
|
|
407
|
+
return this.entries.get(G(e));
|
|
396
408
|
}
|
|
397
409
|
size() {
|
|
398
410
|
return this.entries.size;
|
|
@@ -419,7 +431,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
419
431
|
return e;
|
|
420
432
|
}
|
|
421
433
|
destroy(e) {
|
|
422
|
-
for (let t of this.entries.values()) t.evictionTimer !== null && clearTimeout(t.evictionTimer), t.recoveryTimer !== null && clearTimeout(t.recoveryTimer), t.fiber && e.runFork(
|
|
434
|
+
for (let t of this.entries.values()) t.evictionTimer !== null && clearTimeout(t.evictionTimer), t.recoveryTimer !== null && clearTimeout(t.recoveryTimer), t.fiber && e.runFork(ie.interrupt(t.fiber));
|
|
423
435
|
this.entries.clear();
|
|
424
436
|
}
|
|
425
437
|
refreshAll(e) {
|
|
@@ -446,25 +458,27 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
446
458
|
}
|
|
447
459
|
reissue(e, t, n = !0) {
|
|
448
460
|
if (!e.fetch) return;
|
|
449
|
-
e.fiber && t.runFork(
|
|
461
|
+
e.fiber && t.runFork(ie.interrupt(e.fiber)), e.fiber = null;
|
|
450
462
|
let r = e.state.patches, i = e.state.base, a = e.state.baseRevision, o = e.state.baseEmittedAt;
|
|
451
463
|
e.state = this.freshState(), e.state.patches = r, n || (e.state.base = i, e.state.baseRevision = a, e.state.baseEmittedAt = o), this.startFiber(e, e.fetch, t);
|
|
452
464
|
}
|
|
453
465
|
seedStaleFrom(e) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
466
|
+
e.successor = this;
|
|
467
|
+
let t = 0, n = /* @__PURE__ */ new Set();
|
|
468
|
+
for (let r of e.entries.values()) {
|
|
469
|
+
if (r.state.base === void 0 || this.entries.has(r.key)) continue;
|
|
457
470
|
let e = {
|
|
458
|
-
key:
|
|
459
|
-
tag:
|
|
471
|
+
key: r.key,
|
|
472
|
+
tag: r.tag,
|
|
460
473
|
state: {
|
|
461
|
-
base:
|
|
462
|
-
baseRevision:
|
|
463
|
-
baseEmittedAt:
|
|
474
|
+
base: r.state.base,
|
|
475
|
+
baseRevision: r.state.baseRevision,
|
|
476
|
+
baseEmittedAt: r.state.baseEmittedAt,
|
|
464
477
|
baseError: void 0,
|
|
465
|
-
patches:
|
|
478
|
+
patches: r.state.patches.map((e) => (e.confirmed === !0 && n.add(e.mutationId), { ...e })),
|
|
466
479
|
cachedSnapshot: null
|
|
467
480
|
},
|
|
481
|
+
baseMoves: r.baseMoves,
|
|
468
482
|
subscribers: /* @__PURE__ */ new Set(),
|
|
469
483
|
fiber: null,
|
|
470
484
|
resumeAfterTransportOpen: !1,
|
|
@@ -476,13 +490,14 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
476
490
|
recoveryBasePreserved: !1,
|
|
477
491
|
recoveryTimer: null,
|
|
478
492
|
evictionTimer: null,
|
|
479
|
-
source:
|
|
480
|
-
computed:
|
|
493
|
+
source: r.source,
|
|
494
|
+
computed: r.computed,
|
|
481
495
|
fetch: null,
|
|
482
496
|
runtime: null
|
|
483
497
|
};
|
|
484
498
|
this.entries.set(e.key, e), this.scheduleEviction(e), t += 1;
|
|
485
499
|
}
|
|
500
|
+
for (let e of n) setTimeout(() => this.resyncUnechoedMutation(e), Re);
|
|
486
501
|
return t;
|
|
487
502
|
}
|
|
488
503
|
create(e, t, n, r, i) {
|
|
@@ -490,6 +505,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
490
505
|
key: e,
|
|
491
506
|
tag: t,
|
|
492
507
|
state: this.freshState(),
|
|
508
|
+
baseMoves: 0,
|
|
493
509
|
subscribers: /* @__PURE__ */ new Set(),
|
|
494
510
|
fiber: null,
|
|
495
511
|
resumeAfterTransportOpen: !1,
|
|
@@ -515,6 +531,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
515
531
|
key: e,
|
|
516
532
|
tag: t,
|
|
517
533
|
state: this.freshState(),
|
|
534
|
+
baseMoves: 0,
|
|
518
535
|
subscribers: /* @__PURE__ */ new Set(),
|
|
519
536
|
fiber: null,
|
|
520
537
|
resumeAfterTransportOpen: !1,
|
|
@@ -546,15 +563,15 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
546
563
|
startFiber(e, t, n) {
|
|
547
564
|
let r = e.tag ?? e.key;
|
|
548
565
|
e.resumeAfterTransportOpen = !1;
|
|
549
|
-
let i = t(), a = z.unwrapScoped(
|
|
566
|
+
let i = t(), a = z.unwrapScoped(N.currentSpan.pipe(N.catchAll(() => N.succeed(void 0)), N.map((t) => (t && (e.traceId = t.traceId, ve({
|
|
550
567
|
traceId: t.traceId,
|
|
551
568
|
spanId: t.spanId,
|
|
552
569
|
source: "subscription",
|
|
553
570
|
tag: r
|
|
554
|
-
})), i)))).pipe(z.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(z.runForEach((t) =>
|
|
571
|
+
})), i)))).pipe(z.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(z.runForEach((t) => N.sync(() => {
|
|
555
572
|
let n = e.state.base;
|
|
556
573
|
if (t._tag === "snapshot") e.state.base = t.data, e.state.baseRevision = t.revision, e.state.baseEmittedAt = void 0, e.state.baseError = void 0, t.computed === !0 && (e.computed = !0);
|
|
557
|
-
else if (t._tag === "error") e.state.baseError =
|
|
574
|
+
else if (t._tag === "error") e.state.baseError = M.fail(t.error), typeof t.revision == "number" && (e.state.baseRevision = t.revision);
|
|
558
575
|
else {
|
|
559
576
|
let n = e.state.base;
|
|
560
577
|
Array.isArray(n) && (e.state.base = ue(n, t.patch, this.mergeCell === void 0 ? {} : { mergeCell: this.mergeCell })), e.state.baseRevision = t.revision, e.state.baseEmittedAt = t.emittedAt, e.state.baseError = void 0;
|
|
@@ -565,21 +582,24 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
565
582
|
}), e.recoveryPhase = "steady", this.diagnose("subscription.health-cleared", e, { delivery: t._tag })), this.errorBus?.emitSuccess({
|
|
566
583
|
source: "subscription",
|
|
567
584
|
tag: e.tag ?? e.key
|
|
568
|
-
}))
|
|
585
|
+
}));
|
|
586
|
+
let r = ze(t, n, e.state.base);
|
|
587
|
+
r && (e.baseMoves += 1), r && e.state.patches.some((e) => e.confirmed === !0) && (e.state.patches = e.state.patches.filter((e) => e.confirmed !== !0)), this.mirror !== void 0 && t._tag !== "error" && this.mirror.save(e.key, {
|
|
569
588
|
tag: e.tag,
|
|
570
589
|
data: e.state.base,
|
|
571
590
|
revision: e.state.baseRevision
|
|
572
591
|
}).catch(() => {}), this.invalidate(e);
|
|
573
|
-
}))), c = n.runFork(o === void 0 ? s : s.pipe(
|
|
592
|
+
}))), c = n.runFork(o === void 0 ? s : s.pipe(N.locallyWith(se.currentHeaders, (e) => oe.set(e, "voltro-resume-from", String(o)))));
|
|
574
593
|
e.fiber = c, c.addObserver((t) => {
|
|
575
|
-
if (e.fiber === c && (e.fiber = null),
|
|
594
|
+
if (e.fiber === c && (e.fiber = null), P.isFailure(t) && !P.isInterrupted(t)) {
|
|
576
595
|
e.state.baseRevision === -1 && (e.state.baseError = t.cause, this.invalidate(e));
|
|
577
|
-
let n =
|
|
596
|
+
let n = M.squash(t.cause), r = M.failureOption(t.cause), i = L.isSome(r) ? V(r.value, "handler") : "unknown";
|
|
578
597
|
i === "transport" && (e.recoveryTimer !== null && clearTimeout(e.recoveryTimer), e.recoveryTimer = null, e.resumeAfterTransportOpen = !0, e.recoveryPhase = "awaiting-protocol", e.lastTransportFailureAt = Date.now(), this.diagnose("subscription.transport-failed", e)), this.errorBus && this.errorBus.emit({
|
|
579
598
|
source: "subscription",
|
|
580
599
|
tag: e.tag ?? e.key,
|
|
581
600
|
error: n,
|
|
582
601
|
kind: i,
|
|
602
|
+
outcome: "not-applicable",
|
|
583
603
|
...e.traceId === void 0 ? {} : { traceId: e.traceId }
|
|
584
604
|
});
|
|
585
605
|
}
|
|
@@ -592,7 +612,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
592
612
|
}
|
|
593
613
|
getSnapshot(e) {
|
|
594
614
|
let t = this.entries.get(e);
|
|
595
|
-
if (!t) return
|
|
615
|
+
if (!t) return Le;
|
|
596
616
|
if (t.state.cachedSnapshot !== null) return t.state.cachedSnapshot;
|
|
597
617
|
let n = t.state.base;
|
|
598
618
|
if (n !== void 0 && t.state.patches.length > 0) for (let e of t.state.patches) n = e.reducer(n);
|
|
@@ -612,29 +632,29 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
612
632
|
scheduleEviction(e) {
|
|
613
633
|
e.evictionTimer !== null && clearTimeout(e.evictionTimer), e.evictionTimer = setTimeout(() => {
|
|
614
634
|
let t = this.entries.get(e.key);
|
|
615
|
-
t && t.subscribers.size === 0 && (t.recoveryTimer !== null && clearTimeout(t.recoveryTimer), t.fiber &&
|
|
635
|
+
t && t.subscribers.size === 0 && (t.recoveryTimer !== null && clearTimeout(t.recoveryTimer), t.fiber && N.runFork(ie.interrupt(t.fiber)), this.entries.delete(e.key));
|
|
616
636
|
}, this.inactiveTtlMs);
|
|
617
637
|
}
|
|
618
|
-
},
|
|
638
|
+
}, Qe = class extends Ze {
|
|
619
639
|
subscribe(e, t, n, r, i = {}) {
|
|
620
640
|
return {
|
|
621
641
|
getSnapshot: () => this.peek(e),
|
|
622
642
|
unsubscribe: () => {}
|
|
623
643
|
};
|
|
624
644
|
}
|
|
625
|
-
},
|
|
626
|
-
for (let t of
|
|
645
|
+
}, $e = /* @__PURE__ */ new Set(), et = (e) => {
|
|
646
|
+
for (let t of $e) try {
|
|
627
647
|
t(e);
|
|
628
648
|
} catch {}
|
|
629
|
-
},
|
|
630
|
-
|
|
631
|
-
}),
|
|
632
|
-
|
|
649
|
+
}, tt = (e) => ($e.add(e), () => {
|
|
650
|
+
$e.delete(e);
|
|
651
|
+
}), nt = (e, t) => {
|
|
652
|
+
et({
|
|
633
653
|
error: e,
|
|
634
654
|
source: "manual",
|
|
635
655
|
...t ? { context: t } : {}
|
|
636
656
|
});
|
|
637
|
-
},
|
|
657
|
+
}, rt = class {
|
|
638
658
|
#e = /* @__PURE__ */ new Set();
|
|
639
659
|
#t = /* @__PURE__ */ new Set();
|
|
640
660
|
on(e) {
|
|
@@ -646,12 +666,13 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
646
666
|
for (let t of this.#e) try {
|
|
647
667
|
t(e);
|
|
648
668
|
} catch {}
|
|
649
|
-
|
|
669
|
+
et({
|
|
650
670
|
error: e.error,
|
|
651
671
|
source: `rpc.${e.source}`,
|
|
652
672
|
context: {
|
|
653
673
|
rpcTag: e.tag,
|
|
654
674
|
rpcErrorKind: e.kind,
|
|
675
|
+
...e.outcome === void 0 ? {} : { rpcCallOutcome: e.outcome },
|
|
655
676
|
...e.traceId === void 0 ? {} : { traceId: e.traceId }
|
|
656
677
|
}
|
|
657
678
|
});
|
|
@@ -666,81 +687,299 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
666
687
|
t(e);
|
|
667
688
|
} catch {}
|
|
668
689
|
}
|
|
669
|
-
},
|
|
690
|
+
}, it = (e, t, n, r) => e === void 0 || !Number.isFinite(e) ? t : Math.min(r, Math.max(n, Math.trunc(e))), at = (e) => ({
|
|
691
|
+
graceMs: it(e?.graceMs, 1500, 0, 3e4),
|
|
692
|
+
maxPendingMutations: it(e?.maxPendingMutations, 32, 0, 256),
|
|
693
|
+
replayWindowMs: it(e?.replayWindowMs, 1e4, 250, 6e4),
|
|
694
|
+
capabilitiesUrl: e?.capabilitiesUrl
|
|
695
|
+
}), ot = class {
|
|
696
|
+
#e;
|
|
697
|
+
#t;
|
|
698
|
+
#n;
|
|
699
|
+
#r = /* @__PURE__ */ new Set();
|
|
700
|
+
#i = /* @__PURE__ */ new Set();
|
|
701
|
+
#a = /* @__PURE__ */ new Set();
|
|
702
|
+
#o = /* @__PURE__ */ new Set();
|
|
703
|
+
#s = /* @__PURE__ */ new Set();
|
|
704
|
+
#c = "connected";
|
|
705
|
+
#l = "connected";
|
|
706
|
+
#u = 0;
|
|
707
|
+
#d;
|
|
708
|
+
#f = 0;
|
|
709
|
+
#p = "unknown";
|
|
710
|
+
#m = -1;
|
|
711
|
+
#h = 0;
|
|
712
|
+
#g;
|
|
713
|
+
#_;
|
|
714
|
+
#v = !1;
|
|
715
|
+
#y;
|
|
716
|
+
constructor(e, t, n) {
|
|
717
|
+
this.#e = e, this.#t = at(t), this.#n = {
|
|
718
|
+
now: n?.now ?? Date.now,
|
|
719
|
+
setTimeout: n?.setTimeout ?? ((e, t) => setTimeout(e, t)),
|
|
720
|
+
clearTimeout: n?.clearTimeout ?? ((e) => clearTimeout(e))
|
|
721
|
+
}, this.#y = this.#b();
|
|
722
|
+
}
|
|
723
|
+
get options() {
|
|
724
|
+
return this.#t;
|
|
725
|
+
}
|
|
726
|
+
getSnapshot = () => this.#y;
|
|
727
|
+
subscribe = (e) => (this.#r.add(e), () => {
|
|
728
|
+
this.#r.delete(e);
|
|
729
|
+
});
|
|
730
|
+
onVisibleError(e) {
|
|
731
|
+
return this.#i.add(e), () => {
|
|
732
|
+
this.#i.delete(e);
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
#b() {
|
|
736
|
+
return {
|
|
737
|
+
rawTransport: this.#c,
|
|
738
|
+
status: this.#l,
|
|
739
|
+
failureCount: this.#u,
|
|
740
|
+
lastFailureAt: this.#d,
|
|
741
|
+
failedSubscriptions: [...this.#s].sort(),
|
|
742
|
+
pendingMutationReplays: this.#f,
|
|
743
|
+
mutationReplay: this.#p
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
#x() {
|
|
747
|
+
this.#y = this.#b();
|
|
748
|
+
for (let e of this.#r) try {
|
|
749
|
+
e();
|
|
750
|
+
} catch {}
|
|
751
|
+
W(this.#e, "recovery.state", {
|
|
752
|
+
rawTransport: this.#y.rawTransport,
|
|
753
|
+
status: this.#y.status,
|
|
754
|
+
failureCount: this.#y.failureCount,
|
|
755
|
+
failedSubscriptions: this.#y.failedSubscriptions.length,
|
|
756
|
+
pendingMutationReplays: this.#y.pendingMutationReplays,
|
|
757
|
+
mutationReplay: this.#y.mutationReplay
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
#S(e) {
|
|
761
|
+
for (let t of this.#i) try {
|
|
762
|
+
t(e);
|
|
763
|
+
} catch {}
|
|
764
|
+
}
|
|
765
|
+
#C() {
|
|
766
|
+
if (this.#l === "connected") {
|
|
767
|
+
if (this.#l = this.#t.graceMs === 0 ? "degraded" : "recovering", this.#t.graceMs === 0) {
|
|
768
|
+
this.#_ !== void 0 && (this.#v = !0, this.#S(this.#_));
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
this.#g = this.#n.setTimeout(() => {
|
|
772
|
+
this.#g = void 0, this.#l === "recovering" && (this.#l = "degraded", this.#_ !== void 0 && (this.#v = !0, this.#S(this.#_)), this.#x());
|
|
773
|
+
}, this.#t.graceMs);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
#w() {
|
|
777
|
+
this.#c !== "connected" || this.#s.size > 0 || (this.#g !== void 0 && (this.#n.clearTimeout(this.#g), this.#g = void 0), this.#l = "connected", this.#u = 0, this.#_ = void 0, this.#v = !1);
|
|
778
|
+
}
|
|
779
|
+
transportIssue() {
|
|
780
|
+
this.#c = "disconnected", this.#u += 1, this.#d = this.#n.now(), this.#C(), this.#x();
|
|
781
|
+
}
|
|
782
|
+
protocolReady() {
|
|
783
|
+
this.#c = "connected";
|
|
784
|
+
for (let e of this.#a) e();
|
|
785
|
+
this.#a.clear(), this.#w(), this.#x();
|
|
786
|
+
}
|
|
787
|
+
observeError(e) {
|
|
788
|
+
if (e.kind !== "transport") {
|
|
789
|
+
this.#S(e);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
this.#_ === void 0 && (this.#_ = e), e.source === "subscription" && this.#s.add(e.tag), this.#c !== "disconnected" && (this.#c = "disconnected", this.#u += 1, this.#d = this.#n.now()), this.#C(), this.#l === "degraded" && !this.#v && (this.#v = !0, this.#S(e)), this.#x();
|
|
793
|
+
}
|
|
794
|
+
observeSuccess(e) {
|
|
795
|
+
e.source === "subscription" && this.#s.delete(e.tag), this.#w(), this.#x();
|
|
796
|
+
}
|
|
797
|
+
reportExternalSuccess() {
|
|
798
|
+
this.#c = "connected";
|
|
799
|
+
for (let e of this.#a) e();
|
|
800
|
+
this.#a.clear(), this.#w(), this.#x();
|
|
801
|
+
}
|
|
802
|
+
resetForSubjectChange(e = 0) {
|
|
803
|
+
this.#g !== void 0 && this.#n.clearTimeout(this.#g), this.#g = void 0, this.#c = "disconnected", this.#l = "connected", this.#u = 0, this.#d = void 0, this.#s.clear(), this.#_ = void 0, this.#v = !1, this.#p = "unknown", this.#h += 1, this.#m = e;
|
|
804
|
+
for (let e of this.#o) e(!1);
|
|
805
|
+
this.#o.clear();
|
|
806
|
+
for (let e of this.#a) e();
|
|
807
|
+
this.#a.clear(), this.#C(), this.#x();
|
|
808
|
+
}
|
|
809
|
+
setMutationReplaySupported(e, t = 0) {
|
|
810
|
+
if (!(t < this.#m)) {
|
|
811
|
+
this.#m = t, this.#p = e ? "enabled" : "disabled";
|
|
812
|
+
for (let t of this.#o) t(e);
|
|
813
|
+
this.#o.clear(), this.#x();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
replayWindowRemaining(e) {
|
|
817
|
+
return Math.max(0, this.#t.replayWindowMs - (this.#n.now() - e));
|
|
818
|
+
}
|
|
819
|
+
waitForMutationReplaySupport(e) {
|
|
820
|
+
if (this.#p !== "unknown") return Promise.resolve(this.#p === "enabled");
|
|
821
|
+
let t = this.#t.replayWindowMs - (this.#n.now() - e);
|
|
822
|
+
return t <= 0 ? Promise.resolve(!1) : new Promise((e) => {
|
|
823
|
+
let n = !1, r, i = (t) => {
|
|
824
|
+
n || (n = !0, this.#o.delete(i), r !== void 0 && this.#n.clearTimeout(r), e(t));
|
|
825
|
+
};
|
|
826
|
+
this.#o.add(i), r = this.#n.setTimeout(() => i(!1), t);
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
reserveMutationReplay(e) {
|
|
830
|
+
if (this.#p === "disabled" || this.#n.now() - e > this.#t.replayWindowMs || this.#f >= this.#t.maxPendingMutations) return;
|
|
831
|
+
this.#f += 1, this.#x();
|
|
832
|
+
let t = this.#h, n = !1;
|
|
833
|
+
return {
|
|
834
|
+
isValid: () => !n && t === this.#h && this.#p === "enabled" && this.#c === "connected" && this.#n.now() - e <= this.#t.replayWindowMs,
|
|
835
|
+
release: () => {
|
|
836
|
+
n || (n = !0, --this.#f, this.#x());
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
waitForProtocolReady(e) {
|
|
841
|
+
if (this.#c === "connected") return Promise.resolve(!0);
|
|
842
|
+
let t = this.#t.replayWindowMs - (this.#n.now() - e);
|
|
843
|
+
return t <= 0 ? Promise.resolve(!1) : new Promise((e) => {
|
|
844
|
+
let n = !1, r = (t) => {
|
|
845
|
+
n || (n = !0, this.#a.delete(i), this.#n.clearTimeout(a), e(t && this.#c === "connected"));
|
|
846
|
+
}, i = () => r(!0);
|
|
847
|
+
this.#a.add(i);
|
|
848
|
+
let a = this.#n.setTimeout(() => r(!1), t);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
dispose() {
|
|
852
|
+
this.#g !== void 0 && this.#n.clearTimeout(this.#g), this.#g = void 0;
|
|
853
|
+
for (let e of this.#a) e();
|
|
854
|
+
this.#a.clear();
|
|
855
|
+
for (let e of this.#o) e(!1);
|
|
856
|
+
this.#o.clear(), this.#r.clear(), this.#i.clear();
|
|
857
|
+
}
|
|
858
|
+
}, st = /* @__PURE__ */ new WeakMap(), ct = (e, t, n) => {
|
|
859
|
+
let r = st.get(e);
|
|
860
|
+
if (r !== void 0) return r;
|
|
861
|
+
let i = new ot(t, n);
|
|
862
|
+
return e.on((e) => i.observeError(e)), typeof e.onSuccess == "function" && e.onSuccess((e) => i.observeSuccess(e)), st.set(e, i), i;
|
|
863
|
+
}, lt = w(null), ut = () => {
|
|
670
864
|
throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
|
|
671
|
-
},
|
|
672
|
-
get: (e, t) =>
|
|
865
|
+
}, dt = new Proxy(() => ut(), {
|
|
866
|
+
get: (e, t) => dt,
|
|
673
867
|
has: () => !0,
|
|
674
|
-
apply: () =>
|
|
675
|
-
}),
|
|
676
|
-
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
},
|
|
680
|
-
runtime: { runPromiseExit: () => Promise.resolve(
|
|
681
|
-
cache: new
|
|
682
|
-
client:
|
|
868
|
+
apply: () => ut()
|
|
869
|
+
}), ft = Symbol.for("@voltro/client/ssrDescriptors"), pt = globalThis, mt = pt[ft] ?? (pt[ft] = { byApi: /* @__PURE__ */ new Map() }), ht = (e, t) => {
|
|
870
|
+
mt.byApi.set(e, t);
|
|
871
|
+
}, gt = (e) => mt.byApi.get(e), _t = () => {
|
|
872
|
+
mt.byApi.clear();
|
|
873
|
+
}, vt = {
|
|
874
|
+
runtime: { runPromiseExit: () => Promise.resolve(P.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
|
|
875
|
+
cache: new Qe(),
|
|
876
|
+
client: dt,
|
|
683
877
|
descriptors: {},
|
|
684
878
|
inspectBaseUrl: "",
|
|
685
|
-
errorBus: new
|
|
686
|
-
|
|
879
|
+
errorBus: new rt(),
|
|
880
|
+
recovery: new ot("ssr")
|
|
881
|
+
}, yt = {
|
|
687
882
|
get: (e) => {
|
|
688
|
-
let t =
|
|
689
|
-
return t === void 0 ?
|
|
690
|
-
...
|
|
883
|
+
let t = gt(e);
|
|
884
|
+
return t === void 0 ? vt : {
|
|
885
|
+
...vt,
|
|
691
886
|
descriptors: t
|
|
692
887
|
};
|
|
693
888
|
},
|
|
694
889
|
names: []
|
|
695
|
-
},
|
|
696
|
-
|
|
697
|
-
},
|
|
698
|
-
let e =
|
|
699
|
-
return e ? (
|
|
700
|
-
|
|
701
|
-
}, 0)),
|
|
702
|
-
},
|
|
703
|
-
let t =
|
|
704
|
-
return
|
|
890
|
+
}, bt = !1, xt = !1, K = null, St = () => {
|
|
891
|
+
bt = !1, xt = !1, K !== null && (clearTimeout(K), K = null);
|
|
892
|
+
}, Ct = () => {
|
|
893
|
+
let e = ee(lt);
|
|
894
|
+
return e ? (xt || (xt = !0, K !== null && (clearTimeout(K), K = null)), e) : (typeof window < "u" && !bt && !xt && K === null && process.env.NODE_ENV !== "production" && (K = setTimeout(() => {
|
|
895
|
+
K = null, !(bt || xt) && (bt = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
|
|
896
|
+
}, 0)), yt);
|
|
897
|
+
}, q = (e) => {
|
|
898
|
+
let t = Ct(), n = t.demand;
|
|
899
|
+
return D(() => {
|
|
705
900
|
n?.(e);
|
|
706
901
|
}, [n, e]), t.get(e);
|
|
707
|
-
},
|
|
902
|
+
}, wt = (e) => typeof e.runtime?.runFork != "function", Tt = (e, t, n) => {
|
|
903
|
+
try {
|
|
904
|
+
let r = typeof globalThis.location == "object" ? globalThis.location.href : void 0, i = new URL(e, r);
|
|
905
|
+
if (i.protocol === "wss:" ? i.protocol = "https:" : i.protocol === "ws:" && (i.protocol = "http:"), n !== void 0) return new URL(n, i).toString();
|
|
906
|
+
let a = `/ws/${t}`;
|
|
907
|
+
if (i.pathname === a) i.pathname = `/_voltro/api/${encodeURIComponent(t)}/_voltro/runtime-capabilities`;
|
|
908
|
+
else {
|
|
909
|
+
let e = i.pathname.lastIndexOf("/");
|
|
910
|
+
i.pathname = `${e <= 0 ? "" : i.pathname.slice(0, e)}/_voltro/runtime-capabilities`;
|
|
911
|
+
}
|
|
912
|
+
return i.search = "", i.hash = "", i.toString();
|
|
913
|
+
} catch {
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
}, Et = async (e, t, n = fetch, r = 1500, i) => {
|
|
917
|
+
let a = Tt(e, t, i);
|
|
918
|
+
if (a === void 0) return;
|
|
919
|
+
let o = new AbortController(), s = setTimeout(() => o.abort(), r);
|
|
920
|
+
try {
|
|
921
|
+
let e = await n(a, {
|
|
922
|
+
method: "GET",
|
|
923
|
+
headers: { accept: "application/json" },
|
|
924
|
+
cache: "no-store",
|
|
925
|
+
signal: o.signal
|
|
926
|
+
});
|
|
927
|
+
if (!e.ok) return;
|
|
928
|
+
let t = await e.json();
|
|
929
|
+
return t.protocol !== 1 || typeof t.mutationReplay != "boolean" ? void 0 : {
|
|
930
|
+
protocol: 1,
|
|
931
|
+
mutationReplay: t.mutationReplay
|
|
932
|
+
};
|
|
933
|
+
} catch {
|
|
934
|
+
return;
|
|
935
|
+
} finally {
|
|
936
|
+
clearTimeout(s);
|
|
937
|
+
}
|
|
938
|
+
}, Dt = (e, t) => B.Socket.of({
|
|
708
939
|
...e,
|
|
709
940
|
runRaw: (n, r) => e.runRaw(n, {
|
|
710
941
|
...r,
|
|
711
|
-
onOpen:
|
|
942
|
+
onOpen: N.zipRight(r?.onOpen ?? N.void, N.sync(t))
|
|
712
943
|
})
|
|
713
|
-
}),
|
|
944
|
+
}), Ot = async (e) => {
|
|
714
945
|
let { name: t, wsUrl: n, group: r, headers: i, webSocketConstructor: a } = e, o = e.generation ?? 0;
|
|
715
|
-
|
|
716
|
-
let s = e.errorBus ?? new
|
|
946
|
+
W(t, "runtime.build-started", { generation: o });
|
|
947
|
+
let s = e.errorBus ?? new rt(), c = e.recovery ?? ct(s, t);
|
|
948
|
+
Et(n, t, fetch, 1500, c.options.capabilitiesUrl).then((e) => {
|
|
949
|
+
c.setMutationReplaySupported(e?.mutationReplay === !0, o), W(t, "runtime.capabilities", {
|
|
950
|
+
mutationReplay: e?.mutationReplay === !0,
|
|
951
|
+
discovered: e !== void 0
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
let l = new Ze({
|
|
717
955
|
errorBus: s,
|
|
718
956
|
apiName: t
|
|
719
|
-
}),
|
|
720
|
-
class
|
|
721
|
-
let
|
|
957
|
+
}), u;
|
|
958
|
+
class d extends ne.Tag(`@voltro/client/AppClient/${t}`)() {}
|
|
959
|
+
let f = F.succeed(B.WebSocketConstructor, a), p = B.layerWebSocket(n).pipe(F.provide(f)), m = F.effect(B.Socket, N.map(B.Socket, (e) => Dt(e, () => {
|
|
722
960
|
let e = 0;
|
|
723
|
-
|
|
961
|
+
u !== void 0 && (e = l.resumeTransportFailures(u)), W(t, "protocol.ready", {
|
|
724
962
|
generation: o,
|
|
725
963
|
resumed: e
|
|
726
|
-
});
|
|
727
|
-
}))).pipe(F.provide(
|
|
728
|
-
|
|
964
|
+
}), c.protocolReady();
|
|
965
|
+
}))).pipe(F.provide(p)), h = se.layerProtocolSocket().pipe(F.provide(le.layerJson), F.provide(m)), g = typeof i == "function" ? await i() : i, _ = F.scoped(d, se.make(r)).pipe(F.provide(h)), v = g ? F.locallyScoped(se.currentHeaders, oe.fromInput(g)) : F.empty, y = I.make(F.merge(_, v));
|
|
966
|
+
u = y;
|
|
729
967
|
try {
|
|
730
|
-
let e = await
|
|
731
|
-
return
|
|
732
|
-
runtime:
|
|
968
|
+
let e = await y.runPromise(d);
|
|
969
|
+
return W(t, "runtime.resolved", { generation: o }), {
|
|
970
|
+
runtime: y,
|
|
733
971
|
client: e,
|
|
734
|
-
cache:
|
|
735
|
-
errorBus: s
|
|
972
|
+
cache: l,
|
|
973
|
+
errorBus: s,
|
|
974
|
+
recovery: c
|
|
736
975
|
};
|
|
737
976
|
} catch (e) {
|
|
738
|
-
throw
|
|
977
|
+
throw W(t, "runtime.failed", {
|
|
739
978
|
generation: o,
|
|
740
979
|
errorName: e instanceof Error ? e.name : typeof e
|
|
741
|
-
}),
|
|
980
|
+
}), y.dispose(), e;
|
|
742
981
|
}
|
|
743
|
-
},
|
|
982
|
+
}, kt = (e) => Math.min(500 * 2 ** Math.min(e - 1, 4), 5e3), At = (e, t, n) => ({
|
|
744
983
|
resolved: null,
|
|
745
984
|
retryToken: 0,
|
|
746
985
|
failureCount: 0,
|
|
@@ -749,16 +988,23 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
749
988
|
everOpened: !1,
|
|
750
989
|
wedgeStop: null,
|
|
751
990
|
subjectMayHaveChanged: !1,
|
|
752
|
-
errorBus: e
|
|
753
|
-
|
|
991
|
+
errorBus: e,
|
|
992
|
+
recovery: t,
|
|
993
|
+
stopRecoveryError: e.on((e) => t.observeError(e)),
|
|
994
|
+
stopRecoverySuccess: e.onSuccess((e) => t.observeSuccess(e)),
|
|
995
|
+
ownsRecovery: n
|
|
996
|
+
}), jt = (e) => {
|
|
754
997
|
e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
|
|
755
|
-
},
|
|
998
|
+
}, Mt = (e) => {
|
|
756
999
|
e.cache.destroy(e.runtime), e.runtime.dispose();
|
|
757
|
-
},
|
|
758
|
-
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ??
|
|
1000
|
+
}, Nt = (e) => {
|
|
1001
|
+
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.retryDelayMs ?? kt, a = e.stableWindowMs ?? 5e3, o = e.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), s = e.scheduler?.clearTimeout ?? ((e) => {
|
|
759
1002
|
clearTimeout(e);
|
|
760
1003
|
}), c = e.scheduler?.queueMicrotask ?? queueMicrotask, l = e.onReconnecting, u = e.wedgeBackstop, d = /* @__PURE__ */ new Map();
|
|
761
|
-
for (let n of t)
|
|
1004
|
+
for (let n of t) {
|
|
1005
|
+
let t = e.errorBusFor?.(n.name) ?? new rt(), r = e.recoveryFor?.(n.name, n.recovery), i = r ?? new ot(n.name, n.recovery);
|
|
1006
|
+
d.set(n.name, At(t, i, r === void 0));
|
|
1007
|
+
}
|
|
762
1008
|
let f = !1, p = /* @__PURE__ */ new Set(), m = (e, t) => {
|
|
763
1009
|
let n = o(() => {
|
|
764
1010
|
p.delete(n), e();
|
|
@@ -775,7 +1021,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
775
1021
|
if (!t) return;
|
|
776
1022
|
t.failureCount += 1;
|
|
777
1023
|
let n = i(t.failureCount);
|
|
778
|
-
|
|
1024
|
+
W(e.name, "socket.retry-scheduled", {
|
|
779
1025
|
generation: t.generation,
|
|
780
1026
|
attempt: t.failureCount,
|
|
781
1027
|
delayMs: n
|
|
@@ -790,27 +1036,27 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
790
1036
|
if (!t) return;
|
|
791
1037
|
let r = t.generation, i = () => {
|
|
792
1038
|
if (f || t.generation !== r) return;
|
|
793
|
-
t.everOpened = !0,
|
|
1039
|
+
t.everOpened = !0, jt(t), t.retryToken++;
|
|
794
1040
|
let e = t.failureCount;
|
|
795
1041
|
m(() => {
|
|
796
1042
|
f || t.failureCount === e && (t.failureCount = 0);
|
|
797
1043
|
}, a);
|
|
798
1044
|
}, o = (n) => {
|
|
799
|
-
f || t.generation !== r || g(e);
|
|
1045
|
+
f || t.generation !== r || (t.recovery.transportIssue(), g(e));
|
|
800
1046
|
};
|
|
801
1047
|
try {
|
|
802
|
-
let a = await n(e, r, i, o, t.errorBus);
|
|
1048
|
+
let a = await n(e, r, i, o, t.errorBus, t.recovery);
|
|
803
1049
|
if (f || t.generation !== r) {
|
|
804
|
-
|
|
1050
|
+
Mt(a);
|
|
805
1051
|
return;
|
|
806
1052
|
}
|
|
807
1053
|
let s = t.resolved, c = t.subjectMayHaveChanged, l = s && !c ? a.cache.seedStaleFrom(s.cache) : 0;
|
|
808
|
-
t.subjectMayHaveChanged = !1, t.resolved = a,
|
|
1054
|
+
t.subjectMayHaveChanged = !1, t.resolved = a, W(e.name, "runtime.swapped", {
|
|
809
1055
|
generation: r,
|
|
810
1056
|
replaced: s !== null,
|
|
811
1057
|
seeded: l,
|
|
812
1058
|
subjectMayHaveChanged: c
|
|
813
|
-
}), t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s &&
|
|
1059
|
+
}), t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), h(), s && Mt(s);
|
|
814
1060
|
} catch {
|
|
815
1061
|
if (f || t.generation !== r) return;
|
|
816
1062
|
g(e);
|
|
@@ -818,7 +1064,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
818
1064
|
}, v = (e) => {
|
|
819
1065
|
if (!f) for (let n of t) {
|
|
820
1066
|
let t = d.get(n.name);
|
|
821
|
-
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, t.failureCount = 0,
|
|
1067
|
+
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, e && t.recovery.resetForSubjectChange(t.generation), t.failureCount = 0, jt(t), _(n));
|
|
822
1068
|
}
|
|
823
1069
|
};
|
|
824
1070
|
return t.length === 0 ? (r(/* @__PURE__ */ new Map(), !0), {
|
|
@@ -835,8 +1081,8 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
835
1081
|
f = !0;
|
|
836
1082
|
for (let e of p) s(e);
|
|
837
1083
|
p.clear();
|
|
838
|
-
for (let [, e] of d) e.resolved &&
|
|
839
|
-
for (let e of t)
|
|
1084
|
+
for (let [, e] of d) e.resolved && Mt(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), jt(e), e.stopRecoveryError(), e.stopRecoverySuccess(), e.ownsRecovery && e.recovery.dispose();
|
|
1085
|
+
for (let e of t) W(e.name, "runtime.disposed");
|
|
840
1086
|
d.clear();
|
|
841
1087
|
}
|
|
842
1088
|
},
|
|
@@ -847,8 +1093,8 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
847
1093
|
v(!1);
|
|
848
1094
|
}
|
|
849
1095
|
});
|
|
850
|
-
},
|
|
851
|
-
let r =
|
|
1096
|
+
}, Pt = ({ apis: e, children: t, demand: n }) => {
|
|
1097
|
+
let r = O(() => ({
|
|
852
1098
|
get: (t) => {
|
|
853
1099
|
let n = e.get(t);
|
|
854
1100
|
if (!n) {
|
|
@@ -860,45 +1106,45 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
860
1106
|
names: Array.from(e.keys()),
|
|
861
1107
|
...n === void 0 ? {} : { demand: n }
|
|
862
1108
|
}), [e]);
|
|
863
|
-
return /* @__PURE__ */ pe(
|
|
1109
|
+
return /* @__PURE__ */ pe(lt.Provider, {
|
|
864
1110
|
value: r,
|
|
865
1111
|
children: t
|
|
866
1112
|
});
|
|
867
|
-
},
|
|
868
|
-
let e = globalThis, t = e[
|
|
1113
|
+
}, Ft = Symbol.for("@voltro/client/storeStorageProvider"), It = () => {
|
|
1114
|
+
let e = globalThis, t = e[Ft];
|
|
869
1115
|
if (t !== void 0) return t;
|
|
870
1116
|
let n = {
|
|
871
1117
|
provider: void 0,
|
|
872
1118
|
used: !1
|
|
873
1119
|
};
|
|
874
|
-
return e[
|
|
875
|
-
},
|
|
1120
|
+
return e[Ft] = n, n;
|
|
1121
|
+
}, Lt = (e) => {
|
|
876
1122
|
if (typeof window > "u") return null;
|
|
877
1123
|
try {
|
|
878
1124
|
return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
|
|
879
1125
|
} catch {
|
|
880
1126
|
return null;
|
|
881
1127
|
}
|
|
882
|
-
},
|
|
883
|
-
let t =
|
|
1128
|
+
}, Rt = (e) => {
|
|
1129
|
+
let t = It();
|
|
884
1130
|
t.used && e !== null && console.warn("[voltro] setStoreStorage() was called after a persisted store had already read. That store booted against the previous backing store and will not be re-read. Install storage before the first render — on React Native, after awaiting hydrate()."), t.provider = e ?? void 0;
|
|
885
|
-
},
|
|
886
|
-
let t =
|
|
887
|
-
return t.used = !0, (t.provider ??
|
|
888
|
-
},
|
|
889
|
-
let e =
|
|
1131
|
+
}, zt = (e) => {
|
|
1132
|
+
let t = It();
|
|
1133
|
+
return t.used = !0, (t.provider ?? Lt)(e);
|
|
1134
|
+
}, Bt = () => {
|
|
1135
|
+
let e = It();
|
|
890
1136
|
e.provider = void 0, e.used = !1;
|
|
891
|
-
},
|
|
1137
|
+
}, Vt = (e, t) => {
|
|
892
1138
|
if (Object.is(e, t)) return !0;
|
|
893
1139
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
894
1140
|
let n = Object.keys(e), r = Object.keys(t);
|
|
895
1141
|
if (n.length !== r.length) return !1;
|
|
896
1142
|
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
897
1143
|
return !0;
|
|
898
|
-
},
|
|
899
|
-
|
|
900
|
-
},
|
|
901
|
-
let r =
|
|
1144
|
+
}, Ht = 50, Ut = /* @__PURE__ */ new Set(), Wt = (e, t) => {
|
|
1145
|
+
Ut.has(e) || (Ut.add(e), console.warn(t));
|
|
1146
|
+
}, Gt = "\0global", Kt = null, qt = (e, t, n) => {
|
|
1147
|
+
let r = Kt?.() ?? null;
|
|
902
1148
|
if (r === null) return n;
|
|
903
1149
|
let i = n;
|
|
904
1150
|
for (let n of r.seeds) n.store === e && n.key === t && (i = {
|
|
@@ -906,9 +1152,9 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
906
1152
|
...n.value
|
|
907
1153
|
});
|
|
908
1154
|
return i;
|
|
909
|
-
},
|
|
1155
|
+
}, Jt = (e, t) => {
|
|
910
1156
|
let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
|
|
911
|
-
if (i >=
|
|
1157
|
+
if (i >= Ht) throw i = 0, Error(`defineStore: notification depth exceeded ${Ht} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
|
|
912
1158
|
i += 1;
|
|
913
1159
|
try {
|
|
914
1160
|
for (let e of [...r]) e();
|
|
@@ -929,20 +1175,20 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
929
1175
|
if (typeof i?.then == "function") throw a === 1 && o !== void 0 && (n = o), --a, a === 0 && (o = void 0, s = void 0), Error(`defineStore: batch('${e}') was given an async function. A batch is synchronous — everything after the first await would land outside it. Await the work first, then batch the writes: \`const r = await load(); store.batch('${e}', () => { … })\`.`);
|
|
930
1176
|
if (--a, a > 0) return;
|
|
931
1177
|
let l = o, u = s;
|
|
932
|
-
o = void 0, s = void 0, !
|
|
1178
|
+
o = void 0, s = void 0, !Vt(l, n) && (t(l, n, u), c());
|
|
933
1179
|
},
|
|
934
1180
|
set: (e, r) => {
|
|
935
1181
|
let i = typeof e == "function" ? e(n) : {
|
|
936
1182
|
...n,
|
|
937
1183
|
...e
|
|
938
1184
|
};
|
|
939
|
-
if (
|
|
1185
|
+
if (Vt(i, n)) return;
|
|
940
1186
|
let o = n;
|
|
941
1187
|
n = i, !(a > 0) && (t(o, i, r), c());
|
|
942
1188
|
},
|
|
943
1189
|
reset: () => {
|
|
944
1190
|
let r = e();
|
|
945
|
-
if (
|
|
1191
|
+
if (Vt(r, n)) return;
|
|
946
1192
|
let i = n;
|
|
947
1193
|
n = r, !(a > 0) && (t(i, r, "reset"), c());
|
|
948
1194
|
},
|
|
@@ -950,51 +1196,51 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
950
1196
|
r.delete(e);
|
|
951
1197
|
})
|
|
952
1198
|
};
|
|
953
|
-
},
|
|
954
|
-
|
|
955
|
-
}),
|
|
956
|
-
|
|
957
|
-
},
|
|
958
|
-
let n =
|
|
1199
|
+
}, Yt = 200, Xt = [], Zt = /* @__PURE__ */ new Set(), Qt = [], $t = () => Qt, en = (e) => (Zt.add(e), () => {
|
|
1200
|
+
Zt.delete(e);
|
|
1201
|
+
}), tn = () => {
|
|
1202
|
+
Xt.length = 0, Qt = [];
|
|
1203
|
+
}, nn = (e, t) => {
|
|
1204
|
+
let n = Xt[e];
|
|
959
1205
|
if (n === void 0) return !1;
|
|
960
|
-
let r =
|
|
1206
|
+
let r = sn.get(n.store);
|
|
961
1207
|
if (r === void 0) return !1;
|
|
962
1208
|
let i = t === "before" ? n.prev : n.next;
|
|
963
|
-
|
|
1209
|
+
an = !0;
|
|
964
1210
|
try {
|
|
965
1211
|
r.set(() => i, n.key, `travel:${t}`);
|
|
966
1212
|
} finally {
|
|
967
|
-
|
|
1213
|
+
an = !1;
|
|
968
1214
|
}
|
|
969
1215
|
return !0;
|
|
970
|
-
},
|
|
971
|
-
|
|
972
|
-
for (let e of [...
|
|
973
|
-
},
|
|
974
|
-
|
|
975
|
-
})),
|
|
976
|
-
function
|
|
1216
|
+
}, rn = !1, an = !1, on = (e) => {
|
|
1217
|
+
Xt.push(e), Xt.length > Yt && Xt.shift(), Qt = [...Xt];
|
|
1218
|
+
for (let e of [...Zt]) e();
|
|
1219
|
+
}, sn = /* @__PURE__ */ new Map(), cn = /* @__PURE__ */ new Map(), ln = 0, un = !1, dn = /* @__PURE__ */ new Map(), fn = () => (un || (un = !0, queueMicrotask(() => {
|
|
1220
|
+
ln += 1, un = !1;
|
|
1221
|
+
})), ln), pn = mn(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
|
|
1222
|
+
function mn(e) {
|
|
977
1223
|
let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
|
|
978
1224
|
return n.length > 0 ? n : void 0;
|
|
979
1225
|
}
|
|
980
|
-
var
|
|
1226
|
+
var hn = () => {
|
|
981
1227
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
982
1228
|
if (typeof e != "string") return "<unknown>";
|
|
983
1229
|
for (let t of e.split("\n").slice(1)) {
|
|
984
|
-
let e =
|
|
1230
|
+
let e = mn(t);
|
|
985
1231
|
if (e === void 0) continue;
|
|
986
1232
|
let n = e.replace(/:\d+:\d+$/, "");
|
|
987
|
-
if (
|
|
1233
|
+
if (pn === "" || n !== pn.replace(/:\d+:\d+$/, "")) return n;
|
|
988
1234
|
}
|
|
989
1235
|
return "<unknown>";
|
|
990
|
-
},
|
|
991
|
-
let r =
|
|
1236
|
+
}, gn = () => [...sn.values()], _n = (e, t, n) => {
|
|
1237
|
+
let r = hn(), i = fn(), a = sn.get(e);
|
|
992
1238
|
if (a !== void 0) {
|
|
993
|
-
let t =
|
|
1239
|
+
let t = cn.get(e) ?? "<unknown>", n = dn.get(e) === i;
|
|
994
1240
|
if (r !== "<unknown>" && r === t && !n) return a;
|
|
995
1241
|
throw Error(`defineStore: '${e}' is already defined. Store names are the devtools + seed key, so two stores sharing one name would silently share state. Rename one.\n first: ${t}\n second: ${r}`);
|
|
996
1242
|
}
|
|
997
|
-
let o = n?.persist, s = () =>
|
|
1243
|
+
let o = n?.persist, s = () => zt(o?.storage === "session" ? "session" : "local"), c = () => {
|
|
998
1244
|
let e = s();
|
|
999
1245
|
if (e === null || o === void 0) return;
|
|
1000
1246
|
let t;
|
|
@@ -1019,28 +1265,28 @@ var ln = () => {
|
|
|
1019
1265
|
t.setItem(o.key, JSON.stringify(n));
|
|
1020
1266
|
} catch {}
|
|
1021
1267
|
}, u = /* @__PURE__ */ new Map(), d = (n) => {
|
|
1022
|
-
let r = n ??
|
|
1268
|
+
let r = n ?? Gt, i = u.get(r);
|
|
1023
1269
|
if (i === void 0) {
|
|
1024
1270
|
let a = n;
|
|
1025
|
-
i =
|
|
1271
|
+
i = Jt(o !== void 0 && n === void 0 ? () => {
|
|
1026
1272
|
let e = t();
|
|
1027
1273
|
return f = e, {
|
|
1028
1274
|
...e,
|
|
1029
1275
|
...c() ?? {}
|
|
1030
1276
|
};
|
|
1031
1277
|
} : t, (t, n, r) => {
|
|
1032
|
-
if (o !== void 0 && a === void 0 && l(n), !
|
|
1278
|
+
if (o !== void 0 && a === void 0 && l(n), !rn && !an) {
|
|
1033
1279
|
let e = m(a);
|
|
1034
1280
|
e.steps.length = e.cursor, e.steps.push({
|
|
1035
1281
|
prev: t,
|
|
1036
1282
|
next: n
|
|
1037
1283
|
}), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
|
|
1038
1284
|
}
|
|
1039
|
-
|
|
1285
|
+
on({
|
|
1040
1286
|
store: e,
|
|
1041
1287
|
...a === void 0 ? {} : { key: a },
|
|
1042
1288
|
...r === void 0 ? {} : { label: r },
|
|
1043
|
-
...
|
|
1289
|
+
...rn || an ? { isUndo: !0 } : {},
|
|
1044
1290
|
prev: t,
|
|
1045
1291
|
next: n,
|
|
1046
1292
|
at: Date.now()
|
|
@@ -1049,7 +1295,7 @@ var ln = () => {
|
|
|
1049
1295
|
}
|
|
1050
1296
|
return i;
|
|
1051
1297
|
}, f, p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
1052
|
-
let t = e ??
|
|
1298
|
+
let t = e ?? Gt, n = p.get(t);
|
|
1053
1299
|
return n === void 0 && (n = {
|
|
1054
1300
|
steps: [],
|
|
1055
1301
|
cursor: 0
|
|
@@ -1069,24 +1315,24 @@ var ln = () => {
|
|
|
1069
1315
|
}, b = {
|
|
1070
1316
|
name: e,
|
|
1071
1317
|
use: (t, n) => {
|
|
1072
|
-
let r = d(n?.key), i =
|
|
1318
|
+
let r = d(n?.key), i = k(t);
|
|
1073
1319
|
i.current = t;
|
|
1074
|
-
let a =
|
|
1320
|
+
let a = k(n?.equals);
|
|
1075
1321
|
a.current = n?.equals;
|
|
1076
|
-
let o =
|
|
1322
|
+
let o = k({
|
|
1077
1323
|
state: void 0,
|
|
1078
1324
|
value: void 0,
|
|
1079
1325
|
has: !1
|
|
1080
|
-
}), s =
|
|
1326
|
+
}), s = E((t) => {
|
|
1081
1327
|
let n = o.current;
|
|
1082
1328
|
if (n.has && Object.is(n.state, t)) return n.value;
|
|
1083
1329
|
let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
|
|
1084
|
-
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r &&
|
|
1330
|
+
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && Vt(n.value, r)) {
|
|
1085
1331
|
let t = !0;
|
|
1086
1332
|
try {
|
|
1087
1333
|
t = !Object.is(i.current(n.state), n.value);
|
|
1088
1334
|
} catch {}
|
|
1089
|
-
|
|
1335
|
+
Wt(e, t ? `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.` : `[@voltro/client] ${e}.use(): this component re-renders on store changes that do not change what it selects. The selector is stable — it returns the same reference for the same state — and the STORE is writing a new value that is equal one level deep (a fresh \`[]\` or \`{}\`, say).\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or stop writing an equal value.`);
|
|
1090
1336
|
}
|
|
1091
1337
|
let l = c ? n.value : r;
|
|
1092
1338
|
return o.current = {
|
|
@@ -1094,7 +1340,7 @@ var ln = () => {
|
|
|
1094
1340
|
value: l,
|
|
1095
1341
|
has: !0
|
|
1096
1342
|
}, l;
|
|
1097
|
-
}, []), c = n?.key, l = n?.retain === !0, u =
|
|
1343
|
+
}, []), c = n?.key, l = n?.retain === !0, u = E((e) => {
|
|
1098
1344
|
let t = r.subscribe(e);
|
|
1099
1345
|
return c !== void 0 && !l && v(c), () => {
|
|
1100
1346
|
t(), c !== void 0 && !l && y(c);
|
|
@@ -1103,12 +1349,12 @@ var ln = () => {
|
|
|
1103
1349
|
r,
|
|
1104
1350
|
c,
|
|
1105
1351
|
l
|
|
1106
|
-
]), p =
|
|
1352
|
+
]), p = E(() => s(r.get()), [r, s]), m = E(() => s(qt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
|
|
1107
1353
|
r,
|
|
1108
1354
|
n?.key,
|
|
1109
1355
|
s
|
|
1110
|
-
]), h =
|
|
1111
|
-
return
|
|
1356
|
+
]), h = j(u, p, m);
|
|
1357
|
+
return te(h), h;
|
|
1112
1358
|
},
|
|
1113
1359
|
instance: d,
|
|
1114
1360
|
get: (e) => d(e).get(),
|
|
@@ -1121,11 +1367,11 @@ var ln = () => {
|
|
|
1121
1367
|
undo: (e) => {
|
|
1122
1368
|
let t = m(e);
|
|
1123
1369
|
if (t.cursor === 0) return !1;
|
|
1124
|
-
--t.cursor,
|
|
1370
|
+
--t.cursor, rn = !0;
|
|
1125
1371
|
try {
|
|
1126
1372
|
d(e).set(() => t.steps[t.cursor].prev, "undo");
|
|
1127
1373
|
} finally {
|
|
1128
|
-
|
|
1374
|
+
rn = !1;
|
|
1129
1375
|
}
|
|
1130
1376
|
return !0;
|
|
1131
1377
|
},
|
|
@@ -1133,11 +1379,11 @@ var ln = () => {
|
|
|
1133
1379
|
let t = m(e);
|
|
1134
1380
|
if (t.cursor >= t.steps.length) return !1;
|
|
1135
1381
|
let n = t.steps[t.cursor];
|
|
1136
|
-
t.cursor += 1,
|
|
1382
|
+
t.cursor += 1, rn = !0;
|
|
1137
1383
|
try {
|
|
1138
1384
|
d(e).set(() => n.next, "redo");
|
|
1139
1385
|
} finally {
|
|
1140
|
-
|
|
1386
|
+
rn = !1;
|
|
1141
1387
|
}
|
|
1142
1388
|
return !0;
|
|
1143
1389
|
},
|
|
@@ -1149,27 +1395,27 @@ var ln = () => {
|
|
|
1149
1395
|
release: (e) => {
|
|
1150
1396
|
u.delete(e), p.delete(e);
|
|
1151
1397
|
},
|
|
1152
|
-
keys: () => [...u.keys()].filter((e) => e !==
|
|
1398
|
+
keys: () => [...u.keys()].filter((e) => e !== Gt)
|
|
1153
1399
|
};
|
|
1154
|
-
return
|
|
1155
|
-
},
|
|
1156
|
-
|
|
1157
|
-
},
|
|
1158
|
-
|
|
1159
|
-
},
|
|
1160
|
-
let r =
|
|
1400
|
+
return sn.set(e, b), cn.set(e, r), dn.set(e, i), b;
|
|
1401
|
+
}, vn = () => {
|
|
1402
|
+
sn.clear(), cn.clear(), dn.clear(), Ut.clear();
|
|
1403
|
+
}, yn = () => ({ seeds: [] }), bn = (e) => {
|
|
1404
|
+
Kt = e;
|
|
1405
|
+
}, xn = (e, t, n) => {
|
|
1406
|
+
let r = Kt?.() ?? null;
|
|
1161
1407
|
if (r === null) throw Error(`seedStore('${e.name}') was called outside a server render. Seeding exists to put a value into the SSR hydration payload; on the client, set the store directly instead. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
|
|
1162
1408
|
r.seeds.push({
|
|
1163
1409
|
store: e.name,
|
|
1164
1410
|
...n?.key === void 0 ? {} : { key: n.key },
|
|
1165
1411
|
value: t
|
|
1166
1412
|
});
|
|
1167
|
-
},
|
|
1413
|
+
}, Sn = (e) => {
|
|
1168
1414
|
if (e !== void 0) for (let t of e) {
|
|
1169
|
-
let e =
|
|
1415
|
+
let e = sn.get(t.store);
|
|
1170
1416
|
e !== void 0 && e.set(t.value, t.key);
|
|
1171
1417
|
}
|
|
1172
|
-
},
|
|
1418
|
+
}, J = (e, t) => {
|
|
1173
1419
|
let n = t.split("."), r = e;
|
|
1174
1420
|
for (let e = 0; e < n.length; e++) {
|
|
1175
1421
|
let i = n[e];
|
|
@@ -1188,35 +1434,35 @@ var ln = () => {
|
|
|
1188
1434
|
}
|
|
1189
1435
|
if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
|
|
1190
1436
|
return r;
|
|
1191
|
-
},
|
|
1437
|
+
}, Cn = Object.freeze({
|
|
1192
1438
|
data: void 0,
|
|
1193
1439
|
revision: -1,
|
|
1194
1440
|
emittedAt: void 0,
|
|
1195
1441
|
error: void 0,
|
|
1196
1442
|
pendingPatches: 0
|
|
1197
|
-
}),
|
|
1198
|
-
function
|
|
1199
|
-
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } =
|
|
1443
|
+
}), wn = () => Cn;
|
|
1444
|
+
function Y(e, t, n = {}, r = {}) {
|
|
1445
|
+
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = q(e), l = c[t]?.source, u = k(n);
|
|
1200
1446
|
u.current = n;
|
|
1201
|
-
let d =
|
|
1447
|
+
let d = k(s);
|
|
1202
1448
|
d.current = s;
|
|
1203
|
-
let f =
|
|
1449
|
+
let f = O(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = O(() => {
|
|
1204
1450
|
let e = u.current;
|
|
1205
1451
|
return {
|
|
1206
1452
|
queryKey: [t, e],
|
|
1207
|
-
fetch: () =>
|
|
1453
|
+
fetch: () => J(d.current, t)(e)
|
|
1208
1454
|
};
|
|
1209
|
-
}, [t, f]), m = p.queryKey, h =
|
|
1455
|
+
}, [t, f]), m = p.queryKey, h = E((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
|
|
1210
1456
|
o,
|
|
1211
1457
|
a,
|
|
1212
1458
|
l,
|
|
1213
1459
|
i,
|
|
1214
1460
|
p
|
|
1215
|
-
]), g =
|
|
1461
|
+
]), g = E(() => i ? Cn : o.peek(m), [
|
|
1216
1462
|
o,
|
|
1217
1463
|
i,
|
|
1218
1464
|
m
|
|
1219
|
-
]), _ =
|
|
1465
|
+
]), _ = j(h, g, wn), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
|
|
1220
1466
|
revision: _.revision,
|
|
1221
1467
|
emittedAt: _.emittedAt,
|
|
1222
1468
|
error: _.error,
|
|
@@ -1273,35 +1519,35 @@ function J(e, t, n = {}, r = {}) {
|
|
|
1273
1519
|
}
|
|
1274
1520
|
//#endregion
|
|
1275
1521
|
//#region src/awaitResolvedApi.ts
|
|
1276
|
-
var
|
|
1277
|
-
if (!
|
|
1278
|
-
let r = Date.now() +
|
|
1279
|
-
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !
|
|
1280
|
-
throw Error(`Voltro: the api "${t}" did not resolve within ${
|
|
1281
|
-
},
|
|
1522
|
+
var Tn = 15e3, X = async (e, t, n) => {
|
|
1523
|
+
if (!wt(e.current)) return e.current;
|
|
1524
|
+
let r = Date.now() + Tn;
|
|
1525
|
+
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !wt(e.current)) return e.current;
|
|
1526
|
+
throw Error(`Voltro: the api "${t}" did not resolve within ${Tn}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
|
|
1527
|
+
}, Z = async (e, t) => {
|
|
1282
1528
|
let n = await e.runPromiseExit(t);
|
|
1283
|
-
if (
|
|
1284
|
-
let r =
|
|
1285
|
-
throw xe(r, L.isSome(i) ?
|
|
1286
|
-
},
|
|
1287
|
-
|
|
1288
|
-
},
|
|
1289
|
-
|
|
1290
|
-
for (let e of
|
|
1529
|
+
if (P.isSuccess(n)) return n.value;
|
|
1530
|
+
let r = M.squash(n.cause), i = M.failureOption(n.cause);
|
|
1531
|
+
throw xe(r, L.isSome(i) ? V(i.value, "handler") : "unknown");
|
|
1532
|
+
}, En = 100, Q = [], Dn = /* @__PURE__ */ new Set(), On = [], kn = () => {
|
|
1533
|
+
On = Q.slice();
|
|
1534
|
+
}, An = () => {
|
|
1535
|
+
kn();
|
|
1536
|
+
for (let e of Dn) try {
|
|
1291
1537
|
e();
|
|
1292
1538
|
} catch {}
|
|
1293
|
-
},
|
|
1539
|
+
}, jn = (e) => {
|
|
1294
1540
|
let t = {
|
|
1295
1541
|
...e,
|
|
1296
1542
|
status: "pending",
|
|
1297
1543
|
startedAt: Date.now()
|
|
1298
1544
|
};
|
|
1299
|
-
|
|
1300
|
-
},
|
|
1301
|
-
let n =
|
|
1545
|
+
Q.unshift(t), Q.length > En && (Q.length = En), An();
|
|
1546
|
+
}, Mn = (e, t) => {
|
|
1547
|
+
let n = Q.findIndex((t) => t.id === e);
|
|
1302
1548
|
if (n === -1) return;
|
|
1303
|
-
let r =
|
|
1304
|
-
|
|
1549
|
+
let r = Q[n], i = Date.now();
|
|
1550
|
+
Q[n] = t.status === "success" ? {
|
|
1305
1551
|
...r,
|
|
1306
1552
|
status: "success",
|
|
1307
1553
|
output: t.output,
|
|
@@ -1313,12 +1559,12 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1313
1559
|
error: t.error,
|
|
1314
1560
|
settledAt: i,
|
|
1315
1561
|
durationMs: i - r.startedAt
|
|
1316
|
-
},
|
|
1317
|
-
},
|
|
1318
|
-
|
|
1319
|
-
}),
|
|
1320
|
-
|
|
1321
|
-
},
|
|
1562
|
+
}, An();
|
|
1563
|
+
}, Nn = () => On, Pn = (e) => (Dn.add(e), () => {
|
|
1564
|
+
Dn.delete(e);
|
|
1565
|
+
}), Fn = () => {
|
|
1566
|
+
Q.length !== 0 && (Q.length = 0, An());
|
|
1567
|
+
}, In = (e, t) => {
|
|
1322
1568
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1323
1569
|
try {
|
|
1324
1570
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1328,45 +1574,46 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1328
1574
|
});
|
|
1329
1575
|
} catch {}
|
|
1330
1576
|
return e;
|
|
1331
|
-
},
|
|
1332
|
-
|
|
1333
|
-
},
|
|
1577
|
+
}, Ln, Rn = (e) => {
|
|
1578
|
+
Ln = e;
|
|
1579
|
+
}, zn = () => Ln, Bn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Vn = 0, Hn = () => `mut_${++Vn}`, Un = 0, Wn = () => {
|
|
1334
1580
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
1335
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${
|
|
1336
|
-
},
|
|
1581
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${Un += 1}`;
|
|
1582
|
+
}, Gn = (e, t) => e.pipe(N.locallyWith(se.currentHeaders, (e) => oe.set(e, "idempotency-key", t))), Kn = (e, t) => ({
|
|
1337
1583
|
update: (n, r) => {
|
|
1338
1584
|
e.update(n, r, t);
|
|
1339
1585
|
},
|
|
1340
1586
|
forTag: (n, r) => e.forTag(n, r, t)
|
|
1341
|
-
}),
|
|
1342
|
-
let n =
|
|
1587
|
+
}), qn = (e, t) => {
|
|
1588
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
1343
1589
|
i.current = n;
|
|
1344
1590
|
let a = r[t], o = a?.targets;
|
|
1345
1591
|
if (process.env.NODE_ENV !== "production") {
|
|
1346
1592
|
let n = a?.kind;
|
|
1347
1593
|
n !== void 0 && n !== "mutation" && console.error(`[@voltro/client] useMutation('${e}', '${t}') targets a ${n}, not a mutation. Use ${n === "action" ? "useAction" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
|
|
1348
1594
|
}
|
|
1349
|
-
let [s, c] =
|
|
1595
|
+
let [s, c] = A(!1), [l, u] = A(void 0), [d, f] = A(void 0), p = k(null), m = k(!1), h = E(async (n, r) => {
|
|
1350
1596
|
let a = r?.onError !== void 0 || r?.notify?.error !== void 0, s = (e) => {
|
|
1351
1597
|
r?.onError?.(e, n);
|
|
1352
|
-
let t =
|
|
1353
|
-
t !== void 0 &&
|
|
1598
|
+
let t = Bn(r?.notify?.error, e, n);
|
|
1599
|
+
t !== void 0 && Ln?.error(t);
|
|
1354
1600
|
};
|
|
1355
1601
|
c(!0), u(void 0);
|
|
1356
1602
|
let l, d, h;
|
|
1357
1603
|
try {
|
|
1358
|
-
({runtime: l, cache: d, client: h} = await
|
|
1604
|
+
({runtime: l, cache: d, client: h} = await X(i, e, t));
|
|
1359
1605
|
} catch (e) {
|
|
1360
1606
|
if (c(!1), u(e), i.current.errorBus.emit({
|
|
1361
1607
|
source: "mutation",
|
|
1362
1608
|
tag: t,
|
|
1363
1609
|
error: e,
|
|
1364
|
-
kind: "client"
|
|
1610
|
+
kind: "client",
|
|
1611
|
+
outcome: "not-started"
|
|
1365
1612
|
}), a) return s(e);
|
|
1366
1613
|
throw e;
|
|
1367
1614
|
}
|
|
1368
|
-
let g =
|
|
1369
|
-
|
|
1615
|
+
let g = Hn(), _ = r?.idempotencyKey ?? Wn();
|
|
1616
|
+
jn({
|
|
1370
1617
|
id: g,
|
|
1371
1618
|
apiName: e,
|
|
1372
1619
|
tag: t,
|
|
@@ -1374,50 +1621,85 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1374
1621
|
});
|
|
1375
1622
|
let v = p.current, y = m.current;
|
|
1376
1623
|
if (v) try {
|
|
1377
|
-
v(
|
|
1624
|
+
v(Kn(d, g), n);
|
|
1378
1625
|
} catch (e) {
|
|
1379
|
-
if (u(e), c(!1), d.revertByMutation(g),
|
|
1626
|
+
if (u(e), c(!1), d.revertByMutation(g), Mn(g, {
|
|
1380
1627
|
status: "error",
|
|
1381
1628
|
error: e
|
|
1382
1629
|
}), a) return s(e);
|
|
1383
1630
|
throw e;
|
|
1384
1631
|
}
|
|
1385
1632
|
else !y && o && o.length > 0 && d.autoApply(o, n, g);
|
|
1386
|
-
let b, x = !1;
|
|
1633
|
+
let b, x = !1, S, C = Date.now();
|
|
1387
1634
|
try {
|
|
1388
|
-
let a =
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1635
|
+
let a = async (r, i, a) => {
|
|
1636
|
+
let o = J(i, t), s = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1637
|
+
b = e.traceId, ve({
|
|
1638
|
+
traceId: e.traceId,
|
|
1639
|
+
spanId: e.spanId,
|
|
1640
|
+
source: "mutation",
|
|
1641
|
+
tag: t
|
|
1642
|
+
});
|
|
1643
|
+
})), N.catchAll(() => N.void), N.zipRight(Gn(o(n), _))).pipe(N.withSpan(`client.mutation.${t}`, { attributes: {
|
|
1644
|
+
"voltro.api": e,
|
|
1645
|
+
"voltro.mutationId": g,
|
|
1646
|
+
"rpc.tag": t,
|
|
1647
|
+
"voltro.replay": a
|
|
1648
|
+
} }));
|
|
1649
|
+
return x = !0, Z(r, s);
|
|
1650
|
+
}, o;
|
|
1651
|
+
try {
|
|
1652
|
+
o = await a(l, h, !1);
|
|
1653
|
+
} catch (n) {
|
|
1654
|
+
let r = x ? V(n, "handler") : "client", s = In(n, b);
|
|
1655
|
+
r === "transport" && (i.current.errorBus.emit({
|
|
1392
1656
|
source: "mutation",
|
|
1393
|
-
tag: t
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1657
|
+
tag: t,
|
|
1658
|
+
error: s,
|
|
1659
|
+
kind: r,
|
|
1660
|
+
outcome: "unknown",
|
|
1661
|
+
...b === void 0 ? {} : { traceId: b }
|
|
1662
|
+
}), S = s);
|
|
1663
|
+
let c = i.current, l = c.recovery ?? ct(c.errorBus, e), u = r === "transport" ? l.reserveMutationReplay(C) : void 0;
|
|
1664
|
+
if (u === void 0) throw s;
|
|
1665
|
+
try {
|
|
1666
|
+
if (!await l.waitForMutationReplaySupport(C) || !await l.waitForProtocolReady(C)) throw s;
|
|
1667
|
+
let n = await X(i, e, t);
|
|
1668
|
+
if (!u.isValid()) throw s;
|
|
1669
|
+
try {
|
|
1670
|
+
o = await a(n.runtime, n.client, !0);
|
|
1671
|
+
} catch (e) {
|
|
1672
|
+
let t = e;
|
|
1673
|
+
if (t?._tag !== "MutationInFlight") throw e;
|
|
1674
|
+
let r = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 1e3;
|
|
1675
|
+
if (r >= l.replayWindowRemaining(C)) throw e;
|
|
1676
|
+
if (await new Promise((e) => setTimeout(e, r)), !u.isValid()) throw s;
|
|
1677
|
+
o = await a(n.runtime, n.client, !0);
|
|
1678
|
+
}
|
|
1679
|
+
} finally {
|
|
1680
|
+
u.release();
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
f(o), Mn(g, {
|
|
1403
1684
|
status: "success",
|
|
1404
|
-
output:
|
|
1685
|
+
output: o
|
|
1405
1686
|
}), i.current.errorBus.emitSuccess({
|
|
1406
1687
|
source: "mutation",
|
|
1407
1688
|
tag: t
|
|
1408
|
-
}), d.confirmByMutation(g), r?.onSuccess?.(
|
|
1409
|
-
let
|
|
1410
|
-
return
|
|
1689
|
+
}), d.confirmByMutation(g), r?.onSuccess?.(o, n);
|
|
1690
|
+
let s = Bn(r?.notify?.success, o, n);
|
|
1691
|
+
return s !== void 0 && Ln?.success(s), o;
|
|
1411
1692
|
} catch (e) {
|
|
1412
|
-
let n =
|
|
1413
|
-
if (u(n),
|
|
1693
|
+
let n = In(e, b);
|
|
1694
|
+
if (u(n), Mn(g, {
|
|
1414
1695
|
status: "error",
|
|
1415
1696
|
error: n
|
|
1416
|
-
}), d.revertByMutation(g), i.current.errorBus.emit({
|
|
1697
|
+
}), d.revertByMutation(g), Object.is(S, n) || i.current.errorBus.emit({
|
|
1417
1698
|
source: "mutation",
|
|
1418
1699
|
tag: t,
|
|
1419
1700
|
error: n,
|
|
1420
|
-
kind: x ?
|
|
1701
|
+
kind: x ? V(e, "handler") : "client",
|
|
1702
|
+
outcome: x && V(e, "handler") === "transport" ? "unknown" : x ? "known" : "not-started",
|
|
1421
1703
|
...b === void 0 ? {} : { traceId: b }
|
|
1422
1704
|
}), a) return s(n);
|
|
1423
1705
|
throw n;
|
|
@@ -1429,7 +1711,7 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1429
1711
|
t,
|
|
1430
1712
|
o
|
|
1431
1713
|
]);
|
|
1432
|
-
return
|
|
1714
|
+
return O(() => {
|
|
1433
1715
|
let e = {
|
|
1434
1716
|
mutate: h,
|
|
1435
1717
|
pending: s,
|
|
@@ -1445,7 +1727,7 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1445
1727
|
l,
|
|
1446
1728
|
d
|
|
1447
1729
|
]);
|
|
1448
|
-
},
|
|
1730
|
+
}, Jn = (e, t) => {
|
|
1449
1731
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1450
1732
|
try {
|
|
1451
1733
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1455,17 +1737,17 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1455
1737
|
});
|
|
1456
1738
|
} catch {}
|
|
1457
1739
|
return e;
|
|
1458
|
-
},
|
|
1459
|
-
let n =
|
|
1740
|
+
}, Yn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Xn = 0, Zn = () => `act_${++Xn}`, Qn = (e, t) => {
|
|
1741
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
1460
1742
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
1461
1743
|
let n = r[t]?.kind;
|
|
1462
1744
|
n !== void 0 && n !== "action" && console.error(`[@voltro/client] useAction('${e}', '${t}') targets a ${n}, not an action. Use ${n === "mutation" ? "useMutation" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
|
|
1463
1745
|
}
|
|
1464
|
-
let [a, o] =
|
|
1746
|
+
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = E(async (n, r) => {
|
|
1465
1747
|
let a = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
1466
1748
|
o(!0), c(void 0);
|
|
1467
|
-
let s =
|
|
1468
|
-
|
|
1749
|
+
let s = Zn(), l = r?.idempotencyKey ?? Wn();
|
|
1750
|
+
jn({
|
|
1469
1751
|
id: s,
|
|
1470
1752
|
apiName: e,
|
|
1471
1753
|
tag: t,
|
|
@@ -1473,44 +1755,45 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1473
1755
|
});
|
|
1474
1756
|
let d, f = !1;
|
|
1475
1757
|
try {
|
|
1476
|
-
let { runtime: a, client: o } = await
|
|
1758
|
+
let { runtime: a, client: o } = await X(i, e, t), c = J(o, t), p = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1477
1759
|
d = e.traceId, ve({
|
|
1478
1760
|
traceId: e.traceId,
|
|
1479
1761
|
spanId: e.spanId,
|
|
1480
1762
|
source: "action",
|
|
1481
1763
|
tag: t
|
|
1482
1764
|
});
|
|
1483
|
-
})),
|
|
1765
|
+
})), N.catchAll(() => N.void), N.zipRight(Gn(c(n), l))).pipe(N.withSpan(`client.action.${t}`, { attributes: {
|
|
1484
1766
|
"voltro.api": e,
|
|
1485
1767
|
"voltro.actionId": s,
|
|
1486
1768
|
"rpc.tag": t
|
|
1487
1769
|
} }));
|
|
1488
1770
|
f = !0;
|
|
1489
|
-
let m = await
|
|
1490
|
-
u(m),
|
|
1771
|
+
let m = await Z(a, p);
|
|
1772
|
+
u(m), Mn(s, {
|
|
1491
1773
|
status: "success",
|
|
1492
1774
|
output: m
|
|
1493
1775
|
}), i.current.errorBus.emitSuccess({
|
|
1494
1776
|
source: "action",
|
|
1495
1777
|
tag: t
|
|
1496
1778
|
}), r?.onSuccess?.(m, n);
|
|
1497
|
-
let h =
|
|
1498
|
-
return h !== void 0 &&
|
|
1779
|
+
let h = Yn(r?.notify?.success, m, n);
|
|
1780
|
+
return h !== void 0 && zn()?.success(h), m;
|
|
1499
1781
|
} catch (e) {
|
|
1500
|
-
let o =
|
|
1501
|
-
if (c(o),
|
|
1782
|
+
let o = Jn(e, d);
|
|
1783
|
+
if (c(o), Mn(s, {
|
|
1502
1784
|
status: "error",
|
|
1503
1785
|
error: o
|
|
1504
1786
|
}), i.current.errorBus.emit({
|
|
1505
1787
|
source: "action",
|
|
1506
1788
|
tag: t,
|
|
1507
1789
|
error: o,
|
|
1508
|
-
kind: f ?
|
|
1790
|
+
kind: f ? V(e, "handler") : "client",
|
|
1791
|
+
outcome: f && V(e, "handler") === "transport" ? "unknown" : f ? "known" : "not-started",
|
|
1509
1792
|
...d === void 0 ? {} : { traceId: d }
|
|
1510
1793
|
}), a) {
|
|
1511
1794
|
r?.onError?.(o, n);
|
|
1512
|
-
let e =
|
|
1513
|
-
e !== void 0 &&
|
|
1795
|
+
let e = Yn(r?.notify?.error, o, n);
|
|
1796
|
+
e !== void 0 && zn()?.error(e);
|
|
1514
1797
|
return;
|
|
1515
1798
|
}
|
|
1516
1799
|
throw o;
|
|
@@ -1518,7 +1801,7 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1518
1801
|
o(!1);
|
|
1519
1802
|
}
|
|
1520
1803
|
}, [e, t]);
|
|
1521
|
-
return
|
|
1804
|
+
return O(() => ({
|
|
1522
1805
|
run: d,
|
|
1523
1806
|
pending: a,
|
|
1524
1807
|
error: s,
|
|
@@ -1529,14 +1812,14 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1529
1812
|
s,
|
|
1530
1813
|
l
|
|
1531
1814
|
]);
|
|
1532
|
-
},
|
|
1815
|
+
}, $n = w(void 0), er = (e) => T($n.Provider, { value: e.messages }, e.children), tr = () => ee($n), nr = Symbol.for("voltro.client.formEngine"), rr = w(void 0), ir = (e, t) => {
|
|
1533
1816
|
let n = e;
|
|
1534
1817
|
for (let e of t.split(".")) {
|
|
1535
1818
|
if (typeof n != "object" || !n) return;
|
|
1536
1819
|
n = n[e];
|
|
1537
1820
|
}
|
|
1538
1821
|
return n;
|
|
1539
|
-
},
|
|
1822
|
+
}, ar = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), or = {
|
|
1540
1823
|
isTouched: !1,
|
|
1541
1824
|
isBlurred: !1,
|
|
1542
1825
|
isDirty: !1,
|
|
@@ -1545,28 +1828,28 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1545
1828
|
isValidating: !1,
|
|
1546
1829
|
errorMap: {},
|
|
1547
1830
|
errorSourceMap: {}
|
|
1548
|
-
},
|
|
1831
|
+
}, sr = (e, t) => {
|
|
1549
1832
|
let n = e.find((e) => e.name === t);
|
|
1550
1833
|
if (n !== void 0) return n;
|
|
1551
1834
|
let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
|
|
1552
1835
|
if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
|
|
1553
|
-
},
|
|
1554
|
-
let r =
|
|
1836
|
+
}, cr = (e, t, n) => {
|
|
1837
|
+
let r = q(e), a = k(void 0), o = typeof t == "function" ? t(a.current?.state?.values ?? n.defaults ?? {}) : t, s = k(o).current, c = qn(e, o), l = n.schema ?? r.descriptors[o]?.input;
|
|
1555
1838
|
process.env.NODE_ENV !== "production" && l === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`);
|
|
1556
|
-
let u =
|
|
1839
|
+
let u = O(() => l ? x(l) : [], [l]), d = tr(), f = n.messages ?? d, p = O(() => ({
|
|
1557
1840
|
...n.locale === void 0 ? {} : { locale: n.locale },
|
|
1558
1841
|
...f === void 0 ? {} : { messages: f }
|
|
1559
|
-
}), [n.locale, f]), m =
|
|
1842
|
+
}), [n.locale, f]), m = k(n.asyncFields);
|
|
1560
1843
|
m.current = n.asyncFields;
|
|
1561
|
-
let h =
|
|
1844
|
+
let h = k(n);
|
|
1562
1845
|
h.current = n;
|
|
1563
|
-
let g =
|
|
1846
|
+
let g = k(c);
|
|
1564
1847
|
g.current = c;
|
|
1565
|
-
let _ =
|
|
1848
|
+
let _ = k(p);
|
|
1566
1849
|
_.current = p;
|
|
1567
|
-
let v =
|
|
1850
|
+
let v = k(l);
|
|
1568
1851
|
v.current = l;
|
|
1569
|
-
let [y, S] =
|
|
1852
|
+
let [y, S] = A(() => n.flash?.errors ?? {}), [w, T] = A(n.flash?.formError), [ee, te] = A(void 0), j = k(void 0), M = E((e) => {
|
|
1570
1853
|
let t = v.current;
|
|
1571
1854
|
if (t === void 0) return [];
|
|
1572
1855
|
let n = h.current, r = e;
|
|
@@ -1580,26 +1863,26 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1580
1863
|
let o = n.errorPath ?? {};
|
|
1581
1864
|
return a.map((t) => {
|
|
1582
1865
|
let n = o[t.path];
|
|
1583
|
-
return n === void 0 ? (
|
|
1866
|
+
return n === void 0 ? (ir(e, t.path) !== void 0 || t.path.includes("."), t) : {
|
|
1584
1867
|
...t,
|
|
1585
1868
|
path: n
|
|
1586
1869
|
};
|
|
1587
1870
|
});
|
|
1588
|
-
}, []),
|
|
1871
|
+
}, []), ne = E((e) => {
|
|
1589
1872
|
let t = { ...e ?? {} }, n = v.current;
|
|
1590
1873
|
if (n !== void 0) for (let e of x(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
|
|
1591
1874
|
return t;
|
|
1592
|
-
}, []),
|
|
1875
|
+
}, []), re = k(() => Promise.resolve());
|
|
1593
1876
|
if (a.current === void 0) {
|
|
1594
|
-
let e = n.flash, t = e === void 0 ?
|
|
1595
|
-
...
|
|
1877
|
+
let e = n.flash, t = e === void 0 ? ne(n.defaults) : {
|
|
1878
|
+
...ne(n.defaults),
|
|
1596
1879
|
...e.values
|
|
1597
1880
|
};
|
|
1598
1881
|
a.current = new me({
|
|
1599
|
-
onSubmit: ({ value: e }) =>
|
|
1882
|
+
onSubmit: ({ value: e }) => re.current(e),
|
|
1600
1883
|
defaultValues: t,
|
|
1601
1884
|
validators: { onChange: ({ value: e }) => {
|
|
1602
|
-
let t =
|
|
1885
|
+
let t = M(e);
|
|
1603
1886
|
if (t.length === 0) return;
|
|
1604
1887
|
let n = {};
|
|
1605
1888
|
for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = b(e, _.current));
|
|
@@ -1607,11 +1890,11 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1607
1890
|
} }
|
|
1608
1891
|
});
|
|
1609
1892
|
}
|
|
1610
|
-
let
|
|
1611
|
-
|
|
1612
|
-
let
|
|
1613
|
-
he(
|
|
1614
|
-
let F =
|
|
1893
|
+
let N = a.current, P = N;
|
|
1894
|
+
D(() => P.mount(), [P]);
|
|
1895
|
+
let ie = n.subscribe ?? "all";
|
|
1896
|
+
he(N.store, (e) => ie === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
|
|
1897
|
+
let F = N.store.state.values, I = N.store.state, L = O(() => M(F), [M, F]), R = n.isLoading === !0, ae = n.validate, z = ae?.onChange ?? "afterTouched", oe = ae?.onBlur ?? !0, se = I.submissionAttempts, ce = I.fieldMetaBase ?? {}, le = E((e) => {
|
|
1615
1898
|
if (R) return !1;
|
|
1616
1899
|
if (se > 0 || z === "always") return !0;
|
|
1617
1900
|
if (z === "never") return !1;
|
|
@@ -1623,7 +1906,7 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1623
1906
|
R,
|
|
1624
1907
|
z,
|
|
1625
1908
|
oe
|
|
1626
|
-
]), ue =
|
|
1909
|
+
]), ue = E((e) => {
|
|
1627
1910
|
let t = y[e];
|
|
1628
1911
|
if (t !== void 0) return t;
|
|
1629
1912
|
let n = m.current?.[e];
|
|
@@ -1638,7 +1921,7 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1638
1921
|
y,
|
|
1639
1922
|
le,
|
|
1640
1923
|
L
|
|
1641
|
-
]), fe =
|
|
1924
|
+
]), fe = O(() => {
|
|
1642
1925
|
let e = {}, t = /* @__PURE__ */ new Set([...L.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(y)]);
|
|
1643
1926
|
for (let [e, n] of Object.entries(m.current ?? {})) n.status === "invalid" && t.add(e);
|
|
1644
1927
|
for (let n of t) {
|
|
@@ -1650,22 +1933,22 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1650
1933
|
L,
|
|
1651
1934
|
y,
|
|
1652
1935
|
ue
|
|
1653
|
-
]), B =
|
|
1936
|
+
]), B = E((e) => {
|
|
1654
1937
|
S((t) => {
|
|
1655
1938
|
if (!(e in t)) return t;
|
|
1656
1939
|
let n = { ...t };
|
|
1657
1940
|
return delete n[e], n;
|
|
1658
1941
|
});
|
|
1659
|
-
}, []), pe =
|
|
1660
|
-
let n =
|
|
1942
|
+
}, []), pe = E((t) => {
|
|
1943
|
+
let n = sr(u, t), r = P.getFieldMeta(t), i = ue(t), a = ar(e, s, t), o = m.current?.[t], c = [i === void 0 ? void 0 : `${a}-error`, n?.description === void 0 ? void 0 : `${a}-help`].filter((e) => e !== void 0);
|
|
1661
1944
|
return {
|
|
1662
|
-
value:
|
|
1945
|
+
value: P.getFieldValue(t),
|
|
1663
1946
|
setValue: (e) => {
|
|
1664
|
-
B(t), !Object.is(
|
|
1947
|
+
B(t), !Object.is(P.getFieldValue(t), e) && P.setFieldValue(t, e);
|
|
1665
1948
|
},
|
|
1666
1949
|
onBlur: () => {
|
|
1667
|
-
|
|
1668
|
-
|
|
1950
|
+
P.setFieldMeta(t, (e) => ({
|
|
1951
|
+
...or,
|
|
1669
1952
|
...e ?? {},
|
|
1670
1953
|
isTouched: !0,
|
|
1671
1954
|
isBlurred: !0
|
|
@@ -1693,35 +1976,35 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1693
1976
|
e,
|
|
1694
1977
|
s,
|
|
1695
1978
|
B,
|
|
1696
|
-
|
|
1979
|
+
P,
|
|
1697
1980
|
u,
|
|
1698
1981
|
y,
|
|
1699
1982
|
ue
|
|
1700
|
-
]), ge =
|
|
1701
|
-
items:
|
|
1983
|
+
]), ge = E((e) => ({
|
|
1984
|
+
items: P.getFieldValue(e) ?? [],
|
|
1702
1985
|
push: (t) => {
|
|
1703
|
-
|
|
1986
|
+
P.pushFieldValue(e, t);
|
|
1704
1987
|
},
|
|
1705
1988
|
insert: (t, n) => {
|
|
1706
|
-
|
|
1989
|
+
P.insertFieldValue(e, t, n);
|
|
1707
1990
|
},
|
|
1708
1991
|
remove: (t) => {
|
|
1709
|
-
|
|
1992
|
+
P.removeFieldValue(e, t);
|
|
1710
1993
|
},
|
|
1711
1994
|
move: (t, n) => {
|
|
1712
|
-
|
|
1995
|
+
P.moveFieldValues(e, t, n);
|
|
1713
1996
|
},
|
|
1714
1997
|
swap: (t, n) => {
|
|
1715
|
-
|
|
1998
|
+
P.swapFieldValues(e, t, n);
|
|
1716
1999
|
},
|
|
1717
2000
|
field: (t, n) => pe(`${e}.${t}.${n}`)
|
|
1718
|
-
}), [
|
|
1719
|
-
B(e), !Object.is(
|
|
1720
|
-
}, [B,
|
|
1721
|
-
for (let [t, n] of Object.entries(e))
|
|
1722
|
-
}, [
|
|
1723
|
-
S({}),
|
|
1724
|
-
}, [
|
|
2001
|
+
}), [P, pe]), _e = E((e) => u.filter((t) => t.section === e), [u]), ve = E((e, t) => {
|
|
2002
|
+
B(e), !Object.is(P.getFieldValue(e), t) && P.setFieldValue(e, t);
|
|
2003
|
+
}, [B, P]), ye = E((e) => {
|
|
2004
|
+
for (let [t, n] of Object.entries(e)) P.setFieldValue(t, n);
|
|
2005
|
+
}, [P]), be = E((e) => {
|
|
2006
|
+
S({}), T(void 0), te(void 0), j.current = void 0, e === void 0 ? P.reset() : P.reset(ne(e));
|
|
2007
|
+
}, [P, ne]), xe = n.asyncTimeoutMs ?? 5e3, V = E(async () => {
|
|
1725
2008
|
let e = Date.now();
|
|
1726
2009
|
for (;;) {
|
|
1727
2010
|
let t = m.current;
|
|
@@ -1740,12 +2023,12 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1740
2023
|
}, _.current)]));
|
|
1741
2024
|
await new Promise((e) => setTimeout(e, 50));
|
|
1742
2025
|
}
|
|
1743
|
-
}, [xe]),
|
|
2026
|
+
}, [xe]), Se = E(() => {
|
|
1744
2027
|
let t = globalThis.document;
|
|
1745
2028
|
if (t?.getElementById === void 0) return;
|
|
1746
2029
|
let n = [...u.map((e) => e.name), ...Object.keys(y).filter((e) => !u.some((t) => t.name === e))];
|
|
1747
2030
|
for (let r of n) if (ue(r) !== void 0) {
|
|
1748
|
-
t.getElementById(
|
|
2031
|
+
t.getElementById(ar(e, s, r))?.focus?.();
|
|
1749
2032
|
return;
|
|
1750
2033
|
}
|
|
1751
2034
|
}, [
|
|
@@ -1754,44 +2037,44 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1754
2037
|
u,
|
|
1755
2038
|
y,
|
|
1756
2039
|
ue
|
|
1757
|
-
]),
|
|
1758
|
-
|
|
1759
|
-
let
|
|
1760
|
-
|
|
2040
|
+
]), H = k(Se);
|
|
2041
|
+
H.current = Se;
|
|
2042
|
+
let Ce = E(async () => {
|
|
2043
|
+
T(void 0), S({}), te(void 0), j.current = void 0;
|
|
1761
2044
|
let e, t = !1;
|
|
1762
|
-
if (await
|
|
2045
|
+
if (await P.handleSubmit().catch((n) => {
|
|
1763
2046
|
t = !0, e = n;
|
|
1764
2047
|
}), t) throw e;
|
|
1765
|
-
return
|
|
1766
|
-
|
|
1767
|
-
}),
|
|
1768
|
-
}, [
|
|
1769
|
-
|
|
2048
|
+
return j.current === void 0 && queueMicrotask(() => {
|
|
2049
|
+
H.current();
|
|
2050
|
+
}), j.current;
|
|
2051
|
+
}, [P]);
|
|
2052
|
+
re.current = (async (e) => {
|
|
1770
2053
|
let t = h.current, n = e, r = n;
|
|
1771
2054
|
if (t.toInput !== void 0) try {
|
|
1772
2055
|
r = t.toInput(n);
|
|
1773
2056
|
} catch (e) {
|
|
1774
|
-
|
|
2057
|
+
T(e instanceof Error ? e.message : String(e));
|
|
1775
2058
|
return;
|
|
1776
2059
|
}
|
|
1777
|
-
if (
|
|
2060
|
+
if (M(n).length > 0) {
|
|
1778
2061
|
queueMicrotask(() => {
|
|
1779
|
-
|
|
2062
|
+
H.current();
|
|
1780
2063
|
});
|
|
1781
2064
|
return;
|
|
1782
2065
|
}
|
|
1783
2066
|
let i = v.current;
|
|
1784
2067
|
if (i !== void 0) {
|
|
1785
|
-
let e =
|
|
2068
|
+
let e = C(i, r);
|
|
1786
2069
|
e.dropped.length > 0 && process.env.NODE_ENV !== "production" && console.warn(`[@voltro/client] useFormBinding: dropped ${e.dropped.length} value(s) the mutation's input does not declare (${e.dropped.join(", ")}). The server refuses undeclared fields, so they are not sent. Map them with \`toInput\` if they belong in the write; ignore this if they are form-only state.`), r = e.input;
|
|
1787
2070
|
}
|
|
1788
|
-
let a = await
|
|
2071
|
+
let a = await V();
|
|
1789
2072
|
if (a !== void 0) {
|
|
1790
2073
|
S((e) => ({
|
|
1791
2074
|
...e,
|
|
1792
2075
|
...a
|
|
1793
2076
|
})), queueMicrotask(() => {
|
|
1794
|
-
|
|
2077
|
+
H.current();
|
|
1795
2078
|
});
|
|
1796
2079
|
return;
|
|
1797
2080
|
}
|
|
@@ -1802,11 +2085,11 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1802
2085
|
values: n,
|
|
1803
2086
|
mutate: o
|
|
1804
2087
|
});
|
|
1805
|
-
|
|
2088
|
+
j.current = e, t.onSuccess?.(e);
|
|
1806
2089
|
} catch (e) {
|
|
1807
2090
|
let t = de(e);
|
|
1808
2091
|
if (t.length === 0) {
|
|
1809
|
-
|
|
2092
|
+
te(e), h.current.onError?.(e);
|
|
1810
2093
|
return;
|
|
1811
2094
|
}
|
|
1812
2095
|
let n = {};
|
|
@@ -1819,191 +2102,195 @@ var yn = 15e3, Y = async (e, t, n) => {
|
|
|
1819
2102
|
...e,
|
|
1820
2103
|
...n
|
|
1821
2104
|
})), queueMicrotask(() => {
|
|
1822
|
-
|
|
2105
|
+
H.current();
|
|
1823
2106
|
});
|
|
1824
2107
|
}
|
|
1825
2108
|
});
|
|
1826
|
-
let
|
|
2109
|
+
let we = L.length === 0, Te = Object.values(m.current ?? {}).some((e) => e.status === "checking"), Ee = ee ?? c.error, U = Ee !== void 0 && de(Ee).length > 0 ? void 0 : Ee, De = Object.keys(fe).length, Oe = (() => {
|
|
1827
2110
|
for (let e of u) if (fe[e.name] !== void 0) return e.name;
|
|
1828
2111
|
let e = Object.keys(fe);
|
|
1829
2112
|
return e.length > 0 ? e[0] : void 0;
|
|
1830
|
-
})(),
|
|
2113
|
+
})(), ke = {
|
|
1831
2114
|
isDirty: !R && I.isDirty,
|
|
1832
2115
|
isPristine: I.isPristine,
|
|
1833
2116
|
isTouched: I.isTouched,
|
|
1834
|
-
isValid:
|
|
1835
|
-
isValidating:
|
|
1836
|
-
canSubmit:
|
|
2117
|
+
isValid: we,
|
|
2118
|
+
isValidating: Te,
|
|
2119
|
+
canSubmit: we && !Te && !I.isSubmitting && !R,
|
|
1837
2120
|
isSubmitting: I.isSubmitting,
|
|
1838
2121
|
isSubmitted: I.isSubmitted,
|
|
1839
|
-
isSubmitSuccessful: I.isSubmitSuccessful &&
|
|
2122
|
+
isSubmitSuccessful: I.isSubmitSuccessful && j.current !== void 0,
|
|
1840
2123
|
submissionAttempts: I.submissionAttempts,
|
|
1841
|
-
errorCount:
|
|
1842
|
-
firstInvalidPath:
|
|
2124
|
+
errorCount: De,
|
|
2125
|
+
firstInvalidPath: Oe,
|
|
1843
2126
|
pending: c.pending,
|
|
1844
2127
|
isLoading: R,
|
|
1845
|
-
submitError:
|
|
2128
|
+
submitError: U,
|
|
1846
2129
|
data: c.data
|
|
1847
|
-
},
|
|
2130
|
+
}, Ae = {
|
|
1848
2131
|
fields: u,
|
|
1849
2132
|
values: F,
|
|
1850
2133
|
errors: fe,
|
|
1851
2134
|
issues: L,
|
|
1852
|
-
isValid:
|
|
2135
|
+
isValid: we,
|
|
1853
2136
|
pending: c.pending,
|
|
1854
|
-
submitError:
|
|
1855
|
-
formError:
|
|
2137
|
+
submitError: U,
|
|
2138
|
+
formError: w,
|
|
1856
2139
|
data: c.data,
|
|
1857
2140
|
setValue: ve,
|
|
1858
2141
|
setValues: ye,
|
|
1859
2142
|
reset: be,
|
|
1860
|
-
submit:
|
|
2143
|
+
submit: Ce,
|
|
1861
2144
|
field: pe,
|
|
1862
2145
|
array: ge,
|
|
1863
2146
|
section: _e,
|
|
1864
|
-
state:
|
|
1865
|
-
focusFirstInvalid:
|
|
2147
|
+
state: ke,
|
|
2148
|
+
focusFirstInvalid: Se
|
|
1866
2149
|
};
|
|
1867
|
-
return Object.defineProperty(
|
|
2150
|
+
return Object.defineProperty(Ae, nr, {
|
|
1868
2151
|
value: {
|
|
1869
|
-
store:
|
|
2152
|
+
store: N.store,
|
|
1870
2153
|
field: pe
|
|
1871
2154
|
},
|
|
1872
2155
|
enumerable: !1
|
|
1873
|
-
}),
|
|
1874
|
-
},
|
|
1875
|
-
function
|
|
1876
|
-
let n =
|
|
2156
|
+
}), Ae;
|
|
2157
|
+
}, lr = (e) => T(rr.Provider, { value: e.binding }, e.children), ur = () => ee(rr);
|
|
2158
|
+
function dr(e, t) {
|
|
2159
|
+
let n = ee(rr), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
|
|
1877
2160
|
if (a === void 0) throw Error("useFormField(path) found no form binding — mount <FormBindingProvider binding={form}> above this field, or call useFormField(form, path) with the binding in hand.");
|
|
1878
|
-
let o = a[
|
|
2161
|
+
let o = a[nr];
|
|
1879
2162
|
if (o === void 0) throw Error("useFormField: not a useFormBinding result");
|
|
1880
2163
|
return he(o.store, (e) => {
|
|
1881
2164
|
let t = e.fieldMetaBase[i];
|
|
1882
|
-
return `${JSON.stringify(
|
|
2165
|
+
return `${JSON.stringify(ir(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
|
|
1883
2166
|
}), o.field(i);
|
|
1884
2167
|
}
|
|
1885
2168
|
//#endregion
|
|
1886
2169
|
//#region src/createHooks.ts
|
|
1887
|
-
var
|
|
1888
|
-
useSubscription: (t, n, r) =>
|
|
1889
|
-
useMutation: (t) =>
|
|
1890
|
-
useAction: (t) =>
|
|
1891
|
-
useFormBinding: (t, n) =>
|
|
1892
|
-
}),
|
|
1893
|
-
|
|
1894
|
-
},
|
|
1895
|
-
let i =
|
|
2170
|
+
var fr = Y, pr = (e) => ({
|
|
2171
|
+
useSubscription: (t, n, r) => fr(e, t, n, r),
|
|
2172
|
+
useMutation: (t) => qn(e, t),
|
|
2173
|
+
useAction: (t) => Qn(e, t),
|
|
2174
|
+
useFormBinding: (t, n) => cr(e, t, n ?? {})
|
|
2175
|
+
}), mr = () => ({ seeds: [] }), hr = null, gr = (e) => {
|
|
2176
|
+
hr = e;
|
|
2177
|
+
}, _r = /* @__PURE__ */ new Map(), vr = (e, t) => `${e}\u0000${t}`, yr = (e, t, n, r) => {
|
|
2178
|
+
let i = hr?.() ?? null;
|
|
1896
2179
|
if (i === null) throw Error(`seedPreloadedSubscription('${e}', '${t}') was called outside a server render. Preload seeds exist to put a subscription's first value into the SSR hydration payload; on the client the live subscription already provides it. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
|
|
1897
2180
|
i.seeds.push({
|
|
1898
2181
|
api: e,
|
|
1899
|
-
key:
|
|
2182
|
+
key: G([t, n]),
|
|
1900
2183
|
value: r
|
|
1901
2184
|
});
|
|
1902
|
-
},
|
|
1903
|
-
let r =
|
|
2185
|
+
}, br = (e, t, n) => {
|
|
2186
|
+
let r = hr?.() ?? null;
|
|
1904
2187
|
r !== null && r.seeds.push({
|
|
1905
2188
|
api: e,
|
|
1906
|
-
key:
|
|
2189
|
+
key: G([t, n]),
|
|
1907
2190
|
value: void 0,
|
|
1908
2191
|
failed: !0
|
|
1909
2192
|
});
|
|
1910
|
-
},
|
|
1911
|
-
if (e !== void 0) for (let t of e)
|
|
2193
|
+
}, xr = (e) => {
|
|
2194
|
+
if (e !== void 0) for (let t of e) _r.set(vr(t.api, t.key), {
|
|
1912
2195
|
value: t.value,
|
|
1913
2196
|
failed: t.failed === !0
|
|
1914
2197
|
});
|
|
1915
|
-
},
|
|
1916
|
-
let r =
|
|
2198
|
+
}, Sr = (e, t, n) => {
|
|
2199
|
+
let r = G([t, n]), i = hr?.() ?? null;
|
|
1917
2200
|
if (i !== null) {
|
|
1918
2201
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
|
|
1919
2202
|
return;
|
|
1920
2203
|
}
|
|
1921
|
-
let a =
|
|
2204
|
+
let a = _r.get(vr(e, r));
|
|
1922
2205
|
return a === void 0 || a.failed ? void 0 : a.value;
|
|
1923
|
-
},
|
|
1924
|
-
let r =
|
|
2206
|
+
}, Cr = (e, t, n) => {
|
|
2207
|
+
let r = G([t, n]), i = hr?.() ?? null;
|
|
1925
2208
|
if (i !== null) {
|
|
1926
2209
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
|
|
1927
2210
|
return "absent";
|
|
1928
2211
|
}
|
|
1929
|
-
let a =
|
|
2212
|
+
let a = _r.get(vr(e, r));
|
|
1930
2213
|
return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
|
|
1931
|
-
},
|
|
1932
|
-
|
|
2214
|
+
}, wr = () => {
|
|
2215
|
+
_r.clear();
|
|
1933
2216
|
};
|
|
1934
2217
|
//#endregion
|
|
1935
2218
|
//#region src/usePreloadedSubscription.ts
|
|
1936
|
-
function
|
|
1937
|
-
let i =
|
|
2219
|
+
function Tr(e, t, n = {}, r = {}) {
|
|
2220
|
+
let i = Sr(e, t, n), a = Y(e, t, n, i === void 0 ? r : {
|
|
1938
2221
|
...r,
|
|
1939
2222
|
initialSnapshot: i
|
|
1940
2223
|
});
|
|
1941
|
-
return
|
|
2224
|
+
return Cr(e, t, n) === "failed" ? {
|
|
1942
2225
|
...a,
|
|
1943
2226
|
preloadFailed: !0
|
|
1944
2227
|
} : a;
|
|
1945
2228
|
}
|
|
1946
2229
|
//#endregion
|
|
1947
2230
|
//#region src/useEvent.ts
|
|
1948
|
-
var
|
|
2231
|
+
var Er = {
|
|
1949
2232
|
status: "idle",
|
|
1950
2233
|
missed: 0,
|
|
1951
2234
|
lastMiss: void 0
|
|
1952
|
-
},
|
|
2235
|
+
}, Dr = class {
|
|
1953
2236
|
_tag = "EventStreamClosed";
|
|
1954
2237
|
};
|
|
1955
|
-
function
|
|
1956
|
-
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s =
|
|
2238
|
+
function Or(e, t, n, r = {}) {
|
|
2239
|
+
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s = q(a), { runtime: c, client: l } = s, [u, d] = A(Er), f = k(n);
|
|
1957
2240
|
f.current = n;
|
|
1958
|
-
let p =
|
|
2241
|
+
let p = k(o);
|
|
1959
2242
|
p.current = o;
|
|
1960
|
-
let m =
|
|
2243
|
+
let m = k(l);
|
|
1961
2244
|
m.current = l;
|
|
1962
|
-
let h =
|
|
2245
|
+
let h = k(c);
|
|
1963
2246
|
h.current = c;
|
|
1964
|
-
let g =
|
|
2247
|
+
let g = k(/* @__PURE__ */ new Map()), _ = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), v = k(t);
|
|
1965
2248
|
v.current = t;
|
|
1966
|
-
let y =
|
|
2249
|
+
let y = k(null);
|
|
1967
2250
|
y.current !== _ && (y.current = _, g.current = /* @__PURE__ */ new Map());
|
|
1968
|
-
let b =
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
missed:
|
|
2251
|
+
let b = E((t, n) => {
|
|
2252
|
+
t <= 0 || (W(a, "event.gap", {
|
|
2253
|
+
tag: e.name,
|
|
2254
|
+
missed: t,
|
|
2255
|
+
reason: n
|
|
2256
|
+
}), d((e) => ({
|
|
2257
|
+
...e,
|
|
2258
|
+
missed: e.missed + t,
|
|
1972
2259
|
lastMiss: {
|
|
1973
|
-
count:
|
|
1974
|
-
reason:
|
|
2260
|
+
count: t,
|
|
2261
|
+
reason: n
|
|
1975
2262
|
}
|
|
1976
2263
|
})), p.current?.({
|
|
1977
|
-
count:
|
|
1978
|
-
reason:
|
|
2264
|
+
count: t,
|
|
2265
|
+
reason: n
|
|
1979
2266
|
}));
|
|
1980
|
-
}, []), x = !i && _ !== null && !
|
|
1981
|
-
return
|
|
2267
|
+
}, [a, e.name]), x = !i && _ !== null && !wt(s);
|
|
2268
|
+
return D(() => {
|
|
1982
2269
|
if (!x) {
|
|
1983
|
-
d(
|
|
2270
|
+
d(Er);
|
|
1984
2271
|
return;
|
|
1985
2272
|
}
|
|
1986
2273
|
d((e) => ({
|
|
1987
2274
|
...e,
|
|
1988
2275
|
status: "connecting"
|
|
1989
2276
|
}));
|
|
1990
|
-
let t = 0, n =
|
|
2277
|
+
let t = 0, n = N.sync(() => {
|
|
1991
2278
|
let t = [...g.current].map(([e, t]) => ({
|
|
1992
2279
|
origin: e,
|
|
1993
2280
|
n: t
|
|
1994
2281
|
}));
|
|
1995
|
-
return
|
|
2282
|
+
return J(m.current, e.name)({
|
|
1996
2283
|
key: v.current,
|
|
1997
2284
|
...t.length > 0 ? { resume: t } : {}
|
|
1998
2285
|
});
|
|
1999
|
-
}), r = z.unwrap(n).pipe(z.tap(() =>
|
|
2286
|
+
}), r = z.unwrap(n).pipe(z.tap(() => N.sync(() => {
|
|
2000
2287
|
t = 0;
|
|
2001
|
-
})), z.concat(z.fail(new
|
|
2288
|
+
})), z.concat(z.fail(new Dr())), z.retry(R.exponential("250 millis", 2).pipe(R.either(R.spaced("30 seconds")), R.jittered, R.tapOutput(() => N.sync(() => {
|
|
2002
2289
|
t += 1, d((e) => ({
|
|
2003
2290
|
...e,
|
|
2004
2291
|
status: "connecting"
|
|
2005
2292
|
}));
|
|
2006
|
-
}))))), i = h.current.runFork(z.runForEach(r, (e) =>
|
|
2293
|
+
}))))), i = h.current.runFork(z.runForEach(r, (e) => N.sync(() => {
|
|
2007
2294
|
if (e._tag === "attached") {
|
|
2008
2295
|
d((e) => ({
|
|
2009
2296
|
...e,
|
|
@@ -2025,11 +2312,11 @@ function xr(e, t, n, r = {}) {
|
|
|
2025
2312
|
_,
|
|
2026
2313
|
e.name,
|
|
2027
2314
|
b
|
|
2028
|
-
]), x ? u :
|
|
2315
|
+
]), x ? u : Er;
|
|
2029
2316
|
}
|
|
2030
2317
|
//#endregion
|
|
2031
2318
|
//#region src/sequence.ts
|
|
2032
|
-
var
|
|
2319
|
+
var kr = () => {
|
|
2033
2320
|
let e = (t) => ({
|
|
2034
2321
|
steps: t,
|
|
2035
2322
|
step: ((n, r, i) => e([...t, {
|
|
@@ -2041,7 +2328,7 @@ var Sr = () => {
|
|
|
2041
2328
|
}]))
|
|
2042
2329
|
});
|
|
2043
2330
|
return e([]);
|
|
2044
|
-
},
|
|
2331
|
+
}, Ar = async (e, t = {}) => {
|
|
2045
2332
|
let n = {}, r = [];
|
|
2046
2333
|
for (let i of e.steps) {
|
|
2047
2334
|
if (i.when !== void 0 && !i.when(n)) {
|
|
@@ -2101,13 +2388,13 @@ var Sr = () => {
|
|
|
2101
2388
|
ok: !0,
|
|
2102
2389
|
data: n
|
|
2103
2390
|
};
|
|
2104
|
-
},
|
|
2105
|
-
let [t, n] =
|
|
2391
|
+
}, jr = (e = {}) => {
|
|
2392
|
+
let [t, n] = A(!1), [r, i] = A(void 0), [a, o] = A(void 0), s = k(e);
|
|
2106
2393
|
return s.current = e, {
|
|
2107
|
-
run:
|
|
2394
|
+
run: E(async (e, t = {}) => {
|
|
2108
2395
|
n(!0), i(void 0), o(void 0);
|
|
2109
2396
|
try {
|
|
2110
|
-
let n = await
|
|
2397
|
+
let n = await Ar(e, {
|
|
2111
2398
|
...s.current,
|
|
2112
2399
|
...t
|
|
2113
2400
|
});
|
|
@@ -2120,7 +2407,7 @@ var Sr = () => {
|
|
|
2120
2407
|
error: r,
|
|
2121
2408
|
failedStep: a
|
|
2122
2409
|
};
|
|
2123
|
-
},
|
|
2410
|
+
}, Mr = "@voltro/plugin-storage", $ = (e) => fe(Mr, e), Nr = (e, t, n, r) => new Promise((i, a) => {
|
|
2124
2411
|
let o = new XMLHttpRequest();
|
|
2125
2412
|
if (o.open("PUT", e), o.upload.onprogress = (e) => {
|
|
2126
2413
|
e.lengthComputable && n(e.loaded / e.total);
|
|
@@ -2134,7 +2421,7 @@ var Sr = () => {
|
|
|
2134
2421
|
return;
|
|
2135
2422
|
}
|
|
2136
2423
|
r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
|
|
2137
|
-
}),
|
|
2424
|
+
}), Pr = (e, t, n, r, i, a) => new Promise((o, s) => {
|
|
2138
2425
|
let c = new XMLHttpRequest();
|
|
2139
2426
|
if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
|
|
2140
2427
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2152,7 +2439,7 @@ var Sr = () => {
|
|
|
2152
2439
|
return;
|
|
2153
2440
|
}
|
|
2154
2441
|
i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
|
|
2155
|
-
}),
|
|
2442
|
+
}), Fr = (e, t, n, r, i) => new Promise((a, o) => {
|
|
2156
2443
|
let s = new XMLHttpRequest();
|
|
2157
2444
|
if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
2158
2445
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2163,7 +2450,7 @@ var Sr = () => {
|
|
|
2163
2450
|
return;
|
|
2164
2451
|
}
|
|
2165
2452
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
2166
|
-
}),
|
|
2453
|
+
}), Ir = (e, t, n, r, i) => new Promise((a, o) => {
|
|
2167
2454
|
let s = new XMLHttpRequest();
|
|
2168
2455
|
if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
2169
2456
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2179,15 +2466,15 @@ var Sr = () => {
|
|
|
2179
2466
|
return;
|
|
2180
2467
|
}
|
|
2181
2468
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
2182
|
-
}),
|
|
2183
|
-
let n =
|
|
2469
|
+
}), Lr = (e, t = {}) => {
|
|
2470
|
+
let n = q(e), { inspectBaseUrl: r } = n, i = k(n);
|
|
2184
2471
|
i.current = n;
|
|
2185
|
-
let [a, o] =
|
|
2472
|
+
let [a, o] = A(0), [s, c] = A("idle"), [l, u] = A(void 0), d = k(null), f = E(() => {
|
|
2186
2473
|
o(0), c("idle"), u(void 0);
|
|
2187
|
-
}, []), p =
|
|
2474
|
+
}, []), p = E(() => {
|
|
2188
2475
|
d.current?.abort();
|
|
2189
|
-
}, []), m =
|
|
2190
|
-
let { runtime: s, client: c } = await
|
|
2476
|
+
}, []), m = E((e) => /^https?:\/\//.test(e) ? e : `${r}${e}`, [r]), h = E(async (n, r, a, o) => {
|
|
2477
|
+
let { runtime: s, client: c } = await X(i, e, "storage.upload").catch((e) => {
|
|
2191
2478
|
throw xe(e, "client");
|
|
2192
2479
|
}), l = Math.max(0, r.retries ?? t.retries ?? 1), u = (n instanceof File, n.type || "application/octet-stream"), d = n instanceof File ? n.name : "blob", f = r.visibility ?? t.visibility, p = r.key ?? t.key, h = r.folder ?? t.folder, g = r.tags ?? t.tags, _ = {
|
|
2193
2480
|
...f ? { visibility: f } : {},
|
|
@@ -2204,28 +2491,28 @@ var Sr = () => {
|
|
|
2204
2491
|
...e.width === void 0 ? {} : { width: e.width },
|
|
2205
2492
|
...e.height === void 0 ? {} : { height: e.height }
|
|
2206
2493
|
}), y = async () => {
|
|
2207
|
-
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"), i =
|
|
2494
|
+
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"), i = J(c, e), l = await Z(s, i({
|
|
2208
2495
|
contentType: u,
|
|
2209
2496
|
..._,
|
|
2210
2497
|
...p ? { key: p } : {}
|
|
2211
|
-
})), d = await
|
|
2498
|
+
})), d = await Ir(m(l.uploadUrl), u, n, o, a);
|
|
2212
2499
|
return v(d);
|
|
2213
2500
|
}, b = async () => {
|
|
2214
2501
|
let e = r.presignMintTag ?? t.presignMintTag ?? $("mintPresignedUpload"), i = r.finalizeTag ?? t.finalizeTag ?? $("finalizeUpload"), l;
|
|
2215
2502
|
try {
|
|
2216
|
-
let t =
|
|
2217
|
-
l = await
|
|
2503
|
+
let t = J(c, e);
|
|
2504
|
+
l = await Z(s, t({
|
|
2218
2505
|
contentType: u,
|
|
2219
2506
|
..._
|
|
2220
2507
|
}));
|
|
2221
2508
|
} catch {
|
|
2222
2509
|
return null;
|
|
2223
2510
|
}
|
|
2224
|
-
await
|
|
2225
|
-
let d =
|
|
2511
|
+
await Fr(l.uploadUrl, u, n, o, a);
|
|
2512
|
+
let d = J(c, i), f = await Z(s, d({ finalizeToken: l.finalizeToken }));
|
|
2226
2513
|
return v(f);
|
|
2227
2514
|
}, x = async () => {
|
|
2228
|
-
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"), i =
|
|
2515
|
+
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"), i = J(c, e), l = n.size, d = r.chunkSize ?? t.chunkSize, f = await Z(s, i({
|
|
2229
2516
|
contentType: u,
|
|
2230
2517
|
size: l,
|
|
2231
2518
|
..._,
|
|
@@ -2236,7 +2523,7 @@ var Sr = () => {
|
|
|
2236
2523
|
for (;;) {
|
|
2237
2524
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2238
2525
|
try {
|
|
2239
|
-
let t = await
|
|
2526
|
+
let t = await Pr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${s ? "&final=1" : ""}`}`, u, i, (e) => o((b + e * c) / l), a, s);
|
|
2240
2527
|
s && (x = t);
|
|
2241
2528
|
break;
|
|
2242
2529
|
} catch (e) {
|
|
@@ -2250,8 +2537,8 @@ var Sr = () => {
|
|
|
2250
2537
|
}, S = async () => {
|
|
2251
2538
|
let e = r.multipartBeginTag ?? t.multipartBeginTag ?? $("beginMultipartUpload"), i = r.multipartSignTag ?? t.multipartSignTag ?? $("signMultipartPart"), l = r.multipartCompleteTag ?? t.multipartCompleteTag ?? $("completeMultipartUpload"), f = r.multipartAbortTag ?? t.multipartAbortTag ?? $("abortMultipartUpload"), p = n.size, h = r.chunkSize ?? t.chunkSize, g;
|
|
2252
2539
|
try {
|
|
2253
|
-
let t =
|
|
2254
|
-
g = await
|
|
2540
|
+
let t = J(c, e);
|
|
2541
|
+
g = await Z(s, t({
|
|
2255
2542
|
contentType: u,
|
|
2256
2543
|
size: p,
|
|
2257
2544
|
..._,
|
|
@@ -2260,31 +2547,31 @@ var Sr = () => {
|
|
|
2260
2547
|
} catch {
|
|
2261
2548
|
return null;
|
|
2262
2549
|
}
|
|
2263
|
-
let v =
|
|
2550
|
+
let v = J(c, i), y = J(c, l), b = J(c, f), x = Math.max(1, g.partSize), S = Math.max(1, Math.ceil(p / x)), C = Math.max(0, r.retries ?? t.retries ?? 1), w = [], T = 0;
|
|
2264
2551
|
try {
|
|
2265
2552
|
for (let e = 0; e < S; e++) {
|
|
2266
2553
|
let t = e * x, r = Math.min(p, t + x), i = n.slice(t, r), c = e + 1, l = r - t, u = 0;
|
|
2267
2554
|
for (;;) {
|
|
2268
2555
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2269
2556
|
try {
|
|
2270
|
-
let { url: e } = await
|
|
2557
|
+
let { url: e } = await Z(s, v({
|
|
2271
2558
|
multipartToken: g.multipartToken,
|
|
2272
2559
|
partNumber: c
|
|
2273
|
-
})), t = await
|
|
2274
|
-
|
|
2560
|
+
})), t = await Nr(e, i, (e) => o((T + e * l) / p), a);
|
|
2561
|
+
w.push({
|
|
2275
2562
|
partNumber: c,
|
|
2276
2563
|
etag: t
|
|
2277
2564
|
});
|
|
2278
2565
|
break;
|
|
2279
2566
|
} catch (e) {
|
|
2280
|
-
if (e instanceof DOMException && e.name === "AbortError" || u++ >=
|
|
2567
|
+
if (e instanceof DOMException && e.name === "AbortError" || u++ >= C) throw e;
|
|
2281
2568
|
}
|
|
2282
2569
|
}
|
|
2283
|
-
|
|
2570
|
+
T += l, o(T / p);
|
|
2284
2571
|
}
|
|
2285
|
-
let e = await
|
|
2572
|
+
let e = await Z(s, y({
|
|
2286
2573
|
multipartToken: g.multipartToken,
|
|
2287
|
-
parts:
|
|
2574
|
+
parts: w
|
|
2288
2575
|
}));
|
|
2289
2576
|
return {
|
|
2290
2577
|
id: e.id,
|
|
@@ -2295,27 +2582,27 @@ var Sr = () => {
|
|
|
2295
2582
|
};
|
|
2296
2583
|
} catch (e) {
|
|
2297
2584
|
try {
|
|
2298
|
-
await
|
|
2585
|
+
await Z(s, b({ multipartToken: g.multipartToken }));
|
|
2299
2586
|
} catch {}
|
|
2300
2587
|
throw e;
|
|
2301
2588
|
}
|
|
2302
2589
|
};
|
|
2303
2590
|
if ((r.prefer ?? t.prefer) === "multipart") return await S() || await x();
|
|
2304
2591
|
if ((r.prefer ?? t.prefer) === "resumable") return await x();
|
|
2305
|
-
let
|
|
2592
|
+
let C = (r.prefer ?? t.prefer) === "presign", w;
|
|
2306
2593
|
for (let e = 0; e <= l; e++) {
|
|
2307
2594
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2308
2595
|
try {
|
|
2309
|
-
if (
|
|
2596
|
+
if (C) {
|
|
2310
2597
|
let e = await b();
|
|
2311
2598
|
if (e) return e;
|
|
2312
2599
|
}
|
|
2313
2600
|
return await y();
|
|
2314
2601
|
} catch (t) {
|
|
2315
|
-
if (t instanceof DOMException && t.name === "AbortError" || (
|
|
2602
|
+
if (t instanceof DOMException && t.name === "AbortError" || (w = t, e === l)) throw t;
|
|
2316
2603
|
}
|
|
2317
2604
|
}
|
|
2318
|
-
throw
|
|
2605
|
+
throw w;
|
|
2319
2606
|
}, [
|
|
2320
2607
|
e,
|
|
2321
2608
|
m,
|
|
@@ -2334,7 +2621,7 @@ var Sr = () => {
|
|
|
2334
2621
|
t.folder,
|
|
2335
2622
|
t.tags,
|
|
2336
2623
|
t.retries
|
|
2337
|
-
]), g =
|
|
2624
|
+
]), g = E(async (e, n = {}) => {
|
|
2338
2625
|
let r = new AbortController();
|
|
2339
2626
|
d.current = r, c("uploading"), u(void 0), o(0);
|
|
2340
2627
|
try {
|
|
@@ -2345,10 +2632,11 @@ var Sr = () => {
|
|
|
2345
2632
|
source: "action",
|
|
2346
2633
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2347
2634
|
error: e,
|
|
2348
|
-
kind:
|
|
2635
|
+
kind: V(e, "unknown"),
|
|
2636
|
+
outcome: V(e, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
2349
2637
|
}), e;
|
|
2350
2638
|
}
|
|
2351
|
-
}, [h, t.mintTag]), _ =
|
|
2639
|
+
}, [h, t.mintTag]), _ = E(async (e, n = {}) => {
|
|
2352
2640
|
if (e.length === 0) return [];
|
|
2353
2641
|
let r = new AbortController();
|
|
2354
2642
|
d.current = r, c("uploading"), u(void 0), o(0);
|
|
@@ -2368,27 +2656,28 @@ var Sr = () => {
|
|
|
2368
2656
|
source: "action",
|
|
2369
2657
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2370
2658
|
error: e,
|
|
2371
|
-
kind:
|
|
2659
|
+
kind: V(e, "unknown"),
|
|
2660
|
+
outcome: V(e, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
2372
2661
|
}), e;
|
|
2373
2662
|
}
|
|
2374
2663
|
}, [
|
|
2375
2664
|
h,
|
|
2376
2665
|
t.concurrency,
|
|
2377
2666
|
t.mintTag
|
|
2378
|
-
]), v =
|
|
2667
|
+
]), v = E((e, t = {}) => {
|
|
2379
2668
|
e.preventDefault();
|
|
2380
2669
|
let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
|
|
2381
2670
|
return n.length ? _(n, t) : Promise.resolve([]);
|
|
2382
|
-
}, [_]), y =
|
|
2671
|
+
}, [_]), y = E((e, t = {}) => {
|
|
2383
2672
|
let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
|
|
2384
2673
|
return n.length ? _(n, t) : Promise.resolve([]);
|
|
2385
|
-
}, [_]), b =
|
|
2674
|
+
}, [_]), b = O(() => ({
|
|
2386
2675
|
onDragOver: (e) => e.preventDefault(),
|
|
2387
2676
|
onDrop: (e) => {
|
|
2388
2677
|
v(e);
|
|
2389
2678
|
}
|
|
2390
2679
|
}), [v]);
|
|
2391
|
-
return
|
|
2680
|
+
return O(() => ({
|
|
2392
2681
|
upload: g,
|
|
2393
2682
|
uploadMany: _,
|
|
2394
2683
|
progress: a,
|
|
@@ -2411,10 +2700,10 @@ var Sr = () => {
|
|
|
2411
2700
|
y,
|
|
2412
2701
|
b
|
|
2413
2702
|
]);
|
|
2414
|
-
},
|
|
2415
|
-
let n =
|
|
2703
|
+
}, Rr = (e, t) => {
|
|
2704
|
+
let n = Lr(e), r = Qn(e, t.action), [i, a] = A("idle"), [o, s] = A(void 0), [c, l] = A(void 0), u = k(t.extra);
|
|
2416
2705
|
u.current = t.extra;
|
|
2417
|
-
let d =
|
|
2706
|
+
let d = E(async (e) => {
|
|
2418
2707
|
l(void 0), s(void 0), a("uploading");
|
|
2419
2708
|
let t;
|
|
2420
2709
|
try {
|
|
@@ -2432,12 +2721,12 @@ var Sr = () => {
|
|
|
2432
2721
|
} catch (e) {
|
|
2433
2722
|
throw a("error"), l(e), e;
|
|
2434
2723
|
}
|
|
2435
|
-
}, [n, r]), f =
|
|
2724
|
+
}, [n, r]), f = E(() => {
|
|
2436
2725
|
n.cancel(), a("idle");
|
|
2437
|
-
}, [n]), p =
|
|
2726
|
+
}, [n]), p = E(() => {
|
|
2438
2727
|
n.reset(), a("idle"), s(void 0), l(void 0);
|
|
2439
2728
|
}, [n]);
|
|
2440
|
-
return
|
|
2729
|
+
return O(() => ({
|
|
2441
2730
|
phase: i,
|
|
2442
2731
|
progress: i === "uploading" ? n.progress : void 0,
|
|
2443
2732
|
result: o,
|
|
@@ -2455,29 +2744,29 @@ var Sr = () => {
|
|
|
2455
2744
|
f,
|
|
2456
2745
|
p
|
|
2457
2746
|
]);
|
|
2458
|
-
},
|
|
2459
|
-
let t =
|
|
2747
|
+
}, zr = async (e) => {
|
|
2748
|
+
let t = J(e.client, e.tag), n = N.currentSpan.pipe(N.tap((t) => N.sync(() => {
|
|
2460
2749
|
ve({
|
|
2461
2750
|
traceId: t.traceId,
|
|
2462
2751
|
spanId: t.spanId,
|
|
2463
2752
|
source: "mutation",
|
|
2464
2753
|
tag: e.tag
|
|
2465
2754
|
});
|
|
2466
|
-
})),
|
|
2755
|
+
})), N.catchAll(() => N.void), N.zipRight(t(e.input)), N.withSpan(`${e.spanPrefix}.${e.tag}`, { attributes: {
|
|
2467
2756
|
"voltro.api": e.apiName,
|
|
2468
2757
|
"rpc.tag": e.tag
|
|
2469
2758
|
} }));
|
|
2470
|
-
return
|
|
2471
|
-
},
|
|
2472
|
-
let n =
|
|
2759
|
+
return Z(e.runtime, n);
|
|
2760
|
+
}, Br = (e, t) => {
|
|
2761
|
+
let n = q(e), { descriptors: r } = n, i = k(n);
|
|
2473
2762
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
2474
2763
|
let n = r[t]?.kind;
|
|
2475
2764
|
n !== void 0 && n !== "workflow" && console.error(`[@voltro/client] useWorkflow('${e}', '${t}') targets a ${n}, not a workflow. Use ${n === "mutation" ? "useMutation" : n === "action" ? "useAction" : `the ${n} hook`} instead.`);
|
|
2476
2765
|
}
|
|
2477
|
-
let [a, o] =
|
|
2766
|
+
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = E(async (n) => {
|
|
2478
2767
|
o(!0), c(void 0);
|
|
2479
2768
|
try {
|
|
2480
|
-
let { runtime: r, client: a } = await
|
|
2769
|
+
let { runtime: r, client: a } = await X(i, e, t), o = await zr({
|
|
2481
2770
|
apiName: e,
|
|
2482
2771
|
runtime: r,
|
|
2483
2772
|
client: a,
|
|
@@ -2491,9 +2780,9 @@ var Sr = () => {
|
|
|
2491
2780
|
} finally {
|
|
2492
2781
|
o(!1);
|
|
2493
2782
|
}
|
|
2494
|
-
}, [e, t]), f =
|
|
2495
|
-
let { runtime: n, client: r } = await
|
|
2496
|
-
await
|
|
2783
|
+
}, [e, t]), f = E(async (t) => {
|
|
2784
|
+
let { runtime: n, client: r } = await X(i, e, "__voltro.workflow.cancel");
|
|
2785
|
+
await zr({
|
|
2497
2786
|
apiName: e,
|
|
2498
2787
|
runtime: n,
|
|
2499
2788
|
client: r,
|
|
@@ -2501,9 +2790,9 @@ var Sr = () => {
|
|
|
2501
2790
|
input: t,
|
|
2502
2791
|
spanPrefix: "client.workflow.cancel"
|
|
2503
2792
|
});
|
|
2504
|
-
}, [e]), p =
|
|
2505
|
-
let { runtime: n, client: r } = await
|
|
2506
|
-
await
|
|
2793
|
+
}, [e]), p = E(async (t) => {
|
|
2794
|
+
let { runtime: n, client: r } = await X(i, e, "__voltro.workflow.resume");
|
|
2795
|
+
await zr({
|
|
2507
2796
|
apiName: e,
|
|
2508
2797
|
runtime: n,
|
|
2509
2798
|
client: r,
|
|
@@ -2511,9 +2800,9 @@ var Sr = () => {
|
|
|
2511
2800
|
input: t,
|
|
2512
2801
|
spanPrefix: "client.workflow.resume"
|
|
2513
2802
|
});
|
|
2514
|
-
}, [e]), m =
|
|
2515
|
-
let { runtime: a, client: o } = await
|
|
2516
|
-
return
|
|
2803
|
+
}, [e]), m = E(async (t, n, r) => {
|
|
2804
|
+
let { runtime: a, client: o } = await X(i, e, "__voltro.workflow.signal");
|
|
2805
|
+
return zr({
|
|
2517
2806
|
apiName: e,
|
|
2518
2807
|
runtime: a,
|
|
2519
2808
|
client: o,
|
|
@@ -2525,9 +2814,9 @@ var Sr = () => {
|
|
|
2525
2814
|
},
|
|
2526
2815
|
spanPrefix: "client.workflow.signal"
|
|
2527
2816
|
});
|
|
2528
|
-
}, [e]), h =
|
|
2529
|
-
let { runtime: o, client: s } = await
|
|
2530
|
-
return
|
|
2817
|
+
}, [e]), h = E(async (t, n, r, a) => {
|
|
2818
|
+
let { runtime: o, client: s } = await X(i, e, "__voltro.workflow.update");
|
|
2819
|
+
return zr({
|
|
2531
2820
|
apiName: e,
|
|
2532
2821
|
runtime: o,
|
|
2533
2822
|
client: s,
|
|
@@ -2541,7 +2830,7 @@ var Sr = () => {
|
|
|
2541
2830
|
spanPrefix: "client.workflow.update"
|
|
2542
2831
|
});
|
|
2543
2832
|
}, [e]);
|
|
2544
|
-
return
|
|
2833
|
+
return O(() => ({
|
|
2545
2834
|
start: d,
|
|
2546
2835
|
cancel: f,
|
|
2547
2836
|
resume: p,
|
|
@@ -2560,13 +2849,13 @@ var Sr = () => {
|
|
|
2560
2849
|
s,
|
|
2561
2850
|
l
|
|
2562
2851
|
]);
|
|
2563
|
-
},
|
|
2564
|
-
let t =
|
|
2852
|
+
}, Vr = (e) => {
|
|
2853
|
+
let t = q(e), n = k(t);
|
|
2565
2854
|
n.current = t;
|
|
2566
|
-
let [r, i] =
|
|
2855
|
+
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = E(async (t, r, a) => {
|
|
2567
2856
|
i(!0), o(void 0);
|
|
2568
2857
|
try {
|
|
2569
|
-
let { runtime: i, client: o } = await
|
|
2858
|
+
let { runtime: i, client: o } = await X(n, e, "__voltro.workflow.signal"), s = await zr({
|
|
2570
2859
|
apiName: e,
|
|
2571
2860
|
runtime: i,
|
|
2572
2861
|
client: o,
|
|
@@ -2585,7 +2874,7 @@ var Sr = () => {
|
|
|
2585
2874
|
i(!1);
|
|
2586
2875
|
}
|
|
2587
2876
|
}, [e]);
|
|
2588
|
-
return
|
|
2877
|
+
return O(() => ({
|
|
2589
2878
|
signal: l,
|
|
2590
2879
|
pending: r,
|
|
2591
2880
|
error: a,
|
|
@@ -2596,13 +2885,13 @@ var Sr = () => {
|
|
|
2596
2885
|
a,
|
|
2597
2886
|
s
|
|
2598
2887
|
]);
|
|
2599
|
-
},
|
|
2600
|
-
let t =
|
|
2888
|
+
}, Hr = (e) => {
|
|
2889
|
+
let t = q(e), n = k(t);
|
|
2601
2890
|
n.current = t;
|
|
2602
|
-
let [r, i] =
|
|
2891
|
+
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = E(async (t, r, a, s) => {
|
|
2603
2892
|
i(!0), o(void 0);
|
|
2604
2893
|
try {
|
|
2605
|
-
let { runtime: i, client: o } = await
|
|
2894
|
+
let { runtime: i, client: o } = await X(n, e, "__voltro.workflow.update"), l = await zr({
|
|
2606
2895
|
apiName: e,
|
|
2607
2896
|
runtime: i,
|
|
2608
2897
|
client: o,
|
|
@@ -2622,7 +2911,7 @@ var Sr = () => {
|
|
|
2622
2911
|
i(!1);
|
|
2623
2912
|
}
|
|
2624
2913
|
}, [e]);
|
|
2625
|
-
return
|
|
2914
|
+
return O(() => ({
|
|
2626
2915
|
update: l,
|
|
2627
2916
|
pending: r,
|
|
2628
2917
|
error: a,
|
|
@@ -2633,8 +2922,8 @@ var Sr = () => {
|
|
|
2633
2922
|
a,
|
|
2634
2923
|
s
|
|
2635
2924
|
]);
|
|
2636
|
-
},
|
|
2637
|
-
let n =
|
|
2925
|
+
}, Ur = (e, t) => {
|
|
2926
|
+
let n = Y(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
|
|
2638
2927
|
return n.loading || n.idle || n.failed ? {
|
|
2639
2928
|
...n,
|
|
2640
2929
|
run: void 0
|
|
@@ -2642,8 +2931,8 @@ var Sr = () => {
|
|
|
2642
2931
|
...n,
|
|
2643
2932
|
run: n.data[0]
|
|
2644
2933
|
};
|
|
2645
|
-
},
|
|
2646
|
-
let r =
|
|
2934
|
+
}, Wr = (e, t = {}, n = {}) => {
|
|
2935
|
+
let r = Y(e, "__voltro.workflow.runs", t, n);
|
|
2647
2936
|
return r.loading || r.idle || r.failed ? {
|
|
2648
2937
|
...r,
|
|
2649
2938
|
runs: []
|
|
@@ -2651,8 +2940,8 @@ var Sr = () => {
|
|
|
2651
2940
|
...r,
|
|
2652
2941
|
runs: r.data
|
|
2653
2942
|
};
|
|
2654
|
-
},
|
|
2655
|
-
let n =
|
|
2943
|
+
}, Gr = (e, t) => {
|
|
2944
|
+
let n = Y(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2656
2945
|
return n.loading || n.idle || n.failed ? {
|
|
2657
2946
|
...n,
|
|
2658
2947
|
steps: []
|
|
@@ -2660,8 +2949,8 @@ var Sr = () => {
|
|
|
2660
2949
|
...n,
|
|
2661
2950
|
steps: n.data
|
|
2662
2951
|
};
|
|
2663
|
-
},
|
|
2664
|
-
let n =
|
|
2952
|
+
}, Kr = (e, t) => {
|
|
2953
|
+
let n = Y(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2665
2954
|
return n.loading || n.idle || n.failed ? {
|
|
2666
2955
|
...n,
|
|
2667
2956
|
events: []
|
|
@@ -2669,8 +2958,8 @@ var Sr = () => {
|
|
|
2669
2958
|
...n,
|
|
2670
2959
|
events: n.data
|
|
2671
2960
|
};
|
|
2672
|
-
},
|
|
2673
|
-
let r =
|
|
2961
|
+
}, qr = Kr, Jr = (e, t = {}, n = {}) => {
|
|
2962
|
+
let r = Y(e, "__voltro.workflow.domainEvents", t, n);
|
|
2674
2963
|
return r.loading || r.idle || r.failed ? {
|
|
2675
2964
|
...r,
|
|
2676
2965
|
events: []
|
|
@@ -2678,8 +2967,8 @@ var Sr = () => {
|
|
|
2678
2967
|
...r,
|
|
2679
2968
|
events: r.data
|
|
2680
2969
|
};
|
|
2681
|
-
},
|
|
2682
|
-
let n =
|
|
2970
|
+
}, Yr = (e, t) => {
|
|
2971
|
+
let n = Y(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
|
|
2683
2972
|
return n.loading || n.idle || n.failed ? {
|
|
2684
2973
|
...n,
|
|
2685
2974
|
deliveries: []
|
|
@@ -2687,42 +2976,42 @@ var Sr = () => {
|
|
|
2687
2976
|
...n,
|
|
2688
2977
|
deliveries: n.data
|
|
2689
2978
|
};
|
|
2690
|
-
},
|
|
2979
|
+
}, Xr = (e, t) => {
|
|
2691
2980
|
let n = e.payload;
|
|
2692
2981
|
if (!n || typeof n != "object") return;
|
|
2693
2982
|
let r = n[t];
|
|
2694
2983
|
return typeof r == "string" ? r : void 0;
|
|
2695
|
-
},
|
|
2984
|
+
}, Zr = (e) => {
|
|
2696
2985
|
let t = e.payload;
|
|
2697
2986
|
if (!t || typeof t != "object") return;
|
|
2698
2987
|
let n = t.updateId;
|
|
2699
2988
|
return typeof n == "string" ? n : void 0;
|
|
2700
|
-
},
|
|
2989
|
+
}, Qr = (e) => {
|
|
2701
2990
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2702
2991
|
for (let r of e) if (r.eventType === "signal-received") {
|
|
2703
|
-
let e =
|
|
2992
|
+
let e = Xr(r, "signalName");
|
|
2704
2993
|
e && t.add(e);
|
|
2705
2994
|
} else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
|
|
2706
|
-
let e =
|
|
2995
|
+
let e = Zr(r);
|
|
2707
2996
|
e && n.add(e);
|
|
2708
2997
|
}
|
|
2709
2998
|
for (let r = e.length - 1; r >= 0; --r) {
|
|
2710
2999
|
let i = e[r];
|
|
2711
3000
|
if (i.eventType === "signal-awaited") {
|
|
2712
|
-
let e =
|
|
3001
|
+
let e = Xr(i, "signalName");
|
|
2713
3002
|
if (e && !t.has(e)) return {
|
|
2714
3003
|
name: e,
|
|
2715
3004
|
kind: "signal"
|
|
2716
3005
|
};
|
|
2717
3006
|
} else if (i.eventType === "update-requested") {
|
|
2718
|
-
let e =
|
|
3007
|
+
let e = Zr(i), t = Xr(i, "updateName");
|
|
2719
3008
|
if (t && (!e || !n.has(e))) return {
|
|
2720
3009
|
name: t,
|
|
2721
3010
|
kind: "update"
|
|
2722
3011
|
};
|
|
2723
3012
|
}
|
|
2724
3013
|
}
|
|
2725
|
-
},
|
|
3014
|
+
}, $r = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), ei = (e, t) => {
|
|
2726
3015
|
if (!e || e.status !== "failed") return;
|
|
2727
3016
|
let n = t.find((e) => e.status === "failed");
|
|
2728
3017
|
return {
|
|
@@ -2730,34 +3019,34 @@ var Sr = () => {
|
|
|
2730
3019
|
message: e.errorMessage,
|
|
2731
3020
|
step: n?.stepName
|
|
2732
3021
|
};
|
|
2733
|
-
},
|
|
2734
|
-
let n =
|
|
3022
|
+
}, ti = (e, t) => {
|
|
3023
|
+
let n = Ur(e, t), r = Gr(e, t), i = Kr(e, t), a = Br(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = E(async () => {
|
|
2735
3024
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
|
|
2736
3025
|
await a.cancel({
|
|
2737
3026
|
workflowName: o.tag,
|
|
2738
3027
|
executionId: o.executionId
|
|
2739
3028
|
});
|
|
2740
|
-
}, [a, o]), u =
|
|
3029
|
+
}, [a, o]), u = E(async () => {
|
|
2741
3030
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot resume");
|
|
2742
3031
|
await a.resume({
|
|
2743
3032
|
workflowName: o.tag,
|
|
2744
3033
|
executionId: o.executionId
|
|
2745
3034
|
});
|
|
2746
|
-
}, [a, o]), d =
|
|
3035
|
+
}, [a, o]), d = E((e, n) => {
|
|
2747
3036
|
if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot signal");
|
|
2748
3037
|
return a.signal({ id: t }, e, n);
|
|
2749
|
-
}, [a, t]), f =
|
|
3038
|
+
}, [a, t]), f = E((e, n, r) => {
|
|
2750
3039
|
if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot update");
|
|
2751
3040
|
return a.update({ id: t }, e, n, r);
|
|
2752
3041
|
}, [a, t]);
|
|
2753
|
-
return
|
|
3042
|
+
return O(() => ({
|
|
2754
3043
|
run: o,
|
|
2755
3044
|
status: o?.status,
|
|
2756
3045
|
steps: s,
|
|
2757
3046
|
events: c,
|
|
2758
|
-
currentStep:
|
|
2759
|
-
waitingFor: o?.status === "suspended" ?
|
|
2760
|
-
error:
|
|
3047
|
+
currentStep: $r(s),
|
|
3048
|
+
waitingFor: o?.status === "suspended" ? Qr(c) : void 0,
|
|
3049
|
+
error: ei(o, s),
|
|
2761
3050
|
traceId: o?.traceId,
|
|
2762
3051
|
loading: n.data === void 0,
|
|
2763
3052
|
cancel: l,
|
|
@@ -2774,24 +3063,24 @@ var Sr = () => {
|
|
|
2774
3063
|
d,
|
|
2775
3064
|
f
|
|
2776
3065
|
]);
|
|
2777
|
-
},
|
|
2778
|
-
let { runtime: n, client: r } =
|
|
3066
|
+
}, ni = (e, t) => {
|
|
3067
|
+
let { runtime: n, client: r } = q(e), [i, a] = A([]), [o, s] = A("idle"), [c, l] = A(void 0), u = k(null), d = E(() => {
|
|
2779
3068
|
let e = u.current;
|
|
2780
|
-
e && (u.current = null, n.runFork(
|
|
3069
|
+
e && (u.current = null, n.runFork(ie.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
|
|
2781
3070
|
}, [n]);
|
|
2782
3071
|
return {
|
|
2783
3072
|
events: i,
|
|
2784
3073
|
status: o,
|
|
2785
3074
|
error: c,
|
|
2786
|
-
start:
|
|
3075
|
+
start: E((e = {}) => {
|
|
2787
3076
|
let i = u.current;
|
|
2788
|
-
i && n.runFork(
|
|
2789
|
-
let o =
|
|
3077
|
+
i && n.runFork(ie.interrupt(i)), a([]), l(void 0), s("streaming");
|
|
3078
|
+
let o = J(r, t)(e), c = z.runForEach(o, (e) => N.sync(() => a((t) => [...t, e]))).pipe(N.matchCause({
|
|
2790
3079
|
onSuccess: () => {
|
|
2791
3080
|
s("done");
|
|
2792
3081
|
},
|
|
2793
3082
|
onFailure: (e) => {
|
|
2794
|
-
|
|
3083
|
+
M.isInterruptedOnly(e) || (l(M.squash(e)), s("error"));
|
|
2795
3084
|
}
|
|
2796
3085
|
}));
|
|
2797
3086
|
u.current = n.runFork(c);
|
|
@@ -2802,8 +3091,8 @@ var Sr = () => {
|
|
|
2802
3091
|
]),
|
|
2803
3092
|
cancel: d
|
|
2804
3093
|
};
|
|
2805
|
-
},
|
|
2806
|
-
let i = 0, a = !1, o = (e) =>
|
|
3094
|
+
}, ri = (e, t, n, r) => {
|
|
3095
|
+
let i = 0, a = !1, o = (e) => N.sync(() => {
|
|
2807
3096
|
e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
|
|
2808
3097
|
}), s = (e) => {
|
|
2809
3098
|
if (typeof e != "object" || !e) return;
|
|
@@ -2811,52 +3100,52 @@ var Sr = () => {
|
|
|
2811
3100
|
if (typeof t == "string" || typeof n == "string") return `${typeof t == "string" ? t : ""}::${typeof n == "string" ? n : ""}`;
|
|
2812
3101
|
}, c, l = (e, t, a) => {
|
|
2813
3102
|
let o = i > t, l = o ? 0 : e + 1, d = a === void 0 ? void 0 : s(a), f = d !== void 0 && d === c && !o;
|
|
2814
|
-
if (c = o ? void 0 : d, f || l > r.maxReconnects) return
|
|
3103
|
+
if (c = o ? void 0 : d, f || l > r.maxReconnects) return N.sync(() => {
|
|
2815
3104
|
n.onError(a ?? /* @__PURE__ */ Error("stream connection lost")), n.onStatus("error");
|
|
2816
3105
|
});
|
|
2817
3106
|
let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, l - 1));
|
|
2818
|
-
return
|
|
3107
|
+
return N.sync(() => {
|
|
2819
3108
|
n.onStatus("reconnecting"), n.onReconnect();
|
|
2820
|
-
}).pipe(
|
|
2821
|
-
}, u = (r) =>
|
|
3109
|
+
}).pipe(N.zipRight(N.sleep(re.millis(p))), N.zipRight(N.sync(() => n.onStatus("streaming"))), N.zipRight(u(l)));
|
|
3110
|
+
}, u = (r) => N.suspend(() => {
|
|
2822
3111
|
let s = i, c = e({
|
|
2823
3112
|
...t,
|
|
2824
3113
|
fromSeq: s
|
|
2825
3114
|
});
|
|
2826
|
-
return z.runForEach(c, o).pipe(
|
|
2827
|
-
onSuccess: () => a ?
|
|
2828
|
-
onFailure: (e) =>
|
|
3115
|
+
return z.runForEach(c, o).pipe(N.matchCauseEffect({
|
|
3116
|
+
onSuccess: () => a ? N.sync(() => n.onStatus("done")) : l(r, s, void 0),
|
|
3117
|
+
onFailure: (e) => M.isInterruptedOnly(e) ? N.void : a ? N.sync(() => n.onStatus("done")) : l(r, s, M.squash(e))
|
|
2829
3118
|
}));
|
|
2830
3119
|
});
|
|
2831
3120
|
return u(0);
|
|
2832
|
-
},
|
|
3121
|
+
}, ii = (e) => {
|
|
2833
3122
|
let t = e?._tag;
|
|
2834
3123
|
return t === "done" || t === "error";
|
|
2835
|
-
},
|
|
2836
|
-
let { runtime: r, client: i } =
|
|
3124
|
+
}, ai = (e, t, n = {}) => {
|
|
3125
|
+
let { runtime: r, client: i } = q(e), [a, o] = A([]), [s, c] = A("idle"), [l, u] = A(0), [d, f] = A(void 0), p = k(null), m = {
|
|
2837
3126
|
maxReconnects: n.maxReconnects ?? 6,
|
|
2838
3127
|
backoffMs: n.backoffMs ?? 400,
|
|
2839
3128
|
maxBackoffMs: n.maxBackoffMs ?? 8e3,
|
|
2840
|
-
isTerminal: n.isTerminal ??
|
|
2841
|
-
}, h =
|
|
3129
|
+
isTerminal: n.isTerminal ?? ii
|
|
3130
|
+
}, h = E(() => {
|
|
2842
3131
|
let e = p.current;
|
|
2843
|
-
e && (p.current = null, r.runFork(
|
|
3132
|
+
e && (p.current = null, r.runFork(ie.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
|
|
2844
3133
|
}, [r]);
|
|
2845
3134
|
return {
|
|
2846
3135
|
events: a,
|
|
2847
3136
|
status: s,
|
|
2848
3137
|
reconnects: l,
|
|
2849
3138
|
error: d,
|
|
2850
|
-
start:
|
|
3139
|
+
start: E((e = {}) => {
|
|
2851
3140
|
let n = p.current;
|
|
2852
|
-
n && r.runFork(
|
|
2853
|
-
let a =
|
|
3141
|
+
n && r.runFork(ie.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
|
|
3142
|
+
let a = J(i, t), s = {
|
|
2854
3143
|
onEvent: (e) => o((t) => [...t, e]),
|
|
2855
3144
|
onStatus: c,
|
|
2856
3145
|
onReconnect: () => u((e) => e + 1),
|
|
2857
3146
|
onError: f
|
|
2858
3147
|
};
|
|
2859
|
-
p.current = r.runFork(
|
|
3148
|
+
p.current = r.runFork(ri(a, e, s, m));
|
|
2860
3149
|
}, [
|
|
2861
3150
|
r,
|
|
2862
3151
|
i,
|
|
@@ -2868,13 +3157,13 @@ var Sr = () => {
|
|
|
2868
3157
|
]),
|
|
2869
3158
|
cancel: h
|
|
2870
3159
|
};
|
|
2871
|
-
},
|
|
3160
|
+
}, oi = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), si = (e) => {
|
|
2872
3161
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
2873
3162
|
let n = e[t];
|
|
2874
3163
|
if (n.role === "user" && n.content) return n.content;
|
|
2875
3164
|
}
|
|
2876
|
-
},
|
|
2877
|
-
let { threadId: r } = n, i =
|
|
3165
|
+
}, ci = (e, t, n) => {
|
|
3166
|
+
let { threadId: r } = n, i = Y(e, `${t}.messages`, { threadId: r }), a = Qn(e, `${t}.send`), o = O(() => [...i.data ?? []].sort(oi), [i.data]), s = E((e, t = {}) => a.run({
|
|
2878
3167
|
threadId: r,
|
|
2879
3168
|
order: i.data?.length ?? 0,
|
|
2880
3169
|
prompt: e,
|
|
@@ -2883,11 +3172,11 @@ var Sr = () => {
|
|
|
2883
3172
|
a,
|
|
2884
3173
|
r,
|
|
2885
3174
|
i.data
|
|
2886
|
-
]), c =
|
|
2887
|
-
let e =
|
|
3175
|
+
]), c = E(() => {
|
|
3176
|
+
let e = si(o);
|
|
2888
3177
|
return e === void 0 ? void 0 : s(e);
|
|
2889
3178
|
}, [o, s]);
|
|
2890
|
-
return
|
|
3179
|
+
return O(() => ({
|
|
2891
3180
|
messages: o,
|
|
2892
3181
|
streaming: o.some((e) => e.streaming),
|
|
2893
3182
|
loading: i.data === void 0,
|
|
@@ -2904,9 +3193,9 @@ var Sr = () => {
|
|
|
2904
3193
|
s,
|
|
2905
3194
|
c
|
|
2906
3195
|
]);
|
|
2907
|
-
},
|
|
2908
|
-
let { events: n, status: r, error: i, start: a, cancel: o } =
|
|
2909
|
-
return
|
|
3196
|
+
}, li = (e, t) => {
|
|
3197
|
+
let { events: n, status: r, error: i, start: a, cancel: o } = ni(e, t), [s, c] = A([]), l = k(null), u = O(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
|
|
3198
|
+
return D(() => {
|
|
2910
3199
|
if (r !== "done" || l.current === null) return;
|
|
2911
3200
|
let e = l.current;
|
|
2912
3201
|
l.current = null, c((t) => [
|
|
@@ -2925,18 +3214,18 @@ var Sr = () => {
|
|
|
2925
3214
|
history: s,
|
|
2926
3215
|
status: r,
|
|
2927
3216
|
error: i,
|
|
2928
|
-
send:
|
|
3217
|
+
send: E((e = {}) => {
|
|
2929
3218
|
let t = e.message;
|
|
2930
3219
|
l.current = typeof t == "string" ? t : "", a(e);
|
|
2931
3220
|
}, [a]),
|
|
2932
3221
|
cancel: o
|
|
2933
3222
|
};
|
|
2934
|
-
},
|
|
2935
|
-
let n =
|
|
3223
|
+
}, ui = (e, t) => {
|
|
3224
|
+
let n = Qn(e, t), [r, i] = A(void 0), a = E(async (e) => {
|
|
2936
3225
|
let t = await n.run({ question: e });
|
|
2937
3226
|
return i(t), t;
|
|
2938
|
-
}, [n]), o =
|
|
2939
|
-
return
|
|
3227
|
+
}, [n]), o = E(() => i(void 0), []);
|
|
3228
|
+
return O(() => ({
|
|
2940
3229
|
ask: a,
|
|
2941
3230
|
answer: r,
|
|
2942
3231
|
pending: n.pending,
|
|
@@ -2949,14 +3238,14 @@ var Sr = () => {
|
|
|
2949
3238
|
n.error,
|
|
2950
3239
|
o
|
|
2951
3240
|
]);
|
|
2952
|
-
},
|
|
2953
|
-
let { cache: t, runtime: n } =
|
|
2954
|
-
return
|
|
3241
|
+
}, di = (e) => {
|
|
3242
|
+
let { cache: t, runtime: n } = q(e);
|
|
3243
|
+
return E(() => {
|
|
2955
3244
|
t.refreshAll(n);
|
|
2956
3245
|
}, [t, n]);
|
|
2957
|
-
},
|
|
3246
|
+
}, fi = (e) => e?._tag === "Unauthenticated", pi = (e, t, n = {}) => {
|
|
2958
3247
|
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
2959
|
-
if (!
|
|
3248
|
+
if (!fi(e.error) || s >= i) return;
|
|
2960
3249
|
let n = a();
|
|
2961
3250
|
n - o < r || (o = n, s += 1, t());
|
|
2962
3251
|
}), l = e.onSuccess(() => {
|
|
@@ -2970,18 +3259,21 @@ var Sr = () => {
|
|
|
2970
3259
|
s = 0;
|
|
2971
3260
|
}
|
|
2972
3261
|
};
|
|
2973
|
-
},
|
|
2974
|
-
let
|
|
2975
|
-
|
|
2976
|
-
},
|
|
3262
|
+
}, mi = (e, t) => {
|
|
3263
|
+
let n = q(e), r = n.recovery ?? ct(n.errorBus, e), i = k(t);
|
|
3264
|
+
i.current = t, D(() => r.onVisibleError((e) => i.current(e)), [r]);
|
|
3265
|
+
}, hi = (e, t) => {
|
|
3266
|
+
let { errorBus: n } = q(e), r = k(t);
|
|
3267
|
+
r.current = t, D(() => n.on((e) => r.current(e)), [n]);
|
|
3268
|
+
}, gi = {
|
|
2977
3269
|
failed: [],
|
|
2978
3270
|
healthy: !0
|
|
2979
|
-
},
|
|
2980
|
-
let { errorBus: t } =
|
|
2981
|
-
return
|
|
3271
|
+
}, _i = (e) => {
|
|
3272
|
+
let { errorBus: t } = q(e), [n, r] = A(gi);
|
|
3273
|
+
return D(() => {
|
|
2982
3274
|
let e = /* @__PURE__ */ new Map(), n = () => {
|
|
2983
3275
|
let t = [...e.values()].sort((e, t) => t.at - e.at);
|
|
2984
|
-
r(t.length === 0 ?
|
|
3276
|
+
r(t.length === 0 ? gi : {
|
|
2985
3277
|
failed: t,
|
|
2986
3278
|
healthy: !1
|
|
2987
3279
|
});
|
|
@@ -2999,17 +3291,17 @@ var Sr = () => {
|
|
|
2999
3291
|
i(), a();
|
|
3000
3292
|
};
|
|
3001
3293
|
}, [t]), n;
|
|
3002
|
-
},
|
|
3294
|
+
}, vi = (e, t) => {
|
|
3003
3295
|
let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
|
|
3004
3296
|
if (i) return i;
|
|
3005
|
-
let a =
|
|
3297
|
+
let a = w(t);
|
|
3006
3298
|
return n[r] = a, a;
|
|
3007
|
-
},
|
|
3299
|
+
}, yi = vi("serverRequest", null), bi = () => ee(yi), xi = ({ value: e, children: t }) => /* @__PURE__ */ pe(yi.Provider, {
|
|
3008
3300
|
value: e,
|
|
3009
3301
|
children: t
|
|
3010
|
-
}),
|
|
3011
|
-
let t =
|
|
3012
|
-
return
|
|
3302
|
+
}), Si = (e) => {
|
|
3303
|
+
let t = bi();
|
|
3304
|
+
return O(() => {
|
|
3013
3305
|
if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
|
|
3014
3306
|
if (typeof document > "u") return;
|
|
3015
3307
|
let n = document.getElementById(v);
|
|
@@ -3020,15 +3312,15 @@ var Sr = () => {
|
|
|
3020
3312
|
return;
|
|
3021
3313
|
}
|
|
3022
3314
|
}, [t, e]);
|
|
3023
|
-
},
|
|
3315
|
+
}, Ci = (e, t, n) => e.map((e) => {
|
|
3024
3316
|
let r = String(e[n] ?? ""), i = e[t];
|
|
3025
3317
|
return {
|
|
3026
3318
|
value: r,
|
|
3027
3319
|
label: i == null ? r : String(i)
|
|
3028
3320
|
};
|
|
3029
|
-
}),
|
|
3030
|
-
let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] =
|
|
3031
|
-
|
|
3321
|
+
}), wi = (e, t, n = {}) => {
|
|
3322
|
+
let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = A(n.initialTerm ?? ""), [l, u] = A(s);
|
|
3323
|
+
D(() => {
|
|
3032
3324
|
if (s === l) return;
|
|
3033
3325
|
let e = setTimeout(() => u(s), r);
|
|
3034
3326
|
return () => clearTimeout(e);
|
|
@@ -3037,24 +3329,24 @@ var Sr = () => {
|
|
|
3037
3329
|
l,
|
|
3038
3330
|
r
|
|
3039
3331
|
]);
|
|
3040
|
-
let d = n.skipUntilTerm === !0 && l.trim() === "", f =
|
|
3332
|
+
let d = n.skipUntilTerm === !0 && l.trim() === "", f = Y(e, t, O(() => o(l), [o, l]), { skip: d }), p = O(() => Ci(f.data ?? [], i, a), [
|
|
3041
3333
|
f.data,
|
|
3042
3334
|
i,
|
|
3043
3335
|
a
|
|
3044
|
-
]), m =
|
|
3336
|
+
]), m = E((e) => c(e), []);
|
|
3045
3337
|
return {
|
|
3046
3338
|
options: p,
|
|
3047
3339
|
loading: !d && f.data === void 0,
|
|
3048
3340
|
term: s,
|
|
3049
3341
|
search: m
|
|
3050
3342
|
};
|
|
3051
|
-
},
|
|
3052
|
-
let i =
|
|
3343
|
+
}, Ti = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Ei = (t, n, r = {}) => {
|
|
3344
|
+
let i = q(t), [a, o] = A(r.pageSize), s = Y(t, n, O(() => a === void 0 ? r.input ?? {} : {
|
|
3053
3345
|
...r.input,
|
|
3054
3346
|
limit: a
|
|
3055
|
-
}, [r.input, a])), c = i.descriptors[n]?.output, l =
|
|
3347
|
+
}, [r.input, a])), c = i.descriptors[n]?.output, l = E(() => {
|
|
3056
3348
|
r.pageSize !== void 0 && o((e) => (e ?? r.pageSize) + r.pageSize);
|
|
3057
|
-
}, [r.pageSize]), u =
|
|
3349
|
+
}, [r.pageSize]), u = O(() => r.columns ?? (c === void 0 ? [] : e(c)), [r.columns, c]), [d, f] = A(r.initialSort), p = E((e) => {
|
|
3058
3350
|
f((t) => t?.column === e ? {
|
|
3059
3351
|
column: e,
|
|
3060
3352
|
direction: t.direction === "asc" ? "desc" : "asc"
|
|
@@ -3065,11 +3357,11 @@ var Sr = () => {
|
|
|
3065
3357
|
}, []);
|
|
3066
3358
|
return {
|
|
3067
3359
|
columns: u,
|
|
3068
|
-
rows:
|
|
3360
|
+
rows: O(() => {
|
|
3069
3361
|
let e = s.data ?? [];
|
|
3070
3362
|
if (d === void 0) return e;
|
|
3071
3363
|
let t = d.direction === "asc" ? 1 : -1;
|
|
3072
|
-
return [...e].sort((e, n) =>
|
|
3364
|
+
return [...e].sort((e, n) => Ti(e[d.column], n[d.column]) * t);
|
|
3073
3365
|
}, [s.data, d]),
|
|
3074
3366
|
loading: s.data === void 0,
|
|
3075
3367
|
error: s.error,
|
|
@@ -3078,26 +3370,26 @@ var Sr = () => {
|
|
|
3078
3370
|
loadMore: l,
|
|
3079
3371
|
hasMore: a !== void 0 && (s.data?.length ?? 0) >= a
|
|
3080
3372
|
};
|
|
3081
|
-
},
|
|
3373
|
+
}, Di = (e, t, n, r) => {
|
|
3082
3374
|
let i = e.replace(/\/$/, ""), a = new URLSearchParams({
|
|
3083
3375
|
table: t,
|
|
3084
3376
|
id: n
|
|
3085
3377
|
});
|
|
3086
3378
|
return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
|
|
3087
|
-
},
|
|
3088
|
-
let { inspectBaseUrl: i } =
|
|
3379
|
+
}, Oi = Di, ki = (e, t, n, r) => {
|
|
3380
|
+
let { inspectBaseUrl: i } = q(e), [a, o] = A({
|
|
3089
3381
|
data: void 0,
|
|
3090
3382
|
loading: !0,
|
|
3091
3383
|
error: void 0
|
|
3092
3384
|
});
|
|
3093
|
-
return
|
|
3385
|
+
return D(() => {
|
|
3094
3386
|
let e = !1;
|
|
3095
3387
|
o({
|
|
3096
3388
|
data: void 0,
|
|
3097
3389
|
loading: !0,
|
|
3098
3390
|
error: void 0
|
|
3099
3391
|
});
|
|
3100
|
-
let a =
|
|
3392
|
+
let a = Di(i ?? "", t, n, r);
|
|
3101
3393
|
return fetch(a).then(async (e) => {
|
|
3102
3394
|
if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
|
|
3103
3395
|
return await e.json();
|
|
@@ -3123,23 +3415,23 @@ var Sr = () => {
|
|
|
3123
3415
|
n,
|
|
3124
3416
|
r
|
|
3125
3417
|
]), a;
|
|
3126
|
-
},
|
|
3127
|
-
function
|
|
3128
|
-
return
|
|
3418
|
+
}, Ai = "admin:full", ji = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Mi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), Ni = w({ scopes: [] });
|
|
3419
|
+
function Pi(e) {
|
|
3420
|
+
return T(Ni.Provider, { value: { scopes: e.scopes } }, e.children);
|
|
3129
3421
|
}
|
|
3130
|
-
var
|
|
3131
|
-
let { inspectBaseUrl: t } =
|
|
3422
|
+
var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scopes, e), Ri = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, zi = (e) => {
|
|
3423
|
+
let { inspectBaseUrl: t } = q(e), [n, r] = A({
|
|
3132
3424
|
manifest: void 0,
|
|
3133
3425
|
loading: !0,
|
|
3134
3426
|
error: void 0
|
|
3135
3427
|
});
|
|
3136
|
-
return
|
|
3428
|
+
return D(() => {
|
|
3137
3429
|
let e = !1;
|
|
3138
3430
|
return r({
|
|
3139
3431
|
manifest: void 0,
|
|
3140
3432
|
loading: !0,
|
|
3141
3433
|
error: void 0
|
|
3142
|
-
}), fetch(
|
|
3434
|
+
}), fetch(Ri(t ?? "")).then(async (e) => {
|
|
3143
3435
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
3144
3436
|
return await e.json();
|
|
3145
3437
|
}).then((t) => {
|
|
@@ -3158,7 +3450,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3158
3450
|
e = !0;
|
|
3159
3451
|
};
|
|
3160
3452
|
}, [e, t]), n;
|
|
3161
|
-
},
|
|
3453
|
+
}, Bi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), Vi = (e, t) => {
|
|
3162
3454
|
if (e === void 0) return "unknown";
|
|
3163
3455
|
if (t.includes("admin:full") || e.length === 0) return "allowed";
|
|
3164
3456
|
let n = !1;
|
|
@@ -3167,7 +3459,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3167
3459
|
n = !0;
|
|
3168
3460
|
continue;
|
|
3169
3461
|
}
|
|
3170
|
-
if (!
|
|
3462
|
+
if (!Bi(t, r)) {
|
|
3171
3463
|
if (r.resourceScoped) {
|
|
3172
3464
|
n = !0;
|
|
3173
3465
|
continue;
|
|
@@ -3176,13 +3468,13 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3176
3468
|
}
|
|
3177
3469
|
}
|
|
3178
3470
|
return n ? "unknown" : "allowed";
|
|
3179
|
-
},
|
|
3471
|
+
}, Hi = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), Ui = (e) => {
|
|
3180
3472
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
3181
|
-
},
|
|
3473
|
+
}, Wi = (e) => Vi(e, Fi().scopes), Gi = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, Ki = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, qi = (e) => e === void 0 ? {} : {
|
|
3182
3474
|
tag: e.tag,
|
|
3183
3475
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
3184
|
-
},
|
|
3185
|
-
let n = e.procedures.find((e) => e.kind === "query" &&
|
|
3476
|
+
}, Ji = (e) => e.tables.filter((e) => !e.framework).map((t) => {
|
|
3477
|
+
let n = e.procedures.find((e) => e.kind === "query" && Gi(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && Ki(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && Ki(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && Ki(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
|
|
3186
3478
|
return {
|
|
3187
3479
|
table: t.name,
|
|
3188
3480
|
columns: t.columns.filter((e) => e.serverOnly !== !0),
|
|
@@ -3191,22 +3483,22 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3191
3483
|
reactive: t.reactive,
|
|
3192
3484
|
...o === void 0 ? {} : { pkColumn: o },
|
|
3193
3485
|
editable: (t.editable ?? !0) && o !== void 0,
|
|
3194
|
-
list:
|
|
3195
|
-
create:
|
|
3196
|
-
update:
|
|
3197
|
-
delete:
|
|
3486
|
+
list: qi(n),
|
|
3487
|
+
create: qi(r),
|
|
3488
|
+
update: qi(i),
|
|
3489
|
+
delete: qi(a)
|
|
3198
3490
|
};
|
|
3199
|
-
}),
|
|
3200
|
-
let [t, n] =
|
|
3491
|
+
}), Yi = (e) => {
|
|
3492
|
+
let [t, n] = A([]), [r, i] = A([]), a = E((e) => {
|
|
3201
3493
|
n((t) => [...t, e]), i([]);
|
|
3202
|
-
}, []), o =
|
|
3494
|
+
}, []), o = E(async () => {
|
|
3203
3495
|
let r = t[t.length - 1];
|
|
3204
3496
|
r !== void 0 && r.blockedBy === void 0 && (await e.onUndo(r.invocationId), n((e) => e.slice(0, -1)), i((e) => [...e, r]));
|
|
3205
|
-
}, [t, e]), s =
|
|
3497
|
+
}, [t, e]), s = E(async () => {
|
|
3206
3498
|
let t = r[r.length - 1];
|
|
3207
3499
|
t !== void 0 && (await e.onRedo(t.invocationId), i((e) => e.slice(0, -1)), n((e) => [...e, t]));
|
|
3208
3500
|
}, [r, e]);
|
|
3209
|
-
return
|
|
3501
|
+
return O(() => {
|
|
3210
3502
|
let e = t[t.length - 1];
|
|
3211
3503
|
return {
|
|
3212
3504
|
record: a,
|
|
@@ -3224,14 +3516,14 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3224
3516
|
o,
|
|
3225
3517
|
s
|
|
3226
3518
|
]);
|
|
3227
|
-
},
|
|
3228
|
-
let n = t?.limit, { data: r } =
|
|
3519
|
+
}, Xi = "__voltro.undo.log", Zi = "__voltro.undo.apply", Qi = "__voltro.undo.redo", $i = (e, t) => {
|
|
3520
|
+
let n = t?.limit, { data: r } = Y(e, Xi, n === void 0 ? {} : { limit: n }), i = qn(e, Zi), a = qn(e, Qi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = E(async (e) => {
|
|
3229
3521
|
await i.mutate({ invocationId: e });
|
|
3230
|
-
}, [i]), u =
|
|
3522
|
+
}, [i]), u = E(async (e) => {
|
|
3231
3523
|
await a.mutate({ invocationId: e });
|
|
3232
|
-
}, [a]), d =
|
|
3524
|
+
}, [a]), d = E(async () => {
|
|
3233
3525
|
s && await l(s.id);
|
|
3234
|
-
}, [s, l]), f =
|
|
3526
|
+
}, [s, l]), f = E(async () => {
|
|
3235
3527
|
c && await u(c.id);
|
|
3236
3528
|
}, [c, u]);
|
|
3237
3529
|
return {
|
|
@@ -3244,22 +3536,22 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3244
3536
|
undoLast: d,
|
|
3245
3537
|
redoLast: f
|
|
3246
3538
|
};
|
|
3247
|
-
},
|
|
3539
|
+
}, ea = (e, t) => ({
|
|
3248
3540
|
name: e,
|
|
3249
3541
|
map: t
|
|
3250
|
-
}),
|
|
3542
|
+
}), ta = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), na = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), ra = (e, t, n) => {
|
|
3251
3543
|
let r = { ...t };
|
|
3252
3544
|
for (let [i, a] of Object.entries(e.map)) {
|
|
3253
|
-
if (
|
|
3545
|
+
if (na.has(i) || a === void 0) continue;
|
|
3254
3546
|
let e = t[i];
|
|
3255
3547
|
r[i] = (...r) => {
|
|
3256
|
-
let i =
|
|
3548
|
+
let i = ta(a, t);
|
|
3257
3549
|
if (i !== null && n(i), typeof e == "function") return e(...r);
|
|
3258
3550
|
};
|
|
3259
3551
|
}
|
|
3260
3552
|
return r;
|
|
3261
|
-
},
|
|
3262
|
-
let r =
|
|
3553
|
+
}, ia = (e, t, n) => {
|
|
3554
|
+
let r = k({
|
|
3263
3555
|
spec: e,
|
|
3264
3556
|
props: t,
|
|
3265
3557
|
sink: n
|
|
@@ -3268,47 +3560,47 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3268
3560
|
spec: e,
|
|
3269
3561
|
props: t,
|
|
3270
3562
|
sink: n
|
|
3271
|
-
},
|
|
3272
|
-
let e = r.current, t =
|
|
3563
|
+
}, D(() => {
|
|
3564
|
+
let e = r.current, t = ta(e.spec.map.onMount, e.props);
|
|
3273
3565
|
return t !== null && e.sink(t), () => {
|
|
3274
|
-
let e = r.current, t =
|
|
3566
|
+
let e = r.current, t = ta(e.spec.map.onUnmount, e.props);
|
|
3275
3567
|
t !== null && e.sink(t);
|
|
3276
3568
|
};
|
|
3277
|
-
}, []),
|
|
3569
|
+
}, []), O(() => ra(e, t, n), [
|
|
3278
3570
|
e,
|
|
3279
3571
|
t,
|
|
3280
3572
|
n
|
|
3281
3573
|
]);
|
|
3282
|
-
},
|
|
3283
|
-
let n =
|
|
3284
|
-
return
|
|
3285
|
-
},
|
|
3286
|
-
let r =
|
|
3287
|
-
return
|
|
3288
|
-
},
|
|
3574
|
+
}, aa = (e, t) => {
|
|
3575
|
+
let n = q(e).descriptors[t]?.input;
|
|
3576
|
+
return O(() => n === void 0 ? [] : x(n), [n]);
|
|
3577
|
+
}, oa = (t, n) => {
|
|
3578
|
+
let r = q(t).descriptors[n]?.output;
|
|
3579
|
+
return O(() => r === void 0 ? [] : e(r), [r]);
|
|
3580
|
+
}, sa = (e, t) => {
|
|
3289
3581
|
if (e === t) return !0;
|
|
3290
3582
|
if (e.length !== t.length) return !1;
|
|
3291
3583
|
for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
|
|
3292
3584
|
return !0;
|
|
3293
|
-
},
|
|
3294
|
-
let n =
|
|
3295
|
-
return (n.current === null ||
|
|
3585
|
+
}, ca = (e) => Object.keys(e).sort().map((t) => e[t]), la = (e, t) => {
|
|
3586
|
+
let n = k(null), r = ca(e);
|
|
3587
|
+
return (n.current === null || !sa(n.current.key, r)) && (n.current = {
|
|
3296
3588
|
key: r,
|
|
3297
3589
|
value: t(e)
|
|
3298
3590
|
}), n.current.value;
|
|
3299
|
-
},
|
|
3300
|
-
let i =
|
|
3301
|
-
return
|
|
3591
|
+
}, ua = (e, t, n, r = {}) => {
|
|
3592
|
+
let i = Y(e, t, { ...n }, r);
|
|
3593
|
+
return O(() => ({
|
|
3302
3594
|
allowed: i.data?.allowed === !0,
|
|
3303
3595
|
pending: i.data === void 0
|
|
3304
3596
|
}), [i.data]);
|
|
3305
|
-
},
|
|
3306
|
-
let i =
|
|
3307
|
-
return
|
|
3597
|
+
}, da = (e, t, n, r = {}) => {
|
|
3598
|
+
let i = Y(e, t, { ...n }, r);
|
|
3599
|
+
return O(() => ({
|
|
3308
3600
|
allowedIds: new Set(i.data?.allowedIds ?? []),
|
|
3309
3601
|
pending: i.data === void 0
|
|
3310
3602
|
}), [i.data]);
|
|
3311
|
-
},
|
|
3603
|
+
}, fa = (e) => {
|
|
3312
3604
|
switch (e) {
|
|
3313
3605
|
case "select":
|
|
3314
3606
|
case "radio":
|
|
@@ -3324,26 +3616,26 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3324
3616
|
case "switch": return "boolean";
|
|
3325
3617
|
default: return null;
|
|
3326
3618
|
}
|
|
3327
|
-
},
|
|
3619
|
+
}, pa = (e) => x(e).map((e) => {
|
|
3328
3620
|
if (e.name.includes(".")) return null;
|
|
3329
|
-
let t =
|
|
3621
|
+
let t = fa(e.widget);
|
|
3330
3622
|
return t === null ? null : {
|
|
3331
3623
|
name: e.name,
|
|
3332
3624
|
label: e.label,
|
|
3333
3625
|
kind: t,
|
|
3334
3626
|
...e.options ? { options: e.options } : {}
|
|
3335
3627
|
};
|
|
3336
|
-
}).filter((e) => e !== null),
|
|
3628
|
+
}).filter((e) => e !== null), ma = (e) => {
|
|
3337
3629
|
let t = {};
|
|
3338
3630
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
3339
3631
|
return t;
|
|
3340
|
-
},
|
|
3341
|
-
let r =
|
|
3342
|
-
o((n) =>
|
|
3632
|
+
}, ha = (e, t, n = {}) => {
|
|
3633
|
+
let r = q(e).descriptors[t]?.input, i = O(() => r === void 0 ? [] : pa(r), [r]), [a, o] = A(n.initial ?? {}), s = E((e, t) => {
|
|
3634
|
+
o((n) => ma({
|
|
3343
3635
|
...n,
|
|
3344
3636
|
[e]: t
|
|
3345
3637
|
}));
|
|
3346
|
-
}, []), c =
|
|
3638
|
+
}, []), c = E(() => o({}), []), l = Y(e, t, O(() => ma(a), [a]));
|
|
3347
3639
|
return {
|
|
3348
3640
|
filters: i,
|
|
3349
3641
|
values: a,
|
|
@@ -3354,20 +3646,20 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3354
3646
|
loading: l.data === void 0,
|
|
3355
3647
|
error: l.error
|
|
3356
3648
|
};
|
|
3357
|
-
},
|
|
3358
|
-
let r =
|
|
3649
|
+
}, ga = (e, t, n = {}) => {
|
|
3650
|
+
let r = Y(e, t, n), i = r.data;
|
|
3359
3651
|
return {
|
|
3360
3652
|
record: Array.isArray(i) ? i[0] : i,
|
|
3361
3653
|
loading: i === void 0,
|
|
3362
3654
|
error: r.error
|
|
3363
3655
|
};
|
|
3364
|
-
},
|
|
3365
|
-
let [n, r] =
|
|
3366
|
-
return
|
|
3656
|
+
}, _a = (e, t = 300) => {
|
|
3657
|
+
let [n, r] = A(e);
|
|
3658
|
+
return D(() => {
|
|
3367
3659
|
let n = setTimeout(() => r(e), t);
|
|
3368
3660
|
return () => clearTimeout(n);
|
|
3369
3661
|
}, [e, t]), n;
|
|
3370
|
-
},
|
|
3662
|
+
}, va = (e) => {
|
|
3371
3663
|
let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
|
|
3372
3664
|
if (a && t.trim() === "") return {
|
|
3373
3665
|
status: "idle",
|
|
@@ -3385,19 +3677,19 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3385
3677
|
valid: o.valid,
|
|
3386
3678
|
message: o.message
|
|
3387
3679
|
};
|
|
3388
|
-
},
|
|
3389
|
-
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c =
|
|
3390
|
-
return
|
|
3680
|
+
}, ya = (e, t, n, r) => {
|
|
3681
|
+
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = _a(n, o), l = s && c.trim() === "", u = Y(e, t, O(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
|
|
3682
|
+
return va({
|
|
3391
3683
|
value: n,
|
|
3392
3684
|
debouncedValue: c,
|
|
3393
3685
|
data: l ? null : u.data,
|
|
3394
3686
|
interpret: a,
|
|
3395
3687
|
skipEmpty: s
|
|
3396
3688
|
});
|
|
3397
|
-
},
|
|
3689
|
+
}, ba = (e, t) => ({
|
|
3398
3690
|
name: e,
|
|
3399
3691
|
payload: t
|
|
3400
|
-
}),
|
|
3692
|
+
}), xa = (e, t) => {
|
|
3401
3693
|
let n = ae.decodeUnknownEither(e.payload, { errors: "all" })(t);
|
|
3402
3694
|
if (n._tag === "Right") return {
|
|
3403
3695
|
valid: !0,
|
|
@@ -3409,15 +3701,15 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3409
3701
|
valid: !1,
|
|
3410
3702
|
errors: r
|
|
3411
3703
|
};
|
|
3412
|
-
},
|
|
3704
|
+
}, Sa = (e) => {
|
|
3413
3705
|
let t = new Map(e.map((e) => [e.name, e]));
|
|
3414
3706
|
return {
|
|
3415
3707
|
names: [...t.keys()].sort(),
|
|
3416
3708
|
get: (e) => t.get(e),
|
|
3417
3709
|
events: e
|
|
3418
3710
|
};
|
|
3419
|
-
},
|
|
3420
|
-
let n =
|
|
3711
|
+
}, Ca = (e, t) => {
|
|
3712
|
+
let n = Sa(e);
|
|
3421
3713
|
return {
|
|
3422
3714
|
track: (e, r) => {
|
|
3423
3715
|
let i = n.get(e);
|
|
@@ -3426,7 +3718,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3426
3718
|
return;
|
|
3427
3719
|
}
|
|
3428
3720
|
if (process.env.NODE_ENV !== "production") {
|
|
3429
|
-
let t =
|
|
3721
|
+
let t = xa(i, r);
|
|
3430
3722
|
t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
|
|
3431
3723
|
}
|
|
3432
3724
|
t({
|
|
@@ -3437,49 +3729,49 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3437
3729
|
names: n.names,
|
|
3438
3730
|
catalog: n
|
|
3439
3731
|
};
|
|
3440
|
-
},
|
|
3441
|
-
let n =
|
|
3732
|
+
}, wa = (e, t) => {
|
|
3733
|
+
let n = Qn(e, t);
|
|
3442
3734
|
return {
|
|
3443
|
-
preview:
|
|
3735
|
+
preview: E((e) => n.run(e), [n]),
|
|
3444
3736
|
diff: n.lastResult,
|
|
3445
3737
|
pending: n.pending,
|
|
3446
3738
|
error: n.error
|
|
3447
3739
|
};
|
|
3448
|
-
},
|
|
3740
|
+
}, Ta = (e, t, n, r) => [...e, {
|
|
3449
3741
|
id: t,
|
|
3450
3742
|
tag: n,
|
|
3451
3743
|
input: r,
|
|
3452
3744
|
status: "pending",
|
|
3453
3745
|
attempts: 0
|
|
3454
|
-
}],
|
|
3746
|
+
}], Ea = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3455
3747
|
...e,
|
|
3456
3748
|
...n
|
|
3457
|
-
} : e),
|
|
3749
|
+
} : e), Da = (e, t) => Ea(e, t, { status: "sent" }), Oa = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3458
3750
|
...e,
|
|
3459
3751
|
status: "failed",
|
|
3460
3752
|
error: n,
|
|
3461
3753
|
attempts: e.attempts + 1
|
|
3462
|
-
} : e),
|
|
3754
|
+
} : e), ka = (e, t, n) => Ea(e, t, {
|
|
3463
3755
|
status: "conflict",
|
|
3464
3756
|
error: n
|
|
3465
|
-
}),
|
|
3757
|
+
}), Aa = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
|
|
3466
3758
|
...e,
|
|
3467
3759
|
input: n,
|
|
3468
3760
|
status: "pending",
|
|
3469
3761
|
error: void 0
|
|
3470
|
-
} : e),
|
|
3762
|
+
} : e), ja = (e) => e.filter((e) => e.status !== "sent"), Ma = (e) => {
|
|
3471
3763
|
let t = [];
|
|
3472
3764
|
for (let n of e) {
|
|
3473
3765
|
if (n.status === "conflict") break;
|
|
3474
3766
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
3475
3767
|
}
|
|
3476
3768
|
return t;
|
|
3477
|
-
},
|
|
3769
|
+
}, Na = (e) => {
|
|
3478
3770
|
let t = e;
|
|
3479
3771
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
3480
|
-
},
|
|
3481
|
-
let [t, n] =
|
|
3482
|
-
return
|
|
3772
|
+
}, Pa = (e) => {
|
|
3773
|
+
let [t, n] = A(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
|
|
3774
|
+
return D(() => {
|
|
3483
3775
|
if (e !== void 0) {
|
|
3484
3776
|
n(e);
|
|
3485
3777
|
return;
|
|
@@ -3490,11 +3782,11 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3490
3782
|
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
3491
3783
|
};
|
|
3492
3784
|
}, [e]), t;
|
|
3493
|
-
},
|
|
3494
|
-
let { send: t, persistence: n, isConflict: r =
|
|
3785
|
+
}, Fa = (e) => {
|
|
3786
|
+
let { send: t, persistence: n, isConflict: r = Na, idFor: i } = e, [a, o] = A([]), s = Pa(e.online), c = k(a);
|
|
3495
3787
|
c.current = a;
|
|
3496
|
-
let l =
|
|
3497
|
-
|
|
3788
|
+
let l = k(0), u = k(Math.random().toString(36).slice(2, 8)), d = k(n === void 0);
|
|
3789
|
+
D(() => {
|
|
3498
3790
|
if (n === void 0 || d.current) return;
|
|
3499
3791
|
let e = !1;
|
|
3500
3792
|
return n.load().then((t) => {
|
|
@@ -3504,28 +3796,28 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3504
3796
|
}), () => {
|
|
3505
3797
|
e = !0;
|
|
3506
3798
|
};
|
|
3507
|
-
}, [n]),
|
|
3508
|
-
n === void 0 || !d.current || n.save(
|
|
3799
|
+
}, [n]), D(() => {
|
|
3800
|
+
n === void 0 || !d.current || n.save(ja(a)).catch(() => {});
|
|
3509
3801
|
}, [n, a]);
|
|
3510
|
-
let f =
|
|
3802
|
+
let f = E((e, t) => {
|
|
3511
3803
|
let n = i?.() ?? `obx_${u.current}_${l.current++}_${e}`;
|
|
3512
|
-
o((r) =>
|
|
3513
|
-
}, [i]), p =
|
|
3514
|
-
for (let e of
|
|
3515
|
-
await t(e), o((t) =>
|
|
3804
|
+
o((r) => Ta(r, n, e, t));
|
|
3805
|
+
}, [i]), p = E(async () => {
|
|
3806
|
+
for (let e of Ma(c.current)) try {
|
|
3807
|
+
await t(e), o((t) => Da(t, e.id));
|
|
3516
3808
|
} catch (t) {
|
|
3517
3809
|
if (r(t)) {
|
|
3518
|
-
o((n) =>
|
|
3810
|
+
o((n) => ka(n, e.id, t));
|
|
3519
3811
|
break;
|
|
3520
3812
|
}
|
|
3521
|
-
o((n) =>
|
|
3813
|
+
o((n) => Oa(n, e.id, t));
|
|
3522
3814
|
}
|
|
3523
3815
|
}, [t, r]);
|
|
3524
|
-
|
|
3816
|
+
D(() => {
|
|
3525
3817
|
s && p();
|
|
3526
3818
|
}, [s, p]);
|
|
3527
|
-
let m =
|
|
3528
|
-
let n =
|
|
3819
|
+
let m = E((e, t) => {
|
|
3820
|
+
let n = Aa(c.current, e, t);
|
|
3529
3821
|
c.current = n, o(n), s && p();
|
|
3530
3822
|
}, [s, p]);
|
|
3531
3823
|
return {
|
|
@@ -3537,7 +3829,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3537
3829
|
conflicts: a.filter((e) => e.status === "conflict"),
|
|
3538
3830
|
resolveConflict: m
|
|
3539
3831
|
};
|
|
3540
|
-
},
|
|
3832
|
+
}, Ia = (e) => {
|
|
3541
3833
|
let { scrollTop: t, viewportHeight: n, rowHeight: r, overscan: i = 5, total: a } = e, o = r > 0 ? r : 1, s = Math.max(0, Math.floor(t / o)), c = Math.ceil(n / o), l = Math.max(0, s - i), u = s + c + i, d = a === void 0 ? u : Math.min(u, a);
|
|
3542
3834
|
return {
|
|
3543
3835
|
startIndex: l,
|
|
@@ -3547,8 +3839,8 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3547
3839
|
topSpacer: l * r,
|
|
3548
3840
|
bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
|
|
3549
3841
|
};
|
|
3550
|
-
},
|
|
3551
|
-
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] =
|
|
3842
|
+
}, La = (e, t, n) => {
|
|
3843
|
+
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = A(0), u = O(() => Ia({
|
|
3552
3844
|
scrollTop: c,
|
|
3553
3845
|
viewportHeight: i,
|
|
3554
3846
|
rowHeight: r,
|
|
@@ -3560,7 +3852,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3560
3852
|
r,
|
|
3561
3853
|
a,
|
|
3562
3854
|
o
|
|
3563
|
-
]), d =
|
|
3855
|
+
]), d = Y(e, t, O(() => ({
|
|
3564
3856
|
...s,
|
|
3565
3857
|
offset: u.offset,
|
|
3566
3858
|
limit: u.limit
|
|
@@ -3568,7 +3860,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3568
3860
|
s,
|
|
3569
3861
|
u.offset,
|
|
3570
3862
|
u.limit
|
|
3571
|
-
])), f =
|
|
3863
|
+
])), f = E((e) => {
|
|
3572
3864
|
l(e.currentTarget.scrollTop);
|
|
3573
3865
|
}, []);
|
|
3574
3866
|
return {
|
|
@@ -3580,58 +3872,45 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3580
3872
|
loading: d.data === void 0,
|
|
3581
3873
|
error: d.error
|
|
3582
3874
|
};
|
|
3583
|
-
},
|
|
3584
|
-
let
|
|
3585
|
-
|
|
3586
|
-
u.current = !1;
|
|
3587
|
-
}), []), E(() => {
|
|
3875
|
+
}, Ra = () => typeof navigator > "u" || navigator.onLine, za = (e) => {
|
|
3876
|
+
let t = q(e), n = t.recovery ?? ct(t.errorBus, e), r = j(n.subscribe, n.getSnapshot, n.getSnapshot), [i, a] = A(Ra);
|
|
3877
|
+
D(() => {
|
|
3588
3878
|
if (typeof window > "u") return;
|
|
3589
3879
|
let e = () => {
|
|
3590
|
-
|
|
3591
|
-
}, t = () =>
|
|
3880
|
+
a(!0);
|
|
3881
|
+
}, t = () => a(!1);
|
|
3592
3882
|
return window.addEventListener("online", e), window.addEventListener("offline", t), () => {
|
|
3593
3883
|
window.removeEventListener("online", e), window.removeEventListener("offline", t);
|
|
3594
3884
|
};
|
|
3595
|
-
}, [])
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
return () => {
|
|
3607
|
-
r(), i(), d.current === e && (d.current = /* @__PURE__ */ new Set());
|
|
3608
|
-
};
|
|
3609
|
-
}, [t]);
|
|
3610
|
-
let f = T(() => {
|
|
3611
|
-
d.current.size === 0 && a(0);
|
|
3612
|
-
}, []), p = n ? i > 0 ? "degraded" : "connected" : "offline";
|
|
3613
|
-
return E(() => {
|
|
3614
|
-
U(e, "connection.status", {
|
|
3615
|
-
status: p,
|
|
3616
|
-
online: n,
|
|
3617
|
-
failureCount: i,
|
|
3618
|
-
failedSubscriptions: c.length
|
|
3885
|
+
}, []);
|
|
3886
|
+
let o = E(() => n.reportExternalSuccess(), [n]), s = i ? r.status : "offline";
|
|
3887
|
+
return D(() => {
|
|
3888
|
+
W(e, "connection.status", {
|
|
3889
|
+
status: s,
|
|
3890
|
+
rawTransport: r.rawTransport,
|
|
3891
|
+
online: i,
|
|
3892
|
+
failureCount: r.failureCount,
|
|
3893
|
+
failedSubscriptions: r.failedSubscriptions.length,
|
|
3894
|
+
pendingMutationReplays: r.pendingMutationReplays,
|
|
3895
|
+
mutationReplay: r.mutationReplay
|
|
3619
3896
|
});
|
|
3620
3897
|
}, [
|
|
3621
3898
|
e,
|
|
3622
|
-
|
|
3623
|
-
n,
|
|
3899
|
+
s,
|
|
3624
3900
|
i,
|
|
3625
|
-
|
|
3901
|
+
r
|
|
3626
3902
|
]), {
|
|
3627
|
-
status:
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3903
|
+
status: s,
|
|
3904
|
+
rawTransport: r.rawTransport,
|
|
3905
|
+
online: i,
|
|
3906
|
+
failureCount: r.failureCount,
|
|
3907
|
+
lastFailureAt: r.lastFailureAt,
|
|
3908
|
+
failedSubscriptions: r.failedSubscriptions,
|
|
3909
|
+
pendingMutationReplays: r.pendingMutationReplays,
|
|
3910
|
+
mutationReplay: r.mutationReplay,
|
|
3911
|
+
reportSuccess: o
|
|
3633
3912
|
};
|
|
3634
|
-
},
|
|
3913
|
+
}, Ba = "__voltro.connections.list", Va = "__voltro.connections.start", Ha = "__voltro.connections.submitToken", Ua = "__voltro.connections.disconnect", Wa = {
|
|
3635
3914
|
connectionId: "",
|
|
3636
3915
|
kind: "oauth2",
|
|
3637
3916
|
label: "",
|
|
@@ -3642,14 +3921,14 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3642
3921
|
expiresAt: null,
|
|
3643
3922
|
lastError: null,
|
|
3644
3923
|
connectedAt: null
|
|
3645
|
-
},
|
|
3924
|
+
}, Ga = (e, t) => {
|
|
3646
3925
|
if (t === "redirect") {
|
|
3647
3926
|
globalThis.location.assign(e);
|
|
3648
3927
|
return;
|
|
3649
3928
|
}
|
|
3650
3929
|
globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
|
|
3651
|
-
},
|
|
3652
|
-
let { data: t } =
|
|
3930
|
+
}, Ka = (e) => {
|
|
3931
|
+
let { data: t } = Y(e, Ba, {}), n = Qn(e, Va), r = qn(e, Ha), i = qn(e, Ua), a = t ?? [], o = n.pending || r.pending || i.pending, s = E((e) => ({
|
|
3653
3932
|
...e,
|
|
3654
3933
|
connected: e.status === "connected",
|
|
3655
3934
|
needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
|
|
@@ -3657,7 +3936,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3657
3936
|
connect: async (t) => {
|
|
3658
3937
|
if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
|
|
3659
3938
|
let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
|
|
3660
|
-
|
|
3939
|
+
Ga((await n.run({
|
|
3661
3940
|
connectionId: e.connectionId,
|
|
3662
3941
|
redirectTo: r
|
|
3663
3942
|
})).authorizeUrl, t?.mode);
|
|
@@ -3677,7 +3956,7 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3677
3956
|
n,
|
|
3678
3957
|
r,
|
|
3679
3958
|
i
|
|
3680
|
-
]), c =
|
|
3959
|
+
]), c = E((e) => {
|
|
3681
3960
|
let t = a.find((t) => t.connectionId === e);
|
|
3682
3961
|
return t === void 0 ? void 0 : s(t);
|
|
3683
3962
|
}, [a, s]);
|
|
@@ -3687,10 +3966,10 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3687
3966
|
get: c,
|
|
3688
3967
|
pending: o
|
|
3689
3968
|
};
|
|
3690
|
-
},
|
|
3691
|
-
let n =
|
|
3692
|
-
return
|
|
3693
|
-
...
|
|
3969
|
+
}, qa = (e, t) => {
|
|
3970
|
+
let n = Ka(e), r = n.get(t);
|
|
3971
|
+
return O(() => r === void 0 ? {
|
|
3972
|
+
...Wa,
|
|
3694
3973
|
connectionId: t,
|
|
3695
3974
|
label: t,
|
|
3696
3975
|
connected: !1,
|
|
@@ -3715,6 +3994,6 @@ var Di = () => te(Ti), Oi = (e) => Ci(Di().scopes, e), ki = (e) => wi(Di().scope
|
|
|
3715
3994
|
n.loading,
|
|
3716
3995
|
n.pending
|
|
3717
3996
|
]);
|
|
3718
|
-
},
|
|
3997
|
+
}, Ja = "framework-client";
|
|
3719
3998
|
//#endregion
|
|
3720
|
-
export {
|
|
3999
|
+
export { Ai as ADMIN_SCOPE, Ja as CLIENT_NAME, Ba as CONNECTIONS_LIST_TAG, Ua as CONNECTION_DISCONNECT_TAG, Va as CONNECTION_START_TAG, Ha as CONNECTION_SUBMIT_TOKEN_TAG, v as FORM_FLASH_SCRIPT_ID, p as FORM_KEY_FIELD, g as FORM_PATH_PREFIX, u as FORM_REDIRECT_FIELD, lr as FormBindingProvider, lt as FrameworkRuntimesContext, Pt as FrameworkRuntimesProvider, Qe as LoadingSubscriptionCache, Pi as PermissionProvider, _ as RICH_TEXT_MARKS, a as RICH_TEXT_MAX_NODES, ot as RecoveryCoordinator, d as RichTextDocument, rt as RpcErrorBus, yi as ServerRequestContext, xi as ServerRequestProvider, Ze as SubscriptionCache, Zi as UNDO_APPLY_TAG, Xi as UNDO_LOG_TAG, Qi as UNDO_REDO_TAG, er as ValidationMessagesProvider, St as _resetFrameworkRuntimesWarning, _t as _resetSsrDescriptors, xr as applyPreloadSeeds, Sn as applyStoreSeeds, Ot as buildApiRuntime, ji as canCall, Mi as canCallAny, Fe as clearClientDiagnostics, Fn as clearMutations, ja as clearSent, tn as clearStoreHistory, Pe as clientDiagnosticsSnapshot, Ia as computeWindow, Ca as createAnalytics, pr as createHooks, Vi as decideAccess, c as decodeFieldIssues, ba as defineEvent, _n as defineStore, ea as defineTracking, gn as definedStores, Ji as deriveEntityAdmins, Ne as disableClientDiagnosticsPersistence, n as documentLocale, y as emptyRichTextDocument, Me as enableClientDiagnosticsPersistence, Ta as enqueueEntry, Sa as eventCatalog, pa as filtersFromSchema, r as formActionPath, m as formDataToInput, S as formField, t as formSections, Wn as freshIdempotencyKey, zn as getMutationNotifier, Nn as getMutations, vi as globalContext, o as isRichTextDocument, s as isSafeHref, fi as isUnauthenticated, wt as isUnresolvedApi, mr as makePreloadSeedBag, yn as makeStoreSeedBag, Ri as manifestUrl, ka as markConflict, Oa as markFailed, Da as markSent, Ui as openAccessReason, h as parseRichText, Oi as provenanceUrl, et as publishClientError, ve as publishClientTrace, Cr as readPreloadedSeedOutcome, Sr as readPreloadedSnapshot, W as recordClientDiagnostic, ct as recoveryCoordinatorFor, ht as registerSsrDescriptors, Ma as replayable, nt as reportClientError, Hi as requiredScopes, wr as resetPreloadSeeds, vn as resetStoreRegistryForTests, Bt as resetStoreStorageForTest, J as resolveByTag, Aa as resolveConflictEntry, at as resolveRecoveryOptions, zt as resolveStoreStorage, ta as resolveTrackingEvent, b as resolveValidationMessage, C as restrictToSchema, ri as resumableConsumeProgram, f as richTextToPlainText, Ci as rowsToOptions, Ar as runSequence, e as schemaToColumns, x as schemaToFields, yr as seedPreloadedSubscription, br as seedPreloadedSubscriptionFailure, xn as seedStore, kr as sequence, l as serializeRichText, Rn as setMutationNotifier, gr as setPreloadSeedResolver, bn as setStoreSeedResolver, Rt as setStoreStorage, Mn as settleMutation, Vt as shallow, sa as shallowArrayEqual, ca as sourceValues, dt as ssrClientProxy, gt as ssrDescriptorsFor, vt as ssrStubHandle, G as stableKey, Nt as startApiSupervisor, jn as startMutation, $t as storeHistory, Ie as subscribeClientDiagnostics, tt as subscribeClientErrors, ye as subscribeClientTraces, Pn as subscribeMutations, en as subscribeStoreHistory, ze as supersedesConfirmedPatches, nn as travelToStoreState, Wi as useAccessDecision, Qn as useAction, li as useAgent, ci as useAgentChat, ni as useAgentStream, ya as useAsyncValidation, Ii as useCan, Li as useCanAny, zi as useCapabilityManifest, qa as useConnection, za as useConnectionStatus, Ka as useConnections, ui as useDataCopilot, Ei as useDataTable, _a as useDebounced, la as useDerived, Or as useEvent, cr as useFormBinding, ur as useFormBindingContext, dr as useFormField, Si as useFormFlash, aa as useFormSkeleton, q as useFrameworkApi, Ct as useFrameworkRuntimes, qn as useMutation, hi as useOnRawRpcError, mi as useOnRpcError, Fa as useOutbox, Fi as usePermissions, Tr as usePreloadedSubscription, wa as usePreview, ki as useProvenance, wi as useQueryField, ha as useQueryFilters, ga as useRecord, di as useRefreshSubscriptions, ua as useResourceCan, da as useResourceCans, ai as useResumableAgentStream, jr as useSequence, bi as useServerRequest, Y as useSubscription, _i as useSubscriptionHealth, oa as useTableSkeleton, ia as useTracking, Rr as useTranscription, Yi as useUndo, $i as useUndoLog, Lr as useUpload, tr as useValidationMessages, La as useWindowedSubscription, Br as useWorkflow, Jr as useWorkflowDomainEvents, Yr as useWorkflowEventDeliveries, qr as useWorkflowEvents, Ur as useWorkflowRun, Kr as useWorkflowRunEvents, ti as useWorkflowRunState, Gr as useWorkflowRunSteps, Wr as useWorkflowRuns, Vr as useWorkflowSignal, Hr as useWorkflowUpdate, xa as validateEventPayload, i as validateFields, va as validationStatus, pi as wireAuthRefresh, Gn as withIdempotencyKey, Dt as withProtocolOpenRecovery, ra as wrapTrackedCallbacks };
|