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

censeo

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

censeo - npm Package Compare versions

Comparing version 0.4.7 to 0.4.8

4

lib/client.js

@@ -45,5 +45,5 @@ (function() {

options.id = ++self.count;
socket.emit("run", options);
socket.on("ran:" + options.id, success);
return socket.on("error:" + options.id, error);
socket.on("error:" + options.id, error);
return socket.emit("run", options);
});

@@ -50,0 +50,0 @@ }));

@@ -33,3 +33,3 @@ (function() {

io.on("connection", function(socket) {
var convertErrorToEmit, emitResult, runWithPromise, exec, runWithCallback, run;
var convertErrorToEmit, emitResult, emitError, runWithPromise, exec, runWithCallback, run;
convertErrorToEmit = function(options, run) {

@@ -41,3 +41,3 @@ var gen1_asyncResult;

}).then(void 0, function(e) {
return socket.emit("error:" + options.id, e);
return emitError(options, e);
}));

@@ -49,18 +49,26 @@ });

};
emitError = function(options, error) {
return socket.emit("error:" + options.id, {
message: error.message
});
};
runWithPromise = function(options) {
return convertErrorToEmit(options, function() {
var func, context, runFunc, gen3_asyncResult, result;
return new Promise(function(gen2_onFulfilled) {
func = options.func;
context = options.context;
context.Promise = require("bluebird");
context.process = process;
context.require = serverRequire;
context.serverRequire = serverRequire;
runFunc = Function("context", "callback", "\n for (var property in context) {\n eval ('var '+property+'= context.'+property);\n }\n\n " + pogoWrappers() + "\n\n return (" + func + ")();\n ");
gen2_onFulfilled(Promise.resolve(runFunc(context)).then(function(gen3_asyncResult) {
result = gen3_asyncResult;
return emitResult(options, result);
}));
});
var gen3_asyncResult;
return new Promise(function(gen2_onFulfilled) {
gen2_onFulfilled(Promise.resolve(convertErrorToEmit(options, function() {
var func, context, runFunc, gen4_asyncResult, result;
return new Promise(function(gen2_onFulfilled) {
func = options.func;
context = options.context;
context.Promise = require("bluebird");
context.process = process;
context.require = serverRequire;
context.serverRequire = serverRequire;
runFunc = Function("context", "callback", "\n for (var property in context) {\n eval ('var '+property+'= context.'+property);\n }\n\n " + pogoWrappers() + "\n\n return (" + func + ")();\n ");
gen2_onFulfilled(Promise.resolve(runFunc(context)).then(function(gen4_asyncResult) {
result = gen4_asyncResult;
return emitResult(options, result);
}));
});
})));
});

@@ -79,3 +87,7 @@ };

callback = function(error, result) {
return emitResult(options, result);
if (error) {
return emitError(options, e);
} else {
return emitResult(options, result);
}
};

@@ -89,8 +101,12 @@ return convertErrorToEmit(options, function() {

var result;
result = exec(options.context, options.func);
return emitResult(options, result);
try {
result = exec(options.context, options.func);
return emitResult(options, result);
} catch (e) {
return emitError(options, e);
}
});
};
socket.on("runTask", function(options) {
var context, runFunc, gen4_asyncResult, result;
var context, runFunc, gen5_asyncResult, result;
return new Promise(function(gen2_onFulfilled) {

@@ -104,4 +120,4 @@ context = options.context;

gen2_onFulfilled(new Promise(function(gen2_onFulfilled) {
gen2_onFulfilled(Promise.resolve(runFunc(context)).then(function(gen5_asyncResult) {
result = gen5_asyncResult;
gen2_onFulfilled(Promise.resolve(runFunc(context)).then(function(gen6_asyncResult) {
result = gen6_asyncResult;
tasks.push({

@@ -114,3 +130,3 @@ id: options.id,

}).then(void 0, function(e) {
return socket.emit("error:" + options.id, e.message);
return emitError(options, e);
}));

@@ -133,14 +149,14 @@ });

runningTask = function() {
var gen6_results, gen7_items, gen8_i, task;
gen6_results = [];
gen7_items = tasks;
for (gen8_i = 0; gen8_i < gen7_items.length; ++gen8_i) {
task = gen7_items[gen8_i];
var gen7_results, gen8_items, gen9_i, task;
gen7_results = [];
gen8_items = tasks;
for (gen9_i = 0; gen9_i < gen8_items.length; ++gen9_i) {
task = gen8_items[gen9_i];
(function(task) {
if (task.id === options.id) {
return gen6_results.push(task);
return gen7_results.push(task);
}
})(task);
}
return gen6_results;
return gen7_results;
}()[0];

@@ -147,0 +163,0 @@ if (runningTask) {

{
"name": "censeo",
"version": "0.4.7",
"version": "0.4.8",
"description": "Run arbitrary JavaScript or PogoScript on a server",

@@ -5,0 +5,0 @@ "author": "Derek Ekins <derek@spathi.com>",

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