@antelopejs/redis 1.0.2 → 1.0.4

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 CHANGED
@@ -1,75 +1,113 @@
1
- ![Redis](.github/social-card.png)
2
-
3
1
  # @antelopejs/redis
4
2
 
5
3
  <div align="center">
6
- <a href="https://www.npmjs.com/package/@antelopejs/redis"><img alt="NPM version" src="https://img.shields.io/npm/v/@antelopejs/redis.svg?style=for-the-badge&labelColor=000000"></a>
7
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/redis.svg?style=for-the-badge&labelColor=000000"></a>
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>
8
6
  <a href="https://discord.gg/sjK28QHrA7"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" alt="Discord"></a>
9
- <a href="https://antelopejs.com/modules/redis"><img src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" alt="Documentation"></a>
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" alt="Documentation"></a>
10
8
  </div>
11
9
 
12
- A Redis client module that implements the Redis and Redis Scheduler interfaces for 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
+
12
+ ## Interfaces
13
+
14
+ | Interface | Documentation |
15
+ | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
16
+ | [`@antelopejs/interface-redis`](https://github.com/AntelopeJS/interface-redis) | [Redis](https://interfaces.antelopejs.com/docs/redis/introduction) |
17
+ | [`@antelopejs/interface-redis-scheduler`](https://github.com/AntelopeJS/interface-redis-scheduler) | [Redis Scheduler](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction) |
18
+
19
+ The scheduler runs inside the interface package on top of the Redis client, so this module is all it needs.
13
20
 
14
- ## Installation
21
+ ## Install
15
22
 
16
23
  ```bash
17
24
  ajs project modules add @antelopejs/redis
18
25
  ```
19
26
 
20
- ## Interfaces
21
-
22
- This module implements two key interfaces:
27
+ The command writes the module's default configuration: `redis://localhost:6379`.
23
28
 
24
- - **Redis Interface**: Promise-based Redis client with key-value operations and pub/sub messaging.
25
- - **Redis Scheduler Interface**: Redis-based distributed task scheduler with job queuing and automatic retries.
29
+ ## Configuration
26
30
 
27
- Both interfaces can be used independently or together depending on your application's needs. The interfaces are installed separately to maintain modularity and minimize dependencies.
31
+ ```typescript [antelope.config.ts]
32
+ import { defineConfig } from "@antelopejs/interface-core/config";
33
+
34
+ export default defineConfig({
35
+ name: "my-project",
36
+ modules: {
37
+ redis: {
38
+ source: {
39
+ type: "package",
40
+ package: "@antelopejs/redis",
41
+ version: "^1.0.3",
42
+ },
43
+ config: {
44
+ url: "redis://localhost:6379",
45
+ useMock: false,
46
+ lazyConnect: true,
47
+ },
48
+ },
49
+ },
50
+ envOverrides: {
51
+ REDIS_URL: "modules.redis.config.url",
52
+ },
53
+ });
54
+ ```
28
55
 
29
- | Name | Install command | |
30
- | --------------- | ---------------------------------------- | ------------------------------------------------------------------------ |
31
- | Redis | `ajs module imports add redis` | [Documentation](https://github.com/AntelopeJS/interface-redis) |
32
- | Redis Scheduler | `ajs module imports add redis_scheduler` | [Documentation](https://github.com/AntelopeJS/interface-redis-scheduler) |
56
+ | Key | Description |
57
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `url` | Redis connection URL. Optional: without it, the client uses the options below, or `localhost:6379`. |
59
+ | `useMock` | Serve an in-memory [`ioredis-mock`](https://github.com/stipsan/ioredis-mock) client instead of connecting. For tests only. |
60
+ | any other key | Passed to the client as [`ioredis` options](https://github.com/redis/ioredis#connect-to-redis) (`host`, `port`, `password`, `db`, `tls`, `lazyConnect`…). |
33
61
 
34
- ## Overview
62
+ The client connects when the module starts, and quits when it stops.
35
63
 
36
- The AntelopeJS Redis module provides functionality for interacting with Redis:
64
+ ## Quick start
37
65
 
38
- - Redis client connection management
39
- - Task scheduling with retry capabilities
66
+ In the module that uses Redis, add the interface:
40
67
 
41
- ## Configuration
68
+ ```bash
69
+ pnpm add @antelopejs/interface-redis
70
+ ```
42
71
 
43
- The Redis module can be configured with standard Redis client options:
72
+ ```typescript
73
+ import { GetClient } from "@antelopejs/interface-redis";
44
74
 
45
- ```json
46
- {
47
- "url": "redis://localhost:6379",
48
- "lazyConnect": true
49
- }
75
+ const client = await GetClient();
76
+ await client.set("greeting", "hello", "EX", 60);
77
+ const greeting = await client.get("greeting");
50
78
  ```
51
79
 
52
- ### Configuration Details
80
+ `GetClient()` waits until the module has connected. For distributed jobs, add `@antelopejs/interface-redis-scheduler` and read its [documentation](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction).
53
81
 
54
- The module accepts the following configuration properties:
82
+ ## Documentation
55
83
 
56
- - All standard Redis client options from the `ioredis` package
57
- - Supports all connection methods including URL string, socket options, etc.
84
+ - [Redis](https://interfaces.antelopejs.com/docs/redis/introduction): the `@antelopejs/interface-redis` contract this module implements
85
+ - [Redis Scheduler](https://interfaces.antelopejs.com/docs/redis-scheduler/introduction): the `@antelopejs/interface-redis-scheduler` contract this module implements
86
+ - [Configuration](https://framework.antelopejs.com/docs/concepts/configuration): module sources, `config` blocks and config variables in `antelope.config.ts`
58
87
 
59
- ## Integration with Other Modules
88
+ ## Compatibility
60
89
 
61
- The Redis module is designed to be used as a dependency for other AntelopeJS modules:
90
+ | Package | Supported range |
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` |
62
95
 
63
- ```typescript
64
- // Example of another module depending on Redis
65
- import { GetClient } from '@ajs/redis/beta';
96
+ The module is developed and tested against `@antelopejs/core` `^1.16.0` on Node.js 24, with `ioredis` `^5.10.1`.
97
+
98
+ ## Contributing
66
99
 
67
- async function storeValueInRedis(key: string, value: string) {
68
- const client = await GetClient();
69
- await client.set(key, value);
70
- }
100
+ ```bash
101
+ pnpm install
102
+ pnpm dev # run the playground/ project against redis://127.0.0.1:6379
103
+ pnpm lint
104
+ pnpm format:check
105
+ pnpm knip
106
+ pnpm test # build, then ajs module test with ioredis-mock
71
107
  ```
72
108
 
109
+ The tests need no Redis server. Read the [contribution guidelines](CONTRIBUTING.md) before opening a pull request.
110
+
73
111
  ## License
74
112
 
75
- This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
113
+ [Apache-2.0](LICENSE)
package/dist/index.js CHANGED
@@ -40,8 +40,8 @@ exports.construct = construct;
40
40
  exports.destroy = destroy;
41
41
  exports.start = start;
42
42
  exports.stop = stop;
43
- const interface_redis_1 = require("@antelopejs/interface-redis");
44
43
  const ioredis_1 = __importDefault(require("ioredis"));
44
+ const interface_redis_1 = require("@antelopejs/interface-redis");
45
45
  let redisConfig;
46
46
  function construct(config) {
47
47
  redisConfig = config;
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,iEAAuD;AACvD,sDAAmD;AAOnD,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,G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C,CAAC"}
package/package.json CHANGED
@@ -1,64 +1,77 @@
1
1
  {
2
2
  "name": "@antelopejs/redis",
3
- "version": "1.0.2",
4
- "description": "Redis module that implements the redis interface of antelopejs",
3
+ "version": "1.0.4",
4
+ "description": "Redis module for AntelopeJS, implementing the Redis and Redis Scheduler interfaces with ioredis",
5
5
  "keywords": [
6
6
  "antelopejs",
7
- "redis",
8
7
  "cache",
9
- "key-value",
10
- "nosql"
8
+ "ioredis",
9
+ "redis",
10
+ "scheduler"
11
11
  ],
12
+ "homepage": "https://interfaces.antelopejs.com/docs/redis/introduction",
13
+ "bugs": {
14
+ "url": "https://github.com/AntelopeJS/redis/issues"
15
+ },
16
+ "license": "Apache-2.0",
12
17
  "repository": {
13
18
  "type": "git",
14
19
  "url": "git+https://github.com/AntelopeJS/redis.git"
15
20
  },
16
- "main": "dist/index.js",
17
21
  "files": [
18
22
  "dist"
19
23
  ],
24
+ "main": "dist/index.js",
20
25
  "publishConfig": {
21
- "access": "public"
26
+ "access": "public",
27
+ "provenance": true
22
28
  },
23
- "license": "Apache-2.0",
24
- "packageManager": "pnpm@10.6.5",
25
29
  "scripts": {
26
30
  "build": "rimraf dist && tsc",
27
31
  "dev": "ajs project run -w -p playground --inspect",
28
- "format": "biome format --write .",
29
- "lint:fix": "biome check --write .",
30
- "lint": "biome check .",
32
+ "format": "oxfmt .",
33
+ "lint:fix": "oxlint --fix",
34
+ "lint": "oxlint",
31
35
  "prepack": "pnpm run build",
32
36
  "release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
33
- "test": "pnpm run build && ajs module test ."
34
- },
35
- "antelopeJs": {
36
- "implements": [
37
- "@antelopejs/interface-redis",
38
- "@antelopejs/interface-redis-scheduler"
39
- ],
40
- "defaultConfig": {
41
- "url": "redis://localhost:6379"
42
- },
43
- "test": "src/test/antelope.test.ts"
37
+ "test": "pnpm run build && ajs module test .",
38
+ "format:check": "oxfmt --check .",
39
+ "knip": "knip"
44
40
  },
45
41
  "dependencies": {
46
- "@antelopejs/interface-core": "^0.0.5",
47
- "@antelopejs/interface-redis": "^0.0.6",
48
- "@antelopejs/interface-redis-scheduler": "^0.0.6",
42
+ "@antelopejs/interface-core": ">=0.2.4 <1.0.0",
43
+ "@antelopejs/interface-redis": ">=0.0.9 <1.0.0",
44
+ "@antelopejs/interface-redis-scheduler": ">=0.0.8 <1.0.0",
49
45
  "ioredis": "^5.10.1",
50
46
  "ioredis-mock": "^8.13.1"
51
47
  },
52
48
  "devDependencies": {
53
- "@biomejs/biome": "2.3.2",
49
+ "@antelopejs/core": "^1.16.0",
50
+ "@antelopejs/tooling-configs": "^0.0.9",
54
51
  "@types/chai": "^4.3.20",
55
52
  "@types/ioredis-mock": "^8.2.7",
56
53
  "@types/mocha": "^10.0.10",
57
54
  "@types/node": "^22.19.15",
58
55
  "chai": "^4.5.0",
56
+ "eslint-plugin-perfectionist": "^5.11.0",
57
+ "knip": "^6.34.0",
58
+ "oxfmt": "^0.66.0",
59
+ "oxlint": "1.81.0",
60
+ "oxlint-tsgolint": "^7.0.2001",
59
61
  "release-it": "^19.2.4",
60
62
  "release-it-changelogen": "^0.1.0",
61
63
  "rimraf": "^6.1.3",
62
64
  "typescript": "^5.9.3"
65
+ },
66
+ "packageManager": "pnpm@10.6.5",
67
+ "antelopeJs": {
68
+ "implements": [
69
+ "@antelopejs/interface-redis",
70
+ "@antelopejs/interface-redis-scheduler"
71
+ ],
72
+ "defaultConfig": {
73
+ "url": "redis://localhost:6379"
74
+ },
75
+ "test": "src/test/antelope.test.ts"
63
76
  }
64
77
  }