adonisjs-server-stats 1.10.0 → 1.11.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 (248) hide show
  1. package/README.md +23 -14
  2. package/dist/core/config-utils.d.ts +8 -0
  3. package/dist/core/constants.d.ts +4 -0
  4. package/dist/core/dashboard-data-controller.d.ts +16 -0
  5. package/dist/core/dashboard-data-helpers.d.ts +12 -0
  6. package/dist/core/debug-data-controller.d.ts +4 -0
  7. package/dist/core/define-config-helpers.d.ts +25 -0
  8. package/dist/core/feature-detect-helpers.d.ts +36 -0
  9. package/dist/core/field-resolvers.d.ts +64 -0
  10. package/dist/core/formatters-helpers.d.ts +23 -0
  11. package/dist/core/formatters.d.ts +15 -0
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.js +599 -509
  14. package/dist/core/log-utils-helpers.d.ts +13 -0
  15. package/dist/core/metrics.d.ts +3 -28
  16. package/dist/core/pagination.d.ts +0 -9
  17. package/dist/core/server-stats-controller.d.ts +6 -0
  18. package/dist/core/transmit-helpers.d.ts +7 -0
  19. package/dist/core/types-dashboard.d.ts +178 -0
  20. package/dist/core/types-diagnostics.d.ts +85 -0
  21. package/dist/core/types.d.ts +10 -442
  22. package/dist/react/CacheSection-BYN53kYO.js +135 -0
  23. package/dist/react/CacheStatsBar-CRodCOeP.js +27 -0
  24. package/dist/react/CacheTab-DOhuK05d.js +106 -0
  25. package/dist/react/{ConfigSection-DfFd-WRq.js → ConfigSection-B9EHh4Rp.js} +1 -1
  26. package/dist/react/{ConfigTab-Bdg8YMer.js → ConfigTab-C8kriE2b.js} +1 -1
  27. package/dist/react/CustomPaneTab-CvzQS_Wh.js +99 -0
  28. package/dist/react/EmailPreviewOverlay-BmXOAvqG.js +58 -0
  29. package/dist/react/EmailsSection-BJyFJf7A.js +226 -0
  30. package/dist/react/EmailsTab-Ch8jp10B.js +110 -0
  31. package/dist/react/{EventsSection-ByQ-9blq.js → EventsSection-DJPwHeT8.js} +28 -27
  32. package/dist/react/EventsTab-B-FoehXC.js +58 -0
  33. package/dist/react/{FilterBar-DQRXpWrb.js → FilterBar-CQ7bD669.js} +15 -15
  34. package/dist/react/{InternalsContent-DBzsI0CG.js → InternalsContent-O8ino9oM.js} +133 -109
  35. package/dist/react/InternalsSection-B6VlVx5f.js +22 -0
  36. package/dist/react/InternalsTab-CkEKpRMU.js +17 -0
  37. package/dist/react/JobStatsBar-C7RslAFE.js +30 -0
  38. package/dist/react/JobsSection-DWF4i1t_.js +167 -0
  39. package/dist/react/JobsTab-DqnifQXV.js +129 -0
  40. package/dist/react/LogEntryRow-CMMkqA9M.js +43 -0
  41. package/dist/react/LogsSection-C1xC5aP4.js +198 -0
  42. package/dist/react/LogsTab-CS4sLfLw.js +79 -0
  43. package/dist/react/{OverviewSection-C4T1ur51.js → OverviewSection-CxvfOR0v.js} +70 -80
  44. package/dist/react/QueriesSection-CrMdU5Ax.js +458 -0
  45. package/dist/react/{QueriesTab-osLUWd4L.js → QueriesTab-x85PjkyS.js} +38 -40
  46. package/dist/react/RequestsSection-DETN9oZb.js +321 -0
  47. package/dist/react/{RoutesSection-BUSkM6PY.js → RoutesSection-CmorkJeC.js} +2 -2
  48. package/dist/react/RoutesTab-CbzBOzpc.js +68 -0
  49. package/dist/react/SplitPaneWrapper-BiIgT4ND.js +49 -0
  50. package/dist/react/TimeAgoCell-o3KigGfM.js +8 -0
  51. package/dist/react/{TimelineTab-Covg5weo.js → TimelineTab-Ue9tUD_n.js} +76 -102
  52. package/dist/react/index-DwDK-4oX.js +1121 -0
  53. package/dist/react/index.js +6 -6
  54. package/dist/react/react/components/shared/CacheStatsBar.d.ts +13 -0
  55. package/dist/react/react/components/shared/EmailPreviewOverlay.d.ts +29 -0
  56. package/dist/react/react/components/{Dashboard/shared → shared}/FilterBar.d.ts +4 -3
  57. package/dist/react/react/components/shared/JobStatsBar.d.ts +12 -0
  58. package/dist/react/react/components/shared/LogEntryRow.d.ts +9 -0
  59. package/dist/react/react/components/shared/RelatedLogs.d.ts +2 -2
  60. package/dist/react/react/components/shared/SplitPaneWrapper.d.ts +7 -0
  61. package/dist/react/react/components/shared/TimeAgoCell.d.ts +17 -0
  62. package/dist/react/react/hooks/useDashboardData.d.ts +4 -8
  63. package/dist/react/react/hooks/useDiagnosticsData.d.ts +14 -0
  64. package/dist/react/style.css +1 -1
  65. package/dist/src/collectors/app_collector.d.ts +0 -8
  66. package/dist/src/collectors/app_collector.js +45 -52
  67. package/dist/src/collectors/auto_detect.d.ts +0 -23
  68. package/dist/src/collectors/auto_detect.js +33 -55
  69. package/dist/src/collectors/db_pool_collector.d.ts +14 -16
  70. package/dist/src/collectors/db_pool_collector.js +72 -57
  71. package/dist/src/collectors/log_collector.d.ts +0 -47
  72. package/dist/src/collectors/log_collector.js +36 -65
  73. package/dist/src/collectors/queue_collector.d.ts +0 -20
  74. package/dist/src/collectors/queue_collector.js +60 -76
  75. package/dist/src/collectors/redis_collector.d.ts +10 -10
  76. package/dist/src/collectors/redis_collector.js +69 -66
  77. package/dist/src/config/deprecation_migration.d.ts +7 -0
  78. package/dist/src/config/deprecation_migration.js +201 -0
  79. package/dist/src/controller/debug_controller.d.ts +1 -1
  80. package/dist/src/controller/debug_controller.js +87 -81
  81. package/dist/src/dashboard/cache_handlers.d.ts +14 -0
  82. package/dist/src/dashboard/cache_handlers.js +52 -0
  83. package/dist/src/dashboard/chart_aggregator.d.ts +0 -7
  84. package/dist/src/dashboard/chart_aggregator.js +68 -50
  85. package/dist/src/dashboard/coalesce_cache.d.ts +25 -0
  86. package/dist/src/dashboard/coalesce_cache.js +47 -0
  87. package/dist/src/dashboard/dashboard_controller.d.ts +11 -37
  88. package/dist/src/dashboard/dashboard_controller.js +51 -544
  89. package/dist/src/dashboard/dashboard_page_assets.d.ts +17 -0
  90. package/dist/src/dashboard/dashboard_page_assets.js +51 -0
  91. package/dist/src/dashboard/dashboard_store.d.ts +19 -218
  92. package/dist/src/dashboard/dashboard_store.js +115 -1116
  93. package/dist/src/dashboard/dashboard_types.d.ts +83 -0
  94. package/dist/src/dashboard/dashboard_types.js +4 -0
  95. package/dist/src/dashboard/detail_queries.d.ts +19 -0
  96. package/dist/src/dashboard/detail_queries.js +98 -0
  97. package/dist/src/dashboard/email_event_builder.d.ts +8 -0
  98. package/dist/src/dashboard/email_event_builder.js +65 -0
  99. package/dist/src/dashboard/explain_query.d.ts +8 -0
  100. package/dist/src/dashboard/explain_query.js +22 -0
  101. package/dist/src/dashboard/filter_handlers.d.ts +23 -0
  102. package/dist/src/dashboard/filter_handlers.js +56 -0
  103. package/dist/src/dashboard/filtered_queries.d.ts +15 -0
  104. package/dist/src/dashboard/filtered_queries.js +155 -0
  105. package/dist/src/dashboard/flush_manager.d.ts +25 -0
  106. package/dist/src/dashboard/flush_manager.js +107 -0
  107. package/dist/src/dashboard/format_helpers.d.ts +126 -0
  108. package/dist/src/dashboard/format_helpers.js +140 -0
  109. package/dist/src/dashboard/inspector_manager.d.ts +36 -0
  110. package/dist/src/dashboard/inspector_manager.js +102 -0
  111. package/dist/src/dashboard/integrations/config_inspector.js +11 -13
  112. package/dist/src/dashboard/integrations/queue_inspector.d.ts +3 -3
  113. package/dist/src/dashboard/integrations/queue_inspector.js +13 -10
  114. package/dist/src/dashboard/jobs_handlers.d.ts +14 -0
  115. package/dist/src/dashboard/jobs_handlers.js +61 -0
  116. package/dist/src/dashboard/knex_factory.d.ts +18 -0
  117. package/dist/src/dashboard/knex_factory.js +91 -0
  118. package/dist/src/dashboard/migrator.js +30 -159
  119. package/dist/src/dashboard/migrator_tables.d.ts +19 -0
  120. package/dist/src/dashboard/migrator_tables.js +153 -0
  121. package/dist/src/dashboard/overview_queries.d.ts +66 -0
  122. package/dist/src/dashboard/overview_queries.js +155 -0
  123. package/dist/src/dashboard/overview_query_runners.d.ts +25 -0
  124. package/dist/src/dashboard/overview_query_runners.js +84 -0
  125. package/dist/src/dashboard/overview_store_queries.d.ts +40 -0
  126. package/dist/src/dashboard/overview_store_queries.js +69 -0
  127. package/dist/src/dashboard/paginate_helper.d.ts +12 -0
  128. package/dist/src/dashboard/paginate_helper.js +33 -0
  129. package/dist/src/dashboard/query_explain_handler.d.ts +10 -0
  130. package/dist/src/dashboard/query_explain_handler.js +80 -0
  131. package/dist/src/dashboard/read_queries.d.ts +32 -0
  132. package/dist/src/dashboard/read_queries.js +107 -0
  133. package/dist/src/dashboard/saved_filter_queries.d.ts +10 -0
  134. package/dist/src/dashboard/saved_filter_queries.js +24 -0
  135. package/dist/src/dashboard/storage_stats.d.ts +41 -0
  136. package/dist/src/dashboard/storage_stats.js +81 -0
  137. package/dist/src/dashboard/write_queue.d.ts +106 -0
  138. package/dist/src/dashboard/write_queue.js +225 -0
  139. package/dist/src/data/data_access.d.ts +2 -39
  140. package/dist/src/data/data_access.js +17 -193
  141. package/dist/src/data/data_access_helpers.d.ts +130 -0
  142. package/dist/src/data/data_access_helpers.js +212 -0
  143. package/dist/src/debug/debug_store.js +37 -32
  144. package/dist/src/debug/email_collector.d.ts +1 -10
  145. package/dist/src/debug/email_collector.js +78 -81
  146. package/dist/src/debug/event_collector.d.ts +0 -9
  147. package/dist/src/debug/event_collector.js +79 -62
  148. package/dist/src/debug/query_collector.js +23 -19
  149. package/dist/src/debug/route_inspector.d.ts +1 -5
  150. package/dist/src/debug/route_inspector.js +50 -51
  151. package/dist/src/debug/trace_collector.d.ts +9 -1
  152. package/dist/src/debug/trace_collector.js +21 -15
  153. package/dist/src/debug/types.d.ts +1 -1
  154. package/dist/src/define_config.d.ts +0 -65
  155. package/dist/src/define_config.js +93 -333
  156. package/dist/src/edge/client/dashboard.js +2 -2
  157. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  158. package/dist/src/edge/client/stats-bar.js +1 -1
  159. package/dist/src/edge/client-vue/dashboard.js +5 -5
  160. package/dist/src/edge/client-vue/debug-panel-deferred.js +4 -4
  161. package/dist/src/edge/client-vue/stats-bar.js +3 -3
  162. package/dist/src/edge/plugin.d.ts +0 -16
  163. package/dist/src/edge/plugin.js +57 -64
  164. package/dist/src/engine/request_metrics.d.ts +1 -0
  165. package/dist/src/engine/request_metrics.js +32 -42
  166. package/dist/src/middleware/request_tracking_middleware.d.ts +2 -8
  167. package/dist/src/middleware/request_tracking_middleware.js +65 -93
  168. package/dist/src/provider/auth_middleware_detector.d.ts +16 -0
  169. package/dist/src/provider/auth_middleware_detector.js +97 -0
  170. package/dist/src/provider/boot_helpers.d.ts +20 -0
  171. package/dist/src/provider/boot_helpers.js +91 -0
  172. package/dist/src/provider/boot_initializer.d.ts +28 -0
  173. package/dist/src/provider/boot_initializer.js +35 -0
  174. package/dist/src/provider/dashboard_init.d.ts +30 -0
  175. package/dist/src/provider/dashboard_init.js +138 -0
  176. package/dist/src/provider/dashboard_setup.d.ts +25 -0
  177. package/dist/src/provider/dashboard_setup.js +78 -0
  178. package/dist/src/provider/diagnostics.d.ts +134 -0
  179. package/dist/src/provider/diagnostics.js +127 -0
  180. package/dist/src/provider/email_bridge.d.ts +43 -0
  181. package/dist/src/provider/email_bridge.js +80 -0
  182. package/dist/src/provider/email_helpers.d.ts +13 -0
  183. package/dist/src/provider/email_helpers.js +68 -0
  184. package/dist/src/provider/pino_hook.d.ts +17 -0
  185. package/dist/src/provider/pino_hook.js +35 -0
  186. package/dist/src/provider/provider_helpers_extra.d.ts +47 -0
  187. package/dist/src/provider/provider_helpers_extra.js +177 -0
  188. package/dist/src/provider/server_stats_provider.d.ts +39 -85
  189. package/dist/src/provider/server_stats_provider.js +132 -951
  190. package/dist/src/provider/shutdown_helpers.d.ts +43 -0
  191. package/dist/src/provider/shutdown_helpers.js +70 -0
  192. package/dist/src/provider/toolbar_setup.d.ts +57 -0
  193. package/dist/src/provider/toolbar_setup.js +141 -0
  194. package/dist/src/routes/dashboard_routes.d.ts +14 -0
  195. package/dist/src/routes/dashboard_routes.js +197 -0
  196. package/dist/src/routes/debug_routes.d.ts +14 -0
  197. package/dist/src/routes/debug_routes.js +101 -0
  198. package/dist/src/routes/register_routes.d.ts +0 -78
  199. package/dist/src/routes/register_routes.js +22 -352
  200. package/dist/src/routes/stats_routes.d.ts +5 -0
  201. package/dist/src/routes/stats_routes.js +14 -0
  202. package/dist/src/styles/components.css +163 -0
  203. package/dist/src/styles/dashboard.css +13 -105
  204. package/dist/src/styles/debug-panel.css +2 -53
  205. package/dist/src/styles/utilities.css +3 -1
  206. package/dist/src/types.d.ts +305 -14
  207. package/dist/vue/{CacheSection-oFAJL3mo.js → CacheSection-DT2Mwf_s.js} +1 -1
  208. package/dist/vue/{ConfigSection-BhfJ4KqL.js → ConfigSection-BwKwS9lh.js} +1 -1
  209. package/dist/vue/CustomPaneTab-Hr1IBHfz.js +172 -0
  210. package/dist/vue/{EmailsSection-BcNyhyHs.js → EmailsSection-B65g0FVS.js} +1 -1
  211. package/dist/vue/{EventsSection-r60Q5Lmu.js → EventsSection-CxqtVF-o.js} +1 -1
  212. package/dist/vue/{JobsSection-BHL-hkQw.js → JobsSection-rMIyMb-g.js} +1 -1
  213. package/dist/vue/{LogsSection-DRMGzJmg.js → LogsSection-DmmZVJ7D.js} +9 -3
  214. package/dist/vue/{LogsTab-Bg3o0Mm6.js → LogsTab-47zEK7jL.js} +4 -1
  215. package/dist/vue/{OverviewSection-CXh6Ja1B.js → OverviewSection-BMabyqw-.js} +49 -50
  216. package/dist/vue/{QueriesSection-IodIsCJ-.js → QueriesSection-BfDFwGqH.js} +44 -45
  217. package/dist/vue/{QueriesTab-C8_7oprC.js → QueriesTab-DuTG7cpC.js} +30 -31
  218. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-Py1iu9GU.js +77 -0
  219. package/dist/vue/{RequestsSection-BPuMdmMc.js → RequestsSection-CTu4jPZ_.js} +143 -147
  220. package/dist/vue/{RoutesSection-NKo3Rbq3.js → RoutesSection-zQZDedL7.js} +1 -1
  221. package/dist/vue/TimelineTab-DHfXsX7t.js +334 -0
  222. package/dist/vue/components/shared/RelatedLogs.vue.d.ts +1 -4
  223. package/dist/vue/composables/useDashboardData.d.ts +12 -23
  224. package/dist/vue/index-CM3yNVUR.js +1232 -0
  225. package/dist/vue/index.js +1 -1
  226. package/dist/vue/style.css +1 -1
  227. package/package.json +1 -1
  228. package/dist/react/CacheSection-UCMptWyn.js +0 -146
  229. package/dist/react/CacheTab-CA8LB1J5.js +0 -123
  230. package/dist/react/CustomPaneTab-Bxtv_8Rw.js +0 -104
  231. package/dist/react/EmailsSection-CM7stSyh.js +0 -262
  232. package/dist/react/EmailsTab-BDhEiomM.js +0 -153
  233. package/dist/react/EventsTab-CMfY98Rl.js +0 -63
  234. package/dist/react/InternalsSection-t7ihcWO-.js +0 -32
  235. package/dist/react/InternalsTab-Oij0A2fN.js +0 -30
  236. package/dist/react/JobsSection-DF3qEv9O.js +0 -187
  237. package/dist/react/JobsTab-BbrBWIOb.js +0 -141
  238. package/dist/react/LogsSection-DcFTZY7b.js +0 -227
  239. package/dist/react/LogsTab-CicucmVk.js +0 -103
  240. package/dist/react/QueriesSection-PswteoF9.js +0 -461
  241. package/dist/react/RelatedLogs-DFDOyUMr.js +0 -40
  242. package/dist/react/RequestsSection-Nag30rEA.js +0 -341
  243. package/dist/react/RoutesTab-DgVzd2PZ.js +0 -74
  244. package/dist/react/index-Cflz9Ebj.js +0 -1069
  245. package/dist/vue/CustomPaneTab-BJxT5Dp7.js +0 -172
  246. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +0 -84
  247. package/dist/vue/TimelineTab-zj5Z5OdT.js +0 -338
  248. package/dist/vue/index-Dtgysd26.js +0 -1229
