@debugkit/dashboard 0.8.0 → 0.10.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 (79) hide show
  1. package/dist/client/assets/_authed-3se5Egqg.js +1 -0
  2. package/dist/client/assets/_authed-BfFWbTOO.js +1 -0
  3. package/dist/client/assets/app-code-BKWbvUMR.js +1 -0
  4. package/dist/client/assets/closed-issues-Cl-8l4oR.js +1 -0
  5. package/dist/client/assets/{copy-button-ORgLIh59.js → copy-button-BwRd5q7l.js} +1 -1
  6. package/dist/client/assets/customers-Cf-R8BOg.js +1 -0
  7. package/dist/client/assets/empty-state-njgr1sWu.js +7 -0
  8. package/dist/client/assets/endpoints-BMqAUNyE.js +1 -0
  9. package/dist/client/assets/events._eventId-CVRZJ-bU.js +2 -0
  10. package/dist/client/assets/exchange-view-DVwSLcXF.js +2 -0
  11. package/dist/client/assets/index-DEnCDILF.js +10 -0
  12. package/dist/client/assets/{invite._token-CxXek2SP.js → invite._token-CKAfd5iB.js} +1 -1
  13. package/dist/client/assets/issues._fingerprint-Cm72LNM_.js +55 -0
  14. package/dist/client/assets/login-BTxOhEbN.js +1 -0
  15. package/dist/client/assets/request-panel-DmtFRF8Z.js +1 -0
  16. package/dist/client/assets/services._service-CU1a45f3.js +1 -0
  17. package/dist/client/assets/{sessions._sessionId-3wNImMqM.js → sessions._sessionId-LRo3QNQP.js} +1 -1
  18. package/dist/client/assets/settings-Ctzvl2LL.js +1 -0
  19. package/dist/client/assets/src-BiKxgjA_.js +3 -0
  20. package/dist/client/assets/styles-Tcq0pvWj.css +2 -0
  21. package/dist/client/assets/{team-Bud2-07A.js → team-xlrjhEGp.js} +1 -1
  22. package/dist/client/assets/{timeline-BSDhQPpY.js → timeline-WXE49N62.js} +1 -1
  23. package/dist/client/assets/ui-DRjjeSWy.js +1 -0
  24. package/dist/client/assets/version-banner-BYe4PVzv.js +1 -0
  25. package/dist/server/assets/_authed-Bn-IktVS.js +120 -0
  26. package/dist/server/assets/_authed-RXh7GpoE.js +252 -0
  27. package/dist/server/assets/_tanstack-start-manifest_v-C4dQ3MxD.js +122 -0
  28. package/dist/server/assets/app-code-BQL_FcSx.js +212 -0
  29. package/dist/server/assets/app-name-BcbY1BZN.js +11 -0
  30. package/dist/server/assets/closed-issues-o9U80FXv.js +45 -0
  31. package/dist/server/assets/config-Bp8m0B8q.js +57 -0
  32. package/dist/server/assets/{customers-CvSLt_xV.js → customers-CD84Bz4P.js} +11 -6
  33. package/dist/server/assets/{demo-BRTkdmQJ.js → demo-D-o8m75S.js} +225 -8
  34. package/dist/server/assets/{dynamodb-B0V3ZO20.js → dynamodb-CcH0cp7R.js} +55 -2
  35. package/dist/server/assets/empty-state-wz34oAi8.js +163 -0
  36. package/dist/server/assets/endpoints-8N389Poe.js +248 -0
  37. package/dist/server/assets/{endpoints-mPQXpH8C.js → endpoints-C0Cxc_-x.js} +38 -36
  38. package/dist/server/assets/{events._eventId-pkQBQ9sL.js → events._eventId-BOHkNO5W.js} +90 -351
  39. package/dist/server/assets/exchange-view-DzoSBt_R.js +112 -0
  40. package/dist/server/assets/{firestore-Jd-LeWZI.js → firestore-DyvYMiz3.js} +13 -2
  41. package/dist/server/assets/{fns-Di0vMpkQ.js → fns-BcVGbSID.js} +22 -7
  42. package/dist/server/assets/fns-DE03YExD.js +831 -0
  43. package/dist/server/assets/{invite._token-LwWF5YxP.js → invite._token-DhlACkIe.js} +3 -3
  44. package/dist/server/assets/{issues._fingerprint-DAA0QCuA.js → issues._fingerprint-BBd-_Nn5.js} +400 -28
  45. package/dist/server/assets/{login-DqjCU4DJ.js → login-CbfdHJvg.js} +3 -3
  46. package/dist/server/assets/{memory-aqsrtEUn.js → memory-CZBUh1Zc.js} +129 -5
  47. package/dist/server/assets/{errors-C2KEDL7l.js → queries-wha4cZbw.js} +1442 -129
  48. package/dist/server/assets/request-panel-DpCSwl2q.js +162 -0
  49. package/dist/server/assets/{router-C0Dauj2C.js → router-BXkzR89j.js} +197 -91
  50. package/dist/server/assets/services._service-DWjFFGON.js +309 -0
  51. package/dist/server/assets/{sessions._sessionId-D7JPV0M4.js → sessions._sessionId-DDspiPTe.js} +2 -2
  52. package/dist/server/assets/{settings-Drjd64d7.js → settings-DCLIaZ_p.js} +201 -24
  53. package/dist/server/assets/{src-C4fNgijW.js → src-B2GKPQyN.js} +1 -1
  54. package/dist/server/assets/{team-D7iXYnSE.js → team-jd_TmWP4.js} +3 -3
  55. package/dist/server/assets/ui-C3pl0edn.js +302 -0
  56. package/dist/server/assets/version-banner-BX34ijG5.js +106 -0
  57. package/dist/server/assets/versions-YI_zK1ql.js +58 -0
  58. package/dist/server/assets/warm-C3GbXP1_.js +16 -0
  59. package/dist/server/server.js +40 -28
  60. package/package.json +4 -4
  61. package/dist/client/assets/_authed-CNObwuZh.js +0 -7
  62. package/dist/client/assets/_authed-CuP-He8G.js +0 -1
  63. package/dist/client/assets/charts-CUvev8lV.js +0 -55
  64. package/dist/client/assets/customers-DTMEprFQ.js +0 -1
  65. package/dist/client/assets/endpoints-lMSO2CdM.js +0 -1
  66. package/dist/client/assets/events._eventId-bWag-i8J.js +0 -3
  67. package/dist/client/assets/index-BNpacHyi.js +0 -10
  68. package/dist/client/assets/issues._fingerprint-BQr85TVY.js +0 -1
  69. package/dist/client/assets/login-Dlk3GyyC.js +0 -1
  70. package/dist/client/assets/settings-CzbEYB7k.js +0 -1
  71. package/dist/client/assets/src-Dq5mIUf0.js +0 -3
  72. package/dist/client/assets/styles-DPsgRH7g.css +0 -2
  73. package/dist/client/assets/ui-CEv2y56s.js +0 -1
  74. package/dist/server/assets/_authed-DkkRwdZl.js +0 -87
  75. package/dist/server/assets/_authed-DsB8kjZB.js +0 -902
  76. package/dist/server/assets/_tanstack-start-manifest_v-D1_ErrJK.js +0 -97
  77. package/dist/server/assets/charts-DzTVqJ8z.js +0 -238
  78. package/dist/server/assets/fns-B3PHbFwV.js +0 -1295
  79. package/dist/server/assets/ui-B_XHlLUQ.js +0 -193
