@voltro/client 0.74.0 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +319 -0
- package/dist/{authRefresh-8OXBP96t.js → authRefresh-BhamJWRV.js} +144 -141
- package/dist/index.js +698 -698
- package/dist/runtime.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h,
|
|
2
|
-
import { C as k, S as A, _ as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { Cause as
|
|
5
|
-
import * as
|
|
6
|
-
import { RpcClient as
|
|
7
|
-
import { fieldIssuesOf as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { FormApi as
|
|
10
|
-
import { useStore as
|
|
11
|
-
import { ArrayFormatter as
|
|
1
|
+
import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as y, n as b, o as x, p as S, r as C, s as w, t as T, u as E, v as D, w as ee, x as te, y as O } from "./authRefresh-BhamJWRV.js";
|
|
2
|
+
import { C as k, S as A, _ as ne, a as j, b as re, c as M, d as ie, f as ae, g as oe, h as N, i as se, l as ce, m as le, n as ue, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as P, w as _e, x as ve, y as ye } from "./formData-dGz5aoUR.js";
|
|
3
|
+
import { createContext as F, createElement as be, useCallback as I, useContext as L, useDebugValue as xe, useEffect as R, useId as Se, useMemo as z, useRef as B, useState as V, useSyncExternalStore as H } from "react";
|
|
4
|
+
import { Cause as Ce, Duration as we, Effect as U, Exit as Te, Fiber as Ee, Option as De, Schedule as Oe, Schema as ke, Stream as W } from "effect";
|
|
5
|
+
import * as Ae from "@effect/platform/Headers";
|
|
6
|
+
import { RpcClient as je } from "@effect/rpc";
|
|
7
|
+
import { fieldIssuesOf as Me, pluginTag as Ne } from "@voltro/protocol";
|
|
8
|
+
import { jsx as Pe } from "react/jsx-runtime";
|
|
9
|
+
import { FormApi as Fe } from "@tanstack/form-core";
|
|
10
|
+
import { useStore as Ie } from "@tanstack/react-store";
|
|
11
|
+
import { ArrayFormatter as Le } from "effect/ParseResult";
|
|
12
12
|
//#region src/runtimeContext.ts
|
|
13
|
-
var
|
|
13
|
+
var Re = F(null), ze = () => {
|
|
14
14
|
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");
|
|
15
|
-
},
|
|
16
|
-
get: (e, t) =>
|
|
15
|
+
}, Be = new Proxy(() => ze(), {
|
|
16
|
+
get: (e, t) => Be,
|
|
17
17
|
has: () => !0,
|
|
18
|
-
apply: () =>
|
|
19
|
-
}),
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
runtime: { runPromiseExit: () => Promise.resolve(
|
|
18
|
+
apply: () => ze()
|
|
19
|
+
}), Ve = Symbol.for("@voltro/client/ssrDescriptors"), He = globalThis, Ue = He[Ve] ?? (He[Ve] = { byApi: /* @__PURE__ */ new Map() }), We = (e, t) => {
|
|
20
|
+
Ue.byApi.set(e, t);
|
|
21
|
+
}, Ge = (e) => Ue.byApi.get(e), Ke = () => {
|
|
22
|
+
Ue.byApi.clear();
|
|
23
|
+
}, qe = {
|
|
24
|
+
runtime: { runPromiseExit: () => Promise.resolve(Te.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
|
|
25
25
|
cache: new s(),
|
|
26
|
-
client:
|
|
26
|
+
client: Be,
|
|
27
27
|
descriptors: {},
|
|
28
28
|
inspectBaseUrl: "",
|
|
29
|
-
errorBus: new
|
|
30
|
-
recovery: new
|
|
31
|
-
},
|
|
29
|
+
errorBus: new S(),
|
|
30
|
+
recovery: new E("ssr")
|
|
31
|
+
}, Je = {
|
|
32
32
|
get: (e) => {
|
|
33
|
-
let t =
|
|
34
|
-
return t === void 0 ?
|
|
35
|
-
...
|
|
33
|
+
let t = Ge(e);
|
|
34
|
+
return t === void 0 ? qe : {
|
|
35
|
+
...qe,
|
|
36
36
|
descriptors: t
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
39
|
names: []
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
let e =
|
|
44
|
-
return e ? (
|
|
45
|
-
G = null, !(
|
|
46
|
-
}, 0)),
|
|
40
|
+
}, Ye = !1, Xe = !1, G = null, Ze = () => {
|
|
41
|
+
Ye = !1, Xe = !1, G !== null && (clearTimeout(G), G = null);
|
|
42
|
+
}, Qe = () => {
|
|
43
|
+
let e = L(Re);
|
|
44
|
+
return e ? (Xe || (Xe = !0, G !== null && (clearTimeout(G), G = null)), e) : (globalThis.window !== void 0 && !Ye && !Xe && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
|
|
45
|
+
G = null, !(Ye || Xe) && (Ye = !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>."));
|
|
46
|
+
}, 0)), Je);
|
|
47
47
|
}, K = (e) => {
|
|
48
|
-
let t =
|
|
49
|
-
return
|
|
48
|
+
let t = Qe(), n = t.demand;
|
|
49
|
+
return R(() => {
|
|
50
50
|
n?.(e);
|
|
51
51
|
}, [n, e]), t.get(e);
|
|
52
|
-
},
|
|
53
|
-
let r =
|
|
52
|
+
}, $e = (e) => typeof e.runtime?.runFork != "function", et = ({ apis: e, children: t, demand: n }) => {
|
|
53
|
+
let r = z(() => ({
|
|
54
54
|
get: (t) => {
|
|
55
55
|
let n = e.get(t);
|
|
56
56
|
if (!n) {
|
|
@@ -62,45 +62,45 @@ var Le = N(null), Re = () => {
|
|
|
62
62
|
names: Array.from(e.keys()),
|
|
63
63
|
...n === void 0 ? {} : { demand: n }
|
|
64
64
|
}), [e]);
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ Pe(Re.Provider, {
|
|
66
66
|
value: r,
|
|
67
67
|
children: t
|
|
68
68
|
});
|
|
69
|
-
},
|
|
70
|
-
let e = globalThis, t = e[
|
|
69
|
+
}, tt = Symbol.for("@voltro/client/storeStorageProvider"), nt = () => {
|
|
70
|
+
let e = globalThis, t = e[tt];
|
|
71
71
|
if (t !== void 0) return t;
|
|
72
72
|
let n = {
|
|
73
73
|
provider: void 0,
|
|
74
74
|
used: !1
|
|
75
75
|
};
|
|
76
|
-
return e[
|
|
77
|
-
},
|
|
76
|
+
return e[tt] = n, n;
|
|
77
|
+
}, rt = (e) => {
|
|
78
78
|
if (typeof window > "u") return null;
|
|
79
79
|
try {
|
|
80
80
|
return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
|
|
81
81
|
} catch {
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
|
-
}, rt = (e) => {
|
|
85
|
-
let t = tt();
|
|
86
|
-
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;
|
|
87
84
|
}, it = (e) => {
|
|
88
|
-
let t =
|
|
89
|
-
|
|
90
|
-
}, at = () => {
|
|
91
|
-
let
|
|
85
|
+
let t = nt();
|
|
86
|
+
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;
|
|
87
|
+
}, at = (e) => {
|
|
88
|
+
let t = nt();
|
|
89
|
+
return t.used = !0, (t.provider ?? rt)(e);
|
|
90
|
+
}, ot = () => {
|
|
91
|
+
let e = nt();
|
|
92
92
|
e.provider = void 0, e.used = !1;
|
|
93
|
-
},
|
|
93
|
+
}, st = (e, t) => {
|
|
94
94
|
if (Object.is(e, t)) return !0;
|
|
95
95
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
96
96
|
let n = Object.keys(e), r = Object.keys(t);
|
|
97
97
|
if (n.length !== r.length) return !1;
|
|
98
98
|
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
99
99
|
return !0;
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
let r =
|
|
100
|
+
}, ct = 50, lt = /* @__PURE__ */ new Set(), ut = (e, t) => {
|
|
101
|
+
lt.has(e) || (lt.add(e), console.warn(t));
|
|
102
|
+
}, dt = "\0global", ft = null, pt = (e, t, n) => {
|
|
103
|
+
let r = ft?.() ?? null;
|
|
104
104
|
if (r === null) return n;
|
|
105
105
|
let i = n;
|
|
106
106
|
for (let n of r.seeds) n.store === e && n.key === t && (i = {
|
|
@@ -108,9 +108,9 @@ var Le = N(null), Re = () => {
|
|
|
108
108
|
...n.value
|
|
109
109
|
});
|
|
110
110
|
return i;
|
|
111
|
-
},
|
|
111
|
+
}, mt = (e, t) => {
|
|
112
112
|
let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
|
|
113
|
-
if (i >=
|
|
113
|
+
if (i >= ct) throw i = 0, Error(`defineStore: notification depth exceeded ${ct} — 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.`);
|
|
114
114
|
i += 1;
|
|
115
115
|
try {
|
|
116
116
|
for (let e of [...r]) e();
|
|
@@ -131,20 +131,20 @@ var Le = N(null), Re = () => {
|
|
|
131
131
|
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}', () => { … })\`.`);
|
|
132
132
|
if (--a, a > 0) return;
|
|
133
133
|
let l = o, u = s;
|
|
134
|
-
o = void 0, s = void 0, !
|
|
134
|
+
o = void 0, s = void 0, !st(l, n) && (t(l, n, u), c());
|
|
135
135
|
},
|
|
136
136
|
set: (e, r) => {
|
|
137
137
|
let i = typeof e == "function" ? e(n) : {
|
|
138
138
|
...n,
|
|
139
139
|
...e
|
|
140
140
|
};
|
|
141
|
-
if (
|
|
141
|
+
if (st(i, n)) return;
|
|
142
142
|
let o = n;
|
|
143
143
|
n = i, !(a > 0) && (t(o, i, r), c());
|
|
144
144
|
},
|
|
145
145
|
reset: () => {
|
|
146
146
|
let r = e();
|
|
147
|
-
if (
|
|
147
|
+
if (st(r, n)) return;
|
|
148
148
|
let i = n;
|
|
149
149
|
n = r, !(a > 0) && (t(i, r, "reset"), c());
|
|
150
150
|
},
|
|
@@ -152,51 +152,51 @@ var Le = N(null), Re = () => {
|
|
|
152
152
|
r.delete(e);
|
|
153
153
|
})
|
|
154
154
|
};
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
}),
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
let n =
|
|
155
|
+
}, ht = 200, gt = [], _t = /* @__PURE__ */ new Set(), vt = [], yt = () => vt, bt = (e) => (_t.add(e), () => {
|
|
156
|
+
_t.delete(e);
|
|
157
|
+
}), xt = () => {
|
|
158
|
+
gt.length = 0, vt = [];
|
|
159
|
+
}, St = (e, t) => {
|
|
160
|
+
let n = gt[e];
|
|
161
161
|
if (n === void 0) return !1;
|
|
162
|
-
let r =
|
|
162
|
+
let r = Et.get(n.store);
|
|
163
163
|
if (r === void 0) return !1;
|
|
164
164
|
let i = t === "before" ? n.prev : n.next;
|
|
165
|
-
|
|
165
|
+
wt = !0;
|
|
166
166
|
try {
|
|
167
167
|
r.set(() => i, n.key, `travel:${t}`);
|
|
168
168
|
} finally {
|
|
169
|
-
|
|
169
|
+
wt = !1;
|
|
170
170
|
}
|
|
171
171
|
return !0;
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
for (let e of [...
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
})),
|
|
178
|
-
function
|
|
172
|
+
}, Ct = !1, wt = !1, Tt = (e) => {
|
|
173
|
+
gt.push(e), gt.length > ht && gt.shift(), vt = [...gt];
|
|
174
|
+
for (let e of [..._t]) e();
|
|
175
|
+
}, Et = /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ new Map(), Ot = 0, kt = !1, At = /* @__PURE__ */ new Map(), jt = () => (kt || (kt = !0, queueMicrotask(() => {
|
|
176
|
+
Ot += 1, kt = !1;
|
|
177
|
+
})), Ot), Mt = Nt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
|
|
178
|
+
function Nt(e) {
|
|
179
179
|
let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
|
|
180
180
|
return n.length > 0 ? n : void 0;
|
|
181
181
|
}
|
|
182
|
-
var
|
|
182
|
+
var Pt = () => {
|
|
183
183
|
let e = (/* @__PURE__ */ Error()).stack;
|
|
184
184
|
if (typeof e != "string") return "<unknown>";
|
|
185
185
|
for (let t of e.split("\n").slice(1)) {
|
|
186
|
-
let e =
|
|
186
|
+
let e = Nt(t);
|
|
187
187
|
if (e === void 0) continue;
|
|
188
188
|
let n = e.replace(/:\d+:\d+$/, "");
|
|
189
|
-
if (
|
|
189
|
+
if (Mt === "" || n !== Mt.replace(/:\d+:\d+$/, "")) return n;
|
|
190
190
|
}
|
|
191
191
|
return "<unknown>";
|
|
192
|
-
},
|
|
193
|
-
let r =
|
|
192
|
+
}, Ft = () => [...Et.values()], It = (e, t, n) => {
|
|
193
|
+
let r = Pt(), i = jt(), a = Et.get(e);
|
|
194
194
|
if (a !== void 0) {
|
|
195
|
-
let t =
|
|
195
|
+
let t = Dt.get(e) ?? "<unknown>", n = At.get(e) === i;
|
|
196
196
|
if (r !== "<unknown>" && r === t && !n) return a;
|
|
197
197
|
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}`);
|
|
198
198
|
}
|
|
199
|
-
let o = n?.persist, s = () =>
|
|
199
|
+
let o = n?.persist, s = () => at(o?.storage === "session" ? "session" : "local"), c = () => {
|
|
200
200
|
let e = s();
|
|
201
201
|
if (e === null || o === void 0) return;
|
|
202
202
|
let t;
|
|
@@ -221,28 +221,28 @@ var Nt = () => {
|
|
|
221
221
|
t.setItem(o.key, JSON.stringify(n));
|
|
222
222
|
} catch {}
|
|
223
223
|
}, u = /* @__PURE__ */ new Map(), d = (n) => {
|
|
224
|
-
let r = n ??
|
|
224
|
+
let r = n ?? dt, i = u.get(r);
|
|
225
225
|
if (i === void 0) {
|
|
226
226
|
let a = n;
|
|
227
|
-
i =
|
|
227
|
+
i = mt(o !== void 0 && n === void 0 ? () => {
|
|
228
228
|
let e = t();
|
|
229
229
|
return f = e, {
|
|
230
230
|
...e,
|
|
231
231
|
...c() ?? {}
|
|
232
232
|
};
|
|
233
233
|
} : t, (t, n, r) => {
|
|
234
|
-
if (o !== void 0 && a === void 0 && l(n), !
|
|
234
|
+
if (o !== void 0 && a === void 0 && l(n), !Ct && !wt) {
|
|
235
235
|
let e = m(a);
|
|
236
236
|
e.steps.length = e.cursor, e.steps.push({
|
|
237
237
|
prev: t,
|
|
238
238
|
next: n
|
|
239
239
|
}), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
Tt({
|
|
242
242
|
store: e,
|
|
243
243
|
...a === void 0 ? {} : { key: a },
|
|
244
244
|
...r === void 0 ? {} : { label: r },
|
|
245
|
-
...
|
|
245
|
+
...Ct || wt ? { isUndo: !0 } : {},
|
|
246
246
|
prev: t,
|
|
247
247
|
next: n,
|
|
248
248
|
at: Date.now()
|
|
@@ -251,7 +251,7 @@ var Nt = () => {
|
|
|
251
251
|
}
|
|
252
252
|
return i;
|
|
253
253
|
}, f, p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
254
|
-
let t = e ??
|
|
254
|
+
let t = e ?? dt, n = p.get(t);
|
|
255
255
|
return n === void 0 && (n = {
|
|
256
256
|
steps: [],
|
|
257
257
|
cursor: 0
|
|
@@ -271,24 +271,24 @@ var Nt = () => {
|
|
|
271
271
|
}, b = {
|
|
272
272
|
name: e,
|
|
273
273
|
use: (t, n) => {
|
|
274
|
-
let r = d(n?.key), i =
|
|
274
|
+
let r = d(n?.key), i = B(t);
|
|
275
275
|
i.current = t;
|
|
276
|
-
let a =
|
|
276
|
+
let a = B(n?.equals);
|
|
277
277
|
a.current = n?.equals;
|
|
278
|
-
let o =
|
|
278
|
+
let o = B({
|
|
279
279
|
state: void 0,
|
|
280
280
|
value: void 0,
|
|
281
281
|
has: !1
|
|
282
|
-
}), s =
|
|
282
|
+
}), s = I((t) => {
|
|
283
283
|
let n = o.current;
|
|
284
284
|
if (n.has && Object.is(n.state, t)) return n.value;
|
|
285
285
|
let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
|
|
286
|
-
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r &&
|
|
286
|
+
if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && st(n.value, r)) {
|
|
287
287
|
let t = !0;
|
|
288
288
|
try {
|
|
289
289
|
t = !Object.is(i.current(n.state), n.value);
|
|
290
290
|
} catch {}
|
|
291
|
-
|
|
291
|
+
ut(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.`);
|
|
292
292
|
}
|
|
293
293
|
let l = c ? n.value : r;
|
|
294
294
|
return o.current = {
|
|
@@ -296,7 +296,7 @@ var Nt = () => {
|
|
|
296
296
|
value: l,
|
|
297
297
|
has: !0
|
|
298
298
|
}, l;
|
|
299
|
-
}, []), c = n?.key, l = n?.retain === !0, u =
|
|
299
|
+
}, []), c = n?.key, l = n?.retain === !0, u = I((e) => {
|
|
300
300
|
let t = r.subscribe(e);
|
|
301
301
|
return c !== void 0 && !l && v(c), () => {
|
|
302
302
|
t(), c !== void 0 && !l && y(c);
|
|
@@ -305,11 +305,11 @@ var Nt = () => {
|
|
|
305
305
|
r,
|
|
306
306
|
c,
|
|
307
307
|
l
|
|
308
|
-
]), p =
|
|
308
|
+
]), p = I(() => s(r.get()), [r, s]), m = I(() => s(pt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
|
|
309
309
|
r,
|
|
310
310
|
n?.key,
|
|
311
311
|
s
|
|
312
|
-
]), h =
|
|
312
|
+
]), h = H(u, p, m);
|
|
313
313
|
return xe(h), h;
|
|
314
314
|
},
|
|
315
315
|
instance: d,
|
|
@@ -323,11 +323,11 @@ var Nt = () => {
|
|
|
323
323
|
undo: (e) => {
|
|
324
324
|
let t = m(e);
|
|
325
325
|
if (t.cursor === 0) return !1;
|
|
326
|
-
--t.cursor,
|
|
326
|
+
--t.cursor, Ct = !0;
|
|
327
327
|
try {
|
|
328
328
|
d(e).set(() => t.steps[t.cursor].prev, "undo");
|
|
329
329
|
} finally {
|
|
330
|
-
|
|
330
|
+
Ct = !1;
|
|
331
331
|
}
|
|
332
332
|
return !0;
|
|
333
333
|
},
|
|
@@ -335,11 +335,11 @@ var Nt = () => {
|
|
|
335
335
|
let t = m(e);
|
|
336
336
|
if (t.cursor >= t.steps.length) return !1;
|
|
337
337
|
let n = t.steps[t.cursor];
|
|
338
|
-
t.cursor += 1,
|
|
338
|
+
t.cursor += 1, Ct = !0;
|
|
339
339
|
try {
|
|
340
340
|
d(e).set(() => n.next, "redo");
|
|
341
341
|
} finally {
|
|
342
|
-
|
|
342
|
+
Ct = !1;
|
|
343
343
|
}
|
|
344
344
|
return !0;
|
|
345
345
|
},
|
|
@@ -351,55 +351,55 @@ var Nt = () => {
|
|
|
351
351
|
release: (e) => {
|
|
352
352
|
u.delete(e), p.delete(e);
|
|
353
353
|
},
|
|
354
|
-
keys: () => [...u.keys()].filter((e) => e !==
|
|
354
|
+
keys: () => [...u.keys()].filter((e) => e !== dt)
|
|
355
355
|
};
|
|
356
|
-
return
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
let r =
|
|
356
|
+
return Et.set(e, b), Dt.set(e, r), At.set(e, i), b;
|
|
357
|
+
}, Lt = () => {
|
|
358
|
+
Et.clear(), Dt.clear(), At.clear(), lt.clear();
|
|
359
|
+
}, Rt = () => ({ seeds: [] }), zt = (e) => {
|
|
360
|
+
ft = e;
|
|
361
|
+
}, Bt = (e, t, n) => {
|
|
362
|
+
let r = ft?.() ?? null;
|
|
363
363
|
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.)`);
|
|
364
364
|
r.seeds.push({
|
|
365
365
|
store: e.name,
|
|
366
366
|
...n?.key === void 0 ? {} : { key: n.key },
|
|
367
367
|
value: t
|
|
368
368
|
});
|
|
369
|
-
},
|
|
369
|
+
}, Vt = (e) => {
|
|
370
370
|
if (e !== void 0) for (let t of e) {
|
|
371
|
-
let e =
|
|
371
|
+
let e = Et.get(t.store);
|
|
372
372
|
e !== void 0 && e.set(t.value, t.key);
|
|
373
373
|
}
|
|
374
|
-
},
|
|
374
|
+
}, Ht = Object.freeze({
|
|
375
375
|
data: void 0,
|
|
376
376
|
revision: -1,
|
|
377
377
|
emittedAt: void 0,
|
|
378
378
|
error: void 0,
|
|
379
379
|
pendingPatches: 0
|
|
380
|
-
}),
|
|
380
|
+
}), Ut = () => Ht;
|
|
381
381
|
function q(e, t, n = {}, r = {}) {
|
|
382
|
-
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u =
|
|
382
|
+
let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = B(n);
|
|
383
383
|
u.current = n;
|
|
384
|
-
let d =
|
|
384
|
+
let d = B(s);
|
|
385
385
|
d.current = s;
|
|
386
|
-
let f =
|
|
386
|
+
let f = z(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = z(() => {
|
|
387
387
|
let e = u.current;
|
|
388
388
|
return {
|
|
389
389
|
queryKey: [t, e],
|
|
390
390
|
fetch: () => h(d.current, t)(e)
|
|
391
391
|
};
|
|
392
|
-
}, [t, f]), m = p.queryKey, g =
|
|
392
|
+
}, [t, f]), m = p.queryKey, g = I((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
|
|
393
393
|
o,
|
|
394
394
|
a,
|
|
395
395
|
l,
|
|
396
396
|
i,
|
|
397
397
|
p
|
|
398
|
-
]), _ =
|
|
398
|
+
]), _ = I(() => i ? Ht : o.peek(m), [
|
|
399
399
|
o,
|
|
400
400
|
i,
|
|
401
401
|
m
|
|
402
|
-
]), v =
|
|
402
|
+
]), v = H(g, _, Ut), y = v.data !== void 0, b = y && (Array.isArray(v.data) ? v.data.length === 0 : v.data === null), x = {
|
|
403
403
|
revision: v.revision,
|
|
404
404
|
emittedAt: v.emittedAt,
|
|
405
405
|
error: v.error,
|
|
@@ -456,25 +456,25 @@ function q(e, t, n = {}, r = {}) {
|
|
|
456
456
|
}
|
|
457
457
|
//#endregion
|
|
458
458
|
//#region src/awaitResolvedApi.ts
|
|
459
|
-
var
|
|
460
|
-
if (
|
|
461
|
-
let r = Date.now() +
|
|
462
|
-
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)),
|
|
463
|
-
throw Error(`Voltro: the api "${t}" did not resolve within ${
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
for (let e of
|
|
459
|
+
var Wt = 15e3, J = async (e, t, n) => {
|
|
460
|
+
if (!$e(e.current)) return e.current;
|
|
461
|
+
let r = Date.now() + Wt;
|
|
462
|
+
for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !$e(e.current)) return e.current;
|
|
463
|
+
throw Error(`Voltro: the api "${t}" did not resolve within ${Wt}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.`);
|
|
464
|
+
}, Gt = 100, Y = [], Kt = /* @__PURE__ */ new Set(), qt = [], Jt = () => {
|
|
465
|
+
qt = Y.slice();
|
|
466
|
+
}, Yt = () => {
|
|
467
|
+
Jt();
|
|
468
|
+
for (let e of Kt) try {
|
|
469
469
|
e();
|
|
470
470
|
} catch {}
|
|
471
|
-
},
|
|
471
|
+
}, Xt = (e) => {
|
|
472
472
|
let t = {
|
|
473
473
|
...e,
|
|
474
474
|
status: "pending",
|
|
475
475
|
startedAt: Date.now()
|
|
476
476
|
};
|
|
477
|
-
Y.unshift(t), Y.length >
|
|
477
|
+
Y.unshift(t), Y.length > Gt && (Y.length = Gt), Yt();
|
|
478
478
|
}, X = (e, t) => {
|
|
479
479
|
let n = Y.findIndex((t) => t.id === e);
|
|
480
480
|
if (n === -1) return;
|
|
@@ -491,43 +491,43 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
491
491
|
error: t.error,
|
|
492
492
|
settledAt: i,
|
|
493
493
|
durationMs: i - r.startedAt
|
|
494
|
-
},
|
|
495
|
-
},
|
|
496
|
-
|
|
497
|
-
}),
|
|
498
|
-
Y.length !== 0 && (Y.length = 0,
|
|
499
|
-
},
|
|
494
|
+
}, Yt();
|
|
495
|
+
}, Zt = () => qt, Qt = (e) => (Kt.add(e), () => {
|
|
496
|
+
Kt.delete(e);
|
|
497
|
+
}), $t = () => {
|
|
498
|
+
Y.length !== 0 && (Y.length = 0, Yt());
|
|
499
|
+
}, en = /* @__PURE__ */ new WeakMap(), tn = (e, t) => {
|
|
500
500
|
let n = Object.freeze({
|
|
501
501
|
apiName: e,
|
|
502
502
|
kind: "connection-setup"
|
|
503
503
|
});
|
|
504
|
-
return
|
|
505
|
-
},
|
|
506
|
-
let n =
|
|
504
|
+
return en.set(n, t), n;
|
|
505
|
+
}, nn = (e, t) => {
|
|
506
|
+
let n = en.get(e);
|
|
507
507
|
if (n === void 0 || e.apiName !== t) throw Error(`Voltro: connection setup must belong to api "${t}"`);
|
|
508
508
|
return n;
|
|
509
|
-
},
|
|
510
|
-
|
|
511
|
-
},
|
|
509
|
+
}, rn = /* @__PURE__ */ new WeakMap(), an = (e, t) => {
|
|
510
|
+
rn.set(e, t);
|
|
511
|
+
}, on = (e) => rn.get(e)?.capture(), sn = 0, cn = () => {
|
|
512
512
|
let e = typeof crypto < "u" ? crypto : void 0;
|
|
513
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${
|
|
514
|
-
},
|
|
513
|
+
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${sn += 1}`;
|
|
514
|
+
}, ln = (e, t) => e.pipe(U.locallyWith(je.currentHeaders, (e) => Ae.set(e, "idempotency-key", t))), un = class extends Error {
|
|
515
515
|
reason;
|
|
516
516
|
_tag = "MutationSerialExecutionError";
|
|
517
517
|
constructor(e) {
|
|
518
518
|
super(`Serial mutation cannot start: ${e}`), this.reason = e, this.name = "MutationSerialExecutionError";
|
|
519
519
|
}
|
|
520
|
-
},
|
|
520
|
+
}, dn = (e = 32) => {
|
|
521
521
|
if (!Number.isSafeInteger(e) || e < 1) throw RangeError("maxPending must be a positive safe integer");
|
|
522
522
|
let t = /* @__PURE__ */ new WeakMap(), n = 0;
|
|
523
523
|
return { reserve(r, i) {
|
|
524
|
-
if (typeof r != "string" || r.length === 0) throw new
|
|
525
|
-
if (i.aborted) throw new
|
|
524
|
+
if (typeof r != "string" || r.length === 0) throw new un("invalid-key");
|
|
525
|
+
if (i.aborted) throw new un("scope-changed");
|
|
526
526
|
let a = t.get(i);
|
|
527
527
|
a === void 0 && (a = /* @__PURE__ */ new Map(), t.set(i, a));
|
|
528
528
|
let o = a, s = a.get(r);
|
|
529
|
-
if (s?.blocked.signal.aborted) throw new
|
|
530
|
-
if (n >= e) throw new
|
|
529
|
+
if (s?.blocked.signal.aborted) throw new un("unknown-predecessor");
|
|
530
|
+
if (n >= e) throw new un("capacity");
|
|
531
531
|
s === void 0 && (s = {
|
|
532
532
|
semaphore: U.unsafeMakeSemaphore(1),
|
|
533
533
|
calls: 0,
|
|
@@ -538,8 +538,8 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
538
538
|
let l = new AbortController(), u = () => l.abort();
|
|
539
539
|
i.addEventListener("abort", u, { once: !0 }), c.blocked.signal.addEventListener("abort", u, { once: !0 });
|
|
540
540
|
let d = () => {
|
|
541
|
-
if (i.aborted) throw new
|
|
542
|
-
if (c.blocked.signal.aborted) throw new
|
|
541
|
+
if (i.aborted) throw new un("scope-changed");
|
|
542
|
+
if (c.blocked.signal.aborted) throw new un("unknown-predecessor");
|
|
543
543
|
}, f = U.runPromise(c.semaphore.take(1), { signal: l.signal }), p = f.then(() => {
|
|
544
544
|
d();
|
|
545
545
|
}, (e) => {
|
|
@@ -559,12 +559,12 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
559
559
|
}
|
|
560
560
|
};
|
|
561
561
|
} };
|
|
562
|
-
},
|
|
563
|
-
let r =
|
|
564
|
-
r === void 0 && (r = /* @__PURE__ */ new Map(),
|
|
562
|
+
}, fn = /* @__PURE__ */ new WeakMap(), pn = (e, t, n) => {
|
|
563
|
+
let r = fn.get(e);
|
|
564
|
+
r === void 0 && (r = /* @__PURE__ */ new Map(), fn.set(e, r));
|
|
565
565
|
let i = r.get(t);
|
|
566
|
-
return i === void 0 && (i =
|
|
567
|
-
},
|
|
566
|
+
return i === void 0 && (i = dn(n), r.set(t, i)), i;
|
|
567
|
+
}, mn = (e, t) => {
|
|
568
568
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
569
569
|
try {
|
|
570
570
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -574,39 +574,39 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
574
574
|
});
|
|
575
575
|
} catch {}
|
|
576
576
|
return e;
|
|
577
|
-
},
|
|
578
|
-
|
|
579
|
-
},
|
|
577
|
+
}, hn, gn = (e) => {
|
|
578
|
+
hn = e;
|
|
579
|
+
}, _n = () => hn, vn = (e, t, n) => typeof e == "function" ? e(t, n) : e, yn = 0, bn = () => `mut_${++yn}`, xn = (e, t) => ({
|
|
580
580
|
update: (n, r) => {
|
|
581
581
|
e.update(n, r, t);
|
|
582
582
|
},
|
|
583
583
|
forTag: (n, r) => e.forTag(n, r, t)
|
|
584
|
-
}),
|
|
585
|
-
let n = K(e), { descriptors: r } = n, a =
|
|
584
|
+
}), Sn = (e, t) => {
|
|
585
|
+
let n = K(e), { descriptors: r } = n, a = B(n);
|
|
586
586
|
a.current = n;
|
|
587
587
|
let o = r[t], s = o?.targets;
|
|
588
588
|
if (process.env.NODE_ENV !== "production") {
|
|
589
589
|
let n = o?.kind;
|
|
590
590
|
n !== void 0 && n !== "mutation" && console.error(`[@voltro/client] useMutation('${e}', '${t}') targets a ${n}, not a mutation. Use ${n === "action" ? "useAction" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
|
|
591
591
|
}
|
|
592
|
-
let [c, l] =
|
|
592
|
+
let [c, l] = V(!1), [f, p] = V(void 0), [m, g] = V(void 0), v = B(null), y = B(!1), b = B(0), x = I(async (n, r) => {
|
|
593
593
|
let o = r?.onError !== void 0 || r?.notify?.error !== void 0, c = (e) => {
|
|
594
594
|
r?.onError?.(e, n);
|
|
595
|
-
let t =
|
|
596
|
-
t !== void 0 &&
|
|
595
|
+
let t = vn(r?.notify?.error, e, n);
|
|
596
|
+
t !== void 0 && hn?.error(t);
|
|
597
597
|
};
|
|
598
598
|
b.current += 1;
|
|
599
599
|
let f = () => l(--b.current > 0);
|
|
600
600
|
l(!0), p(void 0);
|
|
601
|
-
let m,
|
|
601
|
+
let m, S, w, T, E;
|
|
602
602
|
try {
|
|
603
|
-
T =
|
|
603
|
+
T = on(x);
|
|
604
604
|
let r = a.current.descriptors[t]?.serialize;
|
|
605
605
|
if (r !== void 0) {
|
|
606
606
|
let i = a.current, o = i.recovery ?? d(i.errorBus, e);
|
|
607
|
-
E =
|
|
607
|
+
E = pn(i.descriptors, t, r.maxPending ?? 32).reserve(r.key(n), o.subjectSignal);
|
|
608
608
|
}
|
|
609
|
-
({runtime: m, cache:
|
|
609
|
+
({runtime: m, cache: S, client: w} = await J(a, e, t));
|
|
610
610
|
} catch (e) {
|
|
611
611
|
if (E?.release(), f(), p(e), a.current.errorBus.emit({
|
|
612
612
|
source: "mutation",
|
|
@@ -617,24 +617,24 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
617
617
|
}), o) return c(e);
|
|
618
618
|
throw e;
|
|
619
619
|
}
|
|
620
|
-
let D =
|
|
621
|
-
|
|
620
|
+
let D = bn(), ee = r?.idempotencyKey ?? cn();
|
|
621
|
+
Xt({
|
|
622
622
|
id: D,
|
|
623
623
|
apiName: e,
|
|
624
624
|
tag: t,
|
|
625
625
|
input: n
|
|
626
626
|
});
|
|
627
|
-
let
|
|
627
|
+
let te = v.current, O = y.current;
|
|
628
628
|
try {
|
|
629
|
-
|
|
629
|
+
te ? te(xn(S, D), n) : !O && s && s.length > 0 && S.autoApply(s, n, D);
|
|
630
630
|
} catch (e) {
|
|
631
|
-
if (E?.release(), p(e), f(),
|
|
631
|
+
if (E?.release(), p(e), f(), S.revertByMutation(D), X(D, {
|
|
632
632
|
status: "error",
|
|
633
633
|
error: e
|
|
634
634
|
}), o) return c(e);
|
|
635
635
|
throw e;
|
|
636
636
|
}
|
|
637
|
-
let
|
|
637
|
+
let k, A = !1, ne, j, re, M = Date.now();
|
|
638
638
|
try {
|
|
639
639
|
if (E) {
|
|
640
640
|
await E.ready, E.assertActive();
|
|
@@ -643,11 +643,11 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
643
643
|
}
|
|
644
644
|
let o = async (r, i, o, s) => {
|
|
645
645
|
let c = u(r), l = c?.getSnapshot();
|
|
646
|
-
|
|
646
|
+
j = c === void 0 ? void 0 : () => a.current.runtime === r && l !== void 0 && c.getSnapshot() === l, s?.(), E?.assertActive();
|
|
647
647
|
let d = T === void 0 ? void 0 : await T.prepare(r, i);
|
|
648
648
|
l = c?.getSnapshot(), s?.();
|
|
649
|
-
let f =
|
|
650
|
-
|
|
649
|
+
let f = ln(h(i, t)(n), ee), p = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
|
|
650
|
+
k = e.traceId, _({
|
|
651
651
|
traceId: e.traceId,
|
|
652
652
|
spanId: e.spanId,
|
|
653
653
|
source: "mutation",
|
|
@@ -655,7 +655,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
655
655
|
});
|
|
656
656
|
})), U.catchAll(() => U.void), U.zipRight(U.try({
|
|
657
657
|
try: () => {
|
|
658
|
-
s?.(), E?.assertActive(),
|
|
658
|
+
s?.(), E?.assertActive(), A = !0;
|
|
659
659
|
},
|
|
660
660
|
catch: (e) => e
|
|
661
661
|
})), U.zipRight(f)).pipe(U.withSpan(`client.mutation.${t}`, { attributes: {
|
|
@@ -664,25 +664,25 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
664
664
|
"rpc.tag": t,
|
|
665
665
|
"voltro.replay": o
|
|
666
666
|
} }));
|
|
667
|
-
return d === void 0 ?
|
|
667
|
+
return d === void 0 ? C(r, p) : d.run(p);
|
|
668
668
|
}, s;
|
|
669
669
|
try {
|
|
670
670
|
s = await o(m, w, !1);
|
|
671
671
|
} catch (n) {
|
|
672
|
-
let r = i(n,
|
|
672
|
+
let r = i(n, A ? "handler" : "client"), c = mn(n, k);
|
|
673
673
|
r === "transport" && (a.current.errorBus.emit({
|
|
674
674
|
source: "mutation",
|
|
675
675
|
tag: t,
|
|
676
676
|
error: c,
|
|
677
677
|
kind: r,
|
|
678
|
-
...
|
|
679
|
-
outcome:
|
|
680
|
-
...
|
|
681
|
-
}),
|
|
682
|
-
let l = a.current, u = l.recovery ?? d(l.errorBus, e), f = r === "transport" ? u.reserveMutationReplay(
|
|
678
|
+
...j === void 0 ? {} : { affectsTransport: j() },
|
|
679
|
+
outcome: A ? "unknown" : "not-started",
|
|
680
|
+
...k === void 0 ? {} : { traceId: k }
|
|
681
|
+
}), ne = c);
|
|
682
|
+
let l = a.current, u = l.recovery ?? d(l.errorBus, e), f = r === "transport" ? u.reserveMutationReplay(M) : void 0;
|
|
683
683
|
if (f === void 0) throw c;
|
|
684
684
|
try {
|
|
685
|
-
if (!await u.waitForMutationReplaySupport(
|
|
685
|
+
if (!await u.waitForMutationReplaySupport(M) || !await u.waitForProtocolReady(M) || !f.isValid()) throw c;
|
|
686
686
|
let n = () => {
|
|
687
687
|
if (!f.isValid()) throw c;
|
|
688
688
|
};
|
|
@@ -696,7 +696,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
696
696
|
let t = e;
|
|
697
697
|
if (t?._tag !== "MutationInFlight") throw e;
|
|
698
698
|
let r = typeof t.retryAfterMs == "number" && Number.isFinite(t.retryAfterMs) && t.retryAfterMs > 0 ? t.retryAfterMs : 1e3;
|
|
699
|
-
if (r >= u.replayWindowRemaining(
|
|
699
|
+
if (r >= u.replayWindowRemaining(M)) throw e;
|
|
700
700
|
await new Promise((e) => setTimeout(e, r)), n();
|
|
701
701
|
}
|
|
702
702
|
}
|
|
@@ -704,29 +704,29 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
704
704
|
f.release();
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
|
-
|
|
707
|
+
g(s), X(D, {
|
|
708
708
|
status: "success",
|
|
709
709
|
output: s
|
|
710
710
|
}), a.current.errorBus.emitSuccess({
|
|
711
711
|
source: "mutation",
|
|
712
712
|
tag: t
|
|
713
|
-
}),
|
|
714
|
-
let c =
|
|
715
|
-
return c !== void 0 &&
|
|
713
|
+
}), S.confirmByMutation(D), r?.onSuccess?.(s, n);
|
|
714
|
+
let c = vn(r?.notify?.success, s, n);
|
|
715
|
+
return c !== void 0 && hn?.success(c), s;
|
|
716
716
|
} catch (e) {
|
|
717
|
-
|
|
718
|
-
let n =
|
|
717
|
+
A && (ne !== void 0 || i(e, "handler") === "transport") && (re = "unknown");
|
|
718
|
+
let n = mn(e, k);
|
|
719
719
|
if (p(n), X(D, {
|
|
720
720
|
status: "error",
|
|
721
721
|
error: n
|
|
722
|
-
}),
|
|
722
|
+
}), S.revertByMutation(D), Object.is(ne, n) || a.current.errorBus.emit({
|
|
723
723
|
source: "mutation",
|
|
724
724
|
tag: t,
|
|
725
725
|
error: n,
|
|
726
|
-
kind:
|
|
727
|
-
...
|
|
728
|
-
outcome:
|
|
729
|
-
...
|
|
726
|
+
kind: A ? i(e, "handler") : "client",
|
|
727
|
+
...j === void 0 ? {} : { affectsTransport: j() },
|
|
728
|
+
outcome: A && i(e, "handler") === "transport" ? "unknown" : A ? "known" : "not-started",
|
|
729
|
+
...k === void 0 ? {} : { traceId: k }
|
|
730
730
|
}), o) return c(n);
|
|
731
731
|
throw n;
|
|
732
732
|
} finally {
|
|
@@ -737,7 +737,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
737
737
|
t,
|
|
738
738
|
s
|
|
739
739
|
]);
|
|
740
|
-
return
|
|
740
|
+
return z(() => {
|
|
741
741
|
let t = {
|
|
742
742
|
mutate: x,
|
|
743
743
|
pending: c,
|
|
@@ -745,7 +745,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
745
745
|
data: m,
|
|
746
746
|
withOptimistic: (e) => (v.current = e, t),
|
|
747
747
|
withoutOptimistic: () => (y.current = !0, t),
|
|
748
|
-
withConnectionSetup: (n) => (
|
|
748
|
+
withConnectionSetup: (n) => (an(x, nn(n, e)), t)
|
|
749
749
|
};
|
|
750
750
|
return t;
|
|
751
751
|
}, [
|
|
@@ -755,7 +755,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
755
755
|
m,
|
|
756
756
|
e
|
|
757
757
|
]);
|
|
758
|
-
},
|
|
758
|
+
}, Cn = (e, t) => {
|
|
759
759
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
760
760
|
try {
|
|
761
761
|
Object.defineProperty(e, "__voltroTraceId", {
|
|
@@ -765,17 +765,17 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
765
765
|
});
|
|
766
766
|
} catch {}
|
|
767
767
|
return e;
|
|
768
|
-
},
|
|
769
|
-
let n = K(e), { descriptors: r } = n, a =
|
|
768
|
+
}, wn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Tn = 0, En = () => `act_${++Tn}`, Dn = (e, t) => {
|
|
769
|
+
let n = K(e), { descriptors: r } = n, a = B(n);
|
|
770
770
|
if (a.current = n, process.env.NODE_ENV !== "production") {
|
|
771
771
|
let n = r[t]?.kind;
|
|
772
772
|
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.`);
|
|
773
773
|
}
|
|
774
|
-
let [o, s] =
|
|
774
|
+
let [o, s] = V(!1), [c, l] = V(void 0), [u, d] = V(void 0), f = I(async (n, r) => {
|
|
775
775
|
let o = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
776
776
|
s(!0), l(void 0);
|
|
777
|
-
let c =
|
|
778
|
-
|
|
777
|
+
let c = En(), u = r?.idempotencyKey ?? cn();
|
|
778
|
+
Xt({
|
|
779
779
|
id: c,
|
|
780
780
|
apiName: e,
|
|
781
781
|
tag: t,
|
|
@@ -784,19 +784,19 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
784
784
|
let f, p = !1;
|
|
785
785
|
try {
|
|
786
786
|
let { runtime: i, client: o } = await J(a, e, t), s = h(o, t), l = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
|
|
787
|
-
f = e.traceId,
|
|
787
|
+
f = e.traceId, _({
|
|
788
788
|
traceId: e.traceId,
|
|
789
789
|
spanId: e.spanId,
|
|
790
790
|
source: "action",
|
|
791
791
|
tag: t
|
|
792
792
|
});
|
|
793
|
-
})), U.catchAll(() => U.void), U.zipRight(
|
|
793
|
+
})), U.catchAll(() => U.void), U.zipRight(ln(s(n), u))).pipe(U.withSpan(`client.action.${t}`, { attributes: {
|
|
794
794
|
"voltro.api": e,
|
|
795
795
|
"voltro.actionId": c,
|
|
796
796
|
"rpc.tag": t
|
|
797
797
|
} }));
|
|
798
798
|
p = !0;
|
|
799
|
-
let m = await
|
|
799
|
+
let m = await C(i, l);
|
|
800
800
|
d(m), X(c, {
|
|
801
801
|
status: "success",
|
|
802
802
|
output: m
|
|
@@ -804,10 +804,10 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
804
804
|
source: "action",
|
|
805
805
|
tag: t
|
|
806
806
|
}), r?.onSuccess?.(m, n);
|
|
807
|
-
let
|
|
808
|
-
return
|
|
807
|
+
let g = wn(r?.notify?.success, m, n);
|
|
808
|
+
return g !== void 0 && _n()?.success(g), m;
|
|
809
809
|
} catch (e) {
|
|
810
|
-
let s =
|
|
810
|
+
let s = Cn(e, f);
|
|
811
811
|
if (l(s), X(c, {
|
|
812
812
|
status: "error",
|
|
813
813
|
error: s
|
|
@@ -820,8 +820,8 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
820
820
|
...f === void 0 ? {} : { traceId: f }
|
|
821
821
|
}), o) {
|
|
822
822
|
r?.onError?.(s, n);
|
|
823
|
-
let e =
|
|
824
|
-
e !== void 0 &&
|
|
823
|
+
let e = wn(r?.notify?.error, s, n);
|
|
824
|
+
e !== void 0 && _n()?.error(e);
|
|
825
825
|
return;
|
|
826
826
|
}
|
|
827
827
|
throw s;
|
|
@@ -829,7 +829,7 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
829
829
|
s(!1);
|
|
830
830
|
}
|
|
831
831
|
}, [e, t]);
|
|
832
|
-
return
|
|
832
|
+
return z(() => ({
|
|
833
833
|
run: f,
|
|
834
834
|
pending: o,
|
|
835
835
|
error: c,
|
|
@@ -840,14 +840,14 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
840
840
|
c,
|
|
841
841
|
u
|
|
842
842
|
]);
|
|
843
|
-
},
|
|
843
|
+
}, On = F(void 0), kn = (e) => be(On.Provider, { value: e.messages }, e.children), An = () => L(On), jn = Symbol.for("voltro.client.formEngine"), Mn = F(void 0), Nn = (e, t) => {
|
|
844
844
|
let n = e;
|
|
845
845
|
for (let e of t.split(".")) {
|
|
846
846
|
if (typeof n != "object" || !n) return;
|
|
847
847
|
n = n[e];
|
|
848
848
|
}
|
|
849
849
|
return n;
|
|
850
|
-
},
|
|
850
|
+
}, Pn = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), Fn = {
|
|
851
851
|
isTouched: !1,
|
|
852
852
|
isBlurred: !1,
|
|
853
853
|
isDirty: !1,
|
|
@@ -856,35 +856,35 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
856
856
|
isValidating: !1,
|
|
857
857
|
errorMap: {},
|
|
858
858
|
errorSourceMap: {}
|
|
859
|
-
},
|
|
859
|
+
}, In = (e, t) => {
|
|
860
860
|
let n = e.find((e) => e.name === t);
|
|
861
861
|
if (n !== void 0) return n;
|
|
862
862
|
let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
|
|
863
863
|
if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
|
|
864
|
-
},
|
|
865
|
-
let r = K(e), i =
|
|
866
|
-
return process.env.NODE_ENV !== "production" && c === 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.`),
|
|
867
|
-
},
|
|
868
|
-
let t =
|
|
869
|
-
return
|
|
864
|
+
}, Ln = (e, t, n) => {
|
|
865
|
+
let r = K(e), i = B(void 0), a = typeof t == "function" ? t(i.current?.state?.values ?? n.defaults ?? {}) : t, o = B(a).current, s = Sn(e, a), c = n.schema ?? r.descriptors[a]?.input;
|
|
866
|
+
return process.env.NODE_ENV !== "production" && c === 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.`), zn(e, o, n, c, i, s);
|
|
867
|
+
}, Rn = (e) => {
|
|
868
|
+
let t = B(void 0);
|
|
869
|
+
return zn("local", Se(), {
|
|
870
870
|
...e,
|
|
871
|
-
onSubmit: async ({ input: t }) => e.onSubmit(await
|
|
871
|
+
onSubmit: async ({ input: t }) => e.onSubmit(await ke.decodeUnknownPromise(e.schema)(t))
|
|
872
872
|
}, e.schema, t);
|
|
873
|
-
},
|
|
874
|
-
let o =
|
|
873
|
+
}, zn = (e, t, n, r, i, a) => {
|
|
874
|
+
let o = z(() => r ? _e(r) : [], [r]), s = An(), c = n.messages ?? s, l = z(() => ({
|
|
875
875
|
...n.locale === void 0 ? {} : { locale: n.locale },
|
|
876
876
|
...c === void 0 ? {} : { messages: c }
|
|
877
|
-
}), [n.locale, c]), u =
|
|
877
|
+
}), [n.locale, c]), u = B(n.asyncFields);
|
|
878
878
|
u.current = n.asyncFields;
|
|
879
|
-
let d =
|
|
879
|
+
let d = B(n);
|
|
880
880
|
d.current = n;
|
|
881
|
-
let f =
|
|
881
|
+
let f = B(a);
|
|
882
882
|
f.current = a;
|
|
883
|
-
let p =
|
|
883
|
+
let p = B(l);
|
|
884
884
|
p.current = l;
|
|
885
|
-
let m =
|
|
885
|
+
let m = B(r);
|
|
886
886
|
m.current = r;
|
|
887
|
-
let [h, g] =
|
|
887
|
+
let [h, g] = V(() => n.flash?.errors ?? {}), [_, v] = V(n.flash?.formError), [y, b] = V(void 0), x = B(void 0), S = B(!1), C = I((e) => {
|
|
888
888
|
let t = m.current;
|
|
889
889
|
if (t === void 0) return [];
|
|
890
890
|
let n = d.current, r = e;
|
|
@@ -893,97 +893,97 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
893
893
|
} catch {
|
|
894
894
|
r = e;
|
|
895
895
|
}
|
|
896
|
-
let i =
|
|
896
|
+
let i = re(t, r, p.current).issues;
|
|
897
897
|
if (n.toInput === void 0) return i;
|
|
898
898
|
let a = n.errorPath ?? {};
|
|
899
899
|
return i.map((t) => {
|
|
900
900
|
let n = a[t.path];
|
|
901
|
-
return n === void 0 ? (
|
|
901
|
+
return n === void 0 ? (Nn(e, t.path) !== void 0 || t.path.includes("."), t) : {
|
|
902
902
|
...t,
|
|
903
903
|
path: n
|
|
904
904
|
};
|
|
905
905
|
});
|
|
906
|
-
}, []), w =
|
|
906
|
+
}, []), w = I((e) => {
|
|
907
907
|
let t = { ...e ?? {} }, n = m.current;
|
|
908
|
-
if (n !== void 0) for (let e of
|
|
908
|
+
if (n !== void 0) for (let e of _e(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
|
|
909
909
|
return t;
|
|
910
|
-
}, []), T =
|
|
910
|
+
}, []), T = B(() => Promise.resolve());
|
|
911
911
|
if (i.current === void 0) {
|
|
912
912
|
let e = n.flash, t = e === void 0 ? w(n.defaults) : {
|
|
913
913
|
...w(n.defaults),
|
|
914
914
|
...e.values
|
|
915
915
|
};
|
|
916
|
-
i.current = new
|
|
916
|
+
i.current = new Fe({
|
|
917
917
|
onSubmit: ({ value: e }) => T.current(e),
|
|
918
918
|
defaultValues: t,
|
|
919
919
|
validators: { onChange: ({ value: e }) => {
|
|
920
920
|
let t = C(e);
|
|
921
921
|
if (t.length === 0) return;
|
|
922
922
|
let n = {};
|
|
923
|
-
for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] =
|
|
923
|
+
for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = P(e, p.current));
|
|
924
924
|
return { fields: n };
|
|
925
925
|
} }
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
928
|
let E = i.current, D = E;
|
|
929
|
-
|
|
929
|
+
R(() => D.mount(), [D]);
|
|
930
930
|
let ee = n.subscribe ?? "all";
|
|
931
|
-
|
|
932
|
-
let
|
|
933
|
-
if (
|
|
934
|
-
if (
|
|
935
|
-
if (
|
|
936
|
-
let t =
|
|
937
|
-
return t === void 0 ? !1 :
|
|
931
|
+
Ie(E.store, (e) => ee === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
|
|
932
|
+
let te = E.store.state.values, O = E.store.state, k = z(() => C(te), [C, te]), A = n.isLoading === !0, ne = n.validate, j = ne?.onChange ?? "afterTouched", M = ne?.onBlur ?? !0, ie = O.submissionAttempts, ae = O.fieldMetaBase ?? {}, oe = I((e) => {
|
|
933
|
+
if (A) return !1;
|
|
934
|
+
if (ie > 0 || j === "always") return !0;
|
|
935
|
+
if (j === "never") return !1;
|
|
936
|
+
let t = ae[e];
|
|
937
|
+
return t === void 0 ? !1 : M ? t.isBlurred === !0 : t.isTouched === !0;
|
|
938
938
|
}, [
|
|
939
|
+
ie,
|
|
939
940
|
ae,
|
|
940
|
-
|
|
941
|
+
A,
|
|
941
942
|
j,
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
]), ce = F((e) => {
|
|
943
|
+
M
|
|
944
|
+
]), N = I((e) => {
|
|
945
945
|
let t = h[e];
|
|
946
946
|
if (t !== void 0) return t;
|
|
947
947
|
let n = u.current?.[e];
|
|
948
|
-
if (n !== void 0 && n.status === "invalid") return n.message ??
|
|
948
|
+
if (n !== void 0 && n.status === "invalid") return n.message ?? P({
|
|
949
949
|
id: "validation.invalid",
|
|
950
950
|
fallback: "Invalid value"
|
|
951
951
|
}, p.current);
|
|
952
|
-
if (!
|
|
953
|
-
let r =
|
|
954
|
-
return r === void 0 ? void 0 :
|
|
952
|
+
if (!oe(e)) return;
|
|
953
|
+
let r = k.find((t) => t.path === e);
|
|
954
|
+
return r === void 0 ? void 0 : P(r, p.current);
|
|
955
955
|
}, [
|
|
956
956
|
h,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
]),
|
|
960
|
-
let e = {}, t = /* @__PURE__ */ new Set([...
|
|
957
|
+
oe,
|
|
958
|
+
k
|
|
959
|
+
]), se = z(() => {
|
|
960
|
+
let e = {}, t = /* @__PURE__ */ new Set([...k.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(h)]);
|
|
961
961
|
for (let [e, n] of Object.entries(u.current ?? {})) n.status === "invalid" && t.add(e);
|
|
962
962
|
for (let n of t) {
|
|
963
|
-
let t =
|
|
963
|
+
let t = N(n);
|
|
964
964
|
t !== void 0 && (e[n] = t);
|
|
965
965
|
}
|
|
966
966
|
return e;
|
|
967
967
|
}, [
|
|
968
|
-
|
|
968
|
+
k,
|
|
969
969
|
h,
|
|
970
|
-
|
|
971
|
-
]),
|
|
970
|
+
N
|
|
971
|
+
]), ce = I((e) => {
|
|
972
972
|
g((t) => {
|
|
973
973
|
if (!(e in t)) return t;
|
|
974
974
|
let n = { ...t };
|
|
975
975
|
return delete n[e], n;
|
|
976
976
|
});
|
|
977
|
-
}, []),
|
|
978
|
-
let r =
|
|
977
|
+
}, []), le = I((n) => {
|
|
978
|
+
let r = In(o, n), i = D.getFieldMeta(n), a = N(n), s = Pn(e, t, n), c = u.current?.[n], l = [a === void 0 ? void 0 : `${s}-error`, r?.description === void 0 ? void 0 : `${s}-help`].filter((e) => e !== void 0);
|
|
979
979
|
return {
|
|
980
980
|
value: D.getFieldValue(n),
|
|
981
981
|
setValue: (e) => {
|
|
982
|
-
|
|
982
|
+
ce(n), !Object.is(D.getFieldValue(n), e) && D.setFieldValue(n, e);
|
|
983
983
|
},
|
|
984
984
|
onBlur: () => {
|
|
985
985
|
D.setFieldMeta(n, (e) => ({
|
|
986
|
-
...
|
|
986
|
+
...Fn,
|
|
987
987
|
...e ?? {},
|
|
988
988
|
isTouched: !0,
|
|
989
989
|
isBlurred: !0
|
|
@@ -1010,12 +1010,12 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1010
1010
|
}, [
|
|
1011
1011
|
e,
|
|
1012
1012
|
t,
|
|
1013
|
-
|
|
1013
|
+
ce,
|
|
1014
1014
|
D,
|
|
1015
1015
|
o,
|
|
1016
1016
|
h,
|
|
1017
|
-
|
|
1018
|
-
]),
|
|
1017
|
+
N
|
|
1018
|
+
]), ue = I((e) => ({
|
|
1019
1019
|
items: D.getFieldValue(e) ?? [],
|
|
1020
1020
|
push: (t) => {
|
|
1021
1021
|
D.pushFieldValue(e, t);
|
|
@@ -1032,14 +1032,14 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1032
1032
|
swap: (t, n) => {
|
|
1033
1033
|
D.swapFieldValues(e, t, n);
|
|
1034
1034
|
},
|
|
1035
|
-
field: (t, n) =>
|
|
1036
|
-
}), [D,
|
|
1037
|
-
|
|
1038
|
-
}, [
|
|
1035
|
+
field: (t, n) => le(`${e}.${t}.${n}`)
|
|
1036
|
+
}), [D, le]), de = I((e) => o.filter((t) => t.section === e), [o]), fe = I((e, t) => {
|
|
1037
|
+
ce(e), !Object.is(D.getFieldValue(e), t) && D.setFieldValue(e, t);
|
|
1038
|
+
}, [ce, D]), pe = I((e) => {
|
|
1039
1039
|
for (let [t, n] of Object.entries(e)) D.setFieldValue(t, n);
|
|
1040
|
-
}, [D]),
|
|
1040
|
+
}, [D]), me = I((e) => {
|
|
1041
1041
|
g({}), v(void 0), b(void 0), x.current = void 0, S.current = !1, e === void 0 ? D.reset() : D.reset(w(e));
|
|
1042
|
-
}, [D, w]),
|
|
1042
|
+
}, [D, w]), he = n.asyncTimeoutMs ?? 5e3, ge = I(async () => {
|
|
1043
1043
|
let e = Date.now();
|
|
1044
1044
|
for (;;) {
|
|
1045
1045
|
let t = u.current;
|
|
@@ -1047,23 +1047,23 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1047
1047
|
let n = Object.entries(t), r = n.filter(([, e]) => e.status === "checking");
|
|
1048
1048
|
if (r.length === 0) {
|
|
1049
1049
|
let e = n.filter(([, e]) => e.status === "invalid");
|
|
1050
|
-
return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ??
|
|
1050
|
+
return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? P({
|
|
1051
1051
|
id: "validation.invalid",
|
|
1052
1052
|
fallback: "Invalid value"
|
|
1053
1053
|
}, p.current)]));
|
|
1054
1054
|
}
|
|
1055
|
-
if (Date.now() - e >
|
|
1055
|
+
if (Date.now() - e > he) return Object.fromEntries(r.map(([e]) => [e, P({
|
|
1056
1056
|
id: "validation.checking",
|
|
1057
1057
|
fallback: "Still checking…"
|
|
1058
1058
|
}, p.current)]));
|
|
1059
1059
|
await new Promise((e) => setTimeout(e, 50));
|
|
1060
1060
|
}
|
|
1061
|
-
}, [
|
|
1061
|
+
}, [he]), ve = I(() => {
|
|
1062
1062
|
let n = globalThis.document;
|
|
1063
1063
|
if (n?.getElementById === void 0) return;
|
|
1064
1064
|
let r = [...o.map((e) => e.name), ...Object.keys(h).filter((e) => !o.some((t) => t.name === e))];
|
|
1065
|
-
for (let i of r) if (
|
|
1066
|
-
n.getElementById(
|
|
1065
|
+
for (let i of r) if (N(i) !== void 0) {
|
|
1066
|
+
n.getElementById(Pn(e, t, i))?.focus?.();
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
1069
|
}, [
|
|
@@ -1071,17 +1071,17 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1071
1071
|
t,
|
|
1072
1072
|
o,
|
|
1073
1073
|
h,
|
|
1074
|
-
|
|
1075
|
-
]),
|
|
1076
|
-
|
|
1077
|
-
let
|
|
1074
|
+
N
|
|
1075
|
+
]), F = B(ve);
|
|
1076
|
+
F.current = ve;
|
|
1077
|
+
let be = I(async () => {
|
|
1078
1078
|
v(void 0), g({}), b(void 0), x.current = void 0, S.current = !1;
|
|
1079
1079
|
let e, t = !1;
|
|
1080
1080
|
if (await D.handleSubmit().catch((n) => {
|
|
1081
1081
|
t = !0, e = n;
|
|
1082
1082
|
}), t) throw e;
|
|
1083
1083
|
return S.current || queueMicrotask(() => {
|
|
1084
|
-
|
|
1084
|
+
F.current();
|
|
1085
1085
|
}), x.current;
|
|
1086
1086
|
}, [D]);
|
|
1087
1087
|
T.current = (async (e) => {
|
|
@@ -1094,22 +1094,22 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
if (C(n).length > 0) {
|
|
1096
1096
|
queueMicrotask(() => {
|
|
1097
|
-
|
|
1097
|
+
F.current();
|
|
1098
1098
|
});
|
|
1099
1099
|
return;
|
|
1100
1100
|
}
|
|
1101
1101
|
let i = m.current;
|
|
1102
1102
|
if (i !== void 0) {
|
|
1103
|
-
let e =
|
|
1103
|
+
let e = ye(i, r);
|
|
1104
1104
|
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;
|
|
1105
1105
|
}
|
|
1106
|
-
let a = await
|
|
1106
|
+
let a = await ge();
|
|
1107
1107
|
if (a !== void 0) {
|
|
1108
1108
|
g((e) => ({
|
|
1109
1109
|
...e,
|
|
1110
1110
|
...a
|
|
1111
1111
|
})), queueMicrotask(() => {
|
|
1112
|
-
|
|
1112
|
+
F.current();
|
|
1113
1113
|
});
|
|
1114
1114
|
return;
|
|
1115
1115
|
}
|
|
@@ -1125,13 +1125,13 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1125
1125
|
});
|
|
1126
1126
|
x.current = e, S.current = !0, t.onSuccess?.(e);
|
|
1127
1127
|
} catch (e) {
|
|
1128
|
-
let t =
|
|
1128
|
+
let t = Me(e);
|
|
1129
1129
|
if (t.length === 0) {
|
|
1130
1130
|
b(e), d.current.onError?.(e);
|
|
1131
1131
|
return;
|
|
1132
1132
|
}
|
|
1133
1133
|
let n = {};
|
|
1134
|
-
for (let e of t) e.field in n || (n[e.field] =
|
|
1134
|
+
for (let e of t) e.field in n || (n[e.field] = P({
|
|
1135
1135
|
id: e.message,
|
|
1136
1136
|
...e.params === void 0 ? {} : { params: e.params },
|
|
1137
1137
|
fallback: e.message
|
|
@@ -1140,78 +1140,78 @@ var Ut = 15e3, J = async (e, t, n) => {
|
|
|
1140
1140
|
...e,
|
|
1141
1141
|
...n
|
|
1142
1142
|
})), queueMicrotask(() => {
|
|
1143
|
-
|
|
1143
|
+
F.current();
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
1146
|
});
|
|
1147
|
-
let
|
|
1148
|
-
for (let e of o) if (
|
|
1149
|
-
let e = Object.keys(
|
|
1147
|
+
let L = k.length === 0, xe = Object.values(u.current ?? {}).some((e) => e.status === "checking"), Se = y ?? a?.error, H = Se !== void 0 && Me(Se).length > 0 ? void 0 : Se, Ce = Object.keys(se).length, we = (() => {
|
|
1148
|
+
for (let e of o) if (se[e.name] !== void 0) return e.name;
|
|
1149
|
+
let e = Object.keys(se);
|
|
1150
1150
|
return e.length > 0 ? e[0] : void 0;
|
|
1151
|
-
})(),
|
|
1152
|
-
isDirty: !
|
|
1153
|
-
isPristine:
|
|
1154
|
-
isTouched:
|
|
1155
|
-
isValid:
|
|
1156
|
-
isValidating:
|
|
1157
|
-
canSubmit:
|
|
1158
|
-
isSubmitting:
|
|
1159
|
-
isSubmitted:
|
|
1160
|
-
isSubmitSuccessful:
|
|
1161
|
-
submissionAttempts:
|
|
1151
|
+
})(), U = {
|
|
1152
|
+
isDirty: !A && O.isDirty,
|
|
1153
|
+
isPristine: O.isPristine,
|
|
1154
|
+
isTouched: O.isTouched,
|
|
1155
|
+
isValid: L,
|
|
1156
|
+
isValidating: xe,
|
|
1157
|
+
canSubmit: L && !xe && !O.isSubmitting && !A,
|
|
1158
|
+
isSubmitting: O.isSubmitting,
|
|
1159
|
+
isSubmitted: O.isSubmitted,
|
|
1160
|
+
isSubmitSuccessful: O.isSubmitSuccessful && S.current,
|
|
1161
|
+
submissionAttempts: O.submissionAttempts,
|
|
1162
1162
|
errorCount: Ce,
|
|
1163
|
-
firstInvalidPath:
|
|
1164
|
-
pending: a?.pending ??
|
|
1165
|
-
isLoading:
|
|
1163
|
+
firstInvalidPath: we,
|
|
1164
|
+
pending: a?.pending ?? O.isSubmitting,
|
|
1165
|
+
isLoading: A,
|
|
1166
1166
|
submitError: H,
|
|
1167
1167
|
data: a?.data ?? x.current
|
|
1168
1168
|
}, Te = {
|
|
1169
1169
|
fields: o,
|
|
1170
|
-
values:
|
|
1171
|
-
errors:
|
|
1172
|
-
issues:
|
|
1173
|
-
isValid:
|
|
1174
|
-
pending: a?.pending ??
|
|
1170
|
+
values: te,
|
|
1171
|
+
errors: se,
|
|
1172
|
+
issues: k,
|
|
1173
|
+
isValid: L,
|
|
1174
|
+
pending: a?.pending ?? O.isSubmitting,
|
|
1175
1175
|
submitError: H,
|
|
1176
1176
|
formError: _,
|
|
1177
1177
|
data: a?.data ?? x.current,
|
|
1178
|
-
setValue:
|
|
1179
|
-
setValues:
|
|
1180
|
-
reset:
|
|
1181
|
-
submit:
|
|
1182
|
-
field:
|
|
1183
|
-
array:
|
|
1184
|
-
section:
|
|
1185
|
-
state:
|
|
1186
|
-
focusFirstInvalid:
|
|
1178
|
+
setValue: fe,
|
|
1179
|
+
setValues: pe,
|
|
1180
|
+
reset: me,
|
|
1181
|
+
submit: be,
|
|
1182
|
+
field: le,
|
|
1183
|
+
array: ue,
|
|
1184
|
+
section: de,
|
|
1185
|
+
state: U,
|
|
1186
|
+
focusFirstInvalid: ve
|
|
1187
1187
|
};
|
|
1188
|
-
return Object.defineProperty(Te,
|
|
1188
|
+
return Object.defineProperty(Te, jn, {
|
|
1189
1189
|
value: {
|
|
1190
1190
|
store: E.store,
|
|
1191
|
-
field:
|
|
1191
|
+
field: le
|
|
1192
1192
|
},
|
|
1193
1193
|
enumerable: !1
|
|
1194
1194
|
}), Te;
|
|
1195
|
-
},
|
|
1196
|
-
function
|
|
1197
|
-
let n =
|
|
1195
|
+
}, Bn = (e) => be(Mn.Provider, { value: e.binding }, e.children), Vn = () => L(Mn);
|
|
1196
|
+
function Hn(e, t) {
|
|
1197
|
+
let n = L(Mn), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
|
|
1198
1198
|
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.");
|
|
1199
|
-
let o = a[
|
|
1199
|
+
let o = a[jn];
|
|
1200
1200
|
if (o === void 0) throw Error("useFormField: not a useFormBinding result");
|
|
1201
|
-
return
|
|
1201
|
+
return Ie(o.store, (e) => {
|
|
1202
1202
|
let t = e.fieldMetaBase[i];
|
|
1203
|
-
return `${JSON.stringify(
|
|
1203
|
+
return `${JSON.stringify(Nn(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
|
|
1204
1204
|
}), o.field(i);
|
|
1205
1205
|
}
|
|
1206
1206
|
//#endregion
|
|
1207
1207
|
//#region src/connectionPrerequisite.ts
|
|
1208
|
-
var
|
|
1208
|
+
var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:connection-setup-superseded" ? "superseded" : "inactive", Z = class extends Error {
|
|
1209
1209
|
reason;
|
|
1210
1210
|
_tag = "ConnectionPrerequisiteInvalidated";
|
|
1211
1211
|
constructor(e) {
|
|
1212
1212
|
super(`Voltro connection prerequisite: ${e}`), this.reason = e, n(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
|
|
1213
1213
|
}
|
|
1214
|
-
},
|
|
1214
|
+
}, Gn = class {
|
|
1215
1215
|
#e;
|
|
1216
1216
|
#t;
|
|
1217
1217
|
#n = /* @__PURE__ */ new WeakMap();
|
|
@@ -1222,14 +1222,14 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1222
1222
|
}
|
|
1223
1223
|
prepare(e, t) {
|
|
1224
1224
|
let n = u(e)?.getSnapshot();
|
|
1225
|
-
if (this.#e.aborted) return Promise.reject(new Z(
|
|
1225
|
+
if (this.#e.aborted) return Promise.reject(new Z(Wn(this.#e)));
|
|
1226
1226
|
if (n === void 0) return Promise.reject(new Z("connection-unavailable"));
|
|
1227
1227
|
let r = this.#n.get(n);
|
|
1228
1228
|
if (r !== void 0) return r.then((t) => (this.assertCurrent(e, t), t));
|
|
1229
1229
|
let i = this.#a(e, n, t).pipe(U.timeoutFail({
|
|
1230
1230
|
duration: this.#t,
|
|
1231
1231
|
onTimeout: () => new Z("timeout")
|
|
1232
|
-
})), a =
|
|
1232
|
+
})), a = C(e, i).then((t) => {
|
|
1233
1233
|
let r = Object.freeze({
|
|
1234
1234
|
lease: n,
|
|
1235
1235
|
output: t
|
|
@@ -1241,11 +1241,11 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1241
1241
|
}), a;
|
|
1242
1242
|
}
|
|
1243
1243
|
assertCurrent(e, t) {
|
|
1244
|
-
if (!this.#r.has(t)) throw new Z(
|
|
1244
|
+
if (!this.#r.has(t)) throw new Z(Wn(this.#e));
|
|
1245
1245
|
this.#i(e, t.lease);
|
|
1246
1246
|
}
|
|
1247
1247
|
#i(e, t) {
|
|
1248
|
-
if (this.#e.aborted) throw new Z(
|
|
1248
|
+
if (this.#e.aborted) throw new Z(Wn(this.#e));
|
|
1249
1249
|
if (t.signal.aborted || u(e)?.getSnapshot() !== t) throw new Z("connection-changed");
|
|
1250
1250
|
}
|
|
1251
1251
|
run(e, t, n) {
|
|
@@ -1253,21 +1253,21 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1253
1253
|
try: () => this.assertCurrent(e, t),
|
|
1254
1254
|
catch: (e) => e
|
|
1255
1255
|
}).pipe(U.zipRight(n));
|
|
1256
|
-
return
|
|
1256
|
+
return C(e, this.#a(e, t.lease, r));
|
|
1257
1257
|
}
|
|
1258
1258
|
#a(e, t, n) {
|
|
1259
1259
|
let r = U.try({
|
|
1260
1260
|
try: () => this.#i(e, t),
|
|
1261
1261
|
catch: (e) => e
|
|
1262
1262
|
}), i = U.async((e) => {
|
|
1263
|
-
let n = () => e(U.fail(new Z(this.#e.aborted ?
|
|
1263
|
+
let n = () => e(U.fail(new Z(this.#e.aborted ? Wn(this.#e) : "connection-changed")));
|
|
1264
1264
|
return this.#e.addEventListener("abort", n, { once: !0 }), t.signal.addEventListener("abort", n, { once: !0 }), (this.#e.aborted || t.signal.aborted) && n(), U.sync(() => {
|
|
1265
1265
|
this.#e.removeEventListener("abort", n), t.signal.removeEventListener("abort", n);
|
|
1266
1266
|
});
|
|
1267
1267
|
});
|
|
1268
1268
|
return r.pipe(U.zipRight(n), U.tap(() => r), U.raceFirst(i));
|
|
1269
1269
|
}
|
|
1270
|
-
},
|
|
1270
|
+
}, Kn = class {
|
|
1271
1271
|
#e;
|
|
1272
1272
|
#t;
|
|
1273
1273
|
#n;
|
|
@@ -1282,7 +1282,7 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1282
1282
|
#s;
|
|
1283
1283
|
handle;
|
|
1284
1284
|
constructor(e, t, n) {
|
|
1285
|
-
this.#e = e, this.#t = t, this.#n = n, this.handle =
|
|
1285
|
+
this.#e = e, this.#t = t, this.#n = n, this.handle = tn(e, { capture: () => this.#f() });
|
|
1286
1286
|
}
|
|
1287
1287
|
getSnapshot = () => this.#a;
|
|
1288
1288
|
subscribe = (e) => (this.#r.add(e), () => {
|
|
@@ -1290,7 +1290,7 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1290
1290
|
});
|
|
1291
1291
|
clear = (e = !1) => {
|
|
1292
1292
|
let t = this.#i;
|
|
1293
|
-
this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ?
|
|
1293
|
+
this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ? Un : void 0), this.#h({
|
|
1294
1294
|
status: "idle",
|
|
1295
1295
|
data: void 0,
|
|
1296
1296
|
error: void 0
|
|
@@ -1300,11 +1300,11 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1300
1300
|
this.clear(!0);
|
|
1301
1301
|
let n = new AbortController(), r = {
|
|
1302
1302
|
input: e,
|
|
1303
|
-
key:
|
|
1303
|
+
key: cn(),
|
|
1304
1304
|
controller: n,
|
|
1305
1305
|
subject: void 0,
|
|
1306
1306
|
detachSubject: void 0,
|
|
1307
|
-
prerequisite: new
|
|
1307
|
+
prerequisite: new Gn(n.signal, this.#c(this.#n()).options.replayWindowMs),
|
|
1308
1308
|
established: !1
|
|
1309
1309
|
};
|
|
1310
1310
|
this.#i = r, this.#h({
|
|
@@ -1344,7 +1344,7 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1344
1344
|
return e.recovery ?? d(e.errorBus, this.#e);
|
|
1345
1345
|
}
|
|
1346
1346
|
#l(e) {
|
|
1347
|
-
if (this.#i !== e || e.controller.signal.aborted) throw new Z(
|
|
1347
|
+
if (this.#i !== e || e.controller.signal.aborted) throw new Z(Wn(e.controller.signal));
|
|
1348
1348
|
}
|
|
1349
1349
|
#u(e, t, n) {
|
|
1350
1350
|
this.#l(e);
|
|
@@ -1383,7 +1383,7 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1383
1383
|
let n = U.async((t) => {
|
|
1384
1384
|
let n = () => {
|
|
1385
1385
|
let n = a.getSnapshot();
|
|
1386
|
-
e.controller.signal.aborted ? t(U.fail(new Z(
|
|
1386
|
+
e.controller.signal.aborted ? t(U.fail(new Z(Wn(e.controller.signal)))) : n !== void 0 && t(U.succeed(n));
|
|
1387
1387
|
}, r = a.subscribe(n);
|
|
1388
1388
|
return e.controller.signal.addEventListener("abort", n, { once: !0 }), n(), U.sync(() => {
|
|
1389
1389
|
r(), e.controller.signal.removeEventListener("abort", n);
|
|
@@ -1392,7 +1392,7 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1392
1392
|
duration: this.#c(r).options.replayWindowMs,
|
|
1393
1393
|
onTimeout: () => new Z("timeout")
|
|
1394
1394
|
}));
|
|
1395
|
-
await
|
|
1395
|
+
await C(t, n);
|
|
1396
1396
|
}
|
|
1397
1397
|
this.#u(e, t, n);
|
|
1398
1398
|
let o = a.getSnapshot();
|
|
@@ -1414,13 +1414,13 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1414
1414
|
#m(e, t) {
|
|
1415
1415
|
return U.suspend(() => {
|
|
1416
1416
|
let n = `setup_${e.key}_${++this.#o}`;
|
|
1417
|
-
return
|
|
1417
|
+
return Xt({
|
|
1418
1418
|
id: n,
|
|
1419
1419
|
apiName: this.#e,
|
|
1420
1420
|
tag: this.#t,
|
|
1421
1421
|
input: e.input
|
|
1422
|
-
}), U.suspend(() => (this.#u(e, t.runtime, t.client),
|
|
1423
|
-
if (
|
|
1422
|
+
}), U.suspend(() => (this.#u(e, t.runtime, t.client), ln(h(t.client, this.#t)(e.input), e.key))).pipe(U.withSpan(`client.connectionSetup.${this.#t}`)).pipe(U.onExit((e) => U.sync(() => {
|
|
1423
|
+
if (Te.isSuccess(e)) X(n, {
|
|
1424
1424
|
status: "success",
|
|
1425
1425
|
output: e.value
|
|
1426
1426
|
}), t.errorBus.emitSuccess({
|
|
@@ -1428,11 +1428,11 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1428
1428
|
tag: this.#t
|
|
1429
1429
|
});
|
|
1430
1430
|
else {
|
|
1431
|
-
let r =
|
|
1431
|
+
let r = g(e.cause);
|
|
1432
1432
|
if (X(n, {
|
|
1433
1433
|
status: "error",
|
|
1434
1434
|
error: r
|
|
1435
|
-
}), !
|
|
1435
|
+
}), !Ce.isInterruptedOnly(e.cause)) {
|
|
1436
1436
|
let e = i(r, "handler");
|
|
1437
1437
|
t.errorBus.emit({
|
|
1438
1438
|
source: "mutation",
|
|
@@ -1454,109 +1454,109 @@ var Hn = "voltro:connection-setup-superseded", Un = (e) => e.reason === "voltro:
|
|
|
1454
1454
|
} catch {}
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
-
},
|
|
1458
|
-
let n = K(e), r =
|
|
1457
|
+
}, qn = (e, t) => {
|
|
1458
|
+
let n = K(e), r = B(n);
|
|
1459
1459
|
r.current = n;
|
|
1460
|
-
let i =
|
|
1460
|
+
let i = z(() => new Kn(e, t, () => r.current), [e, t]), a = I((n) => i.activate(n, () => J(r, e, t)), [
|
|
1461
1461
|
i,
|
|
1462
1462
|
e,
|
|
1463
1463
|
t
|
|
1464
|
-
]), o =
|
|
1465
|
-
return
|
|
1464
|
+
]), o = H(i.subscribe, i.getSnapshot, i.getSnapshot);
|
|
1465
|
+
return R(() => i.watch(r.current), [
|
|
1466
1466
|
i,
|
|
1467
1467
|
n.runtime,
|
|
1468
1468
|
n.client,
|
|
1469
1469
|
n.recovery
|
|
1470
|
-
]),
|
|
1470
|
+
]), R(() => () => i.clear(), [i]), {
|
|
1471
1471
|
...o,
|
|
1472
1472
|
handle: i.handle,
|
|
1473
1473
|
activate: a,
|
|
1474
1474
|
clear: i.clear,
|
|
1475
1475
|
ready: o.status === "ready"
|
|
1476
1476
|
};
|
|
1477
|
-
},
|
|
1478
|
-
useSubscription: (t, n, r) =>
|
|
1479
|
-
useMutation: (t) =>
|
|
1480
|
-
useConnectionSetup: (t) =>
|
|
1481
|
-
useAction: (t) =>
|
|
1482
|
-
useFormBinding: (t, n) =>
|
|
1483
|
-
}),
|
|
1484
|
-
|
|
1485
|
-
},
|
|
1486
|
-
let i =
|
|
1477
|
+
}, Jn = q, Yn = (e) => ({
|
|
1478
|
+
useSubscription: (t, n, r) => Jn(e, t, n, r),
|
|
1479
|
+
useMutation: (t) => Sn(e, t),
|
|
1480
|
+
useConnectionSetup: (t) => qn(e, t),
|
|
1481
|
+
useAction: (t) => Dn(e, t),
|
|
1482
|
+
useFormBinding: (t, n) => Ln(e, t, n ?? {})
|
|
1483
|
+
}), Xn = () => ({ seeds: [] }), Zn = null, Qn = (e) => {
|
|
1484
|
+
Zn = e;
|
|
1485
|
+
}, $n = /* @__PURE__ */ new Map(), er = (e, t) => `${e}\u0000${t}`, tr = (e, t, n, r) => {
|
|
1486
|
+
let i = Zn?.() ?? null;
|
|
1487
1487
|
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.)`);
|
|
1488
1488
|
i.seeds.push({
|
|
1489
1489
|
api: e,
|
|
1490
1490
|
key: O([t, n]),
|
|
1491
1491
|
value: r
|
|
1492
1492
|
});
|
|
1493
|
-
},
|
|
1494
|
-
let r =
|
|
1493
|
+
}, nr = (e, t, n) => {
|
|
1494
|
+
let r = Zn?.() ?? null;
|
|
1495
1495
|
r !== null && r.seeds.push({
|
|
1496
1496
|
api: e,
|
|
1497
1497
|
key: O([t, n]),
|
|
1498
1498
|
value: void 0,
|
|
1499
1499
|
failed: !0
|
|
1500
1500
|
});
|
|
1501
|
-
},
|
|
1502
|
-
if (e !== void 0) for (let t of e)
|
|
1501
|
+
}, rr = (e) => {
|
|
1502
|
+
if (e !== void 0) for (let t of e) $n.set(er(t.api, t.key), {
|
|
1503
1503
|
value: t.value,
|
|
1504
1504
|
failed: t.failed === !0
|
|
1505
1505
|
});
|
|
1506
|
-
},
|
|
1507
|
-
let r = O([t, n]), i =
|
|
1506
|
+
}, ir = (e, t, n) => {
|
|
1507
|
+
let r = O([t, n]), i = Zn?.() ?? null;
|
|
1508
1508
|
if (i !== null) {
|
|
1509
1509
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
|
|
1510
1510
|
return;
|
|
1511
1511
|
}
|
|
1512
|
-
let a =
|
|
1512
|
+
let a = $n.get(er(e, r));
|
|
1513
1513
|
return a === void 0 || a.failed ? void 0 : a.value;
|
|
1514
|
-
},
|
|
1515
|
-
let r = O([t, n]), i =
|
|
1514
|
+
}, ar = (e, t, n) => {
|
|
1515
|
+
let r = O([t, n]), i = Zn?.() ?? null;
|
|
1516
1516
|
if (i !== null) {
|
|
1517
1517
|
for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
|
|
1518
1518
|
return "absent";
|
|
1519
1519
|
}
|
|
1520
|
-
let a =
|
|
1520
|
+
let a = $n.get(er(e, r));
|
|
1521
1521
|
return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
|
|
1522
|
-
},
|
|
1523
|
-
|
|
1522
|
+
}, or = () => {
|
|
1523
|
+
$n.clear();
|
|
1524
1524
|
};
|
|
1525
1525
|
//#endregion
|
|
1526
1526
|
//#region src/usePreloadedSubscription.ts
|
|
1527
|
-
function
|
|
1528
|
-
let i =
|
|
1527
|
+
function sr(e, t, n = {}, r = {}) {
|
|
1528
|
+
let i = ir(e, t, n), a = q(e, t, n, i === void 0 ? r : {
|
|
1529
1529
|
...r,
|
|
1530
1530
|
initialSnapshot: i
|
|
1531
1531
|
});
|
|
1532
|
-
return
|
|
1532
|
+
return ar(e, t, n) === "failed" ? {
|
|
1533
1533
|
...a,
|
|
1534
1534
|
preloadFailed: !0
|
|
1535
1535
|
} : a;
|
|
1536
1536
|
}
|
|
1537
1537
|
//#endregion
|
|
1538
1538
|
//#region src/useEvent.ts
|
|
1539
|
-
var
|
|
1539
|
+
var cr = {
|
|
1540
1540
|
status: "idle",
|
|
1541
1541
|
missed: 0,
|
|
1542
1542
|
lastMiss: void 0
|
|
1543
|
-
},
|
|
1543
|
+
}, lr = class {
|
|
1544
1544
|
_tag = "EventStreamClosed";
|
|
1545
1545
|
};
|
|
1546
|
-
function
|
|
1547
|
-
let { skip: i = !1, apiName: a = "app", onMissed: s } = r, c = K(a), { runtime: l, client: u } = c, [d, f] =
|
|
1546
|
+
function ur(e, t, n, r = {}) {
|
|
1547
|
+
let { skip: i = !1, apiName: a = "app", onMissed: s } = r, c = K(a), { runtime: l, client: u } = c, [d, f] = V(cr), p = B(n);
|
|
1548
1548
|
p.current = n;
|
|
1549
|
-
let m =
|
|
1549
|
+
let m = B(s);
|
|
1550
1550
|
m.current = s;
|
|
1551
|
-
let g =
|
|
1551
|
+
let g = B(u);
|
|
1552
1552
|
g.current = u;
|
|
1553
|
-
let _ =
|
|
1553
|
+
let _ = B(l);
|
|
1554
1554
|
_.current = l;
|
|
1555
|
-
let v =
|
|
1555
|
+
let v = B(/* @__PURE__ */ new Map()), y = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), b = B(t);
|
|
1556
1556
|
b.current = t;
|
|
1557
|
-
let x =
|
|
1557
|
+
let x = B(null);
|
|
1558
1558
|
x.current !== y && (x.current = y, v.current = /* @__PURE__ */ new Map());
|
|
1559
|
-
let S =
|
|
1559
|
+
let S = I((t, n) => {
|
|
1560
1560
|
t <= 0 || (o(a, "event.gap", {
|
|
1561
1561
|
tag: e.name,
|
|
1562
1562
|
missed: t,
|
|
@@ -1572,10 +1572,10 @@ function lr(e, t, n, r = {}) {
|
|
|
1572
1572
|
count: t,
|
|
1573
1573
|
reason: n
|
|
1574
1574
|
}));
|
|
1575
|
-
}, [a, e.name]), C = !i && y !== null &&
|
|
1576
|
-
return
|
|
1575
|
+
}, [a, e.name]), C = !i && y !== null && !$e(c);
|
|
1576
|
+
return R(() => {
|
|
1577
1577
|
if (!C) {
|
|
1578
|
-
f(
|
|
1578
|
+
f(cr);
|
|
1579
1579
|
return;
|
|
1580
1580
|
}
|
|
1581
1581
|
f((e) => ({
|
|
@@ -1593,7 +1593,7 @@ function lr(e, t, n, r = {}) {
|
|
|
1593
1593
|
});
|
|
1594
1594
|
}), r = W.unwrap(n).pipe(W.tap(() => U.sync(() => {
|
|
1595
1595
|
t = 0;
|
|
1596
|
-
})), W.concat(W.fail(new
|
|
1596
|
+
})), W.concat(W.fail(new lr())), W.retry(Oe.exponential("250 millis", 2).pipe(Oe.either(Oe.spaced("30 seconds")), Oe.jittered, Oe.tapOutput(() => U.sync(() => {
|
|
1597
1597
|
t += 1, f((e) => ({
|
|
1598
1598
|
...e,
|
|
1599
1599
|
status: "connecting"
|
|
@@ -1620,11 +1620,11 @@ function lr(e, t, n, r = {}) {
|
|
|
1620
1620
|
y,
|
|
1621
1621
|
e.name,
|
|
1622
1622
|
S
|
|
1623
|
-
]), C ? d :
|
|
1623
|
+
]), C ? d : cr;
|
|
1624
1624
|
}
|
|
1625
1625
|
//#endregion
|
|
1626
1626
|
//#region src/sequence.ts
|
|
1627
|
-
var
|
|
1627
|
+
var dr = () => {
|
|
1628
1628
|
let e = (t) => ({
|
|
1629
1629
|
steps: t,
|
|
1630
1630
|
step: ((n, r, i) => e([...t, {
|
|
@@ -1636,7 +1636,7 @@ var ur = () => {
|
|
|
1636
1636
|
}]))
|
|
1637
1637
|
});
|
|
1638
1638
|
return e([]);
|
|
1639
|
-
},
|
|
1639
|
+
}, fr = async (e, t = {}) => {
|
|
1640
1640
|
let n = {}, r = [];
|
|
1641
1641
|
for (let i of e.steps) {
|
|
1642
1642
|
if (i.when !== void 0 && !i.when(n)) {
|
|
@@ -1696,13 +1696,13 @@ var ur = () => {
|
|
|
1696
1696
|
ok: !0,
|
|
1697
1697
|
data: n
|
|
1698
1698
|
};
|
|
1699
|
-
},
|
|
1700
|
-
let [t, n] =
|
|
1699
|
+
}, pr = (e = {}) => {
|
|
1700
|
+
let [t, n] = V(!1), [r, i] = V(void 0), [a, o] = V(void 0), s = B(e);
|
|
1701
1701
|
return s.current = e, {
|
|
1702
|
-
run:
|
|
1702
|
+
run: I(async (e, t = {}) => {
|
|
1703
1703
|
n(!0), i(void 0), o(void 0);
|
|
1704
1704
|
try {
|
|
1705
|
-
let n = await
|
|
1705
|
+
let n = await fr(e, {
|
|
1706
1706
|
...s.current,
|
|
1707
1707
|
...t
|
|
1708
1708
|
});
|
|
@@ -1715,7 +1715,7 @@ var ur = () => {
|
|
|
1715
1715
|
error: r,
|
|
1716
1716
|
failedStep: a
|
|
1717
1717
|
};
|
|
1718
|
-
},
|
|
1718
|
+
}, mr = "@voltro/plugin-storage", Q = (e) => Ne(mr, e), hr = (e, t, n, r) => new Promise((i, a) => {
|
|
1719
1719
|
let o = new XMLHttpRequest();
|
|
1720
1720
|
if (o.open("PUT", e), o.upload.onprogress = (e) => {
|
|
1721
1721
|
e.lengthComputable && n(e.loaded / e.total);
|
|
@@ -1729,7 +1729,7 @@ var ur = () => {
|
|
|
1729
1729
|
return;
|
|
1730
1730
|
}
|
|
1731
1731
|
r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
|
|
1732
|
-
}),
|
|
1732
|
+
}), gr = (e, t, n, r, i, a) => new Promise((o, s) => {
|
|
1733
1733
|
let c = new XMLHttpRequest();
|
|
1734
1734
|
if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
|
|
1735
1735
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1747,7 +1747,7 @@ var ur = () => {
|
|
|
1747
1747
|
return;
|
|
1748
1748
|
}
|
|
1749
1749
|
i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
|
|
1750
|
-
}),
|
|
1750
|
+
}), _r = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1751
1751
|
let s = new XMLHttpRequest();
|
|
1752
1752
|
if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1753
1753
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1758,7 +1758,7 @@ var ur = () => {
|
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
1760
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1761
|
-
}),
|
|
1761
|
+
}), vr = (e, t, n, r, i) => new Promise((a, o) => {
|
|
1762
1762
|
let s = new XMLHttpRequest();
|
|
1763
1763
|
if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
|
|
1764
1764
|
e.lengthComputable && r(e.loaded / e.total);
|
|
@@ -1774,14 +1774,14 @@ var ur = () => {
|
|
|
1774
1774
|
return;
|
|
1775
1775
|
}
|
|
1776
1776
|
i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
|
|
1777
|
-
}),
|
|
1778
|
-
let r = K(e), { inspectBaseUrl: a } = r, o =
|
|
1777
|
+
}), yr = (e, t = {}) => {
|
|
1778
|
+
let r = K(e), { inspectBaseUrl: a } = r, o = B(r);
|
|
1779
1779
|
o.current = r;
|
|
1780
|
-
let [s, c] =
|
|
1780
|
+
let [s, c] = V(0), [l, u] = V("idle"), [d, f] = V(void 0), p = B(null), m = I(() => {
|
|
1781
1781
|
c(0), u("idle"), f(void 0);
|
|
1782
|
-
}, []), g =
|
|
1782
|
+
}, []), g = I(() => {
|
|
1783
1783
|
p.current?.abort();
|
|
1784
|
-
}, []), _ =
|
|
1784
|
+
}, []), _ = I((e) => /^https?:\/\//.test(e) ? e : `${a}${e}`, [a]), v = I(async (r, i, a, s) => {
|
|
1785
1785
|
let { runtime: c, client: l } = await J(o, e, "storage.upload").catch((e) => {
|
|
1786
1786
|
throw n(e, "client");
|
|
1787
1787
|
}), u = Math.max(0, i.retries ?? t.retries ?? 1), d = (r instanceof File, r.type || "application/octet-stream"), f = r instanceof File ? r.name : "blob", p = i.visibility ?? t.visibility, m = i.key ?? t.key, g = i.folder ?? t.folder, v = i.tags ?? t.tags, y = {
|
|
@@ -1799,40 +1799,40 @@ var ur = () => {
|
|
|
1799
1799
|
...e.width === void 0 ? {} : { width: e.width },
|
|
1800
1800
|
...e.height === void 0 ? {} : { height: e.height }
|
|
1801
1801
|
}), x = async () => {
|
|
1802
|
-
let e = i.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), n = h(l, e), o = await
|
|
1802
|
+
let e = i.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), n = h(l, e), o = await C(c, n({
|
|
1803
1803
|
contentType: d,
|
|
1804
1804
|
...y,
|
|
1805
1805
|
...m ? { key: m } : {}
|
|
1806
|
-
})), u = await
|
|
1806
|
+
})), u = await vr(_(o.uploadUrl), d, r, s, a);
|
|
1807
1807
|
return b(u);
|
|
1808
|
-
},
|
|
1808
|
+
}, S = async () => {
|
|
1809
1809
|
let e = i.presignMintTag ?? t.presignMintTag ?? Q("mintPresignedUpload"), n = i.finalizeTag ?? t.finalizeTag ?? Q("finalizeUpload"), o;
|
|
1810
1810
|
try {
|
|
1811
1811
|
let t = h(l, e);
|
|
1812
|
-
o = await
|
|
1812
|
+
o = await C(c, t({
|
|
1813
1813
|
contentType: d,
|
|
1814
1814
|
...y
|
|
1815
1815
|
}));
|
|
1816
1816
|
} catch {
|
|
1817
1817
|
return null;
|
|
1818
1818
|
}
|
|
1819
|
-
await
|
|
1820
|
-
let u = h(l, n), f = await
|
|
1819
|
+
await _r(o.uploadUrl, d, r, s, a);
|
|
1820
|
+
let u = h(l, n), f = await C(c, u({ finalizeToken: o.finalizeToken }));
|
|
1821
1821
|
return b(f);
|
|
1822
1822
|
}, w = async () => {
|
|
1823
|
-
let e = i.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), n = h(l, e), o = r.size, u = i.chunkSize ?? t.chunkSize, f = await
|
|
1823
|
+
let e = i.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), n = h(l, e), o = r.size, u = i.chunkSize ?? t.chunkSize, f = await C(c, n({
|
|
1824
1824
|
contentType: d,
|
|
1825
1825
|
size: o,
|
|
1826
1826
|
...y,
|
|
1827
1827
|
...u ? { chunkSize: u } : {}
|
|
1828
|
-
})), p = _(f.uploadUrl), m = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(o / m)), v = Math.max(0, i.retries ?? t.retries ?? 1), x = 0,
|
|
1828
|
+
})), p = _(f.uploadUrl), m = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(o / m)), v = Math.max(0, i.retries ?? t.retries ?? 1), x = 0, S = null;
|
|
1829
1829
|
for (let e = 0; e < g; e++) {
|
|
1830
1830
|
let t = e * m, n = Math.min(o, t + m), i = r.slice(t, n), c = e === g - 1, l = n - t, u = 0;
|
|
1831
1831
|
for (;;) {
|
|
1832
1832
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
1833
1833
|
try {
|
|
1834
|
-
let t = await
|
|
1835
|
-
c && (
|
|
1834
|
+
let t = await gr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${c ? "&final=1" : ""}`}`, d, i, (e) => s((x + e * l) / o), a, c);
|
|
1835
|
+
c && (S = t);
|
|
1836
1836
|
break;
|
|
1837
1837
|
} catch (e) {
|
|
1838
1838
|
if (e instanceof DOMException && e.name === "AbortError" || u++ >= v) throw e;
|
|
@@ -1840,13 +1840,13 @@ var ur = () => {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
x += l, s(x / o);
|
|
1842
1842
|
}
|
|
1843
|
-
if (!
|
|
1844
|
-
return b(
|
|
1843
|
+
if (!S) throw Error("resumable upload produced no final reply");
|
|
1844
|
+
return b(S);
|
|
1845
1845
|
}, T = async () => {
|
|
1846
1846
|
let e = i.multipartBeginTag ?? t.multipartBeginTag ?? Q("beginMultipartUpload"), n = i.multipartSignTag ?? t.multipartSignTag ?? Q("signMultipartPart"), o = i.multipartCompleteTag ?? t.multipartCompleteTag ?? Q("completeMultipartUpload"), u = i.multipartAbortTag ?? t.multipartAbortTag ?? Q("abortMultipartUpload"), p = r.size, m = i.chunkSize ?? t.chunkSize, g;
|
|
1847
1847
|
try {
|
|
1848
1848
|
let t = h(l, e);
|
|
1849
|
-
g = await
|
|
1849
|
+
g = await C(c, t({
|
|
1850
1850
|
contentType: d,
|
|
1851
1851
|
size: p,
|
|
1852
1852
|
...y,
|
|
@@ -1855,17 +1855,17 @@ var ur = () => {
|
|
|
1855
1855
|
} catch {
|
|
1856
1856
|
return null;
|
|
1857
1857
|
}
|
|
1858
|
-
let v = h(l, n), b = h(l, o), x = h(l, u),
|
|
1858
|
+
let v = h(l, n), b = h(l, o), x = h(l, u), S = Math.max(1, g.partSize), w = Math.max(1, Math.ceil(p / S)), T = Math.max(0, i.retries ?? t.retries ?? 1), E = [], D = 0;
|
|
1859
1859
|
try {
|
|
1860
1860
|
for (let e = 0; e < w; e++) {
|
|
1861
|
-
let t = e *
|
|
1861
|
+
let t = e * S, n = Math.min(p, t + S), i = r.slice(t, n), o = e + 1, l = n - t, u = 0;
|
|
1862
1862
|
for (;;) {
|
|
1863
1863
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
1864
1864
|
try {
|
|
1865
|
-
let { url: e } = await
|
|
1865
|
+
let { url: e } = await C(c, v({
|
|
1866
1866
|
multipartToken: g.multipartToken,
|
|
1867
1867
|
partNumber: o
|
|
1868
|
-
})), t = await
|
|
1868
|
+
})), t = await hr(e, i, (e) => s((D + e * l) / p), a);
|
|
1869
1869
|
E.push({
|
|
1870
1870
|
partNumber: o,
|
|
1871
1871
|
etag: t
|
|
@@ -1877,7 +1877,7 @@ var ur = () => {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
D += l, s(D / p);
|
|
1879
1879
|
}
|
|
1880
|
-
let e = await
|
|
1880
|
+
let e = await C(c, b({
|
|
1881
1881
|
multipartToken: g.multipartToken,
|
|
1882
1882
|
parts: E
|
|
1883
1883
|
}));
|
|
@@ -1890,7 +1890,7 @@ var ur = () => {
|
|
|
1890
1890
|
};
|
|
1891
1891
|
} catch (e) {
|
|
1892
1892
|
try {
|
|
1893
|
-
await
|
|
1893
|
+
await C(c, x({ multipartToken: g.multipartToken }));
|
|
1894
1894
|
} catch {}
|
|
1895
1895
|
throw e;
|
|
1896
1896
|
}
|
|
@@ -1902,7 +1902,7 @@ var ur = () => {
|
|
|
1902
1902
|
if (a.aborted) throw new DOMException("upload aborted", "AbortError");
|
|
1903
1903
|
try {
|
|
1904
1904
|
if (E) {
|
|
1905
|
-
let e = await
|
|
1905
|
+
let e = await S();
|
|
1906
1906
|
if (e) return e;
|
|
1907
1907
|
}
|
|
1908
1908
|
return await x();
|
|
@@ -1929,7 +1929,7 @@ var ur = () => {
|
|
|
1929
1929
|
t.folder,
|
|
1930
1930
|
t.tags,
|
|
1931
1931
|
t.retries
|
|
1932
|
-
]), y =
|
|
1932
|
+
]), y = I(async (e, n = {}) => {
|
|
1933
1933
|
let r = new AbortController();
|
|
1934
1934
|
p.current = r, u("uploading"), f(void 0), c(0);
|
|
1935
1935
|
try {
|
|
@@ -1944,7 +1944,7 @@ var ur = () => {
|
|
|
1944
1944
|
outcome: i(e, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
1945
1945
|
}), e;
|
|
1946
1946
|
}
|
|
1947
|
-
}, [v, t.mintTag]), b =
|
|
1947
|
+
}, [v, t.mintTag]), b = I(async (e, n = {}) => {
|
|
1948
1948
|
if (e.length === 0) return [];
|
|
1949
1949
|
let r = new AbortController();
|
|
1950
1950
|
p.current = r, u("uploading"), f(void 0), c(0);
|
|
@@ -1972,20 +1972,20 @@ var ur = () => {
|
|
|
1972
1972
|
v,
|
|
1973
1973
|
t.concurrency,
|
|
1974
1974
|
t.mintTag
|
|
1975
|
-
]), x =
|
|
1975
|
+
]), x = I((e, t = {}) => {
|
|
1976
1976
|
e.preventDefault();
|
|
1977
1977
|
let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
|
|
1978
1978
|
return n.length ? b(n, t) : Promise.resolve([]);
|
|
1979
|
-
}, [b]),
|
|
1979
|
+
}, [b]), S = I((e, t = {}) => {
|
|
1980
1980
|
let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
|
|
1981
1981
|
return n.length ? b(n, t) : Promise.resolve([]);
|
|
1982
|
-
}, [b]), w =
|
|
1982
|
+
}, [b]), w = z(() => ({
|
|
1983
1983
|
onDragOver: (e) => e.preventDefault(),
|
|
1984
1984
|
onDrop: (e) => {
|
|
1985
1985
|
x(e);
|
|
1986
1986
|
}
|
|
1987
1987
|
}), [x]);
|
|
1988
|
-
return
|
|
1988
|
+
return z(() => ({
|
|
1989
1989
|
upload: y,
|
|
1990
1990
|
uploadMany: b,
|
|
1991
1991
|
progress: s,
|
|
@@ -1994,7 +1994,7 @@ var ur = () => {
|
|
|
1994
1994
|
cancel: g,
|
|
1995
1995
|
reset: m,
|
|
1996
1996
|
onDrop: x,
|
|
1997
|
-
onPaste:
|
|
1997
|
+
onPaste: S,
|
|
1998
1998
|
dropzoneProps: w
|
|
1999
1999
|
}), [
|
|
2000
2000
|
y,
|
|
@@ -2005,13 +2005,13 @@ var ur = () => {
|
|
|
2005
2005
|
g,
|
|
2006
2006
|
m,
|
|
2007
2007
|
x,
|
|
2008
|
-
|
|
2008
|
+
S,
|
|
2009
2009
|
w
|
|
2010
2010
|
]);
|
|
2011
|
-
},
|
|
2012
|
-
let n =
|
|
2011
|
+
}, br = (e, t) => {
|
|
2012
|
+
let n = yr(e), r = Dn(e, t.action), [i, a] = V("idle"), [o, s] = V(void 0), [c, l] = V(void 0), u = B(t.extra);
|
|
2013
2013
|
u.current = t.extra;
|
|
2014
|
-
let d =
|
|
2014
|
+
let d = I(async (e) => {
|
|
2015
2015
|
l(void 0), s(void 0), a("uploading");
|
|
2016
2016
|
let t;
|
|
2017
2017
|
try {
|
|
@@ -2029,12 +2029,12 @@ var ur = () => {
|
|
|
2029
2029
|
} catch (e) {
|
|
2030
2030
|
throw a("error"), l(e), e;
|
|
2031
2031
|
}
|
|
2032
|
-
}, [n, r]), f =
|
|
2032
|
+
}, [n, r]), f = I(() => {
|
|
2033
2033
|
n.cancel(), a("idle");
|
|
2034
|
-
}, [n]), p =
|
|
2034
|
+
}, [n]), p = I(() => {
|
|
2035
2035
|
n.reset(), a("idle"), s(void 0), l(void 0);
|
|
2036
2036
|
}, [n]);
|
|
2037
|
-
return
|
|
2037
|
+
return z(() => ({
|
|
2038
2038
|
phase: i,
|
|
2039
2039
|
progress: i === "uploading" ? n.progress : void 0,
|
|
2040
2040
|
result: o,
|
|
@@ -2054,7 +2054,7 @@ var ur = () => {
|
|
|
2054
2054
|
]);
|
|
2055
2055
|
}, $ = async (e) => {
|
|
2056
2056
|
let t = h(e.client, e.tag), n = U.currentSpan.pipe(U.tap((t) => U.sync(() => {
|
|
2057
|
-
|
|
2057
|
+
_({
|
|
2058
2058
|
traceId: t.traceId,
|
|
2059
2059
|
spanId: t.spanId,
|
|
2060
2060
|
source: "mutation",
|
|
@@ -2064,14 +2064,14 @@ var ur = () => {
|
|
|
2064
2064
|
"voltro.api": e.apiName,
|
|
2065
2065
|
"rpc.tag": e.tag
|
|
2066
2066
|
} }));
|
|
2067
|
-
return
|
|
2068
|
-
},
|
|
2069
|
-
let n = K(e), { descriptors: r } = n, i =
|
|
2067
|
+
return C(e.runtime, n);
|
|
2068
|
+
}, xr = (e, t) => {
|
|
2069
|
+
let n = K(e), { descriptors: r } = n, i = B(n);
|
|
2070
2070
|
if (i.current = n, process.env.NODE_ENV !== "production") {
|
|
2071
2071
|
let n = r[t]?.kind;
|
|
2072
2072
|
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.`);
|
|
2073
2073
|
}
|
|
2074
|
-
let [a, o] =
|
|
2074
|
+
let [a, o] = V(!1), [s, c] = V(void 0), [l, u] = V(void 0), d = I(async (n) => {
|
|
2075
2075
|
o(!0), c(void 0);
|
|
2076
2076
|
try {
|
|
2077
2077
|
let { runtime: r, client: a } = await J(i, e, t), o = await $({
|
|
@@ -2088,7 +2088,7 @@ var ur = () => {
|
|
|
2088
2088
|
} finally {
|
|
2089
2089
|
o(!1);
|
|
2090
2090
|
}
|
|
2091
|
-
}, [e, t]), f =
|
|
2091
|
+
}, [e, t]), f = I(async (t) => {
|
|
2092
2092
|
let n = "__voltro.workflow.queued.cancel", { runtime: r, client: a } = await J(i, e, n);
|
|
2093
2093
|
return $({
|
|
2094
2094
|
apiName: e,
|
|
@@ -2098,25 +2098,25 @@ var ur = () => {
|
|
|
2098
2098
|
input: t,
|
|
2099
2099
|
spanPrefix: "client.workflow.queued.cancel"
|
|
2100
2100
|
});
|
|
2101
|
-
}, [e]), p =
|
|
2101
|
+
}, [e]), p = I(async (t) => {
|
|
2102
2102
|
let n = "__voltro.workflow.queued.control", { runtime: r, client: a } = await J(i, e, n), o = h(a, n);
|
|
2103
|
-
return
|
|
2104
|
-
if (
|
|
2103
|
+
return C(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
|
|
2104
|
+
if (De.isSome(e)) {
|
|
2105
2105
|
if (e.value._tag === "snapshot") return U.succeed(e.value.data);
|
|
2106
2106
|
if (e.value._tag === "error") return U.fail(e.value.error);
|
|
2107
2107
|
}
|
|
2108
2108
|
return U.fail(/* @__PURE__ */ Error("queued workflow control query ended without a snapshot"));
|
|
2109
2109
|
})));
|
|
2110
|
-
}, [e]), m =
|
|
2110
|
+
}, [e]), m = I(async (t) => {
|
|
2111
2111
|
let n = "__voltro.workflow.control", { runtime: r, client: a } = await J(i, e, n), o = h(a, n);
|
|
2112
|
-
return
|
|
2113
|
-
if (
|
|
2112
|
+
return C(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
|
|
2113
|
+
if (De.isSome(e)) {
|
|
2114
2114
|
if (e.value._tag === "snapshot") return U.succeed(e.value.data);
|
|
2115
2115
|
if (e.value._tag === "error") return U.fail(e.value.error);
|
|
2116
2116
|
}
|
|
2117
2117
|
return U.fail(/* @__PURE__ */ Error("workflow control query ended without a snapshot"));
|
|
2118
2118
|
})));
|
|
2119
|
-
}, [e]), g =
|
|
2119
|
+
}, [e]), g = I(async (t, n) => {
|
|
2120
2120
|
let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.cancel");
|
|
2121
2121
|
return $({
|
|
2122
2122
|
apiName: e,
|
|
@@ -2129,7 +2129,7 @@ var ur = () => {
|
|
|
2129
2129
|
},
|
|
2130
2130
|
spanPrefix: "client.workflow.cancel"
|
|
2131
2131
|
});
|
|
2132
|
-
}, [e]), _ =
|
|
2132
|
+
}, [e]), _ = I(async (t, n) => {
|
|
2133
2133
|
let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.resume");
|
|
2134
2134
|
return $({
|
|
2135
2135
|
apiName: e,
|
|
@@ -2142,7 +2142,7 @@ var ur = () => {
|
|
|
2142
2142
|
},
|
|
2143
2143
|
spanPrefix: "client.workflow.resume"
|
|
2144
2144
|
});
|
|
2145
|
-
}, [e]), v =
|
|
2145
|
+
}, [e]), v = I(async (t, n, r) => {
|
|
2146
2146
|
let { runtime: a, client: o } = await J(i, e, "__voltro.workflow.signal");
|
|
2147
2147
|
return $({
|
|
2148
2148
|
apiName: e,
|
|
@@ -2156,7 +2156,7 @@ var ur = () => {
|
|
|
2156
2156
|
},
|
|
2157
2157
|
spanPrefix: "client.workflow.signal"
|
|
2158
2158
|
});
|
|
2159
|
-
}, [e]), y =
|
|
2159
|
+
}, [e]), y = I(async (t, n, r, a) => {
|
|
2160
2160
|
let { runtime: o, client: s } = await J(i, e, "__voltro.workflow.update");
|
|
2161
2161
|
return $({
|
|
2162
2162
|
apiName: e,
|
|
@@ -2172,7 +2172,7 @@ var ur = () => {
|
|
|
2172
2172
|
spanPrefix: "client.workflow.update"
|
|
2173
2173
|
});
|
|
2174
2174
|
}, [e]);
|
|
2175
|
-
return
|
|
2175
|
+
return z(() => ({
|
|
2176
2176
|
start: d,
|
|
2177
2177
|
cancelQueued: f,
|
|
2178
2178
|
readQueuedCancellation: p,
|
|
@@ -2197,10 +2197,10 @@ var ur = () => {
|
|
|
2197
2197
|
s,
|
|
2198
2198
|
l
|
|
2199
2199
|
]);
|
|
2200
|
-
},
|
|
2201
|
-
let t = K(e), n =
|
|
2200
|
+
}, Sr = (e) => {
|
|
2201
|
+
let t = K(e), n = B(t);
|
|
2202
2202
|
n.current = t;
|
|
2203
|
-
let [r, i] =
|
|
2203
|
+
let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = I(async (t, r, a) => {
|
|
2204
2204
|
i(!0), o(void 0);
|
|
2205
2205
|
try {
|
|
2206
2206
|
let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.signal"), s = await $({
|
|
@@ -2222,7 +2222,7 @@ var ur = () => {
|
|
|
2222
2222
|
i(!1);
|
|
2223
2223
|
}
|
|
2224
2224
|
}, [e]);
|
|
2225
|
-
return
|
|
2225
|
+
return z(() => ({
|
|
2226
2226
|
signal: l,
|
|
2227
2227
|
pending: r,
|
|
2228
2228
|
error: a,
|
|
@@ -2233,10 +2233,10 @@ var ur = () => {
|
|
|
2233
2233
|
a,
|
|
2234
2234
|
s
|
|
2235
2235
|
]);
|
|
2236
|
-
},
|
|
2237
|
-
let t = K(e), n =
|
|
2236
|
+
}, Cr = (e) => {
|
|
2237
|
+
let t = K(e), n = B(t);
|
|
2238
2238
|
n.current = t;
|
|
2239
|
-
let [r, i] =
|
|
2239
|
+
let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = I(async (t, r, a, s) => {
|
|
2240
2240
|
i(!0), o(void 0);
|
|
2241
2241
|
try {
|
|
2242
2242
|
let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.update"), l = await $({
|
|
@@ -2259,7 +2259,7 @@ var ur = () => {
|
|
|
2259
2259
|
i(!1);
|
|
2260
2260
|
}
|
|
2261
2261
|
}, [e]);
|
|
2262
|
-
return
|
|
2262
|
+
return z(() => ({
|
|
2263
2263
|
update: l,
|
|
2264
2264
|
pending: r,
|
|
2265
2265
|
error: a,
|
|
@@ -2270,7 +2270,7 @@ var ur = () => {
|
|
|
2270
2270
|
a,
|
|
2271
2271
|
s
|
|
2272
2272
|
]);
|
|
2273
|
-
},
|
|
2273
|
+
}, wr = (e, t) => {
|
|
2274
2274
|
let n = q(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
|
|
2275
2275
|
return n.loading || n.idle || n.failed ? {
|
|
2276
2276
|
...n,
|
|
@@ -2279,7 +2279,7 @@ var ur = () => {
|
|
|
2279
2279
|
...n,
|
|
2280
2280
|
run: n.data[0]
|
|
2281
2281
|
};
|
|
2282
|
-
},
|
|
2282
|
+
}, Tr = (e, t = {}, n = {}) => {
|
|
2283
2283
|
let r = q(e, "__voltro.workflow.runs", t, n);
|
|
2284
2284
|
return r.loading || r.idle || r.failed ? {
|
|
2285
2285
|
...r,
|
|
@@ -2288,7 +2288,7 @@ var ur = () => {
|
|
|
2288
2288
|
...r,
|
|
2289
2289
|
runs: r.data
|
|
2290
2290
|
};
|
|
2291
|
-
},
|
|
2291
|
+
}, Er = (e, t) => {
|
|
2292
2292
|
let n = q(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2293
2293
|
return n.loading || n.idle || n.failed ? {
|
|
2294
2294
|
...n,
|
|
@@ -2297,7 +2297,7 @@ var ur = () => {
|
|
|
2297
2297
|
...n,
|
|
2298
2298
|
steps: n.data
|
|
2299
2299
|
};
|
|
2300
|
-
},
|
|
2300
|
+
}, Dr = (e, t) => {
|
|
2301
2301
|
let n = q(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
|
|
2302
2302
|
return n.loading || n.idle || n.failed ? {
|
|
2303
2303
|
...n,
|
|
@@ -2306,7 +2306,7 @@ var ur = () => {
|
|
|
2306
2306
|
...n,
|
|
2307
2307
|
events: n.data
|
|
2308
2308
|
};
|
|
2309
|
-
},
|
|
2309
|
+
}, Or = Dr, kr = (e, t = {}, n = {}) => {
|
|
2310
2310
|
let r = q(e, "__voltro.workflow.domainEvents", t, n);
|
|
2311
2311
|
return r.loading || r.idle || r.failed ? {
|
|
2312
2312
|
...r,
|
|
@@ -2315,7 +2315,7 @@ var ur = () => {
|
|
|
2315
2315
|
...r,
|
|
2316
2316
|
events: r.data
|
|
2317
2317
|
};
|
|
2318
|
-
},
|
|
2318
|
+
}, Ar = (e, t) => {
|
|
2319
2319
|
let n = q(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
|
|
2320
2320
|
return n.loading || n.idle || n.failed ? {
|
|
2321
2321
|
...n,
|
|
@@ -2324,42 +2324,42 @@ var ur = () => {
|
|
|
2324
2324
|
...n,
|
|
2325
2325
|
deliveries: n.data
|
|
2326
2326
|
};
|
|
2327
|
-
},
|
|
2327
|
+
}, jr = (e, t) => {
|
|
2328
2328
|
let n = e.payload;
|
|
2329
2329
|
if (!n || typeof n != "object") return;
|
|
2330
2330
|
let r = n[t];
|
|
2331
2331
|
return typeof r == "string" ? r : void 0;
|
|
2332
|
-
},
|
|
2332
|
+
}, Mr = (e) => {
|
|
2333
2333
|
let t = e.payload;
|
|
2334
2334
|
if (!t || typeof t != "object") return;
|
|
2335
2335
|
let n = t.updateId;
|
|
2336
2336
|
return typeof n == "string" ? n : void 0;
|
|
2337
|
-
},
|
|
2337
|
+
}, Nr = (e) => {
|
|
2338
2338
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2339
2339
|
for (let r of e) if (r.eventType === "signal-received") {
|
|
2340
|
-
let e =
|
|
2340
|
+
let e = jr(r, "signalName");
|
|
2341
2341
|
e && t.add(e);
|
|
2342
2342
|
} else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
|
|
2343
|
-
let e =
|
|
2343
|
+
let e = Mr(r);
|
|
2344
2344
|
e && n.add(e);
|
|
2345
2345
|
}
|
|
2346
2346
|
for (let r = e.length - 1; r >= 0; --r) {
|
|
2347
2347
|
let i = e[r];
|
|
2348
2348
|
if (i.eventType === "signal-awaited") {
|
|
2349
|
-
let e =
|
|
2349
|
+
let e = jr(i, "signalName");
|
|
2350
2350
|
if (e && !t.has(e)) return {
|
|
2351
2351
|
name: e,
|
|
2352
2352
|
kind: "signal"
|
|
2353
2353
|
};
|
|
2354
2354
|
} else if (i.eventType === "update-requested") {
|
|
2355
|
-
let e =
|
|
2355
|
+
let e = Mr(i), t = jr(i, "updateName");
|
|
2356
2356
|
if (t && (!e || !n.has(e))) return {
|
|
2357
2357
|
name: t,
|
|
2358
2358
|
kind: "update"
|
|
2359
2359
|
};
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
-
},
|
|
2362
|
+
}, Pr = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), Fr = (e, t) => {
|
|
2363
2363
|
if (!e || e.status !== "failed") return;
|
|
2364
2364
|
let n = t.find((e) => e.status === "failed");
|
|
2365
2365
|
return {
|
|
@@ -2367,34 +2367,34 @@ var ur = () => {
|
|
|
2367
2367
|
message: e.errorMessage,
|
|
2368
2368
|
step: n?.stepName
|
|
2369
2369
|
};
|
|
2370
|
-
},
|
|
2371
|
-
let n =
|
|
2370
|
+
}, Ir = (e, t) => {
|
|
2371
|
+
let n = wr(e, t), r = Er(e, t), i = Dr(e, t), a = xr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = I(async () => {
|
|
2372
2372
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
|
|
2373
2373
|
await a.cancel({
|
|
2374
2374
|
workflowName: o.tag,
|
|
2375
2375
|
executionId: o.executionId
|
|
2376
2376
|
});
|
|
2377
|
-
}, [a, o]), u =
|
|
2377
|
+
}, [a, o]), u = I(async () => {
|
|
2378
2378
|
if (!o) throw Error("useWorkflowRunState: no run loaded — cannot resume");
|
|
2379
2379
|
await a.resume({
|
|
2380
2380
|
workflowName: o.tag,
|
|
2381
2381
|
executionId: o.executionId
|
|
2382
2382
|
});
|
|
2383
|
-
}, [a, o]), d =
|
|
2383
|
+
}, [a, o]), d = I((e, n) => {
|
|
2384
2384
|
if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot signal");
|
|
2385
2385
|
return a.signal({ id: t }, e, n);
|
|
2386
|
-
}, [a, t]), f =
|
|
2386
|
+
}, [a, t]), f = I((e, n, r) => {
|
|
2387
2387
|
if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot update");
|
|
2388
2388
|
return a.update({ id: t }, e, n, r);
|
|
2389
2389
|
}, [a, t]);
|
|
2390
|
-
return
|
|
2390
|
+
return z(() => ({
|
|
2391
2391
|
run: o,
|
|
2392
2392
|
status: o?.status,
|
|
2393
2393
|
steps: s,
|
|
2394
2394
|
events: c,
|
|
2395
|
-
currentStep:
|
|
2396
|
-
waitingFor: o?.status === "suspended" ?
|
|
2397
|
-
error:
|
|
2395
|
+
currentStep: Pr(s),
|
|
2396
|
+
waitingFor: o?.status === "suspended" ? Nr(c) : void 0,
|
|
2397
|
+
error: Fr(o, s),
|
|
2398
2398
|
traceId: o?.traceId,
|
|
2399
2399
|
loading: n.data === void 0,
|
|
2400
2400
|
cancel: l,
|
|
@@ -2411,24 +2411,24 @@ var ur = () => {
|
|
|
2411
2411
|
d,
|
|
2412
2412
|
f
|
|
2413
2413
|
]);
|
|
2414
|
-
},
|
|
2415
|
-
let { runtime: n, client: r } = K(e), [i, a] =
|
|
2414
|
+
}, Lr = (e, t) => {
|
|
2415
|
+
let { runtime: n, client: r } = K(e), [i, a] = V([]), [o, s] = V("idle"), [c, l] = V(void 0), u = B(null), d = I(() => {
|
|
2416
2416
|
let e = u.current;
|
|
2417
|
-
e && (u.current = null, n.runFork(
|
|
2417
|
+
e && (u.current = null, n.runFork(Ee.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
|
|
2418
2418
|
}, [n]);
|
|
2419
2419
|
return {
|
|
2420
2420
|
events: i,
|
|
2421
2421
|
status: o,
|
|
2422
2422
|
error: c,
|
|
2423
|
-
start:
|
|
2423
|
+
start: I((e = {}) => {
|
|
2424
2424
|
let i = u.current;
|
|
2425
|
-
i && n.runFork(
|
|
2425
|
+
i && n.runFork(Ee.interrupt(i)), a([]), l(void 0), s("streaming");
|
|
2426
2426
|
let o = h(r, t)(e), c = W.runForEach(o, (e) => U.sync(() => a((t) => [...t, e]))).pipe(U.matchCause({
|
|
2427
2427
|
onSuccess: () => {
|
|
2428
2428
|
s("done");
|
|
2429
2429
|
},
|
|
2430
2430
|
onFailure: (e) => {
|
|
2431
|
-
|
|
2431
|
+
Ce.isInterruptedOnly(e) || (l(g(e)), s("error"));
|
|
2432
2432
|
}
|
|
2433
2433
|
}));
|
|
2434
2434
|
u.current = n.runFork(c);
|
|
@@ -2439,7 +2439,7 @@ var ur = () => {
|
|
|
2439
2439
|
]),
|
|
2440
2440
|
cancel: d
|
|
2441
2441
|
};
|
|
2442
|
-
},
|
|
2442
|
+
}, Rr = (e, t, n, r) => {
|
|
2443
2443
|
let i = 0, a = !1, o = (e) => U.sync(() => {
|
|
2444
2444
|
e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
|
|
2445
2445
|
}), s = (e) => {
|
|
@@ -2454,7 +2454,7 @@ var ur = () => {
|
|
|
2454
2454
|
let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, l - 1));
|
|
2455
2455
|
return U.sync(() => {
|
|
2456
2456
|
n.onStatus("reconnecting"), n.onReconnect();
|
|
2457
|
-
}).pipe(U.zipRight(U.sleep(
|
|
2457
|
+
}).pipe(U.zipRight(U.sleep(we.millis(p))), U.zipRight(U.sync(() => n.onStatus("streaming"))), U.zipRight(u(l)));
|
|
2458
2458
|
}, u = (r) => U.suspend(() => {
|
|
2459
2459
|
let s = i, c = e({
|
|
2460
2460
|
...t,
|
|
@@ -2462,38 +2462,38 @@ var ur = () => {
|
|
|
2462
2462
|
});
|
|
2463
2463
|
return W.runForEach(c, o).pipe(U.matchCauseEffect({
|
|
2464
2464
|
onSuccess: () => a ? U.sync(() => n.onStatus("done")) : l(r, s, void 0),
|
|
2465
|
-
onFailure: (e) =>
|
|
2465
|
+
onFailure: (e) => Ce.isInterruptedOnly(e) ? U.void : a ? U.sync(() => n.onStatus("done")) : l(r, s, g(e))
|
|
2466
2466
|
}));
|
|
2467
2467
|
});
|
|
2468
2468
|
return u(0);
|
|
2469
|
-
},
|
|
2469
|
+
}, zr = (e) => {
|
|
2470
2470
|
let t = e?._tag;
|
|
2471
2471
|
return t === "done" || t === "error";
|
|
2472
|
-
},
|
|
2473
|
-
let { runtime: r, client: i } = K(e), [a, o] =
|
|
2472
|
+
}, Br = (e, t, n = {}) => {
|
|
2473
|
+
let { runtime: r, client: i } = K(e), [a, o] = V([]), [s, c] = V("idle"), [l, u] = V(0), [d, f] = V(void 0), p = B(null), m = {
|
|
2474
2474
|
maxReconnects: n.maxReconnects ?? 6,
|
|
2475
2475
|
backoffMs: n.backoffMs ?? 400,
|
|
2476
2476
|
maxBackoffMs: n.maxBackoffMs ?? 8e3,
|
|
2477
|
-
isTerminal: n.isTerminal ??
|
|
2478
|
-
}, g =
|
|
2477
|
+
isTerminal: n.isTerminal ?? zr
|
|
2478
|
+
}, g = I(() => {
|
|
2479
2479
|
let e = p.current;
|
|
2480
|
-
e && (p.current = null, r.runFork(
|
|
2480
|
+
e && (p.current = null, r.runFork(Ee.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
|
|
2481
2481
|
}, [r]);
|
|
2482
2482
|
return {
|
|
2483
2483
|
events: a,
|
|
2484
2484
|
status: s,
|
|
2485
2485
|
reconnects: l,
|
|
2486
2486
|
error: d,
|
|
2487
|
-
start:
|
|
2487
|
+
start: I((e = {}) => {
|
|
2488
2488
|
let n = p.current;
|
|
2489
|
-
n && r.runFork(
|
|
2489
|
+
n && r.runFork(Ee.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
|
|
2490
2490
|
let a = h(i, t), s = {
|
|
2491
2491
|
onEvent: (e) => o((t) => [...t, e]),
|
|
2492
2492
|
onStatus: c,
|
|
2493
2493
|
onReconnect: () => u((e) => e + 1),
|
|
2494
2494
|
onError: f
|
|
2495
2495
|
};
|
|
2496
|
-
p.current = r.runFork(
|
|
2496
|
+
p.current = r.runFork(Rr(a, e, s, m));
|
|
2497
2497
|
}, [
|
|
2498
2498
|
r,
|
|
2499
2499
|
i,
|
|
@@ -2505,13 +2505,13 @@ var ur = () => {
|
|
|
2505
2505
|
]),
|
|
2506
2506
|
cancel: g
|
|
2507
2507
|
};
|
|
2508
|
-
},
|
|
2508
|
+
}, Vr = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), Hr = (e) => {
|
|
2509
2509
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
2510
2510
|
let n = e[t];
|
|
2511
2511
|
if (n.role === "user" && n.content) return n.content;
|
|
2512
2512
|
}
|
|
2513
|
-
},
|
|
2514
|
-
let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a =
|
|
2513
|
+
}, Ur = (e, t, n) => {
|
|
2514
|
+
let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a = Dn(e, `${t}.send`), o = z(() => [...i.data ?? []].sort(Vr), [i.data]), s = I((e, t = {}) => a.run({
|
|
2515
2515
|
threadId: r,
|
|
2516
2516
|
order: i.data?.length ?? 0,
|
|
2517
2517
|
prompt: e,
|
|
@@ -2520,11 +2520,11 @@ var ur = () => {
|
|
|
2520
2520
|
a,
|
|
2521
2521
|
r,
|
|
2522
2522
|
i.data
|
|
2523
|
-
]), c =
|
|
2524
|
-
let e =
|
|
2523
|
+
]), c = I(() => {
|
|
2524
|
+
let e = Hr(o);
|
|
2525
2525
|
return e === void 0 ? void 0 : s(e);
|
|
2526
2526
|
}, [o, s]);
|
|
2527
|
-
return
|
|
2527
|
+
return z(() => ({
|
|
2528
2528
|
messages: o,
|
|
2529
2529
|
streaming: o.some((e) => e.streaming),
|
|
2530
2530
|
loading: i.data === void 0,
|
|
@@ -2541,9 +2541,9 @@ var ur = () => {
|
|
|
2541
2541
|
s,
|
|
2542
2542
|
c
|
|
2543
2543
|
]);
|
|
2544
|
-
},
|
|
2545
|
-
let { events: n, status: r, error: i, start: a, cancel: o } =
|
|
2546
|
-
return
|
|
2544
|
+
}, Wr = (e, t) => {
|
|
2545
|
+
let { events: n, status: r, error: i, start: a, cancel: o } = Lr(e, t), [s, c] = V([]), l = B(null), u = z(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
|
|
2546
|
+
return R(() => {
|
|
2547
2547
|
if (r !== "done" || l.current === null) return;
|
|
2548
2548
|
let e = l.current;
|
|
2549
2549
|
l.current = null, c((t) => [
|
|
@@ -2562,18 +2562,18 @@ var ur = () => {
|
|
|
2562
2562
|
history: s,
|
|
2563
2563
|
status: r,
|
|
2564
2564
|
error: i,
|
|
2565
|
-
send:
|
|
2565
|
+
send: I((e = {}) => {
|
|
2566
2566
|
let t = e.message;
|
|
2567
2567
|
l.current = typeof t == "string" ? t : "", a(e);
|
|
2568
2568
|
}, [a]),
|
|
2569
2569
|
cancel: o
|
|
2570
2570
|
};
|
|
2571
|
-
},
|
|
2572
|
-
let n =
|
|
2571
|
+
}, Gr = (e, t) => {
|
|
2572
|
+
let n = Dn(e, t), [r, i] = V(void 0), a = I(async (e) => {
|
|
2573
2573
|
let t = await n.run({ question: e });
|
|
2574
2574
|
return i(t), t;
|
|
2575
|
-
}, [n]), o =
|
|
2576
|
-
return
|
|
2575
|
+
}, [n]), o = I(() => i(void 0), []);
|
|
2576
|
+
return z(() => ({
|
|
2577
2577
|
ask: a,
|
|
2578
2578
|
answer: r,
|
|
2579
2579
|
pending: n.pending,
|
|
@@ -2586,32 +2586,32 @@ var ur = () => {
|
|
|
2586
2586
|
n.error,
|
|
2587
2587
|
o
|
|
2588
2588
|
]);
|
|
2589
|
-
},
|
|
2589
|
+
}, Kr = (e) => {
|
|
2590
2590
|
let { cache: t, runtime: n } = K(e);
|
|
2591
|
-
return
|
|
2591
|
+
return I(() => {
|
|
2592
2592
|
t.refreshAll(n);
|
|
2593
2593
|
}, [t, n]);
|
|
2594
|
-
},
|
|
2595
|
-
let { cache: r } = K(e), i = O([t, n]), a =
|
|
2596
|
-
return a.current = [t, n],
|
|
2594
|
+
}, qr = (e, t, n) => {
|
|
2595
|
+
let { cache: r } = K(e), i = O([t, n]), a = B([t, n]);
|
|
2596
|
+
return a.current = [t, n], z(() => {
|
|
2597
2597
|
let e = a.current;
|
|
2598
2598
|
return () => r.refresh(e);
|
|
2599
2599
|
}, [r, i]);
|
|
2600
|
-
}, qr = (e, t) => {
|
|
2601
|
-
let n = K(e), r = n.recovery ?? d(n.errorBus, e), i = z(t);
|
|
2602
|
-
i.current = t, L(() => r.onVisibleError((e) => i.current(e)), [r]);
|
|
2603
2600
|
}, Jr = (e, t) => {
|
|
2604
|
-
let
|
|
2605
|
-
|
|
2606
|
-
}, Yr = {
|
|
2601
|
+
let n = K(e), r = n.recovery ?? d(n.errorBus, e), i = B(t);
|
|
2602
|
+
i.current = t, R(() => r.onVisibleError((e) => i.current(e)), [r]);
|
|
2603
|
+
}, Yr = (e, t) => {
|
|
2604
|
+
let { errorBus: n } = K(e), r = B(t);
|
|
2605
|
+
r.current = t, R(() => n.on((e) => r.current(e)), [n]);
|
|
2606
|
+
}, Xr = {
|
|
2607
2607
|
failed: [],
|
|
2608
2608
|
healthy: !0
|
|
2609
|
-
},
|
|
2610
|
-
let { errorBus: t } = K(e), [n, r] =
|
|
2611
|
-
return
|
|
2609
|
+
}, Zr = (e) => {
|
|
2610
|
+
let { errorBus: t } = K(e), [n, r] = V(Xr);
|
|
2611
|
+
return R(() => {
|
|
2612
2612
|
let e = /* @__PURE__ */ new Map(), n = () => {
|
|
2613
2613
|
let t = [...e.values()].sort((e, t) => t.at - e.at);
|
|
2614
|
-
r(t.length === 0 ?
|
|
2614
|
+
r(t.length === 0 ? Xr : {
|
|
2615
2615
|
failed: t,
|
|
2616
2616
|
healthy: !1
|
|
2617
2617
|
});
|
|
@@ -2629,20 +2629,20 @@ var ur = () => {
|
|
|
2629
2629
|
i(), a();
|
|
2630
2630
|
};
|
|
2631
2631
|
}, [t]), n;
|
|
2632
|
-
},
|
|
2632
|
+
}, Qr = (e, t) => {
|
|
2633
2633
|
let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
|
|
2634
2634
|
if (i) return i;
|
|
2635
|
-
let a =
|
|
2635
|
+
let a = F(t);
|
|
2636
2636
|
return n[r] = a, a;
|
|
2637
|
-
},
|
|
2637
|
+
}, $r = Qr("serverRequest", null), ei = () => L($r), ti = ({ value: e, children: t }) => /* @__PURE__ */ Pe($r.Provider, {
|
|
2638
2638
|
value: e,
|
|
2639
2639
|
children: t
|
|
2640
|
-
}),
|
|
2641
|
-
let t =
|
|
2642
|
-
return
|
|
2640
|
+
}), ni = (e) => {
|
|
2641
|
+
let t = ei();
|
|
2642
|
+
return z(() => {
|
|
2643
2643
|
if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
|
|
2644
2644
|
if (typeof document > "u") return;
|
|
2645
|
-
let n = document.getElementById(
|
|
2645
|
+
let n = document.getElementById(he);
|
|
2646
2646
|
if (n !== null && n.textContent !== null && n.textContent !== "") try {
|
|
2647
2647
|
let t = JSON.parse(n.textContent);
|
|
2648
2648
|
return t.formKey === e ? t : void 0;
|
|
@@ -2650,15 +2650,15 @@ var ur = () => {
|
|
|
2650
2650
|
return;
|
|
2651
2651
|
}
|
|
2652
2652
|
}, [t, e]);
|
|
2653
|
-
},
|
|
2653
|
+
}, ri = (e, t, n) => e.map((e) => {
|
|
2654
2654
|
let r = String(e[n] ?? ""), i = e[t];
|
|
2655
2655
|
return {
|
|
2656
2656
|
value: r,
|
|
2657
2657
|
label: i == null ? r : String(i)
|
|
2658
2658
|
};
|
|
2659
|
-
}),
|
|
2660
|
-
let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] =
|
|
2661
|
-
|
|
2659
|
+
}), ii = (e, t, n = {}) => {
|
|
2660
|
+
let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = V(n.initialTerm ?? ""), [l, u] = V(s);
|
|
2661
|
+
R(() => {
|
|
2662
2662
|
if (s === l) return;
|
|
2663
2663
|
let e = setTimeout(() => u(s), r);
|
|
2664
2664
|
return () => clearTimeout(e);
|
|
@@ -2667,24 +2667,24 @@ var ur = () => {
|
|
|
2667
2667
|
l,
|
|
2668
2668
|
r
|
|
2669
2669
|
]);
|
|
2670
|
-
let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t,
|
|
2670
|
+
let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t, z(() => o(l), [o, l]), { skip: d }), p = z(() => ri(f.data ?? [], i, a), [
|
|
2671
2671
|
f.data,
|
|
2672
2672
|
i,
|
|
2673
2673
|
a
|
|
2674
|
-
]), m =
|
|
2674
|
+
]), m = I((e) => c(e), []);
|
|
2675
2675
|
return {
|
|
2676
2676
|
options: p,
|
|
2677
2677
|
loading: !d && f.data === void 0,
|
|
2678
2678
|
term: s,
|
|
2679
2679
|
search: m
|
|
2680
2680
|
};
|
|
2681
|
-
},
|
|
2682
|
-
let r = K(e), [i, a] =
|
|
2681
|
+
}, ai = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, oi = (e, t, n = {}) => {
|
|
2682
|
+
let r = K(e), [i, a] = V(n.pageSize), o = q(e, t, z(() => i === void 0 ? n.input ?? {} : {
|
|
2683
2683
|
...n.input,
|
|
2684
2684
|
limit: i
|
|
2685
|
-
}, [n.input, i])), s = r.descriptors[t]?.output, c =
|
|
2685
|
+
}, [n.input, i])), s = r.descriptors[t]?.output, c = I(() => {
|
|
2686
2686
|
n.pageSize !== void 0 && a((e) => (e ?? n.pageSize) + n.pageSize);
|
|
2687
|
-
}, [n.pageSize]), l =
|
|
2687
|
+
}, [n.pageSize]), l = z(() => n.columns ?? (s === void 0 ? [] : k(s)), [n.columns, s]), [u, d] = V(n.initialSort), f = I((e) => {
|
|
2688
2688
|
d((t) => t?.column === e ? {
|
|
2689
2689
|
column: e,
|
|
2690
2690
|
direction: t.direction === "asc" ? "desc" : "asc"
|
|
@@ -2695,11 +2695,11 @@ var ur = () => {
|
|
|
2695
2695
|
}, []);
|
|
2696
2696
|
return {
|
|
2697
2697
|
columns: l,
|
|
2698
|
-
rows:
|
|
2698
|
+
rows: z(() => {
|
|
2699
2699
|
let e = o.data ?? [];
|
|
2700
2700
|
if (u === void 0) return e;
|
|
2701
2701
|
let t = u.direction === "asc" ? 1 : -1;
|
|
2702
|
-
return [...e].sort((e, n) =>
|
|
2702
|
+
return [...e].sort((e, n) => ai(e[u.column], n[u.column]) * t);
|
|
2703
2703
|
}, [o.data, u]),
|
|
2704
2704
|
loading: o.data === void 0,
|
|
2705
2705
|
error: o.error,
|
|
@@ -2708,26 +2708,26 @@ var ur = () => {
|
|
|
2708
2708
|
loadMore: c,
|
|
2709
2709
|
hasMore: i !== void 0 && (o.data?.length ?? 0) >= i
|
|
2710
2710
|
};
|
|
2711
|
-
},
|
|
2711
|
+
}, si = (e, t, n, r) => {
|
|
2712
2712
|
let i = e.replace(/\/$/, ""), a = new URLSearchParams({
|
|
2713
2713
|
table: t,
|
|
2714
2714
|
id: n
|
|
2715
2715
|
});
|
|
2716
2716
|
return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
|
|
2717
|
-
},
|
|
2718
|
-
let { inspectBaseUrl: i } = K(e), [a, o] =
|
|
2717
|
+
}, ci = si, li = (e, t, n, r) => {
|
|
2718
|
+
let { inspectBaseUrl: i } = K(e), [a, o] = V({
|
|
2719
2719
|
data: void 0,
|
|
2720
2720
|
loading: !0,
|
|
2721
2721
|
error: void 0
|
|
2722
2722
|
});
|
|
2723
|
-
return
|
|
2723
|
+
return R(() => {
|
|
2724
2724
|
let e = !1;
|
|
2725
2725
|
o({
|
|
2726
2726
|
data: void 0,
|
|
2727
2727
|
loading: !0,
|
|
2728
2728
|
error: void 0
|
|
2729
2729
|
});
|
|
2730
|
-
let a =
|
|
2730
|
+
let a = si(i ?? "", t, n, r);
|
|
2731
2731
|
return fetch(a).then(async (e) => {
|
|
2732
2732
|
if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
|
|
2733
2733
|
return await e.json();
|
|
@@ -2753,23 +2753,23 @@ var ur = () => {
|
|
|
2753
2753
|
n,
|
|
2754
2754
|
r
|
|
2755
2755
|
]), a;
|
|
2756
|
-
},
|
|
2757
|
-
function
|
|
2758
|
-
return
|
|
2756
|
+
}, ui = "admin:full", di = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), fi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), pi = F({ scopes: [] });
|
|
2757
|
+
function mi(e) {
|
|
2758
|
+
return be(pi.Provider, { value: { scopes: e.scopes } }, e.children);
|
|
2759
2759
|
}
|
|
2760
|
-
var
|
|
2761
|
-
let { inspectBaseUrl: t } = K(e), [n, r] =
|
|
2760
|
+
var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes, e), vi = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, yi = (e) => {
|
|
2761
|
+
let { inspectBaseUrl: t } = K(e), [n, r] = V({
|
|
2762
2762
|
manifest: void 0,
|
|
2763
2763
|
loading: !0,
|
|
2764
2764
|
error: void 0
|
|
2765
2765
|
});
|
|
2766
|
-
return
|
|
2766
|
+
return R(() => {
|
|
2767
2767
|
let e = !1;
|
|
2768
2768
|
return r({
|
|
2769
2769
|
manifest: void 0,
|
|
2770
2770
|
loading: !0,
|
|
2771
2771
|
error: void 0
|
|
2772
|
-
}), fetch(
|
|
2772
|
+
}), fetch(vi(t ?? "")).then(async (e) => {
|
|
2773
2773
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
2774
2774
|
return await e.json();
|
|
2775
2775
|
}).then((t) => {
|
|
@@ -2788,7 +2788,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2788
2788
|
e = !0;
|
|
2789
2789
|
};
|
|
2790
2790
|
}, [e, t]), n;
|
|
2791
|
-
},
|
|
2791
|
+
}, bi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), xi = (e, t) => {
|
|
2792
2792
|
if (e === void 0) return "unknown";
|
|
2793
2793
|
if (t.includes("admin:full") || e.length === 0) return "allowed";
|
|
2794
2794
|
let n = !1;
|
|
@@ -2797,7 +2797,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2797
2797
|
n = !0;
|
|
2798
2798
|
continue;
|
|
2799
2799
|
}
|
|
2800
|
-
if (!
|
|
2800
|
+
if (!bi(t, r)) {
|
|
2801
2801
|
if (r.resourceScoped) {
|
|
2802
2802
|
n = !0;
|
|
2803
2803
|
continue;
|
|
@@ -2806,13 +2806,13 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2806
2806
|
}
|
|
2807
2807
|
}
|
|
2808
2808
|
return n ? "unknown" : "allowed";
|
|
2809
|
-
},
|
|
2809
|
+
}, Si = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), Ci = (e) => {
|
|
2810
2810
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
2811
|
-
},
|
|
2811
|
+
}, wi = (e) => xi(e, hi().scopes), Ti = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, Ei = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, Di = (e) => e === void 0 ? {} : {
|
|
2812
2812
|
tag: e.tag,
|
|
2813
2813
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
2814
|
-
},
|
|
2815
|
-
let n = e.procedures.find((e) => e.kind === "query" &&
|
|
2814
|
+
}, Oi = (e) => e.tables.filter((e) => !e.framework).map((t) => {
|
|
2815
|
+
let n = e.procedures.find((e) => e.kind === "query" && Ti(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
|
|
2816
2816
|
return {
|
|
2817
2817
|
table: t.name,
|
|
2818
2818
|
columns: t.columns.filter((e) => e.serverOnly !== !0),
|
|
@@ -2821,22 +2821,22 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2821
2821
|
reactive: t.reactive,
|
|
2822
2822
|
...o === void 0 ? {} : { pkColumn: o },
|
|
2823
2823
|
editable: (t.editable ?? !0) && o !== void 0,
|
|
2824
|
-
list:
|
|
2825
|
-
create:
|
|
2826
|
-
update:
|
|
2827
|
-
delete:
|
|
2824
|
+
list: Di(n),
|
|
2825
|
+
create: Di(r),
|
|
2826
|
+
update: Di(i),
|
|
2827
|
+
delete: Di(a)
|
|
2828
2828
|
};
|
|
2829
|
-
}),
|
|
2830
|
-
let [t, n] =
|
|
2829
|
+
}), ki = (e) => {
|
|
2830
|
+
let [t, n] = V([]), [r, i] = V([]), a = I((e) => {
|
|
2831
2831
|
n((t) => [...t, e]), i([]);
|
|
2832
|
-
}, []), o =
|
|
2832
|
+
}, []), o = I(async () => {
|
|
2833
2833
|
let r = t[t.length - 1];
|
|
2834
2834
|
r !== void 0 && r.blockedBy === void 0 && (await e.onUndo(r.invocationId), n((e) => e.slice(0, -1)), i((e) => [...e, r]));
|
|
2835
|
-
}, [t, e]), s =
|
|
2835
|
+
}, [t, e]), s = I(async () => {
|
|
2836
2836
|
let t = r[r.length - 1];
|
|
2837
2837
|
t !== void 0 && (await e.onRedo(t.invocationId), i((e) => e.slice(0, -1)), n((e) => [...e, t]));
|
|
2838
2838
|
}, [r, e]);
|
|
2839
|
-
return
|
|
2839
|
+
return z(() => {
|
|
2840
2840
|
let e = t[t.length - 1];
|
|
2841
2841
|
return {
|
|
2842
2842
|
record: a,
|
|
@@ -2854,14 +2854,14 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2854
2854
|
o,
|
|
2855
2855
|
s
|
|
2856
2856
|
]);
|
|
2857
|
-
},
|
|
2858
|
-
let n = t?.limit, { data: r } = q(e,
|
|
2857
|
+
}, Ai = "__voltro.undo.log", ji = "__voltro.undo.apply", Mi = "__voltro.undo.redo", Ni = (e, t) => {
|
|
2858
|
+
let n = t?.limit, { data: r } = q(e, Ai, n === void 0 ? {} : { limit: n }), i = Sn(e, ji), a = Sn(e, Mi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = I(async (e) => {
|
|
2859
2859
|
await i.mutate({ invocationId: e });
|
|
2860
|
-
}, [i]), u =
|
|
2860
|
+
}, [i]), u = I(async (e) => {
|
|
2861
2861
|
await a.mutate({ invocationId: e });
|
|
2862
|
-
}, [a]), d =
|
|
2862
|
+
}, [a]), d = I(async () => {
|
|
2863
2863
|
s && await l(s.id);
|
|
2864
|
-
}, [s, l]), f =
|
|
2864
|
+
}, [s, l]), f = I(async () => {
|
|
2865
2865
|
c && await u(c.id);
|
|
2866
2866
|
}, [c, u]);
|
|
2867
2867
|
return {
|
|
@@ -2874,22 +2874,22 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2874
2874
|
undoLast: d,
|
|
2875
2875
|
redoLast: f
|
|
2876
2876
|
};
|
|
2877
|
-
},
|
|
2877
|
+
}, Pi = (e, t) => ({
|
|
2878
2878
|
name: e,
|
|
2879
2879
|
map: t
|
|
2880
|
-
}),
|
|
2880
|
+
}), Fi = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), Ii = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), Li = (e, t, n) => {
|
|
2881
2881
|
let r = { ...t };
|
|
2882
2882
|
for (let [i, a] of Object.entries(e.map)) {
|
|
2883
|
-
if (
|
|
2883
|
+
if (Ii.has(i) || a === void 0) continue;
|
|
2884
2884
|
let e = t[i];
|
|
2885
2885
|
r[i] = (...r) => {
|
|
2886
|
-
let i =
|
|
2886
|
+
let i = Fi(a, t);
|
|
2887
2887
|
if (i !== null && n(i), typeof e == "function") return e(...r);
|
|
2888
2888
|
};
|
|
2889
2889
|
}
|
|
2890
2890
|
return r;
|
|
2891
|
-
},
|
|
2892
|
-
let r =
|
|
2891
|
+
}, Ri = (e, t, n) => {
|
|
2892
|
+
let r = B({
|
|
2893
2893
|
spec: e,
|
|
2894
2894
|
props: t,
|
|
2895
2895
|
sink: n
|
|
@@ -2898,47 +2898,47 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2898
2898
|
spec: e,
|
|
2899
2899
|
props: t,
|
|
2900
2900
|
sink: n
|
|
2901
|
-
},
|
|
2902
|
-
let e = r.current, t =
|
|
2901
|
+
}, R(() => {
|
|
2902
|
+
let e = r.current, t = Fi(e.spec.map.onMount, e.props);
|
|
2903
2903
|
return t !== null && e.sink(t), () => {
|
|
2904
|
-
let e = r.current, t =
|
|
2904
|
+
let e = r.current, t = Fi(e.spec.map.onUnmount, e.props);
|
|
2905
2905
|
t !== null && e.sink(t);
|
|
2906
2906
|
};
|
|
2907
|
-
}, []),
|
|
2907
|
+
}, []), z(() => Li(e, t, n), [
|
|
2908
2908
|
e,
|
|
2909
2909
|
t,
|
|
2910
2910
|
n
|
|
2911
2911
|
]);
|
|
2912
|
-
}, Ri = (e, t) => {
|
|
2913
|
-
let n = K(e).descriptors[t]?.input;
|
|
2914
|
-
return R(() => n === void 0 ? [] : ve(n), [n]);
|
|
2915
2912
|
}, zi = (e, t) => {
|
|
2916
|
-
let n = K(e).descriptors[t]?.
|
|
2917
|
-
return
|
|
2913
|
+
let n = K(e).descriptors[t]?.input;
|
|
2914
|
+
return z(() => n === void 0 ? [] : _e(n), [n]);
|
|
2918
2915
|
}, Bi = (e, t) => {
|
|
2916
|
+
let n = K(e).descriptors[t]?.output;
|
|
2917
|
+
return z(() => n === void 0 ? [] : k(n), [n]);
|
|
2918
|
+
}, Vi = (e, t) => {
|
|
2919
2919
|
if (e === t) return !0;
|
|
2920
2920
|
if (e.length !== t.length) return !1;
|
|
2921
2921
|
for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
|
|
2922
2922
|
return !0;
|
|
2923
|
-
},
|
|
2924
|
-
let n =
|
|
2925
|
-
return (n.current === null || !
|
|
2923
|
+
}, Hi = (e) => Object.keys(e).sort().map((t) => e[t]), Ui = (e, t) => {
|
|
2924
|
+
let n = B(null), r = Hi(e);
|
|
2925
|
+
return (n.current === null || !Vi(n.current.key, r)) && (n.current = {
|
|
2926
2926
|
key: r,
|
|
2927
2927
|
value: t(e)
|
|
2928
2928
|
}), n.current.value;
|
|
2929
|
-
},
|
|
2929
|
+
}, Wi = (e, t, n, r = {}) => {
|
|
2930
2930
|
let i = q(e, t, { ...n }, r);
|
|
2931
|
-
return
|
|
2931
|
+
return z(() => ({
|
|
2932
2932
|
allowed: i.data?.allowed === !0,
|
|
2933
2933
|
pending: i.data === void 0
|
|
2934
2934
|
}), [i.data]);
|
|
2935
|
-
},
|
|
2935
|
+
}, Gi = (e, t, n, r = {}) => {
|
|
2936
2936
|
let i = q(e, t, { ...n }, r);
|
|
2937
|
-
return
|
|
2937
|
+
return z(() => ({
|
|
2938
2938
|
allowedIds: new Set(i.data?.allowedIds ?? []),
|
|
2939
2939
|
pending: i.data === void 0
|
|
2940
2940
|
}), [i.data]);
|
|
2941
|
-
},
|
|
2941
|
+
}, Ki = (e) => {
|
|
2942
2942
|
switch (e) {
|
|
2943
2943
|
case "select":
|
|
2944
2944
|
case "radio":
|
|
@@ -2954,26 +2954,26 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2954
2954
|
case "switch": return "boolean";
|
|
2955
2955
|
default: return null;
|
|
2956
2956
|
}
|
|
2957
|
-
},
|
|
2957
|
+
}, qi = (e) => _e(e).map((e) => {
|
|
2958
2958
|
if (e.name.includes(".")) return null;
|
|
2959
|
-
let t =
|
|
2959
|
+
let t = Ki(e.widget);
|
|
2960
2960
|
return t === null ? null : {
|
|
2961
2961
|
name: e.name,
|
|
2962
2962
|
label: e.label,
|
|
2963
2963
|
kind: t,
|
|
2964
2964
|
...e.options ? { options: e.options } : {}
|
|
2965
2965
|
};
|
|
2966
|
-
}).filter((e) => e !== null),
|
|
2966
|
+
}).filter((e) => e !== null), Ji = (e) => {
|
|
2967
2967
|
let t = {};
|
|
2968
2968
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
2969
2969
|
return t;
|
|
2970
|
-
},
|
|
2971
|
-
let r = K(e).descriptors[t]?.input, i =
|
|
2972
|
-
o((n) =>
|
|
2970
|
+
}, Yi = (e, t, n = {}) => {
|
|
2971
|
+
let r = K(e).descriptors[t]?.input, i = z(() => r === void 0 ? [] : qi(r), [r]), [a, o] = V(n.initial ?? {}), s = I((e, t) => {
|
|
2972
|
+
o((n) => Ji({
|
|
2973
2973
|
...n,
|
|
2974
2974
|
[e]: t
|
|
2975
2975
|
}));
|
|
2976
|
-
}, []), c =
|
|
2976
|
+
}, []), c = I(() => o({}), []), l = q(e, t, z(() => Ji(a), [a]));
|
|
2977
2977
|
return {
|
|
2978
2978
|
filters: i,
|
|
2979
2979
|
values: a,
|
|
@@ -2984,20 +2984,20 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
2984
2984
|
loading: l.data === void 0,
|
|
2985
2985
|
error: l.error
|
|
2986
2986
|
};
|
|
2987
|
-
},
|
|
2987
|
+
}, Xi = (e, t, n = {}) => {
|
|
2988
2988
|
let r = q(e, t, n), i = r.data;
|
|
2989
2989
|
return {
|
|
2990
2990
|
record: Array.isArray(i) ? i[0] : i,
|
|
2991
2991
|
loading: i === void 0,
|
|
2992
2992
|
error: r.error
|
|
2993
2993
|
};
|
|
2994
|
-
},
|
|
2995
|
-
let [n, r] =
|
|
2996
|
-
return
|
|
2994
|
+
}, Zi = (e, t = 300) => {
|
|
2995
|
+
let [n, r] = V(e);
|
|
2996
|
+
return R(() => {
|
|
2997
2997
|
let n = setTimeout(() => r(e), t);
|
|
2998
2998
|
return () => clearTimeout(n);
|
|
2999
2999
|
}, [e, t]), n;
|
|
3000
|
-
},
|
|
3000
|
+
}, Qi = (e) => {
|
|
3001
3001
|
let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
|
|
3002
3002
|
if (a && t.trim() === "") return {
|
|
3003
3003
|
status: "idle",
|
|
@@ -3015,39 +3015,39 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3015
3015
|
valid: o.valid,
|
|
3016
3016
|
message: o.message
|
|
3017
3017
|
};
|
|
3018
|
-
},
|
|
3019
|
-
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c =
|
|
3020
|
-
return
|
|
3018
|
+
}, $i = (e, t, n, r) => {
|
|
3019
|
+
let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Zi(n, o), l = s && c.trim() === "", u = q(e, t, z(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
|
|
3020
|
+
return Qi({
|
|
3021
3021
|
value: n,
|
|
3022
3022
|
debouncedValue: c,
|
|
3023
3023
|
data: l ? null : u.data,
|
|
3024
3024
|
interpret: a,
|
|
3025
3025
|
skipEmpty: s
|
|
3026
3026
|
});
|
|
3027
|
-
},
|
|
3027
|
+
}, ea = (e, t) => ({
|
|
3028
3028
|
name: e,
|
|
3029
3029
|
payload: t
|
|
3030
|
-
}),
|
|
3031
|
-
let n =
|
|
3030
|
+
}), ta = (e, t) => {
|
|
3031
|
+
let n = ke.decodeUnknownEither(e.payload, { errors: "all" })(t);
|
|
3032
3032
|
if (n._tag === "Right") return {
|
|
3033
3033
|
valid: !0,
|
|
3034
3034
|
errors: {}
|
|
3035
3035
|
};
|
|
3036
3036
|
let r = {};
|
|
3037
|
-
for (let e of
|
|
3037
|
+
for (let e of Le.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
|
|
3038
3038
|
return {
|
|
3039
3039
|
valid: !1,
|
|
3040
3040
|
errors: r
|
|
3041
3041
|
};
|
|
3042
|
-
},
|
|
3042
|
+
}, na = (e) => {
|
|
3043
3043
|
let t = new Map(e.map((e) => [e.name, e]));
|
|
3044
3044
|
return {
|
|
3045
3045
|
names: [...t.keys()].sort(),
|
|
3046
3046
|
get: (e) => t.get(e),
|
|
3047
3047
|
events: e
|
|
3048
3048
|
};
|
|
3049
|
-
},
|
|
3050
|
-
let n =
|
|
3049
|
+
}, ra = (e, t) => {
|
|
3050
|
+
let n = na(e);
|
|
3051
3051
|
return {
|
|
3052
3052
|
track: (e, r) => {
|
|
3053
3053
|
let i = n.get(e);
|
|
@@ -3056,7 +3056,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3056
3056
|
return;
|
|
3057
3057
|
}
|
|
3058
3058
|
if (process.env.NODE_ENV !== "production") {
|
|
3059
|
-
let t =
|
|
3059
|
+
let t = ta(i, r);
|
|
3060
3060
|
t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
|
|
3061
3061
|
}
|
|
3062
3062
|
t({
|
|
@@ -3067,49 +3067,49 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3067
3067
|
names: n.names,
|
|
3068
3068
|
catalog: n
|
|
3069
3069
|
};
|
|
3070
|
-
},
|
|
3071
|
-
let n =
|
|
3070
|
+
}, ia = (e, t) => {
|
|
3071
|
+
let n = Dn(e, t);
|
|
3072
3072
|
return {
|
|
3073
|
-
preview:
|
|
3073
|
+
preview: I((e) => n.run(e), [n]),
|
|
3074
3074
|
diff: n.lastResult,
|
|
3075
3075
|
pending: n.pending,
|
|
3076
3076
|
error: n.error
|
|
3077
3077
|
};
|
|
3078
|
-
},
|
|
3078
|
+
}, aa = (e, t, n, r) => [...e, {
|
|
3079
3079
|
id: t,
|
|
3080
3080
|
tag: n,
|
|
3081
3081
|
input: r,
|
|
3082
3082
|
status: "pending",
|
|
3083
3083
|
attempts: 0
|
|
3084
|
-
}],
|
|
3084
|
+
}], oa = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3085
3085
|
...e,
|
|
3086
3086
|
...n
|
|
3087
|
-
} : e),
|
|
3087
|
+
} : e), sa = (e, t) => oa(e, t, { status: "sent" }), ca = (e, t, n) => e.map((e) => e.id === t ? {
|
|
3088
3088
|
...e,
|
|
3089
3089
|
status: "failed",
|
|
3090
3090
|
error: n,
|
|
3091
3091
|
attempts: e.attempts + 1
|
|
3092
|
-
} : e),
|
|
3092
|
+
} : e), la = (e, t, n) => oa(e, t, {
|
|
3093
3093
|
status: "conflict",
|
|
3094
3094
|
error: n
|
|
3095
|
-
}),
|
|
3095
|
+
}), ua = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
|
|
3096
3096
|
...e,
|
|
3097
3097
|
input: n,
|
|
3098
3098
|
status: "pending",
|
|
3099
3099
|
error: void 0
|
|
3100
|
-
} : e),
|
|
3100
|
+
} : e), da = (e) => e.filter((e) => e.status !== "sent"), fa = (e) => {
|
|
3101
3101
|
let t = [];
|
|
3102
3102
|
for (let n of e) {
|
|
3103
3103
|
if (n.status === "conflict") break;
|
|
3104
3104
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
3105
3105
|
}
|
|
3106
3106
|
return t;
|
|
3107
|
-
},
|
|
3107
|
+
}, pa = (e) => {
|
|
3108
3108
|
let t = e;
|
|
3109
3109
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
3110
|
-
},
|
|
3111
|
-
let [t, n] =
|
|
3112
|
-
return
|
|
3110
|
+
}, ma = (e) => {
|
|
3111
|
+
let [t, n] = V(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
|
|
3112
|
+
return R(() => {
|
|
3113
3113
|
if (e !== void 0) {
|
|
3114
3114
|
n(e);
|
|
3115
3115
|
return;
|
|
@@ -3120,20 +3120,20 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3120
3120
|
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
3121
3121
|
};
|
|
3122
3122
|
}, [e]), t;
|
|
3123
|
-
},
|
|
3124
|
-
let { send: t, persistence: n, isConflict: r =
|
|
3123
|
+
}, ha = (e) => {
|
|
3124
|
+
let { send: t, persistence: n, isConflict: r = pa, idFor: i } = e, [a, o] = V([]), [s, c] = V(0), l = ma(e.online), u = B([]), d = I((e) => {
|
|
3125
3125
|
let t = e(u.current);
|
|
3126
3126
|
u.current = t, o(t);
|
|
3127
|
-
}, []), f =
|
|
3127
|
+
}, []), f = B(t);
|
|
3128
3128
|
f.current = t;
|
|
3129
|
-
let p =
|
|
3129
|
+
let p = B(r);
|
|
3130
3130
|
p.current = r;
|
|
3131
|
-
let m =
|
|
3132
|
-
|
|
3131
|
+
let m = B(void 0), h = B(!1), g = B(!0);
|
|
3132
|
+
R(() => (g.current = !0, () => {
|
|
3133
3133
|
g.current = !1;
|
|
3134
3134
|
}), []);
|
|
3135
|
-
let _ =
|
|
3136
|
-
|
|
3135
|
+
let _ = B(0), v = B(Math.random().toString(36).slice(2, 8)), y = B(n === void 0);
|
|
3136
|
+
R(() => {
|
|
3137
3137
|
if (n === void 0 || y.current) return;
|
|
3138
3138
|
let e = !1;
|
|
3139
3139
|
return n.load().then((t) => {
|
|
@@ -3143,30 +3143,30 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3143
3143
|
}), () => {
|
|
3144
3144
|
e = !0;
|
|
3145
3145
|
};
|
|
3146
|
-
}, [n, d]),
|
|
3147
|
-
n !== void 0 && y.current && n.save(
|
|
3146
|
+
}, [n, d]), R(() => {
|
|
3147
|
+
n !== void 0 && y.current && n.save(da(a)).catch(() => {});
|
|
3148
3148
|
}, [
|
|
3149
3149
|
n,
|
|
3150
3150
|
a,
|
|
3151
3151
|
s
|
|
3152
3152
|
]);
|
|
3153
|
-
let b =
|
|
3153
|
+
let b = I((e, t) => {
|
|
3154
3154
|
let n = i?.() ?? `obx_${v.current}_${_.current++}_${e}`;
|
|
3155
|
-
d((r) =>
|
|
3156
|
-
}, [i, d]), x =
|
|
3155
|
+
d((r) => aa(r, n, e, t)), c((e) => e + 1);
|
|
3156
|
+
}, [i, d]), x = I(() => {
|
|
3157
3157
|
if (!y.current || !g.current) return Promise.resolve();
|
|
3158
3158
|
if (m.current !== void 0) return m.current;
|
|
3159
3159
|
h.current = !1;
|
|
3160
3160
|
let e = Promise.resolve().then(async () => {
|
|
3161
3161
|
for (; g.current;) {
|
|
3162
|
-
let e =
|
|
3162
|
+
let e = fa(u.current)[0];
|
|
3163
3163
|
if (e === void 0) break;
|
|
3164
3164
|
try {
|
|
3165
3165
|
if (await f.current(e), !g.current) break;
|
|
3166
|
-
d((t) =>
|
|
3166
|
+
d((t) => sa(t, e.id));
|
|
3167
3167
|
} catch (t) {
|
|
3168
3168
|
if (!g.current) break;
|
|
3169
|
-
d((n) => p.current(t) ?
|
|
3169
|
+
d((n) => p.current(t) ? la(n, e.id, t) : ca(n, e.id, t)), h.current = !0;
|
|
3170
3170
|
break;
|
|
3171
3171
|
}
|
|
3172
3172
|
}
|
|
@@ -3175,17 +3175,17 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3175
3175
|
});
|
|
3176
3176
|
return m.current = e, e;
|
|
3177
3177
|
}, [d]);
|
|
3178
|
-
|
|
3178
|
+
R(() => {
|
|
3179
3179
|
l && x();
|
|
3180
|
-
}, [l, x]),
|
|
3180
|
+
}, [l, x]), R(() => {
|
|
3181
3181
|
l && !h.current && x();
|
|
3182
3182
|
}, [
|
|
3183
3183
|
s,
|
|
3184
3184
|
l,
|
|
3185
3185
|
x
|
|
3186
3186
|
]);
|
|
3187
|
-
let S =
|
|
3188
|
-
d((n) =>
|
|
3187
|
+
let S = I((e, t) => {
|
|
3188
|
+
d((n) => ua(n, e, t)), l && x();
|
|
3189
3189
|
}, [
|
|
3190
3190
|
l,
|
|
3191
3191
|
x,
|
|
@@ -3200,7 +3200,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3200
3200
|
conflicts: a.filter((e) => e.status === "conflict"),
|
|
3201
3201
|
resolveConflict: S
|
|
3202
3202
|
};
|
|
3203
|
-
},
|
|
3203
|
+
}, ga = (e) => {
|
|
3204
3204
|
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);
|
|
3205
3205
|
return {
|
|
3206
3206
|
startIndex: l,
|
|
@@ -3210,8 +3210,8 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3210
3210
|
topSpacer: l * r,
|
|
3211
3211
|
bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
|
|
3212
3212
|
};
|
|
3213
|
-
},
|
|
3214
|
-
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] =
|
|
3213
|
+
}, _a = (e, t, n) => {
|
|
3214
|
+
let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = V(0), u = z(() => ga({
|
|
3215
3215
|
scrollTop: c,
|
|
3216
3216
|
viewportHeight: i,
|
|
3217
3217
|
rowHeight: r,
|
|
@@ -3223,7 +3223,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3223
3223
|
r,
|
|
3224
3224
|
a,
|
|
3225
3225
|
o
|
|
3226
|
-
]), d = q(e, t,
|
|
3226
|
+
]), d = q(e, t, z(() => ({
|
|
3227
3227
|
...s,
|
|
3228
3228
|
offset: u.offset,
|
|
3229
3229
|
limit: u.limit
|
|
@@ -3231,7 +3231,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3231
3231
|
s,
|
|
3232
3232
|
u.offset,
|
|
3233
3233
|
u.limit
|
|
3234
|
-
])), f =
|
|
3234
|
+
])), f = I((e) => {
|
|
3235
3235
|
l(e.currentTarget.scrollTop);
|
|
3236
3236
|
}, []);
|
|
3237
3237
|
return {
|
|
@@ -3243,11 +3243,11 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3243
3243
|
loading: d.data === void 0,
|
|
3244
3244
|
error: d.error
|
|
3245
3245
|
};
|
|
3246
|
-
},
|
|
3246
|
+
}, va = () => typeof navigator > "u" || navigator.onLine, ya = () => !0, ba = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
|
|
3247
3247
|
window.removeEventListener("online", e), window.removeEventListener("offline", e);
|
|
3248
|
-
}),
|
|
3249
|
-
let t = K(e), n = t.recovery ?? d(t.errorBus, e), r =
|
|
3250
|
-
return
|
|
3248
|
+
}), xa = (e) => {
|
|
3249
|
+
let t = K(e), n = t.recovery ?? d(t.errorBus, e), r = H(n.subscribe, n.getSnapshot, n.getServerSnapshot ?? (() => v)), i = H(ba, va, ya), a = I(() => n.reportExternalSuccess(), [n]), s = i ? r.status : "offline";
|
|
3250
|
+
return R(() => {
|
|
3251
3251
|
o(e, "connection.status", {
|
|
3252
3252
|
status: s,
|
|
3253
3253
|
rawTransport: r.rawTransport,
|
|
@@ -3273,7 +3273,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3273
3273
|
mutationReplay: r.mutationReplay,
|
|
3274
3274
|
reportSuccess: a
|
|
3275
3275
|
};
|
|
3276
|
-
},
|
|
3276
|
+
}, Sa = "__voltro.connections.list", Ca = "__voltro.connections.start", wa = "__voltro.connections.submitToken", Ta = "__voltro.connections.disconnect", Ea = {
|
|
3277
3277
|
connectionId: "",
|
|
3278
3278
|
kind: "oauth2",
|
|
3279
3279
|
label: "",
|
|
@@ -3284,14 +3284,14 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3284
3284
|
expiresAt: null,
|
|
3285
3285
|
lastError: null,
|
|
3286
3286
|
connectedAt: null
|
|
3287
|
-
},
|
|
3287
|
+
}, Da = (e, t) => {
|
|
3288
3288
|
if (t === "redirect") {
|
|
3289
3289
|
globalThis.location.assign(e);
|
|
3290
3290
|
return;
|
|
3291
3291
|
}
|
|
3292
3292
|
globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
|
|
3293
|
-
},
|
|
3294
|
-
let { data: t } = q(e,
|
|
3293
|
+
}, Oa = (e) => {
|
|
3294
|
+
let { data: t } = q(e, Sa, {}), n = Dn(e, Ca), r = Sn(e, wa), i = Sn(e, Ta), a = t ?? [], o = n.pending || r.pending || i.pending, s = I((e) => ({
|
|
3295
3295
|
...e,
|
|
3296
3296
|
connected: e.status === "connected",
|
|
3297
3297
|
needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
|
|
@@ -3299,7 +3299,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3299
3299
|
connect: async (t) => {
|
|
3300
3300
|
if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
|
|
3301
3301
|
let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
|
|
3302
|
-
|
|
3302
|
+
Da((await n.run({
|
|
3303
3303
|
connectionId: e.connectionId,
|
|
3304
3304
|
redirectTo: r
|
|
3305
3305
|
})).authorizeUrl, t?.mode);
|
|
@@ -3319,7 +3319,7 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3319
3319
|
n,
|
|
3320
3320
|
r,
|
|
3321
3321
|
i
|
|
3322
|
-
]), c =
|
|
3322
|
+
]), c = I((e) => {
|
|
3323
3323
|
let t = a.find((t) => t.connectionId === e);
|
|
3324
3324
|
return t === void 0 ? void 0 : s(t);
|
|
3325
3325
|
}, [a, s]);
|
|
@@ -3329,10 +3329,10 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3329
3329
|
get: c,
|
|
3330
3330
|
pending: o
|
|
3331
3331
|
};
|
|
3332
|
-
},
|
|
3333
|
-
let n =
|
|
3334
|
-
return
|
|
3335
|
-
...
|
|
3332
|
+
}, ka = (e, t) => {
|
|
3333
|
+
let n = Oa(e), r = n.get(t);
|
|
3334
|
+
return z(() => r === void 0 ? {
|
|
3335
|
+
...Ea,
|
|
3336
3336
|
connectionId: t,
|
|
3337
3337
|
label: t,
|
|
3338
3338
|
connected: !1,
|
|
@@ -3357,6 +3357,6 @@ var mi = () => I(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes
|
|
|
3357
3357
|
n.loading,
|
|
3358
3358
|
n.pending
|
|
3359
3359
|
]);
|
|
3360
|
-
},
|
|
3360
|
+
}, Aa = "framework-client";
|
|
3361
3361
|
//#endregion
|
|
3362
|
-
export {
|
|
3362
|
+
export { ui as ADMIN_SCOPE, Aa as CLIENT_NAME, Sa as CONNECTIONS_LIST_TAG, Ta as CONNECTION_DISCONNECT_TAG, Ca as CONNECTION_START_TAG, wa as CONNECTION_SUBMIT_TOKEN_TAG, he as FORM_FLASH_SCRIPT_ID, ue as FORM_KEY_FIELD, pe as FORM_PATH_PREFIX, se as FORM_REDIRECT_FIELD, Bn as FormBindingProvider, Re as FrameworkRuntimesContext, et as FrameworkRuntimesProvider, v as INITIAL_RECOVERY_SNAPSHOT, s as LoadingSubscriptionCache, un as MutationSerialExecutionError, mi as PermissionProvider, me as RICH_TEXT_MARKS, M as RICH_TEXT_MAX_NODES, E as RecoveryCoordinator, ce as RichTextDocument, S as RpcErrorBus, $r as ServerRequestContext, ti as ServerRequestProvider, D as SubscriptionCache, ji as UNDO_APPLY_TAG, Ai as UNDO_LOG_TAG, Mi as UNDO_REDO_TAG, kn as ValidationMessagesProvider, Ze as _resetFrameworkRuntimesWarning, Ke as _resetSsrDescriptors, rr as applyPreloadSeeds, Vt as applyStoreSeeds, x as buildApiRuntime, di as canCall, fi as canCallAny, te as clearClientDiagnostics, $t as clearMutations, da as clearSent, xt as clearStoreHistory, a as clientDiagnosticsSnapshot, ga as computeWindow, ra as createAnalytics, Yn as createHooks, xi as decideAccess, oe as decodeFieldIssues, ea as defineEvent, It as defineStore, Pi as defineTracking, Ft as definedStores, Oi as deriveEntityAdmins, t as disableClientDiagnosticsPersistence, ne as documentLocale, ge as emptyRichTextDocument, ee as enableClientDiagnosticsPersistence, aa as enqueueEntry, na as eventCatalog, qi as filtersFromSchema, j as formActionPath, de as formDataToInput, ve as formField, A as formSections, cn as freshIdempotencyKey, _n as getMutationNotifier, Zt as getMutations, Qr as globalContext, ie as isRichTextDocument, ae as isSafeHref, T as isUnauthenticated, $e as isUnresolvedApi, Xn as makePreloadSeedBag, Rt as makeStoreSeedBag, vi as manifestUrl, la as markConflict, ca as markFailed, sa as markSent, Ci as openAccessReason, fe as parseRichText, ci as provenanceUrl, y as publishClientError, _ as publishClientTrace, ar as readPreloadedSeedOutcome, ir as readPreloadedSnapshot, o as recordClientDiagnostic, d as recoveryCoordinatorFor, We as registerSsrDescriptors, fa as replayable, m as reportClientError, Si as requiredScopes, or as resetPreloadSeeds, Lt as resetStoreRegistryForTests, ot as resetStoreStorageForTest, h as resolveByTag, ua as resolveConflictEntry, f as resolveRecoveryOptions, at as resolveStoreStorage, Fi as resolveTrackingEvent, P as resolveValidationMessage, ye as restrictToSchema, Rr as resumableConsumeProgram, le as richTextToPlainText, ri as rowsToOptions, fr as runSequence, k as schemaToColumns, _e as schemaToFields, tr as seedPreloadedSubscription, nr as seedPreloadedSubscriptionFailure, Bt as seedStore, dr as sequence, N as serializeRichText, gn as setMutationNotifier, Qn as setPreloadSeedResolver, zt as setStoreSeedResolver, it as setStoreStorage, X as settleMutation, st as shallow, Vi as shallowArrayEqual, Hi as sourceValues, Be as ssrClientProxy, Ge as ssrDescriptorsFor, qe as ssrStubHandle, O as stableKey, c as startApiSupervisor, Xt as startMutation, yt as storeHistory, r as subscribeClientDiagnostics, p as subscribeClientErrors, e as subscribeClientTraces, Qt as subscribeMutations, bt as subscribeStoreHistory, l as supersedesConfirmedPatches, St as travelToStoreState, wi as useAccessDecision, Dn as useAction, Wr as useAgent, Ur as useAgentChat, Lr as useAgentStream, $i as useAsyncValidation, gi as useCan, _i as useCanAny, yi as useCapabilityManifest, ka as useConnection, qn as useConnectionSetup, xa as useConnectionStatus, Oa as useConnections, Gr as useDataCopilot, oi as useDataTable, Zi as useDebounced, Ui as useDerived, ur as useEvent, Ln as useFormBinding, Vn as useFormBindingContext, Hn as useFormField, ni as useFormFlash, zi as useFormSkeleton, K as useFrameworkApi, Qe as useFrameworkRuntimes, Sn as useMutation, Yr as useOnRawRpcError, Jr as useOnRpcError, ha as useOutbox, hi as usePermissions, sr as usePreloadedSubscription, ia as usePreview, li as useProvenance, ii as useQueryField, Yi as useQueryFilters, Xi as useRecord, qr as useRefreshSubscription, Kr as useRefreshSubscriptions, Wi as useResourceCan, Gi as useResourceCans, Br as useResumableAgentStream, Rn as useSchemaFormBinding, pr as useSequence, ei as useServerRequest, q as useSubscription, Zr as useSubscriptionHealth, Bi as useTableSkeleton, Ri as useTracking, br as useTranscription, ki as useUndo, Ni as useUndoLog, yr as useUpload, An as useValidationMessages, _a as useWindowedSubscription, xr as useWorkflow, kr as useWorkflowDomainEvents, Ar as useWorkflowEventDeliveries, Or as useWorkflowEvents, wr as useWorkflowRun, Dr as useWorkflowRunEvents, Ir as useWorkflowRunState, Er as useWorkflowRunSteps, Tr as useWorkflowRuns, Sr as useWorkflowSignal, Cr as useWorkflowUpdate, ta as validateEventPayload, re as validateFields, Qi as validationStatus, b as wireAuthRefresh, ln as withIdempotencyKey, w as withProtocolOpenRecovery, Li as wrapTrackedCallbacks };
|