adonisjs-server-stats 1.11.4 → 1.11.6
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.
- package/README.md +6 -6
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +550 -468
- package/dist/react/style.css +1 -1
- package/dist/src/edge/client-vue/dashboard.js +2 -2
- package/dist/src/edge/client-vue/debug-panel-deferred.js +1 -1
- package/dist/src/provider/server_stats_provider.d.ts +8 -0
- package/dist/src/provider/server_stats_provider.js +16 -6
- package/dist/src/routes/dashboard_routes.d.ts +1 -0
- package/dist/src/routes/dashboard_routes.js +7 -0
- package/dist/src/routes/debug_routes.d.ts +1 -0
- package/dist/src/routes/debug_routes.js +7 -0
- package/dist/src/routes/register_routes.d.ts +2 -0
- package/dist/src/routes/register_routes.js +2 -0
- package/dist/src/styles/dashboard.css +19 -18
- package/dist/src/styles/debug-panel.css +2 -0
- package/dist/src/styles/stats-bar.css +1 -0
- package/dist/vue/style.css +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
class
|
|
1
|
+
class x extends Error {
|
|
2
2
|
status;
|
|
3
3
|
constructor(t = 403) {
|
|
4
4
|
super(`Unauthorized (HTTP ${t})`), this.name = "UnauthorizedError", this.status = t;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class K extends Error {
|
|
8
8
|
status;
|
|
9
9
|
body;
|
|
10
10
|
constructor(t, r) {
|
|
11
11
|
super(`API error (HTTP ${t})`), this.name = "ApiError", this.status = t, this.body = r;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class C {
|
|
15
15
|
baseUrl;
|
|
16
16
|
authToken;
|
|
17
17
|
constructor(t) {
|
|
@@ -25,26 +25,26 @@ class E {
|
|
|
25
25
|
* @returns Parsed JSON response body typed as `T`.
|
|
26
26
|
*/
|
|
27
27
|
async fetch(t, r) {
|
|
28
|
-
const
|
|
28
|
+
const s = {
|
|
29
29
|
...{
|
|
30
30
|
Accept: "application/json",
|
|
31
31
|
...this.authToken ? { Authorization: `Bearer ${this.authToken}` } : {}
|
|
32
32
|
},
|
|
33
33
|
...r?.headers
|
|
34
|
-
},
|
|
34
|
+
}, o = await globalThis.fetch(`${this.baseUrl}${t}`, {
|
|
35
35
|
...r,
|
|
36
|
-
headers:
|
|
36
|
+
headers: s,
|
|
37
37
|
credentials: this.authToken ? "omit" : "include"
|
|
38
38
|
});
|
|
39
39
|
if (r?.signal?.aborted)
|
|
40
40
|
throw new DOMException("The operation was aborted.", "AbortError");
|
|
41
|
-
if (
|
|
42
|
-
throw new
|
|
43
|
-
if (!
|
|
44
|
-
const i = await
|
|
45
|
-
throw new
|
|
41
|
+
if (o.status === 401 || o.status === 403)
|
|
42
|
+
throw new x(o.status);
|
|
43
|
+
if (!o.ok) {
|
|
44
|
+
const i = await o.text().catch(() => "");
|
|
45
|
+
throw new K(o.status, i);
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return o.json();
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Perform a GET request.
|
|
@@ -84,22 +84,22 @@ class E {
|
|
|
84
84
|
return this.fetch(t, { method: "DELETE" });
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function z(e, t) {
|
|
88
88
|
const r = e || (typeof window < "u" ? window.location.origin : "");
|
|
89
89
|
if (!t)
|
|
90
90
|
return { baseUrl: r };
|
|
91
91
|
const n = { headers: { Authorization: `Bearer ${t}` } };
|
|
92
92
|
return {
|
|
93
93
|
baseUrl: r,
|
|
94
|
-
beforeSubscribe(
|
|
94
|
+
beforeSubscribe(s) {
|
|
95
95
|
return n;
|
|
96
96
|
},
|
|
97
|
-
beforeUnsubscribe(
|
|
97
|
+
beforeUnsubscribe(s) {
|
|
98
98
|
return n;
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
async function
|
|
102
|
+
async function j() {
|
|
103
103
|
if (typeof window < "u" && window.Transmit && typeof window.Transmit == "function")
|
|
104
104
|
return window.Transmit;
|
|
105
105
|
try {
|
|
@@ -109,17 +109,17 @@ async function q() {
|
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function W(e) {
|
|
113
113
|
let t = null, r = null, n = !1;
|
|
114
114
|
return { subscribe: async () => {
|
|
115
115
|
try {
|
|
116
|
-
const i = await
|
|
116
|
+
const i = await j();
|
|
117
117
|
if (!i)
|
|
118
118
|
throw new Error(
|
|
119
119
|
"Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)"
|
|
120
120
|
);
|
|
121
121
|
if (n) return;
|
|
122
|
-
t = new i(
|
|
122
|
+
t = new i(z(e.baseUrl, e.authToken)), r = t.subscription(e.channelName), r.onMessage((a) => {
|
|
123
123
|
n || e.onMessage(a);
|
|
124
124
|
}), await r.create();
|
|
125
125
|
} catch (i) {
|
|
@@ -133,9 +133,9 @@ function z(e) {
|
|
|
133
133
|
}
|
|
134
134
|
} };
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function V(e) {
|
|
137
137
|
let t = !1;
|
|
138
|
-
const r =
|
|
138
|
+
const r = W({
|
|
139
139
|
baseUrl: e.baseUrl,
|
|
140
140
|
channelName: e.channelName,
|
|
141
141
|
authToken: e.authToken,
|
|
@@ -155,38 +155,38 @@ function K(e) {
|
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
158
|
+
const E = "ss-dash-theme", P = "ss-theme-change";
|
|
159
|
+
function I() {
|
|
160
160
|
if (typeof window > "u") return "light";
|
|
161
|
-
const e = localStorage.getItem(
|
|
161
|
+
const e = localStorage.getItem(E);
|
|
162
162
|
return e === "dark" || e === "light" ? e : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
typeof window > "u" || (localStorage.setItem(
|
|
164
|
+
function G(e) {
|
|
165
|
+
typeof window > "u" || (localStorage.setItem(E, e), window.dispatchEvent(new CustomEvent(P, { detail: e })));
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
const t =
|
|
169
|
-
return
|
|
167
|
+
function Ge() {
|
|
168
|
+
const t = I() === "dark" ? "light" : "dark";
|
|
169
|
+
return G(t), t;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Qe(e) {
|
|
172
172
|
if (typeof window > "u") return () => {
|
|
173
173
|
};
|
|
174
|
-
const t = (
|
|
175
|
-
const i =
|
|
174
|
+
const t = (o) => {
|
|
175
|
+
const i = o.detail;
|
|
176
176
|
(i === "dark" || i === "light") && e(i);
|
|
177
|
-
}, r = (
|
|
178
|
-
if (
|
|
179
|
-
const i =
|
|
180
|
-
e(i === "dark" || i === "light" ? i :
|
|
177
|
+
}, r = (o) => {
|
|
178
|
+
if (o.key === E) {
|
|
179
|
+
const i = o.newValue;
|
|
180
|
+
e(i === "dark" || i === "light" ? i : I());
|
|
181
181
|
}
|
|
182
|
-
}, n = window.matchMedia("(prefers-color-scheme: dark)"),
|
|
183
|
-
localStorage.getItem(
|
|
182
|
+
}, n = window.matchMedia("(prefers-color-scheme: dark)"), s = (o) => {
|
|
183
|
+
localStorage.getItem(E) || e(o.matches ? "dark" : "light");
|
|
184
184
|
};
|
|
185
|
-
return window.addEventListener(
|
|
186
|
-
window.removeEventListener(
|
|
185
|
+
return window.addEventListener(P, t), window.addEventListener("storage", r), n.addEventListener("change", s), () => {
|
|
186
|
+
window.removeEventListener(P, t), window.removeEventListener("storage", r), n.removeEventListener("change", s);
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
const
|
|
189
|
+
const S = {
|
|
190
190
|
color: "#34d399",
|
|
191
191
|
fillOpacityTop: 0.25,
|
|
192
192
|
fillOpacityBottom: 0.02,
|
|
@@ -195,96 +195,96 @@ const y = {
|
|
|
195
195
|
height: 32,
|
|
196
196
|
padding: 2
|
|
197
197
|
};
|
|
198
|
-
function
|
|
199
|
-
return { ...
|
|
198
|
+
function Q(e) {
|
|
199
|
+
return { ...S, ...e };
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Je(e, t = S.width, r = S.height, n = S.padding) {
|
|
202
202
|
if (e.length < 2) return null;
|
|
203
|
-
const
|
|
204
|
-
return e.map((
|
|
205
|
-
const
|
|
206
|
-
return `${
|
|
203
|
+
const s = t - n * 2, o = r - n * 2, i = Math.min(...e), c = Math.max(...e) - i || 1;
|
|
204
|
+
return e.map((g, f) => {
|
|
205
|
+
const p = n + f / (e.length - 1) * s, d = n + o - (g - i) / c * o;
|
|
206
|
+
return `${p.toFixed(1)},${d.toFixed(1)}`;
|
|
207
207
|
}).join(" ");
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Ye(e, t = S.width, r = S.height, n = S.padding) {
|
|
210
210
|
if (e.length < 2) return null;
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
return `${
|
|
214
|
-
}),
|
|
215
|
-
return `M${l[0]} ` + l.slice(1).map((
|
|
211
|
+
const s = t - n * 2, o = r - n * 2, i = Math.min(...e), c = Math.max(...e) - i || 1, l = e.map((d, m) => {
|
|
212
|
+
const u = n + m / (e.length - 1) * s, y = n + o - (d - i) / c * o;
|
|
213
|
+
return `${u.toFixed(1)},${y.toFixed(1)}`;
|
|
214
|
+
}), g = (n + s).toFixed(1), f = (n + o).toFixed(1), p = n.toFixed(1);
|
|
215
|
+
return `M${l[0]} ` + l.slice(1).map((d) => `L${d}`).join(" ") + ` L${g},${f} L${p},${f} Z`;
|
|
216
216
|
}
|
|
217
|
-
let
|
|
218
|
-
function
|
|
219
|
-
return `ss-grad-${
|
|
217
|
+
let J = 0;
|
|
218
|
+
function Y() {
|
|
219
|
+
return `ss-grad-${J++}`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function X(e) {
|
|
222
222
|
if (e.length === 0) return null;
|
|
223
223
|
let t = e[0], r = e[0], n = e[0];
|
|
224
|
-
for (let
|
|
225
|
-
const
|
|
226
|
-
|
|
224
|
+
for (let s = 1; s < e.length; s++) {
|
|
225
|
+
const o = e[s];
|
|
226
|
+
o < t && (t = o), o > r && (r = o), n += o;
|
|
227
227
|
}
|
|
228
228
|
return { min: t, max: r, avg: n / e.length };
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Xe(e, t) {
|
|
231
231
|
if (e.length < 2) return null;
|
|
232
|
-
const r =
|
|
233
|
-
for (let
|
|
234
|
-
const
|
|
235
|
-
l[
|
|
232
|
+
const r = Q(t), n = X(e), s = n.max - n.min || 1, o = r.width - r.padding * 2, i = r.height - r.padding * 2, a = r.padding, c = e.length, l = Array.from({ length: c });
|
|
233
|
+
for (let u = 0; u < c; u++) {
|
|
234
|
+
const y = a + u / (c - 1) * o, v = a + i - (e[u] - n.min) / s * i;
|
|
235
|
+
l[u] = `${y.toFixed(1)},${v.toFixed(1)}`;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const g = l.join(" "), f = (a + o).toFixed(1), p = (a + i).toFixed(1), d = a.toFixed(1), m = `M${l[0]} ` + l.slice(1).map((u) => `L${u}`).join(" ") + ` L${f},${p} L${d},${p} Z`;
|
|
238
238
|
return {
|
|
239
|
-
points:
|
|
240
|
-
areaPath:
|
|
241
|
-
gradientId:
|
|
239
|
+
points: g,
|
|
240
|
+
areaPath: m,
|
|
241
|
+
gradientId: Y(),
|
|
242
242
|
options: r,
|
|
243
243
|
stats: n
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
-
const
|
|
247
|
-
function
|
|
246
|
+
const Z = 5e3, ee = 1e4, te = 3e3, re = 100, ne = 500, oe = 60, se = 1e4;
|
|
247
|
+
function ie(e) {
|
|
248
248
|
return '"' + (e.length > 40 ? e.slice(0, 40) + "..." : e) + '"';
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function ae(e, t, r) {
|
|
251
251
|
if (e.length === 0) return "[]";
|
|
252
|
-
const n = e.slice(0, 3).map((i) => r(i, 30)),
|
|
253
|
-
return
|
|
252
|
+
const n = e.slice(0, 3).map((i) => r(i, 30)), s = e.length > 3 ? ", ..." + e.length + " items" : "", o = "[" + n.join(", ") + s + "]";
|
|
253
|
+
return o.length > t ? "[" + e.length + " items]" : o;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function ce(e, t, r) {
|
|
256
256
|
const n = Object.keys(e);
|
|
257
257
|
if (n.length === 0) return "{}";
|
|
258
|
-
const
|
|
258
|
+
const s = [];
|
|
259
259
|
for (let c = 0; c < Math.min(n.length, 4); c++)
|
|
260
|
-
|
|
261
|
-
const
|
|
260
|
+
s.push(n[c] + ": " + r(e[n[c]], 30));
|
|
261
|
+
const o = n.length > 4 ? ", ...+" + (n.length - 4) : "", i = "{ " + s.join(", ") + o + " }";
|
|
262
262
|
return i.length <= t ? i : "{ " + (n.slice(0, 6).join(", ") + (n.length > 6 ? ", ..." : "")) + " }";
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function le(e) {
|
|
265
265
|
if (!e && e !== 0) return "-";
|
|
266
|
-
const t = Math.floor(e), r = Math.floor(t / 86400), n = Math.floor(t % 86400 / 3600),
|
|
267
|
-
return r > 0 ? `${r}d ${n}h` : n > 0 ? `${n}h ${
|
|
266
|
+
const t = Math.floor(e), r = Math.floor(t / 86400), n = Math.floor(t % 86400 / 3600), s = Math.floor(t % 3600 / 60);
|
|
267
|
+
return r > 0 ? `${r}d ${n}h` : n > 0 ? `${n}h ${s}m` : s > 0 ? `${s}m ${t % 60}s` : `${t}s`;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function A(e) {
|
|
270
270
|
const t = e / 1048576;
|
|
271
271
|
return t >= 1024 ? `${(t / 1024).toFixed(1)}G` : `${t.toFixed(0)}M`;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function F(e) {
|
|
274
274
|
return e >= 1024 ? `${(e / 1024).toFixed(1)}G` : `${e.toFixed(1)}M`;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function ue(e) {
|
|
277
277
|
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}K` : `${e}`;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Ze(e) {
|
|
280
280
|
return e >= 1e3 ? `${(e / 1e3).toFixed(2)}s` : e >= 1 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function H(e) {
|
|
283
283
|
return /([+-]\d{2}:?\d{2}|Z)\s*$/.test(e) ? e : e + "Z";
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function et(e) {
|
|
286
286
|
if (!e) return "-";
|
|
287
|
-
const t = typeof e == "string" ? new Date(
|
|
287
|
+
const t = typeof e == "string" ? new Date(H(e)) : new Date(e);
|
|
288
288
|
return Number.isNaN(t.getTime()) ? "-" : t.toLocaleTimeString("en-US", {
|
|
289
289
|
hour12: !1,
|
|
290
290
|
hour: "2-digit",
|
|
@@ -292,12 +292,12 @@ function Qe(e) {
|
|
|
292
292
|
second: "2-digit"
|
|
293
293
|
}) + "." + String(t.getMilliseconds()).padStart(3, "0");
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function tt(e) {
|
|
296
296
|
if (!e) return "-";
|
|
297
|
-
const t = typeof e == "string" ? new Date(
|
|
297
|
+
const t = typeof e == "string" ? new Date(H(e)).getTime() : e, r = Math.floor((Date.now() - t) / 1e3);
|
|
298
298
|
return r < 0 ? "just now" : r < 60 ? `${r}s ago` : r < 3600 ? `${Math.floor(r / 60)}m ago` : r < 86400 ? `${Math.floor(r / 3600)}h ago` : `${Math.floor(r / 86400)}d ago`;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function rt(e, t) {
|
|
301
301
|
switch (t) {
|
|
302
302
|
case "%":
|
|
303
303
|
return `${e.toFixed(1)}%`;
|
|
@@ -306,7 +306,7 @@ function Ye(e, t) {
|
|
|
306
306
|
case "MB":
|
|
307
307
|
return `${e.toFixed(1)}M`;
|
|
308
308
|
case "bytes":
|
|
309
|
-
return
|
|
309
|
+
return A(e);
|
|
310
310
|
case "/s":
|
|
311
311
|
case "/m":
|
|
312
312
|
return e.toFixed(1);
|
|
@@ -314,75 +314,75 @@ function Ye(e, t) {
|
|
|
314
314
|
return e.toFixed(1);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function w(e, t, r) {
|
|
318
318
|
return e > r ? "red" : e > t ? "amber" : "green";
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function he(e, t, r) {
|
|
321
321
|
return e < r ? "red" : e < t ? "amber" : "green";
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function U(e, t) {
|
|
324
324
|
if (t === 0) return "green";
|
|
325
325
|
const r = e / t;
|
|
326
326
|
return r > 0.8 ? "red" : r > 0.5 ? "amber" : "green";
|
|
327
327
|
}
|
|
328
|
-
const
|
|
328
|
+
const de = {
|
|
329
329
|
green: "ss-green",
|
|
330
330
|
amber: "ss-amber",
|
|
331
331
|
red: "ss-red"
|
|
332
|
-
},
|
|
332
|
+
}, nt = {
|
|
333
333
|
green: "#34d399",
|
|
334
334
|
amber: "#fbbf24",
|
|
335
335
|
red: "#f87171"
|
|
336
|
-
},
|
|
336
|
+
}, ot = {
|
|
337
337
|
green: "--ss-accent",
|
|
338
338
|
amber: "--ss-amber-fg",
|
|
339
339
|
red: "--ss-red-fg"
|
|
340
340
|
};
|
|
341
|
-
function
|
|
341
|
+
function st(e) {
|
|
342
342
|
return e >= 500 ? "red" : e >= 400 ? "amber" : "green";
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
return e >
|
|
344
|
+
function fe(e) {
|
|
345
|
+
return e > ne ? "very-slow" : e > re ? "slow" : "normal";
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
const r =
|
|
347
|
+
function it(e, t = "ss-dash") {
|
|
348
|
+
const r = fe(e);
|
|
349
349
|
return r === "very-slow" ? `${t}-very-slow` : r === "slow" ? `${t}-slow` : "";
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function at(e) {
|
|
352
352
|
return e ? e.length <= 8 ? e : e.slice(0, 8) + "…" : "--";
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
return e === null ? "null" : e === void 0 ? "-" : typeof e == "string" ?
|
|
354
|
+
function D(e, t = 100) {
|
|
355
|
+
return e === null ? "null" : e === void 0 ? "-" : typeof e == "string" ? ie(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? ae(e, t, D) : typeof e == "object" ? ce(e, t, D) : String(e);
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function ct(e) {
|
|
358
358
|
return e < 0 ? "no expiry" : e < 60 ? `${e}s` : e < 3600 ? `${Math.floor(e / 60)}m` : e < 86400 ? `${Math.floor(e / 3600)}h` : `${Math.floor(e / 86400)}d`;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function lt(e) {
|
|
361
361
|
return e < 1024 ? `${e}B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)}KB` : `${(e / (1024 * 1024)).toFixed(1)}MB`;
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
function
|
|
363
|
+
const B = 50;
|
|
364
|
+
function ut(e, t, r) {
|
|
365
365
|
const n = new URLSearchParams();
|
|
366
366
|
if (n.set("page", String(e.page)), n.set("perPage", String(e.perPage)), t) {
|
|
367
367
|
t.search && n.set("search", t.search);
|
|
368
|
-
for (const [
|
|
369
|
-
|
|
368
|
+
for (const [s, o] of Object.entries(t.filters))
|
|
369
|
+
o && n.set(s, o);
|
|
370
370
|
}
|
|
371
371
|
return r && (n.set("sort", r.field), n.set("direction", r.direction)), n.toString();
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
const r = e.data ?? e.items ?? [], n = e.total ?? 0,
|
|
373
|
+
function ht(e, t = B) {
|
|
374
|
+
const r = e.data ?? e.items ?? [], n = e.total ?? 0, s = e.page ?? 1, o = e.perPage ?? e.limit ?? t, i = e.totalPages ?? (Math.ceil(n / o) || 1);
|
|
375
375
|
return {
|
|
376
376
|
data: r,
|
|
377
377
|
pagination: {
|
|
378
|
-
page:
|
|
379
|
-
perPage:
|
|
378
|
+
page: s,
|
|
379
|
+
perPage: o,
|
|
380
380
|
total: n,
|
|
381
381
|
totalPages: i
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function dt(e = B) {
|
|
386
386
|
return {
|
|
387
387
|
page: 1,
|
|
388
388
|
perPage: e,
|
|
@@ -390,16 +390,16 @@ function at(e = O) {
|
|
|
390
390
|
totalPages: 1
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function ft() {
|
|
394
394
|
return {
|
|
395
395
|
search: "",
|
|
396
396
|
filters: {}
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function pt(e = "id", t = "desc") {
|
|
400
400
|
return { field: e, direction: t };
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const pe = [
|
|
403
403
|
{ key: "page", param: "page", isNumeric: !0 },
|
|
404
404
|
{ key: "perPage", param: "perPage", isNumeric: !0 },
|
|
405
405
|
{ key: "search", param: "search" },
|
|
@@ -407,39 +407,39 @@ const he = [
|
|
|
407
407
|
{ key: "sortDir", param: "direction" },
|
|
408
408
|
{ key: "timeRange", param: "range" }
|
|
409
409
|
];
|
|
410
|
-
function
|
|
410
|
+
function ge(e) {
|
|
411
411
|
const t = new URLSearchParams(), r = e;
|
|
412
|
-
for (const { key: n, param:
|
|
412
|
+
for (const { key: n, param: s, isNumeric: o } of pe) {
|
|
413
413
|
const i = r[n];
|
|
414
|
-
(
|
|
414
|
+
(o ? i != null : i) && t.set(s, String(i));
|
|
415
415
|
}
|
|
416
416
|
if (e.filters)
|
|
417
|
-
for (const [n,
|
|
418
|
-
|
|
417
|
+
for (const [n, s] of Object.entries(e.filters))
|
|
418
|
+
s && t.set(n, s);
|
|
419
419
|
return t.toString();
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
const t = Math.max(1, Math.ceil(e.total / e.perPage)), r = Math.min(e.page, t), n = e.total === 0 ? 0 : (r - 1) * e.perPage + 1,
|
|
421
|
+
function gt(e) {
|
|
422
|
+
const t = Math.max(1, Math.ceil(e.total / e.perPage)), r = Math.min(e.page, t), n = e.total === 0 ? 0 : (r - 1) * e.perPage + 1, s = Math.min(r * e.perPage, e.total);
|
|
423
423
|
return {
|
|
424
424
|
page: r,
|
|
425
425
|
perPage: e.perPage,
|
|
426
426
|
total: e.total,
|
|
427
427
|
lastPage: t,
|
|
428
428
|
from: n,
|
|
429
|
-
to:
|
|
429
|
+
to: s,
|
|
430
430
|
hasPrev: r > 1,
|
|
431
431
|
hasNext: r < t
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function mt(e, t, r = 2) {
|
|
435
435
|
if (t <= 1) return [1];
|
|
436
|
-
const n = [],
|
|
437
|
-
n.push(1),
|
|
438
|
-
for (let i =
|
|
436
|
+
const n = [], s = Math.max(2, e - r), o = Math.min(t - 1, e + r);
|
|
437
|
+
n.push(1), s > 2 && n.push("...");
|
|
438
|
+
for (let i = s; i <= o; i++)
|
|
439
439
|
n.push(i);
|
|
440
|
-
return
|
|
440
|
+
return o < t - 1 && n.push("..."), t > 1 && n.push(t), n;
|
|
441
441
|
}
|
|
442
|
-
const
|
|
442
|
+
const me = [
|
|
443
443
|
"tracing",
|
|
444
444
|
"process",
|
|
445
445
|
"system",
|
|
@@ -452,7 +452,7 @@ const fe = [
|
|
|
452
452
|
"log",
|
|
453
453
|
"emails",
|
|
454
454
|
"dashboard"
|
|
455
|
-
],
|
|
455
|
+
], ye = [
|
|
456
456
|
{ flag: "process", group: "process" },
|
|
457
457
|
{ flag: "process", group: "memory" },
|
|
458
458
|
{ flag: "system", group: "memory" },
|
|
@@ -462,7 +462,7 @@ const fe = [
|
|
|
462
462
|
{ flag: "queues", group: "queue" },
|
|
463
463
|
{ flag: "app", group: "app" },
|
|
464
464
|
{ flag: "log", group: "log" }
|
|
465
|
-
],
|
|
465
|
+
], be = [
|
|
466
466
|
{ group: "process", fields: ["cpuPercent", "uptime", "nodeVersion"] },
|
|
467
467
|
{
|
|
468
468
|
group: "memory",
|
|
@@ -477,10 +477,10 @@ const fe = [
|
|
|
477
477
|
{ group: "app", fields: ["onlineUsers", "pendingWebhooks", "pendingEmails"] },
|
|
478
478
|
{ group: "log", fields: ["logErrorsLast5m", "logEntriesPerMinute"] }
|
|
479
479
|
];
|
|
480
|
-
function
|
|
480
|
+
function M(e) {
|
|
481
481
|
return typeof e == "number" && !Number.isNaN(e);
|
|
482
482
|
}
|
|
483
|
-
const
|
|
483
|
+
const N = "/admin/api/debug", Se = {
|
|
484
484
|
tracing: !1,
|
|
485
485
|
process: !1,
|
|
486
486
|
system: !1,
|
|
@@ -495,45 +495,45 @@ const I = "/admin/api/debug", ge = {
|
|
|
495
495
|
dashboard: !1,
|
|
496
496
|
customPanes: []
|
|
497
497
|
};
|
|
498
|
-
function
|
|
498
|
+
function ve(e) {
|
|
499
499
|
const t = { customPanes: e.customPanes ?? [] }, r = e.features;
|
|
500
|
-
for (const n of
|
|
500
|
+
for (const n of me)
|
|
501
501
|
t[n] = r?.[n] ?? !1;
|
|
502
502
|
return t;
|
|
503
503
|
}
|
|
504
|
-
async function
|
|
504
|
+
async function xe(e, t = N) {
|
|
505
505
|
const r = `${t.replace(/\/+$/, "")}/config`;
|
|
506
506
|
return e.fetch(r);
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
509
|
-
const { baseUrl: t = "", debugEndpoint: r =
|
|
508
|
+
async function yt(e) {
|
|
509
|
+
const { baseUrl: t = "", debugEndpoint: r = N, authToken: n } = e, s = new C({ baseUrl: t, authToken: n });
|
|
510
510
|
try {
|
|
511
|
-
const
|
|
512
|
-
return
|
|
511
|
+
const o = await xe(s, r);
|
|
512
|
+
return ve(o);
|
|
513
513
|
} catch {
|
|
514
|
-
return
|
|
514
|
+
return Se;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function bt(e) {
|
|
518
518
|
const t = /* @__PURE__ */ new Set(), n = "features" in e && typeof e.features == "object" && e.features !== null ? e.features : e;
|
|
519
|
-
for (const { flag:
|
|
520
|
-
n[
|
|
519
|
+
for (const { flag: s, group: o } of ye)
|
|
520
|
+
n[s] && t.add(o);
|
|
521
521
|
return t;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function St(e) {
|
|
524
524
|
const t = /* @__PURE__ */ new Set();
|
|
525
|
-
(
|
|
526
|
-
for (const r of
|
|
527
|
-
r.fields.some((n) =>
|
|
525
|
+
(M(e.cpuPercent) || M(e.uptime) || we(e)) && t.add("process");
|
|
526
|
+
for (const r of be)
|
|
527
|
+
r.fields.some((n) => M(e[n])) && t.add(r.group);
|
|
528
528
|
return e.redisOk !== void 0 && e.redisOk !== null && t.add("redis"), t;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function we(e) {
|
|
531
531
|
return typeof e.nodeVersion == "string" && e.nodeVersion.length > 0;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
return
|
|
533
|
+
function b(e) {
|
|
534
|
+
return de[e] || "";
|
|
535
535
|
}
|
|
536
|
-
const
|
|
536
|
+
const $ = [
|
|
537
537
|
// ── Process group ─────────────────────────────────────────────────────────
|
|
538
538
|
// -- Node version ---------------------------------------------------------
|
|
539
539
|
{
|
|
@@ -554,7 +554,7 @@ const A = [
|
|
|
554
554
|
unit: "",
|
|
555
555
|
group: "process",
|
|
556
556
|
extract: (e) => e.uptime,
|
|
557
|
-
format: (e) =>
|
|
557
|
+
format: (e) => le(e.uptime),
|
|
558
558
|
color: () => ""
|
|
559
559
|
},
|
|
560
560
|
// -- CPU ------------------------------------------------------------------
|
|
@@ -568,7 +568,7 @@ const A = [
|
|
|
568
568
|
critThreshold: 80,
|
|
569
569
|
extract: (e) => e.cpuPercent,
|
|
570
570
|
format: (e) => `${e.cpuPercent.toFixed(1)}%`,
|
|
571
|
-
color: (e) =>
|
|
571
|
+
color: (e) => b(w(e.cpuPercent, 50, 80)),
|
|
572
572
|
historyKey: "cpuPercent"
|
|
573
573
|
},
|
|
574
574
|
// -- Event loop -----------------------------------------------------------
|
|
@@ -582,7 +582,7 @@ const A = [
|
|
|
582
582
|
critThreshold: 50,
|
|
583
583
|
extract: (e) => e.eventLoopLag,
|
|
584
584
|
format: (e) => `${e.eventLoopLag.toFixed(1)}ms`,
|
|
585
|
-
color: (e) =>
|
|
585
|
+
color: (e) => b(w(e.eventLoopLag, 20, 50)),
|
|
586
586
|
historyKey: "eventLoopLag"
|
|
587
587
|
},
|
|
588
588
|
// ── Memory group ──────────────────────────────────────────────────────────
|
|
@@ -594,7 +594,7 @@ const A = [
|
|
|
594
594
|
unit: "bytes",
|
|
595
595
|
group: "memory",
|
|
596
596
|
extract: (e) => e.memHeapUsed,
|
|
597
|
-
format: (e) =>
|
|
597
|
+
format: (e) => A(e.memHeapUsed),
|
|
598
598
|
color: () => "",
|
|
599
599
|
historyKey: "memHeapUsed"
|
|
600
600
|
},
|
|
@@ -606,7 +606,7 @@ const A = [
|
|
|
606
606
|
unit: "bytes",
|
|
607
607
|
group: "memory",
|
|
608
608
|
extract: (e) => e.memRss,
|
|
609
|
-
format: (e) =>
|
|
609
|
+
format: (e) => A(e.memRss),
|
|
610
610
|
color: () => "",
|
|
611
611
|
historyKey: "memRss"
|
|
612
612
|
},
|
|
@@ -618,12 +618,12 @@ const A = [
|
|
|
618
618
|
unit: "MB",
|
|
619
619
|
group: "memory",
|
|
620
620
|
extract: (e) => e.systemMemoryTotalMb - e.systemMemoryFreeMb,
|
|
621
|
-
format: (e) => `${
|
|
621
|
+
format: (e) => `${F(e.systemMemoryTotalMb - e.systemMemoryFreeMb)}/${F(e.systemMemoryTotalMb)}`,
|
|
622
622
|
color: (e) => {
|
|
623
623
|
const t = e.systemMemoryTotalMb;
|
|
624
624
|
if (t === 0) return "";
|
|
625
625
|
const r = t - e.systemMemoryFreeMb;
|
|
626
|
-
return
|
|
626
|
+
return b(U(r, t));
|
|
627
627
|
},
|
|
628
628
|
historyKey: "_sysMemUsed",
|
|
629
629
|
show: (e) => e.systemMemoryTotalMb !== null && e.systemMemoryTotalMb !== void 0
|
|
@@ -652,7 +652,7 @@ const A = [
|
|
|
652
652
|
critThreshold: 500,
|
|
653
653
|
extract: (e) => e.avgResponseTimeMs,
|
|
654
654
|
format: (e) => `${e.avgResponseTimeMs.toFixed(0)}ms`,
|
|
655
|
-
color: (e) =>
|
|
655
|
+
color: (e) => b(w(e.avgResponseTimeMs, 200, 500)),
|
|
656
656
|
historyKey: "avgResponseTimeMs"
|
|
657
657
|
},
|
|
658
658
|
// -- Error rate -----------------------------------------------------------
|
|
@@ -666,7 +666,7 @@ const A = [
|
|
|
666
666
|
critThreshold: 5,
|
|
667
667
|
extract: (e) => e.errorRate,
|
|
668
668
|
format: (e) => `${e.errorRate.toFixed(1)}%`,
|
|
669
|
-
color: (e) =>
|
|
669
|
+
color: (e) => b(w(e.errorRate, 1, 5)),
|
|
670
670
|
historyKey: "errorRate"
|
|
671
671
|
},
|
|
672
672
|
// -- Active connections ---------------------------------------------------
|
|
@@ -691,7 +691,7 @@ const A = [
|
|
|
691
691
|
group: "db",
|
|
692
692
|
extract: (e) => e.dbPoolUsed,
|
|
693
693
|
format: (e) => `${e.dbPoolUsed}/${e.dbPoolFree}/${e.dbPoolMax}`,
|
|
694
|
-
color: (e) =>
|
|
694
|
+
color: (e) => b(U(e.dbPoolUsed, e.dbPoolMax)),
|
|
695
695
|
historyKey: "dbPoolUsed"
|
|
696
696
|
},
|
|
697
697
|
// ── Redis group ───────────────────────────────────────────────────────────
|
|
@@ -727,7 +727,7 @@ const A = [
|
|
|
727
727
|
unit: "",
|
|
728
728
|
group: "redis",
|
|
729
729
|
extract: (e) => e.redisKeysCount,
|
|
730
|
-
format: (e) =>
|
|
730
|
+
format: (e) => ue(e.redisKeysCount),
|
|
731
731
|
color: () => "",
|
|
732
732
|
historyKey: "redisKeysCount",
|
|
733
733
|
show: (e) => e.redisOk
|
|
@@ -744,7 +744,7 @@ const A = [
|
|
|
744
744
|
inverseThreshold: !0,
|
|
745
745
|
extract: (e) => e.redisHitRate,
|
|
746
746
|
format: (e) => `${e.redisHitRate.toFixed(0)}%`,
|
|
747
|
-
color: (e) =>
|
|
747
|
+
color: (e) => b(he(e.redisHitRate, 90, 70)),
|
|
748
748
|
historyKey: "redisHitRate",
|
|
749
749
|
show: (e) => e.redisOk
|
|
750
750
|
},
|
|
@@ -835,18 +835,18 @@ const A = [
|
|
|
835
835
|
historyKey: "logEntriesPerMinute"
|
|
836
836
|
}
|
|
837
837
|
];
|
|
838
|
-
function
|
|
839
|
-
return
|
|
838
|
+
function vt(e) {
|
|
839
|
+
return $.find((t) => t.id === e);
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function xt() {
|
|
842
842
|
const e = /* @__PURE__ */ new Map();
|
|
843
|
-
for (const t of
|
|
843
|
+
for (const t of $) {
|
|
844
844
|
const r = t.group || "core";
|
|
845
845
|
e.has(r) || e.set(r, []), e.get(r).push(t);
|
|
846
846
|
}
|
|
847
847
|
return e;
|
|
848
848
|
}
|
|
849
|
-
const
|
|
849
|
+
const Ee = {
|
|
850
850
|
queries: "/queries",
|
|
851
851
|
events: "/events",
|
|
852
852
|
emails: "/emails",
|
|
@@ -858,10 +858,10 @@ const xe = {
|
|
|
858
858
|
config: "/config",
|
|
859
859
|
internals: "/diagnostics"
|
|
860
860
|
};
|
|
861
|
-
function
|
|
862
|
-
return
|
|
861
|
+
function Te(e) {
|
|
862
|
+
return Ee[e] || `/${e}`;
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Ce = {
|
|
865
865
|
overview: "/overview",
|
|
866
866
|
requests: "/requests",
|
|
867
867
|
queries: "/queries",
|
|
@@ -874,45 +874,45 @@ const we = {
|
|
|
874
874
|
jobs: "/jobs",
|
|
875
875
|
config: "/config"
|
|
876
876
|
};
|
|
877
|
-
function
|
|
878
|
-
return
|
|
877
|
+
function Me(e) {
|
|
878
|
+
return Ce[e] || `/${e}`;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function ke(e = oe) {
|
|
881
881
|
const t = {}, r = {};
|
|
882
882
|
let n = !1;
|
|
883
|
-
function o
|
|
884
|
-
if (
|
|
885
|
-
const i = Array.from({ length:
|
|
886
|
-
for (let c = 0; c <
|
|
887
|
-
i[c] =
|
|
883
|
+
function s(o) {
|
|
884
|
+
if (o.count === 0) return [];
|
|
885
|
+
const i = Array.from({ length: o.count }), a = o.count < e ? 0 : o.head;
|
|
886
|
+
for (let c = 0; c < o.count; c++)
|
|
887
|
+
i[c] = o.data[(a + c) % e];
|
|
888
888
|
return i;
|
|
889
889
|
}
|
|
890
890
|
return {
|
|
891
|
-
push(
|
|
891
|
+
push(o) {
|
|
892
892
|
n = !1;
|
|
893
|
-
for (const i of
|
|
893
|
+
for (const i of $) {
|
|
894
894
|
const a = i.historyKey;
|
|
895
895
|
if (!a) continue;
|
|
896
|
-
const c = i.extract(
|
|
896
|
+
const c = i.extract(o);
|
|
897
897
|
if (typeof c != "number") continue;
|
|
898
898
|
t[a] || (t[a] = { data: Array.from({ length: e }), head: 0, count: 0 });
|
|
899
899
|
const l = t[a];
|
|
900
900
|
l.data[l.head] = c, l.head = (l.head + 1) % e, l.count < e && l.count++;
|
|
901
901
|
}
|
|
902
902
|
},
|
|
903
|
-
get(
|
|
904
|
-
const i = t[
|
|
905
|
-
return i ?
|
|
903
|
+
get(o) {
|
|
904
|
+
const i = t[o];
|
|
905
|
+
return i ? s(i) : [];
|
|
906
906
|
},
|
|
907
907
|
getAll() {
|
|
908
908
|
if (n) return r;
|
|
909
|
-
for (const
|
|
910
|
-
r[
|
|
909
|
+
for (const o of Object.keys(t))
|
|
910
|
+
r[o] = s(t[o]);
|
|
911
911
|
return n = !0, r;
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
914
|
}
|
|
915
|
-
class
|
|
915
|
+
class wt {
|
|
916
916
|
// -- Configuration --------------------------------------------------------
|
|
917
917
|
baseUrl;
|
|
918
918
|
endpoint;
|
|
@@ -941,7 +941,7 @@ class yt {
|
|
|
941
941
|
isConnected = !1;
|
|
942
942
|
isStale = !1;
|
|
943
943
|
constructor(t = {}) {
|
|
944
|
-
this.baseUrl = t.baseUrl ?? "", this.endpoint = t.endpoint ?? "/admin/api/server-stats", this.channelName = t.channelName ?? "admin/server-stats", this.authToken = t.authToken, this.pollInterval = t.pollInterval ?? 3e3, this.onStatsUpdate = t.onStatsUpdate, this.onConnectionChange = t.onConnectionChange, this.onStaleChange = t.onStaleChange, this.onError = t.onError, this.onUnauthorizedChange = t.onUnauthorizedChange, this.onHistoryChange = t.onHistoryChange, this.onSseActiveChange = t.onSseActiveChange, this.onPollActiveChange = t.onPollActiveChange, this.historyBuffer =
|
|
944
|
+
this.baseUrl = t.baseUrl ?? "", this.endpoint = t.endpoint ?? "/admin/api/server-stats", this.channelName = t.channelName ?? "admin/server-stats", this.authToken = t.authToken, this.pollInterval = t.pollInterval ?? 3e3, this.onStatsUpdate = t.onStatsUpdate, this.onConnectionChange = t.onConnectionChange, this.onStaleChange = t.onStaleChange, this.onError = t.onError, this.onUnauthorizedChange = t.onUnauthorizedChange, this.onHistoryChange = t.onHistoryChange, this.onSseActiveChange = t.onSseActiveChange, this.onPollActiveChange = t.onPollActiveChange, this.historyBuffer = ke();
|
|
945
945
|
}
|
|
946
946
|
// -- Public API -----------------------------------------------------------
|
|
947
947
|
/**
|
|
@@ -984,7 +984,7 @@ class yt {
|
|
|
984
984
|
initSseSubscription() {
|
|
985
985
|
let t = !1;
|
|
986
986
|
try {
|
|
987
|
-
this.sseHandle =
|
|
987
|
+
this.sseHandle = V({
|
|
988
988
|
baseUrl: this.baseUrl,
|
|
989
989
|
channelName: this.channelName,
|
|
990
990
|
authToken: this.authToken,
|
|
@@ -1018,7 +1018,7 @@ class yt {
|
|
|
1018
1018
|
/** Start the stale detection interval. */
|
|
1019
1019
|
startStaleDetection() {
|
|
1020
1020
|
this.staleTimer = setInterval(() => {
|
|
1021
|
-
this.lastSuccess > 0 && Date.now() - this.lastSuccess >
|
|
1021
|
+
this.lastSuccess > 0 && Date.now() - this.lastSuccess > se && this.setStale(!0);
|
|
1022
1022
|
}, 2e3);
|
|
1023
1023
|
}
|
|
1024
1024
|
/** Process incoming stats data from either SSE or polling. */
|
|
@@ -1028,12 +1028,12 @@ class yt {
|
|
|
1028
1028
|
/** Poll the HTTP endpoint once. */
|
|
1029
1029
|
async poll() {
|
|
1030
1030
|
if (!this.unauthorized) {
|
|
1031
|
-
this.client || (this.client = new
|
|
1031
|
+
this.client || (this.client = new C({ baseUrl: this.baseUrl, authToken: this.authToken }));
|
|
1032
1032
|
try {
|
|
1033
1033
|
const t = await this.client.get(this.endpoint);
|
|
1034
1034
|
this.processStats(t);
|
|
1035
1035
|
} catch (t) {
|
|
1036
|
-
t instanceof
|
|
1036
|
+
t instanceof x && (this.unauthorized = !0, this.onUnauthorizedChange?.(!0), this.onError?.(t), this.stopPolling());
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
@@ -1058,7 +1058,7 @@ class yt {
|
|
|
1058
1058
|
this.isStale !== t && (this.isStale = t, this.onStaleChange?.(t));
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
class
|
|
1061
|
+
class Pe {
|
|
1062
1062
|
constructor(t, r) {
|
|
1063
1063
|
this.client = t, this.basePath = r;
|
|
1064
1064
|
}
|
|
@@ -1070,8 +1070,8 @@ class Ce {
|
|
|
1070
1070
|
* @param init - Optional `RequestInit` overrides (e.g. `{ signal }`).
|
|
1071
1071
|
*/
|
|
1072
1072
|
async fetchSection(t, r, n) {
|
|
1073
|
-
const
|
|
1074
|
-
return this.client.fetch(
|
|
1073
|
+
const s = Me(t), o = r ? `${this.basePath}${s}?${r}` : `${this.basePath}${s}`;
|
|
1074
|
+
return this.client.fetch(o, n);
|
|
1075
1075
|
}
|
|
1076
1076
|
/**
|
|
1077
1077
|
* Fetch chart time-series data for the overview section.
|
|
@@ -1139,15 +1139,15 @@ class Ce {
|
|
|
1139
1139
|
return this.client.fetch(`${this.basePath}/emails/${t}/preview`);
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function Ae(e) {
|
|
1143
1143
|
if (!e || typeof e != "object") return !1;
|
|
1144
1144
|
const t = e;
|
|
1145
1145
|
return t.data !== void 0 && t.meta !== void 0;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function $e(e, t) {
|
|
1148
1148
|
return t.aborted ? !0 : e instanceof DOMException && e.name === "AbortError";
|
|
1149
1149
|
}
|
|
1150
|
-
class
|
|
1150
|
+
class Et {
|
|
1151
1151
|
// -- Dependencies ---------------------------------------------------------
|
|
1152
1152
|
client;
|
|
1153
1153
|
api;
|
|
@@ -1176,7 +1176,7 @@ class bt {
|
|
|
1176
1176
|
/** AbortController for the current in-flight fetch. */
|
|
1177
1177
|
abortController = null;
|
|
1178
1178
|
constructor(t) {
|
|
1179
|
-
this.client = new
|
|
1179
|
+
this.client = new C({ baseUrl: t.baseUrl, authToken: t.authToken }), this.api = new Pe(this.client, t.endpoint), this.endpoint = t.endpoint, this.section = t.section, this.perPage = t.perPage, this.callbacks = t.callbacks;
|
|
1180
1180
|
}
|
|
1181
1181
|
// -- Public API -----------------------------------------------------------
|
|
1182
1182
|
/**
|
|
@@ -1202,12 +1202,12 @@ class bt {
|
|
|
1202
1202
|
if (this.shouldSkipFetch(t)) return;
|
|
1203
1203
|
const { controller: r, myFetchId: n } = this.prepareFetch(t);
|
|
1204
1204
|
try {
|
|
1205
|
-
const
|
|
1205
|
+
const s = await this.executeFetch(r);
|
|
1206
1206
|
if (this.isStaleResponse(n)) return;
|
|
1207
|
-
this.applyFetchResult(
|
|
1208
|
-
} catch (
|
|
1209
|
-
if (this.shouldIgnoreError(
|
|
1210
|
-
this.handleFetchError(
|
|
1207
|
+
this.applyFetchResult(s);
|
|
1208
|
+
} catch (s) {
|
|
1209
|
+
if (this.shouldIgnoreError(s, r.signal, n)) return;
|
|
1210
|
+
this.handleFetchError(s, t);
|
|
1211
1211
|
} finally {
|
|
1212
1212
|
t || (this.explicitFetchPending = !1);
|
|
1213
1213
|
}
|
|
@@ -1256,12 +1256,12 @@ class bt {
|
|
|
1256
1256
|
* then silently refresh the current data.
|
|
1257
1257
|
*/
|
|
1258
1258
|
async mutate(t, r = "post", n) {
|
|
1259
|
-
const
|
|
1259
|
+
const s = `${this.endpoint}/${t}`;
|
|
1260
1260
|
try {
|
|
1261
|
-
const
|
|
1262
|
-
return await this.fetch(!0),
|
|
1263
|
-
} catch (
|
|
1264
|
-
throw
|
|
1261
|
+
const o = r === "post" ? await this.client.post(s, n) : await this.client.delete(s);
|
|
1262
|
+
return await this.fetch(!0), o;
|
|
1263
|
+
} catch (o) {
|
|
1264
|
+
throw o instanceof Error ? o : new Error(String(o));
|
|
1265
1265
|
}
|
|
1266
1266
|
}
|
|
1267
1267
|
/**
|
|
@@ -1325,12 +1325,12 @@ class bt {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
/** Check if an error should be silently ignored (abort or stale). */
|
|
1327
1327
|
shouldIgnoreError(t, r, n) {
|
|
1328
|
-
return
|
|
1328
|
+
return $e(t, r) ? !0 : this.isStaleResponse(n);
|
|
1329
1329
|
}
|
|
1330
1330
|
/** Build query string from current controller state. */
|
|
1331
1331
|
buildCurrentQueryString() {
|
|
1332
1332
|
const t = this.sort ? this.sort.replace(/[A-Z]/g, (n) => "_" + n.toLowerCase()) : void 0, r = this.filters;
|
|
1333
|
-
return
|
|
1333
|
+
return ge({
|
|
1334
1334
|
page: this.page,
|
|
1335
1335
|
perPage: this.perPage,
|
|
1336
1336
|
search: this.search,
|
|
@@ -1342,11 +1342,11 @@ class bt {
|
|
|
1342
1342
|
}
|
|
1343
1343
|
/** Apply a successful fetch result to the callbacks. */
|
|
1344
1344
|
applyFetchResult(t) {
|
|
1345
|
-
|
|
1345
|
+
Ae(t) ? (this.callbacks.onData(t.data), this.callbacks.onPagination(t.meta)) : (this.callbacks.onData(t), this.callbacks.onPagination(null)), this.callbacks.onError(null), this.callbacks.onLoading(!1), this.hasFetched = !0;
|
|
1346
1346
|
}
|
|
1347
1347
|
/** Handle a fetch error (unauthorized, network, etc.). */
|
|
1348
1348
|
handleFetchError(t, r) {
|
|
1349
|
-
if (t instanceof
|
|
1349
|
+
if (t instanceof x) {
|
|
1350
1350
|
this.callbacks.onError(t), this.callbacks.onLoading(!1), this.stopRefreshTimer(), this.callbacks.onUnauthorized();
|
|
1351
1351
|
return;
|
|
1352
1352
|
}
|
|
@@ -1355,14 +1355,14 @@ class bt {
|
|
|
1355
1355
|
// -- Timer management (private) -------------------------------------------
|
|
1356
1356
|
startRefreshTimer() {
|
|
1357
1357
|
this.stopRefreshTimer();
|
|
1358
|
-
const t = this.section === "overview" ?
|
|
1358
|
+
const t = this.section === "overview" ? Z : ee;
|
|
1359
1359
|
this.timer = setInterval(() => this.fetch(!0), t);
|
|
1360
1360
|
}
|
|
1361
1361
|
stopRefreshTimer() {
|
|
1362
1362
|
this.timer && (clearInterval(this.timer), this.timer = null);
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
|
-
const
|
|
1365
|
+
const Tt = {
|
|
1366
1366
|
// ---------------------------------------------------------------------------
|
|
1367
1367
|
// Debug-panel tabs / Dashboard sidebar sections (shared)
|
|
1368
1368
|
// ---------------------------------------------------------------------------
|
|
@@ -1554,46 +1554,81 @@ const St = {
|
|
|
1554
1554
|
viewBox: "0 0 16 16",
|
|
1555
1555
|
elements: ['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']
|
|
1556
1556
|
}
|
|
1557
|
-
},
|
|
1558
|
-
function
|
|
1557
|
+
}, Re = "ss-col-resize", _ = "ss-resizing";
|
|
1558
|
+
function Ct(e) {
|
|
1559
1559
|
const t = Array.from(e.querySelectorAll("thead th"));
|
|
1560
1560
|
if (t.length === 0) return () => {
|
|
1561
1561
|
};
|
|
1562
1562
|
const r = [];
|
|
1563
1563
|
let n = !1;
|
|
1564
|
-
function
|
|
1564
|
+
function s() {
|
|
1565
1565
|
if (!n) {
|
|
1566
1566
|
n = !0;
|
|
1567
|
-
for (const
|
|
1568
|
-
|
|
1567
|
+
for (const o of t)
|
|
1568
|
+
o.style.width = o.offsetWidth + "px";
|
|
1569
1569
|
e.style.tableLayout = "fixed";
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
for (const
|
|
1572
|
+
for (const o of t) {
|
|
1573
1573
|
let i = function(c) {
|
|
1574
|
-
c.preventDefault(), c.stopPropagation(),
|
|
1575
|
-
const l = c.clientX,
|
|
1576
|
-
a.classList.add(
|
|
1577
|
-
function d
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1574
|
+
c.preventDefault(), c.stopPropagation(), s();
|
|
1575
|
+
const l = c.clientX, g = o.offsetWidth;
|
|
1576
|
+
a.classList.add(_), a.setPointerCapture(c.pointerId);
|
|
1577
|
+
function f(d) {
|
|
1578
|
+
const m = d.clientX - l, u = Math.max(30, g + m);
|
|
1579
|
+
o.style.width = u + "px";
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1582
|
-
a.classList.remove(
|
|
1581
|
+
function p() {
|
|
1582
|
+
a.classList.remove(_), a.removeEventListener("pointermove", f), a.removeEventListener("pointerup", p);
|
|
1583
1583
|
}
|
|
1584
|
-
a.addEventListener("pointermove",
|
|
1584
|
+
a.addEventListener("pointermove", f), a.addEventListener("pointerup", p);
|
|
1585
1585
|
};
|
|
1586
|
-
if (!
|
|
1586
|
+
if (!o.textContent?.trim()) continue;
|
|
1587
1587
|
const a = document.createElement("div");
|
|
1588
|
-
a.className =
|
|
1588
|
+
a.className = Re, o.appendChild(a), a.addEventListener("pointerdown", i), r.push(() => {
|
|
1589
1589
|
a.removeEventListener("pointerdown", i), a.remove();
|
|
1590
1590
|
});
|
|
1591
1591
|
}
|
|
1592
1592
|
return () => {
|
|
1593
|
-
for (const
|
|
1593
|
+
for (const o of r) o();
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
function Mt(e) {
|
|
1597
|
+
const { container: t, handle: r, topPane: n, bottomPane: s, storageKey: o, minHeight: i = 60 } = e;
|
|
1598
|
+
if (o) {
|
|
1599
|
+
const c = localStorage.getItem(o);
|
|
1600
|
+
if (c) {
|
|
1601
|
+
const l = parseFloat(c);
|
|
1602
|
+
l > 0 && l < 1 && (n.style.flex = `${l}`, s.style.flex = `${1 - l}`);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
function a(c) {
|
|
1606
|
+
c.preventDefault(), r.setPointerCapture(c.pointerId);
|
|
1607
|
+
const g = t.getBoundingClientRect().height, f = c.clientY, p = n.getBoundingClientRect().height;
|
|
1608
|
+
function d(u) {
|
|
1609
|
+
const y = u.clientY - f;
|
|
1610
|
+
let v = p + y;
|
|
1611
|
+
const q = g - i - r.offsetHeight;
|
|
1612
|
+
v = Math.max(i, Math.min(v, q));
|
|
1613
|
+
const L = v / (g - r.offsetHeight);
|
|
1614
|
+
n.style.flex = `${L}`, s.style.flex = `${1 - L}`;
|
|
1615
|
+
}
|
|
1616
|
+
function m() {
|
|
1617
|
+
if (r.removeEventListener("pointermove", d), r.removeEventListener("pointerup", m), o) {
|
|
1618
|
+
const u = t.getBoundingClientRect().height - r.offsetHeight;
|
|
1619
|
+
if (u > 0) {
|
|
1620
|
+
const y = n.getBoundingClientRect().height / u;
|
|
1621
|
+
localStorage.setItem(o, String(y));
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
r.addEventListener("pointermove", d), r.addEventListener("pointerup", m);
|
|
1626
|
+
}
|
|
1627
|
+
return r.addEventListener("pointerdown", a), () => {
|
|
1628
|
+
r.removeEventListener("pointerdown", a);
|
|
1594
1629
|
};
|
|
1595
1630
|
}
|
|
1596
|
-
class
|
|
1631
|
+
class kt {
|
|
1597
1632
|
client;
|
|
1598
1633
|
endpoint;
|
|
1599
1634
|
refreshInterval;
|
|
@@ -1603,10 +1638,10 @@ class vt {
|
|
|
1603
1638
|
fetchOnceCache = {};
|
|
1604
1639
|
abortController = null;
|
|
1605
1640
|
constructor(t) {
|
|
1606
|
-
this.client = new
|
|
1641
|
+
this.client = new C({
|
|
1607
1642
|
baseUrl: t.baseUrl,
|
|
1608
1643
|
authToken: t.authToken
|
|
1609
|
-
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ??
|
|
1644
|
+
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ?? te, this.callbacks = {
|
|
1610
1645
|
onData: t.onData,
|
|
1611
1646
|
onLoading: t.onLoading,
|
|
1612
1647
|
onError: t.onError,
|
|
@@ -1660,7 +1695,7 @@ class vt {
|
|
|
1660
1695
|
const n = await this.client.fetch(t);
|
|
1661
1696
|
this.callbacks.onData(n), this.callbacks.onError(null), r && (this.fetchOnceCache[t] = n);
|
|
1662
1697
|
} catch (n) {
|
|
1663
|
-
if (n instanceof
|
|
1698
|
+
if (n instanceof x) {
|
|
1664
1699
|
this.callbacks.onUnauthorized(n);
|
|
1665
1700
|
return;
|
|
1666
1701
|
}
|
|
@@ -1693,9 +1728,9 @@ class vt {
|
|
|
1693
1728
|
const r = new AbortController();
|
|
1694
1729
|
this.abortController = r;
|
|
1695
1730
|
try {
|
|
1696
|
-
const n = `${this.endpoint}${
|
|
1731
|
+
const n = `${this.endpoint}${Te(t)}`, s = await this.client.fetch(n, { signal: r.signal });
|
|
1697
1732
|
if (r.signal.aborted) return;
|
|
1698
|
-
this.callbacks.onData(
|
|
1733
|
+
this.callbacks.onData(s), this.callbacks.onError(null), this.callbacks.onLoading(!1);
|
|
1699
1734
|
} catch (n) {
|
|
1700
1735
|
this.handleFetchError(n, r);
|
|
1701
1736
|
}
|
|
@@ -1707,7 +1742,7 @@ class vt {
|
|
|
1707
1742
|
/** Handle errors from fetchData. */
|
|
1708
1743
|
handleFetchError(t, r) {
|
|
1709
1744
|
if (!(t instanceof DOMException && t.name === "AbortError") && !r.signal.aborted) {
|
|
1710
|
-
if (t instanceof
|
|
1745
|
+
if (t instanceof x) {
|
|
1711
1746
|
this.callbacks.onError(t), this.callbacks.onLoading(!1), this.stop(), this.callbacks.onUnauthorized(t);
|
|
1712
1747
|
return;
|
|
1713
1748
|
}
|
|
@@ -1715,21 +1750,36 @@ class vt {
|
|
|
1715
1750
|
}
|
|
1716
1751
|
}
|
|
1717
1752
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1753
|
+
function Le(e) {
|
|
1754
|
+
if (typeof e == "string")
|
|
1755
|
+
try {
|
|
1756
|
+
return JSON.parse(e);
|
|
1757
|
+
} catch {
|
|
1758
|
+
return null;
|
|
1759
|
+
}
|
|
1760
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) ? e : null;
|
|
1761
|
+
}
|
|
1762
|
+
function O(e) {
|
|
1763
|
+
const t = {};
|
|
1764
|
+
for (const [r, n] of Object.entries(e))
|
|
1765
|
+
Ue.has(r) || (t[r] = n);
|
|
1766
|
+
return Object.keys(t).length > 0 ? t : null;
|
|
1767
|
+
}
|
|
1768
|
+
const Pt = ["all", "error", "warn", "info", "debug"];
|
|
1769
|
+
function Fe(e) {
|
|
1720
1770
|
return (e.levelName || e.level_name || (typeof e.level == "string" ? e.level : "") || "info").toLowerCase();
|
|
1721
1771
|
}
|
|
1722
|
-
function
|
|
1772
|
+
function At(e) {
|
|
1723
1773
|
return e.msg || e.message || JSON.stringify(e);
|
|
1724
1774
|
}
|
|
1725
|
-
function
|
|
1775
|
+
function $t(e) {
|
|
1726
1776
|
return e.createdAt || e.created_at || e.time || e.timestamp || 0;
|
|
1727
1777
|
}
|
|
1728
|
-
function
|
|
1778
|
+
function Rt(e) {
|
|
1729
1779
|
const t = e.data || {};
|
|
1730
1780
|
return e.requestId || e.request_id || e["x-request-id"] || t.requestId || t.request_id || t["x-request-id"] || "";
|
|
1731
1781
|
}
|
|
1732
|
-
function
|
|
1782
|
+
function Lt(e, t = "ss-dbg-log-level") {
|
|
1733
1783
|
switch (e) {
|
|
1734
1784
|
case "error":
|
|
1735
1785
|
case "fatal":
|
|
@@ -1746,30 +1796,60 @@ function kt(e, t = "ss-dbg-log-level") {
|
|
|
1746
1796
|
return `${t}-info`;
|
|
1747
1797
|
}
|
|
1748
1798
|
}
|
|
1749
|
-
function
|
|
1799
|
+
function Ft(e, t) {
|
|
1750
1800
|
return t === "all" ? e : e.filter((r) => {
|
|
1751
|
-
const n =
|
|
1801
|
+
const n = Fe(r);
|
|
1752
1802
|
return t === "error" ? n === "error" || n === "fatal" : n === t;
|
|
1753
1803
|
});
|
|
1754
1804
|
}
|
|
1755
|
-
|
|
1805
|
+
const Ue = /* @__PURE__ */ new Set([
|
|
1806
|
+
"level",
|
|
1807
|
+
"time",
|
|
1808
|
+
"pid",
|
|
1809
|
+
"hostname",
|
|
1810
|
+
"msg",
|
|
1811
|
+
"message",
|
|
1812
|
+
"v",
|
|
1813
|
+
"name",
|
|
1814
|
+
"levelName",
|
|
1815
|
+
"level_name",
|
|
1816
|
+
"timestamp",
|
|
1817
|
+
"createdAt",
|
|
1818
|
+
"created_at",
|
|
1819
|
+
"requestId",
|
|
1820
|
+
"request_id",
|
|
1821
|
+
"x-request-id",
|
|
1822
|
+
"id",
|
|
1823
|
+
"data"
|
|
1824
|
+
]);
|
|
1825
|
+
function Ut(e) {
|
|
1826
|
+
if (e.data) {
|
|
1827
|
+
const t = Le(e.data);
|
|
1828
|
+
if (t) {
|
|
1829
|
+
const r = O(t);
|
|
1830
|
+
if (r) return r;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
return O(e);
|
|
1834
|
+
}
|
|
1835
|
+
function Dt(e, t) {
|
|
1756
1836
|
if (!t) return e;
|
|
1757
1837
|
const r = t.toLowerCase();
|
|
1758
1838
|
return e.filter(
|
|
1759
1839
|
(n) => n.sql.toLowerCase().includes(r) || n.model && n.model.toLowerCase().includes(r) || n.method.toLowerCase().includes(r)
|
|
1760
1840
|
);
|
|
1761
1841
|
}
|
|
1762
|
-
function
|
|
1842
|
+
function _t(e) {
|
|
1763
1843
|
const t = {};
|
|
1764
1844
|
for (const r of e)
|
|
1765
1845
|
t[r.sql] = (t[r.sql] || 0) + 1;
|
|
1766
1846
|
return t;
|
|
1767
1847
|
}
|
|
1768
|
-
function
|
|
1769
|
-
const r = e.filter((
|
|
1770
|
-
return { slowCount: r, dupCount: n, avgDuration:
|
|
1848
|
+
function Ot(e, t) {
|
|
1849
|
+
const r = e.filter((o) => o.duration > 100).length, n = Object.values(t).filter((o) => o > 1).length, s = e.length > 0 ? e.reduce((o, i) => o + i.duration, 0) / e.length : 0;
|
|
1850
|
+
return { slowCount: r, dupCount: n, avgDuration: s, totalCount: e.length };
|
|
1771
1851
|
}
|
|
1772
|
-
const
|
|
1852
|
+
const It = [
|
|
1773
1853
|
"all",
|
|
1774
1854
|
"active",
|
|
1775
1855
|
"waiting",
|
|
@@ -1777,7 +1857,7 @@ const Rt = [
|
|
|
1777
1857
|
"completed",
|
|
1778
1858
|
"failed"
|
|
1779
1859
|
];
|
|
1780
|
-
function
|
|
1860
|
+
function Ht(e, t = "ss-dbg-job-status") {
|
|
1781
1861
|
switch (e) {
|
|
1782
1862
|
case "completed":
|
|
1783
1863
|
case "failed":
|
|
@@ -1789,7 +1869,7 @@ function Lt(e, t = "ss-dbg-job-status") {
|
|
|
1789
1869
|
return "ss-dbg-badge-muted";
|
|
1790
1870
|
}
|
|
1791
1871
|
}
|
|
1792
|
-
function
|
|
1872
|
+
function Bt(e) {
|
|
1793
1873
|
switch (e) {
|
|
1794
1874
|
case "active":
|
|
1795
1875
|
return "blue";
|
|
@@ -1805,18 +1885,18 @@ function Ft(e) {
|
|
|
1805
1885
|
return "muted";
|
|
1806
1886
|
}
|
|
1807
1887
|
}
|
|
1808
|
-
function
|
|
1888
|
+
function Nt(e) {
|
|
1809
1889
|
if (!e) return [];
|
|
1810
1890
|
if (Array.isArray(e)) return e;
|
|
1811
1891
|
const t = e;
|
|
1812
1892
|
return t.jobs || t.data || [];
|
|
1813
1893
|
}
|
|
1814
|
-
function
|
|
1894
|
+
function qt(e) {
|
|
1815
1895
|
if (!e || Array.isArray(e)) return null;
|
|
1816
1896
|
const t = e;
|
|
1817
1897
|
return t.stats || t.overview || null;
|
|
1818
1898
|
}
|
|
1819
|
-
function
|
|
1899
|
+
function De(e) {
|
|
1820
1900
|
if (!e) return [];
|
|
1821
1901
|
if (typeof e == "string")
|
|
1822
1902
|
try {
|
|
@@ -1826,7 +1906,7 @@ function $e(e) {
|
|
|
1826
1906
|
}
|
|
1827
1907
|
return Array.isArray(e) ? e : [];
|
|
1828
1908
|
}
|
|
1829
|
-
function
|
|
1909
|
+
function _e(e) {
|
|
1830
1910
|
if (!e) return [];
|
|
1831
1911
|
if (typeof e == "string")
|
|
1832
1912
|
try {
|
|
@@ -1839,25 +1919,25 @@ function Re(e) {
|
|
|
1839
1919
|
function k(e, t, r, n = 0) {
|
|
1840
1920
|
return e[t] ?? e[r] ?? n;
|
|
1841
1921
|
}
|
|
1842
|
-
function
|
|
1922
|
+
function Kt(e) {
|
|
1843
1923
|
return {
|
|
1844
1924
|
method: e.method || "",
|
|
1845
1925
|
url: e.url || "",
|
|
1846
1926
|
statusCode: k(e, "status_code", "statusCode"),
|
|
1847
1927
|
totalDuration: k(e, "total_duration", "totalDuration") || e.duration || 0,
|
|
1848
1928
|
spanCount: k(e, "span_count", "spanCount"),
|
|
1849
|
-
spans:
|
|
1850
|
-
warnings:
|
|
1929
|
+
spans: De(e.spans),
|
|
1930
|
+
warnings: _e(e.warnings),
|
|
1851
1931
|
logs: e.logs || [],
|
|
1852
1932
|
httpRequestId: e.httpRequestId || e.http_request_id || void 0
|
|
1853
1933
|
};
|
|
1854
1934
|
}
|
|
1855
|
-
const
|
|
1856
|
-
function
|
|
1935
|
+
const Oe = ["password", "secret", "token", "key", "credential", "auth"];
|
|
1936
|
+
function Ie(e) {
|
|
1857
1937
|
const t = e.toLowerCase();
|
|
1858
|
-
return
|
|
1938
|
+
return Oe.some((r) => t.includes(r));
|
|
1859
1939
|
}
|
|
1860
|
-
function
|
|
1940
|
+
function He(e) {
|
|
1861
1941
|
if (e == null) return "-";
|
|
1862
1942
|
if (typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
1863
1943
|
return String(e);
|
|
@@ -1868,87 +1948,87 @@ function Ue(e) {
|
|
|
1868
1948
|
return String(e);
|
|
1869
1949
|
}
|
|
1870
1950
|
}
|
|
1871
|
-
const
|
|
1951
|
+
const Be = {
|
|
1872
1952
|
collectionInterval: "Stats Collection",
|
|
1873
1953
|
dashboardBroadcast: "Dashboard Broadcast",
|
|
1874
1954
|
debugBroadcast: "Debug Broadcast",
|
|
1875
1955
|
persistFlush: "Persist Flush",
|
|
1876
1956
|
retentionCleanup: "Retention Cleanup"
|
|
1877
1957
|
};
|
|
1878
|
-
function
|
|
1879
|
-
return
|
|
1958
|
+
function zt(e) {
|
|
1959
|
+
return Be[e] || e;
|
|
1880
1960
|
}
|
|
1881
|
-
const
|
|
1961
|
+
const Ne = {
|
|
1882
1962
|
prometheus: "Prometheus",
|
|
1883
1963
|
pinoHook: "Pino Log Hook",
|
|
1884
1964
|
edgePlugin: "Edge Plugin",
|
|
1885
1965
|
cacheInspector: "Cache Inspector",
|
|
1886
1966
|
queueInspector: "Queue Inspector"
|
|
1887
1967
|
};
|
|
1888
|
-
function
|
|
1889
|
-
return
|
|
1968
|
+
function jt(e) {
|
|
1969
|
+
return Ne[e] || e;
|
|
1890
1970
|
}
|
|
1891
|
-
function
|
|
1971
|
+
function Wt(e) {
|
|
1892
1972
|
return "active" in e ? e.active ? "active" : "inactive" : "available" in e ? e.available ? "available" : "unavailable" : "unknown";
|
|
1893
1973
|
}
|
|
1894
|
-
function
|
|
1974
|
+
function Vt(e, t) {
|
|
1895
1975
|
return t.mode ? `Mode: ${t.mode}` : e === "edgePlugin" && t.active ? "@serverStats() tag registered" : e === "cacheInspector" ? t.available ? "Redis dependency detected" : "Redis not installed" : e === "queueInspector" ? t.available ? "Queue dependency detected" : "@rlanz/bull-queue not installed" : "-";
|
|
1896
1976
|
}
|
|
1897
|
-
function
|
|
1977
|
+
function Gt(e) {
|
|
1898
1978
|
return Object.entries(e).map(([t, r]) => ({
|
|
1899
1979
|
key: t,
|
|
1900
|
-
value:
|
|
1901
|
-
secret:
|
|
1980
|
+
value: He(r),
|
|
1981
|
+
secret: Ie(t)
|
|
1902
1982
|
}));
|
|
1903
1983
|
}
|
|
1904
|
-
function
|
|
1984
|
+
function Qt(e, t) {
|
|
1905
1985
|
return t ? Math.min(100, Math.round(e / t * 100)) : 0;
|
|
1906
1986
|
}
|
|
1907
|
-
const
|
|
1908
|
-
function
|
|
1909
|
-
return
|
|
1987
|
+
const qe = ["healthy", "active", "connected", "available", "ready"], Ke = ["errored", "unavailable"];
|
|
1988
|
+
function Jt(e) {
|
|
1989
|
+
return qe.includes(e) ? "ok" : Ke.includes(e) ? "err" : "";
|
|
1910
1990
|
}
|
|
1911
|
-
function
|
|
1991
|
+
function R(e) {
|
|
1912
1992
|
return e !== null && typeof e == "object" && !Array.isArray(e) && e.__redacted === !0;
|
|
1913
1993
|
}
|
|
1914
|
-
function
|
|
1915
|
-
return e != null && typeof e == "object" && !Array.isArray(e) &&
|
|
1994
|
+
function T(e) {
|
|
1995
|
+
return e != null && typeof e == "object" && !Array.isArray(e) && !R(e);
|
|
1916
1996
|
}
|
|
1917
|
-
function
|
|
1918
|
-
if (!
|
|
1997
|
+
function ze(e, t = "") {
|
|
1998
|
+
if (!T(e))
|
|
1919
1999
|
return [{ path: t, value: e }];
|
|
1920
2000
|
const r = [];
|
|
1921
2001
|
for (const n of Object.keys(e)) {
|
|
1922
|
-
const
|
|
1923
|
-
|
|
2002
|
+
const s = t ? `${t}.${n}` : n, o = e[n];
|
|
2003
|
+
T(o) ? r.push(...ze(o, s)) : r.push({ path: s, value: o });
|
|
1924
2004
|
}
|
|
1925
2005
|
return r;
|
|
1926
2006
|
}
|
|
1927
|
-
function
|
|
2007
|
+
function Yt(e) {
|
|
1928
2008
|
return e == null ? { text: "null", color: "var(--ss-dim)" } : typeof e == "boolean" ? {
|
|
1929
2009
|
text: String(e),
|
|
1930
2010
|
color: e ? "var(--ss-green-fg)" : "var(--ss-red-fg)"
|
|
1931
2011
|
} : typeof e == "number" ? { text: String(e), color: "var(--ss-amber-fg)" } : Array.isArray(e) ? { text: `[${e.map((r) => r == null ? "null" : typeof r == "object" ? JSON.stringify(r) : String(r)).join(", ")}]`, color: "var(--ss-purple-fg)" } : typeof e == "object" ? { text: JSON.stringify(e), color: "var(--ss-dim)" } : { text: String(e) };
|
|
1932
2012
|
}
|
|
1933
|
-
function
|
|
1934
|
-
if (e == null || typeof e != "object" || Array.isArray(e) ||
|
|
2013
|
+
function je(e) {
|
|
2014
|
+
if (e == null || typeof e != "object" || Array.isArray(e) || R(e))
|
|
1935
2015
|
return 1;
|
|
1936
2016
|
let t = 0;
|
|
1937
2017
|
for (const r of Object.keys(e))
|
|
1938
|
-
t +=
|
|
2018
|
+
t += je(e[r]);
|
|
1939
2019
|
return t;
|
|
1940
2020
|
}
|
|
1941
|
-
function
|
|
1942
|
-
if (!
|
|
2021
|
+
function Xt(e) {
|
|
2022
|
+
if (!T(e)) return [];
|
|
1943
2023
|
const t = [];
|
|
1944
2024
|
for (const r of Object.keys(e))
|
|
1945
|
-
|
|
2025
|
+
T(e[r]) && t.push(r);
|
|
1946
2026
|
return t;
|
|
1947
2027
|
}
|
|
1948
|
-
function
|
|
1949
|
-
return !r || e.toLowerCase().includes(r) ? !0 : (
|
|
2028
|
+
function Zt(e, t, r) {
|
|
2029
|
+
return !r || e.toLowerCase().includes(r) ? !0 : (R(t) ? t.display : t == null ? "" : String(t)).toLowerCase().includes(r);
|
|
1950
2030
|
}
|
|
1951
|
-
function
|
|
2031
|
+
function er(e, t, r) {
|
|
1952
2032
|
t && navigator.clipboard.writeText(e).then(() => {
|
|
1953
2033
|
const n = t.textContent;
|
|
1954
2034
|
t.textContent = "✓", t.classList.add(`${r}-copy-row-ok`), setTimeout(() => {
|
|
@@ -1957,7 +2037,7 @@ function Vt(e, t, r) {
|
|
|
1957
2037
|
}).catch(() => {
|
|
1958
2038
|
});
|
|
1959
2039
|
}
|
|
1960
|
-
const
|
|
2040
|
+
const We = /* @__PURE__ */ new Set([
|
|
1961
2041
|
"secret",
|
|
1962
2042
|
"key",
|
|
1963
2043
|
"token",
|
|
@@ -1971,193 +2051,195 @@ const Ne = /* @__PURE__ */ new Set([
|
|
|
1971
2051
|
"private",
|
|
1972
2052
|
"encryption"
|
|
1973
2053
|
]);
|
|
1974
|
-
function
|
|
2054
|
+
function Ve(e) {
|
|
1975
2055
|
const t = e.split(/[._-]/), r = [];
|
|
1976
2056
|
for (const n of t) {
|
|
1977
|
-
const
|
|
1978
|
-
for (const
|
|
1979
|
-
|
|
2057
|
+
const s = n.split(new RegExp("(?<=[a-z])(?=[A-Z])"));
|
|
2058
|
+
for (const o of s)
|
|
2059
|
+
o && r.push(o);
|
|
1980
2060
|
}
|
|
1981
2061
|
return r;
|
|
1982
2062
|
}
|
|
1983
|
-
function
|
|
1984
|
-
return
|
|
2063
|
+
function tr(e) {
|
|
2064
|
+
return Ve(e).some((r) => We.has(r.toLowerCase()));
|
|
1985
2065
|
}
|
|
1986
|
-
const
|
|
1987
|
-
function
|
|
2066
|
+
const rr = new RegExp("secret|password|pass(?:word)?|pwd|token|(?:^|[._-])key(?:[._-]|$)|(?<=[a-z])Key|apikey|api_key|auth|credential|private|encryption", "i");
|
|
2067
|
+
function h(e, ...t) {
|
|
1988
2068
|
for (const r of t) {
|
|
1989
2069
|
const n = e[r];
|
|
1990
2070
|
if (n != null) return n;
|
|
1991
2071
|
}
|
|
1992
2072
|
}
|
|
1993
|
-
function
|
|
1994
|
-
return
|
|
2073
|
+
function nr(e) {
|
|
2074
|
+
return h(e, "createdAt", "created_at", "timestamp");
|
|
1995
2075
|
}
|
|
1996
|
-
function
|
|
1997
|
-
return
|
|
2076
|
+
function or(e) {
|
|
2077
|
+
return h(e, "timestamp", "createdAt", "processedAt", "created_at");
|
|
1998
2078
|
}
|
|
1999
|
-
function
|
|
2000
|
-
return
|
|
2079
|
+
function sr(e) {
|
|
2080
|
+
return h(e, "statusCode", "status_code");
|
|
2001
2081
|
}
|
|
2002
|
-
function
|
|
2003
|
-
return
|
|
2082
|
+
function ir(e) {
|
|
2083
|
+
return h(e, "total_duration", "totalDuration", "duration") ?? 0;
|
|
2004
2084
|
}
|
|
2005
|
-
function
|
|
2006
|
-
return
|
|
2085
|
+
function ar(e) {
|
|
2086
|
+
return h(e, "span_count", "spanCount") ?? 0;
|
|
2007
2087
|
}
|
|
2008
|
-
function
|
|
2009
|
-
return
|
|
2088
|
+
function cr(e) {
|
|
2089
|
+
return h(e, "warning_count", "warningCount") ?? 0;
|
|
2010
2090
|
}
|
|
2011
|
-
function
|
|
2012
|
-
return
|
|
2091
|
+
function lr(e) {
|
|
2092
|
+
return h(e, "from_addr", "from") ?? "";
|
|
2013
2093
|
}
|
|
2014
|
-
function
|
|
2015
|
-
return
|
|
2094
|
+
function ur(e) {
|
|
2095
|
+
return h(e, "to_addr", "to") ?? "";
|
|
2016
2096
|
}
|
|
2017
|
-
function
|
|
2018
|
-
return
|
|
2097
|
+
function hr(e) {
|
|
2098
|
+
return h(e, "cc", "cc_addr") ?? "";
|
|
2019
2099
|
}
|
|
2020
|
-
function
|
|
2021
|
-
return
|
|
2100
|
+
function dr(e) {
|
|
2101
|
+
return h(e, "attachment_count", "attachmentCount") ?? 0;
|
|
2022
2102
|
}
|
|
2023
|
-
function
|
|
2024
|
-
return
|
|
2103
|
+
function fr(e) {
|
|
2104
|
+
return h(e, "event_name", "eventName", "event") ?? "";
|
|
2025
2105
|
}
|
|
2026
|
-
function
|
|
2027
|
-
return
|
|
2106
|
+
function pr(e) {
|
|
2107
|
+
return h(e, "method", "sql_method") ?? "";
|
|
2028
2108
|
}
|
|
2029
|
-
function
|
|
2030
|
-
return
|
|
2109
|
+
function gr(e) {
|
|
2110
|
+
return h(e, "sqlNormalized", "normalizedSql", "sql_normalized", "sql") ?? "";
|
|
2031
2111
|
}
|
|
2032
|
-
function
|
|
2112
|
+
function mr(e, t, r) {
|
|
2033
2113
|
const n = e[t];
|
|
2034
2114
|
return n != null && n !== 0 ? Number(n) : Number(e[r]) || 0;
|
|
2035
2115
|
}
|
|
2036
2116
|
export {
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2117
|
+
C as ApiClient,
|
|
2118
|
+
K as ApiError,
|
|
2119
|
+
Ce as DASHBOARD_SECTION_PATHS,
|
|
2120
|
+
te as DEBUG_REFRESH_MS,
|
|
2121
|
+
Ee as DEBUG_TAB_PATHS,
|
|
2122
|
+
Se as DEFAULT_FEATURES,
|
|
2123
|
+
B as DEFAULT_PER_PAGE,
|
|
2124
|
+
Pe as DashboardApi,
|
|
2125
|
+
Et as DashboardDataController,
|
|
2126
|
+
kt as DebugDataController,
|
|
2127
|
+
Ke as ERROR_STATUSES,
|
|
2128
|
+
Ne as INTEGRATION_LABELS,
|
|
2129
|
+
It as JOB_STATUS_FILTERS,
|
|
2130
|
+
Pt as LOG_LEVELS,
|
|
2131
|
+
oe as MAX_HISTORY,
|
|
2132
|
+
$ as METRIC_DEFINITIONS,
|
|
2133
|
+
qe as OK_STATUSES,
|
|
2134
|
+
Z as OVERVIEW_REFRESH_MS,
|
|
2135
|
+
rr as REDACT_PATTERN,
|
|
2136
|
+
ee as SECTION_REFRESH_MS,
|
|
2137
|
+
re as SLOW_DURATION_MS,
|
|
2138
|
+
se as STALE_MS,
|
|
2139
|
+
wt as ServerStatsController,
|
|
2140
|
+
Tt as TAB_ICONS,
|
|
2141
|
+
de as THRESHOLD_CSS_CLASS,
|
|
2142
|
+
ot as THRESHOLD_CSS_VAR,
|
|
2143
|
+
nt as THRESHOLD_HEX_FALLBACK,
|
|
2144
|
+
Be as TIMER_LABELS,
|
|
2145
|
+
x as UnauthorizedError,
|
|
2146
|
+
ne as VERY_SLOW_DURATION_MS,
|
|
2147
|
+
ge as buildQueryParams,
|
|
2148
|
+
ut as buildQueryString,
|
|
2149
|
+
Xe as buildSparklineData,
|
|
2150
|
+
Jt as classifyStatus,
|
|
2151
|
+
Xt as collectTopLevelObjectKeys,
|
|
2152
|
+
D as compactPreview,
|
|
2153
|
+
gt as computePagination,
|
|
2154
|
+
Ot as computeQuerySummary,
|
|
2155
|
+
X as computeStats,
|
|
2156
|
+
er as copyWithFeedback,
|
|
2157
|
+
_t as countDuplicateQueries,
|
|
2158
|
+
je as countLeaves,
|
|
2159
|
+
ft as createFilterState,
|
|
2160
|
+
ke as createHistoryBuffer,
|
|
2161
|
+
dt as createPaginationState,
|
|
2162
|
+
pt as createSortState,
|
|
2163
|
+
W as createTransmitSubscription,
|
|
2164
|
+
yt as detectFeatures,
|
|
2165
|
+
St as detectMetricGroupsFromStats,
|
|
2166
|
+
it as durationClassName,
|
|
2167
|
+
fe as durationSeverity,
|
|
2168
|
+
qt as extractJobStats,
|
|
2169
|
+
Nt as extractJobs,
|
|
2170
|
+
xe as fetchFeatures,
|
|
2171
|
+
Qt as fillPercent,
|
|
2172
|
+
Ft as filterLogsByLevel,
|
|
2173
|
+
Dt as filterQueries,
|
|
2174
|
+
ze as flattenConfig,
|
|
2175
|
+
A as formatBytes,
|
|
2176
|
+
lt as formatCacheSize,
|
|
2177
|
+
Gt as formatCollectorConfig,
|
|
2178
|
+
He as formatConfigVal,
|
|
2179
|
+
ue as formatCount,
|
|
2180
|
+
Ze as formatDuration,
|
|
2181
|
+
Yt as formatFlatValue,
|
|
2182
|
+
F as formatMb,
|
|
2183
|
+
rt as formatStatNum,
|
|
2184
|
+
et as formatTime,
|
|
2185
|
+
ct as formatTtl,
|
|
2186
|
+
le as formatUptime,
|
|
2187
|
+
Y as generateGradientId,
|
|
2188
|
+
Ye as generateSparklinePath,
|
|
2189
|
+
Je as generateSparklinePoints,
|
|
2190
|
+
Me as getDashboardSectionPath,
|
|
2191
|
+
Te as getDebugTabPath,
|
|
2192
|
+
Vt as getIntegrationDetails,
|
|
2193
|
+
jt as getIntegrationLabel,
|
|
2194
|
+
Wt as getIntegrationStatus,
|
|
2195
|
+
Bt as getJobStatusBadgeColor,
|
|
2196
|
+
Ht as getJobStatusCssClass,
|
|
2197
|
+
Lt as getLogLevelCssClass,
|
|
2198
|
+
vt as getMetricById,
|
|
2199
|
+
xt as getMetricsByGroup,
|
|
2200
|
+
mt as getPageNumbers,
|
|
2201
|
+
U as getRatioColor,
|
|
2202
|
+
Ut as getStructuredData,
|
|
2203
|
+
I as getTheme,
|
|
2204
|
+
w as getThresholdColor,
|
|
2205
|
+
he as getThresholdColorInverse,
|
|
2206
|
+
zt as getTimerLabel,
|
|
2207
|
+
bt as getVisibleMetricGroups,
|
|
2208
|
+
Ct as initResizableColumns,
|
|
2209
|
+
Mt as initSplitPane,
|
|
2210
|
+
R as isRedactedValue,
|
|
2211
|
+
Ie as isSecretKey,
|
|
2212
|
+
Zt as matchesConfigSearch,
|
|
2213
|
+
Kt as normalizeTraceFields,
|
|
2214
|
+
Qe as onThemeChange,
|
|
2215
|
+
ht as parsePaginatedResponse,
|
|
2216
|
+
De as parseTraceSpans,
|
|
2217
|
+
_e as parseTraceWarnings,
|
|
2218
|
+
dr as resolveAttachmentCount,
|
|
2219
|
+
hr as resolveCcAddr,
|
|
2220
|
+
ir as resolveDuration,
|
|
2221
|
+
fr as resolveEventName,
|
|
2222
|
+
h as resolveField,
|
|
2223
|
+
lr as resolveFromAddr,
|
|
2224
|
+
or as resolveJobTimestamp,
|
|
2225
|
+
Fe as resolveLogLevel,
|
|
2226
|
+
At as resolveLogMessage,
|
|
2227
|
+
Rt as resolveLogRequestId,
|
|
2228
|
+
$t as resolveLogTimestamp,
|
|
2229
|
+
mr as resolveMetric,
|
|
2230
|
+
gr as resolveNormalizedSql,
|
|
2231
|
+
ar as resolveSpanCount,
|
|
2232
|
+
pr as resolveSqlMethod,
|
|
2233
|
+
sr as resolveStatusCode,
|
|
2234
|
+
nr as resolveTimestamp,
|
|
2235
|
+
ur as resolveToAddr,
|
|
2154
2236
|
k as resolveTraceField,
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2237
|
+
cr as resolveWarningCount,
|
|
2238
|
+
G as setTheme,
|
|
2239
|
+
at as shortReqId,
|
|
2240
|
+
tr as shouldRedact,
|
|
2241
|
+
st as statusColor,
|
|
2242
|
+
V as subscribeToChannel,
|
|
2243
|
+
tt as timeAgo,
|
|
2244
|
+
Ge as toggleTheme
|
|
2163
2245
|
};
|