@@ -1,7 +1,8 @@
1
1
  import { t as CopyButton } from "./copy-button-D3RddzTw.js";
2
2
  import { a as joined, i as clock, n as ICON, o as offset, t as CrumbBody } from "./timeline-MDRNDhiA.js";
3
- import { t as Card } from "./ui-B_XHlLUQ.js";
4
- import { i as Route } from "./router-C0Dauj2C.js";
3
+ import { i as Facts, n as Card } from "./ui-C3pl0edn.js";
4
+ import { t as RequestPanel } from "./request-panel-DpCSwl2q.js";
5
+ import { a as Route } from "./router-BXkzR89j.js";
5
6
  import { useEffect, useState } from "react";
6
7
  import { Link } from "@tanstack/react-router";
7
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -126,107 +127,6 @@ function ticketText(summary, link, traceId) {
126
127
  }
127
128
  var upperFirst = (s) => s.charAt(0).toUpperCase() + s.slice(1);
128
129
  var cap = (s) => s === "ios" ? "iOS" : s.charAt(0).toUpperCase() + s.slice(1);
129
- // src/lib/exchange-view.ts
130
- /** The SDK's "[binary 12 KB, image/png]", with the size or the type left out when it didn't know them. */
131
- var BINARY = /^\[binary(?: ([\d.]+ ?[KMG]?B))?(?:, ([^\]]+))?\]$/i;
132
- /** The SDK's cut "…[truncated, 48 KB total]", or ingest's "…[truncated]". */
133
- var CUT = /…\[truncated(?:, ([\d.]+ ?[KMG]?B) total)?\]$/;
134
- /** A byte count: "512 B", "47 KB", "1.2 MB". */
135
- function size(bytes) {
136
- return bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${Math.round(bytes / 1024)} KB` : `${(bytes / 1024 / 1024).toFixed(1)} MB`;
137
- }
138
- /** Text without a cut marker, and whether it had one. */
139
- function uncut(text) {
140
- const m = CUT.exec(text);
141
- return m ? {
142
- text: text.slice(0, m.index),
143
- cut: true,
144
- total: m[1]
145
- } : {
146
- text,
147
- cut: false
148
- };
149
- }
150
- function bodyView(side) {
151
- const body = side.body;
152
- if (body === void 0) return void 0;
153
- const bin = BINARY.exec(body.trim());
154
- if (bin) {
155
- const bytes = bin[1] ?? (side.bodySize !== void 0 ? size(side.bodySize) : void 0);
156
- return {
157
- text: "",
158
- raw: "",
159
- json: false,
160
- cut: false,
161
- binary: true,
162
- note: `Binary${bytes ? `, ${bytes}` : ""}${bin[2] ? ` (${bin[2]})` : ""}: not captured.`
163
- };
164
- }
165
- const u = uncut(body);
166
- const cut = u.cut || !!side.truncated;
167
- const total = u.total ?? (side.bodySize !== void 0 ? `${side.bodySize.toLocaleString("en")} characters` : void 0);
168
- const note = cut ? `Cut after ${u.text.length.toLocaleString("en")} characters${total ? ` of ${total}` : ""}: the rest wasn't captured.` : void 0;
169
- const base = {
170
- raw: u.text,
171
- cut,
172
- binary: false,
173
- note
174
- };
175
- if (!u.text.trim()) return {
176
- ...base,
177
- text: "",
178
- json: false,
179
- note: note ?? "Empty body."
180
- };
181
- try {
182
- return {
183
- ...base,
184
- text: JSON.stringify(JSON.parse(u.text), null, 2),
185
- json: true
186
- };
187
- } catch {
188
- return {
189
- ...base,
190
- text: u.text,
191
- json: false
192
- };
193
- }
194
- }
195
- /** Single-quoted for a POSIX shell: nothing inside is expanded. */
196
- var sh = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
197
- /**
198
- * The request as a cURL command, quoted so pasting it runs nothing but curl. It's what the SDK
199
- * captured, so the command starts with a comment saying what to fill in: secrets show as
200
- * "[redacted]", ids in the path as ":id", a cut or binary body isn't the one sent, and HOST stands
201
- * in when the SDK named the call by its path only.
202
- */
203
- function curlOf(x) {
204
- const r = x.request;
205
- const query = r.query !== void 0 ? uncut(r.query) : void 0;
206
- const base = r.fullUrl ?? `https://HOST${r.url.startsWith("/") ? "" : "/"}${r.url}`;
207
- const url = query?.text ? `${base}?${query.text}` : base;
208
- const parts = [`curl -X ${sh(r.method)} ${sh(url)}`];
209
- for (const [k, v] of Object.entries(r.headers ?? {})) parts.push(`-H ${sh(`${k}: ${v}`)}`);
210
- const body = bodyView(r);
211
- if (body && !body.binary) parts.push(`--data-raw ${sh(body.raw)}`);
212
- const fill = [
213
- [
214
- JSON.stringify(r.headers ?? {}),
215
- r.body ?? "",
216
- r.query ?? ""
217
- ].some((t) => t.includes("[redacted]")) && "secrets show as [redacted]",
218
- /\/:id(\/|$)/.test(r.url) && "ids in the path show as :id",
219
- !r.fullUrl && "replace HOST",
220
- query?.cut && "the query was cut",
221
- body?.cut && "the body was cut",
222
- body?.binary && "the binary body wasn't captured"
223
- ].filter(Boolean);
224
- const command = parts.join(" \\\n ");
225
- return {
226
- command: fill.length ? `# From deBug, as captured: ${fill.join("; ")}.\n${command}` : command,
227
- complete: fill.length === 0
228
- };
229
- }
230
130
  // src/routes/_authed/events.$eventId.tsx?tsr-split=component
