@reqray/protocol 0.1.0 → 0.1.1
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 +33 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
# @reqray/protocol
|
|
2
2
|
|
|
3
|
-
The Reqray panel API
|
|
3
|
+
The contract of Reqray's panel API: the types a client sees on the wire. Types
|
|
4
|
+
only — the package emits no runtime code.
|
|
4
5
|
|
|
5
|
-
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request inspector for Node.js. It
|
|
7
|
+
instruments HTTP, SQL, outgoing calls and cache on its own, shows every
|
|
8
|
+
request as a waterfall, and finds N+1 down to the file and the line.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Install it to build your own client for a Reqray panel or collector — a
|
|
11
|
+
script, an editor extension, a bot. The web panel and
|
|
12
|
+
[`@reqray/cli`](https://www.npmjs.com/package/@reqray/cli) are both written
|
|
13
|
+
against it.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -D @reqray/protocol
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import type { RequestDetail, RequestsResponse } from '@reqray/protocol';
|
|
21
|
+
|
|
22
|
+
const base = 'http://localhost:3000/_reqray';
|
|
23
|
+
const list = (await (await fetch(`${base}/api/requests`)).json()) as RequestsResponse;
|
|
24
|
+
const slowest = list.requests.toSorted((a, b) => b.durationMs - a.durationMs)[0];
|
|
25
|
+
const detail = (await (await fetch(`${base}/api/requests/${slowest.id}`)).json()) as RequestDetail;
|
|
26
|
+
|
|
27
|
+
for (const finding of detail.findings) console.log(finding.title, finding.callsite);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
What it describes: request summaries and details, spans (`DbSpan`, `HttpSpan`,
|
|
31
|
+
`CacheSpan`), findings and their evidence, exception groups, per-route
|
|
32
|
+
statistics, time series, and the project report.
|
|
33
|
+
|
|
34
|
+
## More
|
|
35
|
+
|
|
36
|
+
Everything else — the detectors, security defaults, measured overhead and a
|
|
37
|
+
demo that runs with one command — is in the
|
|
10
38
|
[main README](https://github.com/reqray/reqray#readme).
|
|
11
39
|
|
|
12
40
|
## License
|