@@ -1,6 +1,8 @@
1
1
  import { ServerStats } from '../types.js';
2
2
  export type { ServerStats, MetricValue, ServerStatsConfig, ResolvedServerStatsConfig, DevToolbarOptions, ToolbarConfig, AdvancedConfig, } from '../types.js';
3
3
  export type { DebugPane, DebugPaneColumn, DebugPaneSearch, DebugPaneFormatType, BadgeColor, QueryRecord, EventRecord, EmailRecord, RouteRecord, TraceRecord, TraceSpan, } from '../debug/types.js';
4
+ export type { OverviewMetrics, OverviewData, ChartDataPoint, GroupedQuery, DashboardCacheStats, DashboardCacheKeyEntry, DashboardCacheResponse, JobsApiResponse, JobStats, JobRecord, } from './types-dashboard.js';
5
+ export type { DiagnosticsBufferInfo, DiagnosticsCollectorInfo, DiagnosticsTimerInfo, DiagnosticsResponse, } from './types-diagnostics.js';
4
6
  /**
5
7
  * Props / config for the `<ServerStatsBar />` component.
6
8
  */
@@ -18,63 +20,37 @@ export interface StatsBarProps {
18
20
  /** CSS class overrides for the root element. */
19
21
  className?: string;
20
22
  }
21
- /**
22
- * Props for the `<DebugPanel />` component.
23
- */
23
+ /** Props for the `<DebugPanel />` component. */
24
24
  export interface DebugPanelProps {
25
- /** Base URL for API calls. Defaults to `''` (same origin). */
26
25
  baseUrl?: string;
27
- /** Debug API base path. Defaults to `'/admin/api/debug'`. */
28
26
  debugEndpoint?: string;
29
- /** Optional auth token for Bearer auth. */
30
27
  authToken?: string;
31
- /** CSS class overrides for panel container. */
32
28
  className?: string;
33
29
  }
34
- /**
35
- * Props for the `<DashboardPage />` component.
36
- */
30
+ /** Props for the `<DashboardPage />` component. */
37
31
  export interface DashboardPageProps {
38
- /** Base URL for API calls. Defaults to `''` (same origin). */
39
32
  baseUrl?: string;
40
- /** Dashboard API base path. Defaults to `'/__stats/api'`. */
41
33
  dashboardEndpoint?: string;
42
- /** Optional auth token for Bearer auth. */
43
34
  authToken?: string;
44
- /** Transmit channel name for live updates. Defaults to `'server-stats/dashboard'`. */
45
35
  channelName?: string;
46
- /** CSS class overrides for the root element. */
47
36
  className?: string;
48
37
  }
49
- /**
50
- * Alias for {@link StatsBarProps}. Used by Vue components as config type.
51
- */
38
+ /** Alias for {@link StatsBarProps}. Used by Vue components as config type. */
52
39
  export interface StatsBarConfig extends StatsBarProps {
53
- /** Debug API endpoint path (used for feature detection). */
54
40
  debugEndpoint?: string;
55
41
  }
56
- /**
57
- * Alias for {@link DebugPanelProps}. Used by Vue components as config type.
58
- */
42
+ /** Alias for {@link DebugPanelProps}. Used by Vue components as config type. */
59
43
  export interface DebugPanelConfig extends DebugPanelProps {
60
- /** Path to the full dashboard page. */
61
44
  dashboardPath?: string;
62
- /** Whether tracing is enabled. */
63
45
  tracingEnabled?: boolean;
64
- /** Whether the stats bar is connected via Transmit (SSE) for live updates. */
65
46
  isLive?: boolean;
66
47
  }
67
- /**
68
- * Alias for {@link DashboardPageProps}. Used by Vue components as config type.
69
- */
48
+ /** Alias for {@link DashboardPageProps}. Used by Vue components as config type. */
70
49
  export interface DashboardConfig extends DashboardPageProps {
71
- /** Whether tracing is enabled. */
72
50
  tracingEnabled?: boolean;
73
51
  }
