notification-processor
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -23,3 +23,3 @@ (function() { | ||
}); | ||
return observable.on("finished", function(arg) { | ||
observable.on("finished", function(arg) { | ||
var log; | ||
@@ -29,2 +29,7 @@ log = arg.context.log; | ||
}); | ||
return observable.on("ignored", function(arg) { | ||
var log, message, ref; | ||
(ref = arg.context, log = ref.log), message = arg.message; | ||
return log("Message ignored", message); | ||
}); | ||
} | ||
@@ -31,0 +36,0 @@ }; |
(function() { | ||
var Processor, ProcessorBuilder, ServiceBusAdapter, _, logger, | ||
var IgnoreUsers, Processor, ProcessorBuilder, ServiceBusAdapter, _, logger, | ||
slice = [].slice; | ||
@@ -13,2 +13,4 @@ | ||
IgnoreUsers = require("./ignore.user.filter"); | ||
module.exports = ProcessorBuilder = (function() { | ||
@@ -18,2 +20,3 @@ function ProcessorBuilder() { | ||
this.adapter = _.identity; | ||
this.filters = []; | ||
} | ||
@@ -47,2 +50,3 @@ | ||
ProcessorBuilder.prototype.ignoreUsers = function() { | ||
this.filters = _.concat(this.filters, IgnoreUsers); | ||
return this; | ||
@@ -53,3 +57,3 @@ }; | ||
var processor; | ||
processor = new Processor(this.adapter, this.command); | ||
processor = new Processor(this.filters, this.adapter, this.command); | ||
_.forEach(this.listeners, function(listener) { | ||
@@ -56,0 +60,0 @@ return listener.listenTo(processor); |
@@ -16,3 +16,4 @@ (function() { | ||
function Processor(adapter, runner) { | ||
function Processor(filters, adapter, runner) { | ||
this.filters = filters; | ||
this.adapter = adapter; | ||
@@ -34,2 +35,14 @@ this.runner = runner; | ||
}); | ||
if (this.shouldBeIgnore({ | ||
meta: meta, | ||
message: message | ||
})) { | ||
this.emit("ignored", { | ||
context: context, | ||
message: message, | ||
meta: meta | ||
}); | ||
context.done(); | ||
return; | ||
} | ||
Promise.method(this.runner)({ | ||
@@ -66,2 +79,13 @@ message: message, | ||
Processor.prototype.shouldBeIgnore = function(arg) { | ||
var message, meta; | ||
meta = arg.meta, message = arg.message; | ||
return _.some(this.filters, function(filter) { | ||
return filter({ | ||
meta: meta, | ||
message: message | ||
}); | ||
}); | ||
}; | ||
return Processor; | ||
@@ -68,0 +92,0 @@ |
{ | ||
"name": "notification-processor", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "notification-processor", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
21831
546
10