@antelopejs/redis 1.0.4 → 1.1.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/README.md +29 -25
- package/dist/index.js.map +1 -1
- package/package.json +16 -4
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@antelopejs/redis`
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
<a href="https://www.npmjs.com/package/@antelopejs/redis"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/redis?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
5
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/redis?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
-
<a href="https://discord.gg/
|
|
7
|
-
<a href="https://interfaces.antelopejs.com/docs/redis/introduction"><img src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"
|
|
4
|
+
<a href="https://www.npmjs.com/package/@antelopejs/redis"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/redis?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
5
|
+
<a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/redis?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
+
<a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
|
|
7
|
+
<a href="https://interfaces.antelopejs.com/docs/redis/introduction"><img data-illustration alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
|
-
The Redis module of AntelopeJS
|
|
10
|
+
The Redis module of AntelopeJS. It connects one shared [`ioredis`](https://github.com/redis/ioredis) client and serves it to the Redis and Redis Scheduler interfaces.
|
|
11
11
|
|
|
12
12
|
## Interfaces
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ The Redis module of AntelopeJS: it connects one shared [`ioredis`](https://githu
|
|
|
16
16
|
| [`@antelopejs/interface-redis`](https://github.com/AntelopeJS/interface-redis) | [Redis](https://interfaces.antelopejs.com/docs/redis/introduction) |
|
|
17
17
|
| [`@antelopejs/interface-redis-scheduler`](https://github.com/AntelopeJS/interface-redis-scheduler) | [Redis Scheduler](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction) |
|
|
18
18
|
|
|
19
|
-
The scheduler runs inside
|
|
19
|
+
The scheduler runs inside its interface package on top of the Redis client, so it needs no module besides this one.
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ The scheduler runs inside the interface package on top of the Redis client, so t
|
|
|
24
24
|
ajs project modules add @antelopejs/redis
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
The command writes the module's default configuration
|
|
27
|
+
The command writes the module's default configuration, which connects to `redis://localhost:6379`.
|
|
28
28
|
|
|
29
29
|
## Configuration
|
|
30
30
|
|
|
@@ -53,13 +53,13 @@ export default defineConfig({
|
|
|
53
53
|
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
| Key | Description
|
|
57
|
-
| ------------- |
|
|
58
|
-
| `url` | Redis connection URL. Optional
|
|
59
|
-
| `useMock` |
|
|
60
|
-
| any other key | Passed to the client as [`ioredis` options](https://github.com/redis/ioredis#connect-to-redis)
|
|
56
|
+
| Key | Description |
|
|
57
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `url` | Redis connection URL. Optional. Without it, the client uses the options below, or `localhost:6379`. |
|
|
59
|
+
| `useMock` | Serves an in-memory [`ioredis-mock`](https://github.com/stipsan/ioredis-mock) client instead of connecting, and ignores every other key. For tests only. |
|
|
60
|
+
| any other key | Passed to the client as [`ioredis` options](https://github.com/redis/ioredis#connect-to-redis), such as `host`, `port`, `password`, `db`, `tls` or `lazyConnect`. |
|
|
61
61
|
|
|
62
|
-
The client
|
|
62
|
+
The module creates the client when it starts, and quits it when it stops. With `lazyConnect: true`, the module waits for the connection before it serves the client.
|
|
63
63
|
|
|
64
64
|
## Quick start
|
|
65
65
|
|
|
@@ -77,23 +77,27 @@ await client.set("greeting", "hello", "EX", 60);
|
|
|
77
77
|
const greeting = await client.get("greeting");
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
`GetClient()` waits until the module has
|
|
80
|
+
`GetClient()` waits until the module has started and set its client. For distributed jobs, add `@antelopejs/interface-redis-scheduler` and read its [documentation](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction).
|
|
81
81
|
|
|
82
82
|
## Documentation
|
|
83
83
|
|
|
84
|
-
- [Redis](https://interfaces.antelopejs.com/docs/redis/introduction)
|
|
85
|
-
- [Redis Scheduler](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction)
|
|
86
|
-
- [Configuration](https://framework.antelopejs.com/docs/concepts/configuration)
|
|
84
|
+
- [Redis](https://interfaces.antelopejs.com/docs/redis/introduction) documents the `@antelopejs/interface-redis` contract that this module implements.
|
|
85
|
+
- [Redis Scheduler](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction) documents the `@antelopejs/interface-redis-scheduler` contract that this module implements.
|
|
86
|
+
- [Configuration](https://framework.antelopejs.com/docs/concepts/configuration) documents module sources, `config` blocks and config variables in `antelope.config.ts`.
|
|
87
87
|
|
|
88
88
|
## Compatibility
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
| --------------------------------------- | ---------------- |
|
|
92
|
-
| `@antelopejs/interface-redis` | `>=0.0.9 <1.0.0` |
|
|
93
|
-
| `@antelopejs/interface-redis-scheduler` | `>=0.0.8 <1.0.0` |
|
|
94
|
-
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
|
|
90
|
+
<!-- antelopejs-docs-compat:start -->
|
|
95
91
|
|
|
96
|
-
|
|
92
|
+
| Package | Supported | Tested with |
|
|
93
|
+
| --------------------------------------- | ---------------- | ----------- |
|
|
94
|
+
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.2.4` |
|
|
95
|
+
| `@antelopejs/interface-redis` | `>=0.0.9 <1.0.0` | `0.0.9` |
|
|
96
|
+
| `@antelopejs/interface-redis-scheduler` | `>=0.0.8 <1.0.0` | `0.0.8` |
|
|
97
|
+
|
|
98
|
+
<!-- antelopejs-docs-compat:end -->
|
|
99
|
+
|
|
100
|
+
`.nvmrc` sets the Node.js release for development, and the `dependencies` of `package.json` set the `ioredis` range.
|
|
97
101
|
|
|
98
102
|
## Contributing
|
|
99
103
|
|
|
@@ -106,7 +110,7 @@ pnpm knip
|
|
|
106
110
|
pnpm test # build, then ajs module test with ioredis-mock
|
|
107
111
|
```
|
|
108
112
|
|
|
109
|
-
The tests need no Redis server. Read the [contribution guidelines](CONTRIBUTING.md) before
|
|
113
|
+
The tests need no Redis server. Read the [contribution guidelines](CONTRIBUTING.md) before you open a pull request.
|
|
110
114
|
|
|
111
115
|
## License
|
|
112
116
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,8BAEC;AAED,0BAAkC;AAElC,sBAMC;AAED,oBAIC;AA3BD,sDAAmD;AACnD,iEAAuD;AAOvD,IAAI,WAAwB,CAAC;AAC7B,SAAgB,SAAS,CAAC,MAAmB;IAC3C,WAAW,GAAG,MAAM,CAAC;AACvB,CAAC;AAED,SAAgB,OAAO,KAAU,CAAC;AAE3B,KAAK,UAAU,KAAK;IACzB,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,WAAW,CAAC,OAAO,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QACnD,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IACD,0BAAQ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c,GAAC,CAAC;QAC5D,OAAO,IAAI,SAAS,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,iBAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,iBAAK,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,IAAI,iBAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/redis",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Redis module for AntelopeJS, implementing the Redis and Redis Scheduler interfaces with ioredis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -36,7 +36,15 @@
|
|
|
36
36
|
"release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
|
|
37
37
|
"test": "pnpm run build && ajs module test .",
|
|
38
38
|
"format:check": "oxfmt --check .",
|
|
39
|
-
"knip": "knip"
|
|
39
|
+
"knip": "knip",
|
|
40
|
+
"prepare": "if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1; then lefthook install; fi",
|
|
41
|
+
"checks": "antelopejs-checks",
|
|
42
|
+
"size": "antelopejs-check-size",
|
|
43
|
+
"sync": "antelopejs-sync",
|
|
44
|
+
"sync:check": "antelopejs-sync --check",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"suppressions": "antelopejs-suppressions",
|
|
47
|
+
"suppressions:update": "antelopejs-suppressions --update"
|
|
40
48
|
},
|
|
41
49
|
"dependencies": {
|
|
42
50
|
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
@@ -47,7 +55,7 @@
|
|
|
47
55
|
},
|
|
48
56
|
"devDependencies": {
|
|
49
57
|
"@antelopejs/core": "^1.16.0",
|
|
50
|
-
"@antelopejs/tooling-configs": "^0.
|
|
58
|
+
"@antelopejs/tooling-configs": "^0.2.17",
|
|
51
59
|
"@types/chai": "^4.3.20",
|
|
52
60
|
"@types/ioredis-mock": "^8.2.7",
|
|
53
61
|
"@types/mocha": "^10.0.10",
|
|
@@ -55,6 +63,7 @@
|
|
|
55
63
|
"chai": "^4.5.0",
|
|
56
64
|
"eslint-plugin-perfectionist": "^5.11.0",
|
|
57
65
|
"knip": "^6.34.0",
|
|
66
|
+
"lefthook": "^2.2.2",
|
|
58
67
|
"oxfmt": "^0.66.0",
|
|
59
68
|
"oxlint": "1.81.0",
|
|
60
69
|
"oxlint-tsgolint": "^7.0.2001",
|
|
@@ -72,6 +81,9 @@
|
|
|
72
81
|
"defaultConfig": {
|
|
73
82
|
"url": "redis://localhost:6379"
|
|
74
83
|
},
|
|
75
|
-
"test": "src/test/antelope.test.ts"
|
|
84
|
+
"test": "src/test/antelope.test.ts",
|
|
85
|
+
"docs": {
|
|
86
|
+
"standard": true
|
|
87
|
+
}
|
|
76
88
|
}
|
|
77
89
|
}
|