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

@adonisjs/redis

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/redis - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

build/templates/config.txt

102

build/adonis-typings/redis.d.ts
/// <reference types="ioredis" />
/// <reference types="node" />
declare module '@ioc:Adonis/Addons/Redis' {
import Emittery from 'emittery';
import { EventEmitter } from 'events';
import { Redis, RedisOptions, ClusterOptions, Cluster, NodeRole } from 'ioredis';
type ConnectionsList = Exclude<keyof RedisConfigContract, 'connection'>;
type GetFactory<T extends ConnectionsList> = RedisConfigContract[T] extends ClusterConfigContract ? RedisClusterFactoryContract : RedisFactoryContract;
export interface RedisConnectionsList {
}
type GetFactory<T extends keyof RedisConnectionsList> = RedisConnectionsList[T] extends ClusterConfigContract ? RedisClusterFactoryContract : RedisFactoryContract;
export type ReportNode = {
connection: string;
status: string;
used_memory: string;
error: any;
};
export type PubSubChannelHandler<T extends any = any> = ((data: T) => Promise<void> | void);

@@ -20,6 +30,9 @@ export type PubSubPatternHandler<T extends any = any> = ((channel: string, data: T) => Promise<void> | void);

clusterOptions?: ClusterOptions;
healthCheck?: boolean;
};
export type ConnectionConfigContract = RedisOptions;
export type RedisCommandsContract = Omit<Redis, 'Promise' | 'status' | 'connect' | 'disconnect' | 'duplicate' | 'subscribe' | 'unsubscribe' | 'psubscribe' | 'punsubscribe' | 'quit'>;
export interface RedisFactoryContract extends RedisCommandsContract, RedisPubSubContract {
export type ConnectionConfigContract = RedisOptions & {
healthCheck?: boolean;
};
export type RedisCommandsContract = Omit<Redis, 'Promise' | 'status' | 'connect' | 'disconnect' | 'duplicate' | 'subscribe' | 'unsubscribe' | 'psubscribe' | 'punsubscribe' | 'quit' | keyof EventEmitter>;
export interface RedisFactoryContract extends RedisCommandsContract, RedisPubSubContract, Emittery {
status: string;

@@ -33,5 +46,22 @@ connectionName: string;

duplicate(): Redis;
getReport(checkForMemory?: boolean): Promise<ReportNode>;
quit(): Promise<void>;
on(event: 'connect', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'ready', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'close', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'reconnecting', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'end', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:connect', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:ready', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:close', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:reconnecting', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:end', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:ready', callback: ((data: [this, number]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:ready', callback: ((data: [this, number]) => any)): Emittery.UnsubscribeFn;
}
export interface RedisClusterFactoryContract extends RedisCommandsContract, RedisPubSubContract {
export interface RedisClusterFactoryContract extends RedisCommandsContract, RedisPubSubContract, Emittery {
status: string;

@@ -42,2 +72,3 @@ connectionName: string;

ioSubscriberConnection?: Cluster;
getReport(checkForMemory?: boolean): Promise<ReportNode>;
connect(callback?: () => void): Promise<any>;

@@ -48,13 +79,62 @@ nodes(role?: NodeRole): Redis[];

quit(): Promise<void>;
on(event: 'connect', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'ready', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'close', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'reconnecting', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'end', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:connect', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:ready', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:close', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:reconnecting', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:end', callback: ((data: [this]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:ready', callback: ((data: [this, number]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:error', callback: ((data: [this, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:ready', callback: ((data: [this, number]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:added', callback: ((data: [this, Redis]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:removed', callback: ((data: [this, Redis]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:error', callback: ((data: [this, any, string]) => any)): Emittery.UnsubscribeFn;
}
export interface RedisConfigContract {
connection: ConnectionsList;
connection: keyof RedisConnectionsList;
connections: {
[P in keyof RedisConnectionsList]: RedisConnectionsList[P];
};
}
export interface RedisContract extends Omit<GetFactory<RedisConfigContract['connection']>, 'status' | 'connectionName' | 'subscriberStatus' | 'ioConnection' | 'ioSubscriberConnection' | 'duplicate' | 'disconnect' | 'quit'> {
connection<Connection extends ConnectionsList>(name: Connection): GetFactory<Connection>;
type Factory = RedisFactoryContract | RedisClusterFactoryContract;
export interface RedisContract extends Emittery {
on(event: 'connect', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'ready', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'error', callback: ((data: [Factory, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'close', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'reconnecting', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'end', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:connect', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:ready', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:error', callback: ((data: [Factory, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:close', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:reconnecting', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscriber:end', callback: ((data: [Factory]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:error', callback: ((data: [Factory, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'subscription:ready', callback: ((data: [Factory, number]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:error', callback: ((data: [Factory, any]) => any)): Emittery.UnsubscribeFn;
on(event: 'psubscription:ready', callback: ((data: [Factory, number]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:added', callback: ((data: [Factory, Redis]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:removed', callback: ((data: [Factory, Redis]) => any)): Emittery.UnsubscribeFn;
on(event: 'node:error', callback: ((data: [Factory, any, string]) => any)): Emittery.UnsubscribeFn;
connection<Connection extends keyof RedisConnectionsList>(name: Connection): GetFactory<Connection>;
connection(name: string): RedisFactoryContract | RedisClusterFactoryContract;
connection(): GetFactory<RedisConfigContract['connection']>;
quit<Connection extends ConnectionsList>(name: Connection): Promise<void>;
report(): Promise<{
health: {
healthy: boolean;
message: string;
};
meta: ReportNode[];
}>;
quit<Connection extends keyof RedisConnectionsList>(name: Connection): Promise<void>;
quit(name?: string): Promise<void>;
disconnect<Connection extends ConnectionsList>(name: Connection): Promise<void>;
disconnect<Connection extends keyof RedisConnectionsList>(name: Connection): Promise<void>;
disconnect(name?: string): Promise<void>;

@@ -61,0 +141,0 @@ quitAll(): Promise<void>;

5

build/providers/RedisProvider.d.ts

@@ -0,5 +1,6 @@

import { IocContract } from '@adonisjs/fold';
export default class RedisProvider {
protected $container: any;
constructor($container: any);
protected $container: IocContract;
constructor($container: IocContract);
register(): void;
}

@@ -10,6 +10,4 @@ "use strict";

this.$container.singleton('Adonis/Addons/Redis', () => {
const config = this.$container.use('Adonis/Src/Config');
return new Redis_1.Redis(config.get('redis', {
connection: 'primary',
}));
const config = this.$container.use('Adonis/Core/Config').get('redis', {});
return new Redis_1.Redis(this.$container, config);
});

@@ -16,0 +14,0 @@ }

/// <reference path="../../adonis-typings/redis.d.ts" />
import * as Emitter from 'emittery';
import Emitter from 'emittery';
import { Redis, Cluster } from 'ioredis';
import { PubSubChannelHandler, PubSubPatternHandler } from '@ioc:Adonis/Addons/Redis';
import { IocContract } from '@adonisjs/fold';
import { PubSubChannelHandler, PubSubPatternHandler, ReportNode } from '@ioc:Adonis/Addons/Redis';
export declare abstract class AbstractFactory<T extends (Redis | Cluster)> extends Emitter {

@@ -11,8 +12,11 @@ connectionName: string;

protected $psubscriptions: Map<string, PubSubPatternHandler>;
private _namespace;
private _deferredReportAttempts;
private _lastError?;
private _resolver;
private _resolveIoCBinding;
private _getUsedMemory;
readonly status: string;
readonly subscriberStatus: string | undefined;
protected abstract $makeSubscriberConnection(): void;
constructor(connectionName: string);
constructor(connectionName: string, container: IocContract);
protected $proxyConnectionEvents(): void;

@@ -26,2 +30,3 @@ protected $setupSubscriberConnection(): void;

punsubscribe(pattern: string): any;
getReport(checkForMemory?: boolean): Promise<ReportNode>;
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Emitter = require("emittery");
const emittery_1 = __importDefault(require("emittery"));
const utils_1 = require("@poppinss/utils");
class AbstractFactory extends Emitter {
constructor(connectionName) {
const sleep = () => new Promise((resolve) => setTimeout(resolve, 1000));
class AbstractFactory extends emittery_1.default {
constructor(connectionName, container) {
super();

@@ -11,11 +15,15 @@ this.connectionName = connectionName;

this.$psubscriptions = new Map();
this._namespace = 'App/Listeners';
this._deferredReportAttempts = 0;
this._resolver = container.getResolver(undefined, 'redisListeners', 'App/Listeners');
}
_resolveIoCBinding(handler) {
const parsed = utils_1.parseIocReference(handler, this._namespace);
return function dynamicEventHandler(...args) {
const instance = global[Symbol.for('ioc.make')](parsed.namespace);
return global[Symbol.for('ioc.call')](instance, parsed.method, args);
return (...args) => {
return this._resolver.call(handler, undefined, args);
};
}
async _getUsedMemory() {
const memory = await this.ioConnection.info('memory');
const memorySegment = memory.split(/\r|\r\n/).find((line) => line.trim().startsWith('used_memory_human'));
return memorySegment ? memorySegment.split(':')[1] : 'unknown';
}
get status() {

@@ -31,11 +39,17 @@ return this.ioConnection.status;

$proxyConnectionEvents() {
this.ioConnection.on('connect', () => this.emit('connect'));
this.ioConnection.on('ready', () => this.emit('ready'));
this.ioConnection.on('error', (error) => this.emit('error', error));
this.ioConnection.on('close', () => this.emit('close'));
this.ioConnection.on('reconnecting', () => this.emit('reconnecting'));
this.ioConnection.on('+node', (node) => this.emit('node:added', node));
this.ioConnection.on('-node', (node) => this.emit('node:removed', node));
this.ioConnection.on('connect', () => this.emit('connect', [this]));
this.ioConnection.on('ready', () => {
this._lastError = null;
this.emit('ready', [this]);
});
this.ioConnection.on('error', (error) => {
this._lastError = error;
this.emit('error', [this, error]);
});
this.ioConnection.on('close', () => this.emit('close', [this]));
this.ioConnection.on('reconnecting', () => this.emit('reconnecting', [this]));
this.ioConnection.on('+node', (node) => this.emit('node:added', [this, node]));
this.ioConnection.on('-node', (node) => this.emit('node:removed', [this, node]));
this.ioConnection.on('node error', (error, address) => {
this.emit('node:error', { error, address });
this.emit('node:error', [this, error, address]);
});

@@ -45,3 +59,3 @@ this.ioConnection.on('end', async () => {

try {
await this.emit('end', this);
await this.emit('end', [this]);
}

@@ -70,11 +84,11 @@ catch (error) {

});
this.ioSubscriberConnection.on('connect', () => this.emit('subscriber:connect'));
this.ioSubscriberConnection.on('ready', () => this.emit('subscriber:ready'));
this.ioSubscriberConnection.on('error', (error) => this.emit('subscriber:error', error));
this.ioSubscriberConnection.on('close', () => this.emit('subscriber:close'));
this.ioSubscriberConnection.on('reconnecting', () => this.emit('subscriber:reconnecting'));
this.ioSubscriberConnection.on('connect', () => this.emit('subscriber:connect', [this]));
this.ioSubscriberConnection.on('ready', () => this.emit('subscriber:ready', [this]));
this.ioSubscriberConnection.on('error', (error) => this.emit('subscriber:error', [this, error]));
this.ioSubscriberConnection.on('close', () => this.emit('subscriber:close', [this]));
this.ioSubscriberConnection.on('reconnecting', () => this.emit('subscriber:reconnecting', [this]));
this.ioSubscriberConnection.on('end', async () => {
this.ioConnection.removeAllListeners();
try {
await this.emit('subscriber:end', this);
await this.emit('subscriber:end', [this]);
}

@@ -106,3 +120,3 @@ catch (error) {

if (error) {
this.emit('subscription:error', error);
this.emit('subscription:error', [this, error]);
return;

@@ -113,3 +127,3 @@ }

}
this.emit('subscription:ready', count);
this.emit('subscription:ready', [this, count]);
this.$subscriptions.set(channel, handler);

@@ -129,3 +143,3 @@ });

if (error) {
this.emit('psubscription:error', error);
this.emit('psubscription:error', [this, error]);
return;

@@ -136,3 +150,3 @@ }

}
this.emit('psubscription:ready', count);
this.emit('psubscription:ready', [this, count]);
this.$psubscriptions.set(pattern, handler);

@@ -145,3 +159,37 @@ });

}
async getReport(checkForMemory) {
const connection = this.ioConnection;
if (connection.status === 'connecting' && this._deferredReportAttempts < 3 && !this._lastError) {
await sleep();
this._deferredReportAttempts++;
return this.getReport(checkForMemory);
}
if (!['ready', 'connect'].includes(connection.status)) {
return {
connection: this.connectionName,
status: connection.status,
used_memory: 'unknown',
error: this._lastError,
};
}
try {
await connection.ping();
const memory = checkForMemory ? await this._getUsedMemory() : 'unknown';
return {
connection: this.connectionName,
status: connection.status,
used_memory: memory,
error: null,
};
}
catch (error) {
return {
connection: this.connectionName,
status: connection.status,
used_memory: 'unknown',
error,
};
}
}
}
exports.AbstractFactory = AbstractFactory;
/// <reference path="../../adonis-typings/redis.d.ts" />
export declare class Redis {
import Emitter from 'emittery';
import { IocContract } from '@adonisjs/fold';
import { RedisConfigContract, RedisContract, ReportNode } from '@ioc:Adonis/Addons/Redis';
export declare class Redis extends Emitter implements RedisContract {
private _container;
private _config;
private _connectionPools;
private _cleanup;
constructor(_config: any);
private _healthCheckConnections;
constructor(_container: IocContract, _config: RedisConfigContract);
private _getDefaultConnection;
private _getExistingConnection;
connection(connection?: string): any;
private _getConnectionConfig;
connection(name?: string): any;
quit(connection?: string): Promise<void>;
disconnect(connection?: string): Promise<void>;
quitAll(): Promise<void[]>;
disconnectAll(): Promise<void[]>;
quitAll(): Promise<void>;
disconnectAll(): Promise<void>;
report(): Promise<{
health: {
healthy: boolean;
message: string;
};
meta: ReportNode[];
}>;
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const emittery_1 = __importDefault(require("emittery"));
const utils_1 = require("@poppinss/utils");
const RedisFactory_1 = require("../RedisFactory");
const RedisClusterFactory_1 = require("../RedisClusterFactory");
const ioMethods_1 = require("../ioMethods");
class Redis {
constructor(_config) {
class Redis extends emittery_1.default {
constructor(_container, _config) {
super();
this._container = _container;
this._config = _config;
this._connectionPools = {};
this._cleanup = function cleanup(connection) {
delete this._connectionPools[connection.connectionName];
}.bind(this);
this._healthCheckConnections = Object.keys(this._config.connections)
.filter((connection) => this._config.connections[connection].healthCheck);
}

@@ -22,15 +26,23 @@ _getDefaultConnection() {

}
connection(connection) {
connection = connection || this._getDefaultConnection();
if (this._connectionPools[connection]) {
return this._connectionPools[connection];
_getConnectionConfig(name) {
return this._config.connections[name];
}
connection(name) {
name = name || this._getDefaultConnection();
if (this._connectionPools[name]) {
return this._connectionPools[name];
}
const config = this._config[connection];
const config = this._getConnectionConfig(name);
if (!config) {
throw new utils_1.Exception(`Define config for ${connection} connection inside config/redis file`);
throw new utils_1.Exception(`Define config for ${name} connection inside config/redis file`);
}
const factory = this._connectionPools[connection] = config.clusters
? new RedisClusterFactory_1.RedisClusterFactory(connection, config)
: new RedisFactory_1.RedisFactory(connection, config);
factory.on('end', this._cleanup);
const factory = this._connectionPools[name] = config.clusters
? new RedisClusterFactory_1.RedisClusterFactory(name, config, this._container)
: new RedisFactory_1.RedisFactory(name, config, this._container);
factory.on('end', ([connection]) => {
delete this._connectionPools[connection.connectionName];
});
factory.onAny((event, data) => {
this.emit(event, data);
});
return factory;

@@ -53,13 +65,21 @@ }

async quitAll() {
return Promise.all(Object.keys(this._connectionPools).map((name) => this.quit(name)));
await Promise.all(Object.keys(this._connectionPools).map((name) => this.quit(name)));
}
async disconnectAll() {
return Promise.all(Object.keys(this._connectionPools).map((name) => this.disconnect(name)));
await Promise.all(Object.keys(this._connectionPools).map((name) => this.disconnect(name)));
}
async report() {
const reports = await Promise.all(this._healthCheckConnections.map((connection) => {
return this.connection(connection).getReport(true);
}));
const healthy = !reports.find((report) => !!report.error);
return {
health: {
healthy,
message: healthy ? 'All connections are healthy' : 'One or more redis connections are not healthy',
},
meta: reports,
};
}
}
exports.Redis = Redis;
ioMethods_1.ioMethods.forEach((method) => {
Redis.prototype[method] = function redisProxyFn(...args) {
return this.connection()[method](...args);
};
});
/// <reference path="../../adonis-typings/redis.d.ts" />
import * as Redis from 'ioredis';
import Redis from 'ioredis';
import { IocContract } from '@adonisjs/fold';
import { ClusterConfigContract } from '@ioc:Adonis/Addons/Redis';

@@ -7,5 +8,5 @@ import { AbstractFactory } from '../AbstractFactory';

private _config;
constructor(connectionName: string, _config: ClusterConfigContract);
constructor(connectionName: string, _config: ClusterConfigContract, container: IocContract);
protected $makeSubscriberConnection(): void;
nodes(role?: Redis.NodeRole): Redis.Redis[];
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Redis = require("ioredis");
const ioredis_1 = __importDefault(require("ioredis"));
const ioMethods_1 = require("../ioMethods");
const AbstractFactory_1 = require("../AbstractFactory");
class RedisClusterFactory extends AbstractFactory_1.AbstractFactory {
constructor(connectionName, _config) {
super(connectionName);
constructor(connectionName, _config, container) {
super(connectionName, container);
this._config = _config;
this.ioConnection = new Redis.Cluster(this._config.clusters, this._config.clusterOptions);
this.ioConnection = new ioredis_1.default.Cluster(this._config.clusters, this._config.clusterOptions);
this.$proxyConnectionEvents();
}
$makeSubscriberConnection() {
this.ioSubscriberConnection = new Redis.Cluster(this._config.clusters, this._config.clusterOptions);
this.ioSubscriberConnection = new ioredis_1.default.Cluster(this._config.clusters, this._config.clusterOptions);
}

@@ -16,0 +19,0 @@ nodes(role) {

/// <reference path="../../adonis-typings/redis.d.ts" />
import * as Redis from 'ioredis';
import Redis from 'ioredis';
import { IocContract } from '@adonisjs/fold';
import { ConnectionConfigContract } from '@ioc:Adonis/Addons/Redis';

@@ -7,4 +8,4 @@ import { AbstractFactory } from '../AbstractFactory';

private _config;
constructor(connectionName: string, _config: ConnectionConfigContract);
constructor(connectionName: string, _config: ConnectionConfigContract, container: IocContract);
protected $makeSubscriberConnection(): void;
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Redis = require("ioredis");
const ioredis_1 = __importDefault(require("ioredis"));
const ioMethods_1 = require("../ioMethods");
const AbstractFactory_1 = require("../AbstractFactory");
class RedisFactory extends AbstractFactory_1.AbstractFactory {
constructor(connectionName, _config) {
super(connectionName);
constructor(connectionName, _config, container) {
super(connectionName, container);
this._config = _config;
this.ioConnection = new Redis(this._config);
this.ioConnection = new ioredis_1.default(this._config);
this.$proxyConnectionEvents();
}
$makeSubscriberConnection() {
this.ioSubscriberConnection = new Redis(this._config);
this.ioSubscriberConnection = new ioredis_1.default(this._config);
}

@@ -16,0 +19,0 @@ }

{
"name": "@adonisjs/redis",
"version": "3.0.0",
"version": "3.1.0",
"description": "AdonisJs addon for Redis",
"main": "build/index.js",
"files": [
"build/adonis-typings",
"build/providers",
"build/src",
"build/adonis-typings",
"build/providers"
"build/templates"
],
"types": "build/adonis-typings/index.d.ts",
"types": "build/adonis-typings/redis.d.ts",
"scripts": {

@@ -18,4 +19,5 @@ "mrm": "mrm --preset=@adonisjs/mrm-preset",

"clean": "del build",
"copyfiles": "copyfiles \"templates/**/*.txt\" build",
"compile": "npm run lint && npm run clean && tsc",
"build": "npm run compile",
"build": "npm run compile && npm run copyfiles",
"commit": "git-cz",

@@ -44,17 +46,20 @@ "release": "np",

"devDependencies": {
"@adonisjs/fold": "^6.0.3",
"@adonisjs/mrm-preset": "^2.0.3",
"@types/node": "^12.0.10",
"commitizen": "^3.1.1",
"cz-conventional-changelog": "^2.1.0",
"del-cli": "^2.0.0",
"@adonisjs/fold": "^6.1.9",
"@adonisjs/mrm-preset": "^2.1.0",
"@adonisjs/sink": "^2.1.11",
"@poppinss/application": "^1.0.10",
"@types/node": "^12.7.4",
"commitizen": "^4.0.3",
"copyfiles": "^2.1.1",
"cz-conventional-changelog": "^3.0.2",
"del-cli": "^3.0.0",
"doctoc": "^1.4.0",
"husky": "^2.5.0",
"japa": "^2.0.10",
"husky": "^3.0.5",
"japa": "^3.0.1",
"mrm": "^1.2.2",
"np": "^5.0.3",
"ts-node": "^8.3.0",
"tslint": "^5.18.0",
"tslint": "^5.20.0",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^3.5.2"
"typescript": "^3.6.2"
},

@@ -85,7 +90,32 @@ "nyc": {

"dependencies": {
"@poppinss/utils": "^1.0.3",
"@types/ioredis": "^4.0.12",
"@poppinss/utils": "^2.0.0",
"@types/ioredis": "^4.0.17",
"emittery": "^0.4.1",
"ioredis": "^4.10.0"
"ioredis": "^4.14.0"
},
"peerDependencies": {
"@adonisjs/core": "2.x.x"
},
"adonisjs": {
"templates": {
"config": [
{
"src": "config.txt",
"dest": "redis"
}
],
"constracts": [
{
"src": "contract.txt",
"dest": "redis"
}
]
},
"env": {
"REDIS_CONNECTION": "default",
"REDIS_HOST": "127.0.0.1",
"REDIS_PORT": "6379",
"REDIS_PASSWORD": ""
}
}
}
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