node-red-contrib-german-holidays
Advanced tools
Comparing version 0.1.11 to 0.1.13
### CHANGELOG | ||
#### 0.1.13: critical bug fix | ||
- fixed bug with the code prepared for Node-Red 1.0. The recommend way for be backward compatible doesn't work. This is [also](https://discourse.nodered.org/t/knowing-when-a-node-is-done-new-node-api/15737/9) confirmed by @knolleary. | ||
#### 0.1.12: Maintenance Release | ||
- more changes for node-red 1.0 (https://nodered.org/blog/2019/09/20/node-done) | ||
- updated dependencies | ||
- added node-red 0.19.0 as required version | ||
#### 0.1.11: Maintenance Release | ||
@@ -4,0 +14,0 @@ |
@@ -186,31 +186,2 @@ /******************************************** | ||
/*******************************************************************************************************/ | ||
const errorHandler = function (node, err, messageText, stateText) { | ||
if (!err) { | ||
return true; | ||
} | ||
if (err.message) { | ||
// const msg = err.message.toLowerCase(); | ||
messageText += ':' + err.message; | ||
} else { | ||
messageText += '! (No error message given!)'; | ||
} | ||
if (node) { | ||
node.error(messageText); | ||
node.debug(JSON.stringify(err, Object.getOwnPropertyNames(err))); | ||
node.status({ | ||
fill: 'red', | ||
shape: 'ring', | ||
text: stateText | ||
}); | ||
} else if (console) { | ||
console.error(messageText); // eslint-disable-line | ||
console.error(JSON.stringify(err, Object.getOwnPropertyNames(err))); // eslint-disable-line | ||
} | ||
return false; | ||
}; | ||
/*******************************************************************************************************/ | ||
/** | ||
@@ -669,4 +640,8 @@ * creates a string with two digits | ||
}; | ||
const node = this; | ||
this.on('input', function (msg) { | ||
this.on('input', function (msg, send, done) { | ||
// If this is pre-1.0, 'send' will be undefined, so fallback to node.send | ||
done = done || function (text, msg) { if (text) { return node.error(text, msg); } return null; }; | ||
send = send || function (...args) { node.send.apply(node, args); }; | ||
// this.debug('Holiday!! Start'); | ||
@@ -737,3 +712,3 @@ try { | ||
if (this.holidaysArray.length < 0) { | ||
this.error('configuration error: No Holiday is defined. At least one Holiday must be configured!'); | ||
// this.error('configuration error: No Holiday is defined. At least one Holiday must be configured!'); | ||
this.status({ | ||
@@ -744,2 +719,3 @@ fill: 'red', | ||
}); | ||
done('configuration error: No Holiday is defined. At least one Holiday must be configured!' ,msg); | ||
return; | ||
@@ -751,3 +727,3 @@ } | ||
if (allRegions.indexOf(outMsg.data.region) === -1) { | ||
this.error('Invalid region: ' + outMsg.data.region + '! Must be one of ' + allRegions.toString()); | ||
// this.error('Invalid region: ' + outMsg.data.region + '! Must be one of ' + allRegions.toString()); | ||
this.status({ | ||
@@ -758,2 +734,3 @@ fill: 'red', | ||
}); | ||
done('Invalid region: ' + outMsg.data.region + '! Must be one of ' + allRegions.toString() ,msg); | ||
return; | ||
@@ -772,3 +749,2 @@ } | ||
outMsg.payload = this.getDataForDate(dto, specialdays); | ||
this.send(outMsg); | ||
this.status({ | ||
@@ -779,2 +755,4 @@ fill: 'grey', | ||
}); | ||
send(outMsg); // this.send(outMsg); | ||
done(); | ||
return; | ||
@@ -791,3 +769,2 @@ } | ||
outMsg.payload = this.getDataForDay(outMsg.data.ts, outMsg.data.day, dataObjs); | ||
this.send(outMsg); | ||
this.status({ | ||
@@ -798,2 +775,4 @@ fill: 'grey', | ||
}); | ||
send(outMsg); // this.send(outMsg); | ||
done(); | ||
return; | ||
@@ -916,5 +895,13 @@ } | ||
}); | ||
this.send(outMsg); | ||
send(outMsg); // this.send(outMsg); | ||
done(); | ||
} catch (err) { | ||
errorHandler(this, err, 'Exception occurred on get german holidays', 'internal error'); | ||
this.status({ | ||
fill: 'red', | ||
shape: 'ring', | ||
text: 'internal error:' + err.message | ||
}); | ||
this.log('Exception occurred on get german holidays:' + err.message); | ||
this.log(JSON.stringify(err, Object.getOwnPropertyNames(err))); | ||
done('Exception occurred on get german holidays:' + err.message); | ||
} | ||
@@ -921,0 +908,0 @@ }); |
{ | ||
"name": "node-red-contrib-german-holidays", | ||
"version": "0.1.11", | ||
"version": "0.1.13", | ||
"description": "NodeRED nodes to get german holidays", | ||
@@ -53,2 +53,3 @@ "keywords": [ | ||
"node-red": { | ||
"version": ">=0.19.0", | ||
"nodes": { | ||
@@ -58,3 +59,3 @@ "german-holidays": "german-holidays.js" | ||
}, | ||
"dependencies": { | ||
"peerDependencies": { | ||
"util": ">=0.8.0" | ||
@@ -61,0 +62,0 @@ }, |
@@ -0,0 +0,0 @@ # node-red-contrib-german-holidays for NodeRED |
Sorry, the diff of this file is not supported yet
295906
1121
- Removedutil@>=0.8.0