231
131
  function EventPage() {
232
132
  const d = Route.useLoaderData();
@@ -309,93 +209,97 @@ function EventPage() {
309
209
  errorTs: d.ts,
310
210
  errorText: "The error"
311
211
  })
312
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
313
- className: "grid gap-5 lg:grid-cols-5",
314
- children: [/* @__PURE__ */ jsx("div", {
315
- className: "min-w-0 lg:col-span-3",
316
- children: /* @__PURE__ */ jsx(Card, {
317
- title: "Timeline",
318
- subtitle: "What happened before the error, in order. Times are from the device, relative to the error.",
319
- children: /* @__PURE__ */ jsx(Timeline, {
320
- items: d.timeline,
321
- errorTs: d.ts,
322
- errorText: `${d.error.name}: ${d.error.message}`
323
- })
212
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
213
+ d.request && /* @__PURE__ */ jsx(Card, {
214
+ title: "The call that failed",
215
+ subtitle: "What the app sent and what the server answered.",
216
+ children: /* @__PURE__ */ jsx(RequestPanel, {
217
+ call: d.request,
218
+ exchange: d.exchange
324
219
  })
325
- }), /* @__PURE__ */ jsxs("div", {
326
- className: "min-w-0 space-y-5 lg:col-span-2",
327
- children: [d.request && /* @__PURE__ */ jsx(Card, {
328
- title: "Request",
329
- subtitle: "The call that failed.",
330
- children: /* @__PURE__ */ jsx(RequestPanel, {
331
- call: d.request,
332
- exchange: d.exchange
333
- })
334
- }), /* @__PURE__ */ jsxs(Card, {
335
- title: "Device and app",
336
- children: [
337
- /* @__PURE__ */ jsx(Facts, { rows: [
338
- ["OS", joined([d.context.os.name, d.context.os.version])],
339
- ["Device", joined([d.context.device.brand, d.context.device.model])],
340
- ["App", joined([d.context.app.version, d.context.app.build && `(${d.context.app.build})`])],
341
- ["Update", d.context.app.update],
342
- ["Environment", d.context.app.environment],
343
- ["Runtime", joined([
344
- d.context.runtime.name,
345
- d.context.runtime.version,
346
- d.context.runtime.engine
347
- ])],
348
- ["Network", joined([d.context.network?.type, d.context.network?.effectiveType])],
349
- ["Locale", joined([d.context.locale, d.context.timezone], " · ")]
350
- ] }),
351
- /* @__PURE__ */ jsx("h3", {
352
- className: "mb-2 mt-4 text-xs font-medium text-muted",
353
- children: "Tags"
354
- }),
355
- d.tags.length ? /* @__PURE__ */ jsx(Facts, {
356
- mono: true,
357
- rows: d.tags.map((t) => [t.key, t.value])
358
- }) : /* @__PURE__ */ jsx("p", {
359
- className: "text-sm text-muted",
360
- children: "No tags on this event."
220
+ }),
221
+ /* @__PURE__ */ jsxs("div", {
222
+ className: "grid gap-5 lg:grid-cols-5",
223
+ children: [/* @__PURE__ */ jsx("div", {
224
+ className: "min-w-0 lg:col-span-3",
225
+ children: /* @__PURE__ */ jsx(Card, {
226
+ title: "Timeline",
227
+ subtitle: "What happened before the error, in order. Times are from the device, relative to the error.",
228
+ children: /* @__PURE__ */ jsx(Timeline, {
229
+ items: d.timeline,
230
+ errorTs: d.ts,
231
+ errorText: `${d.error.name}: ${d.error.message}`
361
232
  })
362
- ]
233
+ })
234
+ }), /* @__PURE__ */ jsx("div", {
235
+ className: "min-w-0 space-y-5 lg:col-span-2",
236
+ children: /* @__PURE__ */ jsxs(Card, {
237
+ title: "Device and app",
238
+ children: [
239
+ /* @__PURE__ */ jsx(Facts, { rows: [
240
+ ["OS", joined([d.context.os.name, d.context.os.version])],
241
+ ["Device", joined([d.context.device.brand, d.context.device.model])],
242
+ ["App", joined([d.context.app.version, d.context.app.build && `(${d.context.app.build})`])],
243
+ ["Update", d.context.app.update],
244
+ ["Environment", d.context.app.environment],
245
+ ["Runtime", joined([
246
+ d.context.runtime.name,
247
+ d.context.runtime.version,
248
+ d.context.runtime.engine
249
+ ])],
250
+ ["Network", joined([d.context.network?.type, d.context.network?.effectiveType])],
251
+ ["Locale", joined([d.context.locale, d.context.timezone], " · ")]
252
+ ] }),
253
+ /* @__PURE__ */ jsx("h3", {
254
+ className: "mb-2 mt-4 text-xs font-medium text-muted",
255
+ children: "Tags"
256
+ }),
257
+ d.tags.length ? /* @__PURE__ */ jsx(Facts, {
258
+ mono: true,
259
+ rows: d.tags.map((t) => [t.key, t.value])
260
+ }) : /* @__PURE__ */ jsx("p", {
261
+ className: "text-sm text-muted",
262
+ children: "No tags on this event."
263
+ })
264
+ ]
265
+ })
363
266
  })]
364
- })]
365
- }), /* @__PURE__ */ jsx(Card, {
366
- title: "Stack trace",
367
- subtitle: "The app's own code first, then libraries and the runtime.",
368
- children: d.frames.length ? /* @__PURE__ */ jsx("ol", {
369
- className: "space-y-1 font-mono text-xs",
370
- children: d.frames.map((f, i) => /* @__PURE__ */ jsxs("li", {
371
- className: `rounded px-2 py-1 ${f.inApp ? "bg-accent-soft text-ink" : "text-muted"}`,
372
- children: [
373
- /* @__PURE__ */ jsx("span", {
374
- className: "font-semibold",
375
- children: f.fn ?? "<anonymous>"
376
- }),
377
- " ",
378
- /* @__PURE__ */ jsxs("span", {
379
- className: "break-all",
380
- children: [
381
- f.file,
382
- ":",
383
- f.line,
384
- ":",
385
- f.col
386
- ]
387
- }),
388
- !f.inApp && /* @__PURE__ */ jsx("span", {
389
- className: "ml-2 text-[10px] uppercase tracking-wide",
390
- children: "library"
391
- })
392
- ]
393
- }, i))
394
- }) : /* @__PURE__ */ jsx("pre", {
395
- className: "overflow-auto whitespace-pre-wrap text-xs text-muted",
396
- children: d.stack ?? "No stack trace captured."
267
+ }),
268
+ /* @__PURE__ */ jsx(Card, {
269
+ title: "Stack trace",
270
+ subtitle: "The app's own code first, then libraries and the runtime.",
271
+ children: d.frames.length ? /* @__PURE__ */ jsx("ol", {
272
+ className: "space-y-1 font-mono text-xs",
273
+ children: d.frames.map((f, i) => /* @__PURE__ */ jsxs("li", {
274
+ className: `rounded px-2 py-1 ${f.inApp ? "bg-accent-soft text-ink" : "text-muted"}`,
275
+ children: [
276
+ /* @__PURE__ */ jsx("span", {
277
+ className: "font-semibold",
278
+ children: f.fn ?? "<anonymous>"
279
+ }),
280
+ " ",
281
+ /* @__PURE__ */ jsxs("span", {
282
+ className: "break-all",
283
+ children: [
284
+ f.file,
285
+ ":",
286
+ f.line,
287
+ ":",
288
+ f.col
289
+ ]
290
+ }),
291
+ !f.inApp && /* @__PURE__ */ jsx("span", {
292
+ className: "ml-2 text-[10px] uppercase tracking-wide",
293
+ children: "library"
294
+ })
295
+ ]
296
+ }, i))
297
+ }) : /* @__PURE__ */ jsx("pre", {
298
+ className: "overflow-auto whitespace-pre-wrap text-xs text-muted",
299
+ children: d.stack ?? "No stack trace captured."
300
+ })
397
301
  })
398
- })] })
302
+ ] })
399
303
  ]
