@debugkit/dashboard 0.4.0 → 0.6.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 (55) hide show
  1. package/.env.example +3 -0
  2. package/dist/client/assets/_authed-BMdIkvB6.js +7 -0
  3. package/dist/client/assets/_authed-Rg-Gabby.js +1 -0
  4. package/dist/client/assets/{charts-C76vsG2N.js → charts-QIIL2Fv7.js} +18 -18
  5. package/dist/client/assets/index-CMjwqklY.js +10 -0
  6. package/dist/client/assets/invite._token-CDogkC9p.js +1 -0
  7. package/dist/client/assets/issues._fingerprint-DLe_lV5d.js +1 -0
  8. package/dist/client/assets/login-BG9v4zhc.js +1 -0
  9. package/dist/client/assets/preload-helper-Dscj_TcA.js +3 -0
  10. package/dist/client/assets/settings-Ce1uqKl0.js +1 -0
  11. package/dist/client/assets/styles-DztngwT9.css +2 -0
  12. package/dist/client/assets/team-TUMAZ4jv.js +1 -0
  13. package/dist/client/assets/ui-C0HGOza2.js +1 -0
  14. package/dist/server/assets/_authed-DDQ5yYfy.js +73 -0
  15. package/dist/server/assets/{_authed-ClbGOSDJ.js → _authed-Dray_9Ct.js} +296 -70
  16. package/dist/server/assets/_tanstack-start-manifest_v-BItoYCqL.js +61 -0
  17. package/dist/server/assets/{charts-CNlV7Pga.js → charts-DzTVqJ8z.js} +21 -4
  18. package/dist/server/assets/{demo-DTdlXNgj.js → demo-BsMMDk_F.js} +87 -10
  19. package/dist/server/assets/dynamodb-Zkk1-mgz.js +445 -0
  20. package/dist/server/assets/firestore-C52q_vwM.js +237 -0
  21. package/dist/server/assets/fns-DwGaMi8S.js +107 -0
  22. package/dist/server/assets/fns-mbUIXXep.js +529 -0
  23. package/dist/server/assets/invite._token-BWiwnST7.js +136 -0
  24. package/dist/server/assets/{issues._fingerprint-D78dy5os.js → issues._fingerprint-D9vjIk3M.js} +159 -17
  25. package/dist/server/assets/{login-h3B5Vdhl.js → login-BXi46U4B.js} +3 -3
  26. package/dist/server/assets/{queries-DIVV-5j6.js → memory-BssaqdZm.js} +234 -504
  27. package/dist/server/assets/queries-BJxX3Kjp.js +1669 -0
  28. package/dist/server/assets/range-picker-0zbSGr3Z.js +106 -0
  29. package/dist/server/assets/rolldown-runtime-D8jQpDG7.js +12 -0
  30. package/dist/server/assets/{router-DqTf7XfT.js → router-m6Hpq6Ep.js} +114 -51
  31. package/dist/server/assets/settings-ByFLIJce.js +371 -0
  32. package/dist/server/assets/src-D83GYTrp.js +9 -0
  33. package/dist/server/assets/team-CifrrNkf.js +255 -0
  34. package/dist/server/assets/{ui-Lv-KcOoP.js → ui-BJokJdYa.js} +25 -3
  35. package/dist/server/server.js +60 -8
  36. package/handler.mjs +95 -0
  37. package/lambda.mjs +61 -0
  38. package/package.json +16 -7
  39. package/server.mjs +4 -39
  40. package/dist/client/assets/_authed-Bi62GTX3.js +0 -7
  41. package/dist/client/assets/_authed-mWCAMokt.js +0 -1
  42. package/dist/client/assets/index-D7uhDdvA.js +0 -12
  43. package/dist/client/assets/issues._fingerprint-fVGLnT37.js +0 -1
  44. package/dist/client/assets/login-MqvT094Y.js +0 -1
  45. package/dist/client/assets/styles-CZZRuG1z.css +0 -2
  46. package/dist/client/assets/ui-Bj6uJIr8.js +0 -1
  47. package/dist/server/assets/_authed-BaehIntL.js +0 -40
  48. package/dist/server/assets/_tanstack-start-manifest_v-eNUCOzFz.js +0 -40
  49. package/dist/server/assets/dynamodb-DejcakaF.js +0 -187
  50. package/dist/server/assets/firestore-BH-gx9no.js +0 -112
  51. package/dist/server/assets/fns-CgB12FUN.js +0 -31
  52. package/dist/server/assets/fns-Yg8sT1Cb.js +0 -87
  53. package/dist/server/assets/memory-4DwW5cTO.js +0 -59
  54. package/dist/server/assets/rollups-JXbazRNh.js +0 -22
  55. package/dist/server/assets/src-D5jyi_C4.js +0 -235
