@voltro/client 0.90.0 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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, !o(s, n) && (t(s, n, d), u());
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, !(a > 0) && (t(s, i, r), u());
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, !(a > 0) && (t(i, r, "reset"), u());
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), !(n.subscribers.size > 0) && this.scheduleEviction(n));
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(() => {
@@ -1,22 +1,22 @@
1
- import { rpcErrorKind as e } from "./rpcErrorKind.js";
2
- import { useFrameworkApi as t } from "./runtimeContext.js";
3
- import { resolveByTag as n } from "./tagWalk.js";
4
- import { deferRpcMethod as r, runRpcPromise as i } from "./runRpc.js";
5
- import { ConnectionPrerequisiteInvalidated as a } from "./connectionPrerequisite.js";
6
- import { awaitReadyApi as o, bindResolvedRpcInvocationOwner as s } from "./awaitResolvedApi.js";
7
- import { useRpcInvocationOwner as c } from "./useRpcInvocationOwner.js";
8
- import { waitForInvocation as l } from "./invocationWait.js";
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 { createUploadProgress as d } from "./uploadProgress.js";
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 = t(y), x = h(b);
17
+ let b = e(y), x = h(b);
18
18
  x.current = b;
19
- let { owner: S, current: C, assertCurrent: w } = c(x, y, "storage.upload"), T = u(y), E = m(() => ({
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 (t, c, u) => {
75
+ ]), M = f(async (e, t, u) => {
76
76
  w();
77
- let f = v(c.retries ?? 1, 0, "retries"), p = v(c.concurrency ?? 3, 1, "concurrency");
78
- if (!t.length) return [];
79
- if (t.length > 1 && c.operationId !== void 0) throw Error("useUpload: one operationId identifies one file; upload files with separate operation identities.");
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: t.length,
84
+ count: e.length,
85
85
  progress: 0,
86
86
  finished: !1
87
87
  };
88
- E.batches.add(m), E.count += t.length, k();
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) => l(e, m.controller.signal, A), N = {
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 a = await o(x, y, e, m.controller.signal);
101
- s(S, a), O(), A(), g = a.inspectBaseUrl, b = a.errorBus;
102
- let c = r(() => (A(), n(a.client, e)(t))), l = await M(i(a.runtime, 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 = d(t.length), F = Array(t.length), I = 0, L = async () => {
107
+ let P = l(e.length), F = Array(e.length), I = 0, L = async () => {
108
108
  for (;;) {
109
109
  A();
110
- let e = I++;
111
- if (e >= t.length) return;
112
- F[e] = await u(t[e], {
113
- ...c,
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, (t) => {
116
- !j() || m.finished || m.controller.signal.aborted || (m.progress = P(e, Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 0), k());
117
- }), A(), m.progress = P(e, 1), k();
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, t.length) }, () => L()))), A(), m.progress = 1, m.finished = !0, E.settledProgress += m.count, E.batches.delete(m), k(), F;
122
- } catch (t) {
123
- let n = C() ? m.epoch !== E.epoch || m.controller.signal.aborted ? _() : t : new a("inactive"), r = j();
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: c.mintTag ?? "storage.mintUploadTicket",
126
+ tag: t.mintTag ?? "storage.mintUploadTicket",
127
127
  error: n,
128
- kind: e(n, "unknown"),
129
- outcome: e(n, "unknown") === "transport" ? "unknown" : "not-applicable"
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 { publishClientTrace as e, publishClientTraceRefusal as t } from "./traceBus.js";
2
- import { rpcErrorKind as n } from "./rpcErrorKind.js";
3
- import { useFrameworkApi as r } from "./runtimeContext.js";
4
- import { resolveByTag as i } from "./tagWalk.js";
5
- import { reportUnknownRpcTag as a } from "./unknownRpcTag.js";
6
- import { deferRpcMethod as o, runRpcPromise as s } from "./runRpc.js";
7
- import { ConnectionPrerequisiteInvalidated as c } from "./connectionPrerequisite.js";
8
- import { awaitReadyApi as l, bindResolvedRpcInvocationOwner as u } from "./awaitResolvedApi.js";
9
- import { useRpcInvocationOwner as d } from "./useRpcInvocationOwner.js";
10
- import { omitMutationInputs as f, omitMutationOutputs as p, startMutation as m } from "./mutationsBus.js";
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 { getMutationNotifier as _ } from "./useMutation.js";
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 = r(D), { descriptors: j } = A, M = j[k]?.outputRetention === "none", N = j[k]?.clientHistory?.input === "omit", P = S(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 } = d(P, D, k);
30
+ let { owner: F, current: I, assertCurrent: L } = r(P, D, k);
31
31
  if (process.env.NODE_ENV !== "production") {
32
- a("useAction", D, k, j);
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
- }), p(D, k));
46
+ }), c(D, k));
47
47
  }, [
48
48
  M,
49
49
  D,
50
50
  k
51
51
  ]), b(() => {
52
- N && f(D, k);
52
+ N && s(D, k);
53
53
  }, [
54
54
  N,
55
55
  D,
56
56
  k
57
57
  ]);
