node-red-contrib-bacnet
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -1,2 +0,2 @@ | ||
"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=Math.min(Math.max(parseInt(e.priority)||15,1),16),this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){var e=a.payload.options||{priority:n.priority};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTag,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})}; | ||
"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=parseInt(e.priority),this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){n.priority=n.priority<1?16:n.priority,n.priority=16<n.priority?16:n.priority;var e=a.payload.options||{priority:n.priority};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTag,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})}; | ||
//# sourceMappingURL=maps/bacnet-write.js.map |
{ | ||
"name": "node-red-contrib-bacnet", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"private": false, | ||
@@ -43,6 +43,6 @@ "description": "The BACnet toolbox package for Node-RED.", | ||
"test": "standard --fix && mocha test --recursive --reporter dot --timeout 5000", | ||
"test:coverage": "istanbul cover _mocha --report lcovonly -- --recursive --timeout 5000 -R spec && cat ./coverage/lcov.info | codacy-coverage --token $CODACY_COVERAGE_TOKEN && rm -rf ./coverage", | ||
"coverage": "standard --fix && gulp build && npm test && istanbul cover _mocha -- --recursive --timeout 5000", | ||
"test-with-coverage": "istanbul cover _mocha --report lcovonly -- --recursive --timeout 5000 -R spec && cat ./coverage/lcov.info | codacy-coverage --token $CODACY_COVERAGE_TOKEN && rm -rf ./coverage", | ||
"coverage": "npm run build && npm test && istanbul cover _mocha -- --recursive --timeout 5000", | ||
"build": "standard --fix && gulp", | ||
"prepublishOnly": "npm run rewrite-changelog && npm test", | ||
"prepublishOnly": "npm run build && npm run rewrite-changelog && npm test", | ||
"ci-publish": "ci-publish", | ||
@@ -49,0 +49,0 @@ "release": "standard-version -a", |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4051276
86
130257
1
7
3