@hansenexus/hud 0.4.0 → 0.5.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 (157) hide show
  1. package/README.md +603 -9
  2. package/dist/a11y-B5DUaiCs.js +246 -0
  3. package/dist/a11y-panel-p_t4eD7p.js +207 -0
  4. package/dist/{capabilities-CjulXFQX.js → access-C7zlaqj6.js} +1 -90
  5. package/dist/{access-CNvJOwKM.d.ts → access-D_ewAEJG.d.ts} +11 -4
  6. package/dist/access-panel-CEfTr9ZI.js +123 -0
  7. package/dist/adapter-BYoxPYTI.d.ts +33 -0
  8. package/dist/adapter-hcwmJtNx.js +65 -0
  9. package/dist/auto/runtime.d.ts +65 -0
  10. package/dist/auto/runtime.js +50 -0
  11. package/dist/auto.d.ts +15 -0
  12. package/dist/auto.js +33 -0
  13. package/dist/capabilities-rDSKjXpq.js +110 -0
  14. package/dist/capture-CwrIwLqi.js +300 -0
  15. package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +275 -0
  18. package/dist/data-panel-DhxAmP91.js +817 -0
  19. package/dist/data-store-ChF1td_P.js +164 -0
  20. package/dist/define-hud-CHPedaQ5.d.ts +50 -0
  21. package/dist/design-D0kGgPoP.js +87 -0
  22. package/dist/detect-BxHZ0pxW.d.ts +25 -0
  23. package/dist/detect-CHZiSeZs.js +63 -0
  24. package/dist/dispatch-panel-B-xr_Giy.js +279 -0
  25. package/dist/{env-vEjyJfPW.d.ts → env-CApnbI0r.d.ts} +2 -0
  26. package/dist/{env-DfxpPfs9.js → env-CaiFPIhF.js} +3 -0
  27. package/dist/file-xdSaQ2uR.js +103 -0
  28. package/dist/flags-DVtaJ8pQ.d.ts +58 -0
  29. package/dist/flags.d.ts +2 -0
  30. package/dist/flags.js +82 -0
  31. package/dist/force-state-panel-_otVYh9i.js +97 -0
  32. package/dist/generate-C8lQl3Eh.js +53 -0
  33. package/dist/handler-BpVhxEmU.js +106 -0
  34. package/dist/{handler-WmE4Lu7l.d.ts → handler-DtYVCZY6.d.ts} +1 -1
  35. package/dist/index-BAV_1W8a.d.ts +43 -0
  36. package/dist/index-BJ26pse9.d.ts +70 -0
  37. package/dist/index-BnQ0dTZf.d.ts +19 -0
  38. package/dist/index-CwfX-W87.d.ts +72 -0
  39. package/dist/index-DcH9V3cU.d.ts +48 -0
  40. package/dist/index-DqOyNf1u.d.ts +65 -0
  41. package/dist/index-DstI_ike.d.ts +66 -0
  42. package/dist/index-Dxz4fn4j.d.ts +42 -0
  43. package/dist/index-Hhh7OXzU.d.ts +129 -0
  44. package/dist/index-ReFbhQ9p.d.ts +25 -0
  45. package/dist/index-RgXfMBuW.d.ts +48 -0
  46. package/dist/{index-BYsdS-7d.d.ts → index-gCZBO53s.d.ts} +21 -3
  47. package/dist/index.d.ts +5 -5
  48. package/dist/index.js +710 -69
  49. package/dist/inspect-C9Ft8fqn.js +142 -0
  50. package/dist/inspect-root-BkaupBMp.js +429 -0
  51. package/dist/meta-Bv0sEao3.js +6 -0
  52. package/dist/meta-C_G7MB5w.d.ts +49 -0
  53. package/dist/mocks-CA-wM2SB.d.ts +109 -0
  54. package/dist/mocks-ESiRqk9o.js +150 -0
  55. package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
  56. package/dist/next/config.d.ts +52 -0
  57. package/dist/next/config.js +78 -0
  58. package/dist/next.d.ts +14 -4
  59. package/dist/next.js +5 -3
  60. package/dist/observe-CdDnDBRP.js +89 -0
  61. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  62. package/dist/ops-panel-CEqDe_UT.js +234 -0
  63. package/dist/{payload-CLKDVZWl.d.ts → payload-MUQ9ciER.d.ts} +25 -1
  64. package/dist/plugins/a11y.d.ts +2 -0
  65. package/dist/plugins/a11y.js +2 -0
  66. package/dist/plugins/access/server.d.ts +5 -5
  67. package/dist/plugins/access/server.js +4 -3
  68. package/dist/plugins/access.d.ts +5 -5
  69. package/dist/plugins/access.js +16 -215
  70. package/dist/plugins/agent/server.d.ts +3 -38
  71. package/dist/plugins/agent/server.js +47 -21
  72. package/dist/plugins/agent.d.ts +4 -4
  73. package/dist/plugins/agent.js +6 -348
  74. package/dist/plugins/capture/server.d.ts +92 -0
  75. package/dist/plugins/capture/server.js +248 -0
  76. package/dist/plugins/capture.d.ts +24 -0
  77. package/dist/plugins/capture.js +70 -0
  78. package/dist/plugins/data/msw-browser.d.ts +2 -0
  79. package/dist/plugins/data/msw-browser.js +39 -0
  80. package/dist/plugins/data/msw-node.d.ts +36 -0
  81. package/dist/plugins/data/msw-node.js +68 -0
  82. package/dist/plugins/data/server.d.ts +257 -0
  83. package/dist/plugins/data/server.js +717 -0
  84. package/dist/plugins/data.d.ts +6 -0
  85. package/dist/plugins/data.js +51 -0
  86. package/dist/plugins/design/server.d.ts +54 -0
  87. package/dist/plugins/design/server.js +198 -0
  88. package/dist/plugins/design.d.ts +4 -124
  89. package/dist/plugins/design.js +4 -619
  90. package/dist/plugins/inspect/convex.d.ts +2 -0
  91. package/dist/plugins/inspect/convex.js +486 -0
  92. package/dist/plugins/inspect/react-query.d.ts +2 -0
  93. package/dist/plugins/inspect/react-query.js +225 -0
  94. package/dist/plugins/inspect/sockets.d.ts +51 -0
  95. package/dist/plugins/inspect/sockets.js +397 -0
  96. package/dist/plugins/inspect/swr.d.ts +2 -0
  97. package/dist/plugins/inspect/swr.js +218 -0
  98. package/dist/plugins/inspect.d.ts +4 -0
  99. package/dist/plugins/inspect.js +3 -0
  100. package/dist/plugins/observe.d.ts +4 -64
  101. package/dist/plugins/observe.js +1 -616
  102. package/dist/plugins/ops/server.d.ts +1 -1
  103. package/dist/plugins/ops/server.js +2 -1
  104. package/dist/plugins/ops.d.ts +2 -1
  105. package/dist/plugins/ops.js +15 -336
  106. package/dist/plugins/routes/server.d.ts +88 -0
  107. package/dist/plugins/routes/server.js +62 -0
  108. package/dist/plugins/routes.d.ts +3 -0
  109. package/dist/plugins/routes.js +216 -0
  110. package/dist/plugins/seo.d.ts +2 -0
  111. package/dist/plugins/seo.js +2 -0
  112. package/dist/plugins/vitals.d.ts +2 -25
  113. package/dist/plugins/vitals.js +3 -2
  114. package/dist/{plugins-CQ_0w1ot.d.ts → plugins-BZvDqGx5.d.ts} +33 -3
  115. package/dist/poll-CjKsWZi8.js +89 -0
  116. package/dist/requests-BwD6MKEq.js +282 -0
  117. package/dist/requests-CJrUf465.d.ts +50 -0
  118. package/dist/review.js +2 -2
  119. package/dist/same-origin-BGet22CC.js +21 -0
  120. package/dist/scan-DzJNXqOk.js +165 -0
  121. package/dist/seo-Dq9q_QkO.js +551 -0
  122. package/dist/seo-panel-CfiY-TnT.js +124 -0
  123. package/dist/server.d.ts +2 -2
  124. package/dist/server.js +2 -105
  125. package/dist/sessions-panel-COvhPAzv.js +98 -0
  126. package/dist/{shortcut-U6ftVY06.js → shortcut-s_mjGeU8.js} +1 -44
  127. package/dist/{types-QJUajwWq.js → state-CjjZPjPJ.js} +13 -8
  128. package/dist/store/convex.d.ts +33 -0
  129. package/dist/store/convex.js +52 -0
  130. package/dist/{vitals-panel-Dvc5dnR-.js → store-CQqIIKTc.js} +1 -29
  131. package/dist/store-Ync9eb1G.js +67 -0
  132. package/dist/store.d.ts +76 -0
  133. package/dist/store.js +188 -0
  134. package/dist/{styles--slk86ZQ.js → styles-BA8ueHoV.js} +13 -3
  135. package/dist/styles-DKU_P8MH.js +139 -0
  136. package/dist/styles-DPpDPmzi.js +68 -0
  137. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  138. package/dist/types-B-ulf2Jp.js +8 -0
  139. package/dist/types-BIgGf-0C.d.ts +25 -0
  140. package/dist/types-BIkI-qN8.js +30 -0
  141. package/dist/{types-DADBRiGk.d.ts → types-Cxh4twqc.d.ts} +1 -1
  142. package/dist/types-DIdPfjtV.js +6 -0
  143. package/dist/types-DaJcsEjO.d.ts +44 -0
  144. package/dist/types-Dn68psVz.d.ts +118 -0
  145. package/dist/types-szkr2QOF.d.ts +39 -0
  146. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  147. package/dist/variant-groups-TIfO3NIj.js +137 -0
  148. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  149. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  150. package/dist/variants-types-CcRf119M.d.ts +63 -0
  151. package/dist/variants.d.ts +43 -0
  152. package/dist/variants.js +83 -0
  153. package/dist/vitals-panel-BCmMUntW.js +30 -0
  154. package/dist/vite.d.ts +37 -0
  155. package/dist/vite.js +134 -0
  156. package/package.json +65 -5
  157. package/dist/define-hud-BBzsSl8b.d.ts +0 -36
