adonisjs-server-stats 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +14 -2
  2. package/dist/core/core/dashboard-api.d.ts +6 -4
  3. package/dist/core/index.js +9 -6
  4. package/dist/core/types.d.ts +24 -1
  5. package/dist/react/{CacheSection-DkLtukWz.js → CacheSection-C-X2Tnca.js} +48 -44
  6. package/dist/react/{CacheTab-DWeXnEBI.js → CacheTab-D55mfmeE.js} +1 -1
  7. package/dist/react/{ConfigSection-DaVbFPDg.js → ConfigSection-C-HGnZfd.js} +1 -1
  8. package/dist/react/{ConfigTab-D4640WJZ.js → ConfigTab-CNnsOXBh.js} +1 -1
  9. package/dist/react/{CustomPaneTab-DglmAVMC.js → CustomPaneTab-D-267UVd.js} +1 -1
  10. package/dist/react/{EmailsSection-vYx6ExTb.js → EmailsSection-Bqw4DI4r.js} +65 -57
  11. package/dist/react/{EmailsTab-DKDrRmRH.js → EmailsTab-CkHOhj2F.js} +1 -1
  12. package/dist/react/{EventsSection-CapH5xut.js → EventsSection-CMeyjzVC.js} +1 -1
  13. package/dist/react/{EventsTab-BNVEySAm.js → EventsTab-DgS2v1HX.js} +1 -1
  14. package/dist/react/{JobsSection-ZIQsJWid.js → JobsSection-oWH6pbrG.js} +1 -1
  15. package/dist/react/{JobsTab-DXQzXrDt.js → JobsTab-zdxX_as-.js} +1 -1
  16. package/dist/react/{LogEntryRow-BWkHE51-.js → LogEntryRow-Cn8Ee_X0.js} +1 -1
  17. package/dist/react/{LogsSection-ConXdBkL.js → LogsSection-XmiI2MMs.js} +2 -2
  18. package/dist/react/{LogsTab-CJM47LPn.js → LogsTab-ixusY4v7.js} +2 -2
  19. package/dist/react/{OverviewSection-DOMu2qvl.js → OverviewSection-CvhObTLP.js} +119 -111
  20. package/dist/react/{QueriesSection-DFsaOSJI.js → QueriesSection-BvledwBI.js} +1 -1
  21. package/dist/react/{QueriesTab-CY9CG_7L.js → QueriesTab-smQQJvJa.js} +1 -1
  22. package/dist/react/{RequestsSection-CC-eVHsl.js → RequestsSection-DKuYpViv.js} +2 -2
  23. package/dist/react/{RoutesSection-p1DMq41y.js → RoutesSection-5RNVurQ6.js} +1 -1
  24. package/dist/react/{RoutesTab-Cnqy8UcK.js → RoutesTab-CpXNO-Rx.js} +1 -1
  25. package/dist/react/{SplitPaneWrapper-XgkA0QxE.js → SplitPaneWrapper-DQvJnsuk.js} +1 -1
  26. package/dist/react/{TimelineTab-1YOERxe5.js → TimelineTab-LHQHHKkO.js} +2 -2
  27. package/dist/react/components/Dashboard/overview-data-context.d.ts +15 -0
  28. package/dist/react/components/Dashboard/sections/OverviewSection.d.ts +9 -0
  29. package/dist/react/{index-DOSlCpZ9.js → index-LlFvooUN.js} +148 -141
  30. package/dist/react/index.js +1 -1
  31. package/dist/src/collectors/app_collector.d.ts +11 -0
  32. package/dist/src/collectors/app_collector.js +11 -0
  33. package/dist/src/collectors/redis_collector.js +13 -13
  34. package/dist/src/dashboard/cache_handlers.d.ts +17 -3
  35. package/dist/src/dashboard/cache_handlers.js +14 -19
  36. package/dist/src/dashboard/coalesce_cache.d.ts +2 -8
  37. package/dist/src/dashboard/coalesce_cache.js +25 -0
  38. package/dist/src/dashboard/dashboard_controller.d.ts +1 -0
  39. package/dist/src/dashboard/dashboard_controller.js +8 -3
  40. package/dist/src/dashboard/dashboard_store.d.ts +1 -3
  41. package/dist/src/dashboard/dashboard_store.js +14 -9
  42. package/dist/src/dashboard/dashboard_types.d.ts +2 -0
  43. package/dist/src/dashboard/filter_handlers.js +26 -4
  44. package/dist/src/dashboard/flush_manager.d.ts +2 -6
  45. package/dist/src/dashboard/flush_manager.js +9 -11
  46. package/dist/src/dashboard/format_helpers.d.ts +0 -4
  47. package/dist/src/dashboard/format_helpers.js +0 -19
  48. package/dist/src/dashboard/integrations/config_inspector.js +15 -52
  49. package/dist/src/dashboard/migrator_tables.js +4 -0
  50. package/dist/src/dashboard/paginate_helper.js +21 -11
  51. package/dist/src/dashboard/sensitive_patterns.d.ts +76 -0
  52. package/dist/src/dashboard/sensitive_patterns.js +259 -0
  53. package/dist/src/dashboard/write_queue.d.ts +27 -16
  54. package/dist/src/dashboard/write_queue.js +50 -47
  55. package/dist/src/debug/event_collector.d.ts +8 -0
  56. package/dist/src/debug/event_collector.js +12 -0
  57. package/dist/src/debug/query_collector.js +6 -1
  58. package/dist/src/debug/trace_collector.js +26 -13
  59. package/dist/src/edge/client/dashboard.js +2 -2
  60. package/dist/src/edge/client-vue/dashboard.js +5 -5
  61. package/dist/src/edge/views/dashboard.edge +1 -1
  62. package/dist/src/edge/views/debug-panel.edge +1 -1
  63. package/dist/src/edge/views/stats-bar.edge +1 -1
  64. package/dist/src/middleware/request_tracking_middleware.js +7 -2
  65. package/dist/src/provider/dashboard_init.d.ts +9 -1
  66. package/dist/src/provider/dashboard_init.js +19 -0
  67. package/dist/src/provider/email_helpers.js +20 -5
  68. package/dist/src/provider/server_stats_provider.d.ts +9 -0
  69. package/dist/src/provider/server_stats_provider.js +26 -7
  70. package/dist/src/provider/shutdown_helpers.js +3 -1
  71. package/dist/src/provider/toolbar_setup.js +21 -15
  72. package/dist/src/types.d.ts +24 -1
  73. package/dist/vue/CacheSection-Bm0goqX6.js +161 -0
  74. package/dist/vue/{ConfigSection-BiRAiaHj.js → ConfigSection-BrYslIMN.js} +1 -1
  75. package/dist/vue/{EmailsSection-Dl44qyqY.js → EmailsSection-B8N5vaWA.js} +89 -85
  76. package/dist/vue/{EventsSection-CWjeitjU.js → EventsSection-D2Y_xt0m.js} +1 -1
  77. package/dist/vue/{JobsSection-DOBb4LjZ.js → JobsSection-cEKqELLC.js} +1 -1
  78. package/dist/vue/{LogsSection-CXx-HOWJ.js → LogsSection-C3H2c0S3.js} +1 -1
  79. package/dist/vue/{OverviewSection-CyfNQ8uV.js → OverviewSection-I2swuHDa.js} +1 -1
  80. package/dist/vue/{QueriesSection-CXBsFp-y.js → QueriesSection-CF1IE3SN.js} +1 -1
  81. package/dist/vue/{RequestsSection-YTIaZGZd.js → RequestsSection-CuwgXzmU.js} +1 -1
  82. package/dist/vue/{RoutesSection-CDKMey49.js → RoutesSection-BhJCF7Rn.js} +1 -1
  83. package/dist/vue/composables/useDashboardData.d.ts +1 -1
  84. package/dist/vue/{index-14x39RI_.js → index-DUsImuIN.js} +95 -95
  85. package/dist/vue/index.js +1 -1
  86. package/package.json +12 -3
  87. package/dist/src/dashboard/explain_query.d.ts +0 -8
  88. package/dist/src/dashboard/explain_query.js +0 -22
  89. package/dist/src/provider/boot_initializer.d.ts +0 -28
  90. package/dist/src/provider/boot_initializer.js +0 -35
  91. package/dist/vue/CacheSection-CxEBVVkF.js +0 -156
