@strav/devtools 0.1.0 → 0.1.5
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 +6 -6
- package/package.json +5 -5
- package/src/collectors/exception_collector.ts +2 -2
- package/src/collectors/job_collector.ts +2 -2
- package/src/collectors/log_collector.ts +2 -2
- package/src/collectors/request_collector.ts +2 -2
- package/src/commands/devtools_prune.ts +1 -1
- package/src/dashboard/middleware.ts +2 -2
- package/src/dashboard/routes.ts +2 -2
- package/src/devtools_manager.ts +2 -2
- package/src/devtools_provider.ts +4 -4
- package/src/errors.ts +1 -1
- package/src/helpers.ts +2 -2
- package/src/recorders/slow_queries.ts +2 -2
- package/src/recorders/slow_requests.ts +2 -2
- package/stubs/config/devtools.ts +1 -1
- package/stubs/schemas/devtools_aggregates.ts +1 -1
- package/stubs/schemas/devtools_entries.ts +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @strav/devtools
|
|
2
2
|
|
|
3
|
-
Debug inspector and performance monitor for the [Strav](https://www.npmjs.com/package/@
|
|
3
|
+
Debug inspector and performance monitor for the [Strav](https://www.npmjs.com/package/@strav/core) framework. Request inspector, SQL query profiler, exception tracker, log viewer, and APM dashboard.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bun add -d @
|
|
8
|
+
bun add -d @strav/devtools
|
|
9
9
|
bun strav install devtools
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Requires `@
|
|
12
|
+
Requires `@strav/core` as a peer dependency.
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
|
-
import { DevtoolsProvider } from '@
|
|
17
|
+
import { DevtoolsProvider } from '@strav/devtools'
|
|
18
18
|
|
|
19
19
|
app.use(new DevtoolsProvider())
|
|
20
20
|
```
|
|
@@ -41,7 +41,7 @@ Recorders aggregate data for performance monitoring:
|
|
|
41
41
|
## Usage
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import { devtools } from '@
|
|
44
|
+
import { devtools } from '@strav/devtools'
|
|
45
45
|
|
|
46
46
|
// Access collector data programmatically
|
|
47
47
|
const entries = await devtools.entries({ type: 'request', limit: 50 })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strav/devtools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Debug inspector and performance monitor for the Strav framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"tsconfig.json"
|
|
19
19
|
],
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@strav/kernel": "0.1.
|
|
22
|
-
"@strav/http": "0.1.
|
|
23
|
-
"@strav/database": "0.1.
|
|
24
|
-
"@strav/cli": "0.1.
|
|
21
|
+
"@strav/kernel": "0.1.4",
|
|
22
|
+
"@strav/http": "0.1.4",
|
|
23
|
+
"@strav/database": "0.1.4",
|
|
24
|
+
"@strav/cli": "0.1.4"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"test": "bun test tests/",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Listener } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Listener } from '@strav/kernel'
|
|
3
3
|
import Collector from './collector.ts'
|
|
4
4
|
import type EntryStore from '../storage/entry_store.ts'
|
|
5
5
|
import type { CollectorOptions } from '../types.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Listener } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Listener } from '@strav/kernel'
|
|
3
3
|
import Collector from './collector.ts'
|
|
4
4
|
import type EntryStore from '../storage/entry_store.ts'
|
|
5
5
|
import type { CollectorOptions } from '../types.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Listener } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Listener } from '@strav/kernel'
|
|
3
3
|
import Collector from './collector.ts'
|
|
4
4
|
import type EntryStore from '../storage/entry_store.ts'
|
|
5
5
|
import type { CollectorOptions } from '../types.ts'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context, Middleware, Next } from '@
|
|
1
|
+
import type { Context, Middleware, Next } from '@strav/http'
|
|
2
2
|
import Collector from './collector.ts'
|
|
3
3
|
import DevtoolsManager from '../devtools_manager.ts'
|
|
4
4
|
import type EntryStore from '../storage/entry_store.ts'
|
|
@@ -16,7 +16,7 @@ interface RequestCollectorOptions extends CollectorOptions {
|
|
|
16
16
|
* body, and response status.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* import { devtools } from '@
|
|
19
|
+
* import { devtools } from '@strav/devtools'
|
|
20
20
|
* router.use(devtools.middleware())
|
|
21
21
|
*/
|
|
22
22
|
export default class RequestCollector extends Collector {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from 'commander'
|
|
2
2
|
import chalk from 'chalk'
|
|
3
|
-
import { bootstrap, shutdown } from '@
|
|
3
|
+
import { bootstrap, shutdown } from '@strav/cli'
|
|
4
4
|
import DevtoolsManager from '../devtools_manager.ts'
|
|
5
5
|
|
|
6
6
|
export function register(program: Command): void {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context, Middleware, Next } from '@
|
|
1
|
+
import type { Context, Middleware, Next } from '@strav/http'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Authorization gate for the devtools dashboard.
|
|
@@ -7,7 +7,7 @@ import type { Context, Middleware, Next } from '@stravigor/http'
|
|
|
7
7
|
* Pass a custom guard function for production access control.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* import { dashboardAuth } from '@
|
|
10
|
+
* import { dashboardAuth } from '@strav/devtools/dashboard/middleware'
|
|
11
11
|
*
|
|
12
12
|
* // Default: local environment only
|
|
13
13
|
* router.group({ prefix: '/_devtools', middleware: [dashboardAuth()] }, ...)
|
package/src/dashboard/routes.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Router, Context } from '@
|
|
1
|
+
import type { Router, Context } from '@strav/http'
|
|
2
2
|
import { dashboardAuth } from './middleware.ts'
|
|
3
3
|
import DevtoolsManager from '../devtools_manager.ts'
|
|
4
4
|
import type { EntryType, AggregateFunction } from '../types.ts'
|
|
@@ -10,7 +10,7 @@ import { PERIODS } from '../storage/aggregate_store.ts'
|
|
|
10
10
|
* Mounts the API under `/_devtools` and serves the SPA dashboard.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
* import { registerDashboard } from '@
|
|
13
|
+
* import { registerDashboard } from '@strav/devtools/dashboard/routes'
|
|
14
14
|
* registerDashboard(router)
|
|
15
15
|
*
|
|
16
16
|
* // With custom auth guard
|
package/src/devtools_manager.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject, Configuration, Emitter, ConfigurationError } from '@
|
|
2
|
-
import { Database } from '@
|
|
1
|
+
import { inject, Configuration, Emitter, ConfigurationError } from '@strav/kernel'
|
|
2
|
+
import { Database } from '@strav/database'
|
|
3
3
|
import type { DevtoolsConfig, CollectorOptions } from './types.ts'
|
|
4
4
|
|
|
5
5
|
import EntryStore from './storage/entry_store.ts'
|
package/src/devtools_provider.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ServiceProvider } from '@
|
|
2
|
-
import type { Application } from '@
|
|
3
|
-
import type { Context } from '@
|
|
4
|
-
import { Router } from '@
|
|
1
|
+
import { ServiceProvider } from '@strav/kernel'
|
|
2
|
+
import type { Application } from '@strav/kernel'
|
|
3
|
+
import type { Context } from '@strav/http'
|
|
4
|
+
import { Router } from '@strav/http'
|
|
5
5
|
import DevtoolsManager from './devtools_manager.ts'
|
|
6
6
|
import { registerDashboard } from './dashboard/routes.ts'
|
|
7
7
|
|
package/src/errors.ts
CHANGED
package/src/helpers.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import DevtoolsManager from './devtools_manager.ts'
|
|
2
|
-
import type { Middleware } from '@
|
|
2
|
+
import type { Middleware } from '@strav/http'
|
|
3
3
|
import type { EntryRecord, AggregateRecord, EntryType, AggregateFunction } from './types.ts'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Devtools helper — the primary convenience API.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* import { devtools } from '@
|
|
9
|
+
* import { devtools } from '@strav/devtools'
|
|
10
10
|
*
|
|
11
11
|
* // Add the middleware to capture requests
|
|
12
12
|
* router.use(devtools.middleware())
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Listener } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Listener } from '@strav/kernel'
|
|
3
3
|
import Recorder from './recorder.ts'
|
|
4
4
|
import type AggregateStore from '../storage/aggregate_store.ts'
|
|
5
5
|
import type { RecorderOptions } from '../types.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Listener } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Listener } from '@strav/kernel'
|
|
3
3
|
import Recorder from './recorder.ts'
|
|
4
4
|
import type AggregateStore from '../storage/aggregate_store.ts'
|
|
5
5
|
import type { RecorderOptions } from '../types.ts'
|
package/stubs/config/devtools.ts
CHANGED