@debugkit/dashboard 0.9.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-BJkvWYRY.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-DiDJMnQu.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-B0NxM46y.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-BRuVQ2bU.js → team-xlrjhEGp.js} +1 -1
  22. package/dist/client/assets/{timeline-BIGo9MCA.js → timeline-WXE49N62.js} +1 -1
  23. package/dist/client/assets/ui-DRjjeSWy.js +1 -0
  24. package/dist/client/assets/{version-banner-VFvyqbPh.js → version-banner-BYe4PVzv.js} +1 -1
  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-827fC5I3.js → customers-CD84Bz4P.js} +11 -6
  33. package/dist/server/assets/{demo-DDNiXCgj.js → demo-D-o8m75S.js} +222 -6
  34. package/dist/server/assets/{dynamodb-Cd4blXkh.js → dynamodb-CcH0cp7R.js} +2 -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-_T0NSOyA.js → endpoints-C0Cxc_-x.js} +38 -36
  38. package/dist/server/assets/{events._eventId-Dcsu4oVO.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-c8Sz2Q4O.js → firestore-DyvYMiz3.js} +2 -2
  41. package/dist/server/assets/{fns-BiUOnY1_.js → fns-BcVGbSID.js} +20 -7
  42. package/dist/server/assets/fns-DE03YExD.js +831 -0
  43. package/dist/server/assets/{invite._token-7DjEeeaD.js → invite._token-DhlACkIe.js} +3 -3
  44. package/dist/server/assets/{issues._fingerprint-vc9r3jgg.js → issues._fingerprint-BBd-_Nn5.js} +400 -28
  45. package/dist/server/assets/{login-CwKAx9Bj.js → login-CbfdHJvg.js} +3 -3
  46. package/dist/server/assets/{memory-Bv4C8uyK.js → memory-CZBUh1Zc.js} +75 -3
  47. package/dist/server/assets/{errors-Po4Tt5zd.js → queries-wha4cZbw.js} +1394 -128
  48. package/dist/server/assets/request-panel-DpCSwl2q.js +162 -0
  49. package/dist/server/assets/{router-Dk3XHn7B.js → router-BXkzR89j.js} +195 -91
  50. package/dist/server/assets/services._service-DWjFFGON.js +309 -0
  51. package/dist/server/assets/{sessions._sessionId-BvXxK9qF.js → sessions._sessionId-DDspiPTe.js} +2 -2
  52. package/dist/server/assets/{settings-B9NLQjl1.js → settings-DCLIaZ_p.js} +146 -25
  53. package/dist/server/assets/{src-oWPSAvXv.js → src-B2GKPQyN.js} +1 -1
  54. package/dist/server/assets/{team-Bsm2wFG0.js → team-jd_TmWP4.js} +3 -3
  55. package/dist/server/assets/ui-C3pl0edn.js +302 -0
  56. package/dist/server/assets/{version-banner-nf-yZurq.js → version-banner-BX34ijG5.js} +1 -1
  57. package/dist/server/assets/{versions-BOlL8jam.js → versions-YI_zK1ql.js} +3 -3
  58. package/dist/server/assets/warm-C3GbXP1_.js +16 -0
  59. package/dist/server/server.js +37 -29
  60. package/package.json +4 -4
  61. package/dist/client/assets/_authed-C29P68T-.js +0 -1
  62. package/dist/client/assets/_authed-D-dYbHoP.js +0 -7
  63. package/dist/client/assets/charts--S1o8iId.js +0 -55
  64. package/dist/client/assets/customers-Cwx5qEO1.js +0 -1
  65. package/dist/client/assets/endpoints-zz1TotR2.js +0 -1
  66. package/dist/client/assets/events._eventId-Bx6TfUjv.js +0 -3
  67. package/dist/client/assets/index-COHr_cc3.js +0 -10
  68. package/dist/client/assets/issues._fingerprint-Cv522h2j.js +0 -1
  69. package/dist/client/assets/login-CKkpc0t5.js +0 -1
  70. package/dist/client/assets/settings-CIlF10MI.js +0 -1
  71. package/dist/client/assets/src-BKSiJUs3.js +0 -3
  72. package/dist/client/assets/styles-GAsMUS4-.css +0 -2
  73. package/dist/client/assets/ui-CaEZB1j2.js +0 -1
  74. package/dist/server/assets/_authed-BJWDiF9i.js +0 -92
  75. package/dist/server/assets/_authed-X9u_5JUy.js +0 -902
  76. package/dist/server/assets/_tanstack-start-manifest_v-C6vaeBdY.js +0 -90
  77. package/dist/server/assets/charts-DzTVqJ8z.js +0 -238
  78. package/dist/server/assets/fns-CVbk8Gf9.js +0 -1310
  79. package/dist/server/assets/ui-SAkSlP7f.js +0 -193