@@ -1,22 +0,0 @@
1
- /**
2
- * EXPLAIN query execution helper for the DashboardStore.
3
- *
4
- * Extracted from DashboardStore to reduce file length.
5
- */
6
- export function executeExplain(db, cache, queryId, appDb) {
7
- return cache.coalesce('explain:' + queryId, async () => {
8
- const row = await db('server_stats_queries').where('id', queryId).first();
9
- if (!row)
10
- return { error: 'Query not found' };
11
- const sql = row.sql_text.trim();
12
- if (!sql.toLowerCase().startsWith('select'))
13
- return { error: 'EXPLAIN is only supported for SELECT queries' };
14
- try {
15
- const r = await appDb.rawQuery(`EXPLAIN ${sql}`);
16
- return { plan: r.rows || r };
17
- }
18
- catch (err) {
19
- return { error: err.message || 'EXPLAIN failed' };
20
- }
21
- });
22
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Boot initialization helpers for ServerStatsProvider.
3
- * Pure functions for endpoint derivation, dashboard path computation, and route path collection.
4
- */
5
- /**
6
- * Derive stats and debug endpoint paths from config.
7
- */
8
- export declare function deriveEndpointPaths(endpoint: string | false | undefined, devToolbar?: {
9
- enabled?: boolean;
10
- debugEndpoint?: string;
11
- dashboard?: boolean;
12
- dashboardPath?: string;
13
- }): {
14
- statsEndpoint: string | false;
15
- debugEndpoint: string | undefined;
16
- };
17
- /**
18
- * Compute the dashboard path from toolbar config and dependency availability.
19
- */
20
- export declare function computeDashboardPath(devToolbar?: {
21
- enabled?: boolean;
22
- dashboard?: boolean;
23
- dashboardPath?: string;
24
- }, depsAvailable?: boolean): string | undefined;
25
- /**
26
- * Collect registered route paths for logging.
27
- */
28
- export declare function collectRegisteredPaths(statsEndpoint: string | false, debugEndpoint?: string, dashboardPath?: string): string[];
@@ -1,35 +0,0 @@
1
- /**
2
- * Boot initialization helpers for ServerStatsProvider.
3
- * Pure functions for endpoint derivation, dashboard path computation, and route path collection.
4
- */
5
- /**
6
- * Derive stats and debug endpoint paths from config.
7
- */
8
- export function deriveEndpointPaths(endpoint, devToolbar) {
9
- const statsEndpoint = typeof endpoint === 'string' ? endpoint : false;
10
- const debugEndpoint = devToolbar?.enabled
11
- ? (devToolbar.debugEndpoint ?? '/admin/api/debug')
12
- : undefined;
13
- return { statsEndpoint, debugEndpoint };
14
- }
15
- /**
16
- * Compute the dashboard path from toolbar config and dependency availability.
17
- */
18
- export function computeDashboardPath(devToolbar, depsAvailable) {
19
- if (!devToolbar?.enabled || !devToolbar.dashboard || !depsAvailable)
20
- return undefined;
21
- return devToolbar.dashboardPath ?? '/__stats';
22
- }
23
- /**
24
- * Collect registered route paths for logging.
25
- */
26
- export function collectRegisteredPaths(statsEndpoint, debugEndpoint, dashboardPath) {
27
- const paths = [];
28
- if (typeof statsEndpoint === 'string')
29
- paths.push(statsEndpoint);
30
- if (debugEndpoint)
31
- paths.push(debugEndpoint + '/*');
32
- if (dashboardPath)
33
- paths.push(dashboardPath + '/*');
34
- return paths;
35
- }
@@ -1,156 +0,0 @@
1
- import { defineComponent as L, inject as v, ref as h, onMounted as x, computed as g, openBlock as t, createElementBlock as n, createElementVNode as e, toDisplayString as c, createCommentVNode as w, createVNode as A, unref as y, Fragment as F, renderList as N, withModifiers as B, createBlock as M } from "vue";
2
- import { u as U } from "./index-14x39RI_.js";
3
- import { u as H } from "./useResizableTable-BoivAevK.js";
4
- import { DashboardApi as I, formatCacheSize as j, formatTtl as q } from "adonisjs-server-stats/core";
5
- import { u as P } from "./useApiClient-BQQ9CF-q.js";
6
- import { _ as G } from "./JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js";
7
- import { _ as J } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
8
- const O = {
9
- key: 0,
10
- class: "ss-dash-cache-stats"
11
- }, Q = { class: "ss-dash-cache-stat" }, W = { class: "ss-dash-cache-stat-value" }, X = { class: "ss-dash-cache-stat" }, Y = { class: "ss-dash-cache-stat-value" }, Z = { class: "ss-dash-cache-stat" }, ee = { class: "ss-dash-cache-stat-value" }, se = { class: "ss-dash-cache-stat" }, ae = { class: "ss-dash-cache-stat-value" }, te = {
12
- key: 1,
13
- class: "ss-dash-empty"
14
- }, le = {
15
- key: 2,
16
- class: "ss-dash-empty"
17
- }, ne = {
18
- key: 3,
19
- class: "ss-dash-table-wrap"
20
- }, oe = ["onClick"], ce = ["title"], ue = { style: { color: "var(--ss-muted)" } }, ie = ["onClick"], de = {
21
- key: 1,
22
- class: "ss-dash-empty"
23
- }, he = {
24
- key: 4,
25
- class: "ss-dash-cache-detail"
26
- }, re = {
27
- key: 0,
28
- class: "ss-dash-empty"
29
- }, ve = {
30
- key: 1,
31
- class: "ss-dash-empty",
32
- style: { color: "var(--ss-red-fg)" }
33
- }, ge = /* @__PURE__ */ L({
34
- __name: "CacheSection",
35
- setup(ye) {
36
- const z = v("ss-refresh-key", h(0)), m = v("ss-dashboard-endpoint", "/__stats/api"), f = v("ss-auth-token", void 0), b = v("ss-base-url", ""), { data: k, loading: D, setSearch: K, mutate: V } = U(() => "cache", {
37
- baseUrl: b,
38
- dashboardEndpoint: m,
39
- authToken: f,
40
- refreshKey: z
41
- });
42
- let p = null;
43
- x(() => {
44
- const a = P(b || "", f);
45
- p = new I(a(), m || "/__stats/api");
46
- });
47
- const C = h(""), u = h(null), d = h(null), _ = h(!1), i = h(null), o = g(() => k.value), r = g(() => o.value?.keys || o.value?.data || []);
48
- function $(a) {
49
- C.value = a, K(a);
50
- }
51
- async function R(a) {
52
- if (confirm(`Delete cache key "${a}"?`))
53
- try {
54
- await V(`cache/${encodeURIComponent(a)}`, "delete"), u.value === a && (u.value = null, d.value = null, i.value = null);
55
- } catch {
56
- }
57
- }
58
- const { tableRef: S } = H(() => r.value);
59
- async function T(a) {
60
- if (u.value === a) {
61
- u.value = null, d.value = null, i.value = null;
62
- return;
63
- }
64
- u.value = a, d.value = null, i.value = null, _.value = !0;
65
- try {
66
- if (!p) throw new Error("Cache API not initialized");
67
- const s = await p.fetchCacheKey(a);
68
- d.value = s.value !== void 0 ? s.value : s.data !== void 0 ? s.data : s, i.value = null;
69
- } catch {
70
- d.value = null, i.value = "Failed to fetch key value";
71
- } finally {
72
- _.value = !1;
73
- }
74
- }
75
- return (a, s) => (t(), n("div", null, [
76
- o.value?.available && o.value?.stats ? (t(), n("div", O, [
77
- e("div", Q, [
78
- s[0] || (s[0] = e("span", { class: "ss-dash-cache-stat-label" }, "Hit Rate:", -1)),
79
- e("span", W, c((o.value.stats.hitRate ?? 0).toFixed(1)) + "%", 1)
80
- ]),
81
- e("div", X, [
82
- s[1] || (s[1] = e("span", { class: "ss-dash-cache-stat-label" }, "Hits:", -1)),
83
- e("span", Y, c(o.value.stats.hits ?? 0), 1)
84
- ]),
85
- e("div", Z, [
86
- s[2] || (s[2] = e("span", { class: "ss-dash-cache-stat-label" }, "Misses:", -1)),
87
- e("span", ee, c(o.value.stats.misses ?? 0), 1)
88
- ]),
89
- e("div", se, [
90
- s[3] || (s[3] = e("span", { class: "ss-dash-cache-stat-label" }, "Keys:", -1)),
91
- e("span", ae, c(o.value.stats.totalKeys || o.value.stats.keyCount || r.value.length || 0), 1)
92
- ])
93
- ])) : w("", !0),
94
- A(J, {
95
- "model-value": C.value,
96
- placeholder: "Filter cache keys...",
97
- summary: `${r.value.length} keys`,
98
- "onUpdate:modelValue": $
99
- }, null, 8, ["model-value", "summary"]),
100
- y(D) && !y(k) ? (t(), n("div", te, "Loading cache...")) : !o.value || !o.value.available ? (t(), n("div", le, " Cache inspector not available ")) : (t(), n("div", ne, [
101
- r.value.length > 0 ? (t(), n("table", {
102
- key: 0,
103
- ref_key: "tableRef",
104
- ref: S,
105
- class: "ss-dash-table"
106
- }, [
107
- s[4] || (s[4] = e("thead", null, [
108
- e("tr", null, [
109
- e("th", null, "Key"),
110
- e("th", null, "Type"),
111
- e("th", null, "Size"),
112
- e("th", null, "TTL"),
113
- e("th")
114
- ])
115
- ], -1)),
116
- e("tbody", null, [
117
- (t(!0), n(F, null, N(r.value, (l) => (t(), n("tr", {
118
- key: l.key,
119
- class: "ss-dash-clickable",
120
- onClick: (E) => T(l.key)
121
- }, [
122
- e("td", null, [
123
- e("span", {
124
- title: l.key,
125
- style: { color: "var(--ss-sql-color)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", display: "block" }
126
- }, c(l.key), 9, ce)
127
- ]),
128
- e("td", null, [
129
- e("span", ue, c(l.type), 1)
130
- ]),
131
- e("td", null, c(l.size !== null && l.size !== void 0 && l.size > 0 ? y(j)(l.size) : "-"), 1),
132
- e("td", null, c(l.ttl > 0 ? y(q)(l.ttl) : "-"), 1),
133
- e("td", null, [
134
- e("button", {
135
- type: "button",
136
- class: "ss-dash-retry-btn",
137
- onClick: B((E) => R(l.key), ["stop"])
138
- }, " Delete ", 8, ie)
139
- ])
140
- ], 8, oe))), 128))
141
- ])
142
- ], 512)) : (t(), n("div", de, "No cache keys found"))
143
- ])),
144
- u.value ? (t(), n("div", he, [
145
- e("h4", null, "Key: " + c(u.value), 1),
146
- _.value ? (t(), n("div", re, "Loading value...")) : i.value ? (t(), n("div", ve, c(i.value), 1)) : (t(), M(G, {
147
- key: 2,
148
- value: d.value
149
- }, null, 8, ["value"]))
150
- ])) : w("", !0)
151
- ]));
152
- }
153
- });
154
- export {
155
- ge as default
156
- };