@prsm/devtools 1.0.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.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/client/assets/index-CkwmeR8W.js +176 -0
- package/dist/client/assets/index-p_4czaPS.css +1 -0
- package/dist/client/index.html +16 -0
- package/package.json +43 -0
- package/src/index.js +339 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nvms
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/logo.svg" width="80" height="80" alt="devtools logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@prsm/devtools</h1>
|
|
6
|
+
|
|
7
|
+
Read-only Express middleware dashboard for observing prsm infrastructure at runtime. Mount it, pass your instances, get a live UI.
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src=".github/record.png" width="800" alt="realtime records view">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src=".github/executions.png" width="800" alt="workflow executions view">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @prsm/devtools
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import express from 'express'
|
|
27
|
+
import { RealtimeServer } from '@prsm/realtime'
|
|
28
|
+
import Queue from '@prsm/queue'
|
|
29
|
+
import { Cron } from '@prsm/cron'
|
|
30
|
+
import { slidingWindow } from '@prsm/limit'
|
|
31
|
+
import WorkflowEngine from '@prsm/workflow'
|
|
32
|
+
import { prsmDevtools } from '@prsm/devtools'
|
|
33
|
+
|
|
34
|
+
const app = express()
|
|
35
|
+
|
|
36
|
+
const realtime = new RealtimeServer({ redis: { host: '127.0.0.1', port: 6379 } })
|
|
37
|
+
const queue = new Queue({ concurrency: 5 })
|
|
38
|
+
const cron = new Cron()
|
|
39
|
+
const apiLimiter = slidingWindow({ max: 100, window: '1m' })
|
|
40
|
+
const workflow = new WorkflowEngine()
|
|
41
|
+
|
|
42
|
+
app.use('/devtools', prsmDevtools({
|
|
43
|
+
realtime,
|
|
44
|
+
queue,
|
|
45
|
+
cron,
|
|
46
|
+
limit: { api: apiLimiter },
|
|
47
|
+
workflow,
|
|
48
|
+
}))
|
|
49
|
+
|
|
50
|
+
app.listen(3000)
|
|
51
|
+
// open http://localhost:3000/devtools
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Everything is optional. Only pass what you have - tabs appear only for connected subsystems.
|
|
55
|
+
|
|
56
|
+
## What You See
|
|
57
|
+
|
|
58
|
+
**Overview** - unified event stream from all subsystems, live via SSE
|
|
59
|
+
|
|
60
|
+
**Realtime** - full inspector for `@prsm/realtime` with sub-tabs:
|
|
61
|
+
|
|
62
|
+
- **Rooms** - active rooms, members, per-member presence state
|
|
63
|
+
- **Channels** - channels with active subscribers
|
|
64
|
+
- **Collections** - collections with subscribers, expandable resolved records per connection
|
|
65
|
+
- **Records** - subscribed records with live-updating data view (via SSE) and subscription mode per connection
|
|
66
|
+
- **Metadata** - detailed connection view with rooms, channels, collections, records, and presence
|
|
67
|
+
|
|
68
|
+
Includes a connection picker sidebar for filtering all views by a specific client, and a registered patterns panel showing exposed channels, records, collections, presence, and commands.
|
|
69
|
+
|
|
70
|
+
**Queue** - in-flight count (polled), completed/failed/retried counters (session), event log
|
|
71
|
+
|
|
72
|
+
**Cron** - registered jobs with next fire times, fire/error event log
|
|
73
|
+
|
|
74
|
+
**Limits** - registered limiters, peek inspector (inspect a key without consuming)
|
|
75
|
+
|
|
76
|
+
**Workflows** - registered workflow definitions with interactive graph view, step inspector, retry/timeout metadata
|
|
77
|
+
|
|
78
|
+
**Executions** - workflow execution list with filters, live graph overlay showing execution progress, per-step state, output/error inspector, and journal timeline
|
|
79
|
+
|
|
80
|
+
## API
|
|
81
|
+
|
|
82
|
+
### `prsmDevtools(options)`
|
|
83
|
+
|
|
84
|
+
Returns an Express `Router`. Mount it wherever you want.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
app.use('/devtools', prsmDevtools(options))
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Options
|
|
91
|
+
|
|
92
|
+
| Option | Type | Description |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `realtime` | `RealtimeServer` | A `@prsm/realtime` server instance |
|
|
95
|
+
| `queue` | `Queue` | A `@prsm/queue` instance |
|
|
96
|
+
| `cron` | `Cron` | A `@prsm/cron` instance |
|
|
97
|
+
| `limit` | `Object<string, Limiter>` | Named limiters from `@prsm/limit` |
|
|
98
|
+
| `workflow` | `WorkflowEngine` | An `@prsm/workflow` engine instance |
|
|
99
|
+
|
|
100
|
+
All options are optional. The dashboard adapts to what's provided.
|
|
101
|
+
|
|
102
|
+
### Endpoints
|
|
103
|
+
|
|
104
|
+
The middleware exposes these under its mount path:
|
|
105
|
+
|
|
106
|
+
| Endpoint | Description |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `GET /api/config` | Which subsystems are connected |
|
|
109
|
+
| `GET /api/events` | SSE stream (queue, cron, workflow, and realtime record updates) |
|
|
110
|
+
| `GET /api/queue` | Current in-flight count |
|
|
111
|
+
| `GET /api/cron` | Registered jobs with next fire times |
|
|
112
|
+
| `GET /api/limits` | List of named limiters |
|
|
113
|
+
| `GET /api/limits/:name/peek/:key` | Peek at a limiter key |
|
|
114
|
+
| `GET /api/workflows` | Registered workflows with graph data |
|
|
115
|
+
| `GET /api/workflows/describe` | One workflow definition |
|
|
116
|
+
| `GET /api/workflow/executions` | Workflow executions, filterable by workflow/status |
|
|
117
|
+
| `GET /api/workflow/executions/:id` | One workflow execution |
|
|
118
|
+
| `GET /api/realtime/state` | Full realtime state snapshot |
|
|
119
|
+
| `GET /api/realtime/connection/:id` | Detailed connection info |
|
|
120
|
+
| `GET /api/realtime/room/:name` | Room members with metadata and presence |
|
|
121
|
+
| `GET /api/realtime/record/:id` | Fetch a record's current value |
|
|
122
|
+
| `GET /api/realtime/collection/:id/records` | Resolved records for a collection + connection |
|
|
123
|
+
|
|
124
|
+
## How It Works
|
|
125
|
+
|
|
126
|
+
The middleware listens to events on the instances you pass and forwards them to connected browsers via Server-Sent Events. Realtime record updates stream live over SSE - when you expand a record in the UI, its value updates in place as it changes on the server. Polling endpoints read current state from the instances' public APIs.
|
|
127
|
+
|
|
128
|
+
The Vue SPA is pre-built at publish time and served as static files from the same mount point. No build step needed in your project.
|
|
129
|
+
|
|
130
|
+
No dependencies on any `@prsm` packages. The middleware reads from whatever objects you give it.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|