@@ -0,0 +1,309 @@
1
+ import { t as ClosedIssues } from "./closed-issues-o9U80FXv.js";
2
+ import { t as EmptyState } from "./empty-state-wz34oAi8.js";
3
+ import { n as RetentionNote, t as RangePicker } from "./range-picker-0zbSGr3Z.js";
4
+ import { c as LevelRow, f as levelName, m as toneClass, p as timeAgo } from "./ui-C3pl0edn.js";
5
+ import { B as endpointsOf, G as serviceTile, H as isOpen, K as servicesOf, P as HEALTH_ORDER, U as pct, V as failing, W as plural, q as whoseLine, z as endpointLevel } from "./queries-wha4cZbw.js";
6
+ import { t as bodyView } from "./exchange-view-DzoSBt_R.js";
7
+ import { r as Route } from "./router-BXkzR89j.js";
8
+ import { Link, useNavigate } from "@tanstack/react-router";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ // src/routes/_authed/services.$service.tsx?tsr-split=component
11
+ /**
12
+ * One service, one level down from the health wall: its endpoints worst first, each with what
13
+ * the server said, how often, and the issues behind it (one click from the cause and the fix).
14
+ */
15
+ function ServicePage() {
16
+ const report = Route.useLoaderData();
17
+ const { service } = Route.useParams();
18
+ const search = Route.useSearch();
19
+ const navigate = useNavigate({ from: Route.fullPath });
20
+ if (!report) return /* @__PURE__ */ jsx(EmptyState, {});
21
+ const { range } = report;
22
+ const keep = {
23
+ app: report.app,
24
+ range: search.range,
25
+ from: search.from,
26
+ to: search.to
27
+ };
28
+ const endpoints = endpointsOf(service, report.endpoints);
29
+ const grouped = servicesOf(endpoints)[0];
30
+ const summary = grouped && {
31
+ ...grouped,
32
+ key: service
33
+ };
34
+ const now = Date.parse(report.generatedAt);
35
+ const tile = summary && serviceTile(summary, endpoints, now);
36
+ const rows = endpoints.map((e) => ({
37
+ e,
38
+ level: endpointLevel(e)
39
+ })).sort((a, b) => HEALTH_ORDER[b.level] - HEALTH_ORDER[a.level] || failing(b.e) - failing(a.e));
40
+ const broken = rows.filter((r) => r.level !== "healthy");
41
+ const healthy = rows.filter((r) => r.level === "healthy");
42
+ const closed = /* @__PURE__ */ new Map();
43
+ for (const e of endpoints) for (const p of e.problems) if (!isOpen(p.issueStatus)) closed.set(p.fingerprint, {
44
+ ...p,
45
+ status: p.issueStatus
46
+ });
47
+ return /* @__PURE__ */ jsxs("main", {
48
+ className: "mx-auto max-w-7xl space-y-5 px-4 py-6 sm:px-6",
49
+ children: [
50
+ /* @__PURE__ */ jsxs("div", {
51
+ className: "flex flex-wrap items-center justify-between gap-3",
52
+ children: [/* @__PURE__ */ jsxs("nav", {
53
+ "aria-label": "Breadcrumb",
54
+ className: "text-sm text-muted",
55
+ children: [
56
+ /* @__PURE__ */ jsx(Link, {
57
+ to: "/",
58
+ search: keep,
59
+ className: "hover:text-ink hover:underline",
60
+ children: "Health"
61
+ }),
62
+ /* @__PURE__ */ jsx("span", {
63
+ "aria-hidden": true,
64
+ children: " › "
65
+ }),
66
+ /* @__PURE__ */ jsx("span", {
67
+ className: "text-ink",
68
+ "aria-current": "page",
69
+ children: tile?.name ?? service
70
+ })
71
+ ]
72
+ }), /* @__PURE__ */ jsx(RangePicker, {
73
+ value: range,
74
+ today: report.generatedAt.slice(0, 10),
75
+ onChange: (r) => navigate({ search: (s) => ({
76
+ ...s,
77
+ ...r
78
+ }) })
79
+ }, `${range.preset}${range.from}${range.to}`)]
80
+ }),
81
+ /* @__PURE__ */ jsx(RetentionNote, {
82
+ rangeFrom: range.from,
83
+ retention: report.retention
84
+ }),
85
+ !tile ? /* @__PURE__ */ jsxs("p", {
86
+ className: "text-sm text-muted",
87
+ children: [
88
+ service,
89
+ " had no calls or failures in ",
90
+ range.label,
91
+ "."
92
+ ]
93
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
94
+ /* @__PURE__ */ jsxs("header", { children: [
95
+ /* @__PURE__ */ jsxs("p", {
96
+ className: "text-xs font-bold uppercase tracking-wide",
97
+ children: [
98
+ /* @__PURE__ */ jsx("span", {
99
+ className: toneClass(tile.level, "text"),
100
+ children: levelName(tile.level)
101
+ }),
102
+ tile.live && /* @__PURE__ */ jsx("span", {
103
+ className: `ml-2 normal-case ${toneClass(tile.level, "text")}`,
104
+ children: "· Still happening"
105
+ }),
106
+ tile.sideLabel && /* @__PURE__ */ jsx("span", {
107
+ className: "ml-2 rounded-full border border-line px-1.5 py-px normal-case text-muted",
108
+ children: tile.sideLabel
109
+ })
110
+ ]
111
+ }),
112
+ /* @__PURE__ */ jsx("h1", {
113
+ className: "mt-1 text-2xl font-semibold tracking-tight",
114
+ children: tile.name
115
+ }),
116
+ tile.outage && /* @__PURE__ */ jsxs("p", {
117
+ role: "status",
118
+ className: `mt-2 rounded-lg border-2 px-3 py-2 text-sm font-semibold ${toneClass("critical", "surface")}`,
119
+ children: [
120
+ tile.outage,
121
+ ". ",
122
+ whoseLine(tile)
123
+ ]
124
+ }),
125
+ /* @__PURE__ */ jsxs("p", {
126
+ className: "mt-1 text-sm text-muted",
127
+ children: [
128
+ tile.measure,
129
+ " in ",
130
+ range.label,
131
+ tile.lastFailure ? `, the last ${timeAgo(tile.lastFailure, now)}` : "",
132
+ ". ",
133
+ plural(endpoints.length, "endpoint"),
134
+ ", worst first."
135
+ ]
136
+ })
137
+ ] }),
138
+ broken.length > 0 ? /* @__PURE__ */ jsx("ol", {
139
+ className: "space-y-3",
140
+ "aria-label": "Failing endpoints, worst first",
141
+ children: broken.map(({ e, level }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(LevelRow, {
142
+ level,
143
+ aside: e.failureRate !== null ? `${pct(e.failureRate)} failed` : plural(e.failures, "failure"),
144
+ children: /* @__PURE__ */ jsx(EndpointProblems, {
145
+ row: e,
146
+ keep,
147
+ now,
148
+ service
149
+ })
150
+ }) }, e.endpoint))
151
+ }) : /* @__PURE__ */ jsxs("p", {
152
+ className: "rounded-lg border border-level-healthy-edge bg-level-healthy-bg px-3 py-2 text-sm text-level-healthy-fg",
153
+ children: [
154
+ "Every call to ",
155
+ tile.name,
156
+ " worked in ",
157
+ range.label,
158
+ "."
159
+ ]
160
+ }),
161
+ /* @__PURE__ */ jsx(ClosedIssues, {
162
+ issues: [...closed.values()],
163
+ keep,
164
+ now
165
+ }),
166
+ healthy.length > 0 && /* @__PURE__ */ jsxs("section", {
167
+ "aria-label": "Healthy endpoints",
168
+ children: [/* @__PURE__ */ jsx("h2", {
169
+ className: "mb-2 text-sm font-semibold text-muted",
170
+ children: "Healthy"
171
+ }), /* @__PURE__ */ jsx("ul", {
172
+ className: "grid gap-2 sm:grid-cols-2 lg:grid-cols-3",
173
+ children: healthy.map(({ e }) => /* @__PURE__ */ jsxs("li", {
174
+ className: "rounded-lg border border-level-healthy-edge bg-level-healthy-bg px-3 py-2 text-sm text-level-healthy-fg",
175
+ children: [/* @__PURE__ */ jsxs("span", {
176
+ className: "font-mono text-xs",
177
+ children: [
178
+ e.method,
179
+ " ",
180
+ e.path
181
+ ]
182
+ }), /* @__PURE__ */ jsxs("span", {
183
+ className: "block text-xs",
184
+ children: [e.calls?.toLocaleString() ?? "—", " calls, none failed"]
185
+ })]
186
+ }, e.endpoint))
187
+ })]
188
+ })
189
+ ] })
190
+ ]
191
+ });
192
+ }
193
+ /** One failing endpoint: what the server said, how often, and the issues behind it. */
194
+ function EndpointProblems({ row, keep, now, service }) {
195
+ const said = [...row.statuses.slice(0, 3).map((s) => `${s.key} ×${s.count}`)];
196
+ const code = row.backendCodes[0];
197
+ const open = row.problems.filter((p) => isOpen(p.issueStatus));
198
+ const message = row.backendMessages[0];
199
+ return /* @__PURE__ */ jsxs("div", {
200
+ className: "space-y-2",
201
+ children: [
202
+ /* @__PURE__ */ jsxs("div", {
203
+ className: "flex flex-wrap items-baseline justify-between gap-2",
204
+ children: [/* @__PURE__ */ jsxs("h2", {
205
+ className: "break-all font-mono text-sm font-semibold",
206
+ children: [
207
+ row.method,
208
+ " ",
209
+ row.path
210
+ ]
211
+ }), /* @__PURE__ */ jsxs("span", {
212
+ className: "tabular text-xs text-muted",
213
+ children: [row.calls !== null ? `${(row.failedCalls ?? 0).toLocaleString()} of ${plural(row.calls, "call")} failed` : plural(row.failures, "stored failure"), row.lastFailure ? ` · last ${timeAgo(row.lastFailure, now)}` : ""]
214
+ })]
215
+ }),
216
+ (said.length > 0 || code || message) && /* @__PURE__ */ jsxs("p", {
217
+ className: "text-sm",
218
+ children: [
219
+ /* @__PURE__ */ jsx("span", {
220
+ className: "text-muted",
221
+ children: "The server said: "
222
+ }),
223
+ said.join(", "),
224
+ (code || message) && /* @__PURE__ */ jsxs(Fragment, { children: [said.length ? " · " : "", /* @__PURE__ */ jsx("span", {
225
+ className: "font-semibold",
226
+ children: [code?.key, message?.key && `"${message.key}"`].filter(Boolean).join(" ")
227
+ })] })
228
+ ]
229
+ }),
230
+ row.lastAnswer?.body && /* @__PURE__ */ jsxs("details", {
231
+ open: true,
232
+ className: "rounded-lg border border-line bg-panel-2 p-2",
233
+ children: [
234
+ /* @__PURE__ */ jsxs("summary", {
235
+ className: "cursor-pointer text-xs font-medium text-muted hover:text-ink",
236
+ children: [
237
+ "What the server answered last, ",
238
+ row.lastAnswer.status,
239
+ ", ",
240
+ timeAgo(row.lastAnswer.ts, now)
241
+ ]
242
+ }),
243
+ /* @__PURE__ */ jsx("pre", {
244
+ className: "mt-1.5 max-h-48 overflow-auto whitespace-pre-wrap break-all font-mono text-[11px] leading-relaxed",
245
+ children: bodyView({ body: row.lastAnswer.body })?.text ?? row.lastAnswer.body
246
+ }),
247
+ /* @__PURE__ */ jsx(Link, {
248
+ to: "/issues/$fingerprint",
249
+ params: { fingerprint: row.lastAnswer.fingerprint },
250
+ search: {
251
+ ...keep,
252
+ app: keep.app ?? ""
253
+ },
254
+ className: "text-xs text-accent hover:underline",
255
+ children: "The request and the whole response →"
256
+ })
257
+ ]
258
+ }),
259
+ open.length > 0 && /* @__PURE__ */ jsx("ul", {
260
+ className: "space-y-1.5",
261
+ "aria-label": `What's causing it on ${row.method ?? ""} ${row.path ?? row.endpoint}`,
262
+ children: open.map((p) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Link, {
263
+ to: "/issues/$fingerprint",
264
+ params: { fingerprint: p.fingerprint },
265
+ search: {
266
+ ...keep,
267
+ app: keep.app ?? ""
268
+ },
269
+ className: "group flex flex-wrap items-center justify-between gap-2 rounded-lg border border-line bg-panel-2 px-3 py-2 text-sm hover:border-accent focus-visible:outline-2 focus-visible:outline-accent",
270
+ children: [/* @__PURE__ */ jsxs("span", {
271
+ className: "min-w-0 break-words",
272
+ children: [/* @__PURE__ */ jsx("span", {
273
+ className: "font-medium",
274
+ children: p.title
275
+ }), /* @__PURE__ */ jsxs("span", {
276
+ className: "tabular block text-xs text-muted",
277
+ children: [
278
+ p.count,
279
+ "× · ",
280
+ p.status,
281
+ " · ",
282
+ [p.platforms.join(", "), p.versions.slice(0, 2).map((v) => `app ${v}`).join(", ")].filter(Boolean).join(" · "),
283
+ " · last ",
284
+ timeAgo(p.lastSeen, now)
285
+ ]
286
+ })]
287
+ }), /* @__PURE__ */ jsx("span", {
288
+ className: "shrink-0 text-xs font-semibold text-accent group-hover:underline",
289
+ children: "Cause and fix →"
290
+ })]
291
+ }) }, p.fingerprint))
292
+ }),
293
+ row.problems.length > 0 && !open.length && /* @__PURE__ */ jsx("p", {
294
+ className: "text-sm text-muted",
295
+ children: "Its issues are all resolved or ignored (listed at the bottom): these failures came before that, or are still being looked at."
296
+ }),
297
+ /* @__PURE__ */ jsx(Link, {
298
+ to: "/endpoints",
299
+ search: {
300
+ ...keep,
301
+ endpoint: row.endpoint
302
+ },
303
+ className: "inline-block text-xs text-accent hover:underline",
304
+ children: "Every failure on this endpoint, with traces →"
305
+ })
306
+ ]
307
+ });
308
+ }
309
+ export { ServicePage as component };
@@ -1,7 +1,7 @@
1
1
  import { t as CopyButton } from "./copy-button-D3RddzTw.js";
