adonisjs-server-stats 1.13.0 → 1.14.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 (150) hide show
  1. package/README.md +3 -2
  2. package/dist/configure.js +6 -1
  3. package/dist/core/collectors/collector.d.ts +83 -0
  4. package/dist/core/core/types.d.ts +186 -0
  5. package/dist/core/debug/types.d.ts +467 -0
  6. package/dist/core/index.js +184 -169
  7. package/dist/core/types.d.ts +855 -167
  8. package/dist/react/{CacheSection-CX2duJuc.js → CacheSection-DkLtukWz.js} +1 -1
  9. package/dist/react/{CacheTab-CgT4t0oZ.js → CacheTab-DWeXnEBI.js} +51 -46
  10. package/dist/react/ConfigContent-Bwvfl_G7.js +350 -0
  11. package/dist/react/{ConfigSection-Dt0FyeaW.js → ConfigSection-DaVbFPDg.js} +2 -2
  12. package/dist/react/{ConfigTab-KtiTtsrj.js → ConfigTab-D4640WJZ.js} +2 -2
  13. package/dist/react/{CustomPaneTab-15QoEplP.js → CustomPaneTab-DglmAVMC.js} +1 -1
  14. package/dist/react/{EmailsSection-YcJYR5eA.js → EmailsSection-vYx6ExTb.js} +1 -1
  15. package/dist/react/{EmailsTab-CUjubln_.js → EmailsTab-DKDrRmRH.js} +54 -49
  16. package/dist/react/{EventsSection-GGPoYSNv.js → EventsSection-CapH5xut.js} +1 -1
  17. package/dist/react/{EventsTab-Wdwr0_ny.js → EventsTab-BNVEySAm.js} +1 -1
  18. package/dist/react/{InternalsContent-BNOnSoi9.js → InternalsContent-C9lIA92C.js} +1 -1
  19. package/dist/react/{InternalsSection-BwrTfpjA.js → InternalsSection-lOv_UcSV.js} +1 -1
  20. package/dist/react/{InternalsTab--RD-L1dX.js → InternalsTab-BygoSorC.js} +1 -1
  21. package/dist/react/{JobsSection-BqqIh_DR.js → JobsSection-ZIQsJWid.js} +1 -1
  22. package/dist/react/{JobsTab-CBrU-ryL.js → JobsTab-DXQzXrDt.js} +1 -1
  23. package/dist/react/{LogEntryRow-BOrRkhRU.js → LogEntryRow-BWkHE51-.js} +1 -1
  24. package/dist/react/{LogsSection-Cm_lphM6.js → LogsSection-ConXdBkL.js} +2 -2
  25. package/dist/react/LogsTab-CJM47LPn.js +82 -0
  26. package/dist/react/{OverviewSection-XF7bakyM.js → OverviewSection-DOMu2qvl.js} +131 -131
  27. package/dist/react/{QueriesSection-DsQBKrNK.js → QueriesSection-DFsaOSJI.js} +1 -1
  28. package/dist/react/{QueriesTab-CxCC1GVq.js → QueriesTab-CY9CG_7L.js} +1 -1
  29. package/dist/react/RequestsSection-CC-eVHsl.js +326 -0
  30. package/dist/react/{RoutesSection-D0y5JQP4.js → RoutesSection-p1DMq41y.js} +1 -1
  31. package/dist/react/{RoutesTab-Y_alJVMV.js → RoutesTab-Cnqy8UcK.js} +1 -1
  32. package/dist/react/{SplitPaneWrapper-CZl1ouIT.js → SplitPaneWrapper-XgkA0QxE.js} +1 -1
  33. package/dist/react/{TimelineTab-HyqZpfbp.js → TimelineTab-1YOERxe5.js} +3 -3
  34. package/dist/react/index-DOSlCpZ9.js +1159 -0
  35. package/dist/react/index.js +1 -1
  36. package/dist/react/useApiClient-CtEG7rHs.js +11 -0
  37. package/dist/src/collectors/queue_collector.js +22 -6
  38. package/dist/src/config/deprecation_migration.js +11 -0
  39. package/dist/src/dashboard/cache_handlers.js +22 -2
  40. package/dist/src/dashboard/flush_manager.d.ts +2 -0
  41. package/dist/src/dashboard/flush_manager.js +17 -0
  42. package/dist/src/dashboard/integrations/config_inspector.d.ts +0 -1
  43. package/dist/src/dashboard/integrations/config_inspector.js +4 -2
  44. package/dist/src/dashboard/paginate_helper.d.ts +5 -0
  45. package/dist/src/dashboard/paginate_helper.js +16 -4
  46. package/dist/src/dashboard/query_explain_handler.d.ts +6 -1
  47. package/dist/src/dashboard/query_explain_handler.js +12 -2
  48. package/dist/src/dashboard/write_queue.d.ts +13 -0
  49. package/dist/src/dashboard/write_queue.js +34 -2
  50. package/dist/src/debug/debug_store.js +8 -1
  51. package/dist/src/debug/event_collector.js +4 -0
  52. package/dist/src/debug/query_collector.js +2 -0
  53. package/dist/src/debug/ring_buffer.js +8 -1
  54. package/dist/src/debug/trace_collector.js +34 -10
  55. package/dist/src/debug/types.d.ts +2 -0
  56. package/dist/src/define_config.js +1 -0
  57. package/dist/src/edge/client/dashboard.js +2 -2
  58. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  59. package/dist/src/edge/client/stats-bar.js +1 -1
  60. package/dist/src/edge/client-vue/dashboard.js +5 -5
  61. package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
  62. package/dist/src/engine/request_metrics.js +8 -10
  63. package/dist/src/log_stream/log_stream_service.d.ts +1 -0
  64. package/dist/src/log_stream/log_stream_service.js +7 -5
  65. package/dist/src/prometheus/prometheus_collector.d.ts +9 -0
  66. package/dist/src/prometheus/prometheus_collector.js +11 -0
  67. package/dist/src/provider/dashboard_init.js +15 -0
  68. package/dist/src/provider/dashboard_setup.js +9 -2
  69. package/dist/src/provider/email_bridge.js +6 -2
  70. package/dist/src/provider/email_helpers.d.ts +9 -1
  71. package/dist/src/provider/email_helpers.js +32 -4
  72. package/dist/src/provider/pino_hook.d.ts +8 -0
  73. package/dist/src/provider/pino_hook.js +19 -1
  74. package/dist/src/provider/provider_helpers_extra.d.ts +2 -0
  75. package/dist/src/provider/provider_helpers_extra.js +17 -2
  76. package/dist/src/provider/server_stats_provider.js +19 -1
  77. package/dist/src/provider/shutdown_helpers.js +2 -0
  78. package/dist/src/provider/toolbar_setup.js +17 -14
  79. package/dist/src/routes/dashboard_routes.js +96 -62
  80. package/dist/src/routes/debug_routes.js +45 -35
  81. package/dist/src/routes/no_session_middleware.d.ts +6 -3
  82. package/dist/src/routes/no_session_middleware.js +7 -3
  83. package/dist/src/routes/register_routes.d.ts +8 -0
  84. package/dist/src/routes/register_routes.js +19 -0
  85. package/dist/src/types.d.ts +31 -0
  86. package/dist/src/utils/app_import.js +12 -4
  87. package/dist/vue/CacheSection-CxEBVVkF.js +156 -0
  88. package/dist/vue/ConfigSection-BiRAiaHj.js +415 -0
  89. package/dist/vue/EmailsSection-Dl44qyqY.js +208 -0
  90. package/dist/vue/{EmailsTab-CwIF1fik.js → EmailsTab-Diya54CP.js} +6 -5
  91. package/dist/vue/{EventsSection-BpgkWIwM.js → EventsSection-CWjeitjU.js} +1 -1
  92. package/dist/vue/{InternalsTab-521fxYYj.js → InternalsTab-Z3c82glB.js} +15 -15
  93. package/dist/vue/{JobsSection-DrghFEKL.js → JobsSection-DOBb4LjZ.js} +1 -1
  94. package/dist/vue/LogsSection-CXx-HOWJ.js +260 -0
  95. package/dist/vue/{OverviewSection-BAgZTPjY.js → OverviewSection-CyfNQ8uV.js} +318 -302
  96. package/dist/vue/{QueriesSection-CUpwhp7u.js → QueriesSection-CXBsFp-y.js} +1 -1
  97. package/dist/vue/{RequestsSection-D8P2xpF2.js → RequestsSection-YTIaZGZd.js} +151 -145
  98. package/dist/vue/{RoutesSection-0qB81hTT.js → RoutesSection-CDKMey49.js} +1 -1
  99. package/dist/vue/composables/useApiClient.d.ts +8 -1
  100. package/dist/vue/index-14x39RI_.js +1239 -0
  101. package/dist/vue/index.js +1 -1
  102. package/dist/vue/style.css +1 -1
  103. package/package.json +6 -3
  104. package/dist/react/ConfigContent-CnsEI4j3.js +0 -397
  105. package/dist/react/LogsTab-jKwv9G7Q.js +0 -79
  106. package/dist/react/RequestsSection-D8cMbZU0.js +0 -321
  107. package/dist/react/index-CsprmgzI.js +0 -1121
  108. package/dist/react/useApiClient-BVtNCmnL.js +0 -9
  109. package/dist/vue/CacheSection-DRqV3YX2.js +0 -149
  110. package/dist/vue/ConfigSection-C6pQCHAL.js +0 -576
  111. package/dist/vue/EmailsSection-BTNw3ZU2.js +0 -206
  112. package/dist/vue/LogsSection-BDxx9Bfi.js +0 -258
  113. package/dist/vue/index-30jLw-_w.js +0 -1232
  114. /package/dist/core/{api-client.d.ts → core/api-client.d.ts} +0 -0
  115. /package/dist/core/{config-utils.d.ts → core/config-utils.d.ts} +0 -0
  116. /package/dist/core/{constants.d.ts → core/constants.d.ts} +0 -0
  117. /package/dist/core/{dashboard-api.d.ts → core/dashboard-api.d.ts} +0 -0
  118. /package/dist/core/{dashboard-data-controller.d.ts → core/dashboard-data-controller.d.ts} +0 -0
  119. /package/dist/core/{dashboard-data-helpers.d.ts → core/dashboard-data-helpers.d.ts} +0 -0
  120. /package/dist/core/{debug-data-controller.d.ts → core/debug-data-controller.d.ts} +0 -0
  121. /package/dist/core/{define-config-helpers.d.ts → core/define-config-helpers.d.ts} +0 -0
  122. /package/dist/core/{explain-utils.d.ts → core/explain-utils.d.ts} +0 -0
  123. /package/dist/core/{feature-detect-helpers.d.ts → core/feature-detect-helpers.d.ts} +0 -0
  124. /package/dist/core/{feature-detect.d.ts → core/feature-detect.d.ts} +0 -0
  125. /package/dist/core/{field-resolvers.d.ts → core/field-resolvers.d.ts} +0 -0
  126. /package/dist/core/{formatters-helpers.d.ts → core/formatters-helpers.d.ts} +0 -0
  127. /package/dist/core/{formatters.d.ts → core/formatters.d.ts} +0 -0
  128. /package/dist/core/{history-buffer.d.ts → core/history-buffer.d.ts} +0 -0
  129. /package/dist/core/{icons.d.ts → core/icons.d.ts} +0 -0
  130. /package/dist/core/{index.d.ts → core/index.d.ts} +0 -0
  131. /package/dist/core/{internals-utils.d.ts → core/internals-utils.d.ts} +0 -0
  132. /package/dist/core/{job-utils.d.ts → core/job-utils.d.ts} +0 -0
  133. /package/dist/core/{log-utils-helpers.d.ts → core/log-utils-helpers.d.ts} +0 -0
  134. /package/dist/core/{log-utils.d.ts → core/log-utils.d.ts} +0 -0
  135. /package/dist/core/{metrics.d.ts → core/metrics.d.ts} +0 -0
  136. /package/dist/core/{pagination.d.ts → core/pagination.d.ts} +0 -0
  137. /package/dist/core/{queries-columns.d.ts → core/queries-columns.d.ts} +0 -0
  138. /package/dist/core/{queries-controller.d.ts → core/queries-controller.d.ts} +0 -0
  139. /package/dist/core/{query-utils.d.ts → core/query-utils.d.ts} +0 -0
  140. /package/dist/core/{resizable-columns.d.ts → core/resizable-columns.d.ts} +0 -0
  141. /package/dist/core/{routes.d.ts → core/routes.d.ts} +0 -0
  142. /package/dist/core/{server-stats-controller.d.ts → core/server-stats-controller.d.ts} +0 -0
  143. /package/dist/core/{sparkline.d.ts → core/sparkline.d.ts} +0 -0
  144. /package/dist/core/{split-pane.d.ts → core/split-pane.d.ts} +0 -0
  145. /package/dist/core/{theme.d.ts → core/theme.d.ts} +0 -0
  146. /package/dist/core/{trace-utils.d.ts → core/trace-utils.d.ts} +0 -0
  147. /package/dist/core/{transmit-adapter.d.ts → core/transmit-adapter.d.ts} +0 -0
  148. /package/dist/core/{transmit-helpers.d.ts → core/transmit-helpers.d.ts} +0 -0
  149. /package/dist/core/{types-dashboard.d.ts → core/types-dashboard.d.ts} +0 -0
  150. /package/dist/core/{types-diagnostics.d.ts → core/types-diagnostics.d.ts} +0 -0
package/README.md CHANGED
@@ -180,6 +180,7 @@ All fields are optional. `defineConfig({})` works with zero configuration.
180
180
  | `realtime` | `boolean` | `true` | `true` = SSE via Transmit, `false` = poll-only |
181
181
  | `statsEndpoint` | `string \| false` | `'/admin/api/server-stats'` | HTTP endpoint. `false` to disable. |
182
182
  | `authorize` | `(ctx) => boolean` | -- | Per-request visibility guard |
183
+ | `unsafeAllowNoAuth` | `boolean` | `false` | Register the dashboard/debug/stats routes even with **no** `authorize` guard. Off by default (routes fail closed). Local dev only — exposes secrets, email bodies, and SQL. |
183
184
  | `onStats` | `(stats) => void` | -- | Callback after each collection tick |
184
185
  | `toolbar` | `boolean \| ToolbarConfig` | -- | `true` to enable with defaults, or pass a `ToolbarConfig` object |
185
186
  | `dashboard` | `boolean \| DashboardConfig` | -- | `true` to enable at `/__stats`, or pass a `DashboardConfig` |
@@ -376,9 +377,9 @@ export default defineConfig({
376
377
  })
377
378
  ```
378
379
 
379
- > **Tip:** When `authorize` is not set, the bar and all routes are accessible to everyone. In production you almost always want to set this.
380
+ > **Fail closed:** When neither `authorize` nor `shouldShow` is set, the dashboard, debug API, and stats routes are **not registered at all** and a warning is logged. To run without a guard during local development, set `unsafeAllowNoAuth: true` — this exposes secrets, email bodies, and SQL to anyone who can reach the routes, so never use it outside strictly local dev.
380
381
  >
381
- > **Migration note:** `shouldShow` still works as a deprecated alias for `authorize`. Both have the same signature and behavior.
382
+ > **Migration note:** `shouldShow` still works as a deprecated alias for `authorize` same signature, same behavior, and it fully satisfies the guard requirement above. If you already set `shouldShow` (or `authorize`), this change does not affect you; you'll only see a one-time rename hint at boot.
382
383
 
383
384
  ---
384
385
 
package/dist/configure.js CHANGED
@@ -3,9 +3,14 @@ export async function configure(command) {
3
3
  const codemods = await command.createCodemods();
4
4
  // Publish config file
5
5
  await codemods.makeUsingStub(stubsRoot(), 'config.stub', {});
6
+ // The log-stream provider relies on @adonisjs/transmit for live log
7
+ // streaming, so only register it when the user opts in.
8
+ const enableLogStream = await command.prompt.confirm('Register the log-stream provider? (requires @adonisjs/transmit for live log streaming)', { default: false });
6
9
  // Register provider in adonisrc.ts
7
10
  await codemods.updateRcFile((rcFile) => {
8
11
  rcFile.addProvider('adonisjs-server-stats/provider', ['web']);
9
- rcFile.addProvider('adonisjs-server-stats/log-stream/provider', ['web']);
12
+ if (enableLogStream) {
13
+ rcFile.addProvider('adonisjs-server-stats/log-stream/provider', ['web']);
14
+ }
10
15
  });
11
16
  }
@@ -0,0 +1,83 @@
1
+ import { MetricValue } from '../types.js';
2
+ /**
3
+ * Interface that all metric collectors must implement.
4
+ *
5
+ * A collector is responsible for gathering a specific set of metrics
6
+ * (e.g. CPU, memory, HTTP stats) and returning them as a flat
7
+ * key-value record. The {@link StatsEngine} runs all configured
8
+ * collectors in parallel each tick and merges their results into
9
+ * a single {@link ServerStats} snapshot.
10
+ *
11
+ * @example Creating a custom collector
12
+ * ```ts
13
+ * import type { MetricCollector } from 'adonisjs-server-stats/collectors'
14
+ *
15
+ * function diskCollector(): MetricCollector {
16
+ * return {
17
+ * name: 'disk',
18
+ * async collect() {
19
+ * const { availableSpace, totalSpace } = await getDiskInfo()
20
+ * return {
21
+ * diskAvailableGb: availableSpace / 1e9,
22
+ * diskTotalGb: totalSpace / 1e9,
23
+ * diskUsagePercent: ((totalSpace - availableSpace) / totalSpace) * 100,
24
+ * }
25
+ * },
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ export interface MetricCollector {
31
+ /**
32
+ * Unique name identifying this collector.
33
+ *
34
+ * Used for logging and debugging. Built-in collectors use names
35
+ * like `'process'`, `'http'`, `'redis'`, etc.
36
+ */
37
+ name: string;
38
+ /**
39
+ * Short description shown in the startup log.
40
+ *
41
+ * Include key options so the developer can verify the collector
42
+ * is configured correctly at a glance.
43
+ *
44
+ * @example `'http — buffer: 10k, window: 60s'`
45
+ */
46
+ label?: string;
47
+ /**
48
+ * Called once when the {@link StatsEngine} starts.
49
+ *
50
+ * Use this to initialize resources (e.g. start monitoring the
51
+ * event loop, open file handles, connect to external services).
52
+ */
53
+ start?(): void | Promise<void>;
54
+ /**
55
+ * Called once when the {@link StatsEngine} stops (during app shutdown).
56
+ *
57
+ * Use this to clean up resources (e.g. close connections, clear timers).
58
+ */
59
+ stop?(): void | Promise<void>;
60
+ /**
61
+ * Return collector-specific configuration for diagnostics.
62
+ *
63
+ * Used by the Internals diagnostics endpoint to show resolved
64
+ * configuration for each collector. Sensitive values (e.g. passwords)
65
+ * should be redacted.
66
+ */
67
+ getConfig?(): Record<string, unknown>;
68
+ /**
69
+ * Collect metrics and return them as a flat key-value record.
70
+ *
71
+ * Called every tick (default: every 3 seconds). The engine calls
72
+ * all collectors in parallel via `Promise.all`, so this method
73
+ * should be as fast as possible.
74
+ *
75
+ * If the collector throws, the engine catches the error and
76
+ * proceeds with the remaining collectors (the failing collector's
77
+ * metrics will be missing from that tick).
78
+ *
79
+ * @returns A flat record of metric values. Keys should be unique
80
+ * across all collectors to avoid collisions when merged.
81
+ */
82
+ collect(): Record<string, MetricValue> | Promise<Record<string, MetricValue>>;
83
+ }
@@ -0,0 +1,186 @@
1
+ import { ServerStats } from '../types.js';
2
+ export type { ServerStats, MetricValue, ServerStatsConfig, ResolvedServerStatsConfig, DevToolbarOptions, ToolbarConfig, AdvancedConfig, } from '../types.js';
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';
6
+ /**
7
+ * Props / config for the `<ServerStatsBar />` component.
8
+ */
9
+ export interface StatsBarProps {
10
+ /** Base URL for API calls. Defaults to `''` (same origin). */
11
+ baseUrl?: string;
12
+ /** Stats endpoint path. Defaults to `'/admin/api/server-stats'`. */
13
+ endpoint?: string;
14
+ /** Transmit channel name. Defaults to `'admin/server-stats'`. */
15
+ channelName?: string;
16
+ /** Optional auth token for Bearer auth (auto-detects cookies if omitted). */
17
+ authToken?: string;
18
+ /** Polling interval fallback in ms. Defaults to `3000`. */
19
+ pollInterval?: number;
20
+ /** CSS class overrides for the root element. */
21
+ className?: string;
22
+ }
23
+ /** Props for the `<DebugPanel />` component. */
24
+ export interface DebugPanelProps {
25
+ baseUrl?: string;
26
+ debugEndpoint?: string;
27
+ authToken?: string;
28
+ className?: string;
29
+ }
30
+ /** Props for the `<DashboardPage />` component. */
31
+ export interface DashboardPageProps {
32
+ baseUrl?: string;
33
+ dashboardEndpoint?: string;
34
+ authToken?: string;
35
+ channelName?: string;
36
+ className?: string;
37
+ }
38
+ /** Alias for {@link StatsBarProps}. Used by Vue components as config type. */
39
+ export interface StatsBarConfig extends StatsBarProps {
40
+ debugEndpoint?: string;
41
+ }
42
+ /** Alias for {@link DebugPanelProps}. Used by Vue components as config type. */
43
+ export interface DebugPanelConfig extends DebugPanelProps {
44
+ dashboardPath?: string;
45
+ tracingEnabled?: boolean;
46
+ isLive?: boolean;
47
+ }
48
+ /** Alias for {@link DashboardPageProps}. Used by Vue components as config type. */
49
+ export interface DashboardConfig extends DashboardPageProps {
50
+ tracingEnabled?: boolean;
51
+ }
52
+ /**
53
+ * Shape returned by `GET {debugEndpoint}/config`.
54
+ */
55
+ export interface FeatureFlags {
56
+ features: {
57
+ statsBar: boolean;
58
+ debugPanel: boolean;
59
+ dashboard: boolean;
60
+ tracing: boolean;
61
+ process: boolean;
62
+ system: boolean;
63
+ http: boolean;
64
+ db: boolean;
65
+ redis: boolean;
66
+ queues: boolean;
67
+ cache: boolean;
68
+ app: boolean;
69
+ log: boolean;
70
+ emails: boolean;
71
+ };
72
+ customPanes: import('../debug/types.js').DebugPane[];
73
+ endpoints: {
74
+ stats: string;
75
+ debug: string;
76
+ dashboard: string;
77
+ };
78
+ transmit: {
79
+ channelName: string;
80
+ };
81
+ }
82
+ /**
83
+ * Flattened feature config used by Vue composables.
84
+ */
85
+ export interface FeatureConfig {
86
+ tracing: boolean;
87
+ process: boolean;
88
+ system: boolean;
89
+ http: boolean;
90
+ db: boolean;
91
+ redis: boolean;
92
+ queues: boolean;
93
+ cache: boolean;
94
+ app: boolean;
95
+ log: boolean;
96
+ emails: boolean;
97
+ dashboard: boolean;
98
+ customPanes: import('../debug/types.js').DebugPane[];
99
+ }
100
+ /** Threshold color result. */
101
+ export type ThresholdColor = 'green' | 'amber' | 'red';
102
+ /**
103
+ * Definition for a single metric displayed in the stats bar.
104
+ */
105
+ export interface MetricDefinition {
106
+ id: string;
107
+ label: string;
108
+ title?: string;
109
+ unit: string;
110
+ group?: string;
111
+ warnThreshold?: number;
112
+ critThreshold?: number;
113
+ inverseThreshold?: boolean;
114
+ extract: (stats: ServerStats) => number | undefined;
115
+ format: (stats: ServerStats) => string;
116
+ value?: (stats: ServerStats) => string;
117
+ color?: (stats: ServerStats) => string;
118
+ detail?: string | ((stats: ServerStats) => string | null);
119
+ historyKey?: string | undefined;
120
+ show?: (stats: ServerStats) => boolean;
121
+ }
122
+ /** Options for SVG sparkline rendering. */
123
+ export interface SparklineOptions {
124
+ color?: string;
125
+ fillOpacityTop?: number;
126
+ fillOpacityBottom?: number;
127
+ strokeWidth?: number;
128
+ width?: number;
129
+ height?: number;
130
+ padding?: number;
131
+ }
132
+ /**
133
+ * Options for the `useDashboardData` hook.
134
+ */
135
+ export interface DashboardHookOptions extends DashboardPageProps {
136
+ page?: number;
137
+ perPage?: number;
138
+ search?: string;
139
+ sort?: string;
140
+ sortDir?: 'asc' | 'desc';
141
+ filters?: Record<string, string>;
142
+ timeRange?: TimeRange;
143
+ refreshKey?: number;
144
+ }
145
+ export type DebugTab = 'timeline' | 'queries' | 'events' | 'routes' | 'logs' | 'emails' | 'cache' | 'jobs' | (string & {});
146
+ export type DashboardSection = 'overview' | 'requests' | 'queries' | 'events' | 'routes' | 'logs' | 'emails' | 'cache' | 'jobs' | 'config' | (string & {});
147
+ export type TimeRange = '5m' | '15m' | '30m' | '1h' | '6h' | '24h' | '7d';
148
+ export interface PaginatedResponse<T> {
149
+ data: T[];
150
+ meta: {
151
+ total: number;
152
+ page: number;
153
+ perPage: number;
154
+ lastPage: number;
155
+ };
156
+ }
157
+ export interface CacheStats {
158
+ hitRate: number;
159
+ totalHits: number;
160
+ totalMisses: number;
161
+ keys: CacheEntry[];
162
+ keyCount?: number;
163
+ memoryUsedMb?: number;
164
+ }
165
+ export interface CacheEntry {
166
+ key: string;
167
+ type: string;
168
+ ttl: number;
169
+ size: number;
170
+ value?: string | number | boolean | Record<string, unknown> | unknown[] | null;
171
+ }
172
+ export interface PaginationState {
173
+ page: number;
174
+ perPage: number;
175
+ total: number;
176
+ totalPages: number;
177
+ }
178
+ export interface FilterState {
179
+ search: string;
180
+ filters: Record<string, string>;
181
+ }
182
+ export interface SortState {
183
+ field: string;
184
+ direction: 'asc' | 'desc';
185
+ }
186
+ export type { Theme } from './theme.js';