@hexok/queue-redis 1.1.1 → 1.1.3
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 +3 -1
- package/dist/codec.d.ts +1 -0
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +7 -1
- package/dist/codec.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Redis Streams adapter for `@hexok/queue`. Install with `npm i @hexok/queue-redis`. Requires Redis 6.2 or newer and `ioredis` 6. Connections negotiate RESP3 and keep v5 reply shapes. Pass a structural logger and quarantine sink. This package does not depend on `@hexok/logger` or `@hexok/quarantine`.
|
|
4
4
|
|
|
5
|
+
The adapter class is closed. Its fields and helpers are private. Wrap it in your own adapter of the port when you need extra logic.
|
|
6
|
+
|
|
5
7
|
```ts
|
|
6
8
|
import { RedisQueue } from '@hexok/queue-redis';
|
|
7
9
|
|
|
@@ -142,7 +144,7 @@ Every log carries `adapter: 'queue'`. `connection` is `commands` or `blocking`,
|
|
|
142
144
|
| `retentionMs` | `86400000` | Entries older than this are trimmed with `XTRIM MINID`, after each publish and every minute, on the topics this instance published to. One day by default. `maintain()` does not use it. |
|
|
143
145
|
| `trim` | `'published'` | `'published'` age-trims only topics this instance published to. `false` never age-trims, and `MAXLEN ~` on `XADD` still applies. |
|
|
144
146
|
| `encode` | `JSON.stringify` | Turns a payload into the `payload` field. |
|
|
145
|
-
| `decode` | `JSON.parse` | Turns the `payload` field back. A failure parks the entry and acks it. |
|
|
147
|
+
| `decode` | `JSON.parse` | Turns the `payload` field back. A bad entry throws `queue: entry is not JSON` and does not include the text. A failure parks the entry and acks it. |
|
|
146
148
|
| `logger` | no-op | A structural `LogSink`. `@hexok/logger` and `console` fit it. |
|
|
147
149
|
| `quarantine` | unset | A structural `ParkSink`, such as `@hexok/quarantine`. It receives what the queue cannot publish or deliver. |
|
|
148
150
|
|
package/dist/codec.d.ts
CHANGED
package/dist/codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEnD;AAED,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM/C"}
|
package/dist/codec.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export function encodeJson(payload) {
|
|
2
2
|
return JSON.stringify(payload);
|
|
3
3
|
}
|
|
4
|
+
/** `JSON.parse`. The error does not include the text. Node quotes the start of it. */
|
|
4
5
|
export function decodeJson(raw) {
|
|
5
|
-
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(raw);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
throw new Error('queue: entry is not JSON');
|
|
11
|
+
}
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=codec.js.map
|
package/dist/codec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexok/queue-redis",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Redis Streams adapter for the hexok Queue port.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@hexok/ioredis-lifecycle": "^1.0.0",
|
|
45
45
|
"@hexok/queue": "^1.0.0",
|
|
46
|
-
"hexok": "^2.2.
|
|
46
|
+
"hexok": "^2.2.3",
|
|
47
47
|
"ioredis": "^6"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|