2
2
  import { a as joined, i as clock, n as ICON, r as OutcomeBadge, s as roundedSpan, t as CrumbBody } from "./timeline-MDRNDhiA.js";
3
- import { t as Card } from "./ui-SAkSlP7f.js";
4
- import { n as Route } from "./router-Dk3XHn7B.js";
3
+ import { n as Card } from "./ui-C3pl0edn.js";
4
+ import { n as Route } from "./router-BXkzR89j.js";
5
5
  import { Link } from "@tanstack/react-router";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  // src/routes/_authed/sessions.$sessionId.tsx?tsr-split=component
@@ -1,8 +1,9 @@
1
- import { E as OWNER_INFO, T as OWNERS, b as normaliseHostMatch } from "./memory-Bv4C8uyK.js";
2
- import { l as timeAgo, t as Card } from "./ui-SAkSlP7f.js";
3
- import { i as partText, r as useVersionStatus, t as UpgradeCommand } from "./version-banner-nf-yZurq.js";
4
- import { S as sendTestAlert, b as saveAppSettings, x as saveRetention, y as restampExisting } from "./fns-BiUOnY1_.js";
5
- import { s as Route } from "./router-Dk3XHn7B.js";
1
+ import { B as OWNER_INFO, O as hostKindLabel, P as normaliseHostMatch, z as OWNERS } from "./memory-CZBUh1Zc.js";
2
+ import { n as Card, p as timeAgo, t as AppOptions } from "./ui-C3pl0edn.js";
3
+ import { n as validAppName, t as appLabel } from "./app-name-BcbY1BZN.js";
4
+ import { i as partText, r as useVersionStatus, t as UpgradeCommand } from "./version-banner-BX34ijG5.js";
5
+ import { C as saveRetention, S as saveAppSettings, w as sendTestAlert, x as restampExisting } from "./fns-BcVGbSID.js";
6
+ import { c as Route } from "./router-BXkzR89j.js";
6
7
  import { useState } from "react";
7
8
  import { useNavigate, useRouter } from "@tanstack/react-router";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -15,7 +16,7 @@ var CHOICES = [
15
16
  365
16
17
  ];
17
18
  function SettingsPage() {
18
- const { apps, settings, seenHosts } = Route.useLoaderData();
19
+ const { apps, settings, seenHosts, names } = Route.useLoaderData();
19
20
  const versions = useVersionStatus();
20
21
  const navigate = useNavigate({ from: Route.fullPath });
21
22
  const router = useRouter();
@@ -85,21 +86,36 @@ function SettingsPage() {
85
86
  children: [
86
87
  /* @__PURE__ */ jsxs("div", {
87
88
  className: "flex flex-wrap items-end justify-between gap-3",
88
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
89
- className: "text-xs uppercase tracking-wide text-muted",
90
- children: "Settings"
91
- }), /* @__PURE__ */ jsx("h1", {
92
- className: "text-2xl font-semibold tracking-tight",
93
- children: settings.app
94
- })] }), apps.length > 1 && /* @__PURE__ */ jsx("select", {
89
+ children: [/* @__PURE__ */ jsxs("div", { children: [
90
+ /* @__PURE__ */ jsx("p", {
91
+ className: "text-xs uppercase tracking-wide text-muted",
92
+ children: "Settings"
93
+ }),
94
+ /* @__PURE__ */ jsx("h1", {
95
+ className: "text-2xl font-semibold tracking-tight",
96
+ children: appLabel(settings.app, settings.displayName)
97
+ }),
98
+ settings.displayName && /* @__PURE__ */ jsx("p", {
99
+ className: "font-mono text-xs text-muted",
100
+ children: settings.app
101
+ })
102
+ ] }), apps.length > 1 && /* @__PURE__ */ jsx("select", {
95
103
  "aria-label": "App",
96
104
  value: settings.app,
97
105
  onChange: (e) => navigate({ search: { app: e.target.value } }),
98
106
  className: "rounded-md border border-line bg-panel px-2 py-1.5 text-sm",
99
- children: apps.map((a) => /* @__PURE__ */ jsx("option", { children: a }, a))
107
+ children: /* @__PURE__ */ jsx(AppOptions, {
108
+ apps,
109
+ names
110
+ })
100
111
  })]
101
112
  }),
