@voltro/devtools 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.
@@ -2,23 +2,92 @@ import { getLogs as e, subscribeLogs as t } from "../logsBus.js";
2
2
  import { Spinner as n, VoltroMark as r } from "../components/icons.js";
3
3
  import { useDevtoolsStrings as i } from "../strings.js";
4
4
  import { useSubscriptionsCount as a } from "../panels/subscriptions.js";
5
- import { DEFAULT_CAPSULE_PLACEMENT as o } from "../capsulePlacement.js";
6
- import { useCapsuleClearance as s } from "../useCapsuleClearance.js";
7
- import { useCallback as c, useEffect as l, useLayoutEffect as u, useRef as d, useSyncExternalStore as f } from "react";
8
- import { getMutations as p, subscribeMutations as m, useConnectionStatus as h, useFrameworkRuntimes as g } from "@voltro/client";
9
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
5
+ import { useCapsuleClearance as o } from "../useCapsuleClearance.js";
6
+ import { DEFAULT_CAPSULE_PLACEMENT as s } from "../capsulePlacement.js";
7
+ import { useCallback as c, useEffect as l, useLayoutEffect as u, useRef as d, useState as f, useSyncExternalStore as p } from "react";
8
+ import { getMutations as m, subscribeMutations as h, useConnectionStatus as g, useFrameworkRuntimes as _ } from "@voltro/client";
9
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
10
10
  // src/console/Capsule.tsx
