lib-task-scheduler
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
source: MessageSource<T>; | ||
transformer: MessageTransformer<T, R>; | ||
transformer?: MessageTransformer<T, R>; | ||
sink?: MessageSink<R>; | ||
@@ -9,0 +9,0 @@ logger?: Logger; |
@@ -59,4 +59,10 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const outMessages = yield this.config.transformer.transform(message); | ||
this.log.debug(`Transformed message ${message.id}`); | ||
let outMessages; | ||
if (this.config.transformer) { | ||
outMessages = yield this.config.transformer.transform(message); | ||
this.log.debug(`Transformed message ${message.id}`); | ||
} | ||
else { | ||
outMessages = message; | ||
} | ||
if (outMessages) { | ||
@@ -68,3 +74,3 @@ const outbounds = Array.isArray(outMessages) ? outMessages : [outMessages]; | ||
else if (outMessages) { | ||
throw new Error('Transformer produced a message, but no sink is configured.'); | ||
throw new Error('A sink must be configured, when the transformer produces messages (or no transformer is configured).'); | ||
} | ||
@@ -71,0 +77,0 @@ } |
{ | ||
"name": "lib-task-scheduler", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "A lightweight, modular task scheduler.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/convoyinc/lib-task-scheduler", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100052
1445