102
113
  versions && /* @__PURE__ */ jsx(VersionsCard, { status: versions }),
114
+ canEdit && /* @__PURE__ */ jsx(AppName, {
115
+ app: settings.app,
116
+ name: settings.displayName,
117
+ onStatus: setStatus
118
+ }, settings.app + settings.displayName),
103
119
  /* @__PURE__ */ jsxs(Card, {
104
120
  title: "Data retention",
105
121
  subtitle: "Your data lives in your own database, so you decide how long to keep it.",
@@ -378,6 +394,76 @@ function FlowsAndAlerts({ settings, onStatus }) {
378
394
  })
379
395
  ] });
380
396
  }
397
+ /** The app's display name: what people see it as. The id stays what the SDK sends and what links use. */
398
+ function AppName({ app, name, onStatus }) {
399
+ const router = useRouter();
400
+ const [value, setValue] = useState(name);
401
+ const [busy, setBusy] = useState(false);
402
+ const cleaned = validAppName(value);
403
+ const next = typeof cleaned === "string" ? void 0 : cleaned.name;
404
+ const changed = next !== void 0 && next !== name;
405
+ const save = async () => {
406
+ setBusy(true);
407
+ onStatus(null);
408
+ const out = await saveAppSettings({ data: {
409
+ app,
410
+ displayName: value
411
+ } }).catch((e) => ({
412
+ ok: false,
413
+ error: e.message
414
+ }));
415
+ setBusy(false);
416
+ if (!out.ok) return onStatus({
417
+ tone: "error",
418
+ text: out.error
419
+ });
420
+ onStatus({
421
+ tone: "ok",
422
+ text: next ? `Saved. ${app} now shows as "${next}".` : `Saved. The app shows as ${app} again.`
423
+ });
424
+ await router.invalidate();
425
+ };
426
+ return /* @__PURE__ */ jsxs(Card, {
427
+ title: "App name",
428
+ subtitle: "What people see this app as. The app id stays the same in the SDK, links and keys.",
429
+ children: [/* @__PURE__ */ jsxs("form", {
430
+ className: "flex flex-wrap items-end gap-2",
431
+ onSubmit: (e) => {
432
+ e.preventDefault();
433
+ if (changed) save();
434
+ },
435
+ children: [/* @__PURE__ */ jsxs("label", {
436
+ className: "min-w-0 flex-1 text-xs text-muted",
437
+ children: ["Display name", /* @__PURE__ */ jsx("input", {
438
+ value,
439
+ onChange: (e) => setValue(e.target.value),
440
+ placeholder: app,
441
+ maxLength: 60,
442
+ className: "mt-1 w-full rounded-md border border-line bg-panel px-2 py-1.5 text-sm text-ink"
443
+ })]
444
+ }), /* @__PURE__ */ jsx("button", {
445
+ type: "submit",
446
+ disabled: !changed || busy,
447
+ className: "rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",
448
+ children: "Save"
449
+ })]
450
+ }), /* @__PURE__ */ jsxs("p", {
451
+ className: "mt-2 text-xs text-muted",
452
+ children: [
453
+ "Leave it empty to show the id (",
454
+ app,
455
+ ")."
456
+ ]
457
+ })]
458
+ });
459
+ }
460
+ var EMPTY_ROW = {
461
+ match: "",
462
+ name: "",
463
+ owner: "",
464
+ kind: "",
465
+ provider: ""
466
+ };
381
467
  /** Owners a host can be given; leaving it unset lets the classifier decide. */
