@voltro/devtools 0.85.0 → 0.87.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/THIRD-PARTY-NOTICES.md +1125 -34
  3. package/dist/Devtools.js +327 -0
  4. package/dist/capsuleClearance.js +42 -0
  5. package/dist/capsulePlacement.js +66 -0
  6. package/dist/components/boundary.js +47 -0
  7. package/dist/components/dockMenu.js +121 -0
  8. package/dist/components/icons.js +236 -0
  9. package/dist/components/primitives.js +75 -0
  10. package/dist/console/Capsule.js +169 -0
  11. package/dist/console/Console.js +508 -0
  12. package/dist/console/InspectRefusals.js +89 -0
  13. package/dist/console/searchIndex.js +63 -0
  14. package/dist/console/sources.js +106 -0
  15. package/dist/consoleBridge.js +76 -0
  16. package/dist/externalWindow.js +9 -0
  17. package/dist/index.js +3 -4382
  18. package/dist/inspectAuth.js +16 -0
  19. package/dist/inspectFetch.js +46 -0
  20. package/dist/inspectRefusal.js +45 -0
  21. package/dist/inspectStream.js +88 -0
  22. package/dist/logsBus.js +22 -0
  23. package/dist/panels/desktop.js +101 -0
  24. package/dist/panels/indexes.js +233 -0
  25. package/dist/panels/logs.js +55 -0
  26. package/dist/panels/mutations.js +81 -0
  27. package/dist/panels/pwa.js +171 -0
  28. package/dist/panels/routes.js +69 -0
  29. package/dist/panels/runtimes.js +67 -0
  30. package/dist/panels/stores.js +125 -0
  31. package/dist/panels/subscriptions.js +117 -0
  32. package/dist/panels/traces.js +160 -0
  33. package/dist/panels/webhooks.js +248 -0
  34. package/dist/panels/workflows.js +478 -0
  35. package/dist/pushPage.js +36 -0
  36. package/dist/shadowHost.js +77 -0
  37. package/dist/strings.js +332 -0
  38. package/dist/styles.css +20 -0
  39. package/dist/useCapsuleClearance.js +85 -0
  40. package/dist/useDevStatuses.js +6 -0
  41. package/dist/useDock.js +181 -0
  42. package/dist/useDocumentVisible.js +5 -0
  43. package/dist/useLiveCacheEntries.js +19 -0
  44. package/package.json +4 -4
