@venizia/ignis-helpers 0.0.8 → 0.0.9-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 +18 -18
- package/dist/modules/queue/bullmq/helper.d.ts +3 -3
- package/dist/modules/queue/bullmq/helper.d.ts.map +1 -1
- package/dist/modules/redis/base/abstract.helper.d.ts +223 -0
- package/dist/modules/redis/base/abstract.helper.d.ts.map +1 -0
- package/dist/modules/redis/base/abstract.helper.js +433 -0
- package/dist/modules/redis/base/abstract.helper.js.map +1 -0
- package/dist/modules/redis/base/index.d.ts +2 -0
- package/dist/modules/redis/base/index.d.ts.map +1 -0
- package/dist/modules/redis/base/index.js +18 -0
- package/dist/modules/redis/base/index.js.map +1 -0
- package/dist/modules/redis/cluster/cluster.helper.d.ts +11 -0
- package/dist/modules/redis/cluster/cluster.helper.d.ts.map +1 -0
- package/dist/modules/redis/{cluster.helper.js → cluster/cluster.helper.js} +3 -3
- package/dist/modules/redis/cluster/cluster.helper.js.map +1 -0
- package/dist/modules/redis/cluster/index.d.ts +2 -0
- package/dist/modules/redis/cluster/index.d.ts.map +1 -0
- package/dist/modules/redis/cluster/index.js +18 -0
- package/dist/modules/redis/cluster/index.js.map +1 -0
- package/dist/modules/redis/common/constants.d.ts +17 -0
- package/dist/modules/redis/common/constants.d.ts.map +1 -0
- package/dist/modules/redis/common/constants.js +23 -0
- package/dist/modules/redis/common/constants.js.map +1 -0
- package/dist/modules/redis/common/index.d.ts +4 -0
- package/dist/modules/redis/common/index.d.ts.map +1 -0
- package/dist/modules/redis/common/index.js +20 -0
- package/dist/modules/redis/common/index.js.map +1 -0
- package/dist/modules/redis/common/interfaces.d.ts +223 -0
- package/dist/modules/redis/common/interfaces.d.ts.map +1 -0
- package/dist/modules/redis/common/interfaces.js +3 -0
- package/dist/modules/redis/common/interfaces.js.map +1 -0
- package/dist/modules/redis/common/types.d.ts +65 -0
- package/dist/modules/redis/common/types.d.ts.map +1 -0
- package/dist/modules/redis/common/types.js.map +1 -0
- package/dist/modules/redis/factory.d.ts +22 -0
- package/dist/modules/redis/factory.d.ts.map +1 -0
- package/dist/modules/redis/factory.js +25 -0
- package/dist/modules/redis/factory.js.map +1 -0
- package/dist/modules/redis/index.d.ts +6 -4
- package/dist/modules/redis/index.d.ts.map +1 -1
- package/dist/modules/redis/index.js +6 -4
- package/dist/modules/redis/index.js.map +1 -1
- package/dist/modules/redis/sentinel/index.d.ts +2 -0
- package/dist/modules/redis/sentinel/index.d.ts.map +1 -0
- package/dist/modules/redis/sentinel/index.js +18 -0
- package/dist/modules/redis/sentinel/index.js.map +1 -0
- package/dist/modules/redis/sentinel/sentinel.helper.d.ts +8 -0
- package/dist/modules/redis/sentinel/sentinel.helper.d.ts.map +1 -0
- package/dist/modules/redis/sentinel/sentinel.helper.js +41 -0
- package/dist/modules/redis/sentinel/sentinel.helper.js.map +1 -0
- package/dist/modules/redis/single/index.d.ts +2 -0
- package/dist/modules/redis/single/index.d.ts.map +1 -0
- package/dist/modules/redis/single/index.js +18 -0
- package/dist/modules/redis/single/index.js.map +1 -0
- package/dist/modules/redis/single/single.helper.d.ts +8 -0
- package/dist/modules/redis/single/single.helper.d.ts.map +1 -0
- package/dist/modules/redis/single/single.helper.js +33 -0
- package/dist/modules/redis/single/single.helper.js.map +1 -0
- package/dist/modules/socket/socket-io/common/types.d.ts +2 -2
- package/dist/modules/socket/socket-io/common/types.d.ts.map +1 -1
- package/dist/modules/socket/websocket/common/types.d.ts +3 -3
- package/dist/modules/socket/websocket/common/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/modules/redis/cluster.helper.d.ts +0 -11
- package/dist/modules/redis/cluster.helper.d.ts.map +0 -1
- package/dist/modules/redis/cluster.helper.js.map +0 -1
- package/dist/modules/redis/default.helper.d.ts +0 -138
- package/dist/modules/redis/default.helper.d.ts.map +0 -1
- package/dist/modules/redis/default.helper.js +0 -320
- package/dist/modules/redis/default.helper.js.map +0 -1
- package/dist/modules/redis/single.helper.d.ts +0 -8
- package/dist/modules/redis/single.helper.d.ts.map +0 -1
- package/dist/modules/redis/single.helper.js +0 -41
- package/dist/modules/redis/single.helper.js.map +0 -1
- package/dist/modules/redis/types.d.ts +0 -44
- package/dist/modules/redis/types.d.ts.map +0 -1
- package/dist/modules/redis/types.js.map +0 -1
- /package/dist/modules/redis/{types.js → common/types.js} +0 -0
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# :fire: IGNIS - @venizia/ignis-helpers
|
|
4
4
|
|
|
5
|
-
**Production-ready infrastructure utilities for the
|
|
5
|
+
**Production-ready infrastructure utilities for the IGNIS Framework**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@venizia/ignis-helpers)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
10
|
|
|
11
|
-
Logging, Redis, queues (BullMQ/MQTT/Kafka), storage (MinIO/Disk/Memory), cryptography (AES/RSA/ECDH), networking (TCP/TLS/UDP/HTTP), cron, Socket.IO, WebSocket, UID generation, worker threads, and more. Designed to integrate seamlessly with the
|
|
11
|
+
Logging, Redis, queues (BullMQ/MQTT/Kafka), storage (MinIO/Disk/Memory), cryptography (AES/RSA/ECDH), networking (TCP/TLS/UDP/HTTP), cron, Socket.IO, WebSocket, UID generation, worker threads, and more. Designed to integrate seamlessly with the IGNIS IoC container.
|
|
12
12
|
|
|
13
13
|
[Installation](#installation) • [Quick Start](#module-overview) • [API Reference](#logger) • [Documentation](https://venizia-ai.github.io/ignis)
|
|
14
14
|
|
|
@@ -112,7 +112,7 @@ import { CryptoHelper } from '@venizia/ignis-helpers/crypto';
|
|
|
112
112
|
- [Module Utility](#module-utility)
|
|
113
113
|
- [Common Types](#common-types)
|
|
114
114
|
- [Key Patterns](#key-patterns)
|
|
115
|
-
- [Integration with
|
|
115
|
+
- [Integration with IGNIS Core](#integration-with-ignis-core)
|
|
116
116
|
- [Environment Variables Reference](#environment-variables-reference)
|
|
117
117
|
- [Error Handling Patterns](#error-handling-patterns)
|
|
118
118
|
- [Performance Tips](#performance-tips)
|
|
@@ -161,7 +161,7 @@ import { KafkaProducerHelper, KafkaConsumerHelper, KafkaAdminHelper } from '@ven
|
|
|
161
161
|
| `ioredis` | Redis client |
|
|
162
162
|
| `dayjs` | Date/time utilities |
|
|
163
163
|
| `hono` | HTTP framework types, JSX re-exports |
|
|
164
|
-
| `drizzle-orm` | ORM types (used across
|
|
164
|
+
| `drizzle-orm` | ORM types (used across IGNIS) |
|
|
165
165
|
| `lodash` | Utility functions |
|
|
166
166
|
| `reflect-metadata` | Decorator metadata |
|
|
167
167
|
| `@venizia/ignis-inversion` | IoC container, `@inject`/`@injectable` |
|
|
@@ -500,9 +500,9 @@ Full-featured Redis client wrapper around IoRedis supporting single instances an
|
|
|
500
500
|
### Single Instance
|
|
501
501
|
|
|
502
502
|
```typescript
|
|
503
|
-
import {
|
|
503
|
+
import { RedisSingleHelper } from '@venizia/ignis-helpers';
|
|
504
504
|
|
|
505
|
-
const redis = new
|
|
505
|
+
const redis = new RedisSingleHelper({
|
|
506
506
|
name: 'main-redis',
|
|
507
507
|
host: '127.0.0.1',
|
|
508
508
|
port: 6379,
|
|
@@ -536,7 +536,7 @@ const cluster = new RedisClusterHelper({
|
|
|
536
536
|
});
|
|
537
537
|
```
|
|
538
538
|
|
|
539
|
-
Both `
|
|
539
|
+
Both `RedisSingleHelper` and `RedisClusterHelper` extend `AbstractRedisHelper`, which provides all data operations. They differ only in how the underlying IoRedis client is created.
|
|
540
540
|
|
|
541
541
|
### String Operations
|
|
542
542
|
|
|
@@ -787,7 +787,7 @@ const producer = BullMQHelper.newInstance({
|
|
|
787
787
|
queueName: 'email-queue',
|
|
788
788
|
identifier: 'email-producer',
|
|
789
789
|
role: 'queue', // 'queue' = producer, 'worker' = consumer
|
|
790
|
-
redisConnection: redis, //
|
|
790
|
+
redisConnection: redis, // IRedisHelper instance
|
|
791
791
|
});
|
|
792
792
|
|
|
793
793
|
// Add jobs to the queue
|
|
@@ -1660,7 +1660,7 @@ const io = new SocketIOServerHelper({
|
|
|
1660
1660
|
cors: { origin: '*' },
|
|
1661
1661
|
path: '/socket.io',
|
|
1662
1662
|
},
|
|
1663
|
-
redisConnection: redis, //
|
|
1663
|
+
redisConnection: redis, // IRedisHelper instance
|
|
1664
1664
|
defaultRooms: ['io-default', 'io-notification'],
|
|
1665
1665
|
authenticateTimeout: 10_000, // 10s to authenticate
|
|
1666
1666
|
pingInterval: 30_000, // 30s ping interval
|
|
@@ -1784,7 +1784,7 @@ import { WebSocketServerHelper } from '@venizia/ignis-helpers';
|
|
|
1784
1784
|
const ws = new WebSocketServerHelper({
|
|
1785
1785
|
identifier: 'realtime',
|
|
1786
1786
|
server: bunServer, // Bun server instance (IBunServer)
|
|
1787
|
-
redisConnection: redis, //
|
|
1787
|
+
redisConnection: redis, // IRedisHelper instance
|
|
1788
1788
|
path: '/ws', // Default: '/ws'
|
|
1789
1789
|
authTimeout: 5_000, // 5s to authenticate (default)
|
|
1790
1790
|
heartbeatInterval: 30_000, // 30s between heartbeats (default)
|
|
@@ -2899,21 +2899,21 @@ interface IConfigurable<Options, Result> {
|
|
|
2899
2899
|
|
|
2900
2900
|
---
|
|
2901
2901
|
|
|
2902
|
-
## Integration with
|
|
2902
|
+
## Integration with IGNIS Core
|
|
2903
2903
|
|
|
2904
|
-
The helpers package is designed to integrate with the
|
|
2904
|
+
The helpers package is designed to integrate with the IGNIS framework's IoC container. Here is how helpers are typically used within an IGNIS application:
|
|
2905
2905
|
|
|
2906
2906
|
**Binding helpers in the application lifecycle:**
|
|
2907
2907
|
|
|
2908
2908
|
```typescript
|
|
2909
2909
|
import { BaseApplication, BootMixin } from '@venizia/ignis';
|
|
2910
|
-
import {
|
|
2910
|
+
import { RedisSingleHelper, Logger } from '@venizia/ignis-helpers';
|
|
2911
2911
|
|
|
2912
2912
|
class MyApplication extends BootMixin(BaseApplication) {
|
|
2913
2913
|
async preConfigure() {
|
|
2914
2914
|
// Register Redis as a singleton binding
|
|
2915
2915
|
this.container.bind('datasources.Redis').to(
|
|
2916
|
-
new
|
|
2916
|
+
new RedisSingleHelper({
|
|
2917
2917
|
name: 'main',
|
|
2918
2918
|
host: process.env.REDIS_HOST,
|
|
2919
2919
|
port: parseInt(process.env.REDIS_PORT),
|
|
@@ -3005,7 +3005,7 @@ Complete table of all environment variables used across all helpers modules.
|
|
|
3005
3005
|
All connection helpers use lifecycle hooks for error handling. Errors are never swallowed -- they are logged and forwarded to your callback:
|
|
3006
3006
|
|
|
3007
3007
|
```typescript
|
|
3008
|
-
const redis = new
|
|
3008
|
+
const redis = new RedisSingleHelper({
|
|
3009
3009
|
// ...
|
|
3010
3010
|
onError: ({ name, helper, error }) => {
|
|
3011
3011
|
// Log to external monitoring
|
|
@@ -3116,13 +3116,13 @@ try {
|
|
|
3116
3116
|
|
|
3117
3117
|
---
|
|
3118
3118
|
|
|
3119
|
-
## About
|
|
3119
|
+
## About IGNIS
|
|
3120
3120
|
|
|
3121
|
-
|
|
3121
|
+
IGNIS brings together the structured, enterprise development experience of **LoopBack 4** with the blazing speed and simplicity of **Hono** -- giving you the best of both worlds.
|
|
3122
3122
|
|
|
3123
3123
|
## Documentation
|
|
3124
3124
|
|
|
3125
|
-
- [
|
|
3125
|
+
- [IGNIS Repository](https://github.com/VENIZIA-AI/ignis)
|
|
3126
3126
|
- [Getting Started](https://github.com/VENIZIA-AI/ignis/blob/main/docs/wiki/content/get-started/index.md)
|
|
3127
3127
|
- [Helpers Reference](https://github.com/VENIZIA-AI/ignis/blob/main/docs/wiki/content/references/helpers/index.md)
|
|
3128
3128
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseHelper } from '../../../modules/base';
|
|
2
|
-
import {
|
|
2
|
+
import { IRedisHelper } from '../../../modules/redis';
|
|
3
3
|
import { Job, Queue, Worker } from 'bullmq';
|
|
4
4
|
import { TBullQueueRole } from '../common';
|
|
5
5
|
interface IBullMQOptions<TQueueElement = any, TQueueResult = any> {
|
|
6
6
|
queueName: string;
|
|
7
7
|
identifier: string;
|
|
8
8
|
role: TBullQueueRole;
|
|
9
|
-
redisConnection:
|
|
9
|
+
redisConnection: IRedisHelper;
|
|
10
10
|
numberOfWorker?: number;
|
|
11
11
|
lockDuration?: number;
|
|
12
12
|
onWorkerData?: (job: Job<TQueueElement, TQueueResult>) => Promise<any>;
|
|
@@ -16,7 +16,7 @@ interface IBullMQOptions<TQueueElement = any, TQueueResult = any> {
|
|
|
16
16
|
export declare class BullMQHelper<TQueueElement = any, TQueueResult = any> extends BaseHelper {
|
|
17
17
|
protected queueName: string;
|
|
18
18
|
protected role: TBullQueueRole;
|
|
19
|
-
protected redisConnection:
|
|
19
|
+
protected redisConnection: IRedisHelper;
|
|
20
20
|
queue: Queue<TQueueElement, TQueueResult>;
|
|
21
21
|
worker: Worker<TQueueElement, TQueueResult>;
|
|
22
22
|
protected numberOfWorker: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/modules/queue/bullmq/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/modules/queue/bullmq/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAqB,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,UAAU,cAAc,CAAC,aAAa,GAAG,GAAG,EAAE,YAAY,GAAG,GAAG;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,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CAAC;IACnB,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAC3B,GAAG,EAAE,GAAG,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,SAAS,EACjD,KAAK,EAAE,KAAK,KACT,OAAO,CAAC,IAAI,CAAC,CAAC;gBAEP,OAAO,EAAE,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC;IA2BhE,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;IAI/D,OAAO,CAAC,gBAAgB;IASxB,cAAc;IAkBd,eAAe;IAmEf,SAAS;IAuBH,KAAK;CAcZ"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { BaseHelper } from '../../../modules/base';
|
|
2
|
+
import { IRedisHelper } from './../common/interfaces';
|
|
3
|
+
import { IRedisHelperCallbacks, TRedisClient } from './../common/types';
|
|
4
|
+
export declare class AbstractRedisHelper<ClientType extends TRedisClient = TRedisClient> extends BaseHelper implements IRedisHelper {
|
|
5
|
+
client: ClientType;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
constructor(opts: {
|
|
8
|
+
scope: string;
|
|
9
|
+
identifier: string;
|
|
10
|
+
client: ClientType;
|
|
11
|
+
} & IRedisHelperCallbacks);
|
|
12
|
+
protected static buildRetryStrategy(opts: {
|
|
13
|
+
maxRetry: number;
|
|
14
|
+
}): (attemptCounter: number) => number | undefined;
|
|
15
|
+
protected static buildDefaultOpts(opts: {
|
|
16
|
+
maxRetry: number;
|
|
17
|
+
}): {
|
|
18
|
+
showFriendlyErrorStack: boolean;
|
|
19
|
+
maxRetriesPerRequest: null;
|
|
20
|
+
retryStrategy: (attemptCounter: number) => number | undefined;
|
|
21
|
+
};
|
|
22
|
+
getClient(): ClientType;
|
|
23
|
+
duplicateClient(): import("ioredis").default | import("ioredis").Cluster;
|
|
24
|
+
ping(): Promise<"PONG">;
|
|
25
|
+
connect(): Promise<boolean>;
|
|
26
|
+
disconnect(): Promise<boolean>;
|
|
27
|
+
exists(opts: {
|
|
28
|
+
keys: Array<string>;
|
|
29
|
+
}): Promise<number>;
|
|
30
|
+
expire(opts: {
|
|
31
|
+
key: string;
|
|
32
|
+
seconds: number;
|
|
33
|
+
}): Promise<boolean>;
|
|
34
|
+
expireAt(opts: {
|
|
35
|
+
key: string;
|
|
36
|
+
atEpochSeconds: number;
|
|
37
|
+
}): Promise<boolean>;
|
|
38
|
+
ttl(opts: {
|
|
39
|
+
key: string;
|
|
40
|
+
}): Promise<number>;
|
|
41
|
+
persist(opts: {
|
|
42
|
+
key: string;
|
|
43
|
+
}): Promise<boolean>;
|
|
44
|
+
incr(opts: {
|
|
45
|
+
key: string;
|
|
46
|
+
}): Promise<number>;
|
|
47
|
+
decr(opts: {
|
|
48
|
+
key: string;
|
|
49
|
+
}): Promise<number>;
|
|
50
|
+
incrBy(opts: {
|
|
51
|
+
key: string;
|
|
52
|
+
value: number;
|
|
53
|
+
}): Promise<number>;
|
|
54
|
+
decrBy(opts: {
|
|
55
|
+
key: string;
|
|
56
|
+
value: number;
|
|
57
|
+
}): Promise<number>;
|
|
58
|
+
set<T>(opts: {
|
|
59
|
+
key: string;
|
|
60
|
+
value: T;
|
|
61
|
+
options?: {
|
|
62
|
+
log?: boolean;
|
|
63
|
+
expiresIn?: number;
|
|
64
|
+
};
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
get<T = string>(opts: {
|
|
67
|
+
key: string;
|
|
68
|
+
transform?: (input: string) => T;
|
|
69
|
+
}): Promise<T | null>;
|
|
70
|
+
del(opts: {
|
|
71
|
+
keys: Array<string>;
|
|
72
|
+
}): Promise<number>;
|
|
73
|
+
getString(opts: {
|
|
74
|
+
key: string;
|
|
75
|
+
}): Promise<string | null>;
|
|
76
|
+
getStrings(opts: {
|
|
77
|
+
keys: Array<string>;
|
|
78
|
+
}): Promise<(string | null)[]>;
|
|
79
|
+
getObject<T>(opts: {
|
|
80
|
+
key: string;
|
|
81
|
+
}): Promise<T | null>;
|
|
82
|
+
getObjects(opts: {
|
|
83
|
+
keys: Array<string>;
|
|
84
|
+
}): Promise<any[]>;
|
|
85
|
+
mSet<T>(opts: {
|
|
86
|
+
payload: Array<{
|
|
87
|
+
key: string;
|
|
88
|
+
value: T;
|
|
89
|
+
}>;
|
|
90
|
+
options?: {
|
|
91
|
+
log?: boolean;
|
|
92
|
+
};
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
mGet<T = string>(opts: {
|
|
95
|
+
keys: Array<string>;
|
|
96
|
+
transform?: (input: string) => T;
|
|
97
|
+
}): Promise<(T | null)[]>;
|
|
98
|
+
keys(opts: {
|
|
99
|
+
key: string;
|
|
100
|
+
}): Promise<string[]>;
|
|
101
|
+
hSet<T extends Record<string, unknown>>(opts: {
|
|
102
|
+
key: string;
|
|
103
|
+
value: T;
|
|
104
|
+
options?: {
|
|
105
|
+
log?: boolean;
|
|
106
|
+
};
|
|
107
|
+
}): Promise<number>;
|
|
108
|
+
hGetAll(opts: {
|
|
109
|
+
key: string;
|
|
110
|
+
transform?: <T, R>(input: T) => R;
|
|
111
|
+
}): Promise<unknown>;
|
|
112
|
+
hGet(opts: {
|
|
113
|
+
key: string;
|
|
114
|
+
field: string;
|
|
115
|
+
}): Promise<string | null>;
|
|
116
|
+
hDel(opts: {
|
|
117
|
+
key: string;
|
|
118
|
+
fields: Array<string>;
|
|
119
|
+
}): Promise<number>;
|
|
120
|
+
hExists(opts: {
|
|
121
|
+
key: string;
|
|
122
|
+
field: string;
|
|
123
|
+
}): Promise<boolean>;
|
|
124
|
+
hKeys(opts: {
|
|
125
|
+
key: string;
|
|
126
|
+
}): Promise<string[]>;
|
|
127
|
+
hVals(opts: {
|
|
128
|
+
key: string;
|
|
129
|
+
}): Promise<string[]>;
|
|
130
|
+
hIncrBy(opts: {
|
|
131
|
+
key: string;
|
|
132
|
+
field: string;
|
|
133
|
+
value: number;
|
|
134
|
+
}): Promise<number>;
|
|
135
|
+
hLen(opts: {
|
|
136
|
+
key: string;
|
|
137
|
+
}): Promise<number>;
|
|
138
|
+
sAdd(opts: {
|
|
139
|
+
key: string;
|
|
140
|
+
members: Array<string | number>;
|
|
141
|
+
}): Promise<number>;
|
|
142
|
+
sRem(opts: {
|
|
143
|
+
key: string;
|
|
144
|
+
members: Array<string | number>;
|
|
145
|
+
}): Promise<number>;
|
|
146
|
+
sMembers(opts: {
|
|
147
|
+
key: string;
|
|
148
|
+
}): Promise<string[]>;
|
|
149
|
+
sIsMember(opts: {
|
|
150
|
+
key: string;
|
|
151
|
+
member: string | number;
|
|
152
|
+
}): Promise<boolean>;
|
|
153
|
+
sCard(opts: {
|
|
154
|
+
key: string;
|
|
155
|
+
}): Promise<number>;
|
|
156
|
+
lPush(opts: {
|
|
157
|
+
key: string;
|
|
158
|
+
values: Array<string | number>;
|
|
159
|
+
}): Promise<number>;
|
|
160
|
+
rPush(opts: {
|
|
161
|
+
key: string;
|
|
162
|
+
values: Array<string | number>;
|
|
163
|
+
}): Promise<number>;
|
|
164
|
+
lPop(opts: {
|
|
165
|
+
key: string;
|
|
166
|
+
}): Promise<string | null>;
|
|
167
|
+
rPop(opts: {
|
|
168
|
+
key: string;
|
|
169
|
+
}): Promise<string | null>;
|
|
170
|
+
lRange(opts: {
|
|
171
|
+
key: string;
|
|
172
|
+
start: number;
|
|
173
|
+
stop: number;
|
|
174
|
+
}): Promise<string[]>;
|
|
175
|
+
lLen(opts: {
|
|
176
|
+
key: string;
|
|
177
|
+
}): Promise<number>;
|
|
178
|
+
jSet<T>(opts: {
|
|
179
|
+
key: string;
|
|
180
|
+
path: string;
|
|
181
|
+
value: T;
|
|
182
|
+
}): Promise<string | null>;
|
|
183
|
+
jGet<T>(opts: {
|
|
184
|
+
key: string;
|
|
185
|
+
path?: string;
|
|
186
|
+
}): Promise<T | null>;
|
|
187
|
+
jDelete(opts: {
|
|
188
|
+
key: string;
|
|
189
|
+
path?: string;
|
|
190
|
+
}): Promise<number>;
|
|
191
|
+
jNumberIncreaseBy(opts: {
|
|
192
|
+
key: string;
|
|
193
|
+
path: string;
|
|
194
|
+
value: number;
|
|
195
|
+
}): Promise<string | null>;
|
|
196
|
+
jStringAppend(opts: {
|
|
197
|
+
key: string;
|
|
198
|
+
path: string;
|
|
199
|
+
value: string;
|
|
200
|
+
}): Promise<number[] | null>;
|
|
201
|
+
jPush<T>(opts: {
|
|
202
|
+
key: string;
|
|
203
|
+
path: string;
|
|
204
|
+
value: T;
|
|
205
|
+
}): Promise<number[] | null>;
|
|
206
|
+
jPop<T>(opts: {
|
|
207
|
+
key: string;
|
|
208
|
+
path: string;
|
|
209
|
+
}): Promise<T | null>;
|
|
210
|
+
execute<R>(command: string, parameters?: Array<string | number | Buffer>): Promise<R>;
|
|
211
|
+
publish<T>(opts: {
|
|
212
|
+
topics: Array<string>;
|
|
213
|
+
payload: T;
|
|
214
|
+
useCompress?: boolean;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
subscribe(opts: {
|
|
217
|
+
topic: string;
|
|
218
|
+
}): void;
|
|
219
|
+
unsubscribe(opts: {
|
|
220
|
+
topic: string;
|
|
221
|
+
}): void;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=abstract.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract.helper.d.ts","sourceRoot":"","sources":["../../../../src/modules/redis/base/abstract.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAExE,qBAAa,mBAAmB,CAAC,UAAU,SAAS,YAAY,GAAG,YAAY,CAC7E,SAAQ,UACR,YAAW,YAAY;IAEvB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gB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