@@ -0,0 +1,106 @@
1
+ import { useState } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/components/range-picker.tsx
4
+ var PRESETS = [
5
+ ["24h", "Last 24 hours"],
6
+ ["7d", "Last 7 days"],
7
+ ["14d", "Last 14 days"],
8
+ ["30d", "Last 30 days"],
9
+ ["90d", "Last 90 days"],
10
+ ["custom", "Custom range…"]
11
+ ];
12
+ function rangeSearch(s) {
13
+ const pick = (k) => typeof s[k] === "string" ? s[k] : void 0;
14
+ return {
15
+ range: pick("range"),
16
+ from: pick("from"),
17
+ to: pick("to")
18
+ };
19
+ }
20
+ /** Preset select, plus two date inputs for a custom range. Calls onChange with the new search params. */
21
+ function RangePicker({ value, today, onChange }) {
22
+ const [custom, setCustom] = useState(value.preset === "custom");
23
+ const [from, setFrom] = useState(value.from);
24
+ const [to, setTo] = useState(value.to);
25
+ const input = "rounded-md border border-line bg-panel px-2 py-1.5 text-sm";
26
+ return /* @__PURE__ */ jsxs("div", {
27
+ className: "flex flex-wrap items-center gap-2",
28
+ children: [/* @__PURE__ */ jsx("select", {
29
+ "aria-label": "Date range",
30
+ value: custom ? "custom" : value.preset,
31
+ onChange: (e) => {
32
+ const v = e.target.value;
33
+ if (v === "custom") return setCustom(true);
34
+ setCustom(false);
35
+ onChange({
36
+ range: v === "14d" ? void 0 : v,
37
+ from: void 0,
38
+ to: void 0
39
+ });
40
+ },
41
+ className: input,
42
+ children: PRESETS.map(([v, label]) => /* @__PURE__ */ jsx("option", {
43
+ value: v,
44
+ children: label
45
+ }, v))
46
+ }), custom && /* @__PURE__ */ jsxs("form", {
47
+ className: "flex flex-wrap items-center gap-2",
48
+ onSubmit: (e) => {
49
+ e.preventDefault();
50
+ if (from && to) onChange({
51
+ range: "custom",
52
+ from: from <= to ? from : to,
53
+ to: from <= to ? to : from
54
+ });
55
+ },
56
+ children: [
57
+ /* @__PURE__ */ jsx("input", {
58
+ type: "date",
59
+ "aria-label": "From",
60
+ value: from,
61
+ max: today,
62
+ onChange: (e) => setFrom(e.target.value),
63
+ className: input
64
+ }),
65
+ /* @__PURE__ */ jsx("span", {
66
+ className: "text-muted",
67
+ children: "to"
68
+ }),
69
+ /* @__PURE__ */ jsx("input", {
70
+ type: "date",
71
+ "aria-label": "To",
72
+ value: to,
73
+ max: today,
74
+ onChange: (e) => setTo(e.target.value),
75
+ className: input
76
+ }),
77
+ /* @__PURE__ */ jsx("button", {
78
+ type: "submit",
79
+ className: "rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white",
80
+ children: "Apply"
81
+ })
82
+ ]
83
+ })]
84
+ });
85
+ }
86
+ /** "Counts kept forever; details from 14 Sep" — shown when the range reaches past retention. */
87
+ function RetentionNote({ rangeFrom, retention }) {
88
+ if (!retention.detailsFrom || rangeFrom >= retention.detailsFrom) return null;
89
+ const when = (/* @__PURE__ */ new Date(`${retention.detailsFrom}T00:00:00Z`)).toLocaleDateString("en-GB", {
90
+ day: "numeric",
91
+ month: "short",
92
+ year: "numeric",
93
+ timeZone: "UTC"
94
+ });
95
+ return /* @__PURE__ */ jsxs("p", {
96
+ className: "rounded-lg border border-line bg-panel-2 px-3 py-2 text-xs text-muted",
97
+ children: [
98
+ "Raw events are kept for ",
99
+ retention.days,
100
+ " days, so details (stack traces, breadcrumbs) before ",
101
+ when,
102
+ " have expired. The counts and charts still cover the whole range."
103
+ ]
104
+ });
105
+ }
106
+ export { RetentionNote as n, rangeSearch as r, RangePicker as t };
@@ -0,0 +1,12 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ export { __exportAll as t };
@@ -1,23 +1,13 @@
1
- import { i as getSessionUser, n as getLoginInfo, r as getOverview, t as getIssueDetail } from "./fns-CgB12FUN.js";
2
- import { n as ingest, r as parseIngestKeys, t as CORS_HEADERS } from "./src-D5jyi_C4.js";
3
- import { a as authorizeApi, d as getLocalWriteStore, f as getStore, n as buildIssueDetail, p as config, r as buildSummary, t as SUMMARY_FIELDS } from "./queries-DIVV-5j6.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
+ import { a as getOverview, c as getTeam, i as getLoginInfo, n as getInvite, o as getSessionUser, r as getIssueDetail, s as getSettings } from "./fns-DwGaMi8S.js";
3
+ import { r as rangeSearch } from "./range-picker-0zbSGr3Z.js";
4
+ import { A as getLocalWriteStore, M as config, _ as CORS_HEADERS, a as authorizeApi, j as getStore, n as buildIssueDetail, r as buildSummary, t as SUMMARY_FIELDS, v as ingest, y as parseIngestKeys } from "./queries-BJxX3Kjp.js";
4
5
  import { HeadContent, Outlet, Scripts, createFileRoute, createRootRoute, createRouter, lazyRouteComponent, notFound, redirect } from "@tanstack/react-router";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