11
- var y = (e) => e === "compiling" || e === "loading" || e === "reconnecting", b = () => f(t, e, e), x = ({ name: e }) => {
12
- let t = h(e).status;
13
- return /* @__PURE__ */ v("span", {
11
+ var b = (e) => e === "compiling" || e === "loading" || e === "reconnecting", x = () => p(t, e, e), S = ({ name: e }) => {
12
+ let t = g(e).status;
13
+ return /* @__PURE__ */ y("span", {
14
14
  className: "vdt-chip",
15
15
  "data-status": t,
16
- children: [/* @__PURE__ */ _("span", {
16
+ children: [/* @__PURE__ */ v("span", {
17
17
  className: `vdt-dot vdt-dot-${t === "connected" ? "ok" : t === "recovering" ? "warn" : "err"}`,
18
18
  "aria-hidden": "true"
19
- }), /* @__PURE__ */ _("b", { children: e })]
19
+ }), /* @__PURE__ */ v("b", { children: e })]
20
20
  });
21
- }, S = 260, C = "cubic-bezier(0.2, 0.8, 0.2, 1)", w = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, T = (e, t, n) => {
21
+ }, C = (e) => {
22
+ let t = e.indexOf(" /");
23
+ if (t < 0) return {
24
+ verb: e,
25
+ head: "",
26
+ tail: "",
27
+ path: null
28
+ };
29
+ let n = e.slice(0, t + 1), r = e.slice(t + 1), i = r.split("/"), a = i.length > 3 ? 2 : i.length - 1, o = i.length - a;
30
+ return {
31
+ verb: n,
32
+ head: i.slice(0, o).join("/"),
33
+ tail: `/${i.slice(o).join("/")}`.replace(/^\/\//, "/"),
34
+ path: r
35
+ };
36
+ }, w = (e) => e === null ? "chips" : `${e.kind}:${e.label.replace(/[…\.\s]+$/, "")}`, T = (e) => {
37
+ let [t, n] = f(e), r = d(null), i = d(e);
38
+ i.current = e;
39
+ let a = w(t), o = w(e);
40
+ return l(() => {
41
+ if (r.current === null && (r.current = Date.now()), o === a) {
42
+ e !== t && n(e);
43
+ return;
44
+ }
45
+ let s = () => {
46
+ r.current = Date.now(), n(i.current);
47
+ }, c = e === null ? null : C(e.label).path;
48
+ if (c !== null && (t === null || C(t.label).path !== c) || t === null || !b(t.kind) || e !== null && !b(e.kind)) {
49
+ s();
50
+ return;
51
+ }
52
+ let l = e === null ? 250 : Math.max(0, 600 - (Date.now() - (r.current ?? 0)));
53
+ if (l === 0) {
54
+ s();
55
+ return;
56
+ }
57
+ let u = setTimeout(s, l);
58
+ return () => clearTimeout(u);
59
+ }, [
60
+ o,
61
+ a,
62
+ e,
63
+ t
64
+ ]), t;
65
+ }, E = ({ label: e }) => {
66
+ let { verb: t, head: n, tail: r, path: i } = C(e);
67
+ return i === null ? /* @__PURE__ */ v("span", {
68
+ className: "vdt-capsule-label",
69
+ children: /* @__PURE__ */ v("span", {
70
+ className: "vdt-capsule-label-head",
71
+ children: t
72
+ })
73
+ }) : /* @__PURE__ */ y("span", {
74
+ className: "vdt-capsule-label",
75
+ children: [
76
+ /* @__PURE__ */ v("span", {
77
+ className: "vdt-capsule-label-verb",
78
+ children: t
79
+ }),
80
+ n === "" ? null : /* @__PURE__ */ v("span", {
81
+ className: "vdt-capsule-label-head",
82
+ children: n
83
+ }),
84
+ /* @__PURE__ */ v("span", {
85
+ className: "vdt-capsule-label-tail",
86
+ children: r
87
+ })
88
+ ]
89
+ });
90
+ }, D = 260, O = "cubic-bezier(0.2, 0.8, 0.2, 1)", k = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, A = (e, t, n) => {
22
91
  let r = d(null), i = d(null), a = d(e), o = c((e) => {
23
92
  n.current = e, t && (t.current = e);
24
93
  }, [t, n]);
@@ -34,15 +103,15 @@ var y = (e) => e === "compiling" || e === "loading" || e === "reconnecting", b =
34
103
  if (a.current === e) return;
35
104
  a.current = e;
36
105
  let t = n.current;
37
- if (t === null || typeof t.animate != "function" || w()) return;
106
+ if (t === null || typeof t.animate != "function" || k()) return;
38
107
  let o = i.current === null ? r.current : t.offsetWidth;
39
108
  i.current?.cancel(), i.current = null;
40
109
  let s = t.offsetWidth;
41
110
  if (o === null || o === s) return;
42
111
  t.setAttribute("data-morphing", "true");
43
112
  let c = t.animate([{ width: `${o}px` }, { width: `${s}px` }], {
44
- duration: S,
45
- easing: C
113
+ duration: D,
114
+ easing: O
46
115
  });
47
116
  i.current = c;
48
117
  let l = () => {
@@ -50,114 +119,114 @@ var y = (e) => e === "compiling" || e === "loading" || e === "reconnecting", b =
50
119
  };
51
120
  c.addEventListener("finish", l), c.addEventListener("cancel", l);
52
121
  }, [e]), o;
53
- }, E = ({ status: e, onOpen: t, buttonRef: c, style: l, dragging: u = !1, onPointerDown: h }) => {
54
- let S = i().shell, C = g(), w = a(), E = f(m, p, p), D = b(), O = E.filter((e) => e.status === "pending").length, k = E.filter((e) => e.status === "error").length, A = D.filter((e) => e.level === "error" || e.level === "fatal").length, j = D.filter((e) => e.level === "warn").length, M = e !== null, N = e?.kind ?? "idle", P = e === null ? "" : y(N) ? e.label.replace(/[…\.\s]+$/, "") : e.label, F = M ? `${N}:${P}` : "chips", I = d(null), L = T(F, c, I), R = {
55
- x: l?.["--vdt-capsule-x"] ?? o.x,
56
- y: l?.["--vdt-capsule-y"] ?? o.y
57
- }, z = s(I, R, !u), B = {
122
+ }, j = ({ status: e, onOpen: t, buttonRef: c, style: l, dragging: u = !1, pinned: f = !1, onPointerDown: g }) => {
123
+ let C = T(e), w = i().shell, D = _(), O = a(), k = p(h, m, m), j = x(), M = k.filter((e) => e.status === "pending").length, N = k.filter((e) => e.status === "error").length, P = j.filter((e) => e.level === "error" || e.level === "fatal").length, F = j.filter((e) => e.level === "warn").length, I = C !== null, L = C?.kind ?? "idle", R = C === null ? "" : b(L) ? C.label.replace(/[…\.\s]+$/, "") : C.label, z = I ? `${L}:${R}` : "chips", B = d(null), V = A(z, c, B), H = {
124
+ x: l?.["--vdt-capsule-x"] ?? s.x,
125
+ y: l?.["--vdt-capsule-y"] ?? s.y
126
+ }, U = o(B, H, !u && !f), W = f ? {
127
+ placement: H,
128
+ compact: !1
129
+ } : U, G = {
58
130
  ...l,
59
- "--vdt-capsule-x": z.placement.x,
60
- "--vdt-capsule-y": z.placement.y
61
- }, V = M ? P : [
62
- ...C.names,
63
- `${w} ${S.live}`,
64
- ...O > 0 ? [`${O} ${S.pending}`] : [],
65
- ...k > 0 ? [`${k} ${S.failed}`] : [],
66
- ...A > 0 ? [`${A} ${S.errorsWord(A)}`] : [],
67
- ...A === 0 && j > 0 ? [`${j} ${S.warningsWord(j)}`] : []
131
+ "--vdt-capsule-x": W.placement.x,
132
+ "--vdt-capsule-y": W.placement.y
133
+ }, K = I ? R : [
134
+ ...D.names,
135
+ `${O} ${w.live}`,
136
+ ...M > 0 ? [`${M} ${w.pending}`] : [],
137
+ ...N > 0 ? [`${N} ${w.failed}`] : [],
138
+ ...P > 0 ? [`${P} ${w.errorsWord(P)}`] : [],
139
+ ...P === 0 && F > 0 ? [`${F} ${w.warningsWord(F)}`] : []
68
140
  ].join(", ");
69
- return /* @__PURE__ */ v("button", {
70
- ref: L,
141
+ return /* @__PURE__ */ y("button", {
142
+ ref: V,
71
143
  type: "button",
72
144
  className: "vdt-capsule",
73
- "data-busy": M ? "true" : "false",
74
- "data-kind": N,
145
+ "data-busy": I ? "true" : "false",
146
+ "data-kind": L,
75
147
  "data-dragging": u ? "true" : void 0,
76
- "data-clearance-compact": z.compact ? "true" : void 0,
77
- style: B,
148
+ "data-clearance-compact": W.compact ? "true" : void 0,
149
+ style: G,
78
150
  onClick: t,
79
- onPointerDown: h,
80
- title: M || z.compact ? `${S.openTitle}: ${V}` : S.openTitle,
81
- "aria-label": M || z.compact ? `${S.openLabel}: ${V}` : S.openLabel,
151
+ onPointerDown: g,
152
+ title: I || W.compact ? `${w.openTitle}: ${K}` : w.openTitle,
153
+ "aria-label": I || W.compact ? `${w.openLabel}: ${K}` : w.openLabel,
82
154
  children: [
83
- /* @__PURE__ */ _("span", {
155
+ /* @__PURE__ */ v("span", {
84
156
  className: "vdt-capsule-halo vdt-capsule-aura",
85
157
  "aria-hidden": "true"
86
158
  }),
87
- /* @__PURE__ */ _("span", {
159
+ /* @__PURE__ */ v("span", {
88
160
  className: "vdt-capsule-halo",
89
161
  "aria-hidden": "true"
90
162
  }),
91
- M ? /* @__PURE__ */ _(n, { className: "vdt-capsule-mark vdt-spinner" }) : /* @__PURE__ */ _(r, { className: "vdt-capsule-mark" }),
92
- M ? /* @__PURE__ */ v("span", {
163
+ I ? /* @__PURE__ */ v(n, { className: "vdt-capsule-mark vdt-spinner" }) : /* @__PURE__ */ v(r, { className: "vdt-capsule-mark" }),
164
+ I ? /* @__PURE__ */ y("span", {
93
165
  className: "vdt-capsule-status",
94
- children: [/* @__PURE__ */ _("span", {
95
- className: "vdt-capsule-label",
96
- children: P
97
- }), y(N) ? /* @__PURE__ */ v("span", {
166
+ children: [/* @__PURE__ */ v(E, { label: R }), b(L) ? /* @__PURE__ */ y("span", {
98
167
  className: "vdt-dots",
99
168
  "aria-hidden": "true",
100
169
  children: [
101
- /* @__PURE__ */ _("span", {}),
102
- /* @__PURE__ */ _("span", {}),
103
- /* @__PURE__ */ _("span", {})
170
+ /* @__PURE__ */ v("span", {}),
171
+ /* @__PURE__ */ v("span", {}),
172
+ /* @__PURE__ */ v("span", {})
104
173
  ]
105
174
  }) : null]
106
- }, F) : /* @__PURE__ */ v("span", {
175
+ }, z) : /* @__PURE__ */ y("span", {
107
176
  className: "vdt-capsule-chips",
108
177
  children: [
109
- C.names.map((e) => /* @__PURE__ */ _(x, { name: e }, e)),
110
- /* @__PURE__ */ v("span", {
178
+ D.names.map((e) => /* @__PURE__ */ v(S, { name: e }, e)),
179
+ /* @__PURE__ */ y("span", {
111
180
  className: "vdt-chip",
112
181
  "data-chip": "live",
113
182
  children: [
114
- /* @__PURE__ */ _("b", { children: w }),
183
+ /* @__PURE__ */ v("b", { children: O }),
115
184
  " ",
116
- S.live
185
+ w.live
117
186
  ]
118
187
  }),
119
- O > 0 ? /* @__PURE__ */ v("span", {
188
+ M > 0 ? /* @__PURE__ */ y("span", {
120
189
  className: "vdt-chip vdt-chip-info",
121
190
  "data-chip": "pending",
122
191
  children: [
123
- /* @__PURE__ */ _("span", {
192
+ /* @__PURE__ */ v("span", {
124
193
  className: "vdt-dot vdt-dot-info",
125
194
  "aria-hidden": "true"
126
195
  }),
127
- /* @__PURE__ */ _("b", { children: O }),
196
+ /* @__PURE__ */ v("b", { children: M }),
128
197
  " ",
129
- S.pending
198
+ w.pending
130
199
  ]
131
200
  }) : null,
132
- k > 0 ? /* @__PURE__ */ v("span", {
201
+ N > 0 ? /* @__PURE__ */ y("span", {
133
202
  className: "vdt-chip vdt-chip-err",
134
203
  "data-chip": "failed",
135
204
  children: [
136
- /* @__PURE__ */ _("span", {
205
+ /* @__PURE__ */ v("span", {
137
206
  className: "vdt-dot vdt-dot-err",
138
207
  "aria-hidden": "true"
139
208
  }),
140
- /* @__PURE__ */ _("b", { children: k }),
209
+ /* @__PURE__ */ v("b", { children: N }),
141
210
  " ",
142
- S.failed
211
+ w.failed
143
212
  ]
144
213
  }) : null,
145
- A > 0 ? /* @__PURE__ */ v("span", {
214
+ P > 0 ? /* @__PURE__ */ y("span", {
146
215
  className: "vdt-chip vdt-chip-err",
147
216
  "data-chip": "errors",
148
217
  children: [
149
- /* @__PURE__ */ _("b", { children: A }),
218
+ /* @__PURE__ */ v("b", { children: P }),
150
219
  " ",
151
- S.errorsWord(A)
220
+ w.errorsWord(P)
152
221
  ]
153
222
  }) : null,
154
- A === 0 && j > 0 ? /* @__PURE__ */ v("span", {
223
+ P === 0 && F > 0 ? /* @__PURE__ */ y("span", {
155
224
  className: "vdt-chip vdt-chip-warn",
156
225
  "data-chip": "warnings",
157
226
  children: [
158
- /* @__PURE__ */ _("b", { children: j }),
227
+ /* @__PURE__ */ v("b", { children: F }),
159
228
  " ",
160
- S.warningsWord(j)
229
+ w.warningsWord(F)
161
230
  ]
162
231
  }) : null
163
232
  ]
@@ -165,4 +234,4 @@ var y = (e) => e === "compiling" || e === "loading" || e === "reconnecting", b =
165
234
  ]
166
235
  });
167
236
  };
168
- export { E as Capsule };
237
+ export { j as Capsule, C as splitStatusLabel, T as useSteadyStatus };
@@ -1,16 +1,16 @@
1
1
  import { Activity as e, Compass as t, Database as n, Grip as r, Indexes as i, Logs as a, Monitor as o, Mutation as s, Search as ee, Trace as c, VoltroMark as te, Webhook as l, Workflow as u, X as ne, Zap as d } from "../components/icons.js";
2
- import { useDevtoolsStrings as f } from "../strings.js";
3
- import { SubscriptionDetail as p } from "../panels/subscriptions.js";
4
2
  import { DockMenu as re } from "../components/dockMenu.js";
3
+ import { useDevtoolsStrings as f } from "../strings.js";
5
4
  import { InspectRefusals as ie } from "./InspectRefusals.js";
6
5
  import { IndexesPanel as ae, useIndexesCount as oe } from "../panels/indexes.js";
7
6
  import { WebhooksPanel as se, useWebhooksCount as ce } from "../panels/webhooks.js";
8
- import { WorkflowsPanel as le, useWorkflowsCount as m } from "../panels/workflows.js";
9
- import { RoutesPanel as ue } from "../panels/routes.js";
10
- import { RuntimesPanel as de } from "../panels/runtimes.js";
7
+ import { WorkflowsPanel as le, useWorkflowsCount as ue } from "../panels/workflows.js";
8
+ import { RoutesPanel as de } from "../panels/routes.js";
9
+ import { RuntimesPanel as p } from "../panels/runtimes.js";
11
10
  import { PwaPanel as fe } from "../panels/pwa.js";
12
11
  import { DesktopPanel as pe } from "../panels/desktop.js";
13
12
  import { StoresPanel as me } from "../panels/stores.js";
13
+ import { SubscriptionDetail as m } from "../panels/subscriptions.js";
14
14
  import { MutationDetail as h } from "../panels/mutations.js";
15
15
  import { LogDetail as g } from "../panels/logs.js";
16
16
  import { TraceDetail as _ } from "../panels/traces.js";
@@ -169,7 +169,7 @@ var M = {
169
169
  role: "status",
170
170
  children: r.retainedSelection
171
171
  }) : null,
172
- n.source === "subscription" ? /* @__PURE__ */ A(p, { entry: n.entry }) : null,
172
+ n.source === "subscription" ? /* @__PURE__ */ A(m, { entry: n.entry }) : null,
173
173
  n.source === "mutation" || n.source === "action" ? /* @__PURE__ */ A(h, { mutation: n.mutation }) : null,
174
174
  n.source === "trace" ? /* @__PURE__ */ A(_, { trace: n.trace }) : null,
175
175
  n.source === "log" ? /* @__PURE__ */ A(g, { record: n.record }) : null
@@ -200,7 +200,7 @@ var M = {
200
200
  case "log": return t.record;
201
201
  }
202
202
  }, L = ({ dock: e, push: t, onDock: n, onPush: i, onClose: a, scope: o, onScope: s, searchRef: c, onHeaderPointerDown: l }) => {
203
- let u = f(), d = u.shell, p = u.tabs, h = ye(), [g, _] = T(!1), w = ve(!0, g), E = oe(!0), D = ce(!0), O = m(!0), k = we(), [P, L] = T(""), [R, z] = T(!1), [B, V] = T(null), H = B?.id ?? null, U = B?.detail.source === "mutation" || B?.detail.source === "action" ? B.detail.mutation.subjectSignal : void 0;
203
+ let u = f(), d = u.shell, m = u.tabs, h = ye(), [g, _] = T(!1), w = ve(!0, g), E = oe(!0), D = ce(!0), O = ue(!0), k = we(), [P, L] = T(""), [R, z] = T(!1), [B, V] = T(null), H = B?.id ?? null, U = B?.detail.source === "mutation" || B?.detail.source === "action" ? B.detail.mutation.subjectSignal : void 0;
204
204
  S(() => {
205
205
  if (U === void 0) return;
206
206
  let e = () => V((e) => (e?.detail.source === "mutation" || e?.detail.source === "action") && e.detail.mutation.subjectSignal === U ? null : e);
@@ -256,19 +256,19 @@ var M = {
256
256
  }, $ = (e) => {
257
257
  switch (e) {
258
258
  case "all": return d.scopeAll;
259
- case "subscription": return p.subscriptions;
260
- case "mutation": return p.mutations;
261
- case "action": return p.actions;
262
- case "trace": return p.traces;
263
- case "log": return p.logs;
264
- case "workflows": return p.workflows;
265
- case "stores": return p.stores;
266
- case "indexes": return p.indexes;
267
- case "webhooks": return p.webhooks;
268
- case "routes": return p.routes;
269
- case "runtimes": return p.runtimes;
270
- case "pwa": return p.pwa;
271
- case "desktop": return p.desktop;
259
+ case "subscription": return m.subscriptions;
260
+ case "mutation": return m.mutations;
261
+ case "action": return m.actions;
262
+ case "trace": return m.traces;
263
+ case "log": return m.logs;
264
+ case "workflows": return m.workflows;
265
+ case "stores": return m.stores;
266
+ case "indexes": return m.indexes;
267
+ case "webhooks": return m.webhooks;
268
+ case "routes": return m.routes;
269
+ case "runtimes": return m.runtimes;
270
+ case "pwa": return m.pwa;
271
+ case "desktop": return m.desktop;
272
272
  }
273
273
  };
274
274
  return /* @__PURE__ */ j(be, { children: [
@@ -412,8 +412,8 @@ var M = {
412
412
  o === "stores" ? /* @__PURE__ */ A(me, {}) : null,
413
413
  o === "indexes" ? /* @__PURE__ */ A(ae, {}) : null,
414
414
  o === "webhooks" ? /* @__PURE__ */ A(se, {}) : null,
415
- o === "routes" ? /* @__PURE__ */ A(ue, {}) : null,
416
- o === "runtimes" ? /* @__PURE__ */ A(de, {}) : null,
415
+ o === "routes" ? /* @__PURE__ */ A(de, {}) : null,
416
+ o === "runtimes" ? /* @__PURE__ */ A(p, {}) : null,
417
417
  o === "pwa" ? /* @__PURE__ */ A(fe, {}) : null,
418
418
  o === "desktop" ? /* @__PURE__ */ A(pe, {}) : null
419
419
  ]
@@ -1,5 +1,5 @@
1
- import { useDevtoolsStrings as e } from "../strings.js";
2
- import { clearInspectRefusals as t, useInspectRefusals as n } from "../inspectRefusal.js";
1
+ import { clearInspectRefusals as e, useInspectRefusals as t } from "../inspectRefusal.js";
2
+ import { useDevtoolsStrings as n } from "../strings.js";
3
3
  import { useState as r } from "react";
4
4
  import { useFrameworkRuntimes as i } from "@voltro/client";
5
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
@@ -10,21 +10,21 @@ var s = (e) => {
10
10
  } catch {
11
11
  return;
12
12
  }
13
- }, c = ({ url: n }) => {
14
- let i = e().inspect, [s, c] = r(""), [l, u] = r(null), d = async (e) => {
15
- e.preventDefault(), u(null);
13
+ }, c = ({ url: t }) => {
14
+ let i = n().inspect, [s, c] = r(""), [l, u] = r(null), d = async (n) => {
15
+ n.preventDefault(), u(null);
16
16
  try {
17
- let e = await fetch(n, {
17
+ let n = await fetch(t, {
18
18
  method: "POST",
19
19
  credentials: "same-origin",
20
20
  headers: { "content-type": "application/json" },
21
21
  body: JSON.stringify({ token: s })
22
22
  });
23
- if (e.ok) {
24
- c(""), t();
23
+ if (n.ok) {
24
+ c(""), e();
25
25
  return;
26
26
  }
27
- let r = await e.json().catch(() => null), i = typeof r == "object" && r && typeof r.reason == "string" ? r.reason : `HTTP ${e.status}`;
27
+ let r = await n.json().catch(() => null), i = typeof r == "object" && r && typeof r.reason == "string" ? r.reason : `HTTP ${n.status}`;
28
28
  u(i);
29
29
  } catch (e) {
30
30
  u(e instanceof Error ? e.message : String(e));
@@ -54,13 +54,13 @@ var s = (e) => {
54
54
  ]
55
55
  });
56
56
  }, l = () => {
57
- let t = n(), r = i(), l = e().inspect;
58
- if (t.length === 0) return null;
57
+ let e = t(), r = i(), l = n().inspect;
58
+ if (e.length === 0) return null;
59
59
  let u = (e) => r.names.find((t) => r.get(t).inspectBaseUrl === e) ?? e;
60
60
  return /* @__PURE__ */ a("div", {
61
61
  className: "vdt-refusals",
62
62
  role: "status",
63
- children: t.map((e) => {
63
+ children: e.map((e) => {
64
64
  let t = e.locked === !0 ? s(e) : void 0;
65
65
  return /* @__PURE__ */ o("div", {
66
66
  className: "vdt-refusal",
@@ -1,21 +1,21 @@
1
1
  import { getLogs as e, subscribeLogs as t } from "../logsBus.js";
2
- import { defaultDevtoolsStrings as n, useDevtoolsStrings as r } from "../strings.js";
3
- import { formatCacheKey as i, useLiveApiSections as a } from "../panels/subscriptions.js";
4
- import { fmtDuration as o, useTracesAcrossApis as s } from "../panels/traces.js";
2
+ import { formatCacheKey as n, useLiveApiSections as r } from "../panels/subscriptions.js";
3
+ import { fmtDuration as i, useTracesAcrossApis as a } from "../panels/traces.js";
4
+ import { defaultDevtoolsStrings as o, useDevtoolsStrings as s } from "../strings.js";
5
5
  import { compactJson as c } from "./searchIndex.js";
6
6
  import { useMemo as l, useSyncExternalStore as u } from "react";
7
7
  import { getMutations as d, subscribeMutations as f } from "@voltro/client";
8
8
  // src/console/sources.ts
9
9
  var p = (e) => e.recovery.phase === "stuck" || e.snapshot.error ? "err" : e.recovery.phase !== "steady" || e.snapshot.pendingPatches > 0 ? "warn" : e.snapshot.revision >= 0 ? "ok" : e.hasFiber ? "info" : "idle", m = (e, t) => {
10
- let n = i(t.key), r = [];
11
- t.subscriberCount > 0 && r.push(`${t.subscriberCount} sub${t.subscriberCount === 1 ? "" : "s"}`), t.snapshot.revision >= 0 && r.push(`r${t.snapshot.revision}`), t.snapshot.pendingPatches > 0 && r.push(`+${t.snapshot.pendingPatches} pending`), t.evicting && r.push("evicting");
10
+ let r = n(t.key), i = [];
11
+ t.subscriberCount > 0 && i.push(`${t.subscriberCount} sub${t.subscriberCount === 1 ? "" : "s"}`), t.snapshot.revision >= 0 && i.push(`r${t.snapshot.revision}`), t.snapshot.pendingPatches > 0 && i.push(`+${t.snapshot.pendingPatches} pending`), t.evicting && i.push("evicting");
12
12
  let a = t.snapshot.error ? "error" : t.recovery.phase === "steady" ? void 0 : t.recovery.phase;
13
13
  return {
14
14
  id: `sub:${e}:${t.key}`,
15
15
  source: "subscription",
16
16
  apiName: e,
17
- name: n,
18
- summary: r.join(" · "),
17
+ name: r,
18
+ summary: i.join(" · "),
19
19
  ...a === void 0 ? {} : { status: a },
20
20
  tone: p(t),
21
21
  at: 0,
@@ -64,11 +64,11 @@ var p = (e) => e.recovery.phase === "stuck" || e.snapshot.error ? "err" : e.reco
64
64
  source: "log",
65
65
  record: e
66
66
  }
67
- }), b = (e, t, r = n.traces) => {
68
- let i = t.spans.map((e) => e.attributes["db.operation.name"] ?? e.attributes["db.operation"]).find((e) => typeof e == "string"), a = t.spans.filter((e) => e.name !== t.rootName).slice(0, 3).map((e) => e.name).join(" → "), s = t.kind === "subscription" ? `${t.deliveryCount ?? 0} ${r.delivery(t.deliveryCount ?? 0)}` : [
69
- o(t.durationMs),
70
- r.spans(t.spanCount),
71
- i ?? a
67
+ }), b = (e, t, n = o.traces) => {
68
+ let r = t.spans.map((e) => e.attributes["db.operation.name"] ?? e.attributes["db.operation"]).find((e) => typeof e == "string"), a = t.spans.filter((e) => e.name !== t.rootName).slice(0, 3).map((e) => e.name).join(" → "), s = t.kind === "subscription" ? `${t.deliveryCount ?? 0} ${n.delivery(t.deliveryCount ?? 0)}` : [
69
+ i(t.durationMs),
70
+ n.spans(t.spanCount),
71
+ r ?? a
72
72
  ].filter(Boolean).join(" · "), c = t.spans.filter((e) => e.status === "error").map((e) => `${e.name} ${e.statusMessage ?? ""}`).join(" ");
73
73
  return {
74
74
  id: `trace:${e}:${t.traceId}`,
@@ -87,7 +87,7 @@ var p = (e) => e.recovery.phase === "stuck" || e.snapshot.error ? "err" : e.reco
87
87
  }
88
88
  };
89
89
  }, x = () => u(f, d, d), S = () => u(t, e, e), C = (e, t = !1) => {
90
- let n = r().traces, i = a(), o = x(), c = S(), u = s(e, t);
90
+ let n = s().traces, i = r(), o = x(), c = S(), u = a(e, t);
91
91
  return l(() => {
92
92
  let e = [];
93
93
  for (let t of i) for (let n of t.entries) e.push(m(t.name, n));
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { DevtoolsStringsProvider as e, defaultDevtoolsStrings as t, useDevtoolsStrings as n } from "./strings.js";
2
- import { VoltroDevtools as r } from "./Devtools.js";
3
- export { e as DevtoolsStringsProvider, r as VoltroDevtools, t as defaultDevtoolsStrings, n as useDevtoolsStrings };
1
+ import { VoltroDevtools as e } from "./Devtools.js";
2
+ import { DevtoolsStringsProvider as t, defaultDevtoolsStrings as n, useDevtoolsStrings as r } from "./strings.js";
3
+ export { t as DevtoolsStringsProvider, e as VoltroDevtools, n as defaultDevtoolsStrings, r as useDevtoolsStrings };
@@ -1,22 +1,22 @@
1
- import { inspectBaseOf as e, isRefusalStatus as t, mayAskInspect as n, noteInspectFailure as r, noteInspectRefusal as i, noteInspectSuccess as a, readInspectRefusal as o } from "./inspectRefusal.js";
2
- import { inspectHeaders as s } from "./inspectAuth.js";
1
+ import { inspectHeaders as e } from "./inspectAuth.js";
2
+ import { inspectBaseOf as t, isRefusalStatus as n, mayAskInspect as r, noteInspectFailure as i, noteInspectRefusal as a, noteInspectSuccess as o, readInspectRefusal as s } from "./inspectRefusal.js";
3
3
  // src/inspectFetch.ts
4
- var c = (e) => typeof e == "object" && !!e && "data" in e, l = (e) => c(e) ? e.data : null, u = async (e, t, n) => {
5
- let r = await fetch(e, {
4
+ var c = (e) => typeof e == "object" && !!e && "data" in e, l = (e) => c(e) ? e.data : null, u = async (t, n, r) => {
5
+ let i = await fetch(t, {
6
6
  method: "POST",
7
- headers: s(t, {
7
+ headers: e(n, {
8
8
  accept: "application/json",
9
9
  "content-type": "application/json"
10
10
  }),
11
- body: JSON.stringify(n ?? {})
12
- }), i = await r.json().catch(() => null);
13
- if (!r.ok) {
14
- let e = typeof i == "object" && i ? i : void 0, t = typeof e?.message == "string" ? e.message : typeof e?.error == "string" ? e.error : `HTTP ${r.status}`;
11
+ body: JSON.stringify(r ?? {})
12
+ }), a = await i.json().catch(() => null);
13
+ if (!i.ok) {
14
+ let e = typeof a == "object" && a ? a : void 0, t = typeof e?.message == "string" ? e.message : typeof e?.error == "string" ? e.error : `HTTP ${i.status}`;
15
15
  throw Error(t);
16
16
  }
17
- let a = l(i);
18
- if (a === null) throw Error("the api answered without an observation");
19
- return a;
17
+ let o = l(a);
18
+ if (o === null) throw Error("the api answered without an observation");
19
+ return o;
20
20
  }, d = (e, t) => {
21
21
  let n = `${e}\u0000${t ?? ""}`, r = f.get(n);
22
22
  if (r !== void 0) return r;
@@ -25,17 +25,17 @@ var c = (e) => typeof e == "object" && !!e && "data" in e, l = (e) => c(e) ? e.d
25
25
  });
26
26
  return f.set(n, i), i;
27
27
  }, f = /* @__PURE__ */ new Map(), p = async (c, u) => {
28
- let d = e(c);
29
- if (!n(d)) return null;
28
+ let d = t(c);
29
+ if (!r(d)) return null;
30
30
  let f;
31
31
  try {
32
- f = await fetch(c, { headers: s(u, { accept: "application/json" }) });
32
+ f = await fetch(c, { headers: e(u, { accept: "application/json" }) });
33
33
  } catch {
34
- return r(d, !0), null;
34
+ return i(d, !0), null;
35
35
  }
36
- if (t(f.status)) return i(await o(d, f)), null;
37
- if (!f.ok) return r(d, !1), null;
38
- a(d);
36
+ if (n(f.status)) return a(await s(d, f)), null;
37
+ if (!f.ok) return i(d, !1), null;
38
+ o(d);
39
39
  try {
40
40
  return l(await f.json());
41
41
  } catch {
@@ -1,28 +1,28 @@
1
- import { inspectRefusalFor as e, isRefusalStatus as t, noteInspectRefusal as n, readInspectRefusal as r } from "./inspectRefusal.js";
2
- import { inspectHeaders as i } from "./inspectAuth.js";
1
+ import { inspectHeaders as e } from "./inspectAuth.js";
2
+ import { inspectRefusalFor as t, isRefusalStatus as n, noteInspectRefusal as r, readInspectRefusal as i } from "./inspectRefusal.js";
3
3
  import { useEffect as a, useState as o } from "react";
4
4
  // src/inspectStream.ts
5
5
  var s = (a, o) => {
6
6
  let s = `${a}/_voltro/inspect/stream?channels=${encodeURIComponent(o.channels.join(","))}`, c = !1, l = !1, u = 0, d, f, p = async () => {
7
7
  if (c) return;
8
- if (e(a) !== void 0) {
8
+ if (t(a) !== void 0) {
9
9
  l = !0;
10
10
  return;
11
11
  }
12
12
  d = new AbortController();
13
13
  let m;
14
14
  try {
15
- let e = await fetch(s, {
16
- headers: i(o.token, { accept: "text/event-stream" }),
15
+ let t = await fetch(s, {
16
+ headers: e(o.token, { accept: "text/event-stream" }),
17
17
  signal: d.signal
18
18
  });
19
- if (t(e.status)) throw n(await r(a, e)), l = !0, Error(`inspect stream refused (HTTP ${e.status})`);
20
- if (!e.ok || e.body === null) throw Error(`inspect stream HTTP ${e.status}`);
19
+ if (n(t.status)) throw r(await i(a, t)), l = !0, Error(`inspect stream refused (HTTP ${t.status})`);
20
+ if (!t.ok || t.body === null) throw Error(`inspect stream HTTP ${t.status}`);
21
21
  if (c) {
22
- await e.body.cancel();
22
+ await t.body.cancel();
23
23
  return;
24
24
  }
25
- u = 0, m = e.body.getReader();
25
+ u = 0, m = t.body.getReader();
26
26
  let f = new TextDecoder(), p = "";
27
27
  for (; !c;) {
28
28
  let { done: e, value: t } = await m.read();