@stravigor/devtools 0.4.4 → 0.4.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 +64 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @stravigor/devtools
|
|
2
|
+
|
|
3
|
+
Debug inspector and performance monitor for the [Strav](https://www.npmjs.com/package/@stravigor/core) framework. Request inspector, SQL query profiler, exception tracker, log viewer, and APM dashboard.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add -d @stravigor/devtools
|
|
9
|
+
bun strav package:install devtools
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Requires `@stravigor/core` as a peer dependency.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { DevtoolsProvider } from '@stravigor/devtools'
|
|
18
|
+
|
|
19
|
+
app.use(new DevtoolsProvider())
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The provider auto-registers the middleware and serves the dashboard at `/_devtools`.
|
|
23
|
+
|
|
24
|
+
## Collectors
|
|
25
|
+
|
|
26
|
+
Collectors capture data from your application:
|
|
27
|
+
|
|
28
|
+
- **RequestCollector** — HTTP requests and responses
|
|
29
|
+
- **QueryCollector** — SQL queries with timing
|
|
30
|
+
- **ExceptionCollector** — Unhandled exceptions
|
|
31
|
+
- **LogCollector** — Log entries
|
|
32
|
+
- **JobCollector** — Queue job execution
|
|
33
|
+
|
|
34
|
+
## Recorders
|
|
35
|
+
|
|
36
|
+
Recorders aggregate data for performance monitoring:
|
|
37
|
+
|
|
38
|
+
- **SlowRequestsRecorder** — Tracks slow HTTP requests
|
|
39
|
+
- **SlowQueriesRecorder** — Tracks slow SQL queries
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { devtools } from '@stravigor/devtools'
|
|
45
|
+
|
|
46
|
+
// Access collector data programmatically
|
|
47
|
+
const entries = await devtools.entries({ type: 'request', limit: 50 })
|
|
48
|
+
const aggregates = await devtools.aggregates('slow-requests', '1h')
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## CLI
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bun strav devtools:setup # Create the devtools tables
|
|
55
|
+
bun strav devtools:prune # Clean up old entries
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
See the full [Devtools guide](../../guides/devtools.md).
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stravigor/devtools",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Debug inspector and performance monitor for the Strav framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"tsconfig.json"
|
|
19
19
|
],
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@stravigor/core": "0.4.
|
|
21
|
+
"@stravigor/core": "0.4.4"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "bun test tests/",
|