382
468
  var HOST_OWNERS = OWNERS.filter((o) => o !== "unknown");
383
469
  function HostNames({ app, hosts, seen, onStatus }) {
@@ -387,12 +473,12 @@ function HostNames({ app, hosts, seen, onStatus }) {
387
473
  id: i,
388
474
  match: h.match,
389
475
  name: h.name,
390
- owner: h.owner ?? ""
476
+ owner: h.owner ?? "",
477
+ kind: h.kind ?? "",
478
+ provider: h.provider ?? ""
391
479
  })) : [{
392
- id: 0,
393
- match: "",
394
- name: "",
395
- owner: ""
480
+ ...EMPTY_ROW,
481
+ id: 0
396
482
  }]);
397
483
  const [busy, setBusy] = useState(false);
398
484
  const named = new Set(rows.map((r) => normaliseHostMatch(r.match)));
@@ -403,10 +489,9 @@ function HostNames({ app, hosts, seen, onStatus }) {
403
489
  } : r));
404
490
  const add = (match = "") => {
405
491
  setRows((rs) => [...rs.filter((r) => r.match || r.name), {
492
+ ...EMPTY_ROW,
406
493
  id: nextId,
407
- match,
408
- name: "",
409
- owner: ""
494
+ match
410
495
  }]);
411
496
  setNextId((n) => n + 1);
412
497
  };