- // \0rolldown/runtime.js
7
- var __defProp = Object.defineProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- return target;
16
- };
17
7
  // src/styles.css?url
18
- var styles_default = "/assets/styles-CZZRuG1z.css";
8
+ var styles_default = "/assets/styles-DztngwT9.css";
19
9
  // src/routes/__root.tsx
20
- var Route$7 = createRootRoute({
10
+ var Route$10 = createRootRoute({
21
11
  head: () => ({
22
12
  meta: [
23
13
  { charSet: "utf-8" },
@@ -52,34 +42,55 @@ function RootDocument({ children }) {
52
42
  });
53
43
  }
54
44
  // src/routes/_authed.tsx
55
- var $$splitComponentImporter$3 = () => import("./_authed-BaehIntL.js");
56
- var Route$6 = createFileRoute("/_authed")({
45
+ var $$splitComponentImporter$6 = () => import("./_authed-DDQ5yYfy.js");
46
+ var Route$9 = createFileRoute("/_authed")({
57
47
  beforeLoad: async () => {
58
48
  const user = await getSessionUser();
59
49
  if (!user) throw redirect({ to: "/login" });
60
50
  return { user };
61
51
  },
62
- component: lazyRouteComponent($$splitComponentImporter$3, "component")
52
+ component: lazyRouteComponent($$splitComponentImporter$6, "component")
63
53
  });
64
54
  // src/routes/login.tsx
65
- var $$splitComponentImporter$2 = () => import("./login-h3B5Vdhl.js");
66
- var Route$5 = createFileRoute("/login")({
55
+ var $$splitComponentImporter$5 = () => import("./login-BXi46U4B.js");
56
+ var Route$8 = createFileRoute("/login")({
67
57
  beforeLoad: async () => {
68
58
  if (await getSessionUser()) throw redirect({ to: "/" });
69
59
  },
70
60
  loader: () => getLoginInfo(),
71
- component: lazyRouteComponent($$splitComponentImporter$2, "component")
61
+ component: lazyRouteComponent($$splitComponentImporter$5, "component")
72
62
  });
73
63
  // src/routes/_authed/index.tsx
74
- var $$splitComponentImporter$1 = () => import("./_authed-ClbGOSDJ.js");
75
- var Route$4 = createFileRoute("/_authed/")({
64
+ var $$splitComponentImporter$4 = () => import("./_authed-Dray_9Ct.js");
65
+ var Route$7 = createFileRoute("/_authed/")({
76
66
  validateSearch: (s) => ({
77
67
  app: typeof s.app === "string" ? s.app : void 0,
78
- flow: typeof s.flow === "string" ? s.flow : void 0
68
+ flow: typeof s.flow === "string" ? s.flow : void 0,
69
+ status: typeof s.status === "string" ? s.status : void 0,
70
+ ...rangeSearch(s)
71
+ }),
72
+ loaderDeps: ({ search }) => ({
73
+ app: search.app,
74
+ range: search.range,
75
+ from: search.from,
76
+ to: search.to
79
77
  }),
78
+ loader: ({ deps }) => getOverview({ data: deps }),
79
+ component: lazyRouteComponent($$splitComponentImporter$4, "component")
80
+ });
81
+ // src/routes/_authed/settings.tsx
82
+ var $$splitComponentImporter$3 = () => import("./settings-ByFLIJce.js");
83
+ var Route$6 = createFileRoute("/_authed/settings")({
84
+ validateSearch: (s) => ({ app: typeof s.app === "string" ? s.app : void 0 }),
80
85
  loaderDeps: ({ search }) => ({ app: search.app }),
81
- loader: ({ deps }) => getOverview({ data: { app: deps.app } }),
82
- component: lazyRouteComponent($$splitComponentImporter$1, "component")
86
+ loader: ({ deps }) => getSettings({ data: deps }),
87
+ component: lazyRouteComponent($$splitComponentImporter$3, "component")
88
+ });
89
+ // src/routes/_authed/team.tsx
90
+ var $$splitComponentImporter$2 = () => import("./team-CifrrNkf.js");
91
+ var Route$5 = createFileRoute("/_authed/team")({
92
+ loader: () => getTeam(),
93
+ component: lazyRouteComponent($$splitComponentImporter$2, "component")
83
94
  });
84
95
  // src/routes/api/ingest.ts
85
96
  /**
@@ -87,7 +98,7 @@ var Route$4 = createFileRoute("/_authed/")({
87
98
  * Point the SDK at http://localhost:4400/api/ingest with ingestKey "pk_local".
88
99
  * In production, events go to the ingest function in your own cloud instead.
89
100
  */
90
- var Route$3 = createFileRoute("/api/ingest")({ server: { handlers: {
101
+ var Route$4 = createFileRoute("/api/ingest")({ server: { handlers: {
91
102
  OPTIONS: async () => new Response(null, {
92
103
  status: 204,
93
104
  headers: CORS_HEADERS
@@ -113,10 +124,19 @@ var Route$3 = createFileRoute("/api/ingest")({ server: { handlers: {
113
124
  } } });
114
125
  // src/routes/api/summary.ts
115
126
  /** GET /api/summary?app=<id> — the overview as JSON, for agents and scripts. */
116
- var Route$2 = createFileRoute("/api/summary")({ server: { handlers: { GET: async ({ request }) => {
117
- if (!authorizeApi(request)) return Response.json({ error: "unauthorized" }, { status: 401 });
118
- const app = new URL(request.url).searchParams.get("app") ?? void 0;
119
- const summary = await buildSummary(await getStore(), app, config().severity);
127
+ var Route$3 = createFileRoute("/api/summary")({ server: { handlers: { GET: async ({ request }) => {
128
+ if (!await authorizeApi(request)) return Response.json({ error: "unauthorized" }, { status: 401 });
129
+ const q = new URL(request.url).searchParams;
130
+ const app = q.get("app") ?? void 0;
131
+ const range = {
132
+ range: q.get("range") ?? void 0,
133
+ from: q.get("from") ?? void 0,
134
+ to: q.get("to") ?? void 0
135
+ };
136
+ const summary = await buildSummary(await getStore(), app, config().severity, Date.now(), {
137
+ range,
138
+ retentionDays: config().retentionDays
139
+ });
120
140
  if (!summary) return Response.json({ error: "no data" }, { status: 404 });
121
141
  return Response.json({
122
142
  ...summary,
@@ -124,14 +144,28 @@ var Route$2 = createFileRoute("/api/summary")({ server: { handlers: { GET: async
124
144
  _severityThresholds24h: config().severity
125
145
  });
126
146
  } } } });
147
+ // src/routes/invite.$token.tsx
148
+ var $$splitComponentImporter$1 = () => import("./invite._token-BWiwnST7.js");
149
+ var Route$2 = createFileRoute("/invite/$token")({
150
+ loader: ({ params }) => getInvite({ data: { token: params.token } }),
151
+ component: lazyRouteComponent($$splitComponentImporter$1, "component")
152
+ });
127
153
  // src/routes/_authed/issues.$fingerprint.tsx
128
- var $$splitComponentImporter = () => import("./issues._fingerprint-D78dy5os.js");
154
+ var $$splitComponentImporter = () => import("./issues._fingerprint-D9vjIk3M.js");
129
155
  var Route$1 = createFileRoute("/_authed/issues/$fingerprint")({
130
- validateSearch: (s) => ({ app: typeof s.app === "string" ? s.app : "" }),
131
- loaderDeps: ({ search }) => ({ app: search.app }),
156
+ validateSearch: (s) => ({
157
+ app: typeof s.app === "string" ? s.app : "",
158
+ ...rangeSearch(s)
159
+ }),
160
+ loaderDeps: ({ search }) => ({
161
+ app: search.app,
162
+ range: search.range,
163
+ from: search.from,
164
+ to: search.to
165
+ }),
132
166
  loader: async ({ params, deps }) => {
133
167
  const d = await getIssueDetail({ data: {
134
- app: deps.app,
168
+ ...deps,
135
169
  fingerprint: params.fingerprint
136
170
  } });
137
171
  if (!d) throw notFound();
@@ -139,40 +173,66 @@ var Route$1 = createFileRoute("/_authed/issues/$fingerprint")({
139
173
  },
140
174
  component: lazyRouteComponent($$splitComponentImporter, "component")
141
175
  });
176
+ /** Resolve (with the fixed version), ignore or reopen, and open a prefilled ticket. */
142
177
  // src/routes/api/issues/$fingerprint.ts
143
178
  /** GET /api/issues/<fingerprint>?app=<id> — one issue with breakdowns, sample stack, breadcrumbs and hints. */
144
179
  var Route = createFileRoute("/api/issues/$fingerprint")({ server: { handlers: { GET: async ({ request, params }) => {
145
- if (!authorizeApi(request)) return Response.json({ error: "unauthorized" }, { status: 401 });
146
- const app = new URL(request.url).searchParams.get("app");
180
+ if (!await authorizeApi(request)) return Response.json({ error: "unauthorized" }, { status: 401 });
181
+ const q = new URL(request.url).searchParams;
182
+ const app = q.get("app");
147
183
  if (!app) return Response.json({ error: "app query param required" }, { status: 400 });
148
- const detail = await buildIssueDetail(await getStore(), app, params.fingerprint, config().severity);
184
+ const range = {
185
+ range: q.get("range") ?? void 0,
186
+ from: q.get("from") ?? void 0,
187
+ to: q.get("to") ?? void 0
188
+ };
189
+ const detail = await buildIssueDetail(await getStore(), app, params.fingerprint, config().severity, Date.now(), {
190
+ range,
191
+ retentionDays: config().retentionDays,
192
+ trackers: config().trackers
193
+ });
149
194
  if (!detail) return Response.json({ error: "not found" }, { status: 404 });
150
195
  return Response.json(detail);
151
196
  } } } });
152
197
  // src/routeTree.gen.ts
153
- var AuthedRoute = Route$6.update({
198
+ var AuthedRoute = Route$9.update({
154
199
  id: "/_authed",
155
- getParentRoute: () => Route$7
200
+ getParentRoute: () => Route$10
156
201
  });
157
- var LoginRoute = Route$5.update({
202
+ var LoginRoute = Route$8.update({
158
203
  id: "/login",
159
204
  path: "/login",
160
- getParentRoute: () => Route$7
205
+ getParentRoute: () => Route$10
161
206
  });
162
- var AuthedIndexRoute = Route$4.update({
207
+ var AuthedIndexRoute = Route$7.update({
163
208
  id: "/",
164
209
  path: "/",
165
210
  getParentRoute: () => AuthedRoute
166
211
  });
167
- var ApiIngestRoute = Route$3.update({
212
+ var AuthedSettingsRoute = Route$6.update({
213
+ id: "/settings",
214
+ path: "/settings",
215
+ getParentRoute: () => AuthedRoute
216
+ });
217
+ var AuthedTeamRoute = Route$5.update({
218
+ id: "/team",
219
+ path: "/team",
220
+ getParentRoute: () => AuthedRoute
221
+ });
222
+ var ApiIngestRoute = Route$4.update({
168
223
  id: "/api/ingest",
169
224
  path: "/api/ingest",
170
- getParentRoute: () => Route$7
225
+ getParentRoute: () => Route$10
171
226
  });
172
- var ApiSummaryRoute = Route$2.update({
227
+ var ApiSummaryRoute = Route$3.update({
173
228
  id: "/api/summary",
174
229
  path: "/api/summary",
175
- getParentRoute: () => Route$7
230
+ getParentRoute: () => Route$10
231
+ });
232
+ var InviteTokenRoute = Route$2.update({
233
+ id: "/invite/$token",
234
+ path: "/invite/$token",
235
+ getParentRoute: () => Route$10
176
236
  });
177
237
  var AuthedIssuesFingerprintRoute = Route$1.update({
178
238
  id: "/issues/$fingerprint",
@@ -182,9 +242,11 @@ var AuthedIssuesFingerprintRoute = Route$1.update({
182
242
  var ApiIssuesFingerprintRoute = Route.update({
183
243
  id: "/api/issues/$fingerprint",
184
244
  path: "/api/issues/$fingerprint",
185
- getParentRoute: () => Route$7
245
+ getParentRoute: () => Route$10
186
246
  });
187
247
  var AuthedRouteChildren = {
248
+ AuthedSettingsRoute,
249
+ AuthedTeamRoute,
188
250
  AuthedIndexRoute,
189
251
  AuthedIssuesFingerprintRoute
190
252
  };
@@ -193,9 +255,10 @@ var rootRouteChildren = {
193
255
  LoginRoute,
194
256
  ApiIngestRoute,
195
257
  ApiSummaryRoute,
258
+ InviteTokenRoute,
196
259
  ApiIssuesFingerprintRoute
197
260
  };
198
- var routeTree = Route$7._addFileChildren(rootRouteChildren)._addFileTypes();
261
+ var routeTree = Route$10._addFileChildren(rootRouteChildren)._addFileTypes();
199
262
  // src/router.tsx
200
263
  var router_exports = /* @__PURE__ */ __exportAll({ getRouter: () => getRouter });
201
264
  function getRouter() {
@@ -219,4 +282,4 @@ function getRouter() {
219
282
  })
220
283
  });
221
284
  }
222
- export { Route$6 as a, getRouter, Route$5 as i, Route$1 as n, Route$4 as r, router_exports as t };
285
+ export { Route$6 as a, Route$9 as c, getRouter, Route$5 as i, Route$1 as n, Route$7 as o, Route$2 as r, Route$8 as s, router_exports as t };