New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@phiresky/redis-remotify

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phiresky/redis-remotify - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

bin/test.d.ts

2

bin/remotify.d.ts

@@ -22,3 +22,3 @@ import * as redis from "redis";

listen(fn: (...args: any[]) => any, fnname?: string): void;
listenAll<T>(obj: T, prefix?: string): void;
listenAll<T extends object>(obj: T, prefix?: string): void;
}

@@ -25,0 +25,0 @@ declare function defaultConfig(): {

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -17,2 +18,19 @@ });

const debug = _debug("remotify");
const console = (console => ({
log(...args) {
console.log("remotify", ...args);
},
warn(...args) {
console.warn("remotify", ...args);
},
error(...args) {
console.error("remotify", ...args);
},
time(label) {
console.time(label);
},
timeEnd(label) {
console.timeEnd(label);
},
}))(global.console);
/**

@@ -62,2 +80,3 @@ * make sure errors are preserved over the wire

callback = {
method: ns,
callback: data.callback,

@@ -71,2 +90,3 @@ success: false,

callback = {
method: ns,
callback: data.callback,

@@ -79,2 +99,3 @@ success: true,

callback = {
method: ns,
callback: data.callback,

@@ -86,3 +107,10 @@ success: false,

}
this.pubClient.publish(`/remotify/${this.serverid}/callback/${data.clientid}`, JSON.stringify(callback, this.config.jsonReplacer));
const callbackPath = `/remotify/${this.serverid}/callback/${data.clientid}`;
this.pubClient.publish(callbackPath, JSON.stringify(callback, this.config.jsonReplacer), (err, listenedCount) => {
if (err)
console.error("callback", callbackPath, err);
else if (listenedCount === 0) {
console.warn("client is down", callback.method, callbackPath);
}
});
});

@@ -111,7 +139,7 @@ this.pubClient = clients.pub;

function randomid() {
return crypto.randomBytes(20).toString("hex");
return crypto.randomBytes(10).toString("hex");
}
function defaultConfig() {
return {
clientid: randomid(),
clientid: "unnamed",
callbackTimeout: 60 * 1000,

@@ -139,3 +167,3 @@ };

else {
console.error("can't find callback for", data.callback);
console.error("can't find callback for", data.method, data.callback);
}

@@ -145,3 +173,4 @@ };

this.subClient = clients.sub;
this.config = Object.assign({}, defaultConfig(), config);
this.config = Object.assign(Object.assign({}, defaultConfig()), config);
this.config.clientid = this.config.clientid + "_" + randomid();
this.subClient.on("message", this.onCallback);

@@ -148,0 +177,0 @@ this.subClient.subscribe(`/remotify/${this.serverid}/callback/${this.config.clientid}`);

{
"name": "@phiresky/redis-remotify",
"version": "0.2.3",
"version": "0.2.4",
"description": "a tiny library for remote calls and events via redis",

@@ -31,14 +31,14 @@ "main": "bin/index.js",

"devDependencies": {
"@types/debug": "^0.0.30",
"@types/redis": "^2.8.4",
"husky": "^0.14.3",
"lint-staged": "^6.0.0",
"prettier": "^1.15.3",
"redis": "^2.8.0",
"ts-node": "^7.0.1",
"typescript": "^3.2.1"
"@types/debug": "^4.1.5",
"@types/redis": "^2.8.17",
"husky": "^4.2.3",
"lint-staged": "^10.1.2",
"prettier": "^2.0.2",
"redis": "^3.0.2",
"ts-node": "^8.8.2",
"typescript": "^3.8.3"
},
"dependencies": {
"debug": "^3.1.0"
"debug": "^4.1.1"
}
}

Sorry, the diff of this file is not supported yet

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