@voltro/client 0.65.0 → 0.66.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/dist/index.d.ts +85 -17
- package/dist/index.js +1224 -822
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
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
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
|
|
4
|
-
import * as
|
|
5
|
-
import { RpcClient as
|
|
6
|
-
import { applyRowPatch as
|
|
7
|
-
import * as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { FormApi as
|
|
10
|
-
import { useStore as
|
|
11
|
-
import { ArrayFormatter as
|
|
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 ae, Schedule as L, Schema as oe, Stream as R } from "effect";
|
|
4
|
+
import * as se from "@effect/platform/Headers";
|
|
5
|
+
import { RpcClient as ce, RpcClientError as le, RpcSerialization as ue } from "@effect/rpc";
|
|
6
|
+
import { applyRowPatch as de, fieldIssuesOf as fe, pluginTag as pe } from "@voltro/protocol";
|
|
7
|
+
import * as z from "@effect/platform/Socket";
|
|
8
|
+
import { jsx as me } from "react/jsx-runtime";
|
|
9
|
+
import { FormApi as he } from "@tanstack/form-core";
|
|
10
|
+
import { useStore as ge } from "@tanstack/react-store";
|
|
11
|
+
import { ArrayFormatter as _e } from "effect/ParseResult";
|
|
12
12
|
//#region src/traceBus.ts
|
|
13
|
-
var
|
|
14
|
-
for (let t of
|
|
13
|
+
var ve = /* @__PURE__ */ new Set(), ye = (e) => {
|
|
14
|
+
for (let t of ve) try {
|
|
15
15
|
t(e);
|
|
16
16
|
} catch {}
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
}),
|
|
17
|
+
}, be = (e) => (ve.add(e), () => {
|
|
18
|
+
ve.delete(e);
|
|
19
|
+
}), xe = /* @__PURE__ */ new WeakMap(), Se = (e, t) => ((typeof e == "object" && e || typeof e == "function") && xe.set(e, t), e), B = (e, t) => {
|
|
20
20
|
if ((typeof e != "object" || !e) && typeof e != "function") return t;
|
|
21
|
-
let n =
|
|
21
|
+
let n = xe.get(e);
|
|
22
22
|
if (n !== void 0) return n;
|
|
23
23
|
try {
|
|
24
|
-
return
|
|
24
|
+
return le.TypeId in e ? "transport" : t;
|
|
25
25
|
} catch {
|
|
26
26
|
return t;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, Ce = "voltro.client-diagnostics.v1", V = 400, we = 240, Te = Symbol.for("@voltro/client/diagnostics"), Ee = globalThis, De = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), H = Ee[Te] ?? (Ee[Te] = {
|
|
29
29
|
sessionStartedAt: Date.now(),
|
|
30
|
-
monotonicStartedAt:
|
|
30
|
+
monotonicStartedAt: De(),
|
|
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
|
+
}), Oe = (e) => e.length <= we ? e : `${e.slice(0, we)}…`, ke = (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" ? Oe(r) : r);
|
|
40
40
|
return t;
|
|
41
|
-
},
|
|
41
|
+
}, Ae = (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
|
+
}, je = () => {
|
|
46
|
+
if (H.storage !== void 0) try {
|
|
47
|
+
H.storage.setItem(Ce, JSON.stringify({
|
|
48
48
|
version: 1,
|
|
49
|
-
sessionStartedAt:
|
|
50
|
-
sequence:
|
|
51
|
-
dropped:
|
|
52
|
-
events:
|
|
49
|
+
sessionStartedAt: H.sessionStartedAt,
|
|
50
|
+
sequence: H.sequence,
|
|
51
|
+
dropped: H.dropped,
|
|
52
|
+
events: H.events
|
|
53
53
|
}));
|
|
54
54
|
} catch {}
|
|
55
|
-
},
|
|
56
|
-
for (let e of
|
|
55
|
+
}, Me = () => {
|
|
56
|
+
for (let e of H.listeners) try {
|
|
57
57
|
e();
|
|
58
58
|
} catch {}
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
61
|
-
|
|
59
|
+
}, Ne = (e) => {
|
|
60
|
+
if (H.storage = e, !H.loadedStorage) {
|
|
61
|
+
H.loadedStorage = !0;
|
|
62
62
|
try {
|
|
63
|
-
let t = e.getItem(
|
|
63
|
+
let t = e.getItem(Ce);
|
|
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(Ae) : [], r = Math.max(typeof e.sequence == "number" ? e.sequence : 0, 0, ...n.map((e) => e.sequence)), i = H.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 - V), s = typeof e.dropped == "number" ? e.dropped : 0;
|
|
69
|
+
H.dropped = H.dropped + s + o, H.events = a.slice(-400), H.sequence = Math.max(r + i.length, ...H.events.map((e) => e.sequence)), typeof e.sessionStartedAt == "number" && (H.sessionStartedAt = Math.min(H.sessionStartedAt, e.sessionStartedAt));
|
|
70
70
|
}
|
|
71
71
|
} catch {}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
73
|
+
je();
|
|
74
|
+
}, Pe = () => {
|
|
75
|
+
H.storage = void 0;
|
|
76
|
+
}, U = (e, t, n = {}) => {
|
|
77
77
|
let r = {
|
|
78
|
-
sequence: ++
|
|
78
|
+
sequence: ++H.sequence,
|
|
79
79
|
at: Date.now(),
|
|
80
|
-
elapsedMs: Math.max(0, Math.round(
|
|
81
|
-
api:
|
|
80
|
+
elapsedMs: Math.max(0, Math.round(De() - H.monotonicStartedAt)),
|
|
81
|
+
api: Oe(e),
|
|
82
82
|
kind: t,
|
|
83
|
-
fields:
|
|
83
|
+
fields: ke(n)
|
|
84
84
|
};
|
|
85
|
-
return
|
|
86
|
-
},
|
|
85
|
+
return H.events.push(r), H.events.length > V && (H.events.splice(0, H.events.length - V), H.dropped += 1), je(), Me(), r;
|
|
86
|
+
}, Fe = (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: H.sessionStartedAt,
|
|
90
|
+
persisted: H.storage !== void 0,
|
|
91
|
+
dropped: H.dropped,
|
|
92
|
+
events: e === void 0 ? [...H.events] : H.events.filter((t) => t.api === e)
|
|
93
|
+
}), Ie = () => {
|
|
94
|
+
H.events = [], H.dropped = 0;
|
|
95
95
|
try {
|
|
96
|
-
|
|
96
|
+
H.storage?.removeItem(Ce);
|
|
97
97
|
} catch {}
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
}),
|
|
98
|
+
Me();
|
|
99
|
+
}, Le = (e) => (H.listeners.add(e), () => {
|
|
100
|
+
H.listeners.delete(e);
|
|
101
|
+
}), W = (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
|
+
}, Re = 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
|
+
}), ze = 5e3, Be = (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
|
+
}, Ve = 0, He = () => `patch_${++Ve}`, Ue = (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
|
+
}, We = (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
|
+
}, Ge = (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
|
+
}, Ke = (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(Ue(e, r)) ? Ue(e, r) : [];
|
|
146
|
+
return We(e ?? {}, r, s === "append" ? [...t, o] : [o, ...t]);
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
let a =
|
|
149
|
+
let a = Ge(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 = Ue(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]) ? We(e, r, o(n)) : e;
|
|
168
168
|
}
|
|
169
|
-
return
|
|
169
|
+
return We(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(Ue(e, r)) ? Ue(e, r) : [];
|
|
174
|
+
return We(e, r, t.filter((e) => !a.has(e[i])));
|
|
175
175
|
};
|
|
176
|
-
},
|
|
176
|
+
}, qe = (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
|
+
}, Je = (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
|
+
}, Ye = (e, t, n) => {
|
|
212
|
+
if (e.path !== void 0) return Ke(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 = Ge(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 = Ge(e, t);
|
|
254
254
|
return n === null ? null : (e) => {
|
|
255
255
|
if (!Array.isArray(e)) {
|
|
256
256
|
let t = e;
|
|
@@ -260,7 +260,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, Xe = 5e3, Ze = 15e3, Qe = class {
|
|
264
264
|
entries = /* @__PURE__ */ new Map();
|
|
265
265
|
successor;
|
|
266
266
|
inactiveTtlMs;
|
|
@@ -271,10 +271,10 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
271
271
|
apiName;
|
|
272
272
|
recoveryStuckMs;
|
|
273
273
|
constructor(e = {}) {
|
|
274
|
-
this.inactiveTtlMs = e.inactiveTtlMs ??
|
|
274
|
+
this.inactiveTtlMs = e.inactiveTtlMs ?? Xe, this.onChangeHook = e.onChange, this.errorBus = e.errorBus, this.mirror = e.mirror, this.mergeCell = e.mergeCell, this.apiName = e.apiName, this.recoveryStuckMs = e.recoveryStuckMs ?? Ze;
|
|
275
275
|
}
|
|
276
276
|
diagnose(e, t, n = {}) {
|
|
277
|
-
this.apiName !== void 0 &&
|
|
277
|
+
this.apiName !== void 0 && U(this.apiName, e, {
|
|
278
278
|
tag: t.tag ?? "unknown",
|
|
279
279
|
revision: t.state.baseRevision,
|
|
280
280
|
subscribers: t.subscribers.size,
|
|
@@ -283,17 +283,17 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
subscribe(e, t, n, r, i = {}) {
|
|
286
|
-
let a =
|
|
286
|
+
let a = W(e), o = typeof e[0] == "string" ? e[0] : void 0, s = this.entries.get(a);
|
|
287
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), {
|
|
288
288
|
getSnapshot: () => this.getSnapshot(a),
|
|
289
289
|
unsubscribe: () => this.unsubscribe(a, r)
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
update(e, t, n) {
|
|
293
|
-
let r =
|
|
293
|
+
let r = W(e), i = typeof e[0] == "string" ? e[0] : void 0, a = this.entries.get(r);
|
|
294
294
|
a ||= this.createStub(r, i);
|
|
295
295
|
let o = {
|
|
296
|
-
id:
|
|
296
|
+
id: He(),
|
|
297
297
|
mutationId: n,
|
|
298
298
|
reducer: t,
|
|
299
299
|
baseMovesAtApply: a.baseMoves
|
|
@@ -308,7 +308,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
308
308
|
for (let i of this.entries.values()) {
|
|
309
309
|
if (i.tag !== e) continue;
|
|
310
310
|
let a = {
|
|
311
|
-
id: `forTag-${++
|
|
311
|
+
id: `forTag-${++Ve}`,
|
|
312
312
|
mutationId: n,
|
|
313
313
|
reducer: t,
|
|
314
314
|
baseMovesAtApply: i.baseMoves
|
|
@@ -331,12 +331,12 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
331
331
|
r.length > 0 && (n.state.patches = n.state.patches.filter((e) => !r.includes(e)), this.invalidate(n));
|
|
332
332
|
for (let r of n.state.patches) r.mutationId === e && r.confirmed !== !0 && (r.confirmed = !0, t = !0);
|
|
333
333
|
}
|
|
334
|
-
t && setTimeout(() => this.resyncUnechoedMutation(e),
|
|
334
|
+
t && setTimeout(() => this.resyncUnechoedMutation(e), ze), this.successor?.confirmByMutation(e);
|
|
335
335
|
}
|
|
336
336
|
resyncUnechoedMutation(e) {
|
|
337
337
|
for (let t of this.entries.values()) {
|
|
338
338
|
if (!t.state.patches.some((t) => t.mutationId === e && t.confirmed === !0)) continue;
|
|
339
|
-
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 ${ze}ms — the write is confirmed, so the preview is KEPT. Check reactivity for this query's source table.`;
|
|
340
340
|
this.errorBus?.emit({
|
|
341
341
|
source: "subscription",
|
|
342
342
|
tag: n,
|
|
@@ -351,7 +351,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
autoApply(e, t, n) {
|
|
354
|
-
let r = `optimistic-${n}-${++
|
|
354
|
+
let r = `optimistic-${n}-${++Ve}`;
|
|
355
355
|
for (let i of e) {
|
|
356
356
|
for (let e of this.entries.values()) {
|
|
357
357
|
if (!(Array.isArray(e.source) ? e.source.includes(i.table) : e.source === i.table)) continue;
|
|
@@ -365,7 +365,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
365
365
|
if (!n) continue;
|
|
366
366
|
}
|
|
367
367
|
if (e.computed && i.op === "insert" && i.path === void 0) continue;
|
|
368
|
-
let a =
|
|
368
|
+
let a = Ye(i, t, r);
|
|
369
369
|
if (a === null) continue;
|
|
370
370
|
let o = {
|
|
371
371
|
id: `${r}-${e.key}`,
|
|
@@ -379,10 +379,10 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
379
379
|
if (e !== void 0) for (let [a, o] of Object.entries(e)) {
|
|
380
380
|
let e = t[a];
|
|
381
381
|
if (!Array.isArray(e)) continue;
|
|
382
|
-
let s =
|
|
382
|
+
let s = qe(i, t, r);
|
|
383
383
|
if (s !== null) for (let t of this.entries.values()) {
|
|
384
384
|
if (!(Array.isArray(t.source) ? t.source.includes(o.junction) : t.source === o.junction) || t.computed) continue;
|
|
385
|
-
let i =
|
|
385
|
+
let i = Je(o, s, e.map((e) => String(e)), `${r}-${a}`);
|
|
386
386
|
t.state.patches.push({
|
|
387
387
|
id: `${r}-${a}-${t.key}`,
|
|
388
388
|
mutationId: n,
|
|
@@ -401,10 +401,10 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
401
401
|
n.state.patches = n.state.patches.filter((e) => e.id !== t), n.state.patches.length !== r && this.invalidate(n);
|
|
402
402
|
}
|
|
403
403
|
peek(e) {
|
|
404
|
-
return this.getSnapshot(
|
|
404
|
+
return this.getSnapshot(W(e));
|
|
405
405
|
}
|
|
406
406
|
getEntry(e) {
|
|
407
|
-
return this.entries.get(
|
|
407
|
+
return this.entries.get(W(e));
|
|
408
408
|
}
|
|
409
409
|
size() {
|
|
410
410
|
return this.entries.size;
|
|
@@ -497,7 +497,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
497
497
|
};
|
|
498
498
|
this.entries.set(e.key, e), this.scheduleEviction(e), t += 1;
|
|
499
499
|
}
|
|
500
|
-
for (let e of n) setTimeout(() => this.resyncUnechoedMutation(e),
|
|
500
|
+
for (let e of n) setTimeout(() => this.resyncUnechoedMutation(e), ze);
|
|
501
501
|
return t;
|
|
502
502
|
}
|
|
503
503
|
create(e, t, n, r, i) {
|
|
@@ -563,18 +563,18 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
563
563
|
startFiber(e, t, n) {
|
|
564
564
|
let r = e.tag ?? e.key;
|
|
565
565
|
e.resumeAfterTransportOpen = !1;
|
|
566
|
-
let i = t(), a =
|
|
566
|
+
let i = t(), a = R.unwrapScoped(N.currentSpan.pipe(N.catchAll(() => N.succeed(void 0)), N.map((t) => (t && (e.traceId = t.traceId, ye({
|
|
567
567
|
traceId: t.traceId,
|
|
568
568
|
spanId: t.spanId,
|
|
569
569
|
source: "subscription",
|
|
570
570
|
tag: r
|
|
571
|
-
})), i)))).pipe(
|
|
571
|
+
})), i)))).pipe(R.withSpan(`client.subscription.${r}`, { attributes: { "rpc.tag": r } })), o = e.state.baseRevision >= 0 ? e.state.baseRevision : void 0, s = a.pipe(R.runForEach((t) => N.sync(() => {
|
|
572
572
|
let n = e.state.base;
|
|
573
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);
|
|
574
574
|
else if (t._tag === "error") e.state.baseError = M.fail(t.error), typeof t.revision == "number" && (e.state.baseRevision = t.revision);
|
|
575
575
|
else {
|
|
576
576
|
let n = e.state.base;
|
|
577
|
-
Array.isArray(n) && (e.state.base =
|
|
577
|
+
Array.isArray(n) && (e.state.base = de(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;
|
|
578
578
|
}
|
|
579
579
|
t._tag !== "error" && (e.lastDeliveryAt = Date.now(), e.recoveryPhase !== "steady" && (e.recoveryTimer !== null && clearTimeout(e.recoveryTimer), e.recoveryTimer = null, this.diagnose("subscription.first-delivery", e, {
|
|
580
580
|
delivery: t._tag,
|
|
@@ -583,17 +583,17 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
583
583
|
source: "subscription",
|
|
584
584
|
tag: e.tag ?? e.key
|
|
585
585
|
}));
|
|
586
|
-
let r =
|
|
586
|
+
let r = Be(t, n, e.state.base);
|
|
587
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, {
|
|
588
588
|
tag: e.tag,
|
|
589
589
|
data: e.state.base,
|
|
590
590
|
revision: e.state.baseRevision
|
|
591
591
|
}).catch(() => {}), this.invalidate(e);
|
|
592
|
-
}))), c = n.runFork(o === void 0 ? s : s.pipe(N.locallyWith(
|
|
592
|
+
}))), c = n.runFork(o === void 0 ? s : s.pipe(N.locallyWith(ce.currentHeaders, (e) => se.set(e, "voltro-resume-from", String(o)))));
|
|
593
593
|
e.fiber = c, c.addObserver((t) => {
|
|
594
594
|
if (e.fiber === c && (e.fiber = null), P.isFailure(t) && !P.isInterrupted(t)) {
|
|
595
595
|
e.state.baseRevision === -1 && (e.state.baseError = t.cause, this.invalidate(e));
|
|
596
|
-
let n = M.squash(t.cause), r = M.failureOption(t.cause), i =
|
|
596
|
+
let n = M.squash(t.cause), r = M.failureOption(t.cause), i = ae.isSome(r) ? B(r.value, "handler") : "unknown";
|
|
597
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({
|
|
598
598
|
source: "subscription",
|
|
599
599
|
tag: e.tag ?? e.key,
|
|
@@ -612,7 +612,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
612
612
|
}
|
|
613
613
|
getSnapshot(e) {
|
|
614
614
|
let t = this.entries.get(e);
|
|
615
|
-
if (!t) return
|
|
615
|
+
if (!t) return Re;
|
|
616
616
|
if (t.state.cachedSnapshot !== null) return t.state.cachedSnapshot;
|
|
617
617
|
let n = t.state.base;
|
|
618
618
|
if (n !== void 0 && t.state.patches.length > 0) for (let e of t.state.patches) n = e.reducer(n);
|
|
@@ -635,26 +635,26 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
635
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));
|
|
636
636
|
}, this.inactiveTtlMs);
|
|
637
637
|
}
|
|
638
|
-
},
|
|
638
|
+
}, $e = class extends Qe {
|
|
639
639
|
subscribe(e, t, n, r, i = {}) {
|
|
640
640
|
return {
|
|
641
641
|
getSnapshot: () => this.peek(e),
|
|
642
642
|
unsubscribe: () => {}
|
|
643
643
|
};
|
|
644
644
|
}
|
|
645
|
-
},
|
|
646
|
-
for (let t of
|
|
645
|
+
}, et = /* @__PURE__ */ new Set(), tt = (e) => {
|
|
646
|
+
for (let t of et) try {
|
|
647
647
|
t(e);
|
|
648
648
|
} catch {}
|
|
649
|
-
},
|
|
650
|
-
|
|
651
|
-
}),
|
|
652
|
-
|
|
649
|
+
}, nt = (e) => (et.add(e), () => {
|
|
650
|
+
et.delete(e);
|
|
651
|
+
}), rt = (e, t) => {
|
|
652
|
+
tt({
|
|
653
653
|
error: e,
|
|
654
654
|
source: "manual",
|
|
655
655
|
...t ? { context: t } : {}
|
|
656
656
|
});
|
|
657
|
-
},
|
|
657
|
+
}, it = class {
|
|
658
658
|
#e = /* @__PURE__ */ new Set();
|
|
659
659
|
#t = /* @__PURE__ */ new Set();
|
|
660
660
|
on(e) {
|
|
@@ -666,12 +666,13 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
666
666
|
for (let t of this.#e) try {
|
|
667
667
|
t(e);
|
|
668
668
|
} catch {}
|
|
669
|
-
|
|
669
|
+
tt({
|
|
670
670
|
error: e.error,
|
|
671
671
|
source: `rpc.${e.source}`,
|
|
672
672
|
context: {
|
|
673
673
|
rpcTag: e.tag,
|
|
674
674
|
rpcErrorKind: e.kind,
|
|
675
|
+
...e.affectsTransport === void 0 ? {} : { affectsTransport: e.affectsTransport },
|
|
675
676
|
...e.outcome === void 0 ? {} : { rpcCallOutcome: e.outcome },
|
|
676
677
|
...e.traceId === void 0 ? {} : { traceId: e.traceId }
|
|
677
678
|
}
|
|
@@ -687,12 +688,32 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
687
688
|
t(e);
|
|
688
689
|
} catch {}
|
|
689
690
|
}
|
|
690
|
-
},
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
}, at = (e, t, n, r) => Math.min(r, Math.max(n, e === void 0 || !Number.isFinite(e) ? t : e)), ot = (e) => {
|
|
692
|
+
let t = Math.trunc(at(e?.maxMs, 5e3, 50, 6e4));
|
|
693
|
+
return {
|
|
694
|
+
initialMs: Math.trunc(at(e?.initialMs, 0, 0, t)),
|
|
695
|
+
thenMs: Math.trunc(at(e?.thenMs, 500, 50, t)),
|
|
696
|
+
factor: at(e?.factor, 1.5, 1, 10),
|
|
697
|
+
maxMs: t
|
|
698
|
+
};
|
|
699
|
+
}, st = (e, t) => t <= 1 ? e.initialMs : Math.min(e.maxMs, e.thenMs * e.factor ** (t - 2)), ct = (e, t) => {
|
|
700
|
+
let n = 0;
|
|
701
|
+
return {
|
|
702
|
+
reset: () => {
|
|
703
|
+
n = 0;
|
|
704
|
+
},
|
|
705
|
+
schedule: L.forever.pipe(L.addDelayEffect(() => N.sync(() => {
|
|
706
|
+
let r = st(e, ++n);
|
|
707
|
+
return t(n, r), r;
|
|
708
|
+
})))
|
|
709
|
+
};
|
|
710
|
+
}, lt = (e, t, n, r) => e === void 0 || !Number.isFinite(e) ? t : Math.min(r, Math.max(n, Math.trunc(e))), ut = (e) => ({
|
|
711
|
+
graceMs: lt(e?.graceMs, 1500, 0, 3e4),
|
|
712
|
+
retry: ot(e?.retry),
|
|
713
|
+
maxPendingMutations: lt(e?.maxPendingMutations, 32, 0, 256),
|
|
714
|
+
replayWindowMs: lt(e?.replayWindowMs, 1e4, 250, 6e4),
|
|
694
715
|
capabilitiesUrl: e?.capabilitiesUrl
|
|
695
|
-
}),
|
|
716
|
+
}), dt = class {
|
|
696
717
|
#e;
|
|
697
718
|
#t;
|
|
698
719
|
#n;
|
|
@@ -709,21 +730,25 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
709
730
|
#p = "unknown";
|
|
710
731
|
#m = -1;
|
|
711
732
|
#h = 0;
|
|
712
|
-
#g;
|
|
733
|
+
#g = new AbortController();
|
|
713
734
|
#_;
|
|
714
|
-
#v
|
|
715
|
-
#y;
|
|
735
|
+
#v;
|
|
736
|
+
#y = !1;
|
|
737
|
+
#b;
|
|
716
738
|
constructor(e, t, n) {
|
|
717
|
-
this.#e = e, this.#t =
|
|
739
|
+
this.#e = e, this.#t = ut(t), this.#n = {
|
|
718
740
|
now: n?.now ?? Date.now,
|
|
719
741
|
setTimeout: n?.setTimeout ?? ((e, t) => setTimeout(e, t)),
|
|
720
742
|
clearTimeout: n?.clearTimeout ?? ((e) => clearTimeout(e))
|
|
721
|
-
}, this.#
|
|
743
|
+
}, this.#b = this.#x();
|
|
722
744
|
}
|
|
723
745
|
get options() {
|
|
724
746
|
return this.#t;
|
|
725
747
|
}
|
|
726
|
-
|
|
748
|
+
get subjectSignal() {
|
|
749
|
+
return this.#g.signal;
|
|
750
|
+
}
|
|
751
|
+
getSnapshot = () => this.#b;
|
|
727
752
|
subscribe = (e) => (this.#r.add(e), () => {
|
|
728
753
|
this.#r.delete(e);
|
|
729
754
|
});
|
|
@@ -732,7 +757,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
732
757
|
this.#i.delete(e);
|
|
733
758
|
};
|
|
734
759
|
}
|
|
735
|
-
#
|
|
760
|
+
#x() {
|
|
736
761
|
return {
|
|
737
762
|
rawTransport: this.#c,
|
|
738
763
|
status: this.#l,
|
|
@@ -743,74 +768,78 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
743
768
|
mutationReplay: this.#p
|
|
744
769
|
};
|
|
745
770
|
}
|
|
746
|
-
#
|
|
747
|
-
this.#
|
|
771
|
+
#S() {
|
|
772
|
+
this.#b = this.#x();
|
|
748
773
|
for (let e of this.#r) try {
|
|
749
774
|
e();
|
|
750
775
|
} catch {}
|
|
751
|
-
|
|
752
|
-
rawTransport: this.#
|
|
753
|
-
status: this.#
|
|
754
|
-
failureCount: this.#
|
|
755
|
-
failedSubscriptions: this.#
|
|
756
|
-
pendingMutationReplays: this.#
|
|
757
|
-
mutationReplay: this.#
|
|
776
|
+
U(this.#e, "recovery.state", {
|
|
777
|
+
rawTransport: this.#b.rawTransport,
|
|
778
|
+
status: this.#b.status,
|
|
779
|
+
failureCount: this.#b.failureCount,
|
|
780
|
+
failedSubscriptions: this.#b.failedSubscriptions.length,
|
|
781
|
+
pendingMutationReplays: this.#b.pendingMutationReplays,
|
|
782
|
+
mutationReplay: this.#b.mutationReplay
|
|
758
783
|
});
|
|
759
784
|
}
|
|
760
|
-
#
|
|
785
|
+
#C(e) {
|
|
761
786
|
for (let t of this.#i) try {
|
|
762
787
|
t(e);
|
|
763
788
|
} catch {}
|
|
764
789
|
}
|
|
765
|
-
#
|
|
790
|
+
#w() {
|
|
766
791
|
if (this.#l === "connected") {
|
|
767
792
|
if (this.#l = this.#t.graceMs === 0 ? "degraded" : "recovering", this.#t.graceMs === 0) {
|
|
768
|
-
this.#
|
|
793
|
+
this.#v !== void 0 && (this.#y = !0, this.#C(this.#v));
|
|
769
794
|
return;
|
|
770
795
|
}
|
|
771
|
-
this.#
|
|
772
|
-
this.#
|
|
796
|
+
this.#_ = this.#n.setTimeout(() => {
|
|
797
|
+
this.#_ = void 0, this.#l === "recovering" && (this.#l = "degraded", this.#v !== void 0 && (this.#y = !0, this.#C(this.#v)), this.#S());
|
|
773
798
|
}, this.#t.graceMs);
|
|
774
799
|
}
|
|
775
800
|
}
|
|
776
|
-
#
|
|
777
|
-
this.#c !== "connected" || this.#s.size > 0 || (this.#
|
|
801
|
+
#T() {
|
|
802
|
+
this.#c !== "connected" || this.#s.size > 0 || (this.#_ !== void 0 && (this.#n.clearTimeout(this.#_), this.#_ = void 0), this.#l = "connected", this.#u = 0, this.#v = void 0, this.#y = !1);
|
|
778
803
|
}
|
|
779
804
|
transportIssue() {
|
|
780
|
-
this.#c = "disconnected", this.#u += 1, this.#d = this.#n.now(), this.#
|
|
805
|
+
this.#c = "disconnected", this.#u += 1, this.#d = this.#n.now(), this.#w(), this.#S();
|
|
781
806
|
}
|
|
782
807
|
protocolReady() {
|
|
783
808
|
this.#c = "connected";
|
|
784
809
|
for (let e of this.#a) e();
|
|
785
|
-
this.#a.clear(), this.#
|
|
810
|
+
this.#a.clear(), this.#T(), this.#S();
|
|
786
811
|
}
|
|
787
812
|
observeError(e) {
|
|
788
|
-
if (e.kind !== "transport") {
|
|
789
|
-
|
|
790
|
-
|
|
813
|
+
if (e.kind !== "transport" || e.affectsTransport !== !1) {
|
|
814
|
+
if (e.kind !== "transport") {
|
|
815
|
+
this.#C(e);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
this.#v === void 0 && (this.#v = e), e.source === "subscription" && this.#s.add(e.tag), this.#c !== "disconnected" && (this.#c = "disconnected", this.#u += 1, this.#d = this.#n.now()), this.#w(), this.#l === "degraded" && !this.#y && (this.#y = !0, this.#C(e)), this.#S();
|
|
791
819
|
}
|
|
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
820
|
}
|
|
794
821
|
observeSuccess(e) {
|
|
795
|
-
e.source === "subscription" && this.#s.delete(e.tag), this.#
|
|
822
|
+
e.source === "subscription" && this.#s.delete(e.tag), this.#T(), this.#S();
|
|
796
823
|
}
|
|
797
824
|
reportExternalSuccess() {
|
|
798
825
|
this.#c = "connected";
|
|
799
826
|
for (let e of this.#a) e();
|
|
800
|
-
this.#a.clear(), this.#
|
|
827
|
+
this.#a.clear(), this.#T(), this.#S();
|
|
801
828
|
}
|
|
802
829
|
resetForSubjectChange(e = 0) {
|
|
803
|
-
this.#
|
|
830
|
+
this.#_ !== void 0 && this.#n.clearTimeout(this.#_), this.#_ = void 0, this.#c = "disconnected", this.#l = "connected", this.#u = 0, this.#d = void 0, this.#s.clear(), this.#v = void 0, this.#y = !1, this.#p = "unknown", this.#h += 1;
|
|
831
|
+
let t = this.#g;
|
|
832
|
+
this.#g = new AbortController(), t.abort(), this.#m = e;
|
|
804
833
|
for (let e of this.#o) e(!1);
|
|
805
834
|
this.#o.clear();
|
|
806
835
|
for (let e of this.#a) e();
|
|
807
|
-
this.#a.clear(), this.#
|
|
836
|
+
this.#a.clear(), this.#w(), this.#S();
|
|
808
837
|
}
|
|
809
838
|
setMutationReplaySupported(e, t = 0) {
|
|
810
839
|
if (!(t < this.#m)) {
|
|
811
840
|
this.#m = t, this.#p = e ? "enabled" : "disabled";
|
|
812
841
|
for (let t of this.#o) t(e);
|
|
813
|
-
this.#o.clear(), this.#
|
|
842
|
+
this.#o.clear(), this.#S();
|
|
814
843
|
}
|
|
815
844
|
}
|
|
816
845
|
replayWindowRemaining(e) {
|
|
@@ -828,12 +857,12 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
828
857
|
}
|
|
829
858
|
reserveMutationReplay(e) {
|
|
830
859
|
if (this.#p === "disabled" || this.#n.now() - e > this.#t.replayWindowMs || this.#f >= this.#t.maxPendingMutations) return;
|
|
831
|
-
this.#f += 1, this.#
|
|
860
|
+
this.#f += 1, this.#S();
|
|
832
861
|
let t = this.#h, n = !1;
|
|
833
862
|
return {
|
|
834
863
|
isValid: () => !n && t === this.#h && this.#p === "enabled" && this.#c === "connected" && this.#n.now() - e <= this.#t.replayWindowMs,
|
|
835
864
|
release: () => {
|
|
836
|
-
n || (n = !0, --this.#f, this.#
|
|
865
|
+
n || (n = !0, --this.#f, this.#S());
|
|
837
866
|
}
|
|
838
867
|
};
|
|
839
868
|
}
|
|
@@ -849,57 +878,57 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
849
878
|
});
|
|
850
879
|
}
|
|
851
880
|
dispose() {
|
|
852
|
-
this.#g !== void 0 && this.#n.clearTimeout(this.#
|
|
881
|
+
this.#g.abort(), this.#_ !== void 0 && this.#n.clearTimeout(this.#_), this.#_ = void 0;
|
|
853
882
|
for (let e of this.#a) e();
|
|
854
883
|
this.#a.clear();
|
|
855
884
|
for (let e of this.#o) e(!1);
|
|
856
885
|
this.#o.clear(), this.#r.clear(), this.#i.clear();
|
|
857
886
|
}
|
|
858
|
-
},
|
|
859
|
-
let r =
|
|
887
|
+
}, ft = /* @__PURE__ */ new WeakMap(), pt = (e, t, n) => {
|
|
888
|
+
let r = ft.get(e);
|
|
860
889
|
if (r !== void 0) return r;
|
|
861
|
-
let i = new
|
|
862
|
-
return e.on((e) => i.observeError(e)), typeof e.onSuccess == "function" && e.onSuccess((e) => i.observeSuccess(e)),
|
|
863
|
-
},
|
|
890
|
+
let i = new dt(t, n);
|
|
891
|
+
return e.on((e) => i.observeError(e)), typeof e.onSuccess == "function" && e.onSuccess((e) => i.observeSuccess(e)), ft.set(e, i), i;
|
|
892
|
+
}, mt = w(null), ht = () => {
|
|
864
893
|
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");
|
|
865
|
-
},
|
|
866
|
-
get: (e, t) =>
|
|
894
|
+
}, gt = new Proxy(() => ht(), {
|
|
895
|
+
get: (e, t) => gt,
|
|
867
896
|
has: () => !0,
|
|
868
|
-
apply: () =>
|
|
869
|
-
}),
|
|
870
|
-
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
},
|
|
897
|
+
apply: () => ht()
|
|
898
|
+
}), _t = Symbol.for("@voltro/client/ssrDescriptors"), vt = globalThis, yt = vt[_t] ?? (vt[_t] = { byApi: /* @__PURE__ */ new Map() }), bt = (e, t) => {
|
|
899
|
+
yt.byApi.set(e, t);
|
|
900
|
+
}, xt = (e) => yt.byApi.get(e), St = () => {
|
|
901
|
+
yt.byApi.clear();
|
|
902
|
+
}, Ct = {
|
|
874
903
|
runtime: { runPromiseExit: () => Promise.resolve(P.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
|
|
875
|
-
cache: new
|
|
876
|
-
client:
|
|
904
|
+
cache: new $e(),
|
|
905
|
+
client: gt,
|
|
877
906
|
descriptors: {},
|
|
878
907
|
inspectBaseUrl: "",
|
|
879
|
-
errorBus: new
|
|
880
|
-
recovery: new
|
|
881
|
-
},
|
|
908
|
+
errorBus: new it(),
|
|
909
|
+
recovery: new dt("ssr")
|
|
910
|
+
}, wt = {
|
|
882
911
|
get: (e) => {
|
|
883
|
-
let t =
|
|
884
|
-
return t === void 0 ?
|
|
885
|
-
...
|
|
912
|
+
let t = xt(e);
|
|
913
|
+
return t === void 0 ? Ct : {
|
|
914
|
+
...Ct,
|
|
886
915
|
descriptors: t
|
|
887
916
|
};
|
|
888
917
|
},
|
|
889
918
|
names: []
|
|
890
|
-
},
|
|
891
|
-
|
|
892
|
-
},
|
|
893
|
-
let e = ee(
|
|
894
|
-
return e ? (
|
|
895
|
-
|
|
896
|
-
}, 0)),
|
|
897
|
-
},
|
|
898
|
-
let t =
|
|
919
|
+
}, Tt = !1, Et = !1, G = null, Dt = () => {
|
|
920
|
+
Tt = !1, Et = !1, G !== null && (clearTimeout(G), G = null);
|
|
921
|
+
}, Ot = () => {
|
|
922
|
+
let e = ee(mt);
|
|
923
|
+
return e ? (Et || (Et = !0, G !== null && (clearTimeout(G), G = null)), e) : (typeof window < "u" && !Tt && !Et && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
|
|
924
|
+
G = null, !(Tt || Et) && (Tt = !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>."));
|
|
925
|
+
}, 0)), wt);
|
|
926
|
+
}, K = (e) => {
|
|
927
|
+
let t = Ot(), n = t.demand;
|
|
899
928
|
return D(() => {
|
|
900
929
|
n?.(e);
|
|
901
930
|
}, [n, e]), t.get(e);
|
|
902
|
-
},
|
|
931
|
+
}, kt = (e) => typeof e.runtime?.runFork != "function", At = (e, t, n) => {
|
|
903
932
|
try {
|
|
904
933
|
let r = typeof globalThis.location == "object" ? globalThis.location.href : void 0, i = new URL(e, r);
|
|
905
934
|
if (i.protocol === "wss:" ? i.protocol = "https:" : i.protocol === "ws:" && (i.protocol = "http:"), n !== void 0) return new URL(n, i).toString();
|
|
@@ -913,8 +942,8 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
913
942
|
} catch {
|
|
914
943
|
return;
|
|
915
944
|
}
|
|
916
|
-
},
|
|
917
|
-
let a =
|
|
945
|
+
}, jt = async (e, t, n = fetch, r = 1500, i) => {
|
|
946
|
+
let a = At(e, t, i);
|
|
918
947
|
if (a === void 0) return;
|
|
919
948
|
let o = new AbortController(), s = setTimeout(() => o.abort(), r);
|
|
920
949
|
try {
|
|
@@ -935,51 +964,92 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
935
964
|
} finally {
|
|
936
965
|
clearTimeout(s);
|
|
937
966
|
}
|
|
938
|
-
},
|
|
967
|
+
}, Mt = class {
|
|
968
|
+
#e;
|
|
969
|
+
#t;
|
|
970
|
+
#n;
|
|
971
|
+
#r = /* @__PURE__ */ new Set();
|
|
972
|
+
getSnapshot = () => this.#n;
|
|
973
|
+
subscribe = (e) => (this.#r.add(e), () => {
|
|
974
|
+
this.#r.delete(e);
|
|
975
|
+
});
|
|
976
|
+
begin() {
|
|
977
|
+
let e = {};
|
|
978
|
+
return this.#e = e, this.#i(), {
|
|
979
|
+
open: () => {
|
|
980
|
+
if (this.#e === e) return this.#n === void 0 && (this.#t = new AbortController(), this.#n = Object.freeze({ signal: this.#t.signal }), this.#a()), this.#e === e ? this.#n : void 0;
|
|
981
|
+
},
|
|
982
|
+
close: () => {
|
|
983
|
+
this.#e === e && (this.#e = void 0, this.#i());
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
#i() {
|
|
988
|
+
let e = this.#t, t = this.#n !== void 0;
|
|
989
|
+
this.#t = void 0, this.#n = void 0, e?.abort(), t && this.#a();
|
|
990
|
+
}
|
|
991
|
+
#a() {
|
|
992
|
+
for (let e of this.#r) try {
|
|
993
|
+
e();
|
|
994
|
+
} catch {}
|
|
995
|
+
}
|
|
996
|
+
}, Nt = /* @__PURE__ */ new WeakMap(), Pt = (e, t) => {
|
|
997
|
+
Nt.set(e, t);
|
|
998
|
+
}, Ft = (e) => Nt.get(e), It = (e, t, n = new Mt()) => z.Socket.of({
|
|
939
999
|
...e,
|
|
940
|
-
runRaw: (n,
|
|
941
|
-
...
|
|
942
|
-
onOpen: N.zipRight(
|
|
943
|
-
|
|
944
|
-
})
|
|
1000
|
+
runRaw: (r, i) => N.acquireUseRelease(N.sync(() => n.begin()), (n) => e.runRaw(r, {
|
|
1001
|
+
...i,
|
|
1002
|
+
onOpen: N.zipRight(i?.onOpen ?? N.void, N.sync(() => {
|
|
1003
|
+
n.open() !== void 0 && t();
|
|
1004
|
+
}))
|
|
1005
|
+
}), (e) => N.sync(e.close))
|
|
1006
|
+
}), Lt = async (e) => {
|
|
945
1007
|
let { name: t, wsUrl: n, group: r, headers: i, webSocketConstructor: a } = e, o = e.generation ?? 0;
|
|
946
|
-
|
|
947
|
-
let s = e.errorBus ?? new
|
|
948
|
-
|
|
949
|
-
|
|
1008
|
+
U(t, "runtime.build-started", { generation: o });
|
|
1009
|
+
let s = e.errorBus ?? new it(), c = e.recovery ?? pt(s, t), l = ct(c.options.retry, (e, n) => {
|
|
1010
|
+
U(t, "socket.retry-scheduled", {
|
|
1011
|
+
generation: o,
|
|
1012
|
+
attempt: e,
|
|
1013
|
+
delayMs: n,
|
|
1014
|
+
owner: "socket"
|
|
1015
|
+
});
|
|
1016
|
+
});
|
|
1017
|
+
jt(n, t, fetch, 1500, c.options.capabilitiesUrl).then((e) => {
|
|
1018
|
+
c.setMutationReplaySupported(e?.mutationReplay === !0, o), U(t, "runtime.capabilities", {
|
|
950
1019
|
mutationReplay: e?.mutationReplay === !0,
|
|
951
1020
|
discovered: e !== void 0
|
|
952
1021
|
});
|
|
953
1022
|
});
|
|
954
|
-
let
|
|
1023
|
+
let u = new Qe({
|
|
955
1024
|
errorBus: s,
|
|
956
1025
|
apiName: t
|
|
957
|
-
}),
|
|
958
|
-
class
|
|
959
|
-
let
|
|
1026
|
+
}), d = new Mt(), f;
|
|
1027
|
+
class p extends ne.Tag(`@voltro/client/AppClient/${t}`)() {}
|
|
1028
|
+
let m = F.succeed(z.WebSocketConstructor, a), h = z.layerWebSocket(n).pipe(F.provide(m)), g = F.effect(z.Socket, N.map(z.Socket, (e) => It(e, () => {
|
|
1029
|
+
l.reset();
|
|
960
1030
|
let e = 0;
|
|
961
|
-
|
|
1031
|
+
f !== void 0 && (e = u.resumeTransportFailures(f)), U(t, "protocol.ready", {
|
|
962
1032
|
generation: o,
|
|
963
1033
|
resumed: e
|
|
964
1034
|
}), c.protocolReady();
|
|
965
|
-
}))).pipe(F.provide(
|
|
966
|
-
|
|
1035
|
+
}, d))).pipe(F.provide(h)), _ = ce.layerProtocolSocket({ retrySchedule: l.schedule }).pipe(F.provide(ue.layerJson), F.provide(g)), v = typeof i == "function" ? await i() : i, y = F.scoped(p, ce.make(r)).pipe(F.provide(_)), b = v ? F.locallyScoped(ce.currentHeaders, se.fromInput(v)) : F.empty, x = I.make(F.merge(y, b));
|
|
1036
|
+
f = x, Pt(f, d);
|
|
967
1037
|
try {
|
|
968
|
-
let e = await
|
|
969
|
-
return
|
|
970
|
-
runtime:
|
|
1038
|
+
let e = await x.runPromise(p);
|
|
1039
|
+
return U(t, "runtime.resolved", { generation: o }), {
|
|
1040
|
+
runtime: x,
|
|
971
1041
|
client: e,
|
|
972
|
-
cache:
|
|
1042
|
+
cache: u,
|
|
973
1043
|
errorBus: s,
|
|
974
1044
|
recovery: c
|
|
975
1045
|
};
|
|
976
1046
|
} catch (e) {
|
|
977
|
-
throw
|
|
1047
|
+
throw U(t, "runtime.failed", {
|
|
978
1048
|
generation: o,
|
|
979
1049
|
errorName: e instanceof Error ? e.name : typeof e
|
|
980
|
-
}),
|
|
1050
|
+
}), x.dispose(), e;
|
|
981
1051
|
}
|
|
982
|
-
},
|
|
1052
|
+
}, Rt = (e, t, n) => ({
|
|
983
1053
|
resolved: null,
|
|
984
1054
|
retryToken: 0,
|
|
985
1055
|
failureCount: 0,
|
|
@@ -993,97 +1063,100 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
993
1063
|
stopRecoveryError: e.on((e) => t.observeError(e)),
|
|
994
1064
|
stopRecoverySuccess: e.onSuccess((e) => t.observeSuccess(e)),
|
|
995
1065
|
ownsRecovery: n
|
|
996
|
-
}),
|
|
1066
|
+
}), zt = (e) => {
|
|
997
1067
|
e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
|
|
998
|
-
},
|
|
1068
|
+
}, Bt = (e) => {
|
|
999
1069
|
e.cache.destroy(e.runtime), e.runtime.dispose();
|
|
1000
|
-
},
|
|
1001
|
-
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.
|
|
1070
|
+
}, Vt = (e) => {
|
|
1071
|
+
let t = e.apis, n = e.buildClient, r = e.onChange, i = e.stableWindowMs ?? 5e3, a = e.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), o = e.scheduler?.clearTimeout ?? ((e) => {
|
|
1002
1072
|
clearTimeout(e);
|
|
1003
|
-
}),
|
|
1073
|
+
}), s = e.scheduler?.queueMicrotask ?? queueMicrotask, c = e.onReconnecting, l = e.wedgeBackstop, u = /* @__PURE__ */ new Map();
|
|
1004
1074
|
for (let n of t) {
|
|
1005
|
-
let t = e.errorBusFor?.(n.name) ?? new
|
|
1006
|
-
|
|
1075
|
+
let t = e.errorBusFor?.(n.name) ?? new it(), r = e.recoveryFor?.(n.name, n.recovery), i = r ?? new dt(n.name, n.recovery);
|
|
1076
|
+
u.set(n.name, Rt(t, i, r === void 0));
|
|
1007
1077
|
}
|
|
1008
|
-
let
|
|
1009
|
-
let n =
|
|
1010
|
-
|
|
1078
|
+
let d = !1, f = /* @__PURE__ */ new Set(), p = (e, t) => {
|
|
1079
|
+
let n = a(() => {
|
|
1080
|
+
f.delete(n), e();
|
|
1011
1081
|
}, t);
|
|
1012
|
-
return
|
|
1013
|
-
},
|
|
1014
|
-
if (
|
|
1082
|
+
return f.add(n), n;
|
|
1083
|
+
}, m = () => {
|
|
1084
|
+
if (d) return;
|
|
1015
1085
|
let e = /* @__PURE__ */ new Map();
|
|
1016
|
-
for (let [t, n] of
|
|
1086
|
+
for (let [t, n] of u) n.resolved && e.set(t, n.resolved);
|
|
1017
1087
|
r(e, t.every((t) => e.has(t.name)));
|
|
1018
|
-
},
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
if (
|
|
1022
|
-
t.
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1088
|
+
}, h = (e, t) => {
|
|
1089
|
+
t.failureCount += 1, !t.reconnectStatusDispose && c && (t.reconnectStatusDispose = c(e.name)), l && t.everOpened && t.failureCount >= l.afterFailures && t.wedgeStop === null && (t.wedgeStop = l.arm(e.name));
|
|
1090
|
+
}, g = (t) => {
|
|
1091
|
+
if (d) return;
|
|
1092
|
+
let n = u.get(t.name);
|
|
1093
|
+
if (!n) return;
|
|
1094
|
+
h(t, n);
|
|
1095
|
+
let r = e.retryDelayMs?.(n.failureCount) ?? st(n.recovery.options.retry, n.failureCount);
|
|
1096
|
+
U(t.name, "socket.retry-scheduled", {
|
|
1097
|
+
generation: n.generation,
|
|
1098
|
+
attempt: n.failureCount,
|
|
1099
|
+
delayMs: r,
|
|
1100
|
+
owner: "runtime-build"
|
|
1028
1101
|
});
|
|
1029
|
-
let
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
},
|
|
1102
|
+
let i = ++n.retryToken;
|
|
1103
|
+
p(() => {
|
|
1104
|
+
d || n.retryToken === i && (n.generation += 1, _(t));
|
|
1105
|
+
}, r);
|
|
1033
1106
|
}, _ = async (e) => {
|
|
1034
|
-
if (
|
|
1035
|
-
let t =
|
|
1107
|
+
if (d) return;
|
|
1108
|
+
let t = u.get(e.name);
|
|
1036
1109
|
if (!t) return;
|
|
1037
|
-
let r = t.generation,
|
|
1038
|
-
if (
|
|
1039
|
-
t.everOpened = !0,
|
|
1110
|
+
let r = t.generation, a = () => {
|
|
1111
|
+
if (d || t.generation !== r) return;
|
|
1112
|
+
t.everOpened = !0, zt(t), t.reconnectStatusDispose &&= (t.reconnectStatusDispose(), null), t.retryToken++;
|
|
1040
1113
|
let e = t.failureCount;
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
},
|
|
1114
|
+
p(() => {
|
|
1115
|
+
d || t.failureCount === e && (t.failureCount = 0);
|
|
1116
|
+
}, i);
|
|
1044
1117
|
}, o = (n) => {
|
|
1045
|
-
|
|
1118
|
+
d || t.generation !== r || (t.recovery.transportIssue(), h(e, t));
|
|
1046
1119
|
};
|
|
1047
1120
|
try {
|
|
1048
|
-
let
|
|
1049
|
-
if (
|
|
1050
|
-
|
|
1121
|
+
let i = await n(e, r, a, o, t.errorBus, t.recovery);
|
|
1122
|
+
if (d || t.generation !== r) {
|
|
1123
|
+
Bt(i);
|
|
1051
1124
|
return;
|
|
1052
1125
|
}
|
|
1053
|
-
let s = t.resolved, c = t.subjectMayHaveChanged, l = s && !c ?
|
|
1054
|
-
t.subjectMayHaveChanged = !1, t.resolved =
|
|
1126
|
+
let s = t.resolved, c = t.subjectMayHaveChanged, l = s && !c ? i.cache.seedStaleFrom(s.cache) : 0;
|
|
1127
|
+
t.subjectMayHaveChanged = !1, t.resolved = i, U(e.name, "runtime.swapped", {
|
|
1055
1128
|
generation: r,
|
|
1056
1129
|
replaced: s !== null,
|
|
1057
1130
|
seeded: l,
|
|
1058
1131
|
subjectMayHaveChanged: c
|
|
1059
|
-
}),
|
|
1132
|
+
}), m(), s && Bt(s);
|
|
1060
1133
|
} catch {
|
|
1061
|
-
if (
|
|
1134
|
+
if (d || t.generation !== r) return;
|
|
1062
1135
|
g(e);
|
|
1063
1136
|
}
|
|
1064
1137
|
}, v = (e) => {
|
|
1065
|
-
if (!
|
|
1066
|
-
let t =
|
|
1067
|
-
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, e && t.recovery.resetForSubjectChange(t.generation), t.failureCount = 0,
|
|
1138
|
+
if (!d) for (let n of t) {
|
|
1139
|
+
let t = u.get(n.name);
|
|
1140
|
+
t && (e && (t.subjectMayHaveChanged = !0), t.retryToken += 1, t.generation += 1, e && t.recovery.resetForSubjectChange(t.generation), t.failureCount = 0, zt(t), _(n));
|
|
1068
1141
|
}
|
|
1069
1142
|
};
|
|
1070
1143
|
return t.length === 0 ? (r(/* @__PURE__ */ new Map(), !0), {
|
|
1071
1144
|
dispose: () => {
|
|
1072
|
-
|
|
1145
|
+
d = !0;
|
|
1073
1146
|
},
|
|
1074
1147
|
reconnect: () => {},
|
|
1075
1148
|
refreshAuth: () => {}
|
|
1076
|
-
}) : (
|
|
1077
|
-
if (!
|
|
1149
|
+
}) : (s(() => {
|
|
1150
|
+
if (!d) for (let e of t) _(e);
|
|
1078
1151
|
}), {
|
|
1079
1152
|
dispose: () => {
|
|
1080
|
-
if (!
|
|
1081
|
-
|
|
1082
|
-
for (let e of
|
|
1083
|
-
|
|
1084
|
-
for (let [, e] of
|
|
1085
|
-
for (let e of t)
|
|
1086
|
-
|
|
1153
|
+
if (!d) {
|
|
1154
|
+
d = !0;
|
|
1155
|
+
for (let e of f) o(e);
|
|
1156
|
+
f.clear();
|
|
1157
|
+
for (let [, e] of u) e.resolved && Bt(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), zt(e), e.stopRecoveryError(), e.stopRecoverySuccess(), e.ownsRecovery && e.recovery.dispose();
|
|
1158
|
+
for (let e of t) U(e.name, "runtime.disposed");
|
|
1159
|
+
u.clear();
|
|
1087
1160
|
}
|
|
1088
1161
|
},
|
|
1089
1162
|
reconnect: () => {
|
|
@@ -1093,7 +1166,7 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
1093
1166
|
v(!1);
|
|
1094
1167
|
}
|
|
1095
1168
|
});
|
|
1096
|
-
},
|
|
1169
|
+
}, Ht = ({ apis: e, children: t, demand: n }) => {
|
|
1097
1170
|
let r = O(() => ({
|
|
1098
1171
|
get: (t) => {
|
|
1099
1172
|
let n = e.get(t);
|
|
@@ -1106,45 +1179,45 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
1106
1179
|
names: Array.from(e.keys()),
|
|
1107
1180
|
...n === void 0 ? {} : { demand: n }
|
|
1108
1181
|
}), [e]);
|
|
1109
|
-
return /* @__PURE__ */
|
|
1182
|
+
return /* @__PURE__ */ me(mt.Provider, {
|
|
1110
1183
|
value: r,
|
|
1111
1184
|
children: t
|
|
1112
1185
|
});
|
|
1113
|
-
},
|
|
1114
|
-
let e = globalThis, t = e[
|
|
1186
|
+
}, Ut = Symbol.for("@voltro/client/storeStorageProvider"), Wt = () => {
|
|
1187
|
+
let e = globalThis, t = e[Ut];
|
|
1115
1188
|
if (t !== void 0) return t;
|
|
1116
1189
|
let n = {
|
|
1117
1190
|
provider: void 0,
|
|
1118
1191
|
used: !1
|
|
1119
1192
|
};
|
|
1120
|
-
return e[
|
|
1121
|
-
},
|
|
1193
|
+
return e[Ut] = n, n;
|
|
1194
|
+
}, Gt = (e) => {
|
|
1122
1195
|
if (typeof window > "u") return null;
|
|
1123
1196
|
try {
|
|
1124
1197
|
return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
|
|
1125
1198
|
} catch {
|
|
1126
1199
|
return null;
|
|
1127
1200
|
}
|
|
1128
|
-
},
|
|
1129
|
-
let t =
|
|
1201
|
+
}, Kt = (e) => {
|
|
1202
|
+
let t = Wt();
|
|
1130
1203
|
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;
|
|
1131
|
-
},
|
|
1132
|
-
let t =
|
|
1133
|
-
return t.used = !0, (t.provider ??
|
|
1134
|
-
},
|
|
1135
|
-
let e =
|
|
1204
|
+
}, qt = (e) => {
|
|
1205
|
+
let t = Wt();
|
|
1206
|
+
return t.used = !0, (t.provider ?? Gt)(e);
|
|
1207
|
+
}, Jt = () => {
|
|
1208
|
+
let e = Wt();
|
|
1136
1209
|
e.provider = void 0, e.used = !1;
|
|
1137
|
-
},
|
|
1210
|
+
}, Yt = (e, t) => {
|
|
1138
1211
|
if (Object.is(e, t)) return !0;
|
|
1139
1212
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
1140
1213
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1141
1214
|
if (n.length !== r.length) return !1;
|
|
1142
1215
|
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
1143
1216
|
return !0;
|
|
1144
|
-
},
|
|
1145
|
-
|
|
1146
|
-
},
|
|
1147
|
-
let r =
|
|
1217
|
+
}, Xt = 50, Zt = /* @__PURE__ */ new Set(), Qt = (e, t) => {
|
|
1218
|
+
Zt.has(e) || (Zt.add(e), console.warn(t));
|
|
1219
|
+
}, $t = "\0global", en = null, tn = (e, t, n) => {
|
|
1220
|
+
let r = en?.() ?? null;
|
|
1148
1221
|
if (r === null) return n;
|
|
1149
1222
|
let i = n;
|
|
1150
1223
|
for (let n of r.seeds) n.store === e && n.key === t && (i = {
|
|
@@ -1152,9 +1225,9 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
1152
1225
|
...n.value
|
|
1153
1226
|
});
|
|
1154
1227
|
return i;
|
|
1155
|
-
},
|
|
1228
|
+
}, nn = (e, t) => {
|
|
1156
1229
|
let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
|
|
1157
|
-
if (i >=
|
|
1230
|
+
if (i >= Xt) throw i = 0, Error(`defineStore: notification depth exceeded ${Xt} — 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.`);
|
|
1158
1231
|
i += 1;
|
|
1159
1232
|
try {
|
|
1160
1233
|
for (let e of [...r]) e();
|
|
@@ -1175,20 +1248,20 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
1175
1248
|
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}', () => { … })\`.`);
|
|
1176
1249
|
if (--a, a > 0) return;
|
|
1177
1250
|
let l = o, u = s;
|
|
1178
|
-
o = void 0, s = void 0, !
|
|
1251
|
+
o = void 0, s = void 0, !Yt(l, n) && (t(l, n, u), c());
|
|
1179
1252
|
},
|
|
1180
1253
|
set: (e, r) => {
|
|
1181
1254
|
let i = typeof e == "function" ? e(n) : {
|
|
1182
1255
|
...n,
|
|
1183
1256
|
...e
|
|
1184
1257
|
};
|
|
1185
|
-
if (
|
|
1258
|
+
if (Yt(i, n)) return;
|
|
1186
1259
|
let o = n;
|
|
1187
1260
|
n = i, !(a > 0) && (t(o, i, r), c());
|
|
1188
1261
|
},
|
|
1189
1262
|
reset: () => {
|
|
1190
1263
|
let r = e();
|
|
1191
|
-
if (
|
|
1264
|
+
if (Yt(r, n)) return;
|
|
1192
1265
|
let i = n;
|
|
1193
1266
|
n = r, !(a > 0) && (t(i, r, "reset"), c());
|
|
1194
1267
|
},
|
|
@@ -1196,51 +1269,51 @@ var _e = /* @__PURE__ */ new Set(), ve = (e) => {
|
|
|
1196
1269
|
r.delete(e);
|
|
1197
1270
|
})
|
|
1198
1271
|
};
|
|
1199
|
-
},
|
|
1200
|
-
|
|
1201
|
-
}),
|
|
1202
|
-
|
|
1203
|
-
},
|
|
1204
|
-
let n =
|
|
1272
|
+
}, rn = 200, an = [], on = /* @__PURE__ */ new Set(), sn = [], cn = () => sn, ln = (e) => (on.add(e), () => {
|
|
1273
|
+
on.delete(e);
|
|
1274
|
+
}), un = () => {
|
|
1275
|
+
an.length = 0, sn = [];
|
|
1276
|
+
}, dn = (e, t) => {
|
|
1277
|
+
let n = an[e];
|
|
1205
1278
|
if (n === void 0) return !1;
|
|
1206
|
-
let r =
|
|
1279
|
+
let r = hn.get(n.store);
|
|
1207
1280
|
if (r === void 0) return !1;
|
|
1208
1281
|
let i = t === "before" ? n.prev : n.next;
|
|
1209
|
-
|
|
1282
|
+
pn = !0;
|
|
1210
1283
|
try {
|
|
1211
1284
|
r.set(() => i, n.key, `travel:${t}`);
|
|
1212
1285
|
} finally {
|
|
1213
|
-
|
|
1286
|
+
pn = !1;
|
|
1214
1287
|
}
|
|
1215
1288
|
return !0;
|
|
1216
|
-
},
|
|
1217
|
-
|
|
1218
|
-
for (let e of [...
|
|
1219
|
-
},
|
|
1220
|
-
|
|
1221
|
-
})),
|
|
1222
|
-
function
|
|
1289
|
+
}, fn = !1, pn = !1, mn = (e) => {
|
|
1290
|
+
an.push(e), an.length > rn && an.shift(), sn = [...an];
|
|
1291
|
+
for (let e of [...on]) e();
|
|
1292
|
+
}, hn = /* @__PURE__ */ new Map(), gn = /* @__PURE__ */ new Map(), _n = 0, vn = !1, yn = /* @__PURE__ */ new Map(), bn = () => (vn || (vn = !0, queueMicrotask(() => {
|
|
1293
|
+
_n += 1, vn = !1;
|
|
1294
|
+
})), _n), xn = Sn(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
|
|
1295
|
+
function Sn(e) {
|
|
1223
1296
|
let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
|
|
1224
1297
|
return n.length > 0 ? n : void 0;
|
|
1225
1298
|
}
|
|
1226
|
-
var
|
|
1299
|
+
var Cn = () => {
|
|
1227
1300
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
1228
1301
|
if (typeof e != "string") return "<unknown>";
|
|
1229
1302
|
for (let t of e.split("\n").slice(1)) {
|
|
1230
|
-
let e =
|
|
1303
|
+
let e = Sn(t);
|
|
1231
1304
|
if (e === void 0) continue;
|
|
1232
1305
|
let n = e.replace(/:\d+:\d+$/, "");
|
|
1233
|
-
if (
|
|
1306
|
+
if (xn === "" || n !== xn.replace(/:\d+:\d+$/, "")) return n;
|
|
1234
1307
|
}
|
|
1235
1308
|
return "<unknown>";
|
|
1236
|
-
},
|
|
1237
|
-
let r =
|
|
1309
|
+
}, wn = () => [...hn.values()], Tn = (e, t, n) => {
|
|
1310
|
+
let r = Cn(), i = bn(), a = hn.get(e);
|
|
1238
1311
|
if (a !== void 0) {
|
|
1239
|
-
let t =
|
|
1312
|
+
let t = gn.get(e) ?? "<unknown>", n = yn.get(e) === i;
|
|
1240
1313
|
if (r !== "<unknown>" && r === t && !n) return a;
|
|
1241
1314
|
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}`);
|
|
1242
1315
|
}
|
|
1243
|
-
let o = n?.persist, s = () =>
|
|
1316
|
+
let o = n?.persist, s = () => qt(o?.storage === "session" ? "session" : "local"), c = () => {
|
|
1244
1317
|
let e = s();
|
|
1245
1318
|
if (e === null || o === void 0) return;
|
|
1246
1319
|
let t;
|
|
@@ -1265,28 +1338,28 @@ var hn = () => {
|
|
|
1265
1338
|
t.setItem(o.key, JSON.stringify(n));
|
|
1266
1339
|
} catch {}
|
|
1267
1340
|
}, u = /* @__PURE__ */ new Map(), d = (n) => {
|
|
1268
|
-
let r = n ??
|
|
1341
|
+
let r = n ?? $t, i = u.get(r);
|
|
1269
1342
|
if (i === void 0) {
|
|
1270
1343
|
let a = n;
|
|
1271
|
-
i =
|
|
1344
|
+
i = nn(o !== void 0 && n === void 0 ? () => {
|
|
1272
1345
|
let e = t();
|
|
1273
1346
|
return f = e, {
|
|
1274
1347
|
...e,
|
|
1275
1348
|
...c() ?? {}
|
|
1276
1349
|
};
|
|
1277
1350
|
} : t, (t, n, r) => {
|
|
1278
|
-
if (o !== void 0 && a === void 0 && l(n), !
|
|
1351
|
+
if (o !== void 0 && a === void 0 && l(n), !fn && !pn) {
|
|
1279
1352
|
let e = m(a);
|
|
1280
1353
|
e.steps.length = e.cursor, e.steps.push({
|
|
1281
1354
|
prev: t,
|
|
1282
1355
|
next: n
|
|
1283
1356
|
}), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
|
|
1284
1357
|
}
|
|
1285
|
-
|
|
1358
|
+
mn({
|
|
1286
1359
|
store: e,
|
|
1287
1360
|
...a === void 0 ? {} : { key: a },
|
|
1288
1361
|
...r === void 0 ? {} : { label: r },
|
|
1289
|
-
...
|
|
1362
|
+
...fn || pn ? { isUndo: !0 } : {},
|
|
1290
1363
|
prev: t,
|
|
1291
1364
|
next: n,
|
|
1292
1365
|
at: Date.now()
|
|
@@ -1295,7 +1368,7 @@ var hn = () => {
|
|
|
1295
1368
|
}
|
|
1296
1369
|
return i;
|
|
1297
1370
|
}, f, p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
1298
|
-
let t = e ??
|
|
1371
|
+
let t = e ?? $t, n = p.get(t);
|
|
1299
1372
|
return n === void 0 && (n = {
|
|
1300
1373
|
steps: [],
|
|
1301
1374
|
cursor: 0
|
|
@@ -1327,12 +1400,12 @@ var hn = () => {
|
|
|
1327
1400
|
let n = o.current;
|
|
1328
1401
|
if (n.has && Object.is(n.state, t)) return n.value;
|
|
1329
1402
|
let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
|
|
1330
|
-
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r &&
|
|
1403
|
+
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && Yt(n.value, r)) {
|
|
1331
1404
|
let t = !0;
|
|
1332
1405
|
try {
|
|
1333
1406
|
t = !Object.is(i.current(n.state), n.value);
|
|
1334
1407
|
} catch {}
|
|
1335
|
-
|
|
1408
|
+
Qt(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.`);
|
|
1336
1409
|
}
|
|
1337
1410
|
let l = c ? n.value : r;
|
|
1338
1411
|
return o.current = {
|
|
@@ -1349,7 +1422,7 @@ var hn = () => {
|
|
|
1349
1422
|
r,
|
|
1350
1423
|
c,
|
|
1351
1424
|
l
|
|
1352
|
-
]), p = E(() => s(r.get()), [r, s]), m = E(() => s(
|
|
1425
|
+
]), p = E(() => s(r.get()), [r, s]), m = E(() => s(tn(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
|
|
1353
1426
|
r,
|
|
1354
1427
|
n?.key,
|
|
1355
1428
|
s
|
|
@@ -1367,11 +1440,11 @@ var hn = () => {
|
|
|
1367
1440
|
undo: (e) => {
|
|
1368
1441
|
let t = m(e);
|
|
1369
1442
|
if (t.cursor === 0) return !1;
|
|
1370
|
-
--t.cursor,
|
|
1443
|
+
--t.cursor, fn = !0;
|
|
1371
1444
|
try {
|
|
1372
1445
|
d(e).set(() => t.steps[t.cursor].prev, "undo");
|
|
1373
1446
|
} finally {
|
|
1374
|
-
|
|
1447
|
+
fn = !1;
|
|
1375
1448
|
}
|
|
1376
1449
|
return !0;
|
|
1377
1450
|
},
|
|
@@ -1379,11 +1452,11 @@ var hn = () => {
|
|
|
1379
1452
|
let t = m(e);
|
|
1380
1453
|
if (t.cursor >= t.steps.length) return !1;
|
|
1381
1454
|
let n = t.steps[t.cursor];
|
|
1382
|
-
t.cursor += 1,
|
|
1455
|
+
t.cursor += 1, fn = !0;
|
|
1383
1456
|
try {
|
|
1384
1457
|
d(e).set(() => n.next, "redo");
|
|
1385
1458
|
} finally {
|
|
1386
|
-
|
|
1459
|
+
fn = !1;
|
|
1387
1460
|
}
|
|
1388
1461
|
return !0;
|
|
1389
1462
|
},
|
|
@@ -1395,27 +1468,27 @@ var hn = () => {
|
|
|
1395
1468
|
release: (e) => {
|
|
1396
1469
|
u.delete(e), p.delete(e);
|
|
1397
1470
|
},
|
|
1398
|
-
keys: () => [...u.keys()].filter((e) => e !==
|
|
1471
|
+
keys: () => [...u.keys()].filter((e) => e !== $t)
|
|
1399
1472
|
};
|
|
1400
|
-
return
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1403
|
-
},
|
|
1404
|
-
|
|
1405
|
-
},
|
|
1406
|
-
let r =
|
|
1473
|
+
return hn.set(e, b), gn.set(e, r), yn.set(e, i), b;
|
|
1474
|
+
}, En = () => {
|
|
1475
|
+
hn.clear(), gn.clear(), yn.clear(), Zt.clear();
|
|
1476
|
+
}, Dn = () => ({ seeds: [] }), On = (e) => {
|
|
1477
|
+
en = e;
|
|
1478
|
+
}, kn = (e, t, n) => {
|
|
1479
|
+
let r = en?.() ?? null;
|
|
1407
1480
|
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.)`);
|
|
1408
1481
|
r.seeds.push({
|
|
1409
1482
|
store: e.name,
|
|
1410
1483
|
...n?.key === void 0 ? {} : { key: n.key },
|
|
1411
1484
|
value: t
|
|
1412
1485
|
});
|
|
1413
|
-
},
|
|
1486
|
+
}, An = (e) => {
|
|
1414
1487
|
if (e !== void 0) for (let t of e) {
|
|
1415
|
-
let e =
|
|
1488
|
+
let e = hn.get(t.store);
|
|
1416
1489
|
e !== void 0 && e.set(t.value, t.key);
|
|
1417
1490
|
}
|
|
1418
|
-
},
|
|
1491
|
+
}, q = (e, t) => {
|
|
1419
1492
|
let n = t.split("."), r = e;
|
|
1420
1493
|
for (let e = 0; e < n.length; e++) {
|
|
1421
1494
|
let i = n[e];
|
|
@@ -1434,15 +1507,15 @@ var hn = () => {
|
|
|
1434
1507
|
}
|
|
1435
1508
|
if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
|
|
1436
1509
|
return r;
|
|
1437
|
-
},
|
|
1510
|
+
}, jn = Object.freeze({
|
|
1438
1511
|
data: void 0,
|
|
1439
1512
|
revision: -1,
|
|
1440
1513
|
emittedAt: void 0,
|
|
1441
1514
|
error: void 0,
|
|
1442
1515
|
pendingPatches: 0
|
|
1443
|
-
}),
|
|
1444
|
-
function
|
|
1445
|
-
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } =
|
|
1516
|
+
}), Mn = () => jn;
|
|
1517
|
+
function J(e, t, n = {}, r = {}) {
|
|
1518
|
+
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = k(n);
|
|
1446
1519
|
u.current = n;
|
|
1447
1520
|
let d = k(s);
|
|
1448
1521
|
d.current = s;
|
|
@@ -1450,7 +1523,7 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
1450
1523
|
let e = u.current;
|
|
1451
1524
|
return {
|
|
1452
1525
|
queryKey: [t, e],
|
|
1453
|
-
fetch: () =>
|
|
1526
|
+
fetch: () => q(d.current, t)(e)
|
|
1454
1527
|
};
|
|
1455
1528
|
}, [t, f]), m = p.queryKey, h = E((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
|
|
1456
1529
|
o,
|
|
@@ -1458,11 +1531,11 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
1458
1531
|
l,
|
|
1459
1532
|
i,
|
|
1460
1533
|
p
|
|
1461
|
-
]), g = E(() => i ?
|
|
1534
|
+
]), g = E(() => i ? jn : o.peek(m), [
|
|
1462
1535
|
o,
|
|
1463
1536
|
i,
|
|
1464
1537
|
m
|
|
1465
|
-
]), _ = j(h, g,
|
|
1538
|
+
]), _ = j(h, g, Mn), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
|
|
1466
1539
|
revision: _.revision,
|
|
1467
1540
|
emittedAt: _.emittedAt,
|
|
1468
1541
|
error: _.error,
|
|
@@ -1519,35 +1592,35 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
1519
1592
|
}
|
|
1520
1593
|
//#endregion
|
|
1521
1594
|
//#region src/awaitResolvedApi.ts
|
|
1522
|
-
var
|
|
1523
|
-
if (!
|
|
1524
|
-
let r = Date.now() +
|
|
1525
|
-
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !
|
|
1526
|
-
throw Error(`Voltro: the api "${t}" did not resolve within ${
|
|
1527
|
-
},
|
|
1595
|
+
var Nn = 15e3, Y = async (e, t, n) => {
|
|
1596
|
+
if (!kt(e.current)) return e.current;
|
|
1597
|
+
let r = Date.now() + Nn;
|
|
1598
|
+
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !kt(e.current)) return e.current;
|
|
1599
|
+
throw Error(`Voltro: the api "${t}" did not resolve within ${Nn}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.`);
|
|
1600
|
+
}, X = async (e, t) => {
|
|
1528
1601
|
let n = await e.runPromiseExit(t);
|
|
1529
1602
|
if (P.isSuccess(n)) return n.value;
|
|
1530
1603
|
let r = M.squash(n.cause), i = M.failureOption(n.cause);
|
|
1531
|
-
throw
|
|
1532
|
-
},
|
|
1533
|
-
|
|
1534
|
-
},
|
|
1535
|
-
|
|
1536
|
-
for (let e of
|
|
1604
|
+
throw Se(r, ae.isSome(i) ? B(i.value, "handler") : "unknown");
|
|
1605
|
+
}, Pn = 100, Z = [], Fn = /* @__PURE__ */ new Set(), In = [], Ln = () => {
|
|
1606
|
+
In = Z.slice();
|
|
1607
|
+
}, Rn = () => {
|
|
1608
|
+
Ln();
|
|
1609
|
+
for (let e of Fn) try {
|
|
1537
1610
|
e();
|
|
1538
1611
|
} catch {}
|
|
1539
|
-
},
|
|
1612
|
+
}, zn = (e) => {
|
|
1540
1613
|
let t = {
|
|
1541
1614
|
...e,
|
|
1542
1615
|
status: "pending",
|
|
1543
1616
|
startedAt: Date.now()
|
|
1544
1617
|
};
|
|
1545
|
-
|
|
1546
|
-
},
|
|
1547
|
-
let n =
|
|
1618
|
+
Z.unshift(t), Z.length > Pn && (Z.length = Pn), Rn();
|
|
1619
|
+
}, Bn = (e, t) => {
|
|
1620
|
+
let n = Z.findIndex((t) => t.id === e);
|
|
1548
1621
|
if (n === -1) return;
|
|
1549
|
-
let r =
|
|
1550
|
-
|
|
1622
|
+
let r = Z[n], i = Date.now();
|
|
1623
|
+
Z[n] = t.status === "success" ? {
|
|
1551
1624
|
...r,
|
|
1552
1625
|
status: "success",
|
|
1553
1626
|
output: t.output,
|
|
@@ -1559,12 +1632,27 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1559
1632
|
error: t.error,
|
|
1560
1633
|
settledAt: i,
|
|
1561
1634
|
durationMs: i - r.startedAt
|
|
1562
|
-
},
|
|
1563
|
-
},
|
|
1564
|
-
|
|
1565
|
-
}),
|
|
1566
|
-
|
|
1567
|
-
},
|
|
1635
|
+
}, Rn();
|
|
1636
|
+
}, Vn = () => In, Hn = (e) => (Fn.add(e), () => {
|
|
1637
|
+
Fn.delete(e);
|
|
1638
|
+
}), Un = () => {
|
|
1639
|
+
Z.length !== 0 && (Z.length = 0, Rn());
|
|
1640
|
+
}, Wn = /* @__PURE__ */ new WeakMap(), Gn = (e, t) => {
|
|
1641
|
+
let n = Object.freeze({
|
|
1642
|
+
apiName: e,
|
|
1643
|
+
kind: "connection-setup"
|
|
1644
|
+
});
|
|
1645
|
+
return Wn.set(n, t), n;
|
|
1646
|
+
}, Kn = (e, t) => {
|
|
1647
|
+
let n = Wn.get(e);
|
|
1648
|
+
if (n === void 0 || e.apiName !== t) throw Error(`Voltro: connection setup must belong to api "${t}"`);
|
|
1649
|
+
return n;
|
|
1650
|
+
}, qn = /* @__PURE__ */ new WeakMap(), Jn = (e, t) => {
|
|
1651
|
+
qn.set(e, t);
|
|
1652
|
+
}, Yn = (e) => qn.get(e)?.capture(), Xn = 0, Zn = () => {
|
|
1653
|
+
let e = typeof crypto < "u" ? crypto : void 0;
|
|
1654
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${Xn += 1}`;
|
|
1655
|
+
}, Qn = (e, t) => e.pipe(N.locallyWith(ce.currentHeaders, (e) => se.set(e, "idempotency-key", t))), $n = (e, t) => {
|
|
1568
1656
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1569
1657
|
try {
|
|
1570
1658
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1574,18 +1662,15 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1574
1662
|
});
|
|
1575
1663
|
} catch {}
|
|
1576
1664
|
return e;
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1579
|
-
},
|
|
1580
|
-
let e = typeof crypto < "u" ? crypto : void 0;
|
|
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) => ({
|
|
1665
|
+
}, er, tr = (e) => {
|
|
1666
|
+
er = e;
|
|
1667
|
+
}, nr = () => er, rr = (e, t, n) => typeof e == "function" ? e(t, n) : e, ir = 0, ar = () => `mut_${++ir}`, or = (e, t) => ({
|
|
1583
1668
|
update: (n, r) => {
|
|
1584
1669
|
e.update(n, r, t);
|
|
1585
1670
|
},
|
|
1586
1671
|
forTag: (n, r) => e.forTag(n, r, t)
|
|
1587
|
-
}),
|
|
1588
|
-
let n =
|
|
1672
|
+
}), sr = (e, t) => {
|
|
1673
|
+
let n = K(e), { descriptors: r } = n, i = k(n);
|
|
1589
1674
|
i.current = n;
|
|
1590
1675
|
let a = r[t], o = a?.targets;
|
|
1591
1676
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -1595,13 +1680,13 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1595
1680
|
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) => {
|
|
1596
1681
|
let a = r?.onError !== void 0 || r?.notify?.error !== void 0, s = (e) => {
|
|
1597
1682
|
r?.onError?.(e, n);
|
|
1598
|
-
let t =
|
|
1599
|
-
t !== void 0 &&
|
|
1683
|
+
let t = rr(r?.notify?.error, e, n);
|
|
1684
|
+
t !== void 0 && er?.error(t);
|
|
1600
1685
|
};
|
|
1601
1686
|
c(!0), u(void 0);
|
|
1602
|
-
let l, d,
|
|
1687
|
+
let l, d, g, _;
|
|
1603
1688
|
try {
|
|
1604
|
-
({runtime: l, cache: d, client:
|
|
1689
|
+
_ = Yn(h), {runtime: l, cache: d, client: g} = await Y(i, e, t);
|
|
1605
1690
|
} catch (e) {
|
|
1606
1691
|
if (c(!1), u(e), i.current.errorBus.emit({
|
|
1607
1692
|
source: "mutation",
|
|
@@ -1612,95 +1697,111 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1612
1697
|
}), a) return s(e);
|
|
1613
1698
|
throw e;
|
|
1614
1699
|
}
|
|
1615
|
-
let
|
|
1616
|
-
|
|
1617
|
-
id:
|
|
1700
|
+
let v = ar(), y = r?.idempotencyKey ?? Zn();
|
|
1701
|
+
zn({
|
|
1702
|
+
id: v,
|
|
1618
1703
|
apiName: e,
|
|
1619
1704
|
tag: t,
|
|
1620
1705
|
input: n
|
|
1621
1706
|
});
|
|
1622
|
-
let
|
|
1623
|
-
if (
|
|
1624
|
-
|
|
1707
|
+
let b = p.current, x = m.current;
|
|
1708
|
+
if (b) try {
|
|
1709
|
+
b(or(d, v), n);
|
|
1625
1710
|
} catch (e) {
|
|
1626
|
-
if (u(e), c(!1), d.revertByMutation(
|
|
1711
|
+
if (u(e), c(!1), d.revertByMutation(v), Bn(v, {
|
|
1627
1712
|
status: "error",
|
|
1628
1713
|
error: e
|
|
1629
1714
|
}), a) return s(e);
|
|
1630
1715
|
throw e;
|
|
1631
1716
|
}
|
|
1632
|
-
else !
|
|
1633
|
-
let
|
|
1717
|
+
else !x && o && o.length > 0 && d.autoApply(o, n, v);
|
|
1718
|
+
let S, C = !1, w, T, E = Date.now();
|
|
1634
1719
|
try {
|
|
1635
|
-
let a = async (r,
|
|
1636
|
-
let
|
|
1637
|
-
|
|
1720
|
+
let a = async (r, a, o, s) => {
|
|
1721
|
+
let c = Ft(r), l = c?.getSnapshot();
|
|
1722
|
+
T = c === void 0 ? void 0 : () => i.current.runtime === r && l !== void 0 && c.getSnapshot() === l, s?.();
|
|
1723
|
+
let u = _ === void 0 ? void 0 : await _.prepare(r, a);
|
|
1724
|
+
l = c?.getSnapshot(), s?.();
|
|
1725
|
+
let d = Qn(q(a, t)(n), y), f = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1726
|
+
S = e.traceId, ye({
|
|
1638
1727
|
traceId: e.traceId,
|
|
1639
1728
|
spanId: e.spanId,
|
|
1640
1729
|
source: "mutation",
|
|
1641
1730
|
tag: t
|
|
1642
1731
|
});
|
|
1643
|
-
})), N.catchAll(() => N.void), N.zipRight(
|
|
1732
|
+
})), N.catchAll(() => N.void), N.zipRight(N.try({
|
|
1733
|
+
try: () => {
|
|
1734
|
+
s?.(), C = !0;
|
|
1735
|
+
},
|
|
1736
|
+
catch: (e) => e
|
|
1737
|
+
})), N.zipRight(d)).pipe(N.withSpan(`client.mutation.${t}`, { attributes: {
|
|
1644
1738
|
"voltro.api": e,
|
|
1645
|
-
"voltro.mutationId":
|
|
1739
|
+
"voltro.mutationId": v,
|
|
1646
1740
|
"rpc.tag": t,
|
|
1647
|
-
"voltro.replay":
|
|
1741
|
+
"voltro.replay": o
|
|
1648
1742
|
} }));
|
|
1649
|
-
return
|
|
1743
|
+
return u === void 0 ? X(r, f) : u.run(f);
|
|
1650
1744
|
}, o;
|
|
1651
1745
|
try {
|
|
1652
|
-
o = await a(l,
|
|
1746
|
+
o = await a(l, g, !1);
|
|
1653
1747
|
} catch (n) {
|
|
1654
|
-
let r =
|
|
1748
|
+
let r = B(n, C ? "handler" : "client"), s = $n(n, S);
|
|
1655
1749
|
r === "transport" && (i.current.errorBus.emit({
|
|
1656
1750
|
source: "mutation",
|
|
1657
1751
|
tag: t,
|
|
1658
1752
|
error: s,
|
|
1659
1753
|
kind: r,
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1754
|
+
...T === void 0 ? {} : { affectsTransport: T() },
|
|
1755
|
+
outcome: C ? "unknown" : "not-started",
|
|
1756
|
+
...S === void 0 ? {} : { traceId: S }
|
|
1757
|
+
}), w = s);
|
|
1758
|
+
let c = i.current, l = c.recovery ?? pt(c.errorBus, e), u = r === "transport" ? l.reserveMutationReplay(E) : void 0;
|
|
1664
1759
|
if (u === void 0) throw s;
|
|
1665
1760
|
try {
|
|
1666
|
-
if (!await l.waitForMutationReplaySupport(
|
|
1667
|
-
let n =
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
let
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1761
|
+
if (!await l.waitForMutationReplaySupport(E) || !await l.waitForProtocolReady(E) || !u.isValid()) throw s;
|
|
1762
|
+
let n = () => {
|
|
1763
|
+
if (!u.isValid()) throw s;
|
|
1764
|
+
};
|
|
1765
|
+
for (;;) {
|
|
1766
|
+
n();
|
|
1767
|
+
let r = await Y(i, e, t);
|
|
1768
|
+
try {
|
|
1769
|
+
o = await a(r.runtime, r.client, !0, n);
|
|
1770
|
+
break;
|
|
1771
|
+
} catch (e) {
|
|
1772
|
+
let t = e;
|
|
1773
|
+
if (t?._tag !== "MutationInFlight") throw e;
|
|
1774
|
+
let r = typeof t.retryAfterMs == "number" && Number.isFinite(t.retryAfterMs) && t.retryAfterMs > 0 ? t.retryAfterMs : 1e3;
|
|
1775
|
+
if (r >= l.replayWindowRemaining(E)) throw e;
|
|
1776
|
+
await new Promise((e) => setTimeout(e, r)), n();
|
|
1777
|
+
}
|
|
1678
1778
|
}
|
|
1679
1779
|
} finally {
|
|
1680
1780
|
u.release();
|
|
1681
1781
|
}
|
|
1682
1782
|
}
|
|
1683
|
-
f(o),
|
|
1783
|
+
f(o), Bn(v, {
|
|
1684
1784
|
status: "success",
|
|
1685
1785
|
output: o
|
|
1686
1786
|
}), i.current.errorBus.emitSuccess({
|
|
1687
1787
|
source: "mutation",
|
|
1688
1788
|
tag: t
|
|
1689
|
-
}), d.confirmByMutation(
|
|
1690
|
-
let s =
|
|
1691
|
-
return s !== void 0 &&
|
|
1789
|
+
}), d.confirmByMutation(v), r?.onSuccess?.(o, n);
|
|
1790
|
+
let s = rr(r?.notify?.success, o, n);
|
|
1791
|
+
return s !== void 0 && er?.success(s), o;
|
|
1692
1792
|
} catch (e) {
|
|
1693
|
-
let n =
|
|
1694
|
-
if (u(n),
|
|
1793
|
+
let n = $n(e, S);
|
|
1794
|
+
if (u(n), Bn(v, {
|
|
1695
1795
|
status: "error",
|
|
1696
1796
|
error: n
|
|
1697
|
-
}), d.revertByMutation(
|
|
1797
|
+
}), d.revertByMutation(v), Object.is(w, n) || i.current.errorBus.emit({
|
|
1698
1798
|
source: "mutation",
|
|
1699
1799
|
tag: t,
|
|
1700
1800
|
error: n,
|
|
1701
|
-
kind:
|
|
1702
|
-
|
|
1703
|
-
|
|
1801
|
+
kind: C ? B(e, "handler") : "client",
|
|
1802
|
+
...T === void 0 ? {} : { affectsTransport: T() },
|
|
1803
|
+
outcome: C && B(e, "handler") === "transport" ? "unknown" : C ? "known" : "not-started",
|
|
1804
|
+
...S === void 0 ? {} : { traceId: S }
|
|
1704
1805
|
}), a) return s(n);
|
|
1705
1806
|
throw n;
|
|
1706
1807
|
} finally {
|
|
@@ -1712,22 +1813,24 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1712
1813
|
o
|
|
1713
1814
|
]);
|
|
1714
1815
|
return O(() => {
|
|
1715
|
-
let
|
|
1816
|
+
let t = {
|
|
1716
1817
|
mutate: h,
|
|
1717
1818
|
pending: s,
|
|
1718
1819
|
error: l,
|
|
1719
1820
|
data: d,
|
|
1720
|
-
withOptimistic: (
|
|
1721
|
-
withoutOptimistic: () => (m.current = !0,
|
|
1821
|
+
withOptimistic: (e) => (p.current = e, t),
|
|
1822
|
+
withoutOptimistic: () => (m.current = !0, t),
|
|
1823
|
+
withConnectionSetup: (n) => (Jn(h, Kn(n, e)), t)
|
|
1722
1824
|
};
|
|
1723
|
-
return
|
|
1825
|
+
return t;
|
|
1724
1826
|
}, [
|
|
1725
1827
|
h,
|
|
1726
1828
|
s,
|
|
1727
1829
|
l,
|
|
1728
|
-
d
|
|
1830
|
+
d,
|
|
1831
|
+
e
|
|
1729
1832
|
]);
|
|
1730
|
-
},
|
|
1833
|
+
}, cr = (e, t) => {
|
|
1731
1834
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
1732
1835
|
try {
|
|
1733
1836
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -1737,8 +1840,8 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1737
1840
|
});
|
|
1738
1841
|
} catch {}
|
|
1739
1842
|
return e;
|
|
1740
|
-
},
|
|
1741
|
-
let n =
|
|
1843
|
+
}, lr = (e, t, n) => typeof e == "function" ? e(t, n) : e, ur = 0, dr = () => `act_${++ur}`, fr = (e, t) => {
|
|
1844
|
+
let n = K(e), { descriptors: r } = n, i = k(n);
|
|
1742
1845
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
1743
1846
|
let n = r[t]?.kind;
|
|
1744
1847
|
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.`);
|
|
@@ -1746,8 +1849,8 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1746
1849
|
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = E(async (n, r) => {
|
|
1747
1850
|
let a = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
1748
1851
|
o(!0), c(void 0);
|
|
1749
|
-
let s =
|
|
1750
|
-
|
|
1852
|
+
let s = dr(), l = r?.idempotencyKey ?? Zn();
|
|
1853
|
+
zn({
|
|
1751
1854
|
id: s,
|
|
1752
1855
|
apiName: e,
|
|
1753
1856
|
tag: t,
|
|
@@ -1755,45 +1858,45 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1755
1858
|
});
|
|
1756
1859
|
let d, f = !1;
|
|
1757
1860
|
try {
|
|
1758
|
-
let { runtime: a, client: o } = await
|
|
1759
|
-
d = e.traceId,
|
|
1861
|
+
let { runtime: a, client: o } = await Y(i, e, t), c = q(o, t), p = N.currentSpan.pipe(N.tap((e) => N.sync(() => {
|
|
1862
|
+
d = e.traceId, ye({
|
|
1760
1863
|
traceId: e.traceId,
|
|
1761
1864
|
spanId: e.spanId,
|
|
1762
1865
|
source: "action",
|
|
1763
1866
|
tag: t
|
|
1764
1867
|
});
|
|
1765
|
-
})), N.catchAll(() => N.void), N.zipRight(
|
|
1868
|
+
})), N.catchAll(() => N.void), N.zipRight(Qn(c(n), l))).pipe(N.withSpan(`client.action.${t}`, { attributes: {
|
|
1766
1869
|
"voltro.api": e,
|
|
1767
1870
|
"voltro.actionId": s,
|
|
1768
1871
|
"rpc.tag": t
|
|
1769
1872
|
} }));
|
|
1770
1873
|
f = !0;
|
|
1771
|
-
let m = await
|
|
1772
|
-
u(m),
|
|
1874
|
+
let m = await X(a, p);
|
|
1875
|
+
u(m), Bn(s, {
|
|
1773
1876
|
status: "success",
|
|
1774
1877
|
output: m
|
|
1775
1878
|
}), i.current.errorBus.emitSuccess({
|
|
1776
1879
|
source: "action",
|
|
1777
1880
|
tag: t
|
|
1778
1881
|
}), r?.onSuccess?.(m, n);
|
|
1779
|
-
let h =
|
|
1780
|
-
return h !== void 0 &&
|
|
1882
|
+
let h = lr(r?.notify?.success, m, n);
|
|
1883
|
+
return h !== void 0 && nr()?.success(h), m;
|
|
1781
1884
|
} catch (e) {
|
|
1782
|
-
let o =
|
|
1783
|
-
if (c(o),
|
|
1885
|
+
let o = cr(e, d);
|
|
1886
|
+
if (c(o), Bn(s, {
|
|
1784
1887
|
status: "error",
|
|
1785
1888
|
error: o
|
|
1786
1889
|
}), i.current.errorBus.emit({
|
|
1787
1890
|
source: "action",
|
|
1788
1891
|
tag: t,
|
|
1789
1892
|
error: o,
|
|
1790
|
-
kind: f ?
|
|
1791
|
-
outcome: f &&
|
|
1893
|
+
kind: f ? B(e, "handler") : "client",
|
|
1894
|
+
outcome: f && B(e, "handler") === "transport" ? "unknown" : f ? "known" : "not-started",
|
|
1792
1895
|
...d === void 0 ? {} : { traceId: d }
|
|
1793
1896
|
}), a) {
|
|
1794
1897
|
r?.onError?.(o, n);
|
|
1795
|
-
let e =
|
|
1796
|
-
e !== void 0 &&
|
|
1898
|
+
let e = lr(r?.notify?.error, o, n);
|
|
1899
|
+
e !== void 0 && nr()?.error(e);
|
|
1797
1900
|
return;
|
|
1798
1901
|
}
|
|
1799
1902
|
throw o;
|
|
@@ -1812,14 +1915,14 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1812
1915
|
s,
|
|
1813
1916
|
l
|
|
1814
1917
|
]);
|
|
1815
|
-
},
|
|
1918
|
+
}, pr = w(void 0), mr = (e) => T(pr.Provider, { value: e.messages }, e.children), hr = () => ee(pr), gr = Symbol.for("voltro.client.formEngine"), _r = w(void 0), vr = (e, t) => {
|
|
1816
1919
|
let n = e;
|
|
1817
1920
|
for (let e of t.split(".")) {
|
|
1818
1921
|
if (typeof n != "object" || !n) return;
|
|
1819
1922
|
n = n[e];
|
|
1820
1923
|
}
|
|
1821
1924
|
return n;
|
|
1822
|
-
},
|
|
1925
|
+
}, yr = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), br = {
|
|
1823
1926
|
isTouched: !1,
|
|
1824
1927
|
isBlurred: !1,
|
|
1825
1928
|
isDirty: !1,
|
|
@@ -1828,15 +1931,15 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1828
1931
|
isValidating: !1,
|
|
1829
1932
|
errorMap: {},
|
|
1830
1933
|
errorSourceMap: {}
|
|
1831
|
-
},
|
|
1934
|
+
}, xr = (e, t) => {
|
|
1832
1935
|
let n = e.find((e) => e.name === t);
|
|
1833
1936
|
if (n !== void 0) return n;
|
|
1834
1937
|
let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
|
|
1835
1938
|
if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
|
|
1836
|
-
},
|
|
1837
|
-
let r =
|
|
1939
|
+
}, Sr = (e, t, n) => {
|
|
1940
|
+
let r = K(e), a = k(void 0), o = typeof t == "function" ? t(a.current?.state?.values ?? n.defaults ?? {}) : t, s = k(o).current, c = sr(e, o), l = n.schema ?? r.descriptors[o]?.input;
|
|
1838
1941
|
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.`);
|
|
1839
|
-
let u = O(() => l ? x(l) : [], [l]), d =
|
|
1942
|
+
let u = O(() => l ? x(l) : [], [l]), d = hr(), f = n.messages ?? d, p = O(() => ({
|
|
1840
1943
|
...n.locale === void 0 ? {} : { locale: n.locale },
|
|
1841
1944
|
...f === void 0 ? {} : { messages: f }
|
|
1842
1945
|
}), [n.locale, f]), m = k(n.asyncFields);
|
|
@@ -1863,7 +1966,7 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1863
1966
|
let o = n.errorPath ?? {};
|
|
1864
1967
|
return a.map((t) => {
|
|
1865
1968
|
let n = o[t.path];
|
|
1866
|
-
return n === void 0 ? (
|
|
1969
|
+
return n === void 0 ? (vr(e, t.path) !== void 0 || t.path.includes("."), t) : {
|
|
1867
1970
|
...t,
|
|
1868
1971
|
path: n
|
|
1869
1972
|
};
|
|
@@ -1878,7 +1981,7 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1878
1981
|
...ne(n.defaults),
|
|
1879
1982
|
...e.values
|
|
1880
1983
|
};
|
|
1881
|
-
a.current = new
|
|
1984
|
+
a.current = new he({
|
|
1882
1985
|
onSubmit: ({ value: e }) => re.current(e),
|
|
1883
1986
|
defaultValues: t,
|
|
1884
1987
|
validators: { onChange: ({ value: e }) => {
|
|
@@ -1893,20 +1996,20 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1893
1996
|
let N = a.current, P = N;
|
|
1894
1997
|
D(() => P.mount(), [P]);
|
|
1895
1998
|
let ie = n.subscribe ?? "all";
|
|
1896
|
-
|
|
1897
|
-
let F = N.store.state.values, I = N.store.state,
|
|
1898
|
-
if (
|
|
1899
|
-
if (
|
|
1900
|
-
if (
|
|
1901
|
-
let t =
|
|
1902
|
-
return t === void 0 ? !1 :
|
|
1999
|
+
ge(N.store, (e) => ie === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
|
|
2000
|
+
let F = N.store.state.values, I = N.store.state, ae = O(() => M(F), [M, F]), L = n.isLoading === !0, oe = n.validate, R = oe?.onChange ?? "afterTouched", se = oe?.onBlur ?? !0, ce = I.submissionAttempts, le = I.fieldMetaBase ?? {}, ue = E((e) => {
|
|
2001
|
+
if (L) return !1;
|
|
2002
|
+
if (ce > 0 || R === "always") return !0;
|
|
2003
|
+
if (R === "never") return !1;
|
|
2004
|
+
let t = le[e];
|
|
2005
|
+
return t === void 0 ? !1 : se ? t.isBlurred === !0 : t.isTouched === !0;
|
|
1903
2006
|
}, [
|
|
1904
|
-
se,
|
|
1905
2007
|
ce,
|
|
2008
|
+
le,
|
|
2009
|
+
L,
|
|
1906
2010
|
R,
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
]), ue = E((e) => {
|
|
2011
|
+
se
|
|
2012
|
+
]), de = E((e) => {
|
|
1910
2013
|
let t = y[e];
|
|
1911
2014
|
if (t !== void 0) return t;
|
|
1912
2015
|
let n = m.current?.[e];
|
|
@@ -1914,41 +2017,41 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1914
2017
|
id: "validation.invalid",
|
|
1915
2018
|
fallback: "Invalid value"
|
|
1916
2019
|
}, _.current);
|
|
1917
|
-
if (!
|
|
1918
|
-
let r =
|
|
2020
|
+
if (!ue(e)) return;
|
|
2021
|
+
let r = ae.find((t) => t.path === e);
|
|
1919
2022
|
return r === void 0 ? void 0 : b(r, _.current);
|
|
1920
2023
|
}, [
|
|
1921
2024
|
y,
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
]),
|
|
1925
|
-
let e = {}, t = /* @__PURE__ */ new Set([...
|
|
2025
|
+
ue,
|
|
2026
|
+
ae
|
|
2027
|
+
]), pe = O(() => {
|
|
2028
|
+
let e = {}, t = /* @__PURE__ */ new Set([...ae.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(y)]);
|
|
1926
2029
|
for (let [e, n] of Object.entries(m.current ?? {})) n.status === "invalid" && t.add(e);
|
|
1927
2030
|
for (let n of t) {
|
|
1928
|
-
let t =
|
|
2031
|
+
let t = de(n);
|
|
1929
2032
|
t !== void 0 && (e[n] = t);
|
|
1930
2033
|
}
|
|
1931
2034
|
return e;
|
|
1932
2035
|
}, [
|
|
1933
|
-
|
|
2036
|
+
ae,
|
|
1934
2037
|
y,
|
|
1935
|
-
|
|
1936
|
-
]),
|
|
2038
|
+
de
|
|
2039
|
+
]), z = E((e) => {
|
|
1937
2040
|
S((t) => {
|
|
1938
2041
|
if (!(e in t)) return t;
|
|
1939
2042
|
let n = { ...t };
|
|
1940
2043
|
return delete n[e], n;
|
|
1941
2044
|
});
|
|
1942
|
-
}, []),
|
|
1943
|
-
let n =
|
|
2045
|
+
}, []), me = E((t) => {
|
|
2046
|
+
let n = xr(u, t), r = P.getFieldMeta(t), i = de(t), a = yr(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);
|
|
1944
2047
|
return {
|
|
1945
2048
|
value: P.getFieldValue(t),
|
|
1946
2049
|
setValue: (e) => {
|
|
1947
|
-
|
|
2050
|
+
z(t), !Object.is(P.getFieldValue(t), e) && P.setFieldValue(t, e);
|
|
1948
2051
|
},
|
|
1949
2052
|
onBlur: () => {
|
|
1950
2053
|
P.setFieldMeta(t, (e) => ({
|
|
1951
|
-
...
|
|
2054
|
+
...br,
|
|
1952
2055
|
...e ?? {},
|
|
1953
2056
|
isTouched: !0,
|
|
1954
2057
|
isBlurred: !0
|
|
@@ -1975,12 +2078,12 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1975
2078
|
}, [
|
|
1976
2079
|
e,
|
|
1977
2080
|
s,
|
|
1978
|
-
|
|
2081
|
+
z,
|
|
1979
2082
|
P,
|
|
1980
2083
|
u,
|
|
1981
2084
|
y,
|
|
1982
|
-
|
|
1983
|
-
]),
|
|
2085
|
+
de
|
|
2086
|
+
]), _e = E((e) => ({
|
|
1984
2087
|
items: P.getFieldValue(e) ?? [],
|
|
1985
2088
|
push: (t) => {
|
|
1986
2089
|
P.pushFieldValue(e, t);
|
|
@@ -1997,14 +2100,14 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
1997
2100
|
swap: (t, n) => {
|
|
1998
2101
|
P.swapFieldValues(e, t, n);
|
|
1999
2102
|
},
|
|
2000
|
-
field: (t, n) =>
|
|
2001
|
-
}), [P,
|
|
2002
|
-
|
|
2003
|
-
}, [
|
|
2103
|
+
field: (t, n) => me(`${e}.${t}.${n}`)
|
|
2104
|
+
}), [P, me]), ve = E((e) => u.filter((t) => t.section === e), [u]), ye = E((e, t) => {
|
|
2105
|
+
z(e), !Object.is(P.getFieldValue(e), t) && P.setFieldValue(e, t);
|
|
2106
|
+
}, [z, P]), be = E((e) => {
|
|
2004
2107
|
for (let [t, n] of Object.entries(e)) P.setFieldValue(t, n);
|
|
2005
|
-
}, [P]),
|
|
2108
|
+
}, [P]), xe = E((e) => {
|
|
2006
2109
|
S({}), T(void 0), te(void 0), j.current = void 0, e === void 0 ? P.reset() : P.reset(ne(e));
|
|
2007
|
-
}, [P, ne]),
|
|
2110
|
+
}, [P, ne]), Se = n.asyncTimeoutMs ?? 5e3, B = E(async () => {
|
|
2008
2111
|
let e = Date.now();
|
|
2009
2112
|
for (;;) {
|
|
2010
2113
|
let t = m.current;
|
|
@@ -2017,18 +2120,18 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2017
2120
|
fallback: "Invalid value"
|
|
2018
2121
|
}, _.current)]));
|
|
2019
2122
|
}
|
|
2020
|
-
if (Date.now() - e >
|
|
2123
|
+
if (Date.now() - e > Se) return Object.fromEntries(r.map(([e]) => [e, b({
|
|
2021
2124
|
id: "validation.checking",
|
|
2022
2125
|
fallback: "Still checking…"
|
|
2023
2126
|
}, _.current)]));
|
|
2024
2127
|
await new Promise((e) => setTimeout(e, 50));
|
|
2025
2128
|
}
|
|
2026
|
-
}, [
|
|
2129
|
+
}, [Se]), Ce = E(() => {
|
|
2027
2130
|
let t = globalThis.document;
|
|
2028
2131
|
if (t?.getElementById === void 0) return;
|
|
2029
2132
|
let n = [...u.map((e) => e.name), ...Object.keys(y).filter((e) => !u.some((t) => t.name === e))];
|
|
2030
|
-
for (let r of n) if (
|
|
2031
|
-
t.getElementById(
|
|
2133
|
+
for (let r of n) if (de(r) !== void 0) {
|
|
2134
|
+
t.getElementById(yr(e, s, r))?.focus?.();
|
|
2032
2135
|
return;
|
|
2033
2136
|
}
|
|
2034
2137
|
}, [
|
|
@@ -2036,17 +2139,17 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2036
2139
|
s,
|
|
2037
2140
|
u,
|
|
2038
2141
|
y,
|
|
2039
|
-
|
|
2040
|
-
]),
|
|
2041
|
-
|
|
2042
|
-
let
|
|
2142
|
+
de
|
|
2143
|
+
]), V = k(Ce);
|
|
2144
|
+
V.current = Ce;
|
|
2145
|
+
let we = E(async () => {
|
|
2043
2146
|
T(void 0), S({}), te(void 0), j.current = void 0;
|
|
2044
2147
|
let e, t = !1;
|
|
2045
2148
|
if (await P.handleSubmit().catch((n) => {
|
|
2046
2149
|
t = !0, e = n;
|
|
2047
2150
|
}), t) throw e;
|
|
2048
2151
|
return j.current === void 0 && queueMicrotask(() => {
|
|
2049
|
-
|
|
2152
|
+
V.current();
|
|
2050
2153
|
}), j.current;
|
|
2051
2154
|
}, [P]);
|
|
2052
2155
|
re.current = (async (e) => {
|
|
@@ -2059,7 +2162,7 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2059
2162
|
}
|
|
2060
2163
|
if (M(n).length > 0) {
|
|
2061
2164
|
queueMicrotask(() => {
|
|
2062
|
-
|
|
2165
|
+
V.current();
|
|
2063
2166
|
});
|
|
2064
2167
|
return;
|
|
2065
2168
|
}
|
|
@@ -2068,13 +2171,13 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2068
2171
|
let e = C(i, r);
|
|
2069
2172
|
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;
|
|
2070
2173
|
}
|
|
2071
|
-
let a = await
|
|
2174
|
+
let a = await B();
|
|
2072
2175
|
if (a !== void 0) {
|
|
2073
2176
|
S((e) => ({
|
|
2074
2177
|
...e,
|
|
2075
2178
|
...a
|
|
2076
2179
|
})), queueMicrotask(() => {
|
|
2077
|
-
|
|
2180
|
+
V.current();
|
|
2078
2181
|
});
|
|
2079
2182
|
return;
|
|
2080
2183
|
}
|
|
@@ -2087,7 +2190,7 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2087
2190
|
});
|
|
2088
2191
|
j.current = e, t.onSuccess?.(e);
|
|
2089
2192
|
} catch (e) {
|
|
2090
|
-
let t =
|
|
2193
|
+
let t = fe(e);
|
|
2091
2194
|
if (t.length === 0) {
|
|
2092
2195
|
te(e), h.current.onError?.(e);
|
|
2093
2196
|
return;
|
|
@@ -2102,141 +2205,407 @@ var Tn = 15e3, X = async (e, t, n) => {
|
|
|
2102
2205
|
...e,
|
|
2103
2206
|
...n
|
|
2104
2207
|
})), queueMicrotask(() => {
|
|
2105
|
-
|
|
2208
|
+
V.current();
|
|
2106
2209
|
});
|
|
2107
2210
|
}
|
|
2108
2211
|
});
|
|
2109
|
-
let
|
|
2110
|
-
for (let e of u) if (
|
|
2111
|
-
let e = Object.keys(
|
|
2212
|
+
let Te = ae.length === 0, Ee = Object.values(m.current ?? {}).some((e) => e.status === "checking"), De = ee ?? c.error, H = De !== void 0 && fe(De).length > 0 ? void 0 : De, Oe = Object.keys(pe).length, ke = (() => {
|
|
2213
|
+
for (let e of u) if (pe[e.name] !== void 0) return e.name;
|
|
2214
|
+
let e = Object.keys(pe);
|
|
2112
2215
|
return e.length > 0 ? e[0] : void 0;
|
|
2113
|
-
})(),
|
|
2114
|
-
isDirty: !
|
|
2216
|
+
})(), Ae = {
|
|
2217
|
+
isDirty: !L && I.isDirty,
|
|
2115
2218
|
isPristine: I.isPristine,
|
|
2116
2219
|
isTouched: I.isTouched,
|
|
2117
|
-
isValid:
|
|
2118
|
-
isValidating:
|
|
2119
|
-
canSubmit:
|
|
2220
|
+
isValid: Te,
|
|
2221
|
+
isValidating: Ee,
|
|
2222
|
+
canSubmit: Te && !Ee && !I.isSubmitting && !L,
|
|
2120
2223
|
isSubmitting: I.isSubmitting,
|
|
2121
2224
|
isSubmitted: I.isSubmitted,
|
|
2122
2225
|
isSubmitSuccessful: I.isSubmitSuccessful && j.current !== void 0,
|
|
2123
2226
|
submissionAttempts: I.submissionAttempts,
|
|
2124
|
-
errorCount:
|
|
2125
|
-
firstInvalidPath:
|
|
2227
|
+
errorCount: Oe,
|
|
2228
|
+
firstInvalidPath: ke,
|
|
2126
2229
|
pending: c.pending,
|
|
2127
|
-
isLoading:
|
|
2128
|
-
submitError:
|
|
2230
|
+
isLoading: L,
|
|
2231
|
+
submitError: H,
|
|
2129
2232
|
data: c.data
|
|
2130
|
-
},
|
|
2233
|
+
}, je = {
|
|
2131
2234
|
fields: u,
|
|
2132
2235
|
values: F,
|
|
2133
|
-
errors:
|
|
2134
|
-
issues:
|
|
2135
|
-
isValid:
|
|
2236
|
+
errors: pe,
|
|
2237
|
+
issues: ae,
|
|
2238
|
+
isValid: Te,
|
|
2136
2239
|
pending: c.pending,
|
|
2137
|
-
submitError:
|
|
2240
|
+
submitError: H,
|
|
2138
2241
|
formError: w,
|
|
2139
2242
|
data: c.data,
|
|
2140
|
-
setValue:
|
|
2141
|
-
setValues:
|
|
2142
|
-
reset:
|
|
2143
|
-
submit:
|
|
2144
|
-
field:
|
|
2145
|
-
array:
|
|
2146
|
-
section:
|
|
2147
|
-
state:
|
|
2148
|
-
focusFirstInvalid:
|
|
2243
|
+
setValue: ye,
|
|
2244
|
+
setValues: be,
|
|
2245
|
+
reset: xe,
|
|
2246
|
+
submit: we,
|
|
2247
|
+
field: me,
|
|
2248
|
+
array: _e,
|
|
2249
|
+
section: ve,
|
|
2250
|
+
state: Ae,
|
|
2251
|
+
focusFirstInvalid: Ce
|
|
2149
2252
|
};
|
|
2150
|
-
return Object.defineProperty(
|
|
2253
|
+
return Object.defineProperty(je, gr, {
|
|
2151
2254
|
value: {
|
|
2152
2255
|
store: N.store,
|
|
2153
|
-
field:
|
|
2256
|
+
field: me
|
|
2154
2257
|
},
|
|
2155
2258
|
enumerable: !1
|
|
2156
|
-
}),
|
|
2157
|
-
},
|
|
2158
|
-
function
|
|
2159
|
-
let n = ee(
|
|
2259
|
+
}), je;
|
|
2260
|
+
}, Cr = (e) => T(_r.Provider, { value: e.binding }, e.children), wr = () => ee(_r);
|
|
2261
|
+
function Tr(e, t) {
|
|
2262
|
+
let n = ee(_r), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
|
|
2160
2263
|
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.");
|
|
2161
|
-
let o = a[
|
|
2264
|
+
let o = a[gr];
|
|
2162
2265
|
if (o === void 0) throw Error("useFormField: not a useFormBinding result");
|
|
2163
|
-
return
|
|
2266
|
+
return ge(o.store, (e) => {
|
|
2164
2267
|
let t = e.fieldMetaBase[i];
|
|
2165
|
-
return `${JSON.stringify(
|
|
2268
|
+
return `${JSON.stringify(vr(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
|
|
2166
2269
|
}), o.field(i);
|
|
2167
2270
|
}
|
|
2168
2271
|
//#endregion
|
|
2169
|
-
//#region src/
|
|
2170
|
-
var
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2272
|
+
//#region src/connectionPrerequisite.ts
|
|
2273
|
+
var Q = class extends Error {
|
|
2274
|
+
reason;
|
|
2275
|
+
_tag = "ConnectionPrerequisiteInvalidated";
|
|
2276
|
+
constructor(e) {
|
|
2277
|
+
super(`Voltro connection prerequisite: ${e}`), this.reason = e, Se(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
|
|
2278
|
+
}
|
|
2279
|
+
}, Er = class {
|
|
2280
|
+
#e;
|
|
2281
|
+
#t;
|
|
2282
|
+
#n = /* @__PURE__ */ new WeakMap();
|
|
2283
|
+
#r = /* @__PURE__ */ new WeakSet();
|
|
2284
|
+
constructor(e, t) {
|
|
2285
|
+
if (!Number.isFinite(t) || t <= 0 || t > 6e4) throw RangeError("Connection prerequisite timeout must be between 0 and 60000 ms");
|
|
2286
|
+
this.#e = e, this.#t = t;
|
|
2287
|
+
}
|
|
2288
|
+
prepare(e, t) {
|
|
2289
|
+
let n = Ft(e)?.getSnapshot();
|
|
2290
|
+
if (this.#e.aborted) return Promise.reject(new Q("inactive"));
|
|
2291
|
+
if (n === void 0) return Promise.reject(new Q("connection-unavailable"));
|
|
2292
|
+
let r = this.#n.get(n);
|
|
2293
|
+
if (r !== void 0) return r.then((t) => (this.assertCurrent(e, t), t));
|
|
2294
|
+
let i = X(e, this.#a(e, n, t).pipe(N.timeoutFail({
|
|
2295
|
+
duration: this.#t,
|
|
2296
|
+
onTimeout: () => new Q("timeout")
|
|
2297
|
+
}))).then((t) => {
|
|
2298
|
+
let r = Object.freeze({
|
|
2299
|
+
lease: n,
|
|
2300
|
+
output: t
|
|
2301
|
+
});
|
|
2302
|
+
return this.#r.add(r), this.assertCurrent(e, r), r;
|
|
2303
|
+
});
|
|
2304
|
+
return this.#n.set(n, i), i.catch(() => {
|
|
2305
|
+
this.#n.get(n) === i && this.#n.delete(n);
|
|
2306
|
+
}), i;
|
|
2307
|
+
}
|
|
2308
|
+
assertCurrent(e, t) {
|
|
2309
|
+
if (!this.#r.has(t)) throw new Q("inactive");
|
|
2310
|
+
this.#i(e, t.lease);
|
|
2311
|
+
}
|
|
2312
|
+
#i(e, t) {
|
|
2313
|
+
if (this.#e.aborted) throw new Q("inactive");
|
|
2314
|
+
if (t.signal.aborted || Ft(e)?.getSnapshot() !== t) throw new Q("connection-changed");
|
|
2315
|
+
}
|
|
2316
|
+
run(e, t, n) {
|
|
2317
|
+
let r = N.try({
|
|
2318
|
+
try: () => this.assertCurrent(e, t),
|
|
2319
|
+
catch: (e) => e
|
|
2320
|
+
}).pipe(N.zipRight(n));
|
|
2321
|
+
return X(e, this.#a(e, t.lease, r));
|
|
2322
|
+
}
|
|
2323
|
+
#a(e, t, n) {
|
|
2324
|
+
let r = N.try({
|
|
2325
|
+
try: () => this.#i(e, t),
|
|
2326
|
+
catch: (e) => e
|
|
2327
|
+
}), i = N.async((e) => {
|
|
2328
|
+
let n = () => e(N.fail(new Q(this.#e.aborted ? "inactive" : "connection-changed")));
|
|
2329
|
+
return this.#e.addEventListener("abort", n, { once: !0 }), t.signal.addEventListener("abort", n, { once: !0 }), (this.#e.aborted || t.signal.aborted) && n(), N.sync(() => {
|
|
2330
|
+
this.#e.removeEventListener("abort", n), t.signal.removeEventListener("abort", n);
|
|
2331
|
+
});
|
|
2332
|
+
});
|
|
2333
|
+
return r.pipe(N.zipRight(n), N.tap(() => r), N.raceFirst(i));
|
|
2334
|
+
}
|
|
2335
|
+
}, Dr = class {
|
|
2336
|
+
#e;
|
|
2337
|
+
#t;
|
|
2338
|
+
#n;
|
|
2339
|
+
#r = /* @__PURE__ */ new Set();
|
|
2340
|
+
#i;
|
|
2341
|
+
#a = {
|
|
2342
|
+
status: "idle",
|
|
2343
|
+
data: void 0,
|
|
2344
|
+
error: void 0
|
|
2345
|
+
};
|
|
2346
|
+
#o = 0;
|
|
2347
|
+
#s;
|
|
2348
|
+
handle;
|
|
2349
|
+
constructor(e, t, n) {
|
|
2350
|
+
this.#e = e, this.#t = t, this.#n = n, this.handle = Gn(e, { capture: () => this.#f() });
|
|
2351
|
+
}
|
|
2352
|
+
getSnapshot = () => this.#a;
|
|
2353
|
+
subscribe = (e) => (this.#r.add(e), () => {
|
|
2354
|
+
this.#r.delete(e);
|
|
2355
|
+
});
|
|
2356
|
+
clear = () => {
|
|
2357
|
+
let e = this.#i;
|
|
2358
|
+
this.#i = void 0, this.#s = void 0, e?.detachSubject?.(), e?.controller.abort(), this.#h({
|
|
2359
|
+
status: "idle",
|
|
2360
|
+
data: void 0,
|
|
2361
|
+
error: void 0
|
|
2362
|
+
});
|
|
2363
|
+
};
|
|
2364
|
+
async activate(e, t) {
|
|
2365
|
+
this.clear();
|
|
2366
|
+
let n = new AbortController(), r = {
|
|
2367
|
+
input: e,
|
|
2368
|
+
key: Zn(),
|
|
2369
|
+
controller: n,
|
|
2370
|
+
subject: void 0,
|
|
2371
|
+
detachSubject: void 0,
|
|
2372
|
+
prerequisite: new Er(n.signal, this.#c(this.#n()).options.replayWindowMs),
|
|
2373
|
+
established: !1
|
|
2374
|
+
};
|
|
2375
|
+
this.#i = r, this.#h({
|
|
2376
|
+
status: "pending",
|
|
2377
|
+
data: void 0,
|
|
2378
|
+
error: void 0
|
|
2379
|
+
});
|
|
2380
|
+
try {
|
|
2381
|
+
let e = await t(), n = await this.#p(r, e.runtime, e.client);
|
|
2382
|
+
return this.#l(r), r.prerequisite.assertCurrent(e.runtime, n), r.established = !0, n.output;
|
|
2383
|
+
} catch (e) {
|
|
2384
|
+
throw this.#i === r && (this.clear(), this.#h({
|
|
2385
|
+
status: "error",
|
|
2386
|
+
data: void 0,
|
|
2387
|
+
error: e
|
|
2388
|
+
})), e;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
watch(e) {
|
|
2392
|
+
let t = Ft(e.runtime), n = () => {
|
|
2393
|
+
let n = this.#i;
|
|
2394
|
+
if (n === void 0 || !n.established || this.#n().runtime !== e.runtime) return;
|
|
2395
|
+
if (n.subject !== this.#c(e).subjectSignal) {
|
|
2396
|
+
this.clear();
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
let r = t?.getSnapshot();
|
|
2400
|
+
(r === void 0 || r !== this.#s || this.#a.status !== "ready") && (this.#s = void 0, this.#h({
|
|
2401
|
+
status: "pending",
|
|
2402
|
+
data: void 0,
|
|
2403
|
+
error: void 0
|
|
2404
|
+
}), r !== void 0 && this.#p(n, e.runtime, e.client).catch(() => {}));
|
|
2405
|
+
};
|
|
2406
|
+
return n(), t?.subscribe(n) ?? (() => {});
|
|
2407
|
+
}
|
|
2408
|
+
#c(e) {
|
|
2409
|
+
return e.recovery ?? pt(e.errorBus, this.#e);
|
|
2410
|
+
}
|
|
2411
|
+
#l(e) {
|
|
2412
|
+
if (this.#i !== e || e.controller.signal.aborted) throw new Q("inactive");
|
|
2413
|
+
}
|
|
2414
|
+
#u(e, t, n) {
|
|
2415
|
+
this.#l(e);
|
|
2416
|
+
let r = this.#n();
|
|
2417
|
+
if (e.subject !== void 0 && e.subject !== this.#c(r).subjectSignal) throw new Q("inactive");
|
|
2418
|
+
if (r.runtime !== t || r.client !== n) throw new Q("connection-changed");
|
|
2419
|
+
return r;
|
|
2420
|
+
}
|
|
2421
|
+
#d(e, t) {
|
|
2422
|
+
if (e.subject !== void 0) return;
|
|
2423
|
+
let n = this.#c(t).subjectSignal;
|
|
2424
|
+
e.subject = n;
|
|
2425
|
+
let r = () => {
|
|
2426
|
+
this.#i === e && this.clear();
|
|
2427
|
+
};
|
|
2428
|
+
n.addEventListener("abort", r, { once: !0 }), e.detachSubject = () => n.removeEventListener("abort", r), n.aborted && r();
|
|
2429
|
+
}
|
|
2430
|
+
#f() {
|
|
2431
|
+
let e = this.#i;
|
|
2432
|
+
if (e === void 0) throw new Q("inactive");
|
|
2433
|
+
return { prepare: async (t, n) => {
|
|
2434
|
+
let r = await this.#p(e, t, n);
|
|
2435
|
+
return { run: (i) => e.prerequisite.run(t, r, N.try({
|
|
2436
|
+
try: () => this.#u(e, t, n),
|
|
2437
|
+
catch: (e) => e
|
|
2438
|
+
}).pipe(N.zipRight(i))) };
|
|
2439
|
+
} };
|
|
2440
|
+
}
|
|
2441
|
+
async #p(e, t, n) {
|
|
2442
|
+
let r = this.#u(e, t, n), i = r.descriptors[this.#t];
|
|
2443
|
+
if (i?.kind !== "mutation" || i.idempotencyScope !== "connection") throw Error(`Voltro: useConnectionSetup("${this.#t}") requires a mutation declaring idempotencyScope: 'connection'`);
|
|
2444
|
+
this.#d(e, r), this.#l(e);
|
|
2445
|
+
let a = Ft(t);
|
|
2446
|
+
if (a === void 0) throw new Q("connection-unavailable");
|
|
2447
|
+
a.getSnapshot() === void 0 && await X(t, N.async((t) => {
|
|
2448
|
+
let n = () => {
|
|
2449
|
+
let n = a.getSnapshot();
|
|
2450
|
+
e.controller.signal.aborted ? t(N.fail(new Q("inactive"))) : n !== void 0 && t(N.succeed(n));
|
|
2451
|
+
}, r = a.subscribe(n);
|
|
2452
|
+
return e.controller.signal.addEventListener("abort", n, { once: !0 }), n(), N.sync(() => {
|
|
2453
|
+
r(), e.controller.signal.removeEventListener("abort", n);
|
|
2454
|
+
});
|
|
2455
|
+
}).pipe(N.timeoutFail({
|
|
2456
|
+
duration: this.#c(r).options.replayWindowMs,
|
|
2457
|
+
onTimeout: () => new Q("timeout")
|
|
2458
|
+
}))), this.#u(e, t, n);
|
|
2459
|
+
let o = a.getSnapshot();
|
|
2460
|
+
try {
|
|
2461
|
+
let i = await e.prerequisite.prepare(t, this.#m(e, r));
|
|
2462
|
+
return this.#u(e, t, n), this.#s = i.lease, this.#h({
|
|
2463
|
+
status: "ready",
|
|
2464
|
+
data: i.output,
|
|
2465
|
+
error: void 0
|
|
2466
|
+
}), this.#u(e, t, n), e.prerequisite.assertCurrent(t, i), i;
|
|
2467
|
+
} catch (n) {
|
|
2468
|
+
throw this.#i === e && this.#n().runtime === t && a.getSnapshot() === o && this.#h({
|
|
2469
|
+
status: "error",
|
|
2470
|
+
data: void 0,
|
|
2471
|
+
error: n
|
|
2472
|
+
}), n;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
#m(e, t) {
|
|
2476
|
+
return N.suspend(() => {
|
|
2477
|
+
let n = `setup_${e.key}_${++this.#o}`;
|
|
2478
|
+
return zn({
|
|
2479
|
+
id: n,
|
|
2480
|
+
apiName: this.#e,
|
|
2481
|
+
tag: this.#t,
|
|
2482
|
+
input: e.input
|
|
2483
|
+
}), N.suspend(() => (this.#u(e, t.runtime, t.client), Qn(q(t.client, this.#t)(e.input), e.key))).pipe(N.withSpan(`client.connectionSetup.${this.#t}`)).pipe(N.onExit((e) => N.sync(() => {
|
|
2484
|
+
if (P.isSuccess(e)) Bn(n, {
|
|
2485
|
+
status: "success",
|
|
2486
|
+
output: e.value
|
|
2487
|
+
}), t.errorBus.emitSuccess({
|
|
2488
|
+
source: "mutation",
|
|
2489
|
+
tag: this.#t
|
|
2490
|
+
});
|
|
2491
|
+
else {
|
|
2492
|
+
let r = M.squash(e.cause);
|
|
2493
|
+
if (Bn(n, {
|
|
2494
|
+
status: "error",
|
|
2495
|
+
error: r
|
|
2496
|
+
}), !M.isInterruptedOnly(e.cause)) {
|
|
2497
|
+
let e = B(r, "handler");
|
|
2498
|
+
t.errorBus.emit({
|
|
2499
|
+
source: "mutation",
|
|
2500
|
+
tag: this.#t,
|
|
2501
|
+
error: r,
|
|
2502
|
+
kind: e,
|
|
2503
|
+
outcome: e === "transport" ? "unknown" : "known"
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
})));
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
#h(e) {
|
|
2511
|
+
if (this.#a.status !== e.status || this.#a.data !== e.data || this.#a.error !== e.error) {
|
|
2512
|
+
this.#a = e;
|
|
2513
|
+
for (let e of this.#r) try {
|
|
2514
|
+
e();
|
|
2515
|
+
} catch {}
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}, Or = (e, t) => {
|
|
2519
|
+
let n = K(e), r = k(n);
|
|
2520
|
+
r.current = n;
|
|
2521
|
+
let i = O(() => new Dr(e, t, () => r.current), [e, t]), a = E((n) => i.activate(n, () => Y(r, e, t)), [
|
|
2522
|
+
i,
|
|
2523
|
+
e,
|
|
2524
|
+
t
|
|
2525
|
+
]), o = j(i.subscribe, i.getSnapshot, i.getSnapshot);
|
|
2526
|
+
return D(() => i.watch(r.current), [
|
|
2527
|
+
i,
|
|
2528
|
+
n.runtime,
|
|
2529
|
+
n.client,
|
|
2530
|
+
n.recovery
|
|
2531
|
+
]), D(() => () => i.clear(), [i]), {
|
|
2532
|
+
...o,
|
|
2533
|
+
handle: i.handle,
|
|
2534
|
+
activate: a,
|
|
2535
|
+
clear: i.clear,
|
|
2536
|
+
ready: o.status === "ready"
|
|
2537
|
+
};
|
|
2538
|
+
}, kr = J, Ar = (e) => ({
|
|
2539
|
+
useSubscription: (t, n, r) => kr(e, t, n, r),
|
|
2540
|
+
useMutation: (t) => sr(e, t),
|
|
2541
|
+
useConnectionSetup: (t) => Or(e, t),
|
|
2542
|
+
useAction: (t) => fr(e, t),
|
|
2543
|
+
useFormBinding: (t, n) => Sr(e, t, n ?? {})
|
|
2544
|
+
}), jr = () => ({ seeds: [] }), Mr = null, Nr = (e) => {
|
|
2545
|
+
Mr = e;
|
|
2546
|
+
}, Pr = /* @__PURE__ */ new Map(), Fr = (e, t) => `${e}\u0000${t}`, Ir = (e, t, n, r) => {
|
|
2547
|
+
let i = Mr?.() ?? null;
|
|
2179
2548
|
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.)`);
|
|
2180
2549
|
i.seeds.push({
|
|
2181
2550
|
api: e,
|
|
2182
|
-
key:
|
|
2551
|
+
key: W([t, n]),
|
|
2183
2552
|
value: r
|
|
2184
2553
|
});
|
|
2185
|
-
},
|
|
2186
|
-
let r =
|
|
2554
|
+
}, Lr = (e, t, n) => {
|
|
2555
|
+
let r = Mr?.() ?? null;
|
|
2187
2556
|
r !== null && r.seeds.push({
|
|
2188
2557
|
api: e,
|
|
2189
|
-
key:
|
|
2558
|
+
key: W([t, n]),
|
|
2190
2559
|
value: void 0,
|
|
2191
2560
|
failed: !0
|
|
2192
2561
|
});
|
|
2193
|
-
},
|
|
2194
|
-
if (e !== void 0) for (let t of e)
|
|
2562
|
+
}, Rr = (e) => {
|
|
2563
|
+
if (e !== void 0) for (let t of e) Pr.set(Fr(t.api, t.key), {
|
|
2195
2564
|
value: t.value,
|
|
2196
2565
|
failed: t.failed === !0
|
|
2197
2566
|
});
|
|
2198
|
-
},
|
|
2199
|
-
let r =
|
|
2567
|
+
}, zr = (e, t, n) => {
|
|
2568
|
+
let r = W([t, n]), i = Mr?.() ?? null;
|
|
2200
2569
|
if (i !== null) {
|
|
2201
2570
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
|
|
2202
2571
|
return;
|
|
2203
2572
|
}
|
|
2204
|
-
let a =
|
|
2573
|
+
let a = Pr.get(Fr(e, r));
|
|
2205
2574
|
return a === void 0 || a.failed ? void 0 : a.value;
|
|
2206
|
-
},
|
|
2207
|
-
let r =
|
|
2575
|
+
}, Br = (e, t, n) => {
|
|
2576
|
+
let r = W([t, n]), i = Mr?.() ?? null;
|
|
2208
2577
|
if (i !== null) {
|
|
2209
2578
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
|
|
2210
2579
|
return "absent";
|
|
2211
2580
|
}
|
|
2212
|
-
let a =
|
|
2581
|
+
let a = Pr.get(Fr(e, r));
|
|
2213
2582
|
return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
|
|
2214
|
-
},
|
|
2215
|
-
|
|
2583
|
+
}, Vr = () => {
|
|
2584
|
+
Pr.clear();
|
|
2216
2585
|
};
|
|
2217
2586
|
//#endregion
|
|
2218
2587
|
//#region src/usePreloadedSubscription.ts
|
|
2219
|
-
function
|
|
2220
|
-
let i =
|
|
2588
|
+
function Hr(e, t, n = {}, r = {}) {
|
|
2589
|
+
let i = zr(e, t, n), a = J(e, t, n, i === void 0 ? r : {
|
|
2221
2590
|
...r,
|
|
2222
2591
|
initialSnapshot: i
|
|
2223
2592
|
});
|
|
2224
|
-
return
|
|
2593
|
+
return Br(e, t, n) === "failed" ? {
|
|
2225
2594
|
...a,
|
|
2226
2595
|
preloadFailed: !0
|
|
2227
2596
|
} : a;
|
|
2228
2597
|
}
|
|
2229
2598
|
//#endregion
|
|
2230
2599
|
//#region src/useEvent.ts
|
|
2231
|
-
var
|
|
2600
|
+
var Ur = {
|
|
2232
2601
|
status: "idle",
|
|
2233
2602
|
missed: 0,
|
|
2234
2603
|
lastMiss: void 0
|
|
2235
|
-
},
|
|
2604
|
+
}, Wr = class {
|
|
2236
2605
|
_tag = "EventStreamClosed";
|
|
2237
2606
|
};
|
|
2238
|
-
function
|
|
2239
|
-
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s =
|
|
2607
|
+
function Gr(e, t, n, r = {}) {
|
|
2608
|
+
let { skip: i = !1, apiName: a = "app", onMissed: o } = r, s = K(a), { runtime: c, client: l } = s, [u, d] = A(Ur), f = k(n);
|
|
2240
2609
|
f.current = n;
|
|
2241
2610
|
let p = k(o);
|
|
2242
2611
|
p.current = o;
|
|
@@ -2249,7 +2618,7 @@ function Or(e, t, n, r = {}) {
|
|
|
2249
2618
|
let y = k(null);
|
|
2250
2619
|
y.current !== _ && (y.current = _, g.current = /* @__PURE__ */ new Map());
|
|
2251
2620
|
let b = E((t, n) => {
|
|
2252
|
-
t <= 0 || (
|
|
2621
|
+
t <= 0 || (U(a, "event.gap", {
|
|
2253
2622
|
tag: e.name,
|
|
2254
2623
|
missed: t,
|
|
2255
2624
|
reason: n
|
|
@@ -2264,10 +2633,10 @@ function Or(e, t, n, r = {}) {
|
|
|
2264
2633
|
count: t,
|
|
2265
2634
|
reason: n
|
|
2266
2635
|
}));
|
|
2267
|
-
}, [a, e.name]), x = !i && _ !== null && !
|
|
2636
|
+
}, [a, e.name]), x = !i && _ !== null && !kt(s);
|
|
2268
2637
|
return D(() => {
|
|
2269
2638
|
if (!x) {
|
|
2270
|
-
d(
|
|
2639
|
+
d(Ur);
|
|
2271
2640
|
return;
|
|
2272
2641
|
}
|
|
2273
2642
|
d((e) => ({
|
|
@@ -2279,18 +2648,18 @@ function Or(e, t, n, r = {}) {
|
|
|
2279
2648
|
origin: e,
|
|
2280
2649
|
n: t
|
|
2281
2650
|
}));
|
|
2282
|
-
return
|
|
2651
|
+
return q(m.current, e.name)({
|
|
2283
2652
|
key: v.current,
|
|
2284
2653
|
...t.length > 0 ? { resume: t } : {}
|
|
2285
2654
|
});
|
|
2286
|
-
}), r =
|
|
2655
|
+
}), r = R.unwrap(n).pipe(R.tap(() => N.sync(() => {
|
|
2287
2656
|
t = 0;
|
|
2288
|
-
})),
|
|
2657
|
+
})), R.concat(R.fail(new Wr())), R.retry(L.exponential("250 millis", 2).pipe(L.either(L.spaced("30 seconds")), L.jittered, L.tapOutput(() => N.sync(() => {
|
|
2289
2658
|
t += 1, d((e) => ({
|
|
2290
2659
|
...e,
|
|
2291
2660
|
status: "connecting"
|
|
2292
2661
|
}));
|
|
2293
|
-
}))))), i = h.current.runFork(
|
|
2662
|
+
}))))), i = h.current.runFork(R.runForEach(r, (e) => N.sync(() => {
|
|
2294
2663
|
if (e._tag === "attached") {
|
|
2295
2664
|
d((e) => ({
|
|
2296
2665
|
...e,
|
|
@@ -2312,11 +2681,11 @@ function Or(e, t, n, r = {}) {
|
|
|
2312
2681
|
_,
|
|
2313
2682
|
e.name,
|
|
2314
2683
|
b
|
|
2315
|
-
]), x ? u :
|
|
2684
|
+
]), x ? u : Ur;
|
|
2316
2685
|
}
|
|
2317
2686
|
//#endregion
|
|
2318
2687
|
//#region src/sequence.ts
|
|
2319
|
-
var
|
|
2688
|
+
var Kr = () => {
|
|
2320
2689
|
let e = (t) => ({
|
|
2321
2690
|
steps: t,
|
|
2322
2691
|
step: ((n, r, i) => e([...t, {
|
|
@@ -2328,7 +2697,7 @@ var kr = () => {
|
|
|
2328
2697
|
}]))
|
|
2329
2698
|
});
|
|
2330
2699
|
return e([]);
|
|
2331
|
-
},
|
|
2700
|
+
}, qr = async (e, t = {}) => {
|
|
2332
2701
|
let n = {}, r = [];
|
|
2333
2702
|
for (let i of e.steps) {
|
|
2334
2703
|
if (i.when !== void 0 && !i.when(n)) {
|
|
@@ -2388,13 +2757,13 @@ var kr = () => {
|
|
|
2388
2757
|
ok: !0,
|
|
2389
2758
|
data: n
|
|
2390
2759
|
};
|
|
2391
|
-
},
|
|
2760
|
+
}, Jr = (e = {}) => {
|
|
2392
2761
|
let [t, n] = A(!1), [r, i] = A(void 0), [a, o] = A(void 0), s = k(e);
|
|
2393
2762
|
return s.current = e, {
|
|
2394
2763
|
run: E(async (e, t = {}) => {
|
|
2395
2764
|
n(!0), i(void 0), o(void 0);
|
|
2396
2765
|
try {
|
|
2397
|
-
let n = await
|
|
2766
|
+
let n = await qr(e, {
|
|
2398
2767
|
...s.current,
|
|
2399
2768
|
...t
|
|
2400
2769
|
});
|
|
@@ -2407,7 +2776,7 @@ var kr = () => {
|
|
|
2407
2776
|
error: r,
|
|
2408
2777
|
failedStep: a
|
|
2409
2778
|
};
|
|
2410
|
-
},
|
|
2779
|
+
}, Yr = "@voltro/plugin-storage", $ = (e) => pe(Yr, e), Xr = (e, t, n, r) => new Promise((i, a) => {
|
|
2411
2780
|
let o = new XMLHttpRequest();
|
|
2412
2781
|
if (o.open("PUT", e), o.upload.onprogress = (e) => {
|
|
2413
2782
|
e.lengthComputable && n(e.loaded / e.total);
|
|
@@ -2421,7 +2790,7 @@ var kr = () => {
|
|
|
2421
2790
|
return;
|
|
2422
2791
|
}
|
|
2423
2792
|
r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
|
|
2424
|
-
}),
|
|
2793
|
+
}), Zr = (e, t, n, r, i, a) => new Promise((o, s) => {
|
|
2425
2794
|
let c = new XMLHttpRequest();
|
|
2426
2795
|
if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
|
|
2427
2796
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2439,7 +2808,7 @@ var kr = () => {
|
|
|
2439
2808
|
return;
|
|
2440
2809
|
}
|
|
2441
2810
|
i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
|
|
2442
|
-
}),
|
|
2811
|
+
}), Qr = (e, t, n, r, i) => new Promise((a, o) => {
|
|
2443
2812
|
let s = new XMLHttpRequest();
|
|
2444
2813
|
if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
2445
2814
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2450,7 +2819,7 @@ var kr = () => {
|
|
|
2450
2819
|
return;
|
|
2451
2820
|
}
|
|
2452
2821
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
2453
|
-
}),
|
|
2822
|
+
}), $r = (e, t, n, r, i) => new Promise((a, o) => {
|
|
2454
2823
|
let s = new XMLHttpRequest();
|
|
2455
2824
|
if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
2456
2825
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -2466,16 +2835,16 @@ var kr = () => {
|
|
|
2466
2835
|
return;
|
|
2467
2836
|
}
|
|
2468
2837
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
2469
|
-
}),
|
|
2470
|
-
let n =
|
|
2838
|
+
}), ei = (e, t = {}) => {
|
|
2839
|
+
let n = K(e), { inspectBaseUrl: r } = n, i = k(n);
|
|
2471
2840
|
i.current = n;
|
|
2472
2841
|
let [a, o] = A(0), [s, c] = A("idle"), [l, u] = A(void 0), d = k(null), f = E(() => {
|
|
2473
2842
|
o(0), c("idle"), u(void 0);
|
|
2474
2843
|
}, []), p = E(() => {
|
|
2475
2844
|
d.current?.abort();
|
|
2476
2845
|
}, []), m = E((e) => /^https?:\/\//.test(e) ? e : `${r}${e}`, [r]), h = E(async (n, r, a, o) => {
|
|
2477
|
-
let { runtime: s, client: c } = await
|
|
2478
|
-
throw
|
|
2846
|
+
let { runtime: s, client: c } = await Y(i, e, "storage.upload").catch((e) => {
|
|
2847
|
+
throw Se(e, "client");
|
|
2479
2848
|
}), 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, _ = {
|
|
2480
2849
|
...f ? { visibility: f } : {},
|
|
2481
2850
|
...h ? { folder: h } : {},
|
|
@@ -2491,28 +2860,28 @@ var kr = () => {
|
|
|
2491
2860
|
...e.width === void 0 ? {} : { width: e.width },
|
|
2492
2861
|
...e.height === void 0 ? {} : { height: e.height }
|
|
2493
2862
|
}), y = async () => {
|
|
2494
|
-
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"), i =
|
|
2863
|
+
let e = r.mintTag ?? t.mintTag ?? $("mintUploadTicket"), i = q(c, e), l = await X(s, i({
|
|
2495
2864
|
contentType: u,
|
|
2496
2865
|
..._,
|
|
2497
2866
|
...p ? { key: p } : {}
|
|
2498
|
-
})), d = await
|
|
2867
|
+
})), d = await $r(m(l.uploadUrl), u, n, o, a);
|
|
2499
2868
|
return v(d);
|
|
2500
2869
|
}, b = async () => {
|
|
2501
2870
|
let e = r.presignMintTag ?? t.presignMintTag ?? $("mintPresignedUpload"), i = r.finalizeTag ?? t.finalizeTag ?? $("finalizeUpload"), l;
|
|
2502
2871
|
try {
|
|
2503
|
-
let t =
|
|
2504
|
-
l = await
|
|
2872
|
+
let t = q(c, e);
|
|
2873
|
+
l = await X(s, t({
|
|
2505
2874
|
contentType: u,
|
|
2506
2875
|
..._
|
|
2507
2876
|
}));
|
|
2508
2877
|
} catch {
|
|
2509
2878
|
return null;
|
|
2510
2879
|
}
|
|
2511
|
-
await
|
|
2512
|
-
let d =
|
|
2880
|
+
await Qr(l.uploadUrl, u, n, o, a);
|
|
2881
|
+
let d = q(c, i), f = await X(s, d({ finalizeToken: l.finalizeToken }));
|
|
2513
2882
|
return v(f);
|
|
2514
2883
|
}, x = async () => {
|
|
2515
|
-
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"), i =
|
|
2884
|
+
let e = r.beginResumableTag ?? t.beginResumableTag ?? $("beginResumableUpload"), i = q(c, e), l = n.size, d = r.chunkSize ?? t.chunkSize, f = await X(s, i({
|
|
2516
2885
|
contentType: u,
|
|
2517
2886
|
size: l,
|
|
2518
2887
|
..._,
|
|
@@ -2523,7 +2892,7 @@ var kr = () => {
|
|
|
2523
2892
|
for (;;) {
|
|
2524
2893
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2525
2894
|
try {
|
|
2526
|
-
let t = await
|
|
2895
|
+
let t = await Zr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${s ? "&final=1" : ""}`}`, u, i, (e) => o((b + e * c) / l), a, s);
|
|
2527
2896
|
s && (x = t);
|
|
2528
2897
|
break;
|
|
2529
2898
|
} catch (e) {
|
|
@@ -2537,8 +2906,8 @@ var kr = () => {
|
|
|
2537
2906
|
}, S = async () => {
|
|
2538
2907
|
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;
|
|
2539
2908
|
try {
|
|
2540
|
-
let t =
|
|
2541
|
-
g = await
|
|
2909
|
+
let t = q(c, e);
|
|
2910
|
+
g = await X(s, t({
|
|
2542
2911
|
contentType: u,
|
|
2543
2912
|
size: p,
|
|
2544
2913
|
..._,
|
|
@@ -2547,17 +2916,17 @@ var kr = () => {
|
|
|
2547
2916
|
} catch {
|
|
2548
2917
|
return null;
|
|
2549
2918
|
}
|
|
2550
|
-
let v =
|
|
2919
|
+
let v = q(c, i), y = q(c, l), b = q(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;
|
|
2551
2920
|
try {
|
|
2552
2921
|
for (let e = 0; e < S; e++) {
|
|
2553
2922
|
let t = e * x, r = Math.min(p, t + x), i = n.slice(t, r), c = e + 1, l = r - t, u = 0;
|
|
2554
2923
|
for (;;) {
|
|
2555
2924
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
2556
2925
|
try {
|
|
2557
|
-
let { url: e } = await
|
|
2926
|
+
let { url: e } = await X(s, v({
|
|
2558
2927
|
multipartToken: g.multipartToken,
|
|
2559
2928
|
partNumber: c
|
|
2560
|
-
})), t = await
|
|
2929
|
+
})), t = await Xr(e, i, (e) => o((T + e * l) / p), a);
|
|
2561
2930
|
w.push({
|
|
2562
2931
|
partNumber: c,
|
|
2563
2932
|
etag: t
|
|
@@ -2569,7 +2938,7 @@ var kr = () => {
|
|
|
2569
2938
|
}
|
|
2570
2939
|
T += l, o(T / p);
|
|
2571
2940
|
}
|
|
2572
|
-
let e = await
|
|
2941
|
+
let e = await X(s, y({
|
|
2573
2942
|
multipartToken: g.multipartToken,
|
|
2574
2943
|
parts: w
|
|
2575
2944
|
}));
|
|
@@ -2582,7 +2951,7 @@ var kr = () => {
|
|
|
2582
2951
|
};
|
|
2583
2952
|
} catch (e) {
|
|
2584
2953
|
try {
|
|
2585
|
-
await
|
|
2954
|
+
await X(s, b({ multipartToken: g.multipartToken }));
|
|
2586
2955
|
} catch {}
|
|
2587
2956
|
throw e;
|
|
2588
2957
|
}
|
|
@@ -2632,8 +3001,8 @@ var kr = () => {
|
|
|
2632
3001
|
source: "action",
|
|
2633
3002
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2634
3003
|
error: e,
|
|
2635
|
-
kind:
|
|
2636
|
-
outcome:
|
|
3004
|
+
kind: B(e, "unknown"),
|
|
3005
|
+
outcome: B(e, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
2637
3006
|
}), e;
|
|
2638
3007
|
}
|
|
2639
3008
|
}, [h, t.mintTag]), _ = E(async (e, n = {}) => {
|
|
@@ -2656,8 +3025,8 @@ var kr = () => {
|
|
|
2656
3025
|
source: "action",
|
|
2657
3026
|
tag: n.mintTag ?? t.mintTag ?? $("mintUploadTicket"),
|
|
2658
3027
|
error: e,
|
|
2659
|
-
kind:
|
|
2660
|
-
outcome:
|
|
3028
|
+
kind: B(e, "unknown"),
|
|
3029
|
+
outcome: B(e, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
2661
3030
|
}), e;
|
|
2662
3031
|
}
|
|
2663
3032
|
}, [
|
|
@@ -2700,8 +3069,8 @@ var kr = () => {
|
|
|
2700
3069
|
y,
|
|
2701
3070
|
b
|
|
2702
3071
|
]);
|
|
2703
|
-
},
|
|
2704
|
-
let n =
|
|
3072
|
+
}, ti = (e, t) => {
|
|
3073
|
+
let n = ei(e), r = fr(e, t.action), [i, a] = A("idle"), [o, s] = A(void 0), [c, l] = A(void 0), u = k(t.extra);
|
|
2705
3074
|
u.current = t.extra;
|
|
2706
3075
|
let d = E(async (e) => {
|
|
2707
3076
|
l(void 0), s(void 0), a("uploading");
|
|
@@ -2744,9 +3113,9 @@ var kr = () => {
|
|
|
2744
3113
|
f,
|
|
2745
3114
|
p
|
|
2746
3115
|
]);
|
|
2747
|
-
},
|
|
2748
|
-
let t =
|
|
2749
|
-
|
|
3116
|
+
}, ni = async (e) => {
|
|
3117
|
+
let t = q(e.client, e.tag), n = N.currentSpan.pipe(N.tap((t) => N.sync(() => {
|
|
3118
|
+
ye({
|
|
2750
3119
|
traceId: t.traceId,
|
|
2751
3120
|
spanId: t.spanId,
|
|
2752
3121
|
source: "mutation",
|
|
@@ -2756,9 +3125,9 @@ var kr = () => {
|
|
|
2756
3125
|
"voltro.api": e.apiName,
|
|
2757
3126
|
"rpc.tag": e.tag
|
|
2758
3127
|
} }));
|
|
2759
|
-
return
|
|
2760
|
-
},
|
|
2761
|
-
let n =
|
|
3128
|
+
return X(e.runtime, n);
|
|
3129
|
+
}, ri = (e, t) => {
|
|
3130
|
+
let n = K(e), { descriptors: r } = n, i = k(n);
|
|
2762
3131
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
2763
3132
|
let n = r[t]?.kind;
|
|
2764
3133
|
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.`);
|
|
@@ -2766,7 +3135,7 @@ var kr = () => {
|
|
|
2766
3135
|
let [a, o] = A(!1), [s, c] = A(void 0), [l, u] = A(void 0), d = E(async (n) => {
|
|
2767
3136
|
o(!0), c(void 0);
|
|
2768
3137
|
try {
|
|
2769
|
-
let { runtime: r, client: a } = await
|
|
3138
|
+
let { runtime: r, client: a } = await Y(i, e, t), o = await ni({
|
|
2770
3139
|
apiName: e,
|
|
2771
3140
|
runtime: r,
|
|
2772
3141
|
client: a,
|
|
@@ -2781,8 +3150,8 @@ var kr = () => {
|
|
|
2781
3150
|
o(!1);
|
|
2782
3151
|
}
|
|
2783
3152
|
}, [e, t]), f = E(async (t) => {
|
|
2784
|
-
let { runtime: n, client: r } = await
|
|
2785
|
-
await
|
|
3153
|
+
let { runtime: n, client: r } = await Y(i, e, "__voltro.workflow.cancel");
|
|
3154
|
+
await ni({
|
|
2786
3155
|
apiName: e,
|
|
2787
3156
|
runtime: n,
|
|
2788
3157
|
client: r,
|
|
@@ -2791,8 +3160,8 @@ var kr = () => {
|
|
|
2791
3160
|
spanPrefix: "client.workflow.cancel"
|
|
2792
3161
|
});
|
|
2793
3162
|
}, [e]), p = E(async (t) => {
|
|
2794
|
-
let { runtime: n, client: r } = await
|
|
2795
|
-
await
|
|
3163
|
+
let { runtime: n, client: r } = await Y(i, e, "__voltro.workflow.resume");
|
|
3164
|
+
await ni({
|
|
2796
3165
|
apiName: e,
|
|
2797
3166
|
runtime: n,
|
|
2798
3167
|
client: r,
|
|
@@ -2801,8 +3170,8 @@ var kr = () => {
|
|
|
2801
3170
|
spanPrefix: "client.workflow.resume"
|
|
2802
3171
|
});
|
|
2803
3172
|
}, [e]), m = E(async (t, n, r) => {
|
|
2804
|
-
let { runtime: a, client: o } = await
|
|
2805
|
-
return
|
|
3173
|
+
let { runtime: a, client: o } = await Y(i, e, "__voltro.workflow.signal");
|
|
3174
|
+
return ni({
|
|
2806
3175
|
apiName: e,
|
|
2807
3176
|
runtime: a,
|
|
2808
3177
|
client: o,
|
|
@@ -2815,8 +3184,8 @@ var kr = () => {
|
|
|
2815
3184
|
spanPrefix: "client.workflow.signal"
|
|
2816
3185
|
});
|
|
2817
3186
|
}, [e]), h = E(async (t, n, r, a) => {
|
|
2818
|
-
let { runtime: o, client: s } = await
|
|
2819
|
-
return
|
|
3187
|
+
let { runtime: o, client: s } = await Y(i, e, "__voltro.workflow.update");
|
|
3188
|
+
return ni({
|
|
2820
3189
|
apiName: e,
|
|
2821
3190
|
runtime: o,
|
|
2822
3191
|
client: s,
|
|
@@ -2849,13 +3218,13 @@ var kr = () => {
|
|
|
2849
3218
|
s,
|
|
2850
3219
|
l
|
|
2851
3220
|
]);
|
|
2852
|
-
},
|
|
2853
|
-
let t =
|
|
3221
|
+
}, ii = (e) => {
|
|
3222
|
+
let t = K(e), n = k(t);
|
|
2854
3223
|
n.current = t;
|
|
2855
3224
|
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = E(async (t, r, a) => {
|
|
2856
3225
|
i(!0), o(void 0);
|
|
2857
3226
|
try {
|
|
2858
|
-
let { runtime: i, client: o } = await
|
|
3227
|
+
let { runtime: i, client: o } = await Y(n, e, "__voltro.workflow.signal"), s = await ni({
|
|
2859
3228
|
apiName: e,
|
|
2860
3229
|
runtime: i,
|
|
2861
3230
|
client: o,
|
|
@@ -2885,13 +3254,13 @@ var kr = () => {
|
|
|
2885
3254
|
a,
|
|
2886
3255
|
s
|
|
2887
3256
|
]);
|
|
2888
|
-
},
|
|
2889
|
-
let t =
|
|
3257
|
+
}, ai = (e) => {
|
|
3258
|
+
let t = K(e), n = k(t);
|
|
2890
3259
|
n.current = t;
|
|
2891
3260
|
let [r, i] = A(!1), [a, o] = A(void 0), [s, c] = A(void 0), l = E(async (t, r, a, s) => {
|
|
2892
3261
|
i(!0), o(void 0);
|
|
2893
3262
|
try {
|
|
2894
|
-
let { runtime: i, client: o } = await
|
|
3263
|
+
let { runtime: i, client: o } = await Y(n, e, "__voltro.workflow.update"), l = await ni({
|
|
2895
3264
|
apiName: e,
|
|
2896
3265
|
runtime: i,
|
|
2897
3266
|
client: o,
|
|
@@ -2922,8 +3291,8 @@ var kr = () => {
|
|
|
2922
3291
|
a,
|
|
2923
3292
|
s
|
|
2924
3293
|
]);
|
|
2925
|
-
},
|
|
2926
|
-
let n =
|
|
3294
|
+
}, oi = (e, t) => {
|
|
3295
|
+
let n = J(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
|
|
2927
3296
|
return n.loading || n.idle || n.failed ? {
|
|
2928
3297
|
...n,
|
|
2929
3298
|
run: void 0
|
|
@@ -2931,8 +3300,8 @@ var kr = () => {
|
|
|
2931
3300
|
...n,
|
|
2932
3301
|
run: n.data[0]
|
|
2933
3302
|
};
|
|
2934
|
-
},
|
|
2935
|
-
let r =
|
|
3303
|
+
}, si = (e, t = {}, n = {}) => {
|
|
3304
|
+
let r = J(e, "__voltro.workflow.runs", t, n);
|
|
2936
3305
|
return r.loading || r.idle || r.failed ? {
|
|
2937
3306
|
...r,
|
|
2938
3307
|
runs: []
|
|
@@ -2940,8 +3309,8 @@ var kr = () => {
|
|
|
2940
3309
|
...r,
|
|
2941
3310
|
runs: r.data
|
|
2942
3311
|
};
|
|
2943
|
-
},
|
|
2944
|
-
let n =
|
|
3312
|
+
}, ci = (e, t) => {
|
|
3313
|
+
let n = J(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2945
3314
|
return n.loading || n.idle || n.failed ? {
|
|
2946
3315
|
...n,
|
|
2947
3316
|
steps: []
|
|
@@ -2949,8 +3318,8 @@ var kr = () => {
|
|
|
2949
3318
|
...n,
|
|
2950
3319
|
steps: n.data
|
|
2951
3320
|
};
|
|
2952
|
-
},
|
|
2953
|
-
let n =
|
|
3321
|
+
}, li = (e, t) => {
|
|
3322
|
+
let n = J(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2954
3323
|
return n.loading || n.idle || n.failed ? {
|
|
2955
3324
|
...n,
|
|
2956
3325
|
events: []
|
|
@@ -2958,8 +3327,8 @@ var kr = () => {
|
|
|
2958
3327
|
...n,
|
|
2959
3328
|
events: n.data
|
|
2960
3329
|
};
|
|
2961
|
-
},
|
|
2962
|
-
let r =
|
|
3330
|
+
}, ui = li, di = (e, t = {}, n = {}) => {
|
|
3331
|
+
let r = J(e, "__voltro.workflow.domainEvents", t, n);
|
|
2963
3332
|
return r.loading || r.idle || r.failed ? {
|
|
2964
3333
|
...r,
|
|
2965
3334
|
events: []
|
|
@@ -2967,8 +3336,8 @@ var kr = () => {
|
|
|
2967
3336
|
...r,
|
|
2968
3337
|
events: r.data
|
|
2969
3338
|
};
|
|
2970
|
-
},
|
|
2971
|
-
let n =
|
|
3339
|
+
}, fi = (e, t) => {
|
|
3340
|
+
let n = J(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
|
|
2972
3341
|
return n.loading || n.idle || n.failed ? {
|
|
2973
3342
|
...n,
|
|
2974
3343
|
deliveries: []
|
|
@@ -2976,42 +3345,42 @@ var kr = () => {
|
|
|
2976
3345
|
...n,
|
|
2977
3346
|
deliveries: n.data
|
|
2978
3347
|
};
|
|
2979
|
-
},
|
|
3348
|
+
}, pi = (e, t) => {
|
|
2980
3349
|
let n = e.payload;
|
|
2981
3350
|
if (!n || typeof n != "object") return;
|
|
2982
3351
|
let r = n[t];
|
|
2983
3352
|
return typeof r == "string" ? r : void 0;
|
|
2984
|
-
},
|
|
3353
|
+
}, mi = (e) => {
|
|
2985
3354
|
let t = e.payload;
|
|
2986
3355
|
if (!t || typeof t != "object") return;
|
|
2987
3356
|
let n = t.updateId;
|
|
2988
3357
|
return typeof n == "string" ? n : void 0;
|
|
2989
|
-
},
|
|
3358
|
+
}, hi = (e) => {
|
|
2990
3359
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2991
3360
|
for (let r of e) if (r.eventType === "signal-received") {
|
|
2992
|
-
let e =
|
|
3361
|
+
let e = pi(r, "signalName");
|
|
2993
3362
|
e && t.add(e);
|
|
2994
3363
|
} else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
|
|
2995
|
-
let e =
|
|
3364
|
+
let e = mi(r);
|
|
2996
3365
|
e && n.add(e);
|
|
2997
3366
|
}
|
|
2998
3367
|
for (let r = e.length - 1; r >= 0; --r) {
|
|
2999
3368
|
let i = e[r];
|
|
3000
3369
|
if (i.eventType === "signal-awaited") {
|
|
3001
|
-
let e =
|
|
3370
|
+
let e = pi(i, "signalName");
|
|
3002
3371
|
if (e && !t.has(e)) return {
|
|
3003
3372
|
name: e,
|
|
3004
3373
|
kind: "signal"
|
|
3005
3374
|
};
|
|
3006
3375
|
} else if (i.eventType === "update-requested") {
|
|
3007
|
-
let e =
|
|
3376
|
+
let e = mi(i), t = pi(i, "updateName");
|
|
3008
3377
|
if (t && (!e || !n.has(e))) return {
|
|
3009
3378
|
name: t,
|
|
3010
3379
|
kind: "update"
|
|
3011
3380
|
};
|
|
3012
3381
|
}
|
|
3013
3382
|
}
|
|
3014
|
-
},
|
|
3383
|
+
}, gi = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), _i = (e, t) => {
|
|
3015
3384
|
if (!e || e.status !== "failed") return;
|
|
3016
3385
|
let n = t.find((e) => e.status === "failed");
|
|
3017
3386
|
return {
|
|
@@ -3019,8 +3388,8 @@ var kr = () => {
|
|
|
3019
3388
|
message: e.errorMessage,
|
|
3020
3389
|
step: n?.stepName
|
|
3021
3390
|
};
|
|
3022
|
-
},
|
|
3023
|
-
let n =
|
|
3391
|
+
}, vi = (e, t) => {
|
|
3392
|
+
let n = oi(e, t), r = ci(e, t), i = li(e, t), a = ri(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = E(async () => {
|
|
3024
3393
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
|
|
3025
3394
|
await a.cancel({
|
|
3026
3395
|
workflowName: o.tag,
|
|
@@ -3044,9 +3413,9 @@ var kr = () => {
|
|
|
3044
3413
|
status: o?.status,
|
|
3045
3414
|
steps: s,
|
|
3046
3415
|
events: c,
|
|
3047
|
-
currentStep:
|
|
3048
|
-
waitingFor: o?.status === "suspended" ?
|
|
3049
|
-
error:
|
|
3416
|
+
currentStep: gi(s),
|
|
3417
|
+
waitingFor: o?.status === "suspended" ? hi(c) : void 0,
|
|
3418
|
+
error: _i(o, s),
|
|
3050
3419
|
traceId: o?.traceId,
|
|
3051
3420
|
loading: n.data === void 0,
|
|
3052
3421
|
cancel: l,
|
|
@@ -3063,8 +3432,8 @@ var kr = () => {
|
|
|
3063
3432
|
d,
|
|
3064
3433
|
f
|
|
3065
3434
|
]);
|
|
3066
|
-
},
|
|
3067
|
-
let { runtime: n, client: r } =
|
|
3435
|
+
}, yi = (e, t) => {
|
|
3436
|
+
let { runtime: n, client: r } = K(e), [i, a] = A([]), [o, s] = A("idle"), [c, l] = A(void 0), u = k(null), d = E(() => {
|
|
3068
3437
|
let e = u.current;
|
|
3069
3438
|
e && (u.current = null, n.runFork(ie.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
|
|
3070
3439
|
}, [n]);
|
|
@@ -3075,7 +3444,7 @@ var kr = () => {
|
|
|
3075
3444
|
start: E((e = {}) => {
|
|
3076
3445
|
let i = u.current;
|
|
3077
3446
|
i && n.runFork(ie.interrupt(i)), a([]), l(void 0), s("streaming");
|
|
3078
|
-
let o =
|
|
3447
|
+
let o = q(r, t)(e), c = R.runForEach(o, (e) => N.sync(() => a((t) => [...t, e]))).pipe(N.matchCause({
|
|
3079
3448
|
onSuccess: () => {
|
|
3080
3449
|
s("done");
|
|
3081
3450
|
},
|
|
@@ -3091,7 +3460,7 @@ var kr = () => {
|
|
|
3091
3460
|
]),
|
|
3092
3461
|
cancel: d
|
|
3093
3462
|
};
|
|
3094
|
-
},
|
|
3463
|
+
}, bi = (e, t, n, r) => {
|
|
3095
3464
|
let i = 0, a = !1, o = (e) => N.sync(() => {
|
|
3096
3465
|
e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
|
|
3097
3466
|
}), s = (e) => {
|
|
@@ -3112,21 +3481,21 @@ var kr = () => {
|
|
|
3112
3481
|
...t,
|
|
3113
3482
|
fromSeq: s
|
|
3114
3483
|
});
|
|
3115
|
-
return
|
|
3484
|
+
return R.runForEach(c, o).pipe(N.matchCauseEffect({
|
|
3116
3485
|
onSuccess: () => a ? N.sync(() => n.onStatus("done")) : l(r, s, void 0),
|
|
3117
3486
|
onFailure: (e) => M.isInterruptedOnly(e) ? N.void : a ? N.sync(() => n.onStatus("done")) : l(r, s, M.squash(e))
|
|
3118
3487
|
}));
|
|
3119
3488
|
});
|
|
3120
3489
|
return u(0);
|
|
3121
|
-
},
|
|
3490
|
+
}, xi = (e) => {
|
|
3122
3491
|
let t = e?._tag;
|
|
3123
3492
|
return t === "done" || t === "error";
|
|
3124
|
-
},
|
|
3125
|
-
let { runtime: r, client: i } =
|
|
3493
|
+
}, Si = (e, t, n = {}) => {
|
|
3494
|
+
let { runtime: r, client: i } = K(e), [a, o] = A([]), [s, c] = A("idle"), [l, u] = A(0), [d, f] = A(void 0), p = k(null), m = {
|
|
3126
3495
|
maxReconnects: n.maxReconnects ?? 6,
|
|
3127
3496
|
backoffMs: n.backoffMs ?? 400,
|
|
3128
3497
|
maxBackoffMs: n.maxBackoffMs ?? 8e3,
|
|
3129
|
-
isTerminal: n.isTerminal ??
|
|
3498
|
+
isTerminal: n.isTerminal ?? xi
|
|
3130
3499
|
}, h = E(() => {
|
|
3131
3500
|
let e = p.current;
|
|
3132
3501
|
e && (p.current = null, r.runFork(ie.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
|
|
@@ -3139,13 +3508,13 @@ var kr = () => {
|
|
|
3139
3508
|
start: E((e = {}) => {
|
|
3140
3509
|
let n = p.current;
|
|
3141
3510
|
n && r.runFork(ie.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
|
|
3142
|
-
let a =
|
|
3511
|
+
let a = q(i, t), s = {
|
|
3143
3512
|
onEvent: (e) => o((t) => [...t, e]),
|
|
3144
3513
|
onStatus: c,
|
|
3145
3514
|
onReconnect: () => u((e) => e + 1),
|
|
3146
3515
|
onError: f
|
|
3147
3516
|
};
|
|
3148
|
-
p.current = r.runFork(
|
|
3517
|
+
p.current = r.runFork(bi(a, e, s, m));
|
|
3149
3518
|
}, [
|
|
3150
3519
|
r,
|
|
3151
3520
|
i,
|
|
@@ -3157,13 +3526,13 @@ var kr = () => {
|
|
|
3157
3526
|
]),
|
|
3158
3527
|
cancel: h
|
|
3159
3528
|
};
|
|
3160
|
-
},
|
|
3529
|
+
}, Ci = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), wi = (e) => {
|
|
3161
3530
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
3162
3531
|
let n = e[t];
|
|
3163
3532
|
if (n.role === "user" && n.content) return n.content;
|
|
3164
3533
|
}
|
|
3165
|
-
},
|
|
3166
|
-
let { threadId: r } = n, i =
|
|
3534
|
+
}, Ti = (e, t, n) => {
|
|
3535
|
+
let { threadId: r } = n, i = J(e, `${t}.messages`, { threadId: r }), a = fr(e, `${t}.send`), o = O(() => [...i.data ?? []].sort(Ci), [i.data]), s = E((e, t = {}) => a.run({
|
|
3167
3536
|
threadId: r,
|
|
3168
3537
|
order: i.data?.length ?? 0,
|
|
3169
3538
|
prompt: e,
|
|
@@ -3173,7 +3542,7 @@ var kr = () => {
|
|
|
3173
3542
|
r,
|
|
3174
3543
|
i.data
|
|
3175
3544
|
]), c = E(() => {
|
|
3176
|
-
let e =
|
|
3545
|
+
let e = wi(o);
|
|
3177
3546
|
return e === void 0 ? void 0 : s(e);
|
|
3178
3547
|
}, [o, s]);
|
|
3179
3548
|
return O(() => ({
|
|
@@ -3193,8 +3562,8 @@ var kr = () => {
|
|
|
3193
3562
|
s,
|
|
3194
3563
|
c
|
|
3195
3564
|
]);
|
|
3196
|
-
},
|
|
3197
|
-
let { events: n, status: r, error: i, start: a, cancel: o } =
|
|
3565
|
+
}, Ei = (e, t) => {
|
|
3566
|
+
let { events: n, status: r, error: i, start: a, cancel: o } = yi(e, t), [s, c] = A([]), l = k(null), u = O(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
|
|
3198
3567
|
return D(() => {
|
|
3199
3568
|
if (r !== "done" || l.current === null) return;
|
|
3200
3569
|
let e = l.current;
|
|
@@ -3220,8 +3589,8 @@ var kr = () => {
|
|
|
3220
3589
|
}, [a]),
|
|
3221
3590
|
cancel: o
|
|
3222
3591
|
};
|
|
3223
|
-
},
|
|
3224
|
-
let n =
|
|
3592
|
+
}, Di = (e, t) => {
|
|
3593
|
+
let n = fr(e, t), [r, i] = A(void 0), a = E(async (e) => {
|
|
3225
3594
|
let t = await n.run({ question: e });
|
|
3226
3595
|
return i(t), t;
|
|
3227
3596
|
}, [n]), o = E(() => i(void 0), []);
|
|
@@ -3238,14 +3607,14 @@ var kr = () => {
|
|
|
3238
3607
|
n.error,
|
|
3239
3608
|
o
|
|
3240
3609
|
]);
|
|
3241
|
-
},
|
|
3242
|
-
let { cache: t, runtime: n } =
|
|
3610
|
+
}, Oi = (e) => {
|
|
3611
|
+
let { cache: t, runtime: n } = K(e);
|
|
3243
3612
|
return E(() => {
|
|
3244
3613
|
t.refreshAll(n);
|
|
3245
3614
|
}, [t, n]);
|
|
3246
|
-
},
|
|
3615
|
+
}, ki = (e) => e?._tag === "Unauthenticated", Ai = (e, t, n = {}) => {
|
|
3247
3616
|
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
3248
|
-
if (!
|
|
3617
|
+
if (!ki(e.error) || s >= i) return;
|
|
3249
3618
|
let n = a();
|
|
3250
3619
|
n - o < r || (o = n, s += 1, t());
|
|
3251
3620
|
}), l = e.onSuccess(() => {
|
|
@@ -3259,21 +3628,21 @@ var kr = () => {
|
|
|
3259
3628
|
s = 0;
|
|
3260
3629
|
}
|
|
3261
3630
|
};
|
|
3262
|
-
},
|
|
3263
|
-
let n =
|
|
3631
|
+
}, ji = (e, t) => {
|
|
3632
|
+
let n = K(e), r = n.recovery ?? pt(n.errorBus, e), i = k(t);
|
|
3264
3633
|
i.current = t, D(() => r.onVisibleError((e) => i.current(e)), [r]);
|
|
3265
|
-
},
|
|
3266
|
-
let { errorBus: n } =
|
|
3634
|
+
}, Mi = (e, t) => {
|
|
3635
|
+
let { errorBus: n } = K(e), r = k(t);
|
|
3267
3636
|
r.current = t, D(() => n.on((e) => r.current(e)), [n]);
|
|
3268
|
-
},
|
|
3637
|
+
}, Ni = {
|
|
3269
3638
|
failed: [],
|
|
3270
3639
|
healthy: !0
|
|
3271
|
-
},
|
|
3272
|
-
let { errorBus: t } =
|
|
3640
|
+
}, Pi = (e) => {
|
|
3641
|
+
let { errorBus: t } = K(e), [n, r] = A(Ni);
|
|
3273
3642
|
return D(() => {
|
|
3274
3643
|
let e = /* @__PURE__ */ new Map(), n = () => {
|
|
3275
3644
|
let t = [...e.values()].sort((e, t) => t.at - e.at);
|
|
3276
|
-
r(t.length === 0 ?
|
|
3645
|
+
r(t.length === 0 ? Ni : {
|
|
3277
3646
|
failed: t,
|
|
3278
3647
|
healthy: !1
|
|
3279
3648
|
});
|
|
@@ -3291,16 +3660,16 @@ var kr = () => {
|
|
|
3291
3660
|
i(), a();
|
|
3292
3661
|
};
|
|
3293
3662
|
}, [t]), n;
|
|
3294
|
-
},
|
|
3663
|
+
}, Fi = (e, t) => {
|
|
3295
3664
|
let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
|
|
3296
3665
|
if (i) return i;
|
|
3297
3666
|
let a = w(t);
|
|
3298
3667
|
return n[r] = a, a;
|
|
3299
|
-
},
|
|
3668
|
+
}, Ii = Fi("serverRequest", null), Li = () => ee(Ii), Ri = ({ value: e, children: t }) => /* @__PURE__ */ me(Ii.Provider, {
|
|
3300
3669
|
value: e,
|
|
3301
3670
|
children: t
|
|
3302
|
-
}),
|
|
3303
|
-
let t =
|
|
3671
|
+
}), zi = (e) => {
|
|
3672
|
+
let t = Li();
|
|
3304
3673
|
return O(() => {
|
|
3305
3674
|
if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
|
|
3306
3675
|
if (typeof document > "u") return;
|
|
@@ -3312,13 +3681,13 @@ var kr = () => {
|
|
|
3312
3681
|
return;
|
|
3313
3682
|
}
|
|
3314
3683
|
}, [t, e]);
|
|
3315
|
-
},
|
|
3684
|
+
}, Bi = (e, t, n) => e.map((e) => {
|
|
3316
3685
|
let r = String(e[n] ?? ""), i = e[t];
|
|
3317
3686
|
return {
|
|
3318
3687
|
value: r,
|
|
3319
3688
|
label: i == null ? r : String(i)
|
|
3320
3689
|
};
|
|
3321
|
-
}),
|
|
3690
|
+
}), Vi = (e, t, n = {}) => {
|
|
3322
3691
|
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
3692
|
D(() => {
|
|
3324
3693
|
if (s === l) return;
|
|
@@ -3329,7 +3698,7 @@ var kr = () => {
|
|
|
3329
3698
|
l,
|
|
3330
3699
|
r
|
|
3331
3700
|
]);
|
|
3332
|
-
let d = n.skipUntilTerm === !0 && l.trim() === "", f =
|
|
3701
|
+
let d = n.skipUntilTerm === !0 && l.trim() === "", f = J(e, t, O(() => o(l), [o, l]), { skip: d }), p = O(() => Bi(f.data ?? [], i, a), [
|
|
3333
3702
|
f.data,
|
|
3334
3703
|
i,
|
|
3335
3704
|
a
|
|
@@ -3340,8 +3709,8 @@ var kr = () => {
|
|
|
3340
3709
|
term: s,
|
|
3341
3710
|
search: m
|
|
3342
3711
|
};
|
|
3343
|
-
},
|
|
3344
|
-
let i =
|
|
3712
|
+
}, Hi = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Ui = (t, n, r = {}) => {
|
|
3713
|
+
let i = K(t), [a, o] = A(r.pageSize), s = J(t, n, O(() => a === void 0 ? r.input ?? {} : {
|
|
3345
3714
|
...r.input,
|
|
3346
3715
|
limit: a
|
|
3347
3716
|
}, [r.input, a])), c = i.descriptors[n]?.output, l = E(() => {
|
|
@@ -3361,7 +3730,7 @@ var kr = () => {
|
|
|
3361
3730
|
let e = s.data ?? [];
|
|
3362
3731
|
if (d === void 0) return e;
|
|
3363
3732
|
let t = d.direction === "asc" ? 1 : -1;
|
|
3364
|
-
return [...e].sort((e, n) =>
|
|
3733
|
+
return [...e].sort((e, n) => Hi(e[d.column], n[d.column]) * t);
|
|
3365
3734
|
}, [s.data, d]),
|
|
3366
3735
|
loading: s.data === void 0,
|
|
3367
3736
|
error: s.error,
|
|
@@ -3370,14 +3739,14 @@ var kr = () => {
|
|
|
3370
3739
|
loadMore: l,
|
|
3371
3740
|
hasMore: a !== void 0 && (s.data?.length ?? 0) >= a
|
|
3372
3741
|
};
|
|
3373
|
-
},
|
|
3742
|
+
}, Wi = (e, t, n, r) => {
|
|
3374
3743
|
let i = e.replace(/\/$/, ""), a = new URLSearchParams({
|
|
3375
3744
|
table: t,
|
|
3376
3745
|
id: n
|
|
3377
3746
|
});
|
|
3378
3747
|
return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
|
|
3379
|
-
},
|
|
3380
|
-
let { inspectBaseUrl: i } =
|
|
3748
|
+
}, Gi = Wi, Ki = (e, t, n, r) => {
|
|
3749
|
+
let { inspectBaseUrl: i } = K(e), [a, o] = A({
|
|
3381
3750
|
data: void 0,
|
|
3382
3751
|
loading: !0,
|
|
3383
3752
|
error: void 0
|
|
@@ -3389,7 +3758,7 @@ var kr = () => {
|
|
|
3389
3758
|
loading: !0,
|
|
3390
3759
|
error: void 0
|
|
3391
3760
|
});
|
|
3392
|
-
let a =
|
|
3761
|
+
let a = Wi(i ?? "", t, n, r);
|
|
3393
3762
|
return fetch(a).then(async (e) => {
|
|
3394
3763
|
if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
|
|
3395
3764
|
return await e.json();
|
|
@@ -3415,12 +3784,12 @@ var kr = () => {
|
|
|
3415
3784
|
n,
|
|
3416
3785
|
r
|
|
3417
3786
|
]), a;
|
|
3418
|
-
},
|
|
3419
|
-
function
|
|
3420
|
-
return T(
|
|
3787
|
+
}, qi = "admin:full", Ji = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Yi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), Xi = w({ scopes: [] });
|
|
3788
|
+
function Zi(e) {
|
|
3789
|
+
return T(Xi.Provider, { value: { scopes: e.scopes } }, e.children);
|
|
3421
3790
|
}
|
|
3422
|
-
var
|
|
3423
|
-
let { inspectBaseUrl: t } =
|
|
3791
|
+
var Qi = () => ee(Xi), $i = (e) => Ji(Qi().scopes, e), ea = (e) => Yi(Qi().scopes, e), ta = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, na = (e) => {
|
|
3792
|
+
let { inspectBaseUrl: t } = K(e), [n, r] = A({
|
|
3424
3793
|
manifest: void 0,
|
|
3425
3794
|
loading: !0,
|
|
3426
3795
|
error: void 0
|
|
@@ -3431,7 +3800,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3431
3800
|
manifest: void 0,
|
|
3432
3801
|
loading: !0,
|
|
3433
3802
|
error: void 0
|
|
3434
|
-
}), fetch(
|
|
3803
|
+
}), fetch(ta(t ?? "")).then(async (e) => {
|
|
3435
3804
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
3436
3805
|
return await e.json();
|
|
3437
3806
|
}).then((t) => {
|
|
@@ -3450,7 +3819,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3450
3819
|
e = !0;
|
|
3451
3820
|
};
|
|
3452
3821
|
}, [e, t]), n;
|
|
3453
|
-
},
|
|
3822
|
+
}, ra = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), ia = (e, t) => {
|
|
3454
3823
|
if (e === void 0) return "unknown";
|
|
3455
3824
|
if (t.includes("admin:full") || e.length === 0) return "allowed";
|
|
3456
3825
|
let n = !1;
|
|
@@ -3459,7 +3828,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3459
3828
|
n = !0;
|
|
3460
3829
|
continue;
|
|
3461
3830
|
}
|
|
3462
|
-
if (!
|
|
3831
|
+
if (!ra(t, r)) {
|
|
3463
3832
|
if (r.resourceScoped) {
|
|
3464
3833
|
n = !0;
|
|
3465
3834
|
continue;
|
|
@@ -3468,13 +3837,13 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3468
3837
|
}
|
|
3469
3838
|
}
|
|
3470
3839
|
return n ? "unknown" : "allowed";
|
|
3471
|
-
},
|
|
3840
|
+
}, aa = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), oa = (e) => {
|
|
3472
3841
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
3473
|
-
},
|
|
3842
|
+
}, sa = (e) => ia(e, Qi().scopes), ca = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, la = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, ua = (e) => e === void 0 ? {} : {
|
|
3474
3843
|
tag: e.tag,
|
|
3475
3844
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
3476
|
-
},
|
|
3477
|
-
let n = e.procedures.find((e) => e.kind === "query" &&
|
|
3845
|
+
}, da = (e) => e.tables.filter((e) => !e.framework).map((t) => {
|
|
3846
|
+
let n = e.procedures.find((e) => e.kind === "query" && ca(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && la(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && la(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && la(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
|
|
3478
3847
|
return {
|
|
3479
3848
|
table: t.name,
|
|
3480
3849
|
columns: t.columns.filter((e) => e.serverOnly !== !0),
|
|
@@ -3483,12 +3852,12 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3483
3852
|
reactive: t.reactive,
|
|
3484
3853
|
...o === void 0 ? {} : { pkColumn: o },
|
|
3485
3854
|
editable: (t.editable ?? !0) && o !== void 0,
|
|
3486
|
-
list:
|
|
3487
|
-
create:
|
|
3488
|
-
update:
|
|
3489
|
-
delete:
|
|
3855
|
+
list: ua(n),
|
|
3856
|
+
create: ua(r),
|
|
3857
|
+
update: ua(i),
|
|
3858
|
+
delete: ua(a)
|
|
3490
3859
|
};
|
|
3491
|
-
}),
|
|
3860
|
+
}), fa = (e) => {
|
|
3492
3861
|
let [t, n] = A([]), [r, i] = A([]), a = E((e) => {
|
|
3493
3862
|
n((t) => [...t, e]), i([]);
|
|
3494
3863
|
}, []), o = E(async () => {
|
|
@@ -3516,8 +3885,8 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3516
3885
|
o,
|
|
3517
3886
|
s
|
|
3518
3887
|
]);
|
|
3519
|
-
},
|
|
3520
|
-
let n = t?.limit, { data: r } =
|
|
3888
|
+
}, pa = "__voltro.undo.log", ma = "__voltro.undo.apply", ha = "__voltro.undo.redo", ga = (e, t) => {
|
|
3889
|
+
let n = t?.limit, { data: r } = J(e, pa, n === void 0 ? {} : { limit: n }), i = sr(e, ma), a = sr(e, ha), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = E(async (e) => {
|
|
3521
3890
|
await i.mutate({ invocationId: e });
|
|
3522
3891
|
}, [i]), u = E(async (e) => {
|
|
3523
3892
|
await a.mutate({ invocationId: e });
|
|
@@ -3536,21 +3905,21 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3536
3905
|
undoLast: d,
|
|
3537
3906
|
redoLast: f
|
|
3538
3907
|
};
|
|
3539
|
-
},
|
|
3908
|
+
}, _a = (e, t) => ({
|
|
3540
3909
|
name: e,
|
|
3541
3910
|
map: t
|
|
3542
|
-
}),
|
|
3911
|
+
}), va = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), ya = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), ba = (e, t, n) => {
|
|
3543
3912
|
let r = { ...t };
|
|
3544
3913
|
for (let [i, a] of Object.entries(e.map)) {
|
|
3545
|
-
if (
|
|
3914
|
+
if (ya.has(i) || a === void 0) continue;
|
|
3546
3915
|
let e = t[i];
|
|
3547
3916
|
r[i] = (...r) => {
|
|
3548
|
-
let i =
|
|
3917
|
+
let i = va(a, t);
|
|
3549
3918
|
if (i !== null && n(i), typeof e == "function") return e(...r);
|
|
3550
3919
|
};
|
|
3551
3920
|
}
|
|
3552
3921
|
return r;
|
|
3553
|
-
},
|
|
3922
|
+
}, xa = (e, t, n) => {
|
|
3554
3923
|
let r = k({
|
|
3555
3924
|
spec: e,
|
|
3556
3925
|
props: t,
|
|
@@ -3561,46 +3930,46 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3561
3930
|
props: t,
|
|
3562
3931
|
sink: n
|
|
3563
3932
|
}, D(() => {
|
|
3564
|
-
let e = r.current, t =
|
|
3933
|
+
let e = r.current, t = va(e.spec.map.onMount, e.props);
|
|
3565
3934
|
return t !== null && e.sink(t), () => {
|
|
3566
|
-
let e = r.current, t =
|
|
3935
|
+
let e = r.current, t = va(e.spec.map.onUnmount, e.props);
|
|
3567
3936
|
t !== null && e.sink(t);
|
|
3568
3937
|
};
|
|
3569
|
-
}, []), O(() =>
|
|
3938
|
+
}, []), O(() => ba(e, t, n), [
|
|
3570
3939
|
e,
|
|
3571
3940
|
t,
|
|
3572
3941
|
n
|
|
3573
3942
|
]);
|
|
3574
|
-
},
|
|
3575
|
-
let n =
|
|
3943
|
+
}, Sa = (e, t) => {
|
|
3944
|
+
let n = K(e).descriptors[t]?.input;
|
|
3576
3945
|
return O(() => n === void 0 ? [] : x(n), [n]);
|
|
3577
|
-
},
|
|
3578
|
-
let r =
|
|
3946
|
+
}, Ca = (t, n) => {
|
|
3947
|
+
let r = K(t).descriptors[n]?.output;
|
|
3579
3948
|
return O(() => r === void 0 ? [] : e(r), [r]);
|
|
3580
|
-
},
|
|
3949
|
+
}, wa = (e, t) => {
|
|
3581
3950
|
if (e === t) return !0;
|
|
3582
3951
|
if (e.length !== t.length) return !1;
|
|
3583
3952
|
for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
|
|
3584
3953
|
return !0;
|
|
3585
|
-
},
|
|
3586
|
-
let n = k(null), r =
|
|
3587
|
-
return (n.current === null || !
|
|
3954
|
+
}, Ta = (e) => Object.keys(e).sort().map((t) => e[t]), Ea = (e, t) => {
|
|
3955
|
+
let n = k(null), r = Ta(e);
|
|
3956
|
+
return (n.current === null || !wa(n.current.key, r)) && (n.current = {
|
|
3588
3957
|
key: r,
|
|
3589
3958
|
value: t(e)
|
|
3590
3959
|
}), n.current.value;
|
|
3591
|
-
},
|
|
3592
|
-
let i =
|
|
3960
|
+
}, Da = (e, t, n, r = {}) => {
|
|
3961
|
+
let i = J(e, t, { ...n }, r);
|
|
3593
3962
|
return O(() => ({
|
|
3594
3963
|
allowed: i.data?.allowed === !0,
|
|
3595
3964
|
pending: i.data === void 0
|
|
3596
3965
|
}), [i.data]);
|
|
3597
|
-
},
|
|
3598
|
-
let i =
|
|
3966
|
+
}, Oa = (e, t, n, r = {}) => {
|
|
3967
|
+
let i = J(e, t, { ...n }, r);
|
|
3599
3968
|
return O(() => ({
|
|
3600
3969
|
allowedIds: new Set(i.data?.allowedIds ?? []),
|
|
3601
3970
|
pending: i.data === void 0
|
|
3602
3971
|
}), [i.data]);
|
|
3603
|
-
},
|
|
3972
|
+
}, ka = (e) => {
|
|
3604
3973
|
switch (e) {
|
|
3605
3974
|
case "select":
|
|
3606
3975
|
case "radio":
|
|
@@ -3616,26 +3985,26 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3616
3985
|
case "switch": return "boolean";
|
|
3617
3986
|
default: return null;
|
|
3618
3987
|
}
|
|
3619
|
-
},
|
|
3988
|
+
}, Aa = (e) => x(e).map((e) => {
|
|
3620
3989
|
if (e.name.includes(".")) return null;
|
|
3621
|
-
let t =
|
|
3990
|
+
let t = ka(e.widget);
|
|
3622
3991
|
return t === null ? null : {
|
|
3623
3992
|
name: e.name,
|
|
3624
3993
|
label: e.label,
|
|
3625
3994
|
kind: t,
|
|
3626
3995
|
...e.options ? { options: e.options } : {}
|
|
3627
3996
|
};
|
|
3628
|
-
}).filter((e) => e !== null),
|
|
3997
|
+
}).filter((e) => e !== null), ja = (e) => {
|
|
3629
3998
|
let t = {};
|
|
3630
3999
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
3631
4000
|
return t;
|
|
3632
|
-
},
|
|
3633
|
-
let r =
|
|
3634
|
-
o((n) =>
|
|
4001
|
+
}, Ma = (e, t, n = {}) => {
|
|
4002
|
+
let r = K(e).descriptors[t]?.input, i = O(() => r === void 0 ? [] : Aa(r), [r]), [a, o] = A(n.initial ?? {}), s = E((e, t) => {
|
|
4003
|
+
o((n) => ja({
|
|
3635
4004
|
...n,
|
|
3636
4005
|
[e]: t
|
|
3637
4006
|
}));
|
|
3638
|
-
}, []), c = E(() => o({}), []), l =
|
|
4007
|
+
}, []), c = E(() => o({}), []), l = J(e, t, O(() => ja(a), [a]));
|
|
3639
4008
|
return {
|
|
3640
4009
|
filters: i,
|
|
3641
4010
|
values: a,
|
|
@@ -3646,20 +4015,20 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3646
4015
|
loading: l.data === void 0,
|
|
3647
4016
|
error: l.error
|
|
3648
4017
|
};
|
|
3649
|
-
},
|
|
3650
|
-
let r =
|
|
4018
|
+
}, Na = (e, t, n = {}) => {
|
|
4019
|
+
let r = J(e, t, n), i = r.data;
|
|
3651
4020
|
return {
|
|
3652
4021
|
record: Array.isArray(i) ? i[0] : i,
|
|
3653
4022
|
loading: i === void 0,
|
|
3654
4023
|
error: r.error
|
|
3655
4024
|
};
|
|
3656
|
-
},
|
|
4025
|
+
}, Pa = (e, t = 300) => {
|
|
3657
4026
|
let [n, r] = A(e);
|
|
3658
4027
|
return D(() => {
|
|
3659
4028
|
let n = setTimeout(() => r(e), t);
|
|
3660
4029
|
return () => clearTimeout(n);
|
|
3661
4030
|
}, [e, t]), n;
|
|
3662
|
-
},
|
|
4031
|
+
}, Fa = (e) => {
|
|
3663
4032
|
let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
|
|
3664
4033
|
if (a && t.trim() === "") return {
|
|
3665
4034
|
status: "idle",
|
|
@@ -3677,39 +4046,39 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3677
4046
|
valid: o.valid,
|
|
3678
4047
|
message: o.message
|
|
3679
4048
|
};
|
|
3680
|
-
},
|
|
3681
|
-
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c =
|
|
3682
|
-
return
|
|
4049
|
+
}, Ia = (e, t, n, r) => {
|
|
4050
|
+
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Pa(n, o), l = s && c.trim() === "", u = J(e, t, O(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
|
|
4051
|
+
return Fa({
|
|
3683
4052
|
value: n,
|
|
3684
4053
|
debouncedValue: c,
|
|
3685
4054
|
data: l ? null : u.data,
|
|
3686
4055
|
interpret: a,
|
|
3687
4056
|
skipEmpty: s
|
|
3688
4057
|
});
|
|
3689
|
-
},
|
|
4058
|
+
}, La = (e, t) => ({
|
|
3690
4059
|
name: e,
|
|
3691
4060
|
payload: t
|
|
3692
|
-
}),
|
|
3693
|
-
let n =
|
|
4061
|
+
}), Ra = (e, t) => {
|
|
4062
|
+
let n = oe.decodeUnknownEither(e.payload, { errors: "all" })(t);
|
|
3694
4063
|
if (n._tag === "Right") return {
|
|
3695
4064
|
valid: !0,
|
|
3696
4065
|
errors: {}
|
|
3697
4066
|
};
|
|
3698
4067
|
let r = {};
|
|
3699
|
-
for (let e of
|
|
4068
|
+
for (let e of _e.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
|
|
3700
4069
|
return {
|
|
3701
4070
|
valid: !1,
|
|
3702
4071
|
errors: r
|
|
3703
4072
|
};
|
|
3704
|
-
},
|
|
4073
|
+
}, za = (e) => {
|
|
3705
4074
|
let t = new Map(e.map((e) => [e.name, e]));
|
|
3706
4075
|
return {
|
|
3707
4076
|
names: [...t.keys()].sort(),
|
|
3708
4077
|
get: (e) => t.get(e),
|
|
3709
4078
|
events: e
|
|
3710
4079
|
};
|
|
3711
|
-
},
|
|
3712
|
-
let n =
|
|
4080
|
+
}, Ba = (e, t) => {
|
|
4081
|
+
let n = za(e);
|
|
3713
4082
|
return {
|
|
3714
4083
|
track: (e, r) => {
|
|
3715
4084
|
let i = n.get(e);
|
|
@@ -3718,7 +4087,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3718
4087
|
return;
|
|
3719
4088
|
}
|
|
3720
4089
|
if (process.env.NODE_ENV !== "production") {
|
|
3721
|
-
let t =
|
|
4090
|
+
let t = Ra(i, r);
|
|
3722
4091
|
t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
|
|
3723
4092
|
}
|
|
3724
4093
|
t({
|
|
@@ -3729,47 +4098,47 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3729
4098
|
names: n.names,
|
|
3730
4099
|
catalog: n
|
|
3731
4100
|
};
|
|
3732
|
-
},
|
|
3733
|
-
let n =
|
|
4101
|
+
}, Va = (e, t) => {
|
|
4102
|
+
let n = fr(e, t);
|
|
3734
4103
|
return {
|
|
3735
4104
|
preview: E((e) => n.run(e), [n]),
|
|
3736
4105
|
diff: n.lastResult,
|
|
3737
4106
|
pending: n.pending,
|
|
3738
4107
|
error: n.error
|
|
3739
4108
|
};
|
|
3740
|
-
},
|
|
4109
|
+
}, Ha = (e, t, n, r) => [...e, {
|
|
3741
4110
|
id: t,
|
|
3742
4111
|
tag: n,
|
|
3743
4112
|
input: r,
|
|
3744
4113
|
status: "pending",
|
|
3745
4114
|
attempts: 0
|
|
3746
|
-
}],
|
|
4115
|
+
}], Ua = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3747
4116
|
...e,
|
|
3748
4117
|
...n
|
|
3749
|
-
} : e),
|
|
4118
|
+
} : e), Wa = (e, t) => Ua(e, t, { status: "sent" }), Ga = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3750
4119
|
...e,
|
|
3751
4120
|
status: "failed",
|
|
3752
4121
|
error: n,
|
|
3753
4122
|
attempts: e.attempts + 1
|
|
3754
|
-
} : e),
|
|
4123
|
+
} : e), Ka = (e, t, n) => Ua(e, t, {
|
|
3755
4124
|
status: "conflict",
|
|
3756
4125
|
error: n
|
|
3757
|
-
}),
|
|
4126
|
+
}), qa = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
|
|
3758
4127
|
...e,
|
|
3759
4128
|
input: n,
|
|
3760
4129
|
status: "pending",
|
|
3761
4130
|
error: void 0
|
|
3762
|
-
} : e),
|
|
4131
|
+
} : e), Ja = (e) => e.filter((e) => e.status !== "sent"), Ya = (e) => {
|
|
3763
4132
|
let t = [];
|
|
3764
4133
|
for (let n of e) {
|
|
3765
4134
|
if (n.status === "conflict") break;
|
|
3766
4135
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
3767
4136
|
}
|
|
3768
4137
|
return t;
|
|
3769
|
-
},
|
|
4138
|
+
}, Xa = (e) => {
|
|
3770
4139
|
let t = e;
|
|
3771
4140
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
3772
|
-
},
|
|
4141
|
+
}, Za = (e) => {
|
|
3773
4142
|
let [t, n] = A(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
|
|
3774
4143
|
return D(() => {
|
|
3775
4144
|
if (e !== void 0) {
|
|
@@ -3782,54 +4151,87 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3782
4151
|
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
3783
4152
|
};
|
|
3784
4153
|
}, [e]), t;
|
|
3785
|
-
},
|
|
3786
|
-
let { send: t, persistence: n, isConflict: r =
|
|
3787
|
-
|
|
3788
|
-
|
|
4154
|
+
}, Qa = (e) => {
|
|
4155
|
+
let { send: t, persistence: n, isConflict: r = Xa, idFor: i } = e, [a, o] = A([]), [s, c] = A(0), l = Za(e.online), u = k([]), d = E((e) => {
|
|
4156
|
+
let t = e(u.current);
|
|
4157
|
+
u.current = t, o(t);
|
|
4158
|
+
}, []), f = k(t);
|
|
4159
|
+
f.current = t;
|
|
4160
|
+
let p = k(r);
|
|
4161
|
+
p.current = r;
|
|
4162
|
+
let m = k(void 0), h = k(!1), g = k(!0);
|
|
4163
|
+
D(() => (g.current = !0, () => {
|
|
4164
|
+
g.current = !1;
|
|
4165
|
+
}), []);
|
|
4166
|
+
let _ = k(0), v = k(Math.random().toString(36).slice(2, 8)), y = k(n === void 0);
|
|
3789
4167
|
D(() => {
|
|
3790
|
-
if (n === void 0 ||
|
|
4168
|
+
if (n === void 0 || y.current) return;
|
|
3791
4169
|
let e = !1;
|
|
3792
4170
|
return n.load().then((t) => {
|
|
3793
|
-
e || (
|
|
4171
|
+
e || (y.current = !0, t.length > 0 && d((e) => [...t, ...e]), c((e) => e + 1));
|
|
3794
4172
|
}).catch(() => {
|
|
3795
|
-
|
|
4173
|
+
e || (y.current = !0, c((e) => e + 1));
|
|
3796
4174
|
}), () => {
|
|
3797
4175
|
e = !0;
|
|
3798
4176
|
};
|
|
3799
|
-
}, [n]), D(() => {
|
|
3800
|
-
n === void 0 || !
|
|
3801
|
-
}, [
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
4177
|
+
}, [n, d]), D(() => {
|
|
4178
|
+
n === void 0 || !y.current || n.save(Ja(a)).catch(() => {});
|
|
4179
|
+
}, [
|
|
4180
|
+
n,
|
|
4181
|
+
a,
|
|
4182
|
+
s
|
|
4183
|
+
]);
|
|
4184
|
+
let b = E((e, t) => {
|
|
4185
|
+
let n = i?.() ?? `obx_${v.current}_${_.current++}_${e}`;
|
|
4186
|
+
d((r) => Ha(r, n, e, t)), c((e) => e + 1);
|
|
4187
|
+
}, [i, d]), x = E(() => {
|
|
4188
|
+
if (!y.current || !g.current) return Promise.resolve();
|
|
4189
|
+
if (m.current !== void 0) return m.current;
|
|
4190
|
+
h.current = !1;
|
|
4191
|
+
let e = Promise.resolve().then(async () => {
|
|
4192
|
+
for (; g.current;) {
|
|
4193
|
+
let e = Ya(u.current)[0];
|
|
4194
|
+
if (e === void 0) break;
|
|
4195
|
+
try {
|
|
4196
|
+
if (await f.current(e), !g.current) break;
|
|
4197
|
+
d((t) => Wa(t, e.id));
|
|
4198
|
+
} catch (t) {
|
|
4199
|
+
if (!g.current) break;
|
|
4200
|
+
d((n) => p.current(t) ? Ka(n, e.id, t) : Ga(n, e.id, t)), h.current = !0;
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
3812
4203
|
}
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
4204
|
+
}).finally(() => {
|
|
4205
|
+
m.current === e && (m.current = void 0);
|
|
4206
|
+
});
|
|
4207
|
+
return m.current = e, e;
|
|
4208
|
+
}, [d]);
|
|
3816
4209
|
D(() => {
|
|
3817
|
-
|
|
3818
|
-
}, [
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
4210
|
+
l && x();
|
|
4211
|
+
}, [l, x]), D(() => {
|
|
4212
|
+
l && !h.current && x();
|
|
4213
|
+
}, [
|
|
4214
|
+
s,
|
|
4215
|
+
l,
|
|
4216
|
+
x
|
|
4217
|
+
]);
|
|
4218
|
+
let S = E((e, t) => {
|
|
4219
|
+
d((n) => qa(n, e, t)), l && x();
|
|
4220
|
+
}, [
|
|
4221
|
+
l,
|
|
4222
|
+
x,
|
|
4223
|
+
d
|
|
4224
|
+
]);
|
|
3823
4225
|
return {
|
|
3824
4226
|
queue: a,
|
|
3825
|
-
enqueue:
|
|
3826
|
-
replay:
|
|
3827
|
-
online:
|
|
4227
|
+
enqueue: b,
|
|
4228
|
+
replay: x,
|
|
4229
|
+
online: l,
|
|
3828
4230
|
pending: a.filter((e) => e.status === "pending" || e.status === "failed").length,
|
|
3829
4231
|
conflicts: a.filter((e) => e.status === "conflict"),
|
|
3830
|
-
resolveConflict:
|
|
4232
|
+
resolveConflict: S
|
|
3831
4233
|
};
|
|
3832
|
-
},
|
|
4234
|
+
}, $a = (e) => {
|
|
3833
4235
|
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);
|
|
3834
4236
|
return {
|
|
3835
4237
|
startIndex: l,
|
|
@@ -3839,8 +4241,8 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3839
4241
|
topSpacer: l * r,
|
|
3840
4242
|
bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
|
|
3841
4243
|
};
|
|
3842
|
-
},
|
|
3843
|
-
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = A(0), u = O(() =>
|
|
4244
|
+
}, eo = (e, t, n) => {
|
|
4245
|
+
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = A(0), u = O(() => $a({
|
|
3844
4246
|
scrollTop: c,
|
|
3845
4247
|
viewportHeight: i,
|
|
3846
4248
|
rowHeight: r,
|
|
@@ -3852,7 +4254,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3852
4254
|
r,
|
|
3853
4255
|
a,
|
|
3854
4256
|
o
|
|
3855
|
-
]), d =
|
|
4257
|
+
]), d = J(e, t, O(() => ({
|
|
3856
4258
|
...s,
|
|
3857
4259
|
offset: u.offset,
|
|
3858
4260
|
limit: u.limit
|
|
@@ -3872,8 +4274,8 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3872
4274
|
loading: d.data === void 0,
|
|
3873
4275
|
error: d.error
|
|
3874
4276
|
};
|
|
3875
|
-
},
|
|
3876
|
-
let t =
|
|
4277
|
+
}, to = () => typeof navigator > "u" || navigator.onLine, no = (e) => {
|
|
4278
|
+
let t = K(e), n = t.recovery ?? pt(t.errorBus, e), r = j(n.subscribe, n.getSnapshot, n.getSnapshot), [i, a] = A(to);
|
|
3877
4279
|
D(() => {
|
|
3878
4280
|
if (typeof window > "u") return;
|
|
3879
4281
|
let e = () => {
|
|
@@ -3885,7 +4287,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3885
4287
|
}, []);
|
|
3886
4288
|
let o = E(() => n.reportExternalSuccess(), [n]), s = i ? r.status : "offline";
|
|
3887
4289
|
return D(() => {
|
|
3888
|
-
|
|
4290
|
+
U(e, "connection.status", {
|
|
3889
4291
|
status: s,
|
|
3890
4292
|
rawTransport: r.rawTransport,
|
|
3891
4293
|
online: i,
|
|
@@ -3910,7 +4312,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3910
4312
|
mutationReplay: r.mutationReplay,
|
|
3911
4313
|
reportSuccess: o
|
|
3912
4314
|
};
|
|
3913
|
-
},
|
|
4315
|
+
}, ro = "__voltro.connections.list", io = "__voltro.connections.start", ao = "__voltro.connections.submitToken", oo = "__voltro.connections.disconnect", so = {
|
|
3914
4316
|
connectionId: "",
|
|
3915
4317
|
kind: "oauth2",
|
|
3916
4318
|
label: "",
|
|
@@ -3921,14 +4323,14 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3921
4323
|
expiresAt: null,
|
|
3922
4324
|
lastError: null,
|
|
3923
4325
|
connectedAt: null
|
|
3924
|
-
},
|
|
4326
|
+
}, co = (e, t) => {
|
|
3925
4327
|
if (t === "redirect") {
|
|
3926
4328
|
globalThis.location.assign(e);
|
|
3927
4329
|
return;
|
|
3928
4330
|
}
|
|
3929
4331
|
globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
|
|
3930
|
-
},
|
|
3931
|
-
let { data: t } =
|
|
4332
|
+
}, lo = (e) => {
|
|
4333
|
+
let { data: t } = J(e, ro, {}), n = fr(e, io), r = sr(e, ao), i = sr(e, oo), a = t ?? [], o = n.pending || r.pending || i.pending, s = E((e) => ({
|
|
3932
4334
|
...e,
|
|
3933
4335
|
connected: e.status === "connected",
|
|
3934
4336
|
needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
|
|
@@ -3936,7 +4338,7 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3936
4338
|
connect: async (t) => {
|
|
3937
4339
|
if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
|
|
3938
4340
|
let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
|
|
3939
|
-
|
|
4341
|
+
co((await n.run({
|
|
3940
4342
|
connectionId: e.connectionId,
|
|
3941
4343
|
redirectTo: r
|
|
3942
4344
|
})).authorizeUrl, t?.mode);
|
|
@@ -3966,10 +4368,10 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3966
4368
|
get: c,
|
|
3967
4369
|
pending: o
|
|
3968
4370
|
};
|
|
3969
|
-
},
|
|
3970
|
-
let n =
|
|
4371
|
+
}, uo = (e, t) => {
|
|
4372
|
+
let n = lo(e), r = n.get(t);
|
|
3971
4373
|
return O(() => r === void 0 ? {
|
|
3972
|
-
...
|
|
4374
|
+
...so,
|
|
3973
4375
|
connectionId: t,
|
|
3974
4376
|
label: t,
|
|
3975
4377
|
connected: !1,
|
|
@@ -3994,6 +4396,6 @@ var Fi = () => ee(Ni), Ii = (e) => ji(Fi().scopes, e), Li = (e) => Mi(Fi().scope
|
|
|
3994
4396
|
n.loading,
|
|
3995
4397
|
n.pending
|
|
3996
4398
|
]);
|
|
3997
|
-
},
|
|
4399
|
+
}, fo = "framework-client";
|
|
3998
4400
|
//#endregion
|
|
3999
|
-
export {
|
|
4401
|
+
export { qi as ADMIN_SCOPE, fo as CLIENT_NAME, ro as CONNECTIONS_LIST_TAG, oo as CONNECTION_DISCONNECT_TAG, io as CONNECTION_START_TAG, ao 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, Cr as FormBindingProvider, mt as FrameworkRuntimesContext, Ht as FrameworkRuntimesProvider, $e as LoadingSubscriptionCache, Zi as PermissionProvider, _ as RICH_TEXT_MARKS, a as RICH_TEXT_MAX_NODES, dt as RecoveryCoordinator, d as RichTextDocument, it as RpcErrorBus, Ii as ServerRequestContext, Ri as ServerRequestProvider, Qe as SubscriptionCache, ma as UNDO_APPLY_TAG, pa as UNDO_LOG_TAG, ha as UNDO_REDO_TAG, mr as ValidationMessagesProvider, Dt as _resetFrameworkRuntimesWarning, St as _resetSsrDescriptors, Rr as applyPreloadSeeds, An as applyStoreSeeds, Lt as buildApiRuntime, Ji as canCall, Yi as canCallAny, Ie as clearClientDiagnostics, Un as clearMutations, Ja as clearSent, un as clearStoreHistory, Fe as clientDiagnosticsSnapshot, $a as computeWindow, Ba as createAnalytics, Ar as createHooks, ia as decideAccess, c as decodeFieldIssues, La as defineEvent, Tn as defineStore, _a as defineTracking, wn as definedStores, da as deriveEntityAdmins, Pe as disableClientDiagnosticsPersistence, n as documentLocale, y as emptyRichTextDocument, Ne as enableClientDiagnosticsPersistence, Ha as enqueueEntry, za as eventCatalog, Aa as filtersFromSchema, r as formActionPath, m as formDataToInput, S as formField, t as formSections, Zn as freshIdempotencyKey, nr as getMutationNotifier, Vn as getMutations, Fi as globalContext, o as isRichTextDocument, s as isSafeHref, ki as isUnauthenticated, kt as isUnresolvedApi, jr as makePreloadSeedBag, Dn as makeStoreSeedBag, ta as manifestUrl, Ka as markConflict, Ga as markFailed, Wa as markSent, oa as openAccessReason, h as parseRichText, Gi as provenanceUrl, tt as publishClientError, ye as publishClientTrace, Br as readPreloadedSeedOutcome, zr as readPreloadedSnapshot, U as recordClientDiagnostic, pt as recoveryCoordinatorFor, bt as registerSsrDescriptors, Ya as replayable, rt as reportClientError, aa as requiredScopes, Vr as resetPreloadSeeds, En as resetStoreRegistryForTests, Jt as resetStoreStorageForTest, q as resolveByTag, qa as resolveConflictEntry, ut as resolveRecoveryOptions, qt as resolveStoreStorage, va as resolveTrackingEvent, b as resolveValidationMessage, C as restrictToSchema, bi as resumableConsumeProgram, f as richTextToPlainText, Bi as rowsToOptions, qr as runSequence, e as schemaToColumns, x as schemaToFields, Ir as seedPreloadedSubscription, Lr as seedPreloadedSubscriptionFailure, kn as seedStore, Kr as sequence, l as serializeRichText, tr as setMutationNotifier, Nr as setPreloadSeedResolver, On as setStoreSeedResolver, Kt as setStoreStorage, Bn as settleMutation, Yt as shallow, wa as shallowArrayEqual, Ta as sourceValues, gt as ssrClientProxy, xt as ssrDescriptorsFor, Ct as ssrStubHandle, W as stableKey, Vt as startApiSupervisor, zn as startMutation, cn as storeHistory, Le as subscribeClientDiagnostics, nt as subscribeClientErrors, be as subscribeClientTraces, Hn as subscribeMutations, ln as subscribeStoreHistory, Be as supersedesConfirmedPatches, dn as travelToStoreState, sa as useAccessDecision, fr as useAction, Ei as useAgent, Ti as useAgentChat, yi as useAgentStream, Ia as useAsyncValidation, $i as useCan, ea as useCanAny, na as useCapabilityManifest, uo as useConnection, Or as useConnectionSetup, no as useConnectionStatus, lo as useConnections, Di as useDataCopilot, Ui as useDataTable, Pa as useDebounced, Ea as useDerived, Gr as useEvent, Sr as useFormBinding, wr as useFormBindingContext, Tr as useFormField, zi as useFormFlash, Sa as useFormSkeleton, K as useFrameworkApi, Ot as useFrameworkRuntimes, sr as useMutation, Mi as useOnRawRpcError, ji as useOnRpcError, Qa as useOutbox, Qi as usePermissions, Hr as usePreloadedSubscription, Va as usePreview, Ki as useProvenance, Vi as useQueryField, Ma as useQueryFilters, Na as useRecord, Oi as useRefreshSubscriptions, Da as useResourceCan, Oa as useResourceCans, Si as useResumableAgentStream, Jr as useSequence, Li as useServerRequest, J as useSubscription, Pi as useSubscriptionHealth, Ca as useTableSkeleton, xa as useTracking, ti as useTranscription, fa as useUndo, ga as useUndoLog, ei as useUpload, hr as useValidationMessages, eo as useWindowedSubscription, ri as useWorkflow, di as useWorkflowDomainEvents, fi as useWorkflowEventDeliveries, ui as useWorkflowEvents, oi as useWorkflowRun, li as useWorkflowRunEvents, vi as useWorkflowRunState, ci as useWorkflowRunSteps, si as useWorkflowRuns, ii as useWorkflowSignal, ai as useWorkflowUpdate, Ra as validateEventPayload, i as validateFields, Fa as validationStatus, Ai as wireAuthRefresh, Qn as withIdempotencyKey, It as withProtocolOpenRecovery, ba as wrapTrackedCallbacks };
|