58
- let B = y(async (r, a) => {
59
- let d = a?.signal, f = () => {
60
- if (L(), d?.aborted) throw new DOMException("action aborted", "AbortError");
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
- f();
63
- let p = F.subject, y = a?.onError !== void 0 || a?.notify?.error !== void 0;
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 = a?.idempotencyKey ?? h(), S = !1, C = () => {
71
- let e = P.current.descriptors[k], t = !e || e.clientHistory?.input === "omit";
72
- return S = e?.outputRetention === "none", m({
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: t ? void 0 : r,
76
+ input: n ? void 0 : e,
77
77
  kind: "action",
78
- ...t ? { inputOmitted: !0 } : {},
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 t = await l(P, D, k, d);
84
- if (p.aborted) throw new c("inactive");
85
- u(F, t), f(), A ??= C(), f();
86
- let { runtime: n, client: m } = t, h = i(m, k), y = w.currentSpan.pipe(w.tap((t) => w.sync(() => {
87
- j = t.traceId, e({
88
- traceId: t.traceId,
89
- spanId: t.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(o(() => {
94
- f();
95
- let e = h(r);
96
- return M = !0, g(e, x);
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(s(n, y), d, f);
102
- f();
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), f(), A?.settle({
108
+ } : e), c(), A?.settle({
109
109
  status: "success",
110
110
  output: O ? void 0 : T,
111
111
  ...O ? { outputOmitted: !0 } : {}
112
- }), f(), P.current.errorBus.emitSuccess({
112
+ }), c(), P.current.errorBus.emitSuccess({
113
113
  source: "action",
114
114
  tag: k
115
- }), f(), a?.onSuccess?.(T, r), f();
116
- let N = E(a?.notify?.success, T, r);
117
- return f(), N !== void 0 && _()?.success(N), f(), T;
118
- } catch (e) {
119
- let i = I() && !d?.aborted, o = T(I() ? d?.aborted ? new DOMException("action aborted", "AbortError") : e : new c("inactive"), j);
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: o
123
- }), !i) throw o;
124
- if (f(), z((e) => e.owner === F ? {
122
+ error: i
123
+ }), !n) throw i;
124
+ if (c(), z((e) => e.owner === F ? {
125
125
  ...e,
126
- error: o
127
- } : e), f(), M && j !== void 0 && n(e, "handler") === "handler" && t({
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: o,
134
- kind: M ? n(e, "handler") : "client",
135
- outcome: M && n(e, "handler") === "transport" ? "unknown" : M ? "known" : "not-started",
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
- }), f(), y) {
138
- a?.onError?.(o, r), f();
139
- let e = E(a?.notify?.error, o, r);
140
- f(), e !== void 0 && _()?.error(e), f();
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 o;
143
+ throw i;
144
144
  } finally {
145
145
  I() && z((e) => e.owner === F ? {
146
146
  ...e,
@@ -1,5 +1,5 @@
1
- import { useSubscription as e } from "./useSubscription.js";
2
- import { useAction as t } from "./useAction.js";
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 = e(o, u, { threadId: l }), f = t(o, `${s}.send`), p = r(() => [...d.data ?? []].sort(i), [d.data]), m = n((e, t = {}) => f.run({
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 { scopeMembership as t } from "./scopeMembership.js";
3
- import { ADMIN_SCOPE as n, usePermissions as r } from "./permissions.js";
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, r) => {
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 = r.includes(n);
59
+ let i = n.includes(t);
60
60
  if (e.length === 0) return "allowed";
61
- let a = e.length >= 32 && r.length >= 32 && !Object.hasOwn(r, "includes") && !Object.hasOwn(r, Symbol.iterator) && c(e) ? t(r) : void 0, o = !1;
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(r, t, a))) {
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, r().scopes), m = (e) => e === void 0 ? {} : {
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 { recordClientDiagnostic as e } from "./clientDiagnostics.js";
2
- import { INITIAL_RECOVERY_SNAPSHOT as t, recoveryCoordinatorFor as n } from "./recoveryCoordinator.js";
3
- import { useFrameworkApi as r } from "./runtimeContext.js";
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 = r(u), f = d.recovery ?? n(d.errorBus, u), p = o(f.subscribe, f.getSnapshot, f.getServerSnapshot ?? (() => t)), m = o(l, s, c), h = i(() => f.reportExternalSuccess(), [f]), g = m ? p.status : "offline";
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
- e(u, "connection.status", {
11
+ t(u, "connection.status", {
12
12
  status: g,
13
13
  rawTransport: p.rawTransport,
14
14
  online: m,
@@ -1,7 +1,7 @@
1
1
  import { useFrameworkApi as e } from "./runtimeContext.js";
2
2
  import { useSubscription as t } from "./useSubscription.js";
3
- import { schemaToColumns as n } from "./schemaFields.js";
4
- import { createLiveRowSorter as r } from "./liveRowSort.js";
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 ? [] : n(g)), [u.columns, g]), [y, b] = s(u.initialSort), x = i((e) => {
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 = r()), {
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 { recordClientDiagnostic as e } from "./clientDiagnostics.js";
1
+ import { useFrameworkApi as e } from "./runtimeContext.js";
2
2
  import { isUnresolvedApi as t } from "./frameworkRuntimesContext.js";
3
- import { useFrameworkApi as n } from "./runtimeContext.js";
4
- import { resolveByTag as r } from "./tagWalk.js";
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 = n(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(() => ({
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 t = !1, n = () => !t && !T.subject?.aborted && E.current?.scope === T, i = (e) => {
40
- n() && O((t) => ({
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 = (t, r) => {
45
- !n() || t <= 0 || (e(T.apiName, "event.gap", {
44
+ }, a = (e, n) => {
45
+ !t() || e <= 0 || (r(T.apiName, "event.gap", {
46
46
  tag: T.tag,
47
- missed: t,
48
- reason: r
49
- }), i((e) => ({
50
- ...e,
51
- missed: e.missed + t,
47
+ missed: e,
48
+ reason: n
49
+ }), i((t) => ({
50
+ ...t,
51
+ missed: t.missed + e,
52
52
  lastMiss: {
53
- count: t,
54
- reason: r
53
+ count: e,
54
+ reason: n
55
55
  }
56
56
  })), E.current?.onMissed?.({
57
- count: t,
58
- reason: r
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 (!n()) return l.interrupt;
66
+ if (!t()) return l.interrupt;
67
67
  let e = [...T.resume].map(([e, t]) => ({
68
68
  origin: e,
69
69
  n: t
70
- })), t = r(T.client, T.tag);
71
- return l.succeed(t({
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
- n() && (e._tag === "attached" ? i((e) => ({
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
- t || (t = !0, T.resume.clear(), O((e) => e?.scope === T ? {
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))));
@@ -1,6 +1,6 @@
1
- import { globalContext as e } from "./globalContext.js";
2
- import { useFrameworkApi as t } from "./runtimeContext.js";
3
- import { useMutation as n } from "./useMutation.js";
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 = e("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) => {
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 = e("formBinding", void 0), se = (e, t) => {
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 = (e, r, i) => {
87
- let a = t(e), o = h(void 0), s = typeof r == "function" ? r(o.current?.state?.values ?? i.defaults ?? {}) : r, c = h(s).current, l = n(e, s), u = i.schema ?? a.descriptors[s]?.input;
88
- return process.env.NODE_ENV !== "production" && u === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${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(e, c, i, u, o, l);
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), !Object.is(R.getFieldValue(e), t) && R.setFieldValue(e, t);
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), !Object.is(R.getFieldValue(e), t) && R.setFieldValue(e, t);
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) => {