@voltro/client 0.90.0 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +131 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/apiRuntime.js +50 -50
- package/dist/apiSupervisor.js +25 -25
- package/dist/awaitResolvedApi.js +17 -17
- package/dist/bootstrap.js +8 -8
- package/dist/connectionPrerequisite.js +18 -18
- package/dist/connectionSetupController.js +97 -97
- package/dist/createHooks.js +11 -11
- package/dist/form.js +7 -7
- package/dist/index.js +82 -82
- package/dist/outbox.js +133 -133
- package/dist/platform.js +10 -10
- package/dist/rpcCallOnce.js +10 -10
- package/dist/runtime.js +16 -16
- package/dist/runtimeContext.js +1 -1
- package/dist/serviceClient.js +23 -23
- package/dist/store.js +3 -3
- package/dist/subscriptionCache.js +1 -1
- package/dist/uploadClient.js +35 -35
- package/dist/useAction.js +59 -59
- package/dist/useAgentChat.js +3 -3
- package/dist/useCapabilityManifest.js +7 -7
- package/dist/useConnectionStatus.js +5 -5
- package/dist/useDataTable.js +4 -4
- package/dist/useEvent.js +22 -22
- package/dist/useFormBinding.js +10 -10
- package/dist/useMutation.js +89 -89
- package/dist/useOnRpcError.js +5 -5
- package/dist/usePreloadedSubscription.js +6 -6
- package/dist/useRpcCaller.js +21 -21
- package/dist/useRpcInvocationOwner.js +6 -6
- package/dist/useTranscription.js +27 -27
- package/dist/useWorkflow.js +22 -22
- package/dist/workflowClient.js +33 -33
- package/package.json +3 -3
package/dist/store.js
CHANGED
|
@@ -43,7 +43,7 @@ var o = (e, t) => {
|
|
|
43
43
|
if (typeof i?.then == "function") throw a === 1 && c !== void 0 && (n = c), --a, a === 0 && (c = void 0, l = 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}', () => { … })\`.`);
|
|
44
44
|
if (--a, a > 0) return;
|
|
45
45
|
let s = c, d = l;
|
|
46
|
-
c = void 0, l = void 0,
|
|
46
|
+
c = void 0, l = void 0, o(s, n) || (t(s, n, d), u());
|
|
47
47
|
},
|
|
48
48
|
set: (e, r) => {
|
|
49
49
|
let i = typeof e == "function" ? e(n) : {
|
|
@@ -52,13 +52,13 @@ var o = (e, t) => {
|
|
|
52
52
|
};
|
|
53
53
|
if (o(i, n)) return;
|
|
54
54
|
let s = n;
|
|
55
|
-
n = i,
|
|
55
|
+
n = i, a > 0 || (t(s, i, r), u());
|
|
56
56
|
},
|
|
57
57
|
reset: () => {
|
|
58
58
|
let r = e();
|
|
59
59
|
if (o(r, n)) return;
|
|
60
60
|
let i = n;
|
|
61
|
-
n = r,
|
|
61
|
+
n = r, a > 0 || (t(i, r, "reset"), u());
|
|
62
62
|
},
|
|
63
63
|
subscribe: (e) => (r.add(e), () => {
|
|
64
64
|
r.delete(e);
|
|
@@ -704,7 +704,7 @@ var h = (e) => e === void 0 ? /* @__PURE__ */ Error("[voltro] the subscription f
|
|
|
704
704
|
}
|
|
705
705
|
unsubscribe(e, t) {
|
|
706
706
|
let n = this.entries.get(e);
|
|
707
|
-
n && (n.subscribers.delete(t),
|
|
707
|
+
n && (n.subscribers.delete(t), n.subscribers.size > 0 || this.scheduleEviction(n));
|
|
708
708
|
}
|
|
709
709
|
scheduleEviction(e) {
|
|
710
710
|
e.evictionTimer !== null && clearTimeout(e.evictionTimer), e.evictionTimer = setTimeout(() => {
|
package/dist/uploadClient.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
|
+
import { useRpcInvocationOwner as t } from "./useRpcInvocationOwner.js";
|
|
3
|
+
import { awaitReadyApi as n, bindResolvedRpcInvocationOwner as r } from "./awaitResolvedApi.js";
|
|
4
|
+
import { ConnectionPrerequisiteInvalidated as i } from "./connectionPrerequisite.js";
|
|
5
|
+
import { deferRpcMethod as a, runRpcPromise as o } from "./runRpc.js";
|
|
6
|
+
import { resolveByTag as s } from "./tagWalk.js";
|
|
7
|
+
import { rpcErrorKind as c } from "./rpcErrorKind.js";
|
|
8
|
+
import { createUploadProgress as l } from "./uploadProgress.js";
|
|
9
9
|
import { useRpcCaller as u } from "./useRpcCaller.js";
|
|
10
|
-
import {
|
|
10
|
+
import { waitForInvocation as d } from "./invocationWait.js";
|
|
11
11
|
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
12
12
|
// src/uploadClient.ts
|
|
13
13
|
var _ = () => new DOMException("upload aborted", "AbortError"), v = (e, t, n) => {
|
|
14
14
|
if (!Number.isSafeInteger(e) || e < t) throw RangeError(`useUpload: ${n} must be a finite integer >= ${t}.`);
|
|
15
15
|
return e;
|
|
16
16
|
}, y = (y) => {
|
|
17
|
-
let b =
|
|
17
|
+
let b = e(y), x = h(b);
|
|
18
18
|
x.current = b;
|
|
19
|
-
let { owner: S, current: C, assertCurrent: w } =
|
|
19
|
+
let { owner: S, current: C, assertCurrent: w } = t(x, y, "storage.upload"), T = u(y), E = m(() => ({
|
|
20
20
|
epoch: 0,
|
|
21
21
|
batches: /* @__PURE__ */ new Set(),
|
|
22
22
|
count: 0,
|
|
@@ -72,61 +72,61 @@ var _ = () => new DOMException("upload aborted", "AbortError"), v = (e, t, n) =>
|
|
|
72
72
|
C,
|
|
73
73
|
E,
|
|
74
74
|
S
|
|
75
|
-
]), M = f(async (
|
|
75
|
+
]), M = f(async (e, t, u) => {
|
|
76
76
|
w();
|
|
77
|
-
let f = v(
|
|
78
|
-
if (!
|
|
79
|
-
if (
|
|
77
|
+
let f = v(t.retries ?? 1, 0, "retries"), p = v(t.concurrency ?? 3, 1, "concurrency");
|
|
78
|
+
if (!e.length) return [];
|
|
79
|
+
if (e.length > 1 && t.operationId !== void 0) throw Error("useUpload: one operationId identifies one file; upload files with separate operation identities.");
|
|
80
80
|
E.batches.size || (E.count = 0, E.settledProgress = 0, E.failed = !1, E.error = void 0);
|
|
81
81
|
let m = {
|
|
82
82
|
controller: new AbortController(),
|
|
83
83
|
epoch: E.epoch,
|
|
84
|
-
count:
|
|
84
|
+
count: e.length,
|
|
85
85
|
progress: 0,
|
|
86
86
|
finished: !1
|
|
87
87
|
};
|
|
88
|
-
E.batches.add(m), E.count +=
|
|
88
|
+
E.batches.add(m), E.count += e.length, k();
|
|
89
89
|
let h, g = x.current.inspectBaseUrl, b = x.current.errorBus, D = () => m.controller.abort(), O = () => {
|
|
90
90
|
h !== S.subject && (h?.removeEventListener("abort", D), h = S.subject, h.addEventListener("abort", D, { once: !0 })), h.aborted && D();
|
|
91
91
|
}, A = () => {
|
|
92
92
|
if (w(), m.epoch !== E.epoch || m.controller.signal.aborted) throw _();
|
|
93
|
-
}, j = () => C() && m.epoch === E.epoch && E.batches.has(m), M = (e) =>
|
|
93
|
+
}, j = () => C() && m.epoch === E.epoch && E.batches.has(m), M = (e) => d(e, m.controller.signal, A), N = {
|
|
94
94
|
signal: m.controller.signal,
|
|
95
95
|
assertCurrent: A,
|
|
96
96
|
cleanup: (e, t) => T.call(e, t),
|
|
97
97
|
url: (e) => /^https?:\/\//.test(e) ? e : `${g}${e}`,
|
|
98
98
|
rpc: async (e, t) => {
|
|
99
99
|
A();
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
let c =
|
|
100
|
+
let i = await n(x, y, e, m.controller.signal);
|
|
101
|
+
r(S, i), O(), A(), g = i.inspectBaseUrl, b = i.errorBus;
|
|
102
|
+
let c = a(() => (A(), s(i.client, e)(t))), l = await M(o(i.runtime, c));
|
|
103
103
|
return A(), l;
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
O();
|
|
107
|
-
let P =
|
|
107
|
+
let P = l(e.length), F = Array(e.length), I = 0, L = async () => {
|
|
108
108
|
for (;;) {
|
|
109
109
|
A();
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
F[
|
|
113
|
-
...
|
|
110
|
+
let n = I++;
|
|
111
|
+
if (n >= e.length) return;
|
|
112
|
+
F[n] = await u(e[n], {
|
|
113
|
+
...t,
|
|
114
114
|
retries: f
|
|
115
|
-
}, N, (
|
|
116
|
-
!j() || m.finished || m.controller.signal.aborted || (m.progress = P(
|
|
117
|
-
}), A(), m.progress = P(
|
|
115
|
+
}, N, (e) => {
|
|
116
|
+
!j() || m.finished || m.controller.signal.aborted || (m.progress = P(n, Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0), k());
|
|
117
|
+
}), A(), m.progress = P(n, 1), k();
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
try {
|
|
121
|
-
return A(), await M(Promise.all(Array.from({ length: Math.min(p,
|
|
122
|
-
} catch (
|
|
123
|
-
let n = C() ? m.epoch !== E.epoch || m.controller.signal.aborted ? _() :
|
|
121
|
+
return A(), await M(Promise.all(Array.from({ length: Math.min(p, e.length) }, () => L()))), A(), m.progress = 1, m.finished = !0, E.settledProgress += m.count, E.batches.delete(m), k(), F;
|
|
122
|
+
} catch (e) {
|
|
123
|
+
let n = C() ? m.epoch !== E.epoch || m.controller.signal.aborted ? _() : e : new i("inactive"), r = j();
|
|
124
124
|
throw m.controller.abort(), m.finished = !0, E.batches.delete(m), r && (E.settledProgress += m.progress * m.count, E.failed = !0, E.error = n, k(), n instanceof DOMException && n.name === "AbortError" || b.emit({
|
|
125
125
|
source: "action",
|
|
126
|
-
tag:
|
|
126
|
+
tag: t.mintTag ?? "storage.mintUploadTicket",
|
|
127
127
|
error: n,
|
|
128
|
-
kind:
|
|
129
|
-
outcome:
|
|
128
|
+
kind: c(n, "unknown"),
|
|
129
|
+
outcome: c(n, "unknown") === "transport" ? "unknown" : "not-applicable"
|
|
130
130
|
})), n;
|
|
131
131
|
} finally {
|
|
132
132
|
h?.removeEventListener("abort", D);
|
package/dist/useAction.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
|
+
import { awaitReadyApi as t, bindResolvedRpcInvocationOwner as n } from "./awaitResolvedApi.js";
|
|
3
|
+
import { useRpcInvocationOwner as r } from "./useRpcInvocationOwner.js";
|
|
4
|
+
import { deferRpcMethod as i, runRpcPromise as a } from "./runRpc.js";
|
|
5
|
+
import { resolveByTag as o } from "./tagWalk.js";
|
|
6
|
+
import { omitMutationInputs as s, omitMutationOutputs as c, startMutation as l } from "./mutationsBus.js";
|
|
7
|
+
import { getMutationNotifier as u } from "./useMutation.js";
|
|
8
|
+
import { publishClientTrace as d, publishClientTraceRefusal as f } from "./traceBus.js";
|
|
9
|
+
import { rpcErrorKind as p } from "./rpcErrorKind.js";
|
|
10
|
+
import { reportUnknownRpcTag as m } from "./unknownRpcTag.js";
|
|
11
11
|
import { freshIdempotencyKey as h, withIdempotencyKey as g } from "./mutationIdentity.js";
|
|
12
|
-
import {
|
|
12
|
+
import { ConnectionPrerequisiteInvalidated as _ } from "./connectionPrerequisite.js";
|
|
13
13
|
import { waitForInvocation as v } from "./invocationWait.js";
|
|
14
14
|
import { useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
15
15
|
import { Effect as w } from "effect";
|
|
@@ -25,11 +25,11 @@ var T = (e, t) => {
|
|
|
25
25
|
} catch {}
|
|
26
26
|
return e;
|
|
27
27
|
}, E = (e, t, n) => typeof e == "function" ? e(t, n) : e, D = 0, O = () => `act_${++D}`, k = (D, k) => {
|
|
28
|
-
let A =
|
|
28
|
+
let A = e(D), { descriptors: j } = A, M = j[k]?.outputRetention === "none", N = j[k]?.clientHistory?.input === "omit", P = S(A);
|
|
29
29
|
P.current = A;
|
|
30
|
-
let { owner: F, current: I, assertCurrent: L } =
|
|
30
|
+
let { owner: F, current: I, assertCurrent: L } = r(P, D, k);
|
|
31
31
|
if (process.env.NODE_ENV !== "production") {
|
|
32
|
-
|
|
32
|
+
m("useAction", D, k, j);
|
|
33
33
|
let e = j[k]?.kind;
|
|
34
34
|
e !== void 0 && e !== "action" && console.error(`[@voltro/client] useAction('${D}', '${k}') targets a ${e}, not an action. Use ${e === "mutation" ? "useMutation" : e === "workflow" ? "useWorkflow" : `the ${e} hook`} instead.`);
|
|
35
35
|
}
|
|
@@ -43,104 +43,104 @@ var T = (e, t) => {
|
|
|
43
43
|
M && (z((e) => e.lastResult === void 0 ? e : {
|
|
44
44
|
...e,
|
|
45
45
|
lastResult: void 0
|
|
46
|
-
}),
|
|
46
|
+
}), c(D, k));
|
|
47
47
|
}, [
|
|
48
48
|
M,
|
|
49
49
|
D,
|
|
50
50
|
k
|
|
51
51
|
]), b(() => {
|
|
52
|
-
N &&
|
|
52
|
+
N && s(D, k);
|
|
53
53
|
}, [
|
|
54
54
|
N,
|
|
55
55
|
D,
|
|
56
56
|
k
|
|
57
57
|
]);
|
|
58
|
-
let B = y(async (
|
|
59
|
-
let
|
|
60
|
-
if (L(),
|
|
58
|
+
let B = y(async (e, r) => {
|
|
59
|
+
let s = r?.signal, c = () => {
|
|
60
|
+
if (L(), s?.aborted) throw new DOMException("action aborted", "AbortError");
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
let
|
|
62
|
+
c();
|
|
63
|
+
let m = F.subject, y = r?.onError !== void 0 || r?.notify?.error !== void 0;
|
|
64
64
|
z((e) => ({
|
|
65
65
|
owner: F,
|
|
66
66
|
pending: e.owner === F ? e.pending + 1 : 1,
|
|
67
67
|
error: void 0,
|
|
68
68
|
lastResult: e.owner === F ? e.lastResult : void 0
|
|
69
69
|
}));
|
|
70
|
-
let b = O(), x =
|
|
71
|
-
let
|
|
72
|
-
return S =
|
|
70
|
+
let b = O(), x = r?.idempotencyKey ?? h(), S = !1, C = () => {
|
|
71
|
+
let t = P.current.descriptors[k], n = !t || t.clientHistory?.input === "omit";
|
|
72
|
+
return S = t?.outputRetention === "none", l({
|
|
73
73
|
id: b,
|
|
74
74
|
apiName: D,
|
|
75
75
|
tag: k,
|
|
76
|
-
input:
|
|
76
|
+
input: n ? void 0 : e,
|
|
77
77
|
kind: "action",
|
|
78
|
-
...
|
|
78
|
+
...n ? { inputOmitted: !0 } : {},
|
|
79
79
|
...S ? { outputOmitted: !0 } : {}
|
|
80
80
|
}, F.subject);
|
|
81
81
|
}, A = F.resolved ? C() : void 0, j, M = !1;
|
|
82
82
|
try {
|
|
83
|
-
let
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
let { runtime:
|
|
87
|
-
j =
|
|
88
|
-
traceId:
|
|
89
|
-
spanId:
|
|
83
|
+
let l = await t(P, D, k, s);
|
|
84
|
+
if (m.aborted) throw new _("inactive");
|
|
85
|
+
n(F, l), c(), A ??= C(), c();
|
|
86
|
+
let { runtime: f, client: p } = l, h = o(p, k), y = w.currentSpan.pipe(w.tap((e) => w.sync(() => {
|
|
87
|
+
j = e.traceId, d({
|
|
88
|
+
traceId: e.traceId,
|
|
89
|
+
spanId: e.spanId,
|
|
90
90
|
source: "action",
|
|
91
91
|
tag: k
|
|
92
92
|
});
|
|
93
|
-
})), w.catch(() => w.void), w.andThen(
|
|
94
|
-
|
|
95
|
-
let
|
|
96
|
-
return M = !0, g(
|
|
93
|
+
})), w.catch(() => w.void), w.andThen(i(() => {
|
|
94
|
+
c();
|
|
95
|
+
let t = h(e);
|
|
96
|
+
return M = !0, g(t, x);
|
|
97
97
|
}))).pipe(w.withSpan(`client.action.${k}`, { attributes: {
|
|
98
98
|
"voltro.api": D,
|
|
99
99
|
"voltro.actionId": b,
|
|
100
100
|
"rpc.tag": k
|
|
101
|
-
} })), T = await v(
|
|
102
|
-
|
|
101
|
+
} })), T = await v(a(f, y), s, c);
|
|
102
|
+
c();
|
|
103
103
|
let O = S || P.current.descriptors[k]?.outputRetention === "none";
|
|
104
104
|
z((e) => e.owner === F ? {
|
|
105
105
|
...e,
|
|
106
106
|
error: void 0,
|
|
107
107
|
lastResult: O ? void 0 : T
|
|
108
|
-
} : e),
|
|
108
|
+
} : e), c(), A?.settle({
|
|
109
109
|
status: "success",
|
|
110
110
|
output: O ? void 0 : T,
|
|
111
111
|
...O ? { outputOmitted: !0 } : {}
|
|
112
|
-
}),
|
|
112
|
+
}), c(), P.current.errorBus.emitSuccess({
|
|
113
113
|
source: "action",
|
|
114
114
|
tag: k
|
|
115
|
-
}),
|
|
116
|
-
let N = E(
|
|
117
|
-
return
|
|
118
|
-
} catch (
|
|
119
|
-
let
|
|
115
|
+
}), c(), r?.onSuccess?.(T, e), c();
|
|
116
|
+
let N = E(r?.notify?.success, T, e);
|
|
117
|
+
return c(), N !== void 0 && u()?.success(N), c(), T;
|
|
118
|
+
} catch (t) {
|
|
119
|
+
let n = I() && !s?.aborted, i = T(I() ? s?.aborted ? new DOMException("action aborted", "AbortError") : t : new _("inactive"), j);
|
|
120
120
|
if (A?.settle({
|
|
121
121
|
status: "error",
|
|
122
|
-
error:
|
|
123
|
-
}), !
|
|
124
|
-
if (
|
|
122
|
+
error: i
|
|
123
|
+
}), !n) throw i;
|
|
124
|
+
if (c(), z((e) => e.owner === F ? {
|
|
125
125
|
...e,
|
|
126
|
-
error:
|
|
127
|
-
} : e),
|
|
126
|
+
error: i
|
|
127
|
+
} : e), c(), M && j !== void 0 && p(t, "handler") === "handler" && f({
|
|
128
128
|
traceId: j,
|
|
129
129
|
tag: k
|
|
130
130
|
}), P.current.errorBus.emit({
|
|
131
131
|
source: "action",
|
|
132
132
|
tag: k,
|
|
133
|
-
error:
|
|
134
|
-
kind: M ?
|
|
135
|
-
outcome: M &&
|
|
133
|
+
error: i,
|
|
134
|
+
kind: M ? p(t, "handler") : "client",
|
|
135
|
+
outcome: M && p(t, "handler") === "transport" ? "unknown" : M ? "known" : "not-started",
|
|
136
136
|
...j === void 0 ? {} : { traceId: j }
|
|
137
|
-
}),
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
|
|
137
|
+
}), c(), y) {
|
|
138
|
+
r?.onError?.(i, e), c();
|
|
139
|
+
let t = E(r?.notify?.error, i, e);
|
|
140
|
+
c(), t !== void 0 && u()?.error(t), c();
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
throw
|
|
143
|
+
throw i;
|
|
144
144
|
} finally {
|
|
145
145
|
I() && z((e) => e.owner === F ? {
|
|
146
146
|
...e,
|
package/dist/useAgentChat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useAction as e } from "./useAction.js";
|
|
2
|
+
import { useSubscription as t } from "./useSubscription.js";
|
|
3
3
|
import { useCallback as n, useMemo as r } from "react";
|
|
4
4
|
// src/useAgentChat.ts
|
|
5
5
|
var i = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), a = (e) => {
|
|
@@ -8,7 +8,7 @@ var i = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0),
|
|
|
8
8
|
if (n.role === "user" && n.content) return n.content;
|
|
9
9
|
}
|
|
10
10
|
}, o = (o, s, c) => {
|
|
11
|
-
let { threadId: l } = c, u = `${s}.messages`, d =
|
|
11
|
+
let { threadId: l } = c, u = `${s}.messages`, d = t(o, u, { threadId: l }), f = e(o, `${s}.send`), p = r(() => [...d.data ?? []].sort(i), [d.data]), m = n((e, t = {}) => f.run({
|
|
12
12
|
threadId: l,
|
|
13
13
|
order: d.data?.length ?? 0,
|
|
14
14
|
prompt: e,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ADMIN_SCOPE as t, usePermissions as n } from "./permissions.js";
|
|
3
|
+
import { scopeMembership as r } from "./scopeMembership.js";
|
|
4
4
|
import { useEffect as i, useState as a } from "react";
|
|
5
5
|
// src/useCapabilityManifest.ts
|
|
6
6
|
var o = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, s = (t) => {
|
|
@@ -54,17 +54,17 @@ var o = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, s = (t) => {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return !0;
|
|
57
|
-
}, l = (e, t, n) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => n?.has(t) ?? e.includes(t)) : t.scope.every((t) => n?.has(t) ?? e.includes(t))), u = (e,
|
|
57
|
+
}, l = (e, t, n) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => n?.has(t) ?? e.includes(t)) : t.scope.every((t) => n?.has(t) ?? e.includes(t))), u = (e, n) => {
|
|
58
58
|
if (e === void 0) return "unknown";
|
|
59
|
-
let i =
|
|
59
|
+
let i = n.includes(t);
|
|
60
60
|
if (e.length === 0) return "allowed";
|
|
61
|
-
let a = e.length >= 32 &&
|
|
61
|
+
let a = e.length >= 32 && n.length >= 32 && !Object.hasOwn(n, "includes") && !Object.hasOwn(n, Symbol.iterator) && c(e) ? r(n) : void 0, o = !1;
|
|
62
62
|
for (let t of e) if (t.kind !== "open") {
|
|
63
63
|
if (t.kind === "upgraded") o = !0;
|
|
64
64
|
else if (t.kind === "policy") {
|
|
65
65
|
if (i) continue;
|
|
66
66
|
o = !0;
|
|
67
|
-
} else if (!(i || l(
|
|
67
|
+
} else if (!(i || l(n, t, a))) {
|
|
68
68
|
if (t.resourceScoped) o = !0;
|
|
69
69
|
else return "denied";
|
|
70
70
|
}
|
|
@@ -72,7 +72,7 @@ var o = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, s = (t) => {
|
|
|
72
72
|
return o ? "unknown" : "allowed";
|
|
73
73
|
}, d = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), f = (e) => {
|
|
74
74
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
75
|
-
}, p = (e) => u(e,
|
|
75
|
+
}, p = (e) => u(e, n().scopes), m = (e) => e === void 0 ? {} : {
|
|
76
76
|
tag: e.tag,
|
|
77
77
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
78
78
|
}, h = (e) => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
|
+
import { recordClientDiagnostic as t } from "./clientDiagnostics.js";
|
|
3
|
+
import { INITIAL_RECOVERY_SNAPSHOT as n, recoveryCoordinatorFor as r } from "./recoveryCoordinator.js";
|
|
4
4
|
import { useCallback as i, useEffect as a, useSyncExternalStore as o } from "react";
|
|
5
5
|
// src/useConnectionStatus.ts
|
|
6
6
|
var s = () => typeof navigator > "u" || navigator.onLine, c = () => !0, l = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
|
|
7
7
|
window.removeEventListener("online", e), window.removeEventListener("offline", e);
|
|
8
8
|
}), u = (u) => {
|
|
9
|
-
let d =
|
|
9
|
+
let d = e(u), f = d.recovery ?? r(d.errorBus, u), p = o(f.subscribe, f.getSnapshot, f.getServerSnapshot ?? (() => n)), m = o(l, s, c), h = i(() => f.reportExternalSuccess(), [f]), g = m ? p.status : "offline";
|
|
10
10
|
return a(() => {
|
|
11
|
-
|
|
11
|
+
t(u, "connection.status", {
|
|
12
12
|
status: g,
|
|
13
13
|
rawTransport: p.rawTransport,
|
|
14
14
|
online: m,
|
package/dist/useDataTable.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
2
|
import { useSubscription as t } from "./useSubscription.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createLiveRowSorter as n } from "./liveRowSort.js";
|
|
4
|
+
import { schemaToColumns as r } from "./schemaFields.js";
|
|
5
5
|
import { useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
6
|
// src/useDataTable.ts
|
|
7
7
|
var c = (c, l, u = {}) => {
|
|
@@ -10,7 +10,7 @@ var c = (c, l, u = {}) => {
|
|
|
10
10
|
limit: f
|
|
11
11
|
}, [u.input, f]), h = t(c, l, m), g = d.descriptors[l]?.output, _ = i(() => {
|
|
12
12
|
u.pageSize !== void 0 && p((e) => (e ?? u.pageSize) + u.pageSize);
|
|
13
|
-
}, [u.pageSize]), v = a(() => u.columns ?? (g === void 0 ? [] :
|
|
13
|
+
}, [u.pageSize]), v = a(() => u.columns ?? (g === void 0 ? [] : r(g)), [u.columns, g]), [y, b] = s(u.initialSort), x = i((e) => {
|
|
14
14
|
b((t) => t?.column === e ? {
|
|
15
15
|
column: e,
|
|
16
16
|
direction: t.direction === "asc" ? "desc" : "asc"
|
|
@@ -19,7 +19,7 @@ var c = (c, l, u = {}) => {
|
|
|
19
19
|
direction: "asc"
|
|
20
20
|
});
|
|
21
21
|
}, []), S = o(void 0);
|
|
22
|
-
return S.current === void 0 && (S.current =
|
|
22
|
+
return S.current === void 0 && (S.current = n()), {
|
|
23
23
|
columns: v,
|
|
24
24
|
rows: a(() => S.current(h.data ?? [], y), [h.data, y]),
|
|
25
25
|
loading: h.data === void 0,
|
package/dist/useEvent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
2
|
import { isUnresolvedApi as t } from "./frameworkRuntimesContext.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { resolveByTag as n } from "./tagWalk.js";
|
|
4
|
+
import { recordClientDiagnostic as r } from "./clientDiagnostics.js";
|
|
5
5
|
import { useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
6
6
|
import { Effect as l, Fiber as u, Schedule as d, Stream as f } from "effect";
|
|
7
7
|
// src/useEvent.ts
|
|
@@ -13,7 +13,7 @@ var p = {
|
|
|
13
13
|
_tag = "EventStreamClosed";
|
|
14
14
|
};
|
|
15
15
|
function h(h, g, _, v = {}) {
|
|
16
|
-
let { skip: y = !1, apiName: b = "app", onMissed: x } = v, S =
|
|
16
|
+
let { skip: y = !1, apiName: b = "app", onMissed: x } = v, S = e(b), C = g === null ? null : JSON.stringify(Object.entries(g).sort(([e], [t]) => e < t ? -1 : 1)), w = !y && C !== null && !t(S), T = o(() => ({
|
|
17
17
|
resume: /* @__PURE__ */ new Map(),
|
|
18
18
|
runtime: S.runtime,
|
|
19
19
|
client: S.client,
|
|
@@ -36,26 +36,26 @@ function h(h, g, _, v = {}) {
|
|
|
36
36
|
E.current = null;
|
|
37
37
|
})), i(() => {
|
|
38
38
|
if (!w || T.subject?.aborted) return;
|
|
39
|
-
let
|
|
40
|
-
|
|
39
|
+
let e = !1, t = () => !e && !T.subject?.aborted && E.current?.scope === T, i = (e) => {
|
|
40
|
+
t() && O((t) => ({
|
|
41
41
|
scope: T,
|
|
42
42
|
value: e(t?.scope === T ? t.value : p)
|
|
43
43
|
}));
|
|
44
|
-
}, a = (
|
|
45
|
-
!
|
|
44
|
+
}, a = (e, n) => {
|
|
45
|
+
!t() || e <= 0 || (r(T.apiName, "event.gap", {
|
|
46
46
|
tag: T.tag,
|
|
47
|
-
missed:
|
|
48
|
-
reason:
|
|
49
|
-
}), i((
|
|
50
|
-
...
|
|
51
|
-
missed:
|
|
47
|
+
missed: e,
|
|
48
|
+
reason: n
|
|
49
|
+
}), i((t) => ({
|
|
50
|
+
...t,
|
|
51
|
+
missed: t.missed + e,
|
|
52
52
|
lastMiss: {
|
|
53
|
-
count:
|
|
54
|
-
reason:
|
|
53
|
+
count: e,
|
|
54
|
+
reason: n
|
|
55
55
|
}
|
|
56
56
|
})), E.current?.onMissed?.({
|
|
57
|
-
count:
|
|
58
|
-
reason:
|
|
57
|
+
count: e,
|
|
58
|
+
reason: n
|
|
59
59
|
}));
|
|
60
60
|
};
|
|
61
61
|
i((e) => ({
|
|
@@ -63,12 +63,12 @@ function h(h, g, _, v = {}) {
|
|
|
63
63
|
status: "connecting"
|
|
64
64
|
}));
|
|
65
65
|
let o = l.suspend(() => {
|
|
66
|
-
if (!
|
|
66
|
+
if (!t()) return l.interrupt;
|
|
67
67
|
let e = [...T.resume].map(([e, t]) => ({
|
|
68
68
|
origin: e,
|
|
69
69
|
n: t
|
|
70
|
-
})),
|
|
71
|
-
return l.succeed(
|
|
70
|
+
})), r = n(T.client, T.tag);
|
|
71
|
+
return l.succeed(r({
|
|
72
72
|
key: T.key,
|
|
73
73
|
...e.length > 0 ? { resume: e } : {}
|
|
74
74
|
}));
|
|
@@ -76,12 +76,12 @@ function h(h, g, _, v = {}) {
|
|
|
76
76
|
...e,
|
|
77
77
|
status: "connecting"
|
|
78
78
|
}))))))), c = T.runtime.runFork(f.runForEach(s, (e) => l.sync(() => {
|
|
79
|
-
|
|
79
|
+
t() && (e._tag === "attached" ? i((e) => ({
|
|
80
80
|
...e,
|
|
81
81
|
status: "live"
|
|
82
82
|
})) : e._tag === "gap" ? a(e.missed, e.reason) : (T.resume.set(e.origin, Math.max(T.resume.get(e.origin) ?? 0, e.n)), E.current?.handler(e.payload)));
|
|
83
83
|
}))), h = () => {
|
|
84
|
-
|
|
84
|
+
e || (e = !0, T.resume.clear(), O((e) => e?.scope === T ? {
|
|
85
85
|
scope: T,
|
|
86
86
|
value: p
|
|
87
87
|
} : e), T.runtime.runFork(l.forkDetach(u.interrupt(c))));
|
package/dist/useFormBinding.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
|
+
import { useMutation as t } from "./useMutation.js";
|
|
3
|
+
import { globalContext as n } from "./globalContext.js";
|
|
4
4
|
import { schemaToFields as r } from "./schemaFields.js";
|
|
5
5
|
import { resolveValidationMessage as i, restrictToSchema as a, validateFields as o } from "./formBinding.js";
|
|
6
6
|
import { useValidationMessages as s } from "./validationMessages.js";
|
|
@@ -12,7 +12,7 @@ import { fieldIssuesOf as re } from "@voltro/protocol";
|
|
|
12
12
|
import { FormApi as ie } from "@tanstack/form-core";
|
|
13
13
|
import { useStore as ae } from "@tanstack/react-store";
|
|
14
14
|
// src/useFormBinding.ts
|
|
15
|
-
var v = Symbol.for("voltro.client.formEngine"), y =
|
|
15
|
+
var v = Symbol.for("voltro.client.formEngine"), y = n("formFields", void 0), b = (e, t) => Object.is(e.value, t.value) && e.error === t.error && e.serverError === t.serverError && e.touched === t.touched && e.blurred === t.blurred && e.dirty === t.dirty && e.required === t.required && e.label === t.label && e.widget === t.widget && e.options === t.options && e.description === t.description && e.asyncStatus === t.asyncStatus && e.a11y.id === t.a11y.id && e.a11y["aria-invalid"] === t.a11y["aria-invalid"] && e.a11y["aria-required"] === t.a11y["aria-required"] && e.a11y["aria-describedby"] === t.a11y["aria-describedby"], oe = (e, t) => {
|
|
16
16
|
let n = t, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a, o = (e) => {
|
|
17
17
|
let t = n(e), i = r.get(e);
|
|
18
18
|
return i !== void 0 && b(i, t) ? i : (r.set(e, t), t);
|
|
@@ -39,7 +39,7 @@ var v = Symbol.for("voltro.client.formEngine"), y = e("formFields", void 0), b =
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
}, x =
|
|
42
|
+
}, x = n("formBinding", void 0), se = (e, t) => {
|
|
43
43
|
let n = e;
|
|
44
44
|
for (let e of t.split(".")) {
|
|
45
45
|
if (typeof n != "object" || !n) return;
|
|
@@ -83,9 +83,9 @@ var v = Symbol.for("voltro.client.formEngine"), y = e("formFields", void 0), b =
|
|
|
83
83
|
let i = /^(.+?)\.\d+\.(.+)$/.exec(e);
|
|
84
84
|
return i === null ? void 0 : n.get(i[1])?.get(i[2]);
|
|
85
85
|
};
|
|
86
|
-
}, S = (
|
|
87
|
-
let a =
|
|
88
|
-
return process.env.NODE_ENV !== "production" && u === void 0 && console.error(`[@voltro/client] useFormBinding('${
|
|
86
|
+
}, S = (n, r, i) => {
|
|
87
|
+
let a = e(n), o = h(void 0), s = typeof r == "function" ? r(o.current?.state?.values ?? i.defaults ?? {}) : r, c = h(s).current, l = t(n, s), u = i.schema ?? a.descriptors[s]?.input;
|
|
88
|
+
return process.env.NODE_ENV !== "production" && u === void 0 && console.error(`[@voltro/client] useFormBinding('${n}', '${r}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`), w(n, c, i, u, o, l);
|
|
89
89
|
}, C = (e) => {
|
|
90
90
|
let t = h(void 0);
|
|
91
91
|
return w("local", p(), {
|
|
@@ -236,7 +236,7 @@ var v = Symbol.for("voltro.client.formEngine"), y = e("formFields", void 0), b =
|
|
|
236
236
|
return {
|
|
237
237
|
value: R.getFieldValue(e),
|
|
238
238
|
setValue: (t) => {
|
|
239
|
-
q(e),
|
|
239
|
+
q(e), Object.is(R.getFieldValue(e), t) || R.setFieldValue(e, t);
|
|
240
240
|
},
|
|
241
241
|
onBlur: () => {
|
|
242
242
|
R.setFieldMeta(e, (e) => ({
|
|
@@ -296,7 +296,7 @@ var v = Symbol.for("voltro.client.formEngine"), y = e("formFields", void 0), b =
|
|
|
296
296
|
},
|
|
297
297
|
field: (t, n) => J(`${e}.${t}.${n}`)
|
|
298
298
|
}), [R, J]), Ce = d((e) => _.filter((t) => t.section === e), [_]), we = d((e, t) => {
|
|
299
|
-
q(e),
|
|
299
|
+
q(e), Object.is(R.getFieldValue(e), t) || R.setFieldValue(e, t);
|
|
300
300
|
}, [q, R]), Te = d((e) => {
|
|
301
301
|
for (let [t, n] of Object.entries(e)) R.setFieldValue(t, n);
|
|
302
302
|
}, [R]), Ee = d((e) => {
|