@@ -0,0 +1,160 @@
1
+ import { ChevronDown as e } from "../components/icons.js";
2
+ import { useDevtoolsStrings as t } from "../strings.js";
3
+ import { useInspectToken as n } from "../inspectAuth.js";
4
+ import { fetchInspect as r } from "../inspectFetch.js";
5
+ import { useDocumentVisible as i } from "../useDocumentVisible.js";
6
+ import { useEffect as a, useState as o } from "react";
7
+ import { useFrameworkRuntimes as s } from "@voltro/client";
8
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ //#region src/panels/traces.tsx
10
+ var d = 4e3, f = async (e, t, n = !1) => {
11
+ if (e === "") return null;
12
+ let i = await r(`${e}/_voltro/inspect/traces${n ? "?includeBackground=1" : ""}`, t);
13
+ return i !== null && Array.isArray(i.traces) ? i : null;
14
+ }, p = [], m = (e, t = !1) => {
15
+ let r = s(), c = i(), l = n(), u = r.names.join(","), [m, h] = o(p), g = e && c;
16
+ return a(() => {
17
+ if (!g) {
18
+ h(p);
19
+ return;
20
+ }
21
+ let e = u === "" ? [] : u.split(",").map((e) => ({
22
+ name: e,
23
+ baseUrl: r.get(e).inspectBaseUrl
24
+ })).filter((e) => e.baseUrl !== "");
25
+ if (e.length === 0) {
26
+ h(p);
27
+ return;
28
+ }
29
+ let n = !1, i = async () => {
30
+ let r = await Promise.all(e.map((e) => f(e.baseUrl, l, t)));
31
+ if (n) return;
32
+ let i = [];
33
+ r.forEach((t, n) => {
34
+ if (t !== null) for (let r of t.traces) i.push({
35
+ apiName: e[n].name,
36
+ trace: r
37
+ });
38
+ }), h(i);
39
+ };
40
+ i();
41
+ let a = setInterval(i, d);
42
+ return () => {
43
+ n = !0, clearInterval(a);
44
+ };
45
+ }, [
46
+ r,
47
+ u,
48
+ g,
49
+ l,
50
+ t
51
+ ]), m;
52
+ }, h = (e) => e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(2)}s`, g = (e) => {
53
+ let t = new Map(e.map((e) => [e.spanId, e])), n = /* @__PURE__ */ new Map(), r = (e, i) => {
54
+ if (n.has(e.spanId)) return n.get(e.spanId);
55
+ if (i > 64 || e.parentSpanId === null) return n.set(e.spanId, 0), 0;
56
+ let a = t.get(e.parentSpanId), o = a ? r(a, i + 1) + 1 : 0;
57
+ return n.set(e.spanId, o), o;
58
+ };
59
+ for (let t of e) r(t, 0);
60
+ return n;
61
+ }, _ = (e) => {
62
+ if (typeof e == "string") return e;
63
+ try {
64
+ return JSON.stringify(e, null, 2) ?? String(e);
65
+ } catch {
66
+ return String(e);
67
+ }
68
+ }, v = ({ trace: n }) => {
69
+ let r = t().traces, i = g(n.spans), a = new Set(n.spans.map((e) => e.spanId)), o = n.spans.some((e) => e.parentSpanId !== null && !a.has(e.parentSpanId)), s = n.spans.length > 0 && n.spans.every((e) => e.name.startsWith("sql.")), d = n.durationMs > 0 ? n.durationMs : 1;
70
+ return /* @__PURE__ */ u("div", {
71
+ className: "vdt-trace-detail",
72
+ children: [
73
+ /* @__PURE__ */ u("div", {
74
+ className: "vdt-trace-summary",
75
+ children: [/* @__PURE__ */ l("span", { children: r.spans(n.spanCount) }), n.kind === "subscription" ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("span", { children: [
76
+ n.deliveryCount ?? 0,
77
+ " ",
78
+ r.delivery(n.deliveryCount ?? 0)
79
+ ] }), n.lastDeliveryMs === void 0 ? null : /* @__PURE__ */ u("span", { children: [
80
+ r.lastDelivery,
81
+ ": ",
82
+ /* @__PURE__ */ l("strong", { children: h(n.lastDeliveryMs) })
83
+ ] })] }) : /* @__PURE__ */ u("span", { children: [
84
+ r.duration,
85
+ ": ",
86
+ /* @__PURE__ */ l("strong", { children: h(n.durationMs) })
87
+ ] })]
88
+ }),
89
+ /* @__PURE__ */ u("code", {
90
+ className: "vdt-trace-id",
91
+ children: ["trace ", n.traceId]
92
+ }),
93
+ o || s ? /* @__PURE__ */ l("p", {
94
+ className: "vdt-trace-context",
95
+ children: o ? r.missingParents : r.sqlWithoutCaller
96
+ }) : null,
97
+ n.spans.map((t) => {
98
+ let a = Math.min(i.get(t.spanId) ?? 0, 8), o = Math.max(0, Math.min(100, (t.startMs - n.startMs) / d * 100)), s = Math.max(0, Math.min(100 - o, Math.max(1.5, t.durationMs / d * 100))), f = Object.entries(t.attributes);
99
+ return /* @__PURE__ */ u("details", {
100
+ className: "vdt-trace-span",
101
+ open: t.status === "error",
102
+ "data-status": t.status,
103
+ children: [/* @__PURE__ */ u("summary", {
104
+ className: "vdt-trace-span-head",
105
+ style: { paddingLeft: 8 + a * 8 },
106
+ children: [
107
+ /* @__PURE__ */ u("span", {
108
+ className: "vdt-trace-span-label",
109
+ children: [/* @__PURE__ */ l(e, { className: "vdt-trace-chevron" }), /* @__PURE__ */ l("code", {
110
+ className: "vdt-trace-span-name",
111
+ children: t.name
112
+ })]
113
+ }),
114
+ /* @__PURE__ */ l("span", {
115
+ className: "vdt-trace-span-duration",
116
+ children: h(t.durationMs)
117
+ }),
118
+ /* @__PURE__ */ l("span", {
119
+ className: "vdt-trace-span-bar",
120
+ "aria-hidden": "true",
121
+ children: /* @__PURE__ */ l("span", { style: {
122
+ left: `${o}%`,
123
+ width: `${s}%`
124
+ } })
125
+ })
126
+ ]
127
+ }), /* @__PURE__ */ u("div", {
128
+ className: "vdt-trace-span-body",
129
+ children: [
130
+ /* @__PURE__ */ u("div", {
131
+ className: "vdt-trace-span-meta",
132
+ children: [
133
+ /* @__PURE__ */ l("span", { children: t.kind }),
134
+ /* @__PURE__ */ l("span", { children: t.status }),
135
+ /* @__PURE__ */ l("code", { children: t.spanId })
136
+ ]
137
+ }),
138
+ t.statusMessage ? /* @__PURE__ */ l("p", {
139
+ className: "vdt-trace-span-message",
140
+ children: t.statusMessage
141
+ }) : null,
142
+ f.length > 0 ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
143
+ className: "vdt-trace-attributes-label",
144
+ children: r.attributes
145
+ }), /* @__PURE__ */ l("dl", {
146
+ className: "vdt-trace-attributes",
147
+ children: f.map(([e, t]) => /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("dt", { children: e }), /* @__PURE__ */ l("dd", { children: /* @__PURE__ */ l("pre", { children: _(t) }) })] }, e))
148
+ })] }) : /* @__PURE__ */ l("p", {
149
+ className: "vdt-trace-no-attributes",
150
+ children: r.noAttributes
151
+ })
152
+ ]
153
+ })]
154
+ }, t.spanId);
155
+ })
156
+ ]
157
+ });
158
+ };
159
+ //#endregion
160
+ export { v as TraceDetail, g as computeDepths, h as fmtDuration, m as useTracesAcrossApis };
@@ -0,0 +1,248 @@
1
+ import { Webhook as e } from "../components/icons.js";
2
+ import { useDevtoolsStrings as t } from "../strings.js";
3
+ import { Badge as n, Card as r, CardBody as i, Empty as a, SectionTitle as o } from "../components/primitives.js";
4
+ import { useInspectToken as s } from "../inspectAuth.js";
5
+ import { fetchInspect as c } from "../inspectFetch.js";
6
+ import { useDocumentVisible as l } from "../useDocumentVisible.js";
7
+ import { useEffect as u, useState as d } from "react";
8
+ import { useFrameworkRuntimes as f } from "@voltro/client";
9
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ //#region src/panels/webhooks.tsx
11
+ var h = {
12
+ outgoing: [],
13
+ incoming: [],
14
+ targets: [],
15
+ deliveries: []
16
+ }, g = 4e3, _ = async (e, t) => {
17
+ if (e === "") return null;
18
+ let n = await c(`${e}/_voltro/inspect/webhooks`, t);
19
+ return n !== null && Array.isArray(n.outgoing) && Array.isArray(n.incoming) ? n : null;
20
+ }, v = (e, t = !0) => {
21
+ let n = l(), r = s(), i = t && n && e !== "", [a, o] = d(h);
22
+ return u(() => {
23
+ if (!i) return;
24
+ let t = !1, n = async () => {
25
+ let n = await _(e, r);
26
+ t || n === null || o(n);
27
+ };
28
+ n();
29
+ let a = setInterval(n, g);
30
+ return () => {
31
+ t = !0, clearInterval(a);
32
+ };
33
+ }, [
34
+ e,
35
+ i,
36
+ r
37
+ ]), a;
38
+ }, y = {
39
+ pending: "neutral",
40
+ inFlight: "info",
41
+ succeeded: "success",
42
+ failed: "danger",
43
+ retryScheduled: "warning"
44
+ }, b = (e) => {
45
+ let t = new Date(e), n = (e) => e < 10 ? `0${e}` : String(e);
46
+ return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
47
+ }, x = (e) => {
48
+ let t = f(), n = l(), r = s(), i = t.names.join(","), [a, o] = d(0), c = e && n;
49
+ return u(() => {
50
+ if (!c) {
51
+ o(0);
52
+ return;
53
+ }
54
+ let e = i === "" ? [] : i.split(",").map((e) => t.get(e).inspectBaseUrl).filter((e) => e !== "");
55
+ if (e.length === 0) {
56
+ o(0);
57
+ return;
58
+ }
59
+ let n = !1, a = async () => {
60
+ let t = await Promise.all(e.map((e) => _(e, r)));
61
+ n || o(t.reduce((e, t) => e + (t === null ? 0 : t.outgoing.length + t.incoming.length + t.targets.length), 0));
62
+ };
63
+ a();
64
+ let s = setInterval(a, g);
65
+ return () => {
66
+ n = !0, clearInterval(s);
67
+ };
68
+ }, [
69
+ t,
70
+ i,
71
+ c,
72
+ r
73
+ ]), a;
74
+ }, S = ({ apiName: a, baseUrl: s }) => {
75
+ let c = v(s), l = t().webhooks;
76
+ return c.outgoing.length + c.incoming.length + c.targets.length + c.deliveries.length > 0 ? /* @__PURE__ */ p("div", {
77
+ className: "vdt:space-y-4",
78
+ children: /* @__PURE__ */ m(r, { children: [/* @__PURE__ */ p(o, {
79
+ Icon: e,
80
+ children: a
81
+ }), /* @__PURE__ */ m(i, { children: [
82
+ c.outgoing.length > 0 ? /* @__PURE__ */ m("div", {
83
+ className: "vdt:mb-4",
84
+ children: [/* @__PURE__ */ p("div", {
85
+ className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
86
+ children: l.outgoing(c.outgoing.length)
87
+ }), /* @__PURE__ */ p("div", {
88
+ className: "vdt:space-y-1",
89
+ children: c.outgoing.map((e) => /* @__PURE__ */ m("div", {
90
+ className: "vdt-record-row vdt:text-sm",
91
+ children: [
92
+ /* @__PURE__ */ p("code", {
93
+ className: "vdt:text-foreground vdt:font-mono",
94
+ children: e.id
95
+ }),
96
+ /* @__PURE__ */ m(n, {
97
+ tone: "neutral",
98
+ children: ["v", e.version]
99
+ }),
100
+ e.description ? /* @__PURE__ */ p("span", {
101
+ className: "vdt-record-description vdt:text-foreground-muted vdt:text-xs",
102
+ children: e.description
103
+ }) : null
104
+ ]
105
+ }, e.id))
106
+ })]
107
+ }) : null,
108
+ c.incoming.length > 0 ? /* @__PURE__ */ m("div", {
109
+ className: "vdt:mb-4",
110
+ children: [/* @__PURE__ */ p("div", {
111
+ className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
112
+ children: l.incoming(c.incoming.length)
113
+ }), /* @__PURE__ */ p("div", {
114
+ className: "vdt:space-y-1",
115
+ children: c.incoming.map((e) => /* @__PURE__ */ m("div", {
116
+ className: "vdt-record-row vdt:text-sm",
117
+ children: [
118
+ /* @__PURE__ */ p("code", {
119
+ className: "vdt:text-foreground vdt:font-mono",
120
+ children: e.path
121
+ }),
122
+ e.provider ? /* @__PURE__ */ p(n, {
123
+ tone: "info",
124
+ children: e.provider
125
+ }) : null,
126
+ e.signatureConfigured ? /* @__PURE__ */ p(n, {
127
+ tone: "success",
128
+ children: l.signed
129
+ }) : /* @__PURE__ */ p(n, {
130
+ tone: "warning",
131
+ children: l.unsigned
132
+ })
133
+ ]
134
+ }, e.id))
135
+ })]
136
+ }) : null,
137
+ c.targets.length > 0 ? /* @__PURE__ */ m("div", {
138
+ className: "vdt:mb-4",
139
+ children: [/* @__PURE__ */ p("div", {
140
+ className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
141
+ children: l.targets(c.targets.length)
142
+ }), /* @__PURE__ */ p("div", {
143
+ className: "vdt:space-y-1",
144
+ children: c.targets.map((e) => {
145
+ let t = c.outgoing.find((t) => t.id === e.event)?.version ?? e.payloadVersion, r = e.payloadVersion === t ? "current" : e.payloadVersion < t ? "behind" : "ahead";
146
+ return /* @__PURE__ */ m("div", {
147
+ className: "vdt-record-row vdt:text-sm",
148
+ children: [
149
+ /* @__PURE__ */ p("code", {
150
+ className: "vdt:text-foreground vdt:font-mono",
151
+ children: e.event
152
+ }),
153
+ /* @__PURE__ */ p("span", {
154
+ className: "vdt:text-foreground-muted",
155
+ children: "→"
156
+ }),
157
+ /* @__PURE__ */ p("span", {
158
+ className: "vdt:text-foreground vdt:text-xs vdt:truncate vdt:max-w-72",
159
+ children: e.url
160
+ }),
161
+ e.active ? /* @__PURE__ */ p(n, {
162
+ tone: "success",
163
+ children: l.active
164
+ }) : /* @__PURE__ */ p(n, {
165
+ tone: "warning",
166
+ children: l.paused
167
+ }),
168
+ r === "current" ? /* @__PURE__ */ m(n, {
169
+ tone: "neutral",
170
+ children: ["v", e.payloadVersion]
171
+ }) : r === "behind" ? /* @__PURE__ */ m(n, {
172
+ tone: "warning",
173
+ children: [
174
+ "v",
175
+ e.payloadVersion,
176
+ " ← current v",
177
+ t
178
+ ]
179
+ }) : /* @__PURE__ */ m(n, {
180
+ tone: "danger",
181
+ children: [
182
+ "v",
183
+ e.payloadVersion,
184
+ " → ahead of v",
185
+ t
186
+ ]
187
+ })
188
+ ]
189
+ }, e.id);
190
+ })
191
+ })]
192
+ }) : null,
193
+ c.deliveries.length > 0 ? /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("div", {
194
+ className: "vdt:text-foreground-muted vdt:text-xs vdt:uppercase vdt:tracking-wider vdt:mb-2",
195
+ children: l.deliveries(c.deliveries.length)
196
+ }), /* @__PURE__ */ p("div", {
197
+ className: "vdt:space-y-0.5 vdt:font-mono vdt:text-xs",
198
+ children: c.deliveries.map((e) => /* @__PURE__ */ m("div", {
199
+ className: "vdt:flex vdt:items-center vdt:gap-2",
200
+ children: [
201
+ /* @__PURE__ */ p("span", {
202
+ className: "vdt:text-foreground-subtle",
203
+ children: b(e.scheduledAt)
204
+ }),
205
+ /* @__PURE__ */ p("span", {
206
+ className: "vdt:text-foreground vdt:min-w-32 vdt:truncate",
207
+ children: e.event
208
+ }),
209
+ /* @__PURE__ */ p(n, {
210
+ tone: y[e.status],
211
+ children: e.status
212
+ }),
213
+ e.responseStatus === null ? null : /* @__PURE__ */ p("span", {
214
+ className: "vdt:text-foreground-muted",
215
+ children: e.responseStatus
216
+ }),
217
+ e.latencyMs === null ? null : /* @__PURE__ */ m("span", {
218
+ className: "vdt:text-foreground-subtle",
219
+ children: [e.latencyMs, "ms"]
220
+ }),
221
+ /* @__PURE__ */ p("span", {
222
+ className: "vdt:text-foreground-subtle",
223
+ children: l.attempt(e.attempt)
224
+ }),
225
+ e.errorMessage ? /* @__PURE__ */ p("span", {
226
+ className: "vdt:text-danger vdt:truncate vdt:max-w-64",
227
+ children: e.errorMessage
228
+ }) : null
229
+ ]
230
+ }, e.id))
231
+ })] }) : null
232
+ ] })] })
233
+ }) : null;
234
+ }, C = () => {
235
+ let e = f(), n = t().webhooks;
236
+ return e.names.length === 0 ? /* @__PURE__ */ p(a, { children: n.empty }) : /* @__PURE__ */ p("div", {
237
+ className: "vdt:space-y-4 vdt:p-3",
238
+ children: e.names.map((t) => {
239
+ let n = e.get(t);
240
+ return /* @__PURE__ */ p(S, {
241
+ apiName: t,
242
+ baseUrl: n.inspectBaseUrl
243
+ }, t);
244
+ })
245
+ });
246
+ };
247
+ //#endregion
248
+ export { C as WebhooksPanel, x as useWebhooksCount };