@@ -418,7 +503,9 @@ function HostNames({ app, hosts, seen, onStatus }) {
418
503
  hosts: rows.map((r) => ({
419
504
  match: r.match,
420
505
  name: r.name,
421
- ...r.owner ? { owner: r.owner } : {}
506
+ ...r.owner ? { owner: r.owner } : {},
507
+ ...r.kind ? { kind: r.kind } : {},
508
+ ...r.kind === "upstream" && r.provider.trim() ? { provider: r.provider } : {}
422
509
  }))
423
510
  } }).catch((e) => ({
424
511
  ok: false,
@@ -445,7 +532,7 @@ function HostNames({ app, hosts, seen, onStatus }) {
445
532
  rows.map((r, i) => /* @__PURE__ */ jsxs("div", {
446
533
  role: "group",
447
534
  "aria-label": `Host ${i + 1}`,
448
- className: "grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_auto_auto] sm:items-end sm:border-0 sm:p-0",
535
+ className: "grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_auto_auto_auto] sm:items-end sm:border-0 sm:p-0",
449
536
  children: [
450
537
  /* @__PURE__ */ jsxs("label", {
451
538
  className: "min-w-0 text-xs text-muted",
@@ -482,6 +569,40 @@ function HostNames({ app, hosts, seen, onStatus }) {
482
569
  }, o))]
483
570
  })]
484
571
  }),
572
+ /* @__PURE__ */ jsxs("div", {
573
+ className: "text-xs text-muted",
574
+ children: [/* @__PURE__ */ jsxs("label", {
575
+ className: "block",
576
+ children: ["Whose service", /* @__PURE__ */ jsxs("select", {
577
+ value: r.kind,
578
+ onChange: (e) => update(r.id, { kind: e.target.value }),
579
+ className: `mt-1 w-full text-ink ${box}`,
580
+ children: [
581
+ /* @__PURE__ */ jsx("option", {
582
+ value: "",
583
+ children: "From the owner"
584
+ }),
585
+ /* @__PURE__ */ jsx("option", {
586
+ value: "ours",
587
+ children: hostKindLabel("ours")
588
+ }),
589
+ /* @__PURE__ */ jsx("option", {
590
+ value: "upstream",
591
+ children: "Upstream (a third party)"
592
+ })
593
+ ]
594
+ })]
595
+ }), r.kind === "upstream" && /* @__PURE__ */ jsxs("label", {
596
+ className: "mt-1 block",
597
+ children: ["Upstream's name", /* @__PURE__ */ jsx("input", {
598
+ value: r.provider,
599
+ onChange: (e) => update(r.id, { provider: e.target.value }),
600
+ placeholder: "Provider name",
601
+ maxLength: 40,
602
+ className: `mt-1 w-full text-ink ${box}`
603
+ })]
604
+ })]
605
+ }),
485
606
  /* @__PURE__ */ jsx("button", {
486
607
  type: "button",
487
608
  onClick: () => setRows((rs) => rs.filter((x) => x.id !== r.id)),
@@ -510,7 +631,7 @@ function HostNames({ app, hosts, seen, onStatus }) {
510
631
  }),
511
632
  /* @__PURE__ */ jsx("p", {
512
633
  className: "text-xs text-muted",
513
- children: "A path names part of a host: api.example.com/payments covers /payments/… only; the longest match wins. The owner decides who server errors from that host are passed to."
634
+ children: "A path names part of a host: api.example.com/payments covers /payments/… only; the longest match wins. The owner decides who server errors from that host are passed to. Mark a host, or a path on your own gateway, as upstream when your backend passes those calls on to a third party, such as a payment, messaging or telecom provider: Health then says when that service is down, rather than your backend or the app."
514
635
  }),
515
636
  /* @__PURE__ */ jsxs("div", {
516
637
  className: "flex flex-wrap gap-2",
@@ -1,4 +1,4 @@
1
- import "./memory-Bv4C8uyK.js";
1
+ import "./memory-CZBUh1Zc.js";
2
2
  // ../../packages/adapters/src/index.ts
3
3
  var MAX_RETENTION_DAYS = 3650;
4
4
  var TEAM_ROLES = [
@@ -1,6 +1,6 @@
1
- import { l as timeAgo, t as Card } from "./ui-SAkSlP7f.js";
2
- import { C as setMemberRole, m as inviteToTeam, t as cancelInvite, v as removeFromTeam } from "./fns-BiUOnY1_.js";
3
- import { o as Route } from "./router-Dk3XHn7B.js";
1
+ import { n as Card, p as timeAgo } from "./ui-C3pl0edn.js";
2
+ import { T as setMemberRole, b as removeFromTeam, h as inviteToTeam, t as cancelInvite } from "./fns-BcVGbSID.js";
3
+ import { s as Route } from "./router-BXkzR89j.js";
4
4
  import { useState } from "react";
5
5
  import { useRouter } from "@tanstack/react-router";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";