@@ -0,0 +1,486 @@
1
+ import { a as preview, i as prettyPreview, o as useNow, r as oneLine, t as ago } from "../../adapter-hcwmJtNx.js";
2
+ import { useState, useSyncExternalStore } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { getFunctionName } from "convex/server";
5
+ const errorText = (error) => error instanceof Error ? error.message : String(error);
6
+ /**
7
+ * What the Convex adapter records: live query subscriptions with their
8
+ * latency and update count, and one-shot calls (mutations, actions, HTTP
9
+ * queries) with their duration. Snapshots are replaced on every change,
10
+ * shaped for `useSyncExternalStore`.
11
+ */
12
+ var ConvexStore = class {
13
+ queries = [];
14
+ calls = [];
15
+ snapshot = {
16
+ queries: [],
17
+ calls: []
18
+ };
19
+ listeners = /* @__PURE__ */ new Set();
20
+ nextId = 1;
21
+ /** The entry for a subscription, created on first sight. */
22
+ query(name, args) {
23
+ const argsPreview = preview(args ?? {});
24
+ const key = `${name} ${argsPreview.text}`;
25
+ const existing = this.queries.find((entry) => entry.key === key);
26
+ if (existing) return existing;
27
+ const entry = {
28
+ id: this.nextId++,
29
+ name,
30
+ key,
31
+ args: argsPreview,
32
+ subscribedAt: Date.now(),
33
+ updates: 0,
34
+ subscribers: 0
35
+ };
36
+ this.queries.push(entry);
37
+ if (this.queries.length > 200) {
38
+ const idle = this.queries.findIndex((candidate) => candidate.subscribers === 0);
39
+ this.queries.splice(idle === -1 ? 0 : idle, 1);
40
+ }
41
+ this.emit();
42
+ return entry;
43
+ }
44
+ subscribed(id, delta) {
45
+ this.patchQuery(id, (entry) => ({ subscribers: Math.max(0, entry.subscribers + delta) }));
46
+ }
47
+ /** A result arrived: the first one sets the latency, later ones count as updates. */
48
+ result(id, value) {
49
+ const now = Date.now();
50
+ this.patchQuery(id, (entry) => ({
51
+ value: preview(value),
52
+ updatedAt: now,
53
+ ...entry.firstResultMs === void 0 ? { firstResultMs: Math.max(0, now - entry.subscribedAt) } : { updates: entry.updates + 1 }
54
+ }));
55
+ }
56
+ /** `error: undefined` clears an earlier error (the query recovered). */
57
+ queryError(id, error) {
58
+ this.patchQuery(id, () => ({
59
+ error: errorText(error),
60
+ updatedAt: Date.now()
61
+ }));
62
+ }
63
+ start(kind, name, args) {
64
+ const call = {
65
+ id: this.nextId++,
66
+ ts: Date.now(),
67
+ kind,
68
+ name,
69
+ args: preview(args ?? {}),
70
+ status: "pending"
71
+ };
72
+ this.calls.push(call);
73
+ if (this.calls.length > 200) this.calls.splice(0, this.calls.length - 200);
74
+ this.emit();
75
+ return call;
76
+ }
77
+ finish(id, result) {
78
+ this.patchCall(id, (call) => ({
79
+ status: "ok",
80
+ durationMs: Date.now() - call.ts,
81
+ result: preview(result)
82
+ }));
83
+ }
84
+ fail(id, error) {
85
+ this.patchCall(id, (call) => ({
86
+ status: "error",
87
+ durationMs: Date.now() - call.ts,
88
+ error: errorText(error)
89
+ }));
90
+ }
91
+ /** Drops finished calls and queries nobody subscribes to. */
92
+ clear() {
93
+ this.queries = this.queries.filter((entry) => entry.subscribers > 0);
94
+ this.calls = this.calls.filter((call) => call.status === "pending");
95
+ this.emit();
96
+ }
97
+ getSnapshot = () => this.snapshot;
98
+ subscribe = (listener) => {
99
+ this.listeners.add(listener);
100
+ return () => this.listeners.delete(listener);
101
+ };
102
+ patchQuery(id, patch) {
103
+ const index = this.queries.findIndex((entry) => entry.id === id);
104
+ const entry = this.queries[index];
105
+ if (!entry) return;
106
+ this.queries[index] = {
107
+ ...entry,
108
+ ...patch(entry)
109
+ };
110
+ this.emit();
111
+ }
112
+ patchCall(id, patch) {
113
+ const index = this.calls.findIndex((call) => call.id === id);
114
+ const call = this.calls[index];
115
+ if (!call) return;
116
+ this.calls[index] = {
117
+ ...call,
118
+ ...patch(call)
119
+ };
120
+ this.emit();
121
+ }
122
+ emit() {
123
+ this.snapshot = {
124
+ queries: [...this.queries],
125
+ calls: [...this.calls]
126
+ };
127
+ for (const listener of this.listeners) listener();
128
+ }
129
+ };
130
+ function useConvexSnapshot(store) {
131
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
132
+ }
133
+ //#endregion
134
+ //#region src/plugins/inspect/convex/panel.tsx
135
+ function queryLevel(entry) {
136
+ if (entry.error !== void 0) return "error";
137
+ return entry.value === void 0 ? "pending" : "ok";
138
+ }
139
+ function callLevel(call) {
140
+ return call.status === "ok" ? "ok" : call.status === "error" ? "error" : "pending";
141
+ }
142
+ /** Live queries first, then mutations and actions; click a row for args and the result. */
143
+ function ConvexPanel({ store }) {
144
+ const { queries, calls } = useConvexSnapshot(store);
145
+ const [selected, setSelected] = useState(null);
146
+ const now = useNow();
147
+ const live = queries.filter((entry) => entry.subscribers > 0).length;
148
+ const queryRows = [...queries].slice(-100).reverse();
149
+ const callRows = [...calls].slice(-100).reverse();
150
+ const toggle = (next) => setSelected((current) => current?.kind === next.kind && current.id === next.id ? null : next);
151
+ const currentQuery = selected?.kind === "query" ? queries.find((entry) => entry.id === selected.id) : void 0;
152
+ const currentCall = selected?.kind === "call" ? calls.find((call) => call.id === selected.id) : void 0;
153
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
154
+ /* @__PURE__ */ jsxs("div", {
155
+ className: "insp-toolbar",
156
+ role: "toolbar",
157
+ "aria-label": "Convex",
158
+ children: [
159
+ /* @__PURE__ */ jsx("span", {
160
+ className: "insp-chip",
161
+ children: live === 1 ? "1 live query" : `${live} live queries`
162
+ }),
163
+ /* @__PURE__ */ jsx("span", {
164
+ className: "insp-chip",
165
+ children: calls.length === 1 ? "1 call" : `${calls.length} calls`
166
+ }),
167
+ /* @__PURE__ */ jsx("button", {
168
+ type: "button",
169
+ className: "insp-chip insp-clear",
170
+ onClick: () => {
171
+ store.clear();
172
+ setSelected(null);
173
+ },
174
+ children: "clear"
175
+ })
176
+ ]
177
+ }),
178
+ /* @__PURE__ */ jsx("p", {
179
+ className: "insp-heading",
180
+ children: "Queries"
181
+ }),
182
+ /* @__PURE__ */ jsx("div", {
183
+ className: "insp-log",
184
+ role: "listbox",
185
+ "aria-label": "Convex queries",
186
+ children: queryRows.length === 0 ? /* @__PURE__ */ jsx("p", {
187
+ className: "empty",
188
+ children: "No Convex queries yet. useQuery subscriptions land here."
189
+ }) : queryRows.map((entry) => /* @__PURE__ */ jsxs("button", {
190
+ type: "button",
191
+ role: "option",
192
+ className: "insp-row",
193
+ "data-idle": entry.subscribers === 0,
194
+ "aria-selected": currentQuery?.id === entry.id,
195
+ onClick: () => toggle({
196
+ kind: "query",
197
+ id: entry.id
198
+ }),
199
+ children: [
200
+ /* @__PURE__ */ jsx("span", {
201
+ className: "insp-method",
202
+ children: "query"
203
+ }),
204
+ /* @__PURE__ */ jsxs("span", {
205
+ className: "insp-url",
206
+ title: entry.key,
207
+ children: [
208
+ entry.name,
209
+ " ",
210
+ oneLine(entry.args.text, 30)
211
+ ]
212
+ }),
213
+ /* @__PURE__ */ jsx("span", {
214
+ className: "insp-status",
215
+ "data-level": queryLevel(entry),
216
+ children: entry.error !== void 0 ? "ERR" : entry.value === void 0 ? "…" : "ok"
217
+ }),
218
+ entry.firstResultMs !== void 0 && /* @__PURE__ */ jsxs("span", {
219
+ className: "insp-ms",
220
+ children: [entry.firstResultMs, " ms"]
221
+ }),
222
+ /* @__PURE__ */ jsxs("span", {
223
+ className: "insp-sub",
224
+ children: [
225
+ entry.subscribers === 0 ? "idle" : `${entry.subscribers} sub`,
226
+ " ·",
227
+ " ",
228
+ entry.updates === 1 ? "1 update" : `${entry.updates} updates`,
229
+ " · updated",
230
+ " ",
231
+ ago(entry.updatedAt, now)
232
+ ]
233
+ })
234
+ ]
235
+ }, entry.id))
236
+ }),
237
+ /* @__PURE__ */ jsx("p", {
238
+ className: "insp-heading",
239
+ children: "Mutations & actions"
240
+ }),
241
+ /* @__PURE__ */ jsx("div", {
242
+ className: "insp-log",
243
+ role: "listbox",
244
+ "aria-label": "Convex calls",
245
+ children: callRows.length === 0 ? /* @__PURE__ */ jsx("p", {
246
+ className: "empty",
247
+ children: "No mutations or actions yet."
248
+ }) : callRows.map((call) => /* @__PURE__ */ jsxs("button", {
249
+ type: "button",
250
+ role: "option",
251
+ className: "insp-row",
252
+ "aria-selected": currentCall?.id === call.id,
253
+ onClick: () => toggle({
254
+ kind: "call",
255
+ id: call.id
256
+ }),
257
+ children: [
258
+ /* @__PURE__ */ jsx("span", {
259
+ className: "insp-method",
260
+ children: call.kind
261
+ }),
262
+ /* @__PURE__ */ jsxs("span", {
263
+ className: "insp-url",
264
+ title: call.name,
265
+ children: [
266
+ call.name,
267
+ " ",
268
+ oneLine(call.args.text, 30)
269
+ ]
270
+ }),
271
+ /* @__PURE__ */ jsx("span", {
272
+ className: "insp-status",
273
+ "data-level": callLevel(call),
274
+ children: call.status === "ok" ? "ok" : call.status === "error" ? "ERR" : "…"
275
+ }),
276
+ call.durationMs !== void 0 && /* @__PURE__ */ jsxs("span", {
277
+ className: "insp-ms",
278
+ children: [call.durationMs, " ms"]
279
+ })
280
+ ]
281
+ }, call.id))
282
+ }),
283
+ currentQuery && /* @__PURE__ */ jsx(QueryDetail, {
284
+ entry: currentQuery,
285
+ now
286
+ }),
287
+ currentCall && /* @__PURE__ */ jsx(CallDetail, { call: currentCall })
288
+ ] });
289
+ }
290
+ function QueryDetail({ entry, now }) {
291
+ return /* @__PURE__ */ jsxs("section", {
292
+ className: "insp-detail",
293
+ "aria-label": "Query detail",
294
+ children: [
295
+ /* @__PURE__ */ jsxs("dl", {
296
+ className: "insp-kv",
297
+ children: [
298
+ /* @__PURE__ */ jsx("dt", { children: "query" }),
299
+ /* @__PURE__ */ jsx("dd", { children: entry.name }),
300
+ /* @__PURE__ */ jsx("dt", { children: "first result" }),
301
+ /* @__PURE__ */ jsx("dd", { children: entry.firstResultMs === void 0 ? "pending" : `${entry.firstResultMs} ms` }),
302
+ /* @__PURE__ */ jsx("dt", { children: "subscribers" }),
303
+ /* @__PURE__ */ jsx("dd", { children: entry.subscribers }),
304
+ /* @__PURE__ */ jsx("dt", { children: "updates" }),
305
+ /* @__PURE__ */ jsx("dd", { children: entry.updates }),
306
+ /* @__PURE__ */ jsx("dt", { children: "updated" }),
307
+ /* @__PURE__ */ jsx("dd", { children: ago(entry.updatedAt, now) }),
308
+ entry.error !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: "error" }), /* @__PURE__ */ jsx("dd", {
309
+ className: "insp-error",
310
+ children: entry.error
311
+ })] })
312
+ ]
313
+ }),
314
+ /* @__PURE__ */ jsxs("details", {
315
+ className: "insp-section",
316
+ open: true,
317
+ children: [/* @__PURE__ */ jsx("summary", { children: "Args" }), /* @__PURE__ */ jsx("pre", {
318
+ className: "insp-body",
319
+ "data-section": "args",
320
+ children: prettyPreview(entry.args)
321
+ })]
322
+ }),
323
+ entry.value && /* @__PURE__ */ jsxs("details", {
324
+ className: "insp-section",
325
+ open: true,
326
+ children: [/* @__PURE__ */ jsx("summary", { children: "Result" }), /* @__PURE__ */ jsx("pre", {
327
+ className: "insp-body",
328
+ "data-section": "result",
329
+ children: prettyPreview(entry.value)
330
+ })]
331
+ })
332
+ ]
333
+ });
334
+ }
335
+ function CallDetail({ call }) {
336
+ return /* @__PURE__ */ jsxs("section", {
337
+ className: "insp-detail",
338
+ "aria-label": "Call detail",
339
+ children: [
340
+ /* @__PURE__ */ jsxs("dl", {
341
+ className: "insp-kv",
342
+ children: [
343
+ /* @__PURE__ */ jsx("dt", { children: call.kind }),
344
+ /* @__PURE__ */ jsx("dd", { children: call.name }),
345
+ /* @__PURE__ */ jsx("dt", { children: "status" }),
346
+ /* @__PURE__ */ jsx("dd", { children: call.status }),
347
+ call.durationMs !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: "time" }), /* @__PURE__ */ jsxs("dd", { children: [call.durationMs, " ms"] })] }),
348
+ call.error !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: "error" }), /* @__PURE__ */ jsx("dd", {
349
+ className: "insp-error",
350
+ children: call.error
351
+ })] })
352
+ ]
353
+ }),
354
+ /* @__PURE__ */ jsxs("details", {
355
+ className: "insp-section",
356
+ open: true,
357
+ children: [/* @__PURE__ */ jsx("summary", { children: "Args" }), /* @__PURE__ */ jsx("pre", {
358
+ className: "insp-body",
359
+ "data-section": "args",
360
+ children: prettyPreview(call.args)
361
+ })]
362
+ }),
363
+ call.result && /* @__PURE__ */ jsxs("details", {
364
+ className: "insp-section",
365
+ open: true,
366
+ children: [/* @__PURE__ */ jsx("summary", { children: "Result" }), /* @__PURE__ */ jsx("pre", {
367
+ className: "insp-body",
368
+ "data-section": "result",
369
+ children: prettyPreview(call.result)
370
+ })]
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ //#endregion
376
+ //#region src/plugins/inspect/convex/index.tsx
377
+ function nameOf(reference) {
378
+ try {
379
+ return getFunctionName(reference);
380
+ } catch {
381
+ return typeof reference === "string" ? reference : "[unknown function]";
382
+ }
383
+ }
384
+ /**
385
+ * Convex tab for the inspect plugin: every live query with its latency to
386
+ * the first result, update count and subscriber count, and every mutation,
387
+ * action and one-shot query with its duration and result. Args and results
388
+ * are redacted like request bodies. Wraps the client's methods when called,
389
+ * so subscriptions made before the HUD mounts are seen; `dispose()` restores
390
+ * the client.
391
+ */
392
+ function inspectConvex({ client }) {
393
+ const store = new ConvexStore();
394
+ const restorers = [];
395
+ const { watchQuery, onUpdate, mutation, action, query } = client;
396
+ if (watchQuery) {
397
+ client.watchQuery = function patchedWatchQuery(ref, ...rest) {
398
+ const watch = watchQuery.call(this, ref, ...rest);
399
+ const entry = store.query(nameOf(ref), rest[0]);
400
+ try {
401
+ const value = watch.localQueryResult();
402
+ if (value !== void 0) store.result(entry.id, value);
403
+ } catch (error) {
404
+ store.queryError(entry.id, error);
405
+ }
406
+ const wrappedOnUpdate = (callback) => {
407
+ store.subscribed(entry.id, 1);
408
+ const unsubscribe = watch.onUpdate(() => {
409
+ try {
410
+ store.result(entry.id, watch.localQueryResult());
411
+ } catch (error) {
412
+ store.queryError(entry.id, error);
413
+ }
414
+ callback();
415
+ });
416
+ return () => {
417
+ store.subscribed(entry.id, -1);
418
+ unsubscribe();
419
+ };
420
+ };
421
+ return new Proxy(watch, { get(target, property, receiver) {
422
+ if (property === "onUpdate") return wrappedOnUpdate;
423
+ const value = Reflect.get(target, property, receiver);
424
+ return typeof value === "function" ? value.bind(target) : value;
425
+ } });
426
+ };
427
+ restorers.push(() => {
428
+ client.watchQuery = watchQuery;
429
+ });
430
+ }
431
+ if (onUpdate) {
432
+ client.onUpdate = function patchedOnUpdate(ref, args, callback, onError) {
433
+ const entry = store.query(nameOf(ref), args);
434
+ store.subscribed(entry.id, 1);
435
+ const unsubscribe = onUpdate.call(this, ref, args, (result) => {
436
+ store.result(entry.id, result);
437
+ return callback(result);
438
+ }, (error) => {
439
+ store.queryError(entry.id, error);
440
+ return onError?.(error);
441
+ });
442
+ return Object.assign(() => {
443
+ store.subscribed(entry.id, -1);
444
+ return unsubscribe();
445
+ }, unsubscribe);
446
+ };
447
+ restorers.push(() => {
448
+ client.onUpdate = onUpdate;
449
+ });
450
+ }
451
+ const wrapCall = (kind, original) => function patchedCall(ref, ...args) {
452
+ const call = store.start(kind, nameOf(ref), args[0]);
453
+ const promise = original.call(this, ref, ...args);
454
+ promise.then((result) => store.finish(call.id, result), (error) => store.fail(call.id, error));
455
+ return promise;
456
+ };
457
+ if (mutation) {
458
+ client.mutation = wrapCall("mutation", mutation);
459
+ restorers.push(() => {
460
+ client.mutation = mutation;
461
+ });
462
+ }
463
+ if (action) {
464
+ client.action = wrapCall("action", action);
465
+ restorers.push(() => {
466
+ client.action = action;
467
+ });
468
+ }
469
+ if (query) {
470
+ client.query = wrapCall("query", query);
471
+ restorers.push(() => {
472
+ client.query = query;
473
+ });
474
+ }
475
+ return {
476
+ id: "convex",
477
+ title: "Convex",
478
+ Panel: () => /* @__PURE__ */ jsx(ConvexPanel, { store }),
479
+ useCount: () => useConvexSnapshot(store).queries.filter((entry) => entry.subscribers > 0).length,
480
+ dispose: () => {
481
+ while (restorers.length > 0) restorers.pop()?.();
482
+ }
483
+ };
484
+ }
485
+ //#endregion
486
+ export { inspectConvex };
@@ -0,0 +1,2 @@
1
+ import { i as inspectReactQuery, n as QueryClientLike, r as QueryLike, t as InspectReactQueryOptions } from "../../index-RgXfMBuW.js";
2
+ export { InspectReactQueryOptions, QueryClientLike, QueryLike, inspectReactQuery };