74
52
  /**
75
53
  * Shape returned by `GET {debugEndpoint}/config`.
76
- *
77
- * Tells the UI which sections to render and where to find endpoints.
78
54
  */
79
55
  export interface FeatureFlags {
80
56
  features: {
@@ -105,10 +81,6 @@ export interface FeatureFlags {
105
81
  }
106
82
  /**
107
83
  * Flattened feature config used by Vue composables.
108
- *
109
- * Provides a flat interface for feature flags plus custom panes,
110
- * simplifying access in Vue components (e.g. `features.tracing`
111
- * instead of `features.features.tracing`).
112
84
  */
113
85
  export interface FeatureConfig {
114
86
  tracing: boolean;
@@ -125,114 +97,40 @@ export interface FeatureConfig {
125
97
  dashboard: boolean;
126
98
  customPanes: import('../debug/types.js').DebugPane[];
127
99
  }
128
- /**
129
- * Threshold color result.
130
- */
100
+ /** Threshold color result. */
131
101
  export type ThresholdColor = 'green' | 'amber' | 'red';
132
102
  /**
133
103
  * Definition for a single metric displayed in the stats bar.
134
- *
135
- * Each definition drives rendering in both React and Vue:
136
- * label for display, extract for reading the value from a snapshot,
137
- * format for string output, and threshold config for color coding.
138
104
  */
139
105
  export interface MetricDefinition {
140
- /** Unique metric identifier (e.g. `'cpu'`, `'memory'`). */
141
106
  id: string;
142
- /** Short display label (e.g. `'CPU'`, `'MEM'`). */
143
107
  label: string;
144
- /**
145
- * Longer display title for tooltips (e.g. `'CPU Usage'`, `'Memory'`).
146
- * Falls back to `label` if not provided.
147
- */
148
108
  title?: string;
149
- /**
150
- * Unit string for display and tooltip (e.g. `'%'`, `'ms'`, `'bytes'`).
151
- * Empty string for unitless metrics.
152
- */
153
109
  unit: string;
154
- /**
155
- * Metric group for layout grouping in the stats bar.
156
- * Standard groups: `'core'`, `'db'`, `'redis'`, `'queue'`, `'log'`.
157
- * Defaults to `'core'` if not specified.
158
- */
159
110
  group?: string;
160
- /**
161
- * Value at or above which the metric turns amber.
162
- * For inverse metrics (higher is better), this is the *below* threshold.
163
- * `undefined` means no threshold coloring.
164
- */
165
111
  warnThreshold?: number;
166
- /**
167
- * Value at or above which the metric turns red.
168
- * For inverse metrics (higher is better), this is the *below* threshold.
169
- * `undefined` means no threshold coloring.
170
- */
171
112
  critThreshold?: number;
172
- /**
173
- * Whether the threshold logic is inverted (lower values are worse).
174
- * Used for metrics like cache hit rate where <90% is amber and <70% is red.
175
- */
176
113
  inverseThreshold?: boolean;
177
- /**
178
- * Extract the numeric value from a stats snapshot.
179
- * Returns `undefined` if the metric is not available in this snapshot.
180
- */
181
114
  extract: (stats: ServerStats) => number | undefined;
182
- /**
183
- * Format the extracted value for display (e.g. `"52.3%"`, `"128M"`).
184
- * Alias: `value` (same function, alternate name for React).
185
- */
186
115
  format: (stats: ServerStats) => string;
187
- /**
188
- * Alias for {@link format}. Returns the formatted display string.
189
- */
190
116
  value?: (stats: ServerStats) => string;
191
- /**
192
- * Return a CSS class name for threshold coloring (e.g. `'ss-green'`).
193
- * Used by React components. When not provided, the component should
194
- * compute the color from `warnThreshold`/`critThreshold`.
195
- */
196
117
  color?: (stats: ServerStats) => string;
197
- /**
198
- * Additional detail text (or a function returning detail text)
199
- * shown in the tooltip below the main value.
200
- */
201
118
  detail?: string | ((stats: ServerStats) => string | null);
202
- /**
203
- * Key on `ServerStats` to track in the sparkline history buffer.
204
- * `undefined` means no sparkline for this metric.
205
- * A leading `_` prefix indicates a computed value (e.g. `'_sysMemUsed'`).
206
- */
207
119
  historyKey?: string | undefined;
208
- /**
209
- * Optional predicate to conditionally show/hide this metric
210
- * based on the current stats snapshot.
211
- */
212
120
  show?: (stats: ServerStats) => boolean;
213
121
  }
214
- /**
215
- * Options for SVG sparkline rendering.
216
- */
122
+ /** Options for SVG sparkline rendering. */
217
123
  export interface SparklineOptions {
218
- /** Stroke color (CSS color string). Defaults to `'#34d399'`. */
219
124
  color?: string;
220
- /** Fill gradient top opacity (0-1). Defaults to `0.25`. */
221
125
  fillOpacityTop?: number;
222
- /** Fill gradient bottom opacity (0-1). Defaults to `0.02`. */
223
126
  fillOpacityBottom?: number;
224
- /** Line stroke width. Defaults to `1.5`. */
225
127
  strokeWidth?: number;
226
- /** SVG viewBox width. Defaults to `120`. */
227
128
  width?: number;
228
- /** SVG viewBox height. Defaults to `32`. */
229
129
  height?: number;
230
- /** Inner padding in px. Defaults to `2`. */
231
130
  padding?: number;
232
131
  }
233
132
  /**
234
133
  * Options for the `useDashboardData` hook.
235
- * Extends {@link DashboardPageProps} with pagination, sort, filter, and time range options.
236
134
  */
237
135
  export interface DashboardHookOptions extends DashboardPageProps {
238
136
  page?: number;
@@ -242,28 +140,11 @@ export interface DashboardHookOptions extends DashboardPageProps {
242
140
  sortDir?: 'asc' | 'desc';
243
141
  filters?: Record<string, string>;
244
142
  timeRange?: TimeRange;
245
- /** Incrementing key to trigger a refetch (used by live mode). */
246
143
  refreshKey?: number;
247
144
  }
248
- /**
249
- * Built-in debug panel tab identifiers.
250
- *
251
- * Known tabs are provided for autocomplete; any custom string is also accepted.
252
- */
253
145
  export type DebugTab = 'timeline' | 'queries' | 'events' | 'routes' | 'logs' | 'emails' | 'cache' | 'jobs' | (string & {});
254
- /**
255
- * Built-in dashboard section identifiers.
256
- *
257
- * Known sections are provided for autocomplete; any custom string is also accepted.
258
- */
259
146
  export type DashboardSection = 'overview' | 'requests' | 'queries' | 'events' | 'routes' | 'logs' | 'emails' | 'cache' | 'jobs' | 'config' | (string & {});
260
- /**
261
- * Pre-defined time range options for dashboard queries.
262
- */
263
147
  export type TimeRange = '5m' | '15m' | '30m' | '1h' | '6h' | '24h' | '7d';
264
- /**
265
- * Generic paginated API response shape.
266
- */
267
148
  export interface PaginatedResponse<T> {
268
149
  data: T[];
269
150
  meta: {
@@ -273,346 +154,33 @@ export interface PaginatedResponse<T> {
273
154
  lastPage: number;
274
155
  };
275
156
  }
276
- /**
277
- * Aggregate cache statistics returned by the debug cache endpoint.
278
- */
279
157
  export interface CacheStats {
280
158
  hitRate: number;
281
159
  totalHits: number;
282
160
  totalMisses: number;
283
161
  keys: CacheEntry[];
284
- /** Number of cache keys (may differ from `keys.length` when paginated). */
285
162
  keyCount?: number;
286
- /** Memory used by the cache store in megabytes. */
287
163
  memoryUsedMb?: number;
288
164
  }
289
- /**
290
- * Individual cache key metadata.
291
- */
292
165
  export interface CacheEntry {
293
166
  key: string;
294
167
  type: string;
295
168
  ttl: number;
296
169
  size: number;
297
- /** Cached value (populated when inspecting a single key in the debug panel). */
298
170
  value?: string | number | boolean | Record<string, unknown> | unknown[] | null;
299
171
  }
300
- /**
301
- * Redis / cache store statistics returned by the dashboard cache endpoint.
302
- */
303
- export interface DashboardCacheStats {
304
- connected: boolean;
305
- hits: number;
306
- misses: number;
307
- hitRate: number;
308
- memoryUsedBytes: number;
309
- memoryUsedHuman: string;
310
- connectedClients: number;
311
- totalKeys: number;
312
- keyCount?: number;
313
- }
314
- /**
315
- * Individual cache key entry in the dashboard cache inspector.
316
- */
317
- export interface DashboardCacheKeyEntry {
318
- key: string;
319
- type: string;
320
- ttl: number;
321
- size?: number | null;
322
- }
323
- /**
324
- * Full response from the dashboard cache API endpoint.
325
- */
326
- export interface DashboardCacheResponse {
327
- available: boolean;
328
- stats: DashboardCacheStats | null;
329
- keys?: DashboardCacheKeyEntry[];
330
- data?: DashboardCacheKeyEntry[];
331
- cursor: string;
332
- }
333
- /**
334
- * Server response shape from the dashboard API `/api/jobs` endpoint.
335
- *
336
- * The server may return jobs under `jobs` or `data`, and stats under
337
- * `stats` or `overview`. We handle all variants to stay compatible
338
- * with different queue inspector implementations.
339
- */
340
- export interface JobsApiResponse {
341
- available?: boolean;
342
- overview?: JobStats;
343
- stats?: JobStats;
344
- data?: JobRecord[];
345
- jobs?: JobRecord[];
346
- total?: number;
347
- }
348
- /**
349
- * Aggregate queue statistics.
350
- */
351
- export interface JobStats {
352
- active: number;
353
- waiting: number;
354
- delayed: number;
355
- completed: number;
356
- failed: number;
357
- }
358
- /**
359
- * Individual job record from the queue inspector.
360
- */
361
- export interface JobRecord {
362
- id: string;
363
- name: string;
364
- status: string;
365
- data: unknown;
366
- payload: unknown;
367
- attempts: number;
368
- duration: number | null;
369
- timestamp: number | string;
370
- createdAt: number | string;
371
- processedAt: number | string | null;
372
- finishedAt: number | string | null;
373
- failedReason: string | null;
374
- }
375
- /**
376
- * Aggregated overview metrics returned by the dashboard overview endpoint.
377
- */
378
- export interface OverviewMetrics {
379
- avgResponseTime: number;
380
- p95ResponseTime: number;
381
- requestsPerMinute: number;
382
- errorRate: number;
383
- totalRequests: number;
384
- slowestEndpoints: {
385
- url?: string;
386
- pattern?: string;
387
- avgDuration: number;
388
- count: number;
389
- }[];
390
- queryStats: {
391
- total: number;
392
- avgDuration: number;
393
- perRequest: number;
394
- };
395
- recentErrors: {
396
- id?: number;
397
- level: string;
398
- message: string;
399
- timestamp?: number | string;
400
- }[];
401
- topEvents: {
402
- eventName?: string;
403
- name?: string;
404
- event_name?: string;
405
- event?: string;
406
- count: number;
407
- }[];
408
- emailActivity: {
409
- sent: number;
410
- queued: number;
411
- failed: number;
412
- };
413
- logLevelBreakdown: {
414
- error: number;
415
- warn: number;
416
- info: number;
417
- debug: number;
418
- };
419
- cacheStats: {
420
- available: boolean;
421
- totalKeys: number;
422
- hitRate: number;
423
- memoryUsedHuman: string;
424
- } | null;
425
- jobQueueStatus: {
426
- available: boolean;
427
- active: number;
428
- waiting: number;
429
- failed: number;
430
- completed: number;
431
- } | null;
432
- statusDistribution: {
433
- '2xx': number;
434
- '3xx': number;
435
- '4xx': number;
436
- '5xx': number;
437
- };
438
- slowestQueries: {
439
- sqlNormalized?: string;
440
- normalizedSql?: string;
441
- sql_normalized?: string;
442
- sql?: string;
443
- avgDuration: number;
444
- count: number;
445
- }[];
446
- sparklines?: {
447
- avgResponseTime?: number[];
448
- p95ResponseTime?: number[];
449
- requestsPerMinute?: number[];
450
- errorRate?: number[];
451
- };
452
- }
453
- /**
454
- * Extended overview data used by Vue dashboard components.
455
- * Extends {@link OverviewMetrics} with sparkline time-series data.
456
- */
457
- export interface OverviewData extends OverviewMetrics {
458
- avgResponseTimeSeries?: number[];
459
- p95ResponseTimeSeries?: number[];
460
- requestsPerMinuteSeries?: number[];
461
- errorRateSeries?: number[];
462
- recentErrors: {
463
- id?: number;
464
- level: string;
465
- message: string;
466
- timestamp: number | string;
467
- }[];
468
- }
469
- /**
470
- * Single data point for dashboard time-series charts.
471
- */
472
- export interface ChartDataPoint {
473
- bucket: string;
474
- total: number;
475
- count2xx: number;
476
- count3xx: number;
477
- count4xx: number;
478
- count5xx: number;
479
- requestCount?: number;
480
- errorCount?: number;
481
- avgDuration?: number;
482
- p95Duration?: number;
483
- }
484
- /**
485
- * A grouped/aggregated query pattern for the dashboard queries section.
486
- */
487
- export interface GroupedQuery {
488
- pattern: string;
489
- count: number;
490
- avgDuration: number;
491
- minDuration: number;
492
- maxDuration: number;
493
- totalDuration: number;
494
- percentOfTotal: number;
495
- }
496
- export type { Theme } from './theme.js';
497
- /**
498
- * Pagination state for table components.
499
- */
500
172
  export interface PaginationState {
501
- /** Current page number (1-based). */
502
173
  page: number;
503
- /** Number of items per page. */
504
174
  perPage: number;
505
- /** Total number of items across all pages. */
506
175
  total: number;
507
- /** Total number of pages. */
508
176
  totalPages: number;
509
177
  }
510
- /**
511
- * Filter state for table components.
512
- */
513
178
  export interface FilterState {
514
- /** Free-text search query. */
515
179
  search: string;
516
- /** Key-value filter pairs (e.g. `{ status: '500', method: 'GET' }`). */
517
180
  filters: Record<string, string>;
518
181
  }
519
- /**
520
- * Sort state for table components.
521
- */
522
182
  export interface SortState {
523
- /** Column field name to sort by. */
524
183
  field: string;
525
- /** Sort direction. */
526
184
  direction: 'asc' | 'desc';
527
185
  }
528
- /**
529
- * Buffer usage info returned by the diagnostics endpoint.
530
- */
531
- export interface DiagnosticsBufferInfo {
532
- current: number;
533
- max: number;
534
- }
535
- /**
536
- * Collector metadata returned by the diagnostics endpoint.
537
- */
538
- export interface DiagnosticsCollectorInfo {
539
- name: string;
540
- label: string;
541
- status: 'healthy' | 'errored' | 'stopped';
542
- lastError: string | null;
543
- lastErrorAt: number | null;
544
- config: Record<string, unknown>;
545
- }
546
- /**
547
- * Timer state returned by the diagnostics endpoint.
548
- */
549
- export interface DiagnosticsTimerInfo {
550
- active: boolean;
551
- intervalMs?: number;
552
- debounceMs?: number;
553
- }
554
- /**
555
- * Full diagnostics response from `GET {debugEndpoint}/diagnostics`.
556
- *
557
- * Used by both React `InternalsContent` and Vue `InternalsTab` / `InternalsSection`.
558
- */
559
- export interface DiagnosticsResponse {
560
- package: {
561
- version: string;
562
- nodeVersion: string;
563
- adonisVersion: string;
564
- uptime?: number;
565
- };
566
- config: {
567
- intervalMs: number;
568
- transport: string;
569
- channelName: string;
570
- endpoint: string | false;
571
- skipInTest: boolean;
572
- hasOnStatsCallback: boolean;
573
- hasShouldShowCallback: boolean;
574
- };
575
- devToolbar: {
576
- enabled: boolean;
577
- maxQueries: number;
578
- maxEvents: number;
579
- maxEmails: number;
580
- maxTraces: number;
581
- slowQueryThresholdMs: number;
582
- tracing: boolean;
583
- dashboard: boolean;
584
- dashboardPath: string;
585
- debugEndpoint: string;
586
- retentionDays: number;
587
- dbPath: string;
588
- persistDebugData: boolean | string;
589
- renderer: string;
590
- excludeFromTracing: string[];
591
- customPaneCount: number;
592
- };
593
- collectors: DiagnosticsCollectorInfo[];
594
- buffers: Record<string, DiagnosticsBufferInfo>;
595
- timers: Record<string, DiagnosticsTimerInfo>;
596
- transmit: {
597
- available: boolean;
598
- channels: string[];
599
- };
600
- integrations: Record<string, {
601
- active?: boolean;
602
- available?: boolean;
603
- mode?: string;
604
- }>;
605
- storage: {
606
- ready: boolean;
607
- dbPath: string;
608
- fileSizeMb: number;
609
- walSizeMb: number;
610
- retentionDays: number;
611
- tables: Array<{
612
- name: string;
613
- rowCount: number;
614
- }>;
615
- lastCleanupAt: number | null;
616
- } | null;
617
- uptime?: number;
618
- }
186
+ export type { Theme } from './theme.js';
@@ -0,0 +1,135 @@
1
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
+ import { useState as c, useCallback as k } from "react";
3
+ import { formatCacheSize as x, formatTtl as D } from "adonisjs-server-stats/core";
4
+ import { a as N, J as V } from "./index-DwDK-4oX.js";
5
+ import { C as L } from "./CacheStatsBar-CRodCOeP.js";
6
+ import { D as F } from "./DataTable-YyShr5B-.js";
7
+ import { F as T } from "./FilterBar-CQ7bD669.js";
8
+ function _({ options: v = {} }) {
9
+ const [d, b] = c(""), [l, i] = c(null), [w, n] = c(null), [C, h] = c(!1), [y, r] = c(null), { data: u, isLoading: g, mutate: m, getApi: p } = N("cache", {
10
+ ...v,
11
+ search: d
12
+ }), a = u, K = k(
13
+ async (e) => {
14
+ if (confirm(`Delete cache key "${e}"?`))
15
+ try {
16
+ await m(`cache/${encodeURIComponent(e)}`, "delete"), l === e && (i(null), n(null), r(null));
17
+ } catch {
18
+ }
19
+ },
20
+ [m, l]
21
+ ), S = k(
22
+ async (e) => {
23
+ if (l === e) {
24
+ i(null), n(null), r(null);
25
+ return;
26
+ }
27
+ i(e), n(null), r(null), h(!0);
28
+ try {
29
+ const s = await p().fetchCacheKey(e);
30
+ n(
31
+ s.value !== void 0 ? s.value : s.data !== void 0 ? s.data : s
32
+ ), r(null);
33
+ } catch {
34
+ n(null), r("Failed to fetch key value");
35
+ } finally {
36
+ h(!1);
37
+ }
38
+ },
39
+ [l, p]
40
+ );
41
+ return /* @__PURE__ */ o("div", { children: [
42
+ a?.available && a?.stats && /* @__PURE__ */ t(
43
+ L,
44
+ {
45
+ hitRate: a.stats.hitRate ?? 0,
46
+ hits: a.stats.hits ?? 0,
47
+ misses: a.stats.misses ?? 0,
48
+ keys: a.stats.totalKeys || a.stats.keyCount || a.keys?.length || 0
49
+ }
50
+ ),
51
+ /* @__PURE__ */ t(
52
+ T,
53
+ {
54
+ search: d,
55
+ onSearchChange: b,
56
+ placeholder: "Filter cache keys...",
57
+ summary: `${(a?.keys || a?.data || []).length} keys`
58
+ }
59
+ ),
60
+ g && !u ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading cache..." }) : !a || !a.available ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Cache inspector not available" }) : /* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
61
+ F,
62
+ {
63
+ columns: [
64
+ {
65
+ key: "key",
66
+ label: "Key",
67
+ render: (e) => /* @__PURE__ */ t(
68
+ "span",
69
+ {
70
+ title: e,
71
+ style: {
72
+ color: "var(--ss-sql-color)",
73
+ overflow: "hidden",
74
+ textOverflow: "ellipsis",
75
+ whiteSpace: "nowrap",
76
+ display: "block"
77
+ },
78
+ children: e
79
+ }
80
+ )
81
+ },
82
+ {
83
+ key: "type",
84
+ label: "Type",
85
+ width: "70px",
86
+ render: (e) => /* @__PURE__ */ t("span", { style: { color: "var(--ss-muted)" }, children: e })
87
+ },
88
+ {
89
+ key: "size",
90
+ label: "Size",
91
+ width: "60px",
92
+ render: (e) => e != null && e > 0 ? x(e) : "-"
93
+ },
94
+ {
95
+ key: "ttl",
96
+ label: "TTL",
97
+ width: "70px",
98
+ render: (e) => e > 0 ? D(e) : "-"
99
+ },
100
+ {
101
+ key: "_actions",
102
+ label: "",
103
+ width: "60px",
104
+ render: (e, f) => /* @__PURE__ */ t(
105
+ "button",
106
+ {
107
+ type: "button",
108
+ className: "ss-dash-retry-btn",
109
+ onClick: (s) => {
110
+ s.stopPropagation(), K(f.key);
111
+ },
112
+ children: "Delete"
113
+ }
114
+ )
115
+ }
116
+ ],
117
+ data: a.keys || a.data || [],
118
+ keyField: "key",
119
+ onRowClick: (e) => S(e.key),
120
+ emptyMessage: "No cache keys found"
121
+ }
122
+ ) }),
123
+ l && /* @__PURE__ */ o("div", { className: "ss-dash-cache-detail", children: [
124
+ /* @__PURE__ */ o("h4", { children: [
125
+ "Key: ",
126
+ l
127
+ ] }),
128
+ C ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading value..." }) : y ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", style: { color: "var(--ss-red-fg)" }, children: y }) : /* @__PURE__ */ t(V, { data: w })
129
+ ] })
130
+ ] });
131
+ }
132
+ export {
133
+ _ as CacheSection,
134
+ _ as default
135
+ };