Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-redis-cluster

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-redis-cluster - npm Package Compare versions

Comparing version 1.2.9 to 1.2.10

8

dist/cluster-core.module.d.ts
import { DynamicModule, OnModuleDestroy } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { ClusterModuleAsyncOptions, ClusterModuleOptions } from './cluster.interface';
import { RedisClusterModuleAsyncOptions, RedisClusterModuleOptions } from './cluster.interface';
export declare class ClusterCoreModule implements OnModuleDestroy {
private readonly options;
private readonly moduleRef;
constructor(options: ClusterModuleOptions | ClusterModuleOptions[], moduleRef: ModuleRef);
static register(options: ClusterModuleOptions | ClusterModuleOptions[]): DynamicModule;
static forRootAsync(options: ClusterModuleAsyncOptions): DynamicModule;
constructor(options: RedisClusterModuleOptions | RedisClusterModuleOptions[], moduleRef: ModuleRef);
static register(options: RedisClusterModuleOptions | RedisClusterModuleOptions[]): DynamicModule;
static forRootAsync(options: RedisClusterModuleAsyncOptions): DynamicModule;
onModuleDestroy(): void;
}

@@ -32,5 +32,5 @@ "use strict";

cluster_provider_1.createCluster(),
{ provide: cluster_constants_1.CLUSTER_MODULE_OPTIONS, useValue: options },
{ provide: cluster_constants_1.REDIS_CLUSTER_MODULE_OPTIONS, useValue: options },
],
exports: [cluster_service_1.ClusterService],
exports: [cluster_service_1.RedisClusterService],
};

@@ -43,3 +43,3 @@ }

providers: [cluster_provider_1.createCluster(), cluster_provider_1.createAsyncClusterOptions(options)],
exports: [cluster_service_1.ClusterService],
exports: [cluster_service_1.RedisClusterService],
};

@@ -68,8 +68,8 @@ }

common_1.Module({
providers: [cluster_service_1.ClusterService],
exports: [cluster_service_1.ClusterService],
providers: [cluster_service_1.RedisClusterService],
exports: [cluster_service_1.RedisClusterService],
}),
__param(0, common_1.Inject(cluster_constants_1.CLUSTER_MODULE_OPTIONS)),
__param(0, common_1.Inject(cluster_constants_1.REDIS_CLUSTER_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Object, core_1.ModuleRef])
], ClusterCoreModule);
exports.ClusterCoreModule = ClusterCoreModule;

@@ -1,2 +0,2 @@

