@fedify/redis 2.0.2-dev.407 → 2.1.0-dev.405
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/dist/codec.d.cts +20 -20
- package/dist/codec.d.ts +20 -20
- package/dist/kv.d.cts +41 -41
- package/dist/kv.d.ts +41 -41
- package/dist/mq.d.cts +54 -54
- package/dist/mq.d.ts +54 -54
- package/package.json +4 -4
package/dist/codec.d.cts
CHANGED
|
@@ -2,45 +2,45 @@ import { Buffer } from "node:buffer";
|
|
|
2
2
|
|
|
3
3
|
//#region src/codec.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Encode and decodes JavaScript objects to and from binary data.
|
|
6
|
-
*/
|
|
5
|
+
* Encode and decodes JavaScript objects to and from binary data.
|
|
6
|
+
*/
|
|
7
7
|
interface Codec {
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
* Encodes a JavaScript object to binary data.
|
|
10
|
+
* @param value The JavaScript object to encode.
|
|
11
|
+
* @returns The encoded binary data.
|
|
12
|
+
* @throws {EncodingError} If the JavaScript object cannot be encoded.
|
|
13
|
+
*/
|
|
14
14
|
encode(value: unknown): Buffer;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
* Decodes a JavaScript object from binary data.
|
|
17
|
+
* @param encoded The binary data to decode.
|
|
18
|
+
* @returns The decoded JavaScript object.
|
|
19
|
+
* @throws {DecodingError} If the binary data is invalid.
|
|
20
|
+
*/
|
|
21
21
|
decode(encoded: Buffer): unknown;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* An error that occurs when encoding or decoding data.
|
|
25
|
-
*/
|
|
24
|
+
* An error that occurs when encoding or decoding data.
|
|
25
|
+
*/
|
|
26
26
|
declare class CodecError extends Error {
|
|
27
27
|
constructor(message: string);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* An error that occurs when encoding data.
|
|
31
|
-
*/
|
|
30
|
+
* An error that occurs when encoding data.
|
|
31
|
+
*/
|
|
32
32
|
declare class EncodingError extends CodecError {
|
|
33
33
|
constructor(message: string);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* An error that occurs when decoding data.
|
|
37
|
-
*/
|
|
36
|
+
* An error that occurs when decoding data.
|
|
37
|
+
*/
|
|
38
38
|
declare class DecodingError extends CodecError {
|
|
39
39
|
constructor(message: string);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* A codec that encodes and decodes JavaScript objects to and from JSON.
|
|
43
|
-
*/
|
|
42
|
+
* A codec that encodes and decodes JavaScript objects to and from JSON.
|
|
43
|
+
*/
|
|
44
44
|
declare class JsonCodec implements Codec {
|
|
45
45
|
#private;
|
|
46
46
|
encode(value: unknown): Buffer;
|
package/dist/codec.d.ts
CHANGED
|
@@ -3,45 +3,45 @@ import { Buffer } from "node:buffer";
|
|
|
3
3
|
|
|
4
4
|
//#region src/codec.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Encode and decodes JavaScript objects to and from binary data.
|
|
7
|
-
*/
|
|
6
|
+
* Encode and decodes JavaScript objects to and from binary data.
|
|
7
|
+
*/
|
|
8
8
|
interface Codec {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Encodes a JavaScript object to binary data.
|
|
11
|
+
* @param value The JavaScript object to encode.
|
|
12
|
+
* @returns The encoded binary data.
|
|
13
|
+
* @throws {EncodingError} If the JavaScript object cannot be encoded.
|
|
14
|
+
*/
|
|
15
15
|
encode(value: unknown): Buffer;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
* Decodes a JavaScript object from binary data.
|
|
18
|
+
* @param encoded The binary data to decode.
|
|
19
|
+
* @returns The decoded JavaScript object.
|
|
20
|
+
* @throws {DecodingError} If the binary data is invalid.
|
|
21
|
+
*/
|
|
22
22
|
decode(encoded: Buffer): unknown;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* An error that occurs when encoding or decoding data.
|
|
26
|
-
*/
|
|
25
|
+
* An error that occurs when encoding or decoding data.
|
|
26
|
+
*/
|
|
27
27
|
declare class CodecError extends Error {
|
|
28
28
|
constructor(message: string);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* An error that occurs when encoding data.
|
|
32
|
-
*/
|
|
31
|
+
* An error that occurs when encoding data.
|
|
32
|
+
*/
|
|
33
33
|
declare class EncodingError extends CodecError {
|
|
34
34
|
constructor(message: string);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* An error that occurs when decoding data.
|
|
38
|
-
*/
|
|
37
|
+
* An error that occurs when decoding data.
|
|
38
|
+
*/
|
|
39
39
|
declare class DecodingError extends CodecError {
|
|
40
40
|
constructor(message: string);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* A codec that encodes and decodes JavaScript objects to and from JSON.
|
|
44
|
-
*/
|
|
43
|
+
* A codec that encodes and decodes JavaScript objects to and from JSON.
|
|
44
|
+
*/
|
|
45
45
|
declare class JsonCodec implements Codec {
|
|
46
46
|
#private;
|
|
47
47
|
encode(value: unknown): Buffer;
|
package/dist/kv.d.cts
CHANGED
|
@@ -4,62 +4,62 @@ import { Cluster, Redis, RedisKey } from "ioredis";
|
|
|
4
4
|
|
|
5
5
|
//#region src/kv.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* Options for {@link RedisKvStore} class.
|
|
8
|
-
*/
|
|
7
|
+
* Options for {@link RedisKvStore} class.
|
|
8
|
+
*/
|
|
9
9
|
interface RedisKvStoreOptions {
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
* The prefix to use for all keys in the key–value store in Redis.
|
|
12
|
+
* Defaults to `"fedify::"`.
|
|
13
|
+
*/
|
|
14
14
|
readonly keyPrefix?: RedisKey;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
* The codec to use for encoding and decoding values in the key–value store.
|
|
17
|
+
* Defaults to {@link JsonCodec}.
|
|
18
|
+
*/
|
|
19
19
|
readonly codec?: Codec;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* A key–value store that uses Redis as the underlying storage.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts ignore
|
|
26
|
-
* import { createFederation } from "@fedify/fedify";
|
|
27
|
-
* import { RedisKvStore } from "@fedify/redis";
|
|
28
|
-
* import { Redis, Cluster } from "ioredis";
|
|
29
|
-
*
|
|
30
|
-
* // Using a standalone Redis instance:
|
|
31
|
-
* const federation = createFederation({
|
|
32
|
-
* // ...
|
|
33
|
-
* kv: new RedisKvStore(new Redis()),
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Using a Redis Cluster:
|
|
37
|
-
* const cluster = new Cluster([
|
|
38
|
-
* { host: "127.0.0.1", port: 7000 },
|
|
39
|
-
* { host: "127.0.0.1", port: 7001 },
|
|
40
|
-
* { host: "127.0.0.1", port: 7002 },
|
|
41
|
-
* ]);
|
|
42
|
-
* const federation = createFederation({
|
|
43
|
-
* // ...
|
|
44
|
-
* kv: new RedisKvStore(cluster),
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
22
|
+
* A key–value store that uses Redis as the underlying storage.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts ignore
|
|
26
|
+
* import { createFederation } from "@fedify/fedify";
|
|
27
|
+
* import { RedisKvStore } from "@fedify/redis";
|
|
28
|
+
* import { Redis, Cluster } from "ioredis";
|
|
29
|
+
*
|
|
30
|
+
* // Using a standalone Redis instance:
|
|
31
|
+
* const federation = createFederation({
|
|
32
|
+
* // ...
|
|
33
|
+
* kv: new RedisKvStore(new Redis()),
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Using a Redis Cluster:
|
|
37
|
+
* const cluster = new Cluster([
|
|
38
|
+
* { host: "127.0.0.1", port: 7000 },
|
|
39
|
+
* { host: "127.0.0.1", port: 7001 },
|
|
40
|
+
* { host: "127.0.0.1", port: 7002 },
|
|
41
|
+
* ]);
|
|
42
|
+
* const federation = createFederation({
|
|
43
|
+
* // ...
|
|
44
|
+
* kv: new RedisKvStore(cluster),
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
48
|
declare class RedisKvStore implements KvStore {
|
|
49
49
|
#private;
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
* Creates a new Redis key–value store.
|
|
52
|
+
* @param redis The Redis client (standalone or cluster) to use.
|
|
53
|
+
* @param options The options for the key–value store.
|
|
54
|
+
*/
|
|
55
55
|
constructor(redis: Redis | Cluster, options?: RedisKvStoreOptions);
|
|
56
56
|
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
57
57
|
set(key: KvKey, value: unknown, options?: KvStoreSetOptions | undefined): Promise<void>;
|
|
58
58
|
delete(key: KvKey): Promise<void>;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* {@inheritDoc KvStore.list}
|
|
61
|
+
* @since 1.10.0
|
|
62
|
+
*/
|
|
63
63
|
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
package/dist/kv.d.ts
CHANGED
|
@@ -5,62 +5,62 @@ import { Cluster, Redis, RedisKey } from "ioredis";
|
|
|
5
5
|
|
|
6
6
|
//#region src/kv.d.ts
|
|
7
7
|
/**
|
|
8
|
-
* Options for {@link RedisKvStore} class.
|
|
9
|
-
*/
|
|
8
|
+
* Options for {@link RedisKvStore} class.
|
|
9
|
+
*/
|
|
10
10
|
interface RedisKvStoreOptions {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* The prefix to use for all keys in the key–value store in Redis.
|
|
13
|
+
* Defaults to `"fedify::"`.
|
|
14
|
+
*/
|
|
15
15
|
readonly keyPrefix?: RedisKey;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* The codec to use for encoding and decoding values in the key–value store.
|
|
18
|
+
* Defaults to {@link JsonCodec}.
|
|
19
|
+
*/
|
|
20
20
|
readonly codec?: Codec;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* A key–value store that uses Redis as the underlying storage.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts ignore
|
|
27
|
-
* import { createFederation } from "@fedify/fedify";
|
|
28
|
-
* import { RedisKvStore } from "@fedify/redis";
|
|
29
|
-
* import { Redis, Cluster } from "ioredis";
|
|
30
|
-
*
|
|
31
|
-
* // Using a standalone Redis instance:
|
|
32
|
-
* const federation = createFederation({
|
|
33
|
-
* // ...
|
|
34
|
-
* kv: new RedisKvStore(new Redis()),
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Using a Redis Cluster:
|
|
38
|
-
* const cluster = new Cluster([
|
|
39
|
-
* { host: "127.0.0.1", port: 7000 },
|
|
40
|
-
* { host: "127.0.0.1", port: 7001 },
|
|
41
|
-
* { host: "127.0.0.1", port: 7002 },
|
|
42
|
-
* ]);
|
|
43
|
-
* const federation = createFederation({
|
|
44
|
-
* // ...
|
|
45
|
-
* kv: new RedisKvStore(cluster),
|
|
46
|
-
* });
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
23
|
+
* A key–value store that uses Redis as the underlying storage.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts ignore
|
|
27
|
+
* import { createFederation } from "@fedify/fedify";
|
|
28
|
+
* import { RedisKvStore } from "@fedify/redis";
|
|
29
|
+
* import { Redis, Cluster } from "ioredis";
|
|
30
|
+
*
|
|
31
|
+
* // Using a standalone Redis instance:
|
|
32
|
+
* const federation = createFederation({
|
|
33
|
+
* // ...
|
|
34
|
+
* kv: new RedisKvStore(new Redis()),
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Using a Redis Cluster:
|
|
38
|
+
* const cluster = new Cluster([
|
|
39
|
+
* { host: "127.0.0.1", port: 7000 },
|
|
40
|
+
* { host: "127.0.0.1", port: 7001 },
|
|
41
|
+
* { host: "127.0.0.1", port: 7002 },
|
|
42
|
+
* ]);
|
|
43
|
+
* const federation = createFederation({
|
|
44
|
+
* // ...
|
|
45
|
+
* kv: new RedisKvStore(cluster),
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
49
|
declare class RedisKvStore implements KvStore {
|
|
50
50
|
#private;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
* Creates a new Redis key–value store.
|
|
53
|
+
* @param redis The Redis client (standalone or cluster) to use.
|
|
54
|
+
* @param options The options for the key–value store.
|
|
55
|
+
*/
|
|
56
56
|
constructor(redis: Redis | Cluster, options?: RedisKvStoreOptions);
|
|
57
57
|
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
58
58
|
set(key: KvKey, value: unknown, options?: KvStoreSetOptions | undefined): Promise<void>;
|
|
59
59
|
delete(key: KvKey): Promise<void>;
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
* {@inheritDoc KvStore.list}
|
|
62
|
+
* @since 1.10.0
|
|
63
|
+
*/
|
|
64
64
|
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
package/dist/mq.d.cts
CHANGED
|
@@ -4,78 +4,78 @@ import { Cluster, Redis, RedisKey } from "ioredis";
|
|
|
4
4
|
|
|
5
5
|
//#region src/mq.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* Options for {@link RedisMessageQueue} class.
|
|
8
|
-
*/
|
|
7
|
+
* Options for {@link RedisMessageQueue} class.
|
|
8
|
+
*/
|
|
9
9
|
interface RedisMessageQueueOptions {
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* The unique identifier for the worker that is processing messages from the
|
|
12
|
+
* queue. If this is not specified, a random identifier will be generated.
|
|
13
|
+
* This is used to prevent multiple workers from processing the same message,
|
|
14
|
+
* so it should be unique for each worker.
|
|
15
|
+
*/
|
|
16
16
|
readonly workerId?: string;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* The Pub/Sub channel key to use for the message queue. `"fedify_channel"`
|
|
19
|
+
* by default.
|
|
20
|
+
* @default `"fedify_channel"`
|
|
21
|
+
*/
|
|
22
22
|
readonly channelKey?: RedisKey;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
* The Sorted Set key to use for the delayed message queue. `"fedify_queue"`
|
|
25
|
+
* by default.
|
|
26
|
+
* @default `"fedify_queue"`
|
|
27
|
+
*/
|
|
28
28
|
readonly queueKey?: RedisKey;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
* The key to use for locking the message queue. `"fedify_lock"` by default.
|
|
31
|
+
* @default `"fedify_lock"`
|
|
32
|
+
*/
|
|
33
33
|
readonly lockKey?: RedisKey;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* The codec to use for encoding and decoding messages in the key–value store.
|
|
36
|
+
* Defaults to {@link JsonCodec}.
|
|
37
|
+
* @default {@link JsonCodec}
|
|
38
|
+
*/
|
|
39
39
|
readonly codec?: Codec;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* The poll interval for the message queue. 5 seconds by default.
|
|
42
|
+
* @default `{ seconds: 5 }`
|
|
43
|
+
*/
|
|
44
44
|
readonly pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* A message queue that uses Redis as the underlying storage.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```ts ignore
|
|
51
|
-
* import { createFederation } from "@fedify/fedify";
|
|
52
|
-
* import { RedisMessageQueue } from "@fedify/redis";
|
|
53
|
-
* import { Redis, Cluster } from "ioredis";
|
|
54
|
-
*
|
|
55
|
-
* // Using a standalone Redis instance:
|
|
56
|
-
* const federation = createFederation({
|
|
57
|
-
* // ...
|
|
58
|
-
* queue: new RedisMessageQueue(() => new Redis()),
|
|
59
|
-
* });
|
|
60
|
-
*
|
|
61
|
-
* // Using a Redis Cluster:
|
|
62
|
-
* const federation = createFederation({
|
|
63
|
-
* // ...
|
|
64
|
-
* queue: new RedisMessageQueue(() => new Cluster([
|
|
65
|
-
* { host: "127.0.0.1", port: 7000 },
|
|
66
|
-
* { host: "127.0.0.1", port: 7001 },
|
|
67
|
-
* { host: "127.0.0.1", port: 7002 },
|
|
68
|
-
* ])),
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
47
|
+
* A message queue that uses Redis as the underlying storage.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts ignore
|
|
51
|
+
* import { createFederation } from "@fedify/fedify";
|
|
52
|
+
* import { RedisMessageQueue } from "@fedify/redis";
|
|
53
|
+
* import { Redis, Cluster } from "ioredis";
|
|
54
|
+
*
|
|
55
|
+
* // Using a standalone Redis instance:
|
|
56
|
+
* const federation = createFederation({
|
|
57
|
+
* // ...
|
|
58
|
+
* queue: new RedisMessageQueue(() => new Redis()),
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* // Using a Redis Cluster:
|
|
62
|
+
* const federation = createFederation({
|
|
63
|
+
* // ...
|
|
64
|
+
* queue: new RedisMessageQueue(() => new Cluster([
|
|
65
|
+
* { host: "127.0.0.1", port: 7000 },
|
|
66
|
+
* { host: "127.0.0.1", port: 7001 },
|
|
67
|
+
* { host: "127.0.0.1", port: 7002 },
|
|
68
|
+
* ])),
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
72
|
declare class RedisMessageQueue implements MessageQueue, Disposable {
|
|
73
73
|
#private;
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
* Creates a new Redis message queue.
|
|
76
|
+
* @param redis The Redis client factory.
|
|
77
|
+
* @param options The options for the message queue.
|
|
78
|
+
*/
|
|
79
79
|
constructor(redis: () => Redis | Cluster, options?: RedisMessageQueueOptions);
|
|
80
80
|
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
81
81
|
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
package/dist/mq.d.ts
CHANGED
|
@@ -5,78 +5,78 @@ import { Cluster, Redis, RedisKey } from "ioredis";
|
|
|
5
5
|
|
|
6
6
|
//#region src/mq.d.ts
|
|
7
7
|
/**
|
|
8
|
-
* Options for {@link RedisMessageQueue} class.
|
|
9
|
-
*/
|
|
8
|
+
* Options for {@link RedisMessageQueue} class.
|
|
9
|
+
*/
|
|
10
10
|
interface RedisMessageQueueOptions {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
* The unique identifier for the worker that is processing messages from the
|
|
13
|
+
* queue. If this is not specified, a random identifier will be generated.
|
|
14
|
+
* This is used to prevent multiple workers from processing the same message,
|
|
15
|
+
* so it should be unique for each worker.
|
|
16
|
+
*/
|
|
17
17
|
readonly workerId?: string;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
* The Pub/Sub channel key to use for the message queue. `"fedify_channel"`
|
|
20
|
+
* by default.
|
|
21
|
+
* @default `"fedify_channel"`
|
|
22
|
+
*/
|
|
23
23
|
readonly channelKey?: RedisKey;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
* The Sorted Set key to use for the delayed message queue. `"fedify_queue"`
|
|
26
|
+
* by default.
|
|
27
|
+
* @default `"fedify_queue"`
|
|
28
|
+
*/
|
|
29
29
|
readonly queueKey?: RedisKey;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
* The key to use for locking the message queue. `"fedify_lock"` by default.
|
|
32
|
+
* @default `"fedify_lock"`
|
|
33
|
+
*/
|
|
34
34
|
readonly lockKey?: RedisKey;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
* The codec to use for encoding and decoding messages in the key–value store.
|
|
37
|
+
* Defaults to {@link JsonCodec}.
|
|
38
|
+
* @default {@link JsonCodec}
|
|
39
|
+
*/
|
|
40
40
|
readonly codec?: Codec;
|
|
41
41
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
* The poll interval for the message queue. 5 seconds by default.
|
|
43
|
+
* @default `{ seconds: 5 }`
|
|
44
|
+
*/
|
|
45
45
|
readonly pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* A message queue that uses Redis as the underlying storage.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts ignore
|
|
52
|
-
* import { createFederation } from "@fedify/fedify";
|
|
53
|
-
* import { RedisMessageQueue } from "@fedify/redis";
|
|
54
|
-
* import { Redis, Cluster } from "ioredis";
|
|
55
|
-
*
|
|
56
|
-
* // Using a standalone Redis instance:
|
|
57
|
-
* const federation = createFederation({
|
|
58
|
-
* // ...
|
|
59
|
-
* queue: new RedisMessageQueue(() => new Redis()),
|
|
60
|
-
* });
|
|
61
|
-
*
|
|
62
|
-
* // Using a Redis Cluster:
|
|
63
|
-
* const federation = createFederation({
|
|
64
|
-
* // ...
|
|
65
|
-
* queue: new RedisMessageQueue(() => new Cluster([
|
|
66
|
-
* { host: "127.0.0.1", port: 7000 },
|
|
67
|
-
* { host: "127.0.0.1", port: 7001 },
|
|
68
|
-
* { host: "127.0.0.1", port: 7002 },
|
|
69
|
-
* ])),
|
|
70
|
-
* });
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
48
|
+
* A message queue that uses Redis as the underlying storage.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts ignore
|
|
52
|
+
* import { createFederation } from "@fedify/fedify";
|
|
53
|
+
* import { RedisMessageQueue } from "@fedify/redis";
|
|
54
|
+
* import { Redis, Cluster } from "ioredis";
|
|
55
|
+
*
|
|
56
|
+
* // Using a standalone Redis instance:
|
|
57
|
+
* const federation = createFederation({
|
|
58
|
+
* // ...
|
|
59
|
+
* queue: new RedisMessageQueue(() => new Redis()),
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Using a Redis Cluster:
|
|
63
|
+
* const federation = createFederation({
|
|
64
|
+
* // ...
|
|
65
|
+
* queue: new RedisMessageQueue(() => new Cluster([
|
|
66
|
+
* { host: "127.0.0.1", port: 7000 },
|
|
67
|
+
* { host: "127.0.0.1", port: 7001 },
|
|
68
|
+
* { host: "127.0.0.1", port: 7002 },
|
|
69
|
+
* ])),
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
73
|
declare class RedisMessageQueue implements MessageQueue, Disposable {
|
|
74
74
|
#private;
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
* Creates a new Redis message queue.
|
|
77
|
+
* @param redis The Redis client factory.
|
|
78
|
+
* @param options The options for the message queue.
|
|
79
|
+
*/
|
|
80
80
|
constructor(redis: () => Redis | Cluster, options?: RedisMessageQueueOptions);
|
|
81
81
|
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
82
82
|
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/redis",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0-dev.405+f4e278ae",
|
|
4
4
|
"description": "Redis drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"ioredis": "^5.8.2",
|
|
85
|
-
"@fedify/fedify": "^2.0
|
|
85
|
+
"@fedify/fedify": "^2.1.0-dev.405+f4e278ae"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|
|
89
89
|
"@types/node": "^22.17.0",
|
|
90
90
|
"tsdown": "^0.12.9",
|
|
91
91
|
"typescript": "^5.9.3",
|
|
92
|
-
"@fedify/
|
|
93
|
-
"@fedify/
|
|
92
|
+
"@fedify/fixture": "^2.0.0",
|
|
93
|
+
"@fedify/testing": "^2.1.0-dev.405+f4e278ae"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build:self": "tsdown",
|