400
304
  });
401
305
  }
@@ -597,169 +501,4 @@ function Timeline({ items, after = [], errorTs, errorText }) {
597
501
  ]
598
502
  });
599
503
  }
600
- /** The failed call; with what the SDK captured, its request and response in tabs of their own. */
601
- function RequestPanel({ call, exchange }) {
602
- const [tab, setTab] = useState("call");
603
- if (!exchange) return /* @__PURE__ */ jsx(CallFacts, { call });
604
- const tabs = [
605
- ["call", "Call"],
606
- ["request", "Request"],
607
- ...exchange.response ? [["response", "Response"]] : []
608
- ];
609
- const ids = tabs.map(([id]) => id);
610
- const onKey = (e) => {
611
- const i = ids.indexOf(tab);
612
- const next = e.key === "ArrowRight" ? ids[(i + 1) % ids.length] : e.key === "ArrowLeft" ? ids[(i - 1 + ids.length) % ids.length] : e.key === "Home" ? ids[0] : e.key === "End" ? ids[ids.length - 1] : void 0;
613
- if (!next) return;
614
- e.preventDefault();
615
- setTab(next);
616
- document.getElementById(`req-tab-${next}`)?.focus();
617
- };
618
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
619
- role: "tablist",
620
- "aria-label": "Request details",
621
- onKeyDown: onKey,
622
- className: "mb-3 flex gap-1 border-b border-line",
623
- children: tabs.map(([id, label]) => /* @__PURE__ */ jsx("button", {
624
- type: "button",
625
- role: "tab",
626
- id: `req-tab-${id}`,
627
- "aria-selected": tab === id,
628
- "aria-controls": `req-panel-${id}`,
629
- tabIndex: tab === id ? 0 : -1,
630
- onClick: () => setTab(id),
631
- className: `-mb-px border-b-2 px-2.5 py-1.5 text-sm ${tab === id ? "border-ink font-medium text-ink" : "border-transparent text-muted hover:text-ink"}`,
632
- children: label
633
- }, id))
634
- }), tabs.map(([id]) => /* @__PURE__ */ jsxs("div", {
635
- role: "tabpanel",
636
- id: `req-panel-${id}`,
637
- "aria-labelledby": `req-tab-${id}`,
638
- hidden: tab !== id,
639
- tabIndex: 0,
640
- children: [
641
- id === "call" && /* @__PURE__ */ jsx(CallFacts, { call }),
642
- id === "request" && /* @__PURE__ */ jsx(RequestSide, { exchange }),
643
- id === "response" && exchange.response && /* @__PURE__ */ jsx(Side, {
644
- side: exchange.response,
645
- first: ["Status", String(exchange.response.status)]
646
- })
647
- ]
648
- }, id))] });
649
- }
650
- function RequestSide({ exchange }) {
651
- const r = exchange.request;
652
- const curl = curlOf(exchange);
653
- const query = r.query !== void 0 ? uncut(r.query) : void 0;
654
- return /* @__PURE__ */ jsxs("div", {
655
- className: "space-y-3",
656
- children: [/* @__PURE__ */ jsx(Side, {
657
- side: r,
658
- first: ["Call", /* @__PURE__ */ jsxs("span", {
659
- className: "break-all font-mono text-xs",
660
- children: [
661
- r.method,
662
- " ",
663
- r.fullUrl ?? r.url,
664
- query?.text ? `?${query.text}` : "",
665
- query?.cut ? " (query cut)" : ""
666
- ]
667
- })]
668
- }), /* @__PURE__ */ jsxs("div", {
669
- className: "flex flex-wrap items-center gap-2",
670
- children: [/* @__PURE__ */ jsx(CopyButton, {
671
- text: curl.command,
672
- label: "Copy as cURL",
673
- ariaLabel: "Copy the request as a cURL command"
674
- }), /* @__PURE__ */ jsxs("span", {
675
- className: "text-xs text-muted",
676
- children: [
677
- "Redacted as captured: secrets show as [redacted]",
678
- curl.complete ? "" : ", and the command's first line says what to fill in",
679
- "."
680
- ]
681
- })]
682
- })]
683
- });
684
- }
685
- /** Headers and body of one side of the call. */
686
- function Side({ side, first }) {
687
- const body = bodyView(side);
688
- const headers = Object.entries(side.headers ?? {}).sort(([a], [b]) => a.localeCompare(b));
689
- const sized = side.bodySize === void 0 ? void 0 : body?.binary ? size(side.bodySize) : `${side.bodySize.toLocaleString("en")} characters`;
690
- return /* @__PURE__ */ jsxs("div", {
691
- className: "space-y-3",
692
- children: [
693
- /* @__PURE__ */ jsx(Facts, { rows: [first, ["Body size", sized]] }),
694
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
695
- className: "mb-1.5 text-xs font-medium text-muted",
696
- children: "Headers"
697
- }), headers.length ? /* @__PURE__ */ jsx(Facts, {
698
- mono: true,
699
- rows: headers
700
- }) : /* @__PURE__ */ jsx("p", {
701
- className: "text-sm text-muted",
702
- children: "None captured."
703
- })] }),
704
- /* @__PURE__ */ jsxs("div", { children: [
705
- /* @__PURE__ */ jsxs("h3", {
706
- className: "mb-1.5 text-xs font-medium text-muted",
707
- children: ["Body", body?.json ? " (JSON)" : ""]
708
- }),
709
- body?.note && /* @__PURE__ */ jsx("p", {
710
- className: "mb-1.5 rounded-md bg-sev-medium/10 px-2 py-1 text-xs",
711
- children: body.note
712
- }),
713
- body?.text ? /* @__PURE__ */ jsx("pre", {
714
- className: "max-h-96 overflow-auto whitespace-pre-wrap break-all rounded-md border border-line bg-panel-2 p-2 font-mono text-[11px] leading-relaxed",
715
- children: body.text
716
- }) : !body?.note && /* @__PURE__ */ jsx("p", {
717
- className: "text-sm text-muted",
718
- children: "None captured."
719
- })
720
- ] })
721
- ]
722
- });
723
- }
724
- function CallFacts({ call }) {
725
- return /* @__PURE__ */ jsx(Facts, { rows: [
726
- ["Service", call.service],
727
- ["Endpoint", joined([call.method, call.path])],
728
- ["Status", call.status !== void 0 ? String(call.status) : "no answer"],
729
- ["Outcome", call.outcome],
730
- ["Kind", call.errorKind],
731
- ["Backend", joined([call.backendCode, call.backendTitle], " · ")],
732
- ["Backend errors", call.backendErrors],
733
- ["Trace", call.traceId ? /* @__PURE__ */ jsxs("span", {
734
- className: "flex flex-wrap items-center gap-2",
735
- children: [/* @__PURE__ */ jsx("span", {
736
- className: "break-all font-mono text-xs",
737
- children: call.traceId
738
- }), /* @__PURE__ */ jsx(CopyButton, {
739
- text: call.traceId,
740
- label: "Copy",
741
- ariaLabel: "Copy trace id"
742
- })]
743
- }) : void 0],
744
- ["Duration", call.durationMs !== void 0 ? `${call.durationMs} ms` : void 0],
745
- ["Retry", call.retry === void 0 ? void 0 : String(call.retry)]
746
- ] });
747
- }
748
- /** Label/value rows; empty values are left out. */
749
- function Facts({ rows, mono }) {
750
- const shown = rows.filter(([, v]) => v !== void 0 && v !== "");
751
- return /* @__PURE__ */ jsx("dl", {
752
- className: "grid grid-cols-[minmax(6rem,auto)_1fr] gap-x-4 gap-y-1.5 text-sm",
753
- children: shown.map(([k, v]) => /* @__PURE__ */ jsxs("div", {
754
- className: "contents",
755
- children: [/* @__PURE__ */ jsx("dt", {
756
- className: `text-muted ${mono ? "break-all font-mono text-xs" : ""}`,
757
- children: k
758
- }), /* @__PURE__ */ jsx("dd", {
759
- className: `min-w-0 break-words ${mono ? "font-mono text-xs" : ""}`,
760
- children: v
761
- })]
762
- }, k))
763
- });
764
- }
765
504
  export { EventPage as component };
@@ -0,0 +1,112 @@
1
+ // src/lib/exchange-view.ts
2
+ /** The SDK's "[binary 12 KB, image/png]", with the size or the type left out when it didn't know them. */
3
+ var BINARY = /^\[binary(?: ([\d.]+ ?[KMG]?B))?(?:, ([^\]]+))?\]$/i;
4
+ /** The SDK's cut "…[truncated, 48 KB total]", or ingest's "…[truncated]". */
5
+ var CUT = /…\[truncated(?:, ([\d.]+ ?[KMG]?B) total)?\]$/;
6
+ /** A byte count: "512 B", "47 KB", "1.2 MB". */
7
+ function size(bytes) {
8
+ return bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${Math.round(bytes / 1024)} KB` : `${(bytes / 1024 / 1024).toFixed(1)} MB`;
9
+ }
10
+ /** Text without a cut marker, and whether it had one. */
11
+ function uncut(text) {
12
+ const m = CUT.exec(text);
13
+ return m ? {
14
+ text: text.slice(0, m.index),
15
+ cut: true,
16
+ total: m[1]
17
+ } : {
18
+ text,
19
+ cut: false
20
+ };
21
+ }
22
+ function bodyView(side) {
23
+ const body = side.body;
24
+ if (body === void 0) return void 0;
25
+ const bin = BINARY.exec(body.trim());
26
+ if (bin) {
27
+ const bytes = bin[1] ?? (side.bodySize !== void 0 ? size(side.bodySize) : void 0);
28
+ return {
29
+ text: "",
30
+ raw: "",
31
+ json: false,
32
+ cut: false,
33
+ binary: true,
34
+ note: `Binary${bytes ? `, ${bytes}` : ""}${bin[2] ? ` (${bin[2]})` : ""}: not captured.`
35
+ };
36
+ }
37
+ const u = uncut(body);
38
+ const cut = u.cut || !!side.truncated;
39
+ const total = u.total ?? (side.bodySize !== void 0 ? `${side.bodySize.toLocaleString("en")} characters` : void 0);
40
+ const note = cut ? `Cut after ${u.text.length.toLocaleString("en")} characters${total ? ` of ${total}` : ""}: the rest wasn't captured.` : void 0;
41
+ const base = {
42
+ raw: u.text,
43
+ cut,
44
+ binary: false,
45
+ note
46
+ };
47
+ if (!u.text.trim()) return {
48
+ ...base,
49
+ text: "",
50
+ json: false,
51
+ note: note ?? "Empty body."
52
+ };
53
+ try {
54
+ return {
55
+ ...base,
56
+ text: JSON.stringify(JSON.parse(u.text), null, 2),
57
+ json: true
58
+ };
59
+ } catch {
60
+ return {
61
+ ...base,
62
+ text: u.text,
63
+ json: false
64
+ };
65
+ }
66
+ }
67
+ /** Single-quoted for a POSIX shell: nothing inside is expanded. */
68
+ var sh = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
69
+ /**
70
+ * The request as a cURL command, quoted so pasting it runs nothing but curl. It's what the SDK
71
+ * captured, so the command starts with a comment saying what to fill in: secrets show as
72
+ * "[redacted]", ids in the path as ":id", a cut or binary body isn't the one sent, and HOST stands
73
+ * in when the SDK named the call by its path only.
74
+ */
75
+ function curlOf(x) {
76
+ const r = x.request;
77
+ const query = r.query !== void 0 ? uncut(r.query) : void 0;
78
+ const base = r.fullUrl ?? `https://HOST${r.url.startsWith("/") ? "" : "/"}${r.url}`;
79
+ const url = query?.text ? `${base}?${query.text}` : base;
80
+ const parts = [`curl -X ${sh(r.method)} ${sh(url)}`];
81
+ for (const [k, v] of Object.entries(r.headers ?? {})) parts.push(`-H ${sh(`${k}: ${v}`)}`);
82
+ const body = bodyView(r);
83
+ if (body && !body.binary) parts.push(`--data-raw ${sh(body.raw)}`);
84
+ const fill = [
85
+ [
86
+ JSON.stringify(r.headers ?? {}),
87
+ r.body ?? "",
88
+ r.query ?? ""
89
+ ].some((t) => t.includes("[redacted]")) && "secrets show as [redacted]",
90
+ /\/:id(\/|$)/.test(r.url) && "ids in the path show as :id",
91
+ !r.fullUrl && "replace HOST",
92
+ query?.cut && "the query was cut",
93
+ body?.cut && "the body was cut",
94
+ body?.binary && "the binary body wasn't captured"
95
+ ].filter(Boolean);
96
+ const command = parts.join(" \\\n ");
97
+ return {
98
+ command: fill.length ? `# From deBug, as captured: ${fill.join("; ")}.\n${command}` : command,
99
+ complete: fill.length === 0
100
+ };
101
+ }
102
+ /**
103
+ * Why a failed call got no answer, from the outcome and kind the app gave it (free text, in the
104
+ * app's own words): it timed out, it never left the phone, or no answer came back.
105
+ */
106
+ function whyNoAnswer(call) {
107
+ const said = `${call.outcome ?? ""} ${call.errorKind ?? ""}`;
108
+ if (/time/i.test(said)) return "The call timed out: the server didn't answer in time.";
109
+ if (/never|offline|no.?connection/i.test(said)) return "The call never left the phone: there was no connection.";
110
+ return "No answer came back: the server couldn't be reached, or the connection dropped.";
111
+ }
112
+ export { whyNoAnswer as a, uncut as i, curlOf as n, size as r, bodyView as t };
@@ -1,5 +1,5 @@
1
- import { i as rollupId, l as isRegression, r as coalesceRollups } from "./memory-aqsrtEUn.js";
2
- import "./src-C4fNgijW.js";
1
+ import { b as isRegression, c as rollupId, i as mergeVersions, s as coalesceRollups } from "./memory-CZBUh1Zc.js";
2
+ import "./src-B2GKPQyN.js";
3
3
  import { FieldValue, Timestamp } from "firebase-admin/firestore";
4
4
  // ../../packages/adapters/src/firestore.ts
5
5
  /**
@@ -76,6 +76,17 @@ var FirestoreStore = class {
76
76
  updatedAt: FieldValue.serverTimestamp()
77
77
  }, { merge: true });
78
78
  }
79
+ /** On the app's own document, in a transaction: two ingests seeing different SDKs keep the newer. */
80
+ async recordVersions(app, seen) {
81
+ const ref = this.app(app);
82
+ await this.db.runTransaction(async (tx) => {
83
+ const cur = (await tx.get(ref)).data()?.versions;
84
+ tx.set(ref, { versions: strip(mergeVersions(cur, seen)) }, { merge: true });
85
+ });
86
+ }
87
+ async getVersions(app) {
88
+ return (await this.app(app).get()).data()?.versions ?? {};
89
+ }
79
90
  async writeEvents(events, opts = {}) {
80
91
  const days = opts.retentionDays ?? this.opts.retentionDays ?? 30;
81
92
  for (const chunk of chunks(events, 400)) {