export declare const CLUSTER_MODULE_OPTIONS: unique symbol;
export declare const REDIS_CLUSTER_MODULE_OPTIONS: unique symbol;
export declare const REDIS_CLUSTER: unique symbol;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.REDIS_CLUSTER = exports.CLUSTER_MODULE_OPTIONS = void 0;
exports.CLUSTER_MODULE_OPTIONS = Symbol('CLUSTER_MODULE_OPTIONS');
exports.REDIS_CLUSTER = exports.REDIS_CLUSTER_MODULE_OPTIONS = void 0;
exports.REDIS_CLUSTER_MODULE_OPTIONS = Symbol('REDIS_CLUSTER_MODULE_OPTIONS');
exports.REDIS_CLUSTER = Symbol('REDIS_CLUSTER');
import { ModuleMetadata } from '@nestjs/common/interfaces';
import { Redis, ClusterOptions } from 'ioredis';
export interface ClusterModuleOptions extends ClusterOptions {
export interface RedisClusterModuleOptions extends ClusterOptions {
name?: string;

@@ -8,5 +8,5 @@ nodes: (string | number | object)[];

}
export interface ClusterModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useFactory?: (...args: any[]) => ClusterModuleOptions | ClusterModuleOptions[] | Promise<ClusterModuleOptions> | Promise<ClusterModuleOptions[]>;
export interface RedisClusterModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useFactory?: (...args: any[]) => RedisClusterModuleOptions | RedisClusterModuleOptions[] | Promise<RedisClusterModuleOptions> | Promise<RedisClusterModuleOptions[]>;
inject?: any[];
}
import { DynamicModule } from '@nestjs/common';
import { ClusterModuleAsyncOptions, ClusterModuleOptions } from './cluster.interface';
export declare class ClusterModule {
static register(options: ClusterModuleOptions | ClusterModuleOptions[]): DynamicModule;
static forRootAsync(options: ClusterModuleAsyncOptions): DynamicModule;
import { RedisClusterModuleAsyncOptions, RedisClusterModuleOptions } from './cluster.interface';
export declare class RedisClusterModule {
static register(options: RedisClusterModuleOptions | RedisClusterModuleOptions[]): DynamicModule;
static forRootAsync(options: RedisClusterModuleAsyncOptions): DynamicModule;
}

@@ -8,11 +8,11 @@ "use strict";

};
var ClusterModule_1;
var RedisClusterModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterModule = void 0;
exports.RedisClusterModule = void 0;
const common_1 = require("@nestjs/common");
const cluster_core_module_1 = require("./cluster-core.module");
let ClusterModule = ClusterModule_1 = class ClusterModule {
let RedisClusterModule = RedisClusterModule_1 = class RedisClusterModule {
static register(options) {
return {
module: ClusterModule_1,
module: RedisClusterModule_1,
imports: [cluster_core_module_1.ClusterCoreModule.register(options)],

@@ -23,3 +23,3 @@ };

return {
module: ClusterModule_1,
module: RedisClusterModule_1,
imports: [cluster_core_module_1.ClusterCoreModule.forRootAsync(options)],

@@ -29,5 +29,5 @@ };

};
ClusterModule = ClusterModule_1 = __decorate([
RedisClusterModule = RedisClusterModule_1 = __decorate([
common_1.Module({})
], ClusterModule);
exports.ClusterModule = ClusterModule;
], RedisClusterModule);
exports.RedisClusterModule = RedisClusterModule;
import { Redis } from 'ioredis';
import { Provider } from '@nestjs/common';
import { ClusterModuleAsyncOptions, ClusterModuleOptions } from './cluster.interface';
import { RedisClusterModuleAsyncOptions, RedisClusterModuleOptions } from './cluster.interface';
export declare class RedisClusterError extends Error {
}
export interface ClusterProvider {
export interface RedisClusterProvider {
defaultKey: string;

@@ -12,6 +12,6 @@ clusters: Map<string, Redis>;

export declare const createCluster: () => Provider;
export declare const createAsyncClusterOptions: (options: ClusterModuleAsyncOptions) => {
export declare const createAsyncClusterOptions: (options: RedisClusterModuleAsyncOptions) => {
provide: symbol;
useFactory: (...args: any[]) => ClusterModuleOptions | Promise<ClusterModuleOptions> | ClusterModuleOptions[] | Promise<ClusterModuleOptions[]>;
useFactory: (...args: any[]) => RedisClusterModuleOptions | Promise<RedisClusterModuleOptions> | RedisClusterModuleOptions[] | Promise<RedisClusterModuleOptions[]>;
inject: any[];
};

@@ -66,8 +66,8 @@ "use strict";

}),
inject: [cluster_constants_1.CLUSTER_MODULE_OPTIONS],
inject: [cluster_constants_1.REDIS_CLUSTER_MODULE_OPTIONS],
});
exports.createAsyncClusterOptions = (options) => ({
provide: cluster_constants_1.CLUSTER_MODULE_OPTIONS,
provide: cluster_constants_1.REDIS_CLUSTER_MODULE_OPTIONS,
useFactory: options.useFactory,
inject: options.inject,
});
import { Redis } from 'ioredis';
import { ClusterProvider } from './cluster.provider';
export declare class ClusterService {
import { RedisClusterProvider } from './cluster.provider';
export declare class RedisClusterService {
private readonly provider;
constructor(provider: ClusterProvider);
constructor(provider: RedisClusterProvider);
getCluster(name?: string): Redis;
getClusters(): Map<string, Redis>;
}

@@ -15,7 +15,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterService = void 0;
exports.RedisClusterService = void 0;
const common_1 = require("@nestjs/common");
const cluster_constants_1 = require("./cluster.constants");
const cluster_provider_1 = require("./cluster.provider");
let ClusterService = class ClusterService {
let RedisClusterService = class RedisClusterService {
constructor(provider) {

@@ -37,7 +37,7 @@ this.provider = provider;

};
ClusterService = __decorate([
RedisClusterService = __decorate([
common_1.Injectable(),
__param(0, common_1.Inject(cluster_constants_1.REDIS_CLUSTER)),
__metadata("design:paramtypes", [Object])
], ClusterService);
exports.ClusterService = ClusterService;
], RedisClusterService);
exports.RedisClusterService = RedisClusterService;
{
"name": "nestjs-redis-cluster",
"version": "1.2.9",
"version": "1.2.10",
"description": "A nestjs redis module w/ cluster support",

@@ -5,0 +5,0 @@ "author": "Ishmael Samuel (useparagon.com)",

@@ -223,10 +223,10 @@ # Nestjs Redis

Let's register the ClusterModule in `app.module.ts`
Let's register the RedisClusterModule in `app.module.ts`
```typescript
import { Module } from '@nestjs/common';
import { ClusterModule } from 'nestjs-redis-cluster';
import { RedisClusterModule } from 'nestjs-redis-cluster';
@Module({
imports: [ClusterModule.register(options)],
imports: [RedisClusterModule.register(options)],
})

@@ -244,3 +244,3 @@ export class AppModule {}

imports: [
ClusterModule.forRootAsync({
RedisClusterModule.forRootAsync({
useFactory: (configService: ConfigService) =>

@@ -257,3 +257,3 @@ configService.get('cluster'),

Config looks like this for ClusterModule
Config looks like this for RedisClusterModule

@@ -295,4 +295,4 @@ ```typescript

],
onClusterReady: client => {
client.on('error', err => {});
onClusterReady: cluster => {
cluster.on('error', err => {});
},

@@ -334,9 +334,9 @@ };

import { Injectable } from '@nestjs/common';
import { ClusterService } from 'nestjs-redis-cluster';
import { RedisClusterService } from 'nestjs-redis-cluster';
@Injectable()
export class TestService {
constructor(private readonly redisService: RedisService) {}
constructor(private readonly redisService: RedisClusterService) {}
async root(): Promise<boolean> {
const client = await this.redisService.getClient('test');
const client = await this.redisService.getCluster('test');
return true;

@@ -353,3 +353,3 @@ }

```typescript
interface ClusterOptions {
interface RedisClusterOptions {
/**

@@ -356,0 +356,0 @@ * client name. default is a uuid, unique.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc