adonisjs-server-stats 1.9.0 → 1.10.3
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 +23 -14
- package/dist/core/config-utils.d.ts +8 -0
- package/dist/core/constants.d.ts +4 -0
- package/dist/core/dashboard-data-controller.d.ts +16 -0
- package/dist/core/dashboard-data-helpers.d.ts +12 -0
- package/dist/core/debug-data-controller.d.ts +4 -0
- package/dist/core/define-config-helpers.d.ts +25 -0
- package/dist/core/feature-detect-helpers.d.ts +36 -0
- package/dist/core/formatters-helpers.d.ts +23 -0
- package/dist/core/index.js +596 -509
- package/dist/core/log-utils-helpers.d.ts +13 -0
- package/dist/core/metrics.d.ts +3 -28
- package/dist/core/pagination.d.ts +0 -9
- package/dist/core/server-stats-controller.d.ts +6 -0
- package/dist/core/split-pane.d.ts +18 -0
- package/dist/core/trace-utils.d.ts +5 -0
- package/dist/core/transmit-helpers.d.ts +7 -0
- package/dist/core/types-dashboard.d.ts +178 -0
- package/dist/core/types-diagnostics.d.ts +85 -0
- package/dist/core/types.d.ts +11 -443
- package/dist/react/{CacheSection-xH75hwXu.js → CacheSection-baMZotSn.js} +2 -2
- package/dist/react/CacheTab-2cw_rMzj.js +117 -0
- package/dist/react/{ConfigSection-D8BO1Ry9.js → ConfigSection-DGgqjAal.js} +1 -1
- package/dist/react/{ConfigTab-CcN-tfjv.js → ConfigTab-H3OnYqmK.js} +1 -1
- package/dist/react/CustomPaneTab-B6r7ha0u.js +98 -0
- package/dist/react/{EmailsSection-BzlsTdPs.js → EmailsSection-C-UZISG-.js} +2 -2
- package/dist/react/EmailsTab-DbK4Eobn.js +139 -0
- package/dist/react/{EventsSection-CGQWiIdV.js → EventsSection-C7RQW_LY.js} +2 -2
- package/dist/react/EventsTab-CfVr7AiM.js +57 -0
- package/dist/react/{FilterBar-DQRXpWrb.js → FilterBar-CQ7bD669.js} +15 -15
- package/dist/react/{JobsSection-D7AHQmZi.js → JobsSection-CQHNK_Ls.js} +2 -2
- package/dist/react/{JobsTab-B3Lfdqed.js → JobsTab-znzf6jzk.js} +54 -42
- package/dist/react/{LogsSection-Cly1dpvS.js → LogsSection-Dmm3rE2B.js} +9 -3
- package/dist/react/LogsTab-D8unMV5P.js +108 -0
- package/dist/react/{OverviewSection-CkBGFEWq.js → OverviewSection-ABP9ueBo.js} +1 -1
- package/dist/react/{QueriesSection-CfCpnNUD.js → QueriesSection-CnmSkznA.js} +2 -2
- package/dist/react/{QueriesTab-DbBmAqzO.js → QueriesTab-BQzcxEiW.js} +37 -40
- package/dist/react/RelatedLogs-3A8RuGKH.js +52 -0
- package/dist/react/RequestsSection-kW79_M7k.js +341 -0
- package/dist/react/{RoutesSection-CRqF-cNM.js → RoutesSection-BRhxrtjZ.js} +2 -2
- package/dist/react/RoutesTab-CpYH5lUw.js +68 -0
- package/dist/react/TimelineTab-DjLR35Ce.js +214 -0
- package/dist/react/index-CsImORX6.js +1121 -0
- package/dist/react/index.js +1 -1
- package/dist/react/react/components/{Dashboard/shared → shared}/FilterBar.d.ts +4 -3
- package/dist/react/react/components/shared/RelatedLogs.d.ts +7 -0
- package/dist/react/react/hooks/useDashboardData.d.ts +4 -8
- package/dist/react/style.css +1 -1
- package/dist/src/collectors/app_collector.d.ts +0 -8
- package/dist/src/collectors/app_collector.js +45 -52
- package/dist/src/collectors/auto_detect.d.ts +0 -23
- package/dist/src/collectors/auto_detect.js +33 -55
- package/dist/src/collectors/db_pool_collector.d.ts +14 -16
- package/dist/src/collectors/db_pool_collector.js +72 -57
- package/dist/src/collectors/log_collector.d.ts +0 -47
- package/dist/src/collectors/log_collector.js +36 -65
- package/dist/src/collectors/queue_collector.d.ts +0 -20
- package/dist/src/collectors/queue_collector.js +60 -76
- package/dist/src/collectors/redis_collector.d.ts +10 -10
- package/dist/src/collectors/redis_collector.js +69 -66
- package/dist/src/config/deprecation_migration.d.ts +7 -0
- package/dist/src/config/deprecation_migration.js +201 -0
- package/dist/src/controller/debug_controller.d.ts +1 -1
- package/dist/src/controller/debug_controller.js +87 -81
- package/dist/src/dashboard/cache_handlers.d.ts +14 -0
- package/dist/src/dashboard/cache_handlers.js +52 -0
- package/dist/src/dashboard/chart_aggregator.d.ts +0 -7
- package/dist/src/dashboard/chart_aggregator.js +68 -50
- package/dist/src/dashboard/coalesce_cache.d.ts +25 -0
- package/dist/src/dashboard/coalesce_cache.js +47 -0
- package/dist/src/dashboard/dashboard_controller.d.ts +11 -37
- package/dist/src/dashboard/dashboard_controller.js +52 -532
- package/dist/src/dashboard/dashboard_page_assets.d.ts +17 -0
- package/dist/src/dashboard/dashboard_page_assets.js +51 -0
- package/dist/src/dashboard/dashboard_store.d.ts +19 -217
- package/dist/src/dashboard/dashboard_store.js +115 -1069
- package/dist/src/dashboard/dashboard_types.d.ts +83 -0
- package/dist/src/dashboard/dashboard_types.js +4 -0
- package/dist/src/dashboard/detail_queries.d.ts +19 -0
- package/dist/src/dashboard/detail_queries.js +98 -0
- package/dist/src/dashboard/email_event_builder.d.ts +8 -0
- package/dist/src/dashboard/email_event_builder.js +65 -0
- package/dist/src/dashboard/explain_query.d.ts +8 -0
- package/dist/src/dashboard/explain_query.js +22 -0
- package/dist/src/dashboard/filter_handlers.d.ts +23 -0
- package/dist/src/dashboard/filter_handlers.js +56 -0
- package/dist/src/dashboard/filtered_queries.d.ts +15 -0
- package/dist/src/dashboard/filtered_queries.js +155 -0
- package/dist/src/dashboard/flush_manager.d.ts +25 -0
- package/dist/src/dashboard/flush_manager.js +107 -0
- package/dist/src/dashboard/format_helpers.d.ts +126 -0
- package/dist/src/dashboard/format_helpers.js +140 -0
- package/dist/src/dashboard/inspector_manager.d.ts +36 -0
- package/dist/src/dashboard/inspector_manager.js +102 -0
- package/dist/src/dashboard/integrations/config_inspector.js +11 -13
- package/dist/src/dashboard/integrations/queue_inspector.d.ts +3 -3
- package/dist/src/dashboard/integrations/queue_inspector.js +13 -10
- package/dist/src/dashboard/jobs_handlers.d.ts +14 -0
- package/dist/src/dashboard/jobs_handlers.js +61 -0
- package/dist/src/dashboard/knex_factory.d.ts +18 -0
- package/dist/src/dashboard/knex_factory.js +91 -0
- package/dist/src/dashboard/migrator.js +30 -153
- package/dist/src/dashboard/migrator_tables.d.ts +19 -0
- package/dist/src/dashboard/migrator_tables.js +153 -0
- package/dist/src/dashboard/overview_queries.d.ts +66 -0
- package/dist/src/dashboard/overview_queries.js +155 -0
- package/dist/src/dashboard/overview_query_runners.d.ts +25 -0
- package/dist/src/dashboard/overview_query_runners.js +84 -0
- package/dist/src/dashboard/overview_store_queries.d.ts +40 -0
- package/dist/src/dashboard/overview_store_queries.js +69 -0
- package/dist/src/dashboard/paginate_helper.d.ts +12 -0
- package/dist/src/dashboard/paginate_helper.js +33 -0
- package/dist/src/dashboard/query_explain_handler.d.ts +10 -0
- package/dist/src/dashboard/query_explain_handler.js +80 -0
- package/dist/src/dashboard/read_queries.d.ts +32 -0
- package/dist/src/dashboard/read_queries.js +107 -0
- package/dist/src/dashboard/saved_filter_queries.d.ts +10 -0
- package/dist/src/dashboard/saved_filter_queries.js +24 -0
- package/dist/src/dashboard/storage_stats.d.ts +41 -0
- package/dist/src/dashboard/storage_stats.js +81 -0
- package/dist/src/dashboard/write_queue.d.ts +106 -0
- package/dist/src/dashboard/write_queue.js +225 -0
- package/dist/src/data/data_access.d.ts +6 -36
- package/dist/src/data/data_access.js +43 -188
- package/dist/src/data/data_access_helpers.d.ts +130 -0
- package/dist/src/data/data_access_helpers.js +212 -0
- package/dist/src/debug/debug_store.js +37 -32
- package/dist/src/debug/email_collector.d.ts +1 -10
- package/dist/src/debug/email_collector.js +78 -81
- package/dist/src/debug/event_collector.d.ts +0 -9
- package/dist/src/debug/event_collector.js +79 -62
- package/dist/src/debug/query_collector.js +23 -19
- package/dist/src/debug/route_inspector.d.ts +1 -5
- package/dist/src/debug/route_inspector.js +50 -51
- package/dist/src/debug/trace_collector.d.ts +10 -2
- package/dist/src/debug/trace_collector.js +23 -16
- package/dist/src/debug/types.d.ts +5 -1
- package/dist/src/define_config.d.ts +0 -65
- package/dist/src/define_config.js +93 -333
- package/dist/src/edge/client/dashboard.js +2 -2
- package/dist/src/edge/client/debug-panel-deferred.js +1 -1
- package/dist/src/edge/client/stats-bar.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +5 -5
- package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
- package/dist/src/edge/client-vue/stats-bar.js +3 -3
- package/dist/src/edge/plugin.d.ts +0 -16
- package/dist/src/edge/plugin.js +57 -64
- package/dist/src/engine/request_metrics.d.ts +1 -0
- package/dist/src/engine/request_metrics.js +32 -42
- package/dist/src/middleware/request_tracking_middleware.d.ts +3 -8
- package/dist/src/middleware/request_tracking_middleware.js +65 -91
- package/dist/src/provider/auth_middleware_detector.d.ts +16 -0
- package/dist/src/provider/auth_middleware_detector.js +97 -0
- package/dist/src/provider/boot_helpers.d.ts +20 -0
- package/dist/src/provider/boot_helpers.js +91 -0
- package/dist/src/provider/boot_initializer.d.ts +28 -0
- package/dist/src/provider/boot_initializer.js +35 -0
- package/dist/src/provider/dashboard_init.d.ts +30 -0
- package/dist/src/provider/dashboard_init.js +138 -0
- package/dist/src/provider/dashboard_setup.d.ts +25 -0
- package/dist/src/provider/dashboard_setup.js +78 -0
- package/dist/src/provider/diagnostics.d.ts +134 -0
- package/dist/src/provider/diagnostics.js +127 -0
- package/dist/src/provider/email_bridge.d.ts +43 -0
- package/dist/src/provider/email_bridge.js +80 -0
- package/dist/src/provider/email_helpers.d.ts +13 -0
- package/dist/src/provider/email_helpers.js +68 -0
- package/dist/src/provider/pino_hook.d.ts +17 -0
- package/dist/src/provider/pino_hook.js +35 -0
- package/dist/src/provider/provider_helpers_extra.d.ts +47 -0
- package/dist/src/provider/provider_helpers_extra.js +177 -0
- package/dist/src/provider/server_stats_provider.d.ts +39 -85
- package/dist/src/provider/server_stats_provider.js +131 -936
- package/dist/src/provider/shutdown_helpers.d.ts +43 -0
- package/dist/src/provider/shutdown_helpers.js +70 -0
- package/dist/src/provider/toolbar_setup.d.ts +57 -0
- package/dist/src/provider/toolbar_setup.js +141 -0
- package/dist/src/routes/dashboard_routes.d.ts +14 -0
- package/dist/src/routes/dashboard_routes.js +197 -0
- package/dist/src/routes/debug_routes.d.ts +14 -0
- package/dist/src/routes/debug_routes.js +101 -0
- package/dist/src/routes/register_routes.d.ts +0 -78
- package/dist/src/routes/register_routes.js +22 -347
- package/dist/src/routes/stats_routes.d.ts +5 -0
- package/dist/src/routes/stats_routes.js +14 -0
- package/dist/src/styles/components.css +177 -0
- package/dist/src/styles/dashboard.css +8 -90
- package/dist/src/styles/debug-panel.css +10 -31
- package/dist/src/types.d.ts +306 -15
- package/dist/vue/{CacheSection-Cx-hj09X.js → CacheSection-ITqvpfH5.js} +1 -1
- package/dist/vue/{ConfigSection-CMXyryf6.js → ConfigSection-DTn3GslE.js} +1 -1
- package/dist/vue/{EmailsSection-DgKl9xGT.js → EmailsSection-DtLJ4XoS.js} +1 -1
- package/dist/vue/{EventsSection-BNMCAim1.js → EventsSection-BOYYz0Ty.js} +1 -1
- package/dist/vue/{JobsSection-CCMgMlxd.js → JobsSection-BazTxcJL.js} +1 -1
- package/dist/vue/{LogsSection-CvOnTxUu.js → LogsSection-D55PjTKX.js} +9 -3
- package/dist/vue/{LogsTab-Bg3o0Mm6.js → LogsTab-47zEK7jL.js} +4 -1
- package/dist/vue/{OverviewSection-CHgaKtUR.js → OverviewSection-1uBKo-Tu.js} +1 -1
- package/dist/vue/{QueriesSection-BnHRD98z.js → QueriesSection-rpoZ4ogd.js} +1 -1
- package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +84 -0
- package/dist/vue/RequestsSection-x7LvT0MC.js +401 -0
- package/dist/vue/{RoutesSection-BrceOcKQ.js → RoutesSection-CCD0zZqQ.js} +1 -1
- package/dist/vue/TimelineTab-zj5Z5OdT.js +338 -0
- package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +4 -0
- package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +4 -0
- package/dist/vue/components/{Dashboard/sections/TimelineSection.vue.d.ts → shared/RelatedLogs.vue.d.ts} +5 -6
- package/dist/vue/composables/useDashboardData.d.ts +12 -23
- package/dist/vue/index-C8MxnS7Q.js +1232 -0
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/react/CacheTab-DYmsZJJ1.js +0 -123
- package/dist/react/CustomPaneTab-D7_o3Ec6.js +0 -104
- package/dist/react/EmailsTab-Uh2CQY3o.js +0 -153
- package/dist/react/EventsTab-CC6DQzEm.js +0 -63
- package/dist/react/LogsTab-BbYK-iyh.js +0 -103
- package/dist/react/RequestsSection-Cb5a6MlT.js +0 -209
- package/dist/react/RoutesTab-Bwreij3e.js +0 -74
- package/dist/react/TimelineSection-B2y06kRE.js +0 -158
- package/dist/react/TimelineTab-6hthfdBB.js +0 -193
- package/dist/react/WaterfallChart-Cj73WdfM.js +0 -100
- package/dist/react/index-CecA4IdQ.js +0 -1075
- package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +0 -8
- package/dist/vue/RequestsSection-B-uSlM0f.js +0 -243
- package/dist/vue/TimelineSection-CfvnA2Oo.js +0 -186
- package/dist/vue/TimelineTab-Db6lKKsD.js +0 -250
- package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +0 -118
- package/dist/vue/index-oLxS08vN.js +0 -1235
package/dist/core/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
class
|
|
1
|
+
class b 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 B 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 v {
|
|
15
15
|
baseUrl;
|
|
16
16
|
authToken;
|
|
17
17
|
constructor(t) {
|
|
@@ -25,7 +25,7 @@ class T {
|
|
|
25
25
|
* @returns Parsed JSON response body typed as `T`.
|
|
26
26
|
*/
|
|
27
27
|
async fetch(t, r) {
|
|
28
|
-
const
|
|
28
|
+
const o = {
|
|
29
29
|
...{
|
|
30
30
|
Accept: "application/json",
|
|
31
31
|
...this.authToken ? { Authorization: `Bearer ${this.authToken}` } : {}
|
|
@@ -33,16 +33,16 @@ class T {
|
|
|
33
33
|
...r?.headers
|
|
34
34
|
}, s = await globalThis.fetch(`${this.baseUrl}${t}`, {
|
|
35
35
|
...r,
|
|
36
|
-
headers:
|
|
36
|
+
headers: o,
|
|
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
41
|
if (s.status === 401 || s.status === 403)
|
|
42
|
-
throw new
|
|
42
|
+
throw new b(s.status);
|
|
43
43
|
if (!s.ok) {
|
|
44
|
-
const
|
|
45
|
-
throw new
|
|
44
|
+
const i = await s.text().catch(() => "");
|
|
45
|
+
throw new B(s.status, i);
|
|
46
46
|
}
|
|
47
47
|
return s.json();
|
|
48
48
|
}
|
|
@@ -84,7 +84,22 @@ class T {
|
|
|
84
84
|
return this.fetch(t, { method: "DELETE" });
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
function H(e, t) {
|
|
88
|
+
const r = e || (typeof window < "u" ? window.location.origin : "");
|
|
89
|
+
if (!t)
|
|
90
|
+
return { baseUrl: r };
|
|
91
|
+
const n = { headers: { Authorization: `Bearer ${t}` } };
|
|
92
|
+
return {
|
|
93
|
+
baseUrl: r,
|
|
94
|
+
beforeSubscribe(o) {
|
|
95
|
+
return n;
|
|
96
|
+
},
|
|
97
|
+
beforeUnsubscribe(o) {
|
|
98
|
+
return n;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async function N() {
|
|
88
103
|
if (typeof window < "u" && window.Transmit && typeof window.Transmit == "function")
|
|
89
104
|
return window.Transmit;
|
|
90
105
|
try {
|
|
@@ -94,51 +109,33 @@ async function B() {
|
|
|
94
109
|
return null;
|
|
95
110
|
}
|
|
96
111
|
}
|
|
97
|
-
function
|
|
112
|
+
function q(e) {
|
|
98
113
|
let t = null, r = null, n = !1;
|
|
99
114
|
return { subscribe: async () => {
|
|
100
115
|
try {
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
116
|
+
const i = await N();
|
|
117
|
+
if (!i)
|
|
103
118
|
throw new Error(
|
|
104
119
|
"Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)"
|
|
105
120
|
);
|
|
106
121
|
if (n) return;
|
|
107
|
-
t = new
|
|
108
|
-
|
|
109
|
-
...e.authToken ? {
|
|
110
|
-
beforeSubscribe(l) {
|
|
111
|
-
return {
|
|
112
|
-
headers: {
|
|
113
|
-
Authorization: `Bearer ${e.authToken}`
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
beforeUnsubscribe(l) {
|
|
118
|
-
return {
|
|
119
|
-
headers: {
|
|
120
|
-
Authorization: `Bearer ${e.authToken}`
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
} : {}
|
|
125
|
-
}), r = t.subscription(e.channelName), r.onMessage((l) => {
|
|
126
|
-
n || e.onMessage(l);
|
|
122
|
+
t = new i(H(e.baseUrl, e.authToken)), r = t.subscription(e.channelName), r.onMessage((a) => {
|
|
123
|
+
n || e.onMessage(a);
|
|
127
124
|
}), await r.create();
|
|
128
|
-
} catch (
|
|
129
|
-
e.onError
|
|
125
|
+
} catch (i) {
|
|
126
|
+
e.onError?.(i);
|
|
130
127
|
}
|
|
131
128
|
}, unsubscribe: async () => {
|
|
132
129
|
n = !0;
|
|
133
130
|
try {
|
|
134
|
-
|
|
131
|
+
await r?.delete(), r = null, t = null;
|
|
135
132
|
} catch {
|
|
136
133
|
}
|
|
137
134
|
} };
|
|
138
135
|
}
|
|
139
|
-
function
|
|
136
|
+
function K(e) {
|
|
140
137
|
let t = !1;
|
|
141
|
-
const r =
|
|
138
|
+
const r = q({
|
|
142
139
|
baseUrl: e.baseUrl,
|
|
143
140
|
channelName: e.channelName,
|
|
144
141
|
authToken: e.authToken,
|
|
@@ -158,38 +155,38 @@ function N(e) {
|
|
|
158
155
|
}
|
|
159
156
|
};
|
|
160
157
|
}
|
|
161
|
-
const
|
|
158
|
+
const S = "ss-dash-theme", k = "ss-theme-change";
|
|
162
159
|
function U() {
|
|
163
160
|
if (typeof window > "u") return "light";
|
|
164
|
-
const e = localStorage.getItem(
|
|
161
|
+
const e = localStorage.getItem(S);
|
|
165
162
|
return e === "dark" || e === "light" ? e : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
166
163
|
}
|
|
167
|
-
function
|
|
168
|
-
typeof window > "u" || (localStorage.setItem(
|
|
164
|
+
function z(e) {
|
|
165
|
+
typeof window > "u" || (localStorage.setItem(S, e), window.dispatchEvent(new CustomEvent(k, { detail: e })));
|
|
169
166
|
}
|
|
170
|
-
function
|
|
167
|
+
function Ne() {
|
|
171
168
|
const t = U() === "dark" ? "light" : "dark";
|
|
172
|
-
return
|
|
169
|
+
return z(t), t;
|
|
173
170
|
}
|
|
174
|
-
function
|
|
171
|
+
function qe(e) {
|
|
175
172
|
if (typeof window > "u") return () => {
|
|
176
173
|
};
|
|
177
174
|
const t = (s) => {
|
|
178
|
-
const
|
|
179
|
-
(
|
|
175
|
+
const i = s.detail;
|
|
176
|
+
(i === "dark" || i === "light") && e(i);
|
|
180
177
|
}, r = (s) => {
|
|
181
|
-
if (s.key ===
|
|
182
|
-
const
|
|
183
|
-
e(
|
|
178
|
+
if (s.key === S) {
|
|
179
|
+
const i = s.newValue;
|
|
180
|
+
e(i === "dark" || i === "light" ? i : U());
|
|
184
181
|
}
|
|
185
|
-
}, n = window.matchMedia("(prefers-color-scheme: dark)"),
|
|
186
|
-
localStorage.getItem(
|
|
182
|
+
}, n = window.matchMedia("(prefers-color-scheme: dark)"), o = (s) => {
|
|
183
|
+
localStorage.getItem(S) || e(s.matches ? "dark" : "light");
|
|
187
184
|
};
|
|
188
|
-
return window.addEventListener(
|
|
189
|
-
window.removeEventListener(
|
|
185
|
+
return window.addEventListener(k, t), window.addEventListener("storage", r), n.addEventListener("change", o), () => {
|
|
186
|
+
window.removeEventListener(k, t), window.removeEventListener("storage", r), n.removeEventListener("change", o);
|
|
190
187
|
};
|
|
191
188
|
}
|
|
192
|
-
const
|
|
189
|
+
const m = {
|
|
193
190
|
color: "#34d399",
|
|
194
191
|
fillOpacityTop: 0.25,
|
|
195
192
|
fillOpacityBottom: 0.02,
|
|
@@ -198,77 +195,94 @@ const y = {
|
|
|
198
195
|
height: 32,
|
|
199
196
|
padding: 2
|
|
200
197
|
};
|
|
201
|
-
function
|
|
202
|
-
return { ...
|
|
198
|
+
function j(e) {
|
|
199
|
+
return { ...m, ...e };
|
|
203
200
|
}
|
|
204
|
-
function
|
|
201
|
+
function Ke(e, t = m.width, r = m.height, n = m.padding) {
|
|
205
202
|
if (e.length < 2) return null;
|
|
206
|
-
const
|
|
207
|
-
return e.map((
|
|
208
|
-
const
|
|
209
|
-
return `${
|
|
203
|
+
const o = t - n * 2, s = r - n * 2, i = Math.min(...e), c = Math.max(...e) - i || 1;
|
|
204
|
+
return e.map((p, h) => {
|
|
205
|
+
const d = n + h / (e.length - 1) * o, f = n + s - (p - i) / c * s;
|
|
206
|
+
return `${d.toFixed(1)},${f.toFixed(1)}`;
|
|
210
207
|
}).join(" ");
|
|
211
208
|
}
|
|
212
|
-
function
|
|
209
|
+
function ze(e, t = m.width, r = m.height, n = m.padding) {
|
|
213
210
|
if (e.length < 2) return null;
|
|
214
|
-
const
|
|
215
|
-
const u = n +
|
|
211
|
+
const o = t - n * 2, s = r - n * 2, i = Math.min(...e), c = Math.max(...e) - i || 1, l = e.map((f, y) => {
|
|
212
|
+
const u = n + y / (e.length - 1) * o, E = n + s - (f - i) / c * s;
|
|
216
213
|
return `${u.toFixed(1)},${E.toFixed(1)}`;
|
|
217
|
-
}),
|
|
218
|
-
return `M${
|
|
214
|
+
}), p = (n + o).toFixed(1), h = (n + s).toFixed(1), d = n.toFixed(1);
|
|
215
|
+
return `M${l[0]} ` + l.slice(1).map((f) => `L${f}`).join(" ") + ` L${p},${h} L${d},${h} Z`;
|
|
219
216
|
}
|
|
220
|
-
let
|
|
217
|
+
let V = 0;
|
|
221
218
|
function W() {
|
|
222
|
-
return `ss-grad-${
|
|
219
|
+
return `ss-grad-${V++}`;
|
|
223
220
|
}
|
|
224
|
-
function
|
|
221
|
+
function G(e) {
|
|
225
222
|
if (e.length === 0) return null;
|
|
226
223
|
let t = e[0], r = e[0], n = e[0];
|
|
227
|
-
for (let
|
|
228
|
-
const s = e[
|
|
224
|
+
for (let o = 1; o < e.length; o++) {
|
|
225
|
+
const s = e[o];
|
|
229
226
|
s < t && (t = s), s > r && (r = s), n += s;
|
|
230
227
|
}
|
|
231
228
|
return { min: t, max: r, avg: n / e.length };
|
|
232
229
|
}
|
|
233
|
-
function
|
|
230
|
+
function je(e, t) {
|
|
234
231
|
if (e.length < 2) return null;
|
|
235
|
-
const r =
|
|
236
|
-
for (let u = 0; u <
|
|
237
|
-
const E =
|
|
238
|
-
|
|
232
|
+
const r = j(t), n = G(e), o = n.max - n.min || 1, s = 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 E = a + u / (c - 1) * s, _ = a + i - (e[u] - n.min) / o * i;
|
|
235
|
+
l[u] = `${E.toFixed(1)},${_.toFixed(1)}`;
|
|
239
236
|
}
|
|
240
|
-
const
|
|
237
|
+
const p = l.join(" "), h = (a + s).toFixed(1), d = (a + i).toFixed(1), f = a.toFixed(1), y = `M${l[0]} ` + l.slice(1).map((u) => `L${u}`).join(" ") + ` L${h},${d} L${f},${d} Z`;
|
|
241
238
|
return {
|
|
242
|
-
points:
|
|
243
|
-
areaPath:
|
|
239
|
+
points: p,
|
|
240
|
+
areaPath: y,
|
|
244
241
|
gradientId: W(),
|
|
245
242
|
options: r,
|
|
246
243
|
stats: n
|
|
247
244
|
};
|
|
248
245
|
}
|
|
249
|
-
const
|
|
250
|
-
function
|
|
246
|
+
const Q = 5e3, J = 1e4, Y = 3e3, X = 100, Z = 500, ee = 60, te = 1e4;
|
|
247
|
+
function re(e) {
|
|
248
|
+
return '"' + (e.length > 40 ? e.slice(0, 40) + "..." : e) + '"';
|
|
249
|
+
}
|
|
250
|
+
function ne(e, t, r) {
|
|
251
|
+
if (e.length === 0) return "[]";
|
|
252
|
+
const n = e.slice(0, 3).map((i) => r(i, 30)), o = e.length > 3 ? ", ..." + e.length + " items" : "", s = "[" + n.join(", ") + o + "]";
|
|
253
|
+
return s.length > t ? "[" + e.length + " items]" : s;
|
|
254
|
+
}
|
|
255
|
+
function se(e, t, r) {
|
|
256
|
+
const n = Object.keys(e);
|
|
257
|
+
if (n.length === 0) return "{}";
|
|
258
|
+
const o = [];
|
|
259
|
+
for (let c = 0; c < Math.min(n.length, 4); c++)
|
|
260
|
+
o.push(n[c] + ": " + r(e[n[c]], 30));
|
|
261
|
+
const s = n.length > 4 ? ", ...+" + (n.length - 4) : "", i = "{ " + o.join(", ") + s + " }";
|
|
262
|
+
return i.length <= t ? i : "{ " + (n.slice(0, 6).join(", ") + (n.length > 6 ? ", ..." : "")) + " }";
|
|
263
|
+
}
|
|
264
|
+
function oe(e) {
|
|
251
265
|
if (!e && e !== 0) return "-";
|
|
252
|
-
const t = Math.floor(e), r = Math.floor(t / 86400), n = Math.floor(t % 86400 / 3600),
|
|
253
|
-
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), o = Math.floor(t % 3600 / 60);
|
|
267
|
+
return r > 0 ? `${r}d ${n}h` : n > 0 ? `${n}h ${o}m` : o > 0 ? `${o}m ${t % 60}s` : `${t}s`;
|
|
254
268
|
}
|
|
255
|
-
function
|
|
269
|
+
function M(e) {
|
|
256
270
|
const t = e / 1048576;
|
|
257
271
|
return t >= 1024 ? `${(t / 1024).toFixed(1)}G` : `${t.toFixed(0)}M`;
|
|
258
272
|
}
|
|
259
|
-
function
|
|
273
|
+
function A(e) {
|
|
260
274
|
return e >= 1024 ? `${(e / 1024).toFixed(1)}G` : `${e.toFixed(1)}M`;
|
|
261
275
|
}
|
|
262
|
-
function
|
|
276
|
+
function ie(e) {
|
|
263
277
|
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}K` : `${e}`;
|
|
264
278
|
}
|
|
265
|
-
function
|
|
279
|
+
function Ve(e) {
|
|
266
280
|
return e >= 1e3 ? `${(e / 1e3).toFixed(2)}s` : e >= 1 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`;
|
|
267
281
|
}
|
|
268
282
|
function D(e) {
|
|
269
283
|
return /([+-]\d{2}:?\d{2}|Z)\s*$/.test(e) ? e : e + "Z";
|
|
270
284
|
}
|
|
271
|
-
function
|
|
285
|
+
function We(e) {
|
|
272
286
|
if (!e) return "-";
|
|
273
287
|
const t = typeof e == "string" ? new Date(D(e)) : new Date(e);
|
|
274
288
|
return Number.isNaN(t.getTime()) ? "-" : t.toLocaleTimeString("en-US", {
|
|
@@ -278,12 +292,12 @@ function Oe(e) {
|
|
|
278
292
|
second: "2-digit"
|
|
279
293
|
}) + "." + String(t.getMilliseconds()).padStart(3, "0");
|
|
280
294
|
}
|
|
281
|
-
function
|
|
295
|
+
function Ge(e) {
|
|
282
296
|
if (!e) return "-";
|
|
283
297
|
const t = typeof e == "string" ? new Date(D(e)).getTime() : e, r = Math.floor((Date.now() - t) / 1e3);
|
|
284
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`;
|
|
285
299
|
}
|
|
286
|
-
function
|
|
300
|
+
function Qe(e, t) {
|
|
287
301
|
switch (t) {
|
|
288
302
|
case "%":
|
|
289
303
|
return `${e.toFixed(1)}%`;
|
|
@@ -292,7 +306,7 @@ function _e(e, t) {
|
|
|
292
306
|
case "MB":
|
|
293
307
|
return `${e.toFixed(1)}M`;
|
|
294
308
|
case "bytes":
|
|
295
|
-
return
|
|
309
|
+
return M(e);
|
|
296
310
|
case "/s":
|
|
297
311
|
case "/m":
|
|
298
312
|
return e.toFixed(1);
|
|
@@ -300,90 +314,71 @@ function _e(e, t) {
|
|
|
300
314
|
return e.toFixed(1);
|
|
301
315
|
}
|
|
302
316
|
}
|
|
303
|
-
function
|
|
317
|
+
function x(e, t, r) {
|
|
304
318
|
return e > r ? "red" : e > t ? "amber" : "green";
|
|
305
319
|
}
|
|
306
|
-
function
|
|
320
|
+
function ae(e, t, r) {
|
|
307
321
|
return e < r ? "red" : e < t ? "amber" : "green";
|
|
308
322
|
}
|
|
309
|
-
function
|
|
323
|
+
function R(e, t) {
|
|
310
324
|
if (t === 0) return "green";
|
|
311
325
|
const r = e / t;
|
|
312
326
|
return r > 0.8 ? "red" : r > 0.5 ? "amber" : "green";
|
|
313
327
|
}
|
|
314
|
-
const
|
|
328
|
+
const ce = {
|
|
315
329
|
green: "ss-green",
|
|
316
330
|
amber: "ss-amber",
|
|
317
331
|
red: "ss-red"
|
|
318
|
-
},
|
|
332
|
+
}, Je = {
|
|
319
333
|
green: "#34d399",
|
|
320
334
|
amber: "#fbbf24",
|
|
321
335
|
red: "#f87171"
|
|
322
|
-
},
|
|
336
|
+
}, Ye = {
|
|
323
337
|
green: "--ss-accent",
|
|
324
338
|
amber: "--ss-amber-fg",
|
|
325
339
|
red: "--ss-red-fg"
|
|
326
340
|
};
|
|
327
|
-
function
|
|
341
|
+
function Xe(e) {
|
|
328
342
|
return e >= 500 ? "red" : e >= 400 ? "amber" : "green";
|
|
329
343
|
}
|
|
330
|
-
function
|
|
331
|
-
return e >
|
|
344
|
+
function Ze(e) {
|
|
345
|
+
return e > Z ? "very-slow" : e > X ? "slow" : "normal";
|
|
332
346
|
}
|
|
333
|
-
function
|
|
347
|
+
function et(e) {
|
|
334
348
|
return e ? e.length <= 8 ? e : e.slice(0, 8) + "…" : "--";
|
|
335
349
|
}
|
|
336
350
|
function L(e, t = 100) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return '"' + (e.length > 40 ? e.slice(0, 40) + "..." : e) + '"';
|
|
341
|
-
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
342
|
-
if (Array.isArray(e)) {
|
|
343
|
-
if (e.length === 0) return "[]";
|
|
344
|
-
const n = "[" + e.slice(0, 3).map((i) => L(i, 30)).join(", ") + (e.length > 3 ? ", ..." + e.length + " items" : "") + "]";
|
|
345
|
-
return n.length > t ? "[" + e.length + " items]" : n;
|
|
346
|
-
}
|
|
347
|
-
if (typeof e == "object") {
|
|
348
|
-
const r = Object.keys(e);
|
|
349
|
-
if (r.length === 0) return "{}";
|
|
350
|
-
const n = [];
|
|
351
|
-
for (let s = 0; s < Math.min(r.length, 4); s++)
|
|
352
|
-
n.push(r[s] + ": " + L(e[r[s]], 30));
|
|
353
|
-
const i = "{ " + n.join(", ") + (r.length > 4 ? ", ...+" + (r.length - 4) : "") + " }";
|
|
354
|
-
return i.length > t ? "{ " + r.slice(0, 6).join(", ") + (r.length > 6 ? ", ..." : "") + " }" : i;
|
|
355
|
-
}
|
|
356
|
-
return String(e);
|
|
357
|
-
}
|
|
358
|
-
function ze(e) {
|
|
351
|
+
return e === null ? "null" : e === void 0 ? "-" : typeof e == "string" ? re(e) : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? ne(e, t, L) : typeof e == "object" ? se(e, t, L) : String(e);
|
|
352
|
+
}
|
|
353
|
+
function tt(e) {
|
|
359
354
|
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`;
|
|
360
355
|
}
|
|
361
|
-
function
|
|
356
|
+
function rt(e) {
|
|
362
357
|
return e < 1024 ? `${e}B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)}KB` : `${(e / (1024 * 1024)).toFixed(1)}MB`;
|
|
363
358
|
}
|
|
364
|
-
const
|
|
365
|
-
function
|
|
359
|
+
const O = 50;
|
|
360
|
+
function nt(e, t, r) {
|
|
366
361
|
const n = new URLSearchParams();
|
|
367
362
|
if (n.set("page", String(e.page)), n.set("perPage", String(e.perPage)), t) {
|
|
368
363
|
t.search && n.set("search", t.search);
|
|
369
|
-
for (const [
|
|
370
|
-
s && n.set(
|
|
364
|
+
for (const [o, s] of Object.entries(t.filters))
|
|
365
|
+
s && n.set(o, s);
|
|
371
366
|
}
|
|
372
367
|
return r && (n.set("sort", r.field), n.set("direction", r.direction)), n.toString();
|
|
373
368
|
}
|
|
374
|
-
function
|
|
375
|
-
const r = e.data ?? e.items ?? [], n = e.total ?? 0,
|
|
369
|
+
function st(e, t = O) {
|
|
370
|
+
const r = e.data ?? e.items ?? [], n = e.total ?? 0, o = e.page ?? 1, s = e.perPage ?? e.limit ?? t, i = e.totalPages ?? (Math.ceil(n / s) || 1);
|
|
376
371
|
return {
|
|
377
372
|
data: r,
|
|
378
373
|
pagination: {
|
|
379
|
-
page:
|
|
374
|
+
page: o,
|
|
380
375
|
perPage: s,
|
|
381
376
|
total: n,
|
|
382
|
-
totalPages:
|
|
377
|
+
totalPages: i
|
|
383
378
|
}
|
|
384
379
|
};
|
|
385
380
|
}
|
|
386
|
-
function
|
|
381
|
+
function ot(e = O) {
|
|
387
382
|
return {
|
|
388
383
|
page: 1,
|
|
389
384
|
perPage: e,
|
|
@@ -391,44 +386,97 @@ function Ge(e = F) {
|
|
|
391
386
|
totalPages: 1
|
|
392
387
|
};
|
|
393
388
|
}
|
|
394
|
-
function
|
|
389
|
+
function it() {
|
|
395
390
|
return {
|
|
396
391
|
search: "",
|
|
397
392
|
filters: {}
|
|
398
393
|
};
|
|
399
394
|
}
|
|
400
|
-
function
|
|
395
|
+
function at(e = "id", t = "desc") {
|
|
401
396
|
return { field: e, direction: t };
|
|
402
397
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
398
|
+
const le = [
|
|
399
|
+
{ key: "page", param: "page", isNumeric: !0 },
|
|
400
|
+
{ key: "perPage", param: "perPage", isNumeric: !0 },
|
|
401
|
+
{ key: "search", param: "search" },
|
|
402
|
+
{ key: "sort", param: "sort" },
|
|
403
|
+
{ key: "sortDir", param: "direction" },
|
|
404
|
+
{ key: "timeRange", param: "range" }
|
|
405
|
+
];
|
|
406
|
+
function ue(e) {
|
|
407
|
+
const t = new URLSearchParams(), r = e;
|
|
408
|
+
for (const { key: n, param: o, isNumeric: s } of le) {
|
|
409
|
+
const i = r[n];
|
|
410
|
+
(s ? i != null : i) && t.set(o, String(i));
|
|
411
|
+
}
|
|
412
|
+
if (e.filters)
|
|
413
|
+
for (const [n, o] of Object.entries(e.filters))
|
|
414
|
+
o && t.set(n, o);
|
|
408
415
|
return t.toString();
|
|
409
416
|
}
|
|
410
|
-
function
|
|
411
|
-
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,
|
|
417
|
+
function ct(e) {
|
|
418
|
+
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, o = Math.min(r * e.perPage, e.total);
|
|
412
419
|
return {
|
|
413
420
|
page: r,
|
|
414
421
|
perPage: e.perPage,
|
|
415
422
|
total: e.total,
|
|
416
423
|
lastPage: t,
|
|
417
424
|
from: n,
|
|
418
|
-
to:
|
|
425
|
+
to: o,
|
|
419
426
|
hasPrev: r > 1,
|
|
420
427
|
hasNext: r < t
|
|
421
428
|
};
|
|
422
429
|
}
|
|
423
|
-
function
|
|
430
|
+
function lt(e, t, r = 2) {
|
|
424
431
|
if (t <= 1) return [1];
|
|
425
|
-
const n = [],
|
|
426
|
-
n.push(1),
|
|
427
|
-
for (let
|
|
428
|
-
n.push(
|
|
432
|
+
const n = [], o = Math.max(2, e - r), s = Math.min(t - 1, e + r);
|
|
433
|
+
n.push(1), o > 2 && n.push("...");
|
|
434
|
+
for (let i = o; i <= s; i++)
|
|
435
|
+
n.push(i);
|
|
429
436
|
return s < t - 1 && n.push("..."), t > 1 && n.push(t), n;
|
|
430
437
|
}
|
|
431
|
-
const
|
|
438
|
+
const he = [
|
|
439
|
+
"tracing",
|
|
440
|
+
"process",
|
|
441
|
+
"system",
|
|
442
|
+
"http",
|
|
443
|
+
"db",
|
|
444
|
+
"redis",
|
|
445
|
+
"queues",
|
|
446
|
+
"cache",
|
|
447
|
+
"app",
|
|
448
|
+
"log",
|
|
449
|
+
"emails",
|
|
450
|
+
"dashboard"
|
|
451
|
+
], de = [
|
|
452
|
+
{ flag: "process", group: "process" },
|
|
453
|
+
{ flag: "process", group: "memory" },
|
|
454
|
+
{ flag: "system", group: "memory" },
|
|
455
|
+
{ flag: "http", group: "http" },
|
|
456
|
+
{ flag: "db", group: "db" },
|
|
457
|
+
{ flag: "redis", group: "redis" },
|
|
458
|
+
{ flag: "queues", group: "queue" },
|
|
459
|
+
{ flag: "app", group: "app" },
|
|
460
|
+
{ flag: "log", group: "log" }
|
|
461
|
+
], fe = [
|
|
462
|
+
{ group: "process", fields: ["cpuPercent", "uptime", "nodeVersion"] },
|
|
463
|
+
{
|
|
464
|
+
group: "memory",
|
|
465
|
+
fields: ["memHeapUsed", "memRss", "systemMemoryTotalMb", "systemMemoryFreeMb"]
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
group: "http",
|
|
469
|
+
fields: ["requestsPerSecond", "avgResponseTimeMs", "errorRate", "activeHttpConnections"]
|
|
470
|
+
},
|
|
471
|
+
{ group: "db", fields: ["dbPoolMax", "dbPoolUsed", "dbPoolFree", "dbPoolPending"] },
|
|
472
|
+
{ group: "queue", fields: ["queueActive", "queueWaiting", "queueWorkerCount"] },
|
|
473
|
+
{ group: "app", fields: ["onlineUsers", "pendingWebhooks", "pendingEmails"] },
|
|
474
|
+
{ group: "log", fields: ["logErrorsLast5m", "logEntriesPerMinute"] }
|
|
475
|
+
];
|
|
476
|
+
function T(e) {
|
|
477
|
+
return typeof e == "number" && !Number.isNaN(e);
|
|
478
|
+
}
|
|
479
|
+
const I = "/admin/api/debug", pe = {
|
|
432
480
|
tracing: !1,
|
|
433
481
|
process: !1,
|
|
434
482
|
system: !1,
|
|
@@ -443,54 +491,45 @@ const O = "/admin/api/debug", ne = {
|
|
|
443
491
|
dashboard: !1,
|
|
444
492
|
customPanes: []
|
|
445
493
|
};
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
http: e.features?.http ?? !1,
|
|
452
|
-
db: e.features?.db ?? !1,
|
|
453
|
-
redis: e.features?.redis ?? !1,
|
|
454
|
-
queues: e.features?.queues ?? !1,
|
|
455
|
-
cache: e.features?.cache ?? !1,
|
|
456
|
-
app: e.features?.app ?? !1,
|
|
457
|
-
log: e.features?.log ?? !1,
|
|
458
|
-
emails: e.features?.emails ?? !1,
|
|
459
|
-
dashboard: e.features?.dashboard ?? !1,
|
|
460
|
-
customPanes: e.customPanes ?? []
|
|
461
|
-
};
|
|
494
|
+
function ge(e) {
|
|
495
|
+
const t = { customPanes: e.customPanes ?? [] }, r = e.features;
|
|
496
|
+
for (const n of he)
|
|
497
|
+
t[n] = r?.[n] ?? !1;
|
|
498
|
+
return t;
|
|
462
499
|
}
|
|
463
|
-
async function
|
|
500
|
+
async function me(e, t = I) {
|
|
464
501
|
const r = `${t.replace(/\/+$/, "")}/config`;
|
|
465
502
|
return e.fetch(r);
|
|
466
503
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { baseUrl: t = "", debugEndpoint: r =
|
|
504
|
+
async function ut(e) {
|
|
505
|
+
const { baseUrl: t = "", debugEndpoint: r = I, authToken: n } = e, o = new v({ baseUrl: t, authToken: n });
|
|
469
506
|
try {
|
|
470
|
-
const s = await
|
|
471
|
-
return
|
|
507
|
+
const s = await me(o, r);
|
|
508
|
+
return ge(s);
|
|
472
509
|
} catch {
|
|
473
|
-
return
|
|
510
|
+
return pe;
|
|
474
511
|
}
|
|
475
512
|
}
|
|
476
|
-
function
|
|
477
|
-
const t = /* @__PURE__ */ new Set(),
|
|
478
|
-
|
|
513
|
+
function ht(e) {
|
|
514
|
+
const t = /* @__PURE__ */ new Set(), n = "features" in e && typeof e.features == "object" && e.features !== null ? e.features : e;
|
|
515
|
+
for (const { flag: o, group: s } of de)
|
|
516
|
+
n[o] && t.add(s);
|
|
517
|
+
return t;
|
|
479
518
|
}
|
|
480
|
-
function
|
|
519
|
+
function dt(e) {
|
|
481
520
|
const t = /* @__PURE__ */ new Set();
|
|
482
|
-
|
|
521
|
+
(T(e.cpuPercent) || T(e.uptime) || ye(e)) && t.add("process");
|
|
522
|
+
for (const r of fe)
|
|
523
|
+
r.fields.some((n) => T(e[n])) && t.add(r.group);
|
|
524
|
+
return e.redisOk !== void 0 && e.redisOk !== null && t.add("redis"), t;
|
|
483
525
|
}
|
|
484
|
-
function
|
|
485
|
-
return typeof e == "
|
|
486
|
-
}
|
|
487
|
-
function oe(e) {
|
|
488
|
-
return typeof e == "string" && e.length > 0;
|
|
526
|
+
function ye(e) {
|
|
527
|
+
return typeof e.nodeVersion == "string" && e.nodeVersion.length > 0;
|
|
489
528
|
}
|
|
490
529
|
function g(e) {
|
|
491
|
-
return
|
|
530
|
+
return ce[e] || "";
|
|
492
531
|
}
|
|
493
|
-
const
|
|
532
|
+
const P = [
|
|
494
533
|
// ── Process group ─────────────────────────────────────────────────────────
|
|
495
534
|
// -- Node version ---------------------------------------------------------
|
|
496
535
|
{
|
|
@@ -511,7 +550,7 @@ const k = [
|
|
|
511
550
|
unit: "",
|
|
512
551
|
group: "process",
|
|
513
552
|
extract: (e) => e.uptime,
|
|
514
|
-
format: (e) =>
|
|
553
|
+
format: (e) => oe(e.uptime),
|
|
515
554
|
color: () => ""
|
|
516
555
|
},
|
|
517
556
|
// -- CPU ------------------------------------------------------------------
|
|
@@ -525,7 +564,7 @@ const k = [
|
|
|
525
564
|
critThreshold: 80,
|
|
526
565
|
extract: (e) => e.cpuPercent,
|
|
527
566
|
format: (e) => `${e.cpuPercent.toFixed(1)}%`,
|
|
528
|
-
color: (e) => g(
|
|
567
|
+
color: (e) => g(x(e.cpuPercent, 50, 80)),
|
|
529
568
|
historyKey: "cpuPercent"
|
|
530
569
|
},
|
|
531
570
|
// -- Event loop -----------------------------------------------------------
|
|
@@ -539,7 +578,7 @@ const k = [
|
|
|
539
578
|
critThreshold: 50,
|
|
540
579
|
extract: (e) => e.eventLoopLag,
|
|
541
580
|
format: (e) => `${e.eventLoopLag.toFixed(1)}ms`,
|
|
542
|
-
color: (e) => g(
|
|
581
|
+
color: (e) => g(x(e.eventLoopLag, 20, 50)),
|
|
543
582
|
historyKey: "eventLoopLag"
|
|
544
583
|
},
|
|
545
584
|
// ── Memory group ──────────────────────────────────────────────────────────
|
|
@@ -551,7 +590,7 @@ const k = [
|
|
|
551
590
|
unit: "bytes",
|
|
552
591
|
group: "memory",
|
|
553
592
|
extract: (e) => e.memHeapUsed,
|
|
554
|
-
format: (e) =>
|
|
593
|
+
format: (e) => M(e.memHeapUsed),
|
|
555
594
|
color: () => "",
|
|
556
595
|
historyKey: "memHeapUsed"
|
|
557
596
|
},
|
|
@@ -563,7 +602,7 @@ const k = [
|
|
|
563
602
|
unit: "bytes",
|
|
564
603
|
group: "memory",
|
|
565
604
|
extract: (e) => e.memRss,
|
|
566
|
-
format: (e) =>
|
|
605
|
+
format: (e) => M(e.memRss),
|
|
567
606
|
color: () => "",
|
|
568
607
|
historyKey: "memRss"
|
|
569
608
|
},
|
|
@@ -575,12 +614,12 @@ const k = [
|
|
|
575
614
|
unit: "MB",
|
|
576
615
|
group: "memory",
|
|
577
616
|
extract: (e) => e.systemMemoryTotalMb - e.systemMemoryFreeMb,
|
|
578
|
-
format: (e) => `${
|
|
617
|
+
format: (e) => `${A(e.systemMemoryTotalMb - e.systemMemoryFreeMb)}/${A(e.systemMemoryTotalMb)}`,
|
|
579
618
|
color: (e) => {
|
|
580
619
|
const t = e.systemMemoryTotalMb;
|
|
581
620
|
if (t === 0) return "";
|
|
582
621
|
const r = t - e.systemMemoryFreeMb;
|
|
583
|
-
return g(
|
|
622
|
+
return g(R(r, t));
|
|
584
623
|
},
|
|
585
624
|
historyKey: "_sysMemUsed",
|
|
586
625
|
show: (e) => e.systemMemoryTotalMb !== null && e.systemMemoryTotalMb !== void 0
|
|
@@ -609,7 +648,7 @@ const k = [
|
|
|
609
648
|
critThreshold: 500,
|
|
610
649
|
extract: (e) => e.avgResponseTimeMs,
|
|
611
650
|
format: (e) => `${e.avgResponseTimeMs.toFixed(0)}ms`,
|
|
612
|
-
color: (e) => g(
|
|
651
|
+
color: (e) => g(x(e.avgResponseTimeMs, 200, 500)),
|
|
613
652
|
historyKey: "avgResponseTimeMs"
|
|
614
653
|
},
|
|
615
654
|
// -- Error rate -----------------------------------------------------------
|
|
@@ -623,7 +662,7 @@ const k = [
|
|
|
623
662
|
critThreshold: 5,
|
|
624
663
|
extract: (e) => e.errorRate,
|
|
625
664
|
format: (e) => `${e.errorRate.toFixed(1)}%`,
|
|
626
|
-
color: (e) => g(
|
|
665
|
+
color: (e) => g(x(e.errorRate, 1, 5)),
|
|
627
666
|
historyKey: "errorRate"
|
|
628
667
|
},
|
|
629
668
|
// -- Active connections ---------------------------------------------------
|
|
@@ -648,7 +687,7 @@ const k = [
|
|
|
648
687
|
group: "db",
|
|
649
688
|
extract: (e) => e.dbPoolUsed,
|
|
650
689
|
format: (e) => `${e.dbPoolUsed}/${e.dbPoolFree}/${e.dbPoolMax}`,
|
|
651
|
-
color: (e) => g(
|
|
690
|
+
color: (e) => g(R(e.dbPoolUsed, e.dbPoolMax)),
|
|
652
691
|
historyKey: "dbPoolUsed"
|
|
653
692
|
},
|
|
654
693
|
// ── Redis group ───────────────────────────────────────────────────────────
|
|
@@ -684,7 +723,7 @@ const k = [
|
|
|
684
723
|
unit: "",
|
|
685
724
|
group: "redis",
|
|
686
725
|
extract: (e) => e.redisKeysCount,
|
|
687
|
-
format: (e) =>
|
|
726
|
+
format: (e) => ie(e.redisKeysCount),
|
|
688
727
|
color: () => "",
|
|
689
728
|
historyKey: "redisKeysCount",
|
|
690
729
|
show: (e) => e.redisOk
|
|
@@ -701,7 +740,7 @@ const k = [
|
|
|
701
740
|
inverseThreshold: !0,
|
|
702
741
|
extract: (e) => e.redisHitRate,
|
|
703
742
|
format: (e) => `${e.redisHitRate.toFixed(0)}%`,
|
|
704
|
-
color: (e) => g(
|
|
743
|
+
color: (e) => g(ae(e.redisHitRate, 90, 70)),
|
|
705
744
|
historyKey: "redisHitRate",
|
|
706
745
|
show: (e) => e.redisOk
|
|
707
746
|
},
|
|
@@ -792,18 +831,18 @@ const k = [
|
|
|
792
831
|
historyKey: "logEntriesPerMinute"
|
|
793
832
|
}
|
|
794
833
|
];
|
|
795
|
-
function
|
|
796
|
-
return
|
|
834
|
+
function ft(e) {
|
|
835
|
+
return P.find((t) => t.id === e);
|
|
797
836
|
}
|
|
798
|
-
function
|
|
837
|
+
function pt() {
|
|
799
838
|
const e = /* @__PURE__ */ new Map();
|
|
800
|
-
for (const t of
|
|
839
|
+
for (const t of P) {
|
|
801
840
|
const r = t.group || "core";
|
|
802
841
|
e.has(r) || e.set(r, []), e.get(r).push(t);
|
|
803
842
|
}
|
|
804
843
|
return e;
|
|
805
844
|
}
|
|
806
|
-
const
|
|
845
|
+
const be = {
|
|
807
846
|
queries: "/queries",
|
|
808
847
|
events: "/events",
|
|
809
848
|
emails: "/emails",
|
|
@@ -815,10 +854,10 @@ const ae = 60, le = 1e4, ce = {
|
|
|
815
854
|
config: "/config",
|
|
816
855
|
internals: "/diagnostics"
|
|
817
856
|
};
|
|
818
|
-
function
|
|
819
|
-
return
|
|
857
|
+
function xe(e) {
|
|
858
|
+
return be[e] || `/${e}`;
|
|
820
859
|
}
|
|
821
|
-
const
|
|
860
|
+
const Se = {
|
|
822
861
|
overview: "/overview",
|
|
823
862
|
requests: "/requests",
|
|
824
863
|
queries: "/queries",
|
|
@@ -831,45 +870,45 @@ const ue = {
|
|
|
831
870
|
jobs: "/jobs",
|
|
832
871
|
config: "/config"
|
|
833
872
|
};
|
|
834
|
-
function
|
|
835
|
-
return
|
|
873
|
+
function we(e) {
|
|
874
|
+
return Se[e] || `/${e}`;
|
|
836
875
|
}
|
|
837
|
-
function
|
|
876
|
+
function ve(e = ee) {
|
|
838
877
|
const t = {}, r = {};
|
|
839
878
|
let n = !1;
|
|
840
|
-
function
|
|
879
|
+
function o(s) {
|
|
841
880
|
if (s.count === 0) return [];
|
|
842
|
-
const
|
|
843
|
-
for (let
|
|
844
|
-
|
|
845
|
-
return
|
|
881
|
+
const i = Array.from({ length: s.count }), a = s.count < e ? 0 : s.head;
|
|
882
|
+
for (let c = 0; c < s.count; c++)
|
|
883
|
+
i[c] = s.data[(a + c) % e];
|
|
884
|
+
return i;
|
|
846
885
|
}
|
|
847
886
|
return {
|
|
848
887
|
push(s) {
|
|
849
888
|
n = !1;
|
|
850
|
-
for (const
|
|
851
|
-
const
|
|
852
|
-
if (!
|
|
853
|
-
const
|
|
854
|
-
if (typeof
|
|
855
|
-
t[
|
|
856
|
-
const
|
|
857
|
-
|
|
889
|
+
for (const i of P) {
|
|
890
|
+
const a = i.historyKey;
|
|
891
|
+
if (!a) continue;
|
|
892
|
+
const c = i.extract(s);
|
|
893
|
+
if (typeof c != "number") continue;
|
|
894
|
+
t[a] || (t[a] = { data: Array.from({ length: e }), head: 0, count: 0 });
|
|
895
|
+
const l = t[a];
|
|
896
|
+
l.data[l.head] = c, l.head = (l.head + 1) % e, l.count < e && l.count++;
|
|
858
897
|
}
|
|
859
898
|
},
|
|
860
899
|
get(s) {
|
|
861
|
-
const
|
|
862
|
-
return
|
|
900
|
+
const i = t[s];
|
|
901
|
+
return i ? o(i) : [];
|
|
863
902
|
},
|
|
864
903
|
getAll() {
|
|
865
904
|
if (n) return r;
|
|
866
905
|
for (const s of Object.keys(t))
|
|
867
|
-
r[s] =
|
|
906
|
+
r[s] = o(t[s]);
|
|
868
907
|
return n = !0, r;
|
|
869
908
|
}
|
|
870
909
|
};
|
|
871
910
|
}
|
|
872
|
-
class
|
|
911
|
+
class gt {
|
|
873
912
|
// -- Configuration --------------------------------------------------------
|
|
874
913
|
baseUrl;
|
|
875
914
|
endpoint;
|
|
@@ -898,7 +937,7 @@ class st {
|
|
|
898
937
|
isConnected = !1;
|
|
899
938
|
isStale = !1;
|
|
900
939
|
constructor(t = {}) {
|
|
901
|
-
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 =
|
|
940
|
+
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 = ve();
|
|
902
941
|
}
|
|
903
942
|
// -- Public API -----------------------------------------------------------
|
|
904
943
|
/**
|
|
@@ -909,42 +948,8 @@ class st {
|
|
|
909
948
|
start() {
|
|
910
949
|
if (this.unauthorized) return;
|
|
911
950
|
this.stopped = !1;
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
const r = N({
|
|
915
|
-
baseUrl: this.baseUrl,
|
|
916
|
-
channelName: this.channelName,
|
|
917
|
-
authToken: this.authToken,
|
|
918
|
-
onMessage: (n) => {
|
|
919
|
-
n && typeof n == "object" && "timestamp" in n && this.processStats(n);
|
|
920
|
-
},
|
|
921
|
-
onConnect: () => {
|
|
922
|
-
this.setSseActive(!0), this.setConnected(!0), this.stopPolling();
|
|
923
|
-
},
|
|
924
|
-
onDisconnect: () => {
|
|
925
|
-
this.setSseActive(!1), this.setConnected(!1), !this.pollTimer && !this.unauthorized && !this.stopped && this.startPollInterval();
|
|
926
|
-
},
|
|
927
|
-
onError: () => {
|
|
928
|
-
t = !0;
|
|
929
|
-
}
|
|
930
|
-
});
|
|
931
|
-
this.sseHandle = r;
|
|
932
|
-
} catch {
|
|
933
|
-
t = !0;
|
|
934
|
-
}
|
|
935
|
-
if (this.poll(), t || !this.sseHandle)
|
|
936
|
-
this.startPollInterval();
|
|
937
|
-
else {
|
|
938
|
-
const r = setTimeout(() => {
|
|
939
|
-
!this.isConnected && !this.pollTimer && !this.stopped && this.startPollInterval();
|
|
940
|
-
}, 3e3), n = this.sseHandle?.unsubscribe;
|
|
941
|
-
this.sseHandle && (this.sseHandle.unsubscribe = () => {
|
|
942
|
-
clearTimeout(r), n?.();
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
this.staleTimer = setInterval(() => {
|
|
946
|
-
this.lastSuccess > 0 && Date.now() - this.lastSuccess > le && this.setStale(!0);
|
|
947
|
-
}, 2e3);
|
|
951
|
+
const t = this.initSseSubscription();
|
|
952
|
+
this.poll(), t || !this.sseHandle ? this.startPollInterval() : this.setupSseFallbackTimer(), this.startStaleDetection();
|
|
948
953
|
}
|
|
949
954
|
/**
|
|
950
955
|
* Stop all timers and subscriptions. Call on unmount.
|
|
@@ -971,6 +976,47 @@ class st {
|
|
|
971
976
|
return this.unauthorized ? "disconnected" : this.sseActive ? "live" : this.pollTimer ? "polling" : "disconnected";
|
|
972
977
|
}
|
|
973
978
|
// -- Internal helpers -----------------------------------------------------
|
|
979
|
+
/** Initialize the SSE subscription. Returns true if SSE failed and polling should be used. */
|
|
980
|
+
initSseSubscription() {
|
|
981
|
+
let t = !1;
|
|
982
|
+
try {
|
|
983
|
+
this.sseHandle = K({
|
|
984
|
+
baseUrl: this.baseUrl,
|
|
985
|
+
channelName: this.channelName,
|
|
986
|
+
authToken: this.authToken,
|
|
987
|
+
onMessage: (r) => {
|
|
988
|
+
r && typeof r == "object" && "timestamp" in r && this.processStats(r);
|
|
989
|
+
},
|
|
990
|
+
onConnect: () => {
|
|
991
|
+
this.setSseActive(!0), this.setConnected(!0), this.stopPolling();
|
|
992
|
+
},
|
|
993
|
+
onDisconnect: () => {
|
|
994
|
+
this.setSseActive(!1), this.setConnected(!1), !this.pollTimer && !this.unauthorized && !this.stopped && this.startPollInterval();
|
|
995
|
+
},
|
|
996
|
+
onError: () => {
|
|
997
|
+
t = !0;
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
} catch {
|
|
1001
|
+
t = !0;
|
|
1002
|
+
}
|
|
1003
|
+
return t;
|
|
1004
|
+
}
|
|
1005
|
+
/** Set up a 3-second fallback timer to start polling if SSE hasn't connected. */
|
|
1006
|
+
setupSseFallbackTimer() {
|
|
1007
|
+
const t = setTimeout(() => {
|
|
1008
|
+
!this.isConnected && !this.pollTimer && !this.stopped && this.startPollInterval();
|
|
1009
|
+
}, 3e3), r = this.sseHandle?.unsubscribe;
|
|
1010
|
+
this.sseHandle && (this.sseHandle.unsubscribe = () => {
|
|
1011
|
+
clearTimeout(t), r?.();
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
/** Start the stale detection interval. */
|
|
1015
|
+
startStaleDetection() {
|
|
1016
|
+
this.staleTimer = setInterval(() => {
|
|
1017
|
+
this.lastSuccess > 0 && Date.now() - this.lastSuccess > te && this.setStale(!0);
|
|
1018
|
+
}, 2e3);
|
|
1019
|
+
}
|
|
974
1020
|
/** Process incoming stats data from either SSE or polling. */
|
|
975
1021
|
processStats(t) {
|
|
976
1022
|
this.onStatsUpdate?.(t), this.onError?.(null), this.lastSuccess = Date.now(), this.setStale(!1), this.historyBuffer.push(t), this.onHistoryChange?.(this.historyBuffer.getAll());
|
|
@@ -978,12 +1024,12 @@ class st {
|
|
|
978
1024
|
/** Poll the HTTP endpoint once. */
|
|
979
1025
|
async poll() {
|
|
980
1026
|
if (!this.unauthorized) {
|
|
981
|
-
this.client || (this.client = new
|
|
1027
|
+
this.client || (this.client = new v({ baseUrl: this.baseUrl, authToken: this.authToken }));
|
|
982
1028
|
try {
|
|
983
1029
|
const t = await this.client.get(this.endpoint);
|
|
984
1030
|
this.processStats(t);
|
|
985
1031
|
} catch (t) {
|
|
986
|
-
t instanceof
|
|
1032
|
+
t instanceof b && (this.unauthorized = !0, this.onUnauthorizedChange?.(!0), this.onError?.(t), this.stopPolling());
|
|
987
1033
|
}
|
|
988
1034
|
}
|
|
989
1035
|
}
|
|
@@ -1008,7 +1054,7 @@ class st {
|
|
|
1008
1054
|
this.isStale !== t && (this.isStale = t, this.onStaleChange?.(t));
|
|
1009
1055
|
}
|
|
1010
1056
|
}
|
|
1011
|
-
class
|
|
1057
|
+
class Ee {
|
|
1012
1058
|
constructor(t, r) {
|
|
1013
1059
|
this.client = t, this.basePath = r;
|
|
1014
1060
|
}
|
|
@@ -1020,7 +1066,7 @@ class pe {
|
|
|
1020
1066
|
* @param init - Optional `RequestInit` overrides (e.g. `{ signal }`).
|
|
1021
1067
|
*/
|
|
1022
1068
|
async fetchSection(t, r, n) {
|
|
1023
|
-
const
|
|
1069
|
+
const o = we(t), s = r ? `${this.basePath}${o}?${r}` : `${this.basePath}${o}`;
|
|
1024
1070
|
return this.client.fetch(s, n);
|
|
1025
1071
|
}
|
|
1026
1072
|
/**
|
|
@@ -1089,7 +1135,15 @@ class pe {
|
|
|
1089
1135
|
return this.client.fetch(`${this.basePath}/emails/${t}/preview`);
|
|
1090
1136
|
}
|
|
1091
1137
|
}
|
|
1092
|
-
|
|
1138
|
+
function Te(e) {
|
|
1139
|
+
if (!e || typeof e != "object") return !1;
|
|
1140
|
+
const t = e;
|
|
1141
|
+
return t.data !== void 0 && t.meta !== void 0;
|
|
1142
|
+
}
|
|
1143
|
+
function Ce(e, t) {
|
|
1144
|
+
return t.aborted ? !0 : e instanceof DOMException && e.name === "AbortError";
|
|
1145
|
+
}
|
|
1146
|
+
class mt {
|
|
1093
1147
|
// -- Dependencies ---------------------------------------------------------
|
|
1094
1148
|
client;
|
|
1095
1149
|
api;
|
|
@@ -1118,7 +1172,7 @@ class it {
|
|
|
1118
1172
|
/** AbortController for the current in-flight fetch. */
|
|
1119
1173
|
abortController = null;
|
|
1120
1174
|
constructor(t) {
|
|
1121
|
-
this.client = new
|
|
1175
|
+
this.client = new v({ baseUrl: t.baseUrl, authToken: t.authToken }), this.api = new Ee(this.client, t.endpoint), this.endpoint = t.endpoint, this.section = t.section, this.perPage = t.perPage, this.callbacks = t.callbacks;
|
|
1122
1176
|
}
|
|
1123
1177
|
// -- Public API -----------------------------------------------------------
|
|
1124
1178
|
/**
|
|
@@ -1141,40 +1195,15 @@ class it {
|
|
|
1141
1195
|
* and loading state is not modified.
|
|
1142
1196
|
*/
|
|
1143
1197
|
async fetch(t = !0) {
|
|
1144
|
-
if (
|
|
1145
|
-
this.
|
|
1146
|
-
const r = new AbortController();
|
|
1147
|
-
this.abortController = r;
|
|
1148
|
-
const n = ++this.fetchId, i = this.section;
|
|
1149
|
-
if (!i) return;
|
|
1150
|
-
const s = this.filters, o = this.sort ? this.sort.replace(/[A-Z]/g, (a) => "_" + a.toLowerCase()) : void 0, l = re({
|
|
1151
|
-
page: this.page,
|
|
1152
|
-
perPage: this.perPage,
|
|
1153
|
-
search: this.search,
|
|
1154
|
-
sort: o,
|
|
1155
|
-
sortDir: this.sort ? this.sortDir : void 0,
|
|
1156
|
-
filters: s && Object.keys(s).length > 0 ? s : void 0,
|
|
1157
|
-
timeRange: i.startsWith("overview") ? this.timeRange : void 0
|
|
1158
|
-
});
|
|
1159
|
-
t || (this.callbacks.onLoading(!0), this.explicitFetchPending = !0);
|
|
1198
|
+
if (this.shouldSkipFetch(t)) return;
|
|
1199
|
+
const { controller: r, myFetchId: n } = this.prepareFetch(t);
|
|
1160
1200
|
try {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
if (
|
|
1166
|
-
|
|
1167
|
-
this.callbacks.onData(h.data), this.callbacks.onPagination(h.meta);
|
|
1168
|
-
} else
|
|
1169
|
-
this.callbacks.onData(a), this.callbacks.onPagination(null);
|
|
1170
|
-
this.callbacks.onError(null), this.callbacks.onLoading(!1), this.hasFetched = !0;
|
|
1171
|
-
} catch (a) {
|
|
1172
|
-
if (a instanceof DOMException && a.name === "AbortError" || r.signal.aborted || n !== this.fetchId || this.stopped) return;
|
|
1173
|
-
if (a instanceof w) {
|
|
1174
|
-
this.callbacks.onError(a), this.callbacks.onLoading(!1), this.stopRefreshTimer(), this.callbacks.onUnauthorized();
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
t || (this.callbacks.onError(a instanceof Error ? a : new Error(String(a))), this.callbacks.onLoading(!1));
|
|
1201
|
+
const o = await this.executeFetch(r);
|
|
1202
|
+
if (this.isStaleResponse(n)) return;
|
|
1203
|
+
this.applyFetchResult(o);
|
|
1204
|
+
} catch (o) {
|
|
1205
|
+
if (this.shouldIgnoreError(o, r.signal, n)) return;
|
|
1206
|
+
this.handleFetchError(o, t);
|
|
1178
1207
|
} finally {
|
|
1179
1208
|
t || (this.explicitFetchPending = !1);
|
|
1180
1209
|
}
|
|
@@ -1223,9 +1252,9 @@ class it {
|
|
|
1223
1252
|
* then silently refresh the current data.
|
|
1224
1253
|
*/
|
|
1225
1254
|
async mutate(t, r = "post", n) {
|
|
1226
|
-
const
|
|
1255
|
+
const o = `${this.endpoint}/${t}`;
|
|
1227
1256
|
try {
|
|
1228
|
-
const s = r === "post" ? await this.client.post(
|
|
1257
|
+
const s = r === "post" ? await this.client.post(o, n) : await this.client.delete(o);
|
|
1229
1258
|
return await this.fetch(!0), s;
|
|
1230
1259
|
} catch (s) {
|
|
1231
1260
|
throw s instanceof Error ? s : new Error(String(s));
|
|
@@ -1266,17 +1295,70 @@ class it {
|
|
|
1266
1295
|
getClient() {
|
|
1267
1296
|
return this.client;
|
|
1268
1297
|
}
|
|
1298
|
+
// -- Fetch helpers (private) -----------------------------------------------
|
|
1299
|
+
/** Whether this fetch call should be skipped entirely. */
|
|
1300
|
+
shouldSkipFetch(t) {
|
|
1301
|
+
return t && this.explicitFetchPending ? !0 : !this.section;
|
|
1302
|
+
}
|
|
1303
|
+
/** Prepare abort controller, increment fetch ID, set loading state. */
|
|
1304
|
+
prepareFetch(t) {
|
|
1305
|
+
this.abortController?.abort();
|
|
1306
|
+
const r = new AbortController();
|
|
1307
|
+
this.abortController = r;
|
|
1308
|
+
const n = ++this.fetchId;
|
|
1309
|
+
return t || (this.callbacks.onLoading(!0), this.explicitFetchPending = !0), { controller: r, myFetchId: n };
|
|
1310
|
+
}
|
|
1311
|
+
/** Execute the actual API fetch for the current section. */
|
|
1312
|
+
async executeFetch(t) {
|
|
1313
|
+
const r = this.buildCurrentQueryString();
|
|
1314
|
+
return this.api.fetchSection(this.section, r || void 0, {
|
|
1315
|
+
signal: t.signal
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
/** Check if a response is stale (fetch ID mismatch or controller stopped). */
|
|
1319
|
+
isStaleResponse(t) {
|
|
1320
|
+
return t !== this.fetchId || this.stopped;
|
|
1321
|
+
}
|
|
1322
|
+
/** Check if an error should be silently ignored (abort or stale). */
|
|
1323
|
+
shouldIgnoreError(t, r, n) {
|
|
1324
|
+
return Ce(t, r) ? !0 : this.isStaleResponse(n);
|
|
1325
|
+
}
|
|
1326
|
+
/** Build query string from current controller state. */
|
|
1327
|
+
buildCurrentQueryString() {
|
|
1328
|
+
const t = this.sort ? this.sort.replace(/[A-Z]/g, (n) => "_" + n.toLowerCase()) : void 0, r = this.filters;
|
|
1329
|
+
return ue({
|
|
1330
|
+
page: this.page,
|
|
1331
|
+
perPage: this.perPage,
|
|
1332
|
+
search: this.search,
|
|
1333
|
+
sort: t,
|
|
1334
|
+
sortDir: this.sort ? this.sortDir : void 0,
|
|
1335
|
+
filters: r && Object.keys(r).length > 0 ? r : void 0,
|
|
1336
|
+
timeRange: this.section.startsWith("overview") ? this.timeRange : void 0
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
/** Apply a successful fetch result to the callbacks. */
|
|
1340
|
+
applyFetchResult(t) {
|
|
1341
|
+
Te(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;
|
|
1342
|
+
}
|
|
1343
|
+
/** Handle a fetch error (unauthorized, network, etc.). */
|
|
1344
|
+
handleFetchError(t, r) {
|
|
1345
|
+
if (t instanceof b) {
|
|
1346
|
+
this.callbacks.onError(t), this.callbacks.onLoading(!1), this.stopRefreshTimer(), this.callbacks.onUnauthorized();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
r || (this.callbacks.onError(t instanceof Error ? t : new Error(String(t))), this.callbacks.onLoading(!1));
|
|
1350
|
+
}
|
|
1269
1351
|
// -- Timer management (private) -------------------------------------------
|
|
1270
1352
|
startRefreshTimer() {
|
|
1271
1353
|
this.stopRefreshTimer();
|
|
1272
|
-
const t = this.section === "overview" ?
|
|
1354
|
+
const t = this.section === "overview" ? Q : J;
|
|
1273
1355
|
this.timer = setInterval(() => this.fetch(!0), t);
|
|
1274
1356
|
}
|
|
1275
1357
|
stopRefreshTimer() {
|
|
1276
1358
|
this.timer && (clearInterval(this.timer), this.timer = null);
|
|
1277
1359
|
}
|
|
1278
1360
|
}
|
|
1279
|
-
const
|
|
1361
|
+
const yt = {
|
|
1280
1362
|
// ---------------------------------------------------------------------------
|
|
1281
1363
|
// Debug-panel tabs / Dashboard sidebar sections (shared)
|
|
1282
1364
|
// ---------------------------------------------------------------------------
|
|
@@ -1468,14 +1550,14 @@ const ot = {
|
|
|
1468
1550
|
viewBox: "0 0 16 16",
|
|
1469
1551
|
elements: ['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']
|
|
1470
1552
|
}
|
|
1471
|
-
},
|
|
1472
|
-
function
|
|
1553
|
+
}, ke = "ss-col-resize", F = "ss-resizing";
|
|
1554
|
+
function bt(e) {
|
|
1473
1555
|
const t = Array.from(e.querySelectorAll("thead th"));
|
|
1474
1556
|
if (t.length === 0) return () => {
|
|
1475
1557
|
};
|
|
1476
1558
|
const r = [];
|
|
1477
1559
|
let n = !1;
|
|
1478
|
-
function
|
|
1560
|
+
function o() {
|
|
1479
1561
|
if (!n) {
|
|
1480
1562
|
n = !0;
|
|
1481
1563
|
for (const s of t)
|
|
@@ -1484,30 +1566,30 @@ function at(e) {
|
|
|
1484
1566
|
}
|
|
1485
1567
|
}
|
|
1486
1568
|
for (const s of t) {
|
|
1487
|
-
let
|
|
1488
|
-
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
function
|
|
1492
|
-
const
|
|
1569
|
+
let i = function(c) {
|
|
1570
|
+
c.preventDefault(), c.stopPropagation(), o();
|
|
1571
|
+
const l = c.clientX, p = s.offsetWidth;
|
|
1572
|
+
a.classList.add(F), a.setPointerCapture(c.pointerId);
|
|
1573
|
+
function h(f) {
|
|
1574
|
+
const y = f.clientX - l, u = Math.max(30, p + y);
|
|
1493
1575
|
s.style.width = u + "px";
|
|
1494
1576
|
}
|
|
1495
|
-
function
|
|
1496
|
-
|
|
1577
|
+
function d() {
|
|
1578
|
+
a.classList.remove(F), a.removeEventListener("pointermove", h), a.removeEventListener("pointerup", d);
|
|
1497
1579
|
}
|
|
1498
|
-
|
|
1580
|
+
a.addEventListener("pointermove", h), a.addEventListener("pointerup", d);
|
|
1499
1581
|
};
|
|
1500
1582
|
if (!s.textContent?.trim()) continue;
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
|
|
1583
|
+
const a = document.createElement("div");
|
|
1584
|
+
a.className = ke, s.appendChild(a), a.addEventListener("pointerdown", i), r.push(() => {
|
|
1585
|
+
a.removeEventListener("pointerdown", i), a.remove();
|
|
1504
1586
|
});
|
|
1505
1587
|
}
|
|
1506
1588
|
return () => {
|
|
1507
1589
|
for (const s of r) s();
|
|
1508
1590
|
};
|
|
1509
1591
|
}
|
|
1510
|
-
class
|
|
1592
|
+
class xt {
|
|
1511
1593
|
client;
|
|
1512
1594
|
endpoint;
|
|
1513
1595
|
refreshInterval;
|
|
@@ -1517,10 +1599,10 @@ class lt {
|
|
|
1517
1599
|
fetchOnceCache = {};
|
|
1518
1600
|
abortController = null;
|
|
1519
1601
|
constructor(t) {
|
|
1520
|
-
this.client = new
|
|
1602
|
+
this.client = new v({
|
|
1521
1603
|
baseUrl: t.baseUrl,
|
|
1522
1604
|
authToken: t.authToken
|
|
1523
|
-
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ??
|
|
1605
|
+
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ?? Y, this.callbacks = {
|
|
1524
1606
|
onData: t.onData,
|
|
1525
1607
|
onLoading: t.onLoading,
|
|
1526
1608
|
onError: t.onError,
|
|
@@ -1574,7 +1656,7 @@ class lt {
|
|
|
1574
1656
|
const n = await this.client.fetch(t);
|
|
1575
1657
|
this.callbacks.onData(n), this.callbacks.onError(null), r && (this.fetchOnceCache[t] = n);
|
|
1576
1658
|
} catch (n) {
|
|
1577
|
-
if (n instanceof
|
|
1659
|
+
if (n instanceof b) {
|
|
1578
1660
|
this.callbacks.onUnauthorized(n);
|
|
1579
1661
|
return;
|
|
1580
1662
|
}
|
|
@@ -1602,43 +1684,48 @@ class lt {
|
|
|
1602
1684
|
// -------------------------------------------------------------------------
|
|
1603
1685
|
async fetchData() {
|
|
1604
1686
|
const t = this.currentTab;
|
|
1605
|
-
if (!t) return;
|
|
1606
|
-
if (this.fetchOnceCache[t] !== void 0) {
|
|
1607
|
-
this.callbacks.onData(this.fetchOnceCache[t]), this.callbacks.onLoading(!1);
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1687
|
+
if (!t || this.serveFromCache(t)) return;
|
|
1610
1688
|
this.abortController?.abort();
|
|
1611
1689
|
const r = new AbortController();
|
|
1612
1690
|
this.abortController = r;
|
|
1613
1691
|
try {
|
|
1614
|
-
const n = `${this.endpoint}${
|
|
1692
|
+
const n = `${this.endpoint}${xe(t)}`, o = await this.client.fetch(n, { signal: r.signal });
|
|
1615
1693
|
if (r.signal.aborted) return;
|
|
1616
|
-
this.callbacks.onData(
|
|
1694
|
+
this.callbacks.onData(o), this.callbacks.onError(null), this.callbacks.onLoading(!1);
|
|
1617
1695
|
} catch (n) {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1696
|
+
this.handleFetchError(n, r);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
/** Serve cached data if available. Returns true if cache hit. */
|
|
1700
|
+
serveFromCache(t) {
|
|
1701
|
+
return this.fetchOnceCache[t] === void 0 ? !1 : (this.callbacks.onData(this.fetchOnceCache[t]), this.callbacks.onLoading(!1), !0);
|
|
1702
|
+
}
|
|
1703
|
+
/** Handle errors from fetchData. */
|
|
1704
|
+
handleFetchError(t, r) {
|
|
1705
|
+
if (!(t instanceof DOMException && t.name === "AbortError") && !r.signal.aborted) {
|
|
1706
|
+
if (t instanceof b) {
|
|
1707
|
+
this.callbacks.onError(t), this.callbacks.onLoading(!1), this.stop(), this.callbacks.onUnauthorized(t);
|
|
1621
1708
|
return;
|
|
1622
1709
|
}
|
|
1623
|
-
this.callbacks.onError(
|
|
1710
|
+
this.callbacks.onError(t instanceof Error ? t : new Error(String(t))), this.callbacks.onLoading(!1);
|
|
1624
1711
|
}
|
|
1625
1712
|
}
|
|
1626
1713
|
}
|
|
1627
|
-
const
|
|
1628
|
-
function
|
|
1714
|
+
const St = ["all", "error", "warn", "info", "debug"];
|
|
1715
|
+
function Me(e) {
|
|
1629
1716
|
return (e.levelName || e.level_name || (typeof e.level == "string" ? e.level : "") || "info").toLowerCase();
|
|
1630
1717
|
}
|
|
1631
|
-
function
|
|
1718
|
+
function wt(e) {
|
|
1632
1719
|
return e.msg || e.message || JSON.stringify(e);
|
|
1633
1720
|
}
|
|
1634
|
-
function
|
|
1721
|
+
function vt(e) {
|
|
1635
1722
|
return e.createdAt || e.created_at || e.time || e.timestamp || 0;
|
|
1636
1723
|
}
|
|
1637
|
-
function
|
|
1724
|
+
function Et(e) {
|
|
1638
1725
|
const t = e.data || {};
|
|
1639
1726
|
return e.requestId || e.request_id || e["x-request-id"] || t.requestId || t.request_id || t["x-request-id"] || "";
|
|
1640
1727
|
}
|
|
1641
|
-
function
|
|
1728
|
+
function Tt(e, t = "ss-dbg-log-level") {
|
|
1642
1729
|
switch (e) {
|
|
1643
1730
|
case "error":
|
|
1644
1731
|
case "fatal":
|
|
@@ -1655,30 +1742,30 @@ function ft(e, t = "ss-dbg-log-level") {
|
|
|
1655
1742
|
return `${t}-info`;
|
|
1656
1743
|
}
|
|
1657
1744
|
}
|
|
1658
|
-
function
|
|
1745
|
+
function Ct(e, t) {
|
|
1659
1746
|
return t === "all" ? e : e.filter((r) => {
|
|
1660
|
-
const n =
|
|
1747
|
+
const n = Me(r);
|
|
1661
1748
|
return t === "error" ? n === "error" || n === "fatal" : n === t;
|
|
1662
1749
|
});
|
|
1663
1750
|
}
|
|
1664
|
-
function
|
|
1751
|
+
function kt(e, t) {
|
|
1665
1752
|
if (!t) return e;
|
|
1666
1753
|
const r = t.toLowerCase();
|
|
1667
1754
|
return e.filter(
|
|
1668
1755
|
(n) => n.sql.toLowerCase().includes(r) || n.model && n.model.toLowerCase().includes(r) || n.method.toLowerCase().includes(r)
|
|
1669
1756
|
);
|
|
1670
1757
|
}
|
|
1671
|
-
function
|
|
1758
|
+
function Mt(e) {
|
|
1672
1759
|
const t = {};
|
|
1673
1760
|
for (const r of e)
|
|
1674
1761
|
t[r.sql] = (t[r.sql] || 0) + 1;
|
|
1675
1762
|
return t;
|
|
1676
1763
|
}
|
|
1677
|
-
function
|
|
1678
|
-
const r = e.filter((s) => s.duration > 100).length, n = Object.values(t).filter((s) => s > 1).length,
|
|
1679
|
-
return { slowCount: r, dupCount: n, avgDuration:
|
|
1764
|
+
function Pt(e, t) {
|
|
1765
|
+
const r = e.filter((s) => s.duration > 100).length, n = Object.values(t).filter((s) => s > 1).length, o = e.length > 0 ? e.reduce((s, i) => s + i.duration, 0) / e.length : 0;
|
|
1766
|
+
return { slowCount: r, dupCount: n, avgDuration: o, totalCount: e.length };
|
|
1680
1767
|
}
|
|
1681
|
-
const
|
|
1768
|
+
const $t = [
|
|
1682
1769
|
"all",
|
|
1683
1770
|
"active",
|
|
1684
1771
|
"waiting",
|
|
@@ -1686,7 +1773,7 @@ const bt = [
|
|
|
1686
1773
|
"completed",
|
|
1687
1774
|
"failed"
|
|
1688
1775
|
];
|
|
1689
|
-
function
|
|
1776
|
+
function At(e, t = "ss-dbg-job-status") {
|
|
1690
1777
|
switch (e) {
|
|
1691
1778
|
case "completed":
|
|
1692
1779
|
case "failed":
|
|
@@ -1698,7 +1785,7 @@ function xt(e, t = "ss-dbg-job-status") {
|
|
|
1698
1785
|
return "ss-dbg-badge-muted";
|
|
1699
1786
|
}
|
|
1700
1787
|
}
|
|
1701
|
-
function
|
|
1788
|
+
function Rt(e) {
|
|
1702
1789
|
switch (e) {
|
|
1703
1790
|
case "active":
|
|
1704
1791
|
return "blue";
|
|
@@ -1714,18 +1801,18 @@ function wt(e) {
|
|
|
1714
1801
|
return "muted";
|
|
1715
1802
|
}
|
|
1716
1803
|
}
|
|
1717
|
-
function
|
|
1804
|
+
function Lt(e) {
|
|
1718
1805
|
if (!e) return [];
|
|
1719
1806
|
if (Array.isArray(e)) return e;
|
|
1720
1807
|
const t = e;
|
|
1721
1808
|
return t.jobs || t.data || [];
|
|
1722
1809
|
}
|
|
1723
|
-
function
|
|
1810
|
+
function Ft(e) {
|
|
1724
1811
|
if (!e || Array.isArray(e)) return null;
|
|
1725
1812
|
const t = e;
|
|
1726
1813
|
return t.stats || t.overview || null;
|
|
1727
1814
|
}
|
|
1728
|
-
function
|
|
1815
|
+
function Pe(e) {
|
|
1729
1816
|
if (!e) return [];
|
|
1730
1817
|
if (typeof e == "string")
|
|
1731
1818
|
try {
|
|
@@ -1735,7 +1822,7 @@ function ye(e) {
|
|
|
1735
1822
|
}
|
|
1736
1823
|
return Array.isArray(e) ? e : [];
|
|
1737
1824
|
}
|
|
1738
|
-
function
|
|
1825
|
+
function $e(e) {
|
|
1739
1826
|
if (!e) return [];
|
|
1740
1827
|
if (typeof e == "string")
|
|
1741
1828
|
try {
|
|
@@ -1748,23 +1835,25 @@ function be(e) {
|
|
|
1748
1835
|
function C(e, t, r, n = 0) {
|
|
1749
1836
|
return e[t] ?? e[r] ?? n;
|
|
1750
1837
|
}
|
|
1751
|
-
function
|
|
1838
|
+
function Ut(e) {
|
|
1752
1839
|
return {
|
|
1753
1840
|
method: e.method || "",
|
|
1754
1841
|
url: e.url || "",
|
|
1755
1842
|
statusCode: C(e, "status_code", "statusCode"),
|
|
1756
1843
|
totalDuration: C(e, "total_duration", "totalDuration") || e.duration || 0,
|
|
1757
1844
|
spanCount: C(e, "span_count", "spanCount"),
|
|
1758
|
-
spans:
|
|
1759
|
-
warnings:
|
|
1845
|
+
spans: Pe(e.spans),
|
|
1846
|
+
warnings: $e(e.warnings),
|
|
1847
|
+
logs: e.logs || [],
|
|
1848
|
+
httpRequestId: e.httpRequestId || e.http_request_id || void 0
|
|
1760
1849
|
};
|
|
1761
1850
|
}
|
|
1762
|
-
const
|
|
1763
|
-
function
|
|
1851
|
+
const Ae = ["password", "secret", "token", "key", "credential", "auth"];
|
|
1852
|
+
function Re(e) {
|
|
1764
1853
|
const t = e.toLowerCase();
|
|
1765
|
-
return
|
|
1854
|
+
return Ae.some((r) => t.includes(r));
|
|
1766
1855
|
}
|
|
1767
|
-
function
|
|
1856
|
+
function Le(e) {
|
|
1768
1857
|
if (e == null) return "-";
|
|
1769
1858
|
if (typeof e == "string" || typeof e == "number" || typeof e == "boolean")
|
|
1770
1859
|
return String(e);
|
|
@@ -1775,89 +1864,87 @@ function Se(e) {
|
|
|
1775
1864
|
return String(e);
|
|
1776
1865
|
}
|
|
1777
1866
|
}
|
|
1778
|
-
const
|
|
1867
|
+
const Fe = {
|
|
1779
1868
|
collectionInterval: "Stats Collection",
|
|
1780
1869
|
dashboardBroadcast: "Dashboard Broadcast",
|
|
1781
1870
|
debugBroadcast: "Debug Broadcast",
|
|
1782
1871
|
persistFlush: "Persist Flush",
|
|
1783
1872
|
retentionCleanup: "Retention Cleanup"
|
|
1784
1873
|
};
|
|
1785
|
-
function
|
|
1786
|
-
return
|
|
1874
|
+
function Dt(e) {
|
|
1875
|
+
return Fe[e] || e;
|
|
1787
1876
|
}
|
|
1788
|
-
const
|
|
1877
|
+
const Ue = {
|
|
1789
1878
|
prometheus: "Prometheus",
|
|
1790
1879
|
pinoHook: "Pino Log Hook",
|
|
1791
1880
|
edgePlugin: "Edge Plugin",
|
|
1792
1881
|
cacheInspector: "Cache Inspector",
|
|
1793
1882
|
queueInspector: "Queue Inspector"
|
|
1794
1883
|
};
|
|
1795
|
-
function
|
|
1796
|
-
return
|
|
1884
|
+
function Ot(e) {
|
|
1885
|
+
return Ue[e] || e;
|
|
1797
1886
|
}
|
|
1798
|
-
function
|
|
1887
|
+
function It(e) {
|
|
1799
1888
|
return "active" in e ? e.active ? "active" : "inactive" : "available" in e ? e.available ? "available" : "unavailable" : "unknown";
|
|
1800
1889
|
}
|
|
1801
|
-
function
|
|
1890
|
+
function _t(e, t) {
|
|
1802
1891
|
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" : "-";
|
|
1803
1892
|
}
|
|
1804
|
-
function
|
|
1893
|
+
function Bt(e) {
|
|
1805
1894
|
return Object.entries(e).map(([t, r]) => ({
|
|
1806
1895
|
key: t,
|
|
1807
|
-
value:
|
|
1808
|
-
secret:
|
|
1896
|
+
value: Le(r),
|
|
1897
|
+
secret: Re(t)
|
|
1809
1898
|
}));
|
|
1810
1899
|
}
|
|
1811
|
-
function
|
|
1900
|
+
function Ht(e, t) {
|
|
1812
1901
|
return t ? Math.min(100, Math.round(e / t * 100)) : 0;
|
|
1813
1902
|
}
|
|
1814
|
-
const
|
|
1815
|
-
function
|
|
1816
|
-
return
|
|
1903
|
+
const De = ["healthy", "active", "connected", "available", "ready"], Oe = ["errored", "unavailable"];
|
|
1904
|
+
function Nt(e) {
|
|
1905
|
+
return De.includes(e) ? "ok" : Oe.includes(e) ? "err" : "";
|
|
1817
1906
|
}
|
|
1818
|
-
function
|
|
1907
|
+
function $(e) {
|
|
1819
1908
|
return e !== null && typeof e == "object" && !Array.isArray(e) && e.__redacted === !0;
|
|
1820
1909
|
}
|
|
1821
|
-
function
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1910
|
+
function w(e) {
|
|
1911
|
+
return e != null && typeof e == "object" && !Array.isArray(e) && !$(e);
|
|
1912
|
+
}
|
|
1913
|
+
function Ie(e, t = "") {
|
|
1914
|
+
if (!w(e))
|
|
1825
1915
|
return [{ path: t, value: e }];
|
|
1826
1916
|
const r = [];
|
|
1827
1917
|
for (const n of Object.keys(e)) {
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1918
|
+
const o = t ? `${t}.${n}` : n, s = e[n];
|
|
1919
|
+
w(s) ? r.push(...Ie(s, o)) : r.push({ path: o, value: s });
|
|
1830
1920
|
}
|
|
1831
1921
|
return r;
|
|
1832
1922
|
}
|
|
1833
|
-
function
|
|
1923
|
+
function qt(e) {
|
|
1834
1924
|
return e == null ? { text: "null", color: "var(--ss-dim)" } : typeof e == "boolean" ? {
|
|
1835
1925
|
text: String(e),
|
|
1836
1926
|
color: e ? "var(--ss-green-fg)" : "var(--ss-red-fg)"
|
|
1837
1927
|
} : 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) };
|
|
1838
1928
|
}
|
|
1839
|
-
function
|
|
1840
|
-
if (e == null || typeof e != "object" || Array.isArray(e) ||
|
|
1929
|
+
function _e(e) {
|
|
1930
|
+
if (e == null || typeof e != "object" || Array.isArray(e) || $(e))
|
|
1841
1931
|
return 1;
|
|
1842
1932
|
let t = 0;
|
|
1843
1933
|
for (const r of Object.keys(e))
|
|
1844
|
-
t +=
|
|
1934
|
+
t += _e(e[r]);
|
|
1845
1935
|
return t;
|
|
1846
1936
|
}
|
|
1847
|
-
function
|
|
1848
|
-
if (
|
|
1849
|
-
return [];
|
|
1937
|
+
function Kt(e) {
|
|
1938
|
+
if (!w(e)) return [];
|
|
1850
1939
|
const t = [];
|
|
1851
|
-
for (const r of Object.keys(e))
|
|
1852
|
-
|
|
1853
|
-
n !== null && typeof n == "object" && !Array.isArray(n) && !b(n) && t.push(r);
|
|
1854
|
-
}
|
|
1940
|
+
for (const r of Object.keys(e))
|
|
1941
|
+
w(e[r]) && t.push(r);
|
|
1855
1942
|
return t;
|
|
1856
1943
|
}
|
|
1857
|
-
function
|
|
1858
|
-
return !r || e.toLowerCase().includes(r) ? !0 : (
|
|
1944
|
+
function zt(e, t, r) {
|
|
1945
|
+
return !r || e.toLowerCase().includes(r) ? !0 : ($(t) ? t.display : t == null ? "" : String(t)).toLowerCase().includes(r);
|
|
1859
1946
|
}
|
|
1860
|
-
function
|
|
1947
|
+
function jt(e, t, r) {
|
|
1861
1948
|
t && navigator.clipboard.writeText(e).then(() => {
|
|
1862
1949
|
const n = t.textContent;
|
|
1863
1950
|
t.textContent = "✓", t.classList.add(`${r}-copy-row-ok`), setTimeout(() => {
|
|
@@ -1866,7 +1953,7 @@ function Dt(e, t, r) {
|
|
|
1866
1953
|
}).catch(() => {
|
|
1867
1954
|
});
|
|
1868
1955
|
}
|
|
1869
|
-
const
|
|
1956
|
+
const Be = /* @__PURE__ */ new Set([
|
|
1870
1957
|
"secret",
|
|
1871
1958
|
"key",
|
|
1872
1959
|
"token",
|
|
@@ -1880,128 +1967,128 @@ const ke = /* @__PURE__ */ new Set([
|
|
|
1880
1967
|
"private",
|
|
1881
1968
|
"encryption"
|
|
1882
1969
|
]);
|
|
1883
|
-
function
|
|
1970
|
+
function He(e) {
|
|
1884
1971
|
const t = e.split(/[._-]/), r = [];
|
|
1885
1972
|
for (const n of t) {
|
|
1886
|
-
const
|
|
1887
|
-
for (const s of
|
|
1973
|
+
const o = n.split(new RegExp("(?<=[a-z])(?=[A-Z])"));
|
|
1974
|
+
for (const s of o)
|
|
1888
1975
|
s && r.push(s);
|
|
1889
1976
|
}
|
|
1890
1977
|
return r;
|
|
1891
1978
|
}
|
|
1892
|
-
function
|
|
1893
|
-
return
|
|
1979
|
+
function Vt(e) {
|
|
1980
|
+
return He(e).some((r) => Be.has(r.toLowerCase()));
|
|
1894
1981
|
}
|
|
1895
|
-
const
|
|
1982
|
+
const Wt = new RegExp("secret|password|pass(?:word)?|pwd|token|(?:^|[._-])key(?:[._-]|$)|(?<=[a-z])Key|apikey|api_key|auth|credential|private|encryption", "i");
|
|
1896
1983
|
export {
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1984
|
+
v as ApiClient,
|
|
1985
|
+
B as ApiError,
|
|
1986
|
+
Se as DASHBOARD_SECTION_PATHS,
|
|
1987
|
+
Y as DEBUG_REFRESH_MS,
|
|
1988
|
+
be as DEBUG_TAB_PATHS,
|
|
1989
|
+
pe as DEFAULT_FEATURES,
|
|
1990
|
+
O as DEFAULT_PER_PAGE,
|
|
1991
|
+
Ee as DashboardApi,
|
|
1992
|
+
mt as DashboardDataController,
|
|
1993
|
+
xt as DebugDataController,
|
|
1994
|
+
Oe as ERROR_STATUSES,
|
|
1995
|
+
Ue as INTEGRATION_LABELS,
|
|
1996
|
+
$t as JOB_STATUS_FILTERS,
|
|
1997
|
+
St as LOG_LEVELS,
|
|
1998
|
+
ee as MAX_HISTORY,
|
|
1999
|
+
P as METRIC_DEFINITIONS,
|
|
2000
|
+
De as OK_STATUSES,
|
|
2001
|
+
Q as OVERVIEW_REFRESH_MS,
|
|
2002
|
+
Wt as REDACT_PATTERN,
|
|
2003
|
+
J as SECTION_REFRESH_MS,
|
|
2004
|
+
X as SLOW_DURATION_MS,
|
|
2005
|
+
te as STALE_MS,
|
|
2006
|
+
gt as ServerStatsController,
|
|
2007
|
+
yt as TAB_ICONS,
|
|
2008
|
+
ce as THRESHOLD_CSS_CLASS,
|
|
2009
|
+
Ye as THRESHOLD_CSS_VAR,
|
|
2010
|
+
Je as THRESHOLD_HEX_FALLBACK,
|
|
2011
|
+
Fe as TIMER_LABELS,
|
|
2012
|
+
b as UnauthorizedError,
|
|
2013
|
+
Z as VERY_SLOW_DURATION_MS,
|
|
2014
|
+
ue as buildQueryParams,
|
|
2015
|
+
nt as buildQueryString,
|
|
2016
|
+
je as buildSparklineData,
|
|
2017
|
+
Nt as classifyStatus,
|
|
2018
|
+
Kt as collectTopLevelObjectKeys,
|
|
1932
2019
|
L as compactPreview,
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2020
|
+
ct as computePagination,
|
|
2021
|
+
Pt as computeQuerySummary,
|
|
2022
|
+
G as computeStats,
|
|
2023
|
+
jt as copyWithFeedback,
|
|
2024
|
+
Mt as countDuplicateQueries,
|
|
2025
|
+
_e as countLeaves,
|
|
2026
|
+
it as createFilterState,
|
|
2027
|
+
ve as createHistoryBuffer,
|
|
2028
|
+
ot as createPaginationState,
|
|
2029
|
+
at as createSortState,
|
|
2030
|
+
q as createTransmitSubscription,
|
|
2031
|
+
ut as detectFeatures,
|
|
2032
|
+
dt as detectMetricGroupsFromStats,
|
|
2033
|
+
Ze as durationSeverity,
|
|
2034
|
+
Ft as extractJobStats,
|
|
2035
|
+
Lt as extractJobs,
|
|
2036
|
+
me as fetchFeatures,
|
|
2037
|
+
Ht as fillPercent,
|
|
2038
|
+
Ct as filterLogsByLevel,
|
|
2039
|
+
kt as filterQueries,
|
|
2040
|
+
Ie as flattenConfig,
|
|
2041
|
+
M as formatBytes,
|
|
2042
|
+
rt as formatCacheSize,
|
|
2043
|
+
Bt as formatCollectorConfig,
|
|
2044
|
+
Le as formatConfigVal,
|
|
2045
|
+
ie as formatCount,
|
|
2046
|
+
Ve as formatDuration,
|
|
2047
|
+
qt as formatFlatValue,
|
|
2048
|
+
A as formatMb,
|
|
2049
|
+
Qe as formatStatNum,
|
|
2050
|
+
We as formatTime,
|
|
2051
|
+
tt as formatTtl,
|
|
2052
|
+
oe as formatUptime,
|
|
1966
2053
|
W as generateGradientId,
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2054
|
+
ze as generateSparklinePath,
|
|
2055
|
+
Ke as generateSparklinePoints,
|
|
2056
|
+
we as getDashboardSectionPath,
|
|
2057
|
+
xe as getDebugTabPath,
|
|
2058
|
+
_t as getIntegrationDetails,
|
|
2059
|
+
Ot as getIntegrationLabel,
|
|
2060
|
+
It as getIntegrationStatus,
|
|
2061
|
+
Rt as getJobStatusBadgeColor,
|
|
2062
|
+
At as getJobStatusCssClass,
|
|
2063
|
+
Tt as getLogLevelCssClass,
|
|
2064
|
+
ft as getMetricById,
|
|
2065
|
+
pt as getMetricsByGroup,
|
|
2066
|
+
lt as getPageNumbers,
|
|
2067
|
+
R as getRatioColor,
|
|
1981
2068
|
U as getTheme,
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2069
|
+
x as getThresholdColor,
|
|
2070
|
+
ae as getThresholdColorInverse,
|
|
2071
|
+
Dt as getTimerLabel,
|
|
2072
|
+
ht as getVisibleMetricGroups,
|
|
2073
|
+
bt as initResizableColumns,
|
|
2074
|
+
$ as isRedactedValue,
|
|
2075
|
+
Re as isSecretKey,
|
|
2076
|
+
zt as matchesConfigSearch,
|
|
2077
|
+
Ut as normalizeTraceFields,
|
|
2078
|
+
qe as onThemeChange,
|
|
2079
|
+
st as parsePaginatedResponse,
|
|
2080
|
+
Pe as parseTraceSpans,
|
|
2081
|
+
$e as parseTraceWarnings,
|
|
2082
|
+
Me as resolveLogLevel,
|
|
2083
|
+
wt as resolveLogMessage,
|
|
2084
|
+
Et as resolveLogRequestId,
|
|
2085
|
+
vt as resolveLogTimestamp,
|
|
1999
2086
|
C as resolveTraceField,
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2087
|
+
z as setTheme,
|
|
2088
|
+
et as shortReqId,
|
|
2089
|
+
Vt as shouldRedact,
|
|
2090
|
+
Xe as statusColor,
|
|
2091
|
+
K as subscribeToChannel,
|
|
2092
|
+
Ge as timeAgo,
|
|
2093
|
+
Ne as toggleTheme
|
|
2007
2094
|
};
|