@reqray/store-sqlite 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 +50 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,57 @@
|
|
|
1
1
|
# @reqray/store-sqlite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A request history for Reqray that outlives the process. By default Reqray keeps
|
|
4
|
+
the last 500 requests in memory — right for a dev panel, wrong for "what
|
|
5
|
+
happened an hour ago". This store keeps them in a SQLite file.
|
|
4
6
|
|
|
5
|
-
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request inspector for Node.js. It
|
|
8
|
+
instruments HTTP, SQL, outgoing calls and cache on its own, shows every
|
|
9
|
+
request as a waterfall, and finds N+1 down to the file and the line.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @reqray/store-sqlite
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { sqliteTransport } from '@reqray/store-sqlite';
|
|
19
|
+
|
|
20
|
+
await app.register(reqray, {
|
|
21
|
+
transport: sqliteTransport({ file: '.reqray/requests.db' }),
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The panel then pages by cursor instead of loading everything, and filters go
|
|
26
|
+
to the store — "only the errors" means every error there is, not every error
|
|
27
|
+
on screen.
|
|
28
|
+
|
|
29
|
+
Node 22.5 or newer, where SQLite is built in. Nothing is compiled at install
|
|
30
|
+
time.
|
|
31
|
+
|
|
32
|
+
## Options
|
|
33
|
+
|
|
34
|
+
| Option | Default | |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `file` | required | Path to the database file |
|
|
37
|
+
| `maxRequests` | `20000` | Oldest requests are evicted past this |
|
|
38
|
+
| `maxBytes` | 256 MB | …or past this, whichever runs out first |
|
|
39
|
+
| `pinLimit` | `50` | Pinned requests are exempt from eviction, so they get a bound of their own |
|
|
40
|
+
| `retention` | none | A shared `retentionPolicy({ days })`, so the store and a log on disk evict by one number |
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import { retentionPolicy, sqliteTransport } from '@reqray/store-sqlite';
|
|
44
|
+
|
|
45
|
+
const retention = retentionPolicy({ days: 7, file: '.reqray/retention.json' });
|
|
46
|
+
sqliteTransport({ file: '.reqray/requests.db', retention });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The collector takes the same store: `REQRAY_DB=/var/lib/reqray/requests.db`.
|
|
50
|
+
|
|
51
|
+
## More
|
|
52
|
+
|
|
53
|
+
Everything else — the detectors, security defaults, measured overhead and a
|
|
54
|
+
demo that runs with one command — is in the
|
|
10
55
|
[main README](https://github.com/reqray/reqray#readme).
|
|
11
56
|
|
|
12
57
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reqray/store-sqlite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SQLite storage for Reqray: a request history that outlives the process.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@reqray/core": "^0.1.
|
|
52
|
-
"@reqray/protocol": "^0.1.
|
|
51
|
+
"@reqray/core": "^0.1.1",
|
|
52
|
+
"@reqray/protocol": "^0.1.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^26.2.0",
|