adonisjs-server-stats 1.10.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 +594 -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/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 +10 -442
- package/dist/react/{CacheSection-UCMptWyn.js → CacheSection-baMZotSn.js} +2 -2
- package/dist/react/CacheTab-2cw_rMzj.js +117 -0
- package/dist/react/{ConfigSection-DfFd-WRq.js → ConfigSection-DGgqjAal.js} +1 -1
- package/dist/react/{ConfigTab-Bdg8YMer.js → ConfigTab-H3OnYqmK.js} +1 -1
- package/dist/react/CustomPaneTab-B6r7ha0u.js +98 -0
- package/dist/react/{EmailsSection-CM7stSyh.js → EmailsSection-C-UZISG-.js} +2 -2
- package/dist/react/EmailsTab-DbK4Eobn.js +139 -0
- package/dist/react/{EventsSection-ByQ-9blq.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-DF3qEv9O.js → JobsSection-CQHNK_Ls.js} +2 -2
- package/dist/react/{JobsTab-BbrBWIOb.js → JobsTab-znzf6jzk.js} +54 -42
- package/dist/react/{LogsSection-DcFTZY7b.js → LogsSection-Dmm3rE2B.js} +9 -3
- package/dist/react/LogsTab-D8unMV5P.js +108 -0
- package/dist/react/{OverviewSection-C4T1ur51.js → OverviewSection-ABP9ueBo.js} +1 -1
- package/dist/react/{QueriesSection-PswteoF9.js → QueriesSection-CnmSkznA.js} +2 -2
- package/dist/react/{QueriesTab-osLUWd4L.js → QueriesTab-BQzcxEiW.js} +37 -40
- package/dist/react/{RelatedLogs-DFDOyUMr.js → RelatedLogs-3A8RuGKH.js} +15 -3
- package/dist/react/{RequestsSection-Nag30rEA.js → RequestsSection-kW79_M7k.js} +3 -3
- package/dist/react/{RoutesSection-BUSkM6PY.js → RoutesSection-BRhxrtjZ.js} +2 -2
- package/dist/react/RoutesTab-CpYH5lUw.js +68 -0
- package/dist/react/{TimelineTab-Covg5weo.js → TimelineTab-DjLR35Ce.js} +47 -53
- 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/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 +51 -544
- 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 -218
- package/dist/src/dashboard/dashboard_store.js +115 -1116
- 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 -159
- 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 +2 -39
- package/dist/src/data/data_access.js +17 -193
- 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 +9 -1
- package/dist/src/debug/trace_collector.js +21 -15
- package/dist/src/debug/types.d.ts +1 -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 +2 -8
- package/dist/src/middleware/request_tracking_middleware.js +65 -93
- 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 +132 -951
- 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 -352
- 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 +96 -0
- package/dist/src/styles/dashboard.css +8 -90
- package/dist/src/styles/debug-panel.css +1 -31
- package/dist/src/types.d.ts +305 -14
- package/dist/vue/{CacheSection-oFAJL3mo.js → CacheSection-ITqvpfH5.js} +1 -1
- package/dist/vue/{ConfigSection-BhfJ4KqL.js → ConfigSection-DTn3GslE.js} +1 -1
- package/dist/vue/{EmailsSection-BcNyhyHs.js → EmailsSection-DtLJ4XoS.js} +1 -1
- package/dist/vue/{EventsSection-r60Q5Lmu.js → EventsSection-BOYYz0Ty.js} +1 -1
- package/dist/vue/{JobsSection-BHL-hkQw.js → JobsSection-BazTxcJL.js} +1 -1
- package/dist/vue/{LogsSection-DRMGzJmg.js → LogsSection-D55PjTKX.js} +9 -3
- package/dist/vue/{LogsTab-Bg3o0Mm6.js → LogsTab-47zEK7jL.js} +4 -1
- package/dist/vue/{OverviewSection-CXh6Ja1B.js → OverviewSection-1uBKo-Tu.js} +1 -1
- package/dist/vue/{QueriesSection-IodIsCJ-.js → QueriesSection-rpoZ4ogd.js} +1 -1
- package/dist/vue/{RequestsSection-BPuMdmMc.js → RequestsSection-x7LvT0MC.js} +1 -1
- package/dist/vue/{RoutesSection-NKo3Rbq3.js → RoutesSection-CCD0zZqQ.js} +1 -1
- 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-CA8LB1J5.js +0 -123
- package/dist/react/CustomPaneTab-Bxtv_8Rw.js +0 -104
- package/dist/react/EmailsTab-BDhEiomM.js +0 -153
- package/dist/react/EventsTab-CMfY98Rl.js +0 -63
- package/dist/react/LogsTab-CicucmVk.js +0 -103
- package/dist/react/RoutesTab-DgVzd2PZ.js +0 -74
- package/dist/react/index-Cflz9Ebj.js +0 -1069
- package/dist/vue/index-Dtgysd26.js +0 -1229
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://adonisjs.com/)
|
|
8
8
|
[](https://adonisjs.com/)
|
|
9
9
|
|
|
10
|
-
A Laravel Telescope-inspired dev toolbar and real-time server monitor for **AdonisJS v6**.
|
|
10
|
+
A Laravel Telescope-inspired dev toolbar and real-time server monitor for **AdonisJS v6 & v7**.
|
|
11
11
|
|
|
12
12
|
Drop a single Edge tag into your layout and get a live stats bar showing CPU, memory, requests/sec, database pool, Redis, queues, and logs -- plus a full debug toolbar with SQL query inspection, event tracing, route listing, live log tailing, and custom panels.
|
|
13
13
|
|
|
@@ -178,7 +178,7 @@ All fields are optional. `defineConfig({})` works with zero configuration.
|
|
|
178
178
|
| Option | Type | Default | Description |
|
|
179
179
|
| -------------------- | ---------- | ------------------------------------------------- | ----------------------------------------------- |
|
|
180
180
|
| `slowQueryThreshold` | `number` | `100` | Slow query threshold (ms) |
|
|
181
|
-
| `tracing` | `boolean` | `
|
|
181
|
+
| `tracing` | `boolean` | `true` | Enable per-request tracing with timeline |
|
|
182
182
|
| `persist` | `boolean` | `false` | Persist debug data to disk across restarts |
|
|
183
183
|
| `panes` | `DebugPane[]` | -- | Custom debug panel tabs |
|
|
184
184
|
| `excludeFromTracing` | `string[]` | `['/admin/api/debug', '/admin/api/server-stats']` | URL prefixes to exclude from tracing/persistence |
|
|
@@ -231,7 +231,7 @@ The following field names still work but will show deprecation warnings at boot.
|
|
|
231
231
|
| `maxEmails` | `number` | `100` | Max emails to buffer |
|
|
232
232
|
| `slowQueryThresholdMs` | `number` | `100` | Slow query threshold (ms) |
|
|
233
233
|
| `persistDebugData` | `boolean \| string` | `false` | Persist debug data to disk across restarts. `true` writes to `.adonisjs/server-stats/debug-data.json`, or pass a custom path. |
|
|
234
|
-
| `tracing` | `boolean` | `
|
|
234
|
+
| `tracing` | `boolean` | `true` | Enable per-request tracing with timeline visualization |
|
|
235
235
|
| `maxTraces` | `number` | `200` | Max request traces to buffer |
|
|
236
236
|
| `dashboard` | `boolean` | `false` | Enable the full-page dashboard (requires `better-sqlite3`) |
|
|
237
237
|
| `dashboardPath` | `string` | `'/__stats'` | URL path for the dashboard page |
|
|
@@ -381,16 +381,18 @@ Registered when `statsEndpoint` is a string (default: `/admin/api/server-stats`)
|
|
|
381
381
|
|
|
382
382
|
Registered when `toolbar` is enabled. Base path configurable via `advanced.debugEndpoint` (default: `/admin/api/debug`).
|
|
383
383
|
|
|
384
|
-
| Method | Path | Description
|
|
385
|
-
| ------ | --------------------- |
|
|
386
|
-
| GET | `/queries` | SQL queries with summary stats
|
|
387
|
-
| GET | `/events` | Application events
|
|
388
|
-
| GET | `/routes` | Registered route table
|
|
389
|
-
| GET | `/logs` |
|
|
390
|
-
| GET | `/emails` | Captured emails (stripped HTML)
|
|
391
|
-
| GET | `/emails/:id/preview` | Email HTML preview
|
|
392
|
-
| GET | `/traces` | Request traces
|
|
393
|
-
| GET | `/traces/:id` | Trace detail with spans
|
|
384
|
+
| Method | Path | Description |
|
|
385
|
+
| ------ | --------------------- | ---------------------------------------- |
|
|
386
|
+
| GET | `/queries` | SQL queries with summary stats |
|
|
387
|
+
| GET | `/events` | Application events |
|
|
388
|
+
| GET | `/routes` | Registered route table |
|
|
389
|
+
| GET | `/logs` | Paginated log entries (up to 200) |
|
|
390
|
+
| GET | `/emails` | Captured emails (stripped HTML) |
|
|
391
|
+
| GET | `/emails/:id/preview` | Email HTML preview |
|
|
392
|
+
| GET | `/traces` | Request traces with log correlation |
|
|
393
|
+
| GET | `/traces/:id` | Trace detail with spans and related logs |
|
|
394
|
+
| GET | `/config` | Debug store configuration |
|
|
395
|
+
| GET | `/diagnostics` | Provider diagnostics and status |
|
|
394
396
|
|
|
395
397
|
### Dashboard routes
|
|
396
398
|
|
|
@@ -415,6 +417,7 @@ Registered when `dashboard` is enabled. Base path configurable via `dashboard.pa
|
|
|
415
417
|
| GET | `/api/traces/:id` | Trace detail with spans |
|
|
416
418
|
| GET | `/api/cache` | Cache stats and key listing |
|
|
417
419
|
| GET | `/api/cache/:key` | Cache key detail |
|
|
420
|
+
| DELETE | `/api/cache/:key` | Delete a cache key |
|
|
418
421
|
| GET | `/api/jobs` | Job queue overview |
|
|
419
422
|
| GET | `/api/jobs/:id` | Job detail |
|
|
420
423
|
| POST | `/api/jobs/:id/retry` | Retry a failed job |
|
|
@@ -582,7 +585,7 @@ The React and Vue components share the same theme system as Edge. Dark/light pre
|
|
|
582
585
|
- The dashboard page is large — lazy-loading helps but initial bundle may be significant
|
|
583
586
|
- Some edge cases in custom pane rendering may not be fully covered yet
|
|
584
587
|
- Error boundaries are minimal — a bad API response may cause a blank panel
|
|
585
|
-
- Only tested with React 18
|
|
588
|
+
- Only tested with React 18/19 and Vue 3.3+
|
|
586
589
|
|
|
587
590
|
Found a bug? Have feedback? [Open an issue](https://github.com/simulieren/adonisjs-server-stats/issues) — it helps a lot.
|
|
588
591
|
|
|
@@ -714,6 +717,12 @@ const result = await trace('organization.fetchMembers', async () => {
|
|
|
714
717
|
|
|
715
718
|
If tracing is disabled or no request is active, `trace()` executes the function directly with no overhead.
|
|
716
719
|
|
|
720
|
+
#### Related Logs
|
|
721
|
+
|
|
722
|
+
When viewing a trace detail (either in the debug panel Timeline tab or the dashboard), related log entries are automatically correlated using the HTTP request ID (`ctx.request.id()`). Any logs emitted during the request appear in a "Related Logs" section below the waterfall chart.
|
|
723
|
+
|
|
724
|
+
This works with both SQLite persistence (joins on `http_request_id`) and in-memory mode (scans the log file for matching `request_id` entries). No configuration needed — if your app uses AdonisJS request IDs, correlation happens automatically.
|
|
725
|
+
|
|
717
726
|
### Full-Page Dashboard
|
|
718
727
|
|
|
719
728
|
The dashboard is a dedicated page that provides historical data, charts, query analysis, and integration inspectors -- all persisted to a local SQLite database. It's like having Laravel Telescope built into your dev toolbar.
|
|
@@ -20,6 +20,14 @@ export interface FormattedValue {
|
|
|
20
20
|
* Redacted objects have the shape `{ __redacted: true, display: string, value: string }`.
|
|
21
21
|
*/
|
|
22
22
|
export declare function isRedactedValue(val: ConfigValue): val is RedactedValue;
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a config value is a plain config object (not null, not an
|
|
25
|
+
* array, not a redacted value). This consolidates the repeated
|
|
26
|
+
* null/typeof/array/redacted checks into a single reusable guard.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPlainConfigObject(val: ConfigValue): val is {
|
|
29
|
+
[key: string]: ConfigValue;
|
|
30
|
+
};
|
|
23
31
|
/**
|
|
24
32
|
* Recursively flatten a nested config object into a list of dot-path entries.
|
|
25
33
|
*
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -8,3 +8,7 @@ export declare const DEBUG_REFRESH_MS = 3000;
|
|
|
8
8
|
export declare const SLOW_DURATION_MS = 100;
|
|
9
9
|
/** Duration (ms) above which a query/request is considered very slow. */
|
|
10
10
|
export declare const VERY_SLOW_DURATION_MS = 500;
|
|
11
|
+
/** Max data points in the sparkline history buffer per metric. */
|
|
12
|
+
export declare const MAX_HISTORY = 60;
|
|
13
|
+
/** Milliseconds after last success before connection is considered stale. */
|
|
14
|
+
export declare const STALE_MS = 10000;
|
|
@@ -153,6 +153,22 @@ export declare class DashboardDataController {
|
|
|
153
153
|
* Get the underlying `ApiClient` instance.
|
|
154
154
|
*/
|
|
155
155
|
getClient(): ApiClient;
|
|
156
|
+
/** Whether this fetch call should be skipped entirely. */
|
|
157
|
+
private shouldSkipFetch;
|
|
158
|
+
/** Prepare abort controller, increment fetch ID, set loading state. */
|
|
159
|
+
private prepareFetch;
|
|
160
|
+
/** Execute the actual API fetch for the current section. */
|
|
161
|
+
private executeFetch;
|
|
162
|
+
/** Check if a response is stale (fetch ID mismatch or controller stopped). */
|
|
163
|
+
private isStaleResponse;
|
|
164
|
+
/** Check if an error should be silently ignored (abort or stale). */
|
|
165
|
+
private shouldIgnoreError;
|
|
166
|
+
/** Build query string from current controller state. */
|
|
167
|
+
private buildCurrentQueryString;
|
|
168
|
+
/** Apply a successful fetch result to the callbacks. */
|
|
169
|
+
private applyFetchResult;
|
|
170
|
+
/** Handle a fetch error (unauthorized, network, etc.). */
|
|
171
|
+
private handleFetchError;
|
|
156
172
|
private startRefreshTimer;
|
|
157
173
|
private stopRefreshTimer;
|
|
158
174
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PaginatedResponse } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a result is a paginated response (has data + meta).
|
|
4
|
+
*/
|
|
5
|
+
export declare function isPaginatedResult(result: unknown): result is {
|
|
6
|
+
data: unknown;
|
|
7
|
+
meta: PaginatedResponse<unknown>['meta'];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Check if an error is an AbortError (request was cancelled).
|
|
11
|
+
*/
|
|
12
|
+
export declare function isAbortedRequest(err: unknown, signal: AbortSignal): boolean;
|
|
@@ -86,4 +86,8 @@ export declare class DebugDataController<T = unknown> {
|
|
|
86
86
|
*/
|
|
87
87
|
clearCache(): void;
|
|
88
88
|
private fetchData;
|
|
89
|
+
/** Serve cached data if available. Returns true if cache hit. */
|
|
90
|
+
private serveFromCache;
|
|
91
|
+
/** Handle errors from fetchData. */
|
|
92
|
+
private handleFetchError;
|
|
89
93
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DevToolbarOptions, ServerStatsConfig, ToolbarConfig } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Return the first defined (non-undefined) value from the arguments.
|
|
4
|
+
* Falls back to the last argument (the default).
|
|
5
|
+
*/
|
|
6
|
+
export declare function firstDefined<T>(...args: Array<T | undefined>): T;
|
|
7
|
+
/**
|
|
8
|
+
* Apply a toolbar boolean or ToolbarConfig onto the result DevToolbarOptions.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyToolbarSetting(toolbar: boolean | ToolbarConfig, result: DevToolbarOptions): void;
|
|
11
|
+
/**
|
|
12
|
+
* Apply a dashboard boolean or DashboardConfig onto the result DevToolbarOptions.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyDashboardSetting(dashboard: boolean | {
|
|
15
|
+
path?: string;
|
|
16
|
+
retentionDays?: number;
|
|
17
|
+
}, result: DevToolbarOptions): void;
|
|
18
|
+
/**
|
|
19
|
+
* Apply advanced config fields onto the result DevToolbarOptions.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyAdvancedConfig(advanced: NonNullable<ServerStatsConfig['advanced']>, result: DevToolbarOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve transport from new and deprecated config options.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveTransport(config: ServerStatsConfig): 'transmit' | 'none';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FeatureFlags, FeatureConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mapping from FeatureConfig keys to their default value.
|
|
4
|
+
* Used to data-drive the flattenFlags function.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FEATURE_KEYS: Array<keyof Omit<FeatureConfig, 'customPanes'>>;
|
|
7
|
+
/**
|
|
8
|
+
* Flatten a FeatureFlags response to a FeatureConfig using the
|
|
9
|
+
* data-driven FEATURE_KEYS list.
|
|
10
|
+
*/
|
|
11
|
+
export declare function flattenFlagsFromKeys(flags: FeatureFlags): FeatureConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Rules for mapping feature flags to metric groups in getVisibleMetricGroups.
|
|
14
|
+
*/
|
|
15
|
+
export interface FlagGroupRule {
|
|
16
|
+
flag: string;
|
|
17
|
+
group: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Which flags enable which metric groups.
|
|
21
|
+
* Some groups can be triggered by multiple flags (e.g. memory by process or system).
|
|
22
|
+
*/
|
|
23
|
+
export declare const FLAG_TO_GROUP: FlagGroupRule[];
|
|
24
|
+
/**
|
|
25
|
+
* Rules for detecting metric groups from actual stats data.
|
|
26
|
+
* Each rule maps stat field names to a group name.
|
|
27
|
+
*/
|
|
28
|
+
export interface StatsGroupRule {
|
|
29
|
+
group: string;
|
|
30
|
+
fields: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare const STATS_GROUP_RULES: StatsGroupRule[];
|
|
33
|
+
/**
|
|
34
|
+
* Check if a value is a number (including 0).
|
|
35
|
+
*/
|
|
36
|
+
export declare function hasStatValue(v: unknown): v is number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a compact preview of a string value.
|
|
3
|
+
* Truncates at 40 characters and wraps in quotes.
|
|
4
|
+
*/
|
|
5
|
+
export declare function previewString(value: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Create a compact preview of an array value.
|
|
8
|
+
* Shows first 3 items with a summary for larger arrays.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The array to preview.
|
|
11
|
+
* @param maxLen - Maximum preview string length before falling back to a summary.
|
|
12
|
+
* @param recurse - Function to recursively preview nested values.
|
|
13
|
+
*/
|
|
14
|
+
export declare function previewArray(value: unknown[], maxLen: number, recurse: (v: unknown, max: number) => string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a compact preview of a plain object value.
|
|
17
|
+
* Shows first 4 key-value pairs with a summary for larger objects.
|
|
18
|
+
*
|
|
19
|
+
* @param value - The object to preview.
|
|
20
|
+
* @param maxLen - Maximum preview string length before falling back to keys-only.
|
|
21
|
+
* @param recurse - Function to recursively preview nested values.
|
|
22
|
+
*/
|
|
23
|
+
export declare function previewObject(value: Record<string, unknown>, maxLen: number, recurse: (v: unknown, max: number) => string): string;
|