UNPKG

@strato-automation/node-red-contrib-strato-automation

Version:
1 lines 4.1 kB
function a9_0x1f16(){const _0x5db043=['/bacnet/connections','getTelemetry','node-fetch','6932UKwGhc','/shallow','stringify','38698088TeatQJ','url','connectionId','writeMultiplePropery','getShallowObject','getConnectionId','notwork','token','4313512LCRmeL','exports','Bearer\x20','Agent','httpsAgent','7217450dSYLYf','undefined','uniqueObjectIds','/bacnet/telemetry','3035234AFwtsX','writeObject','length','useAggregationWindows','/bacnet/connections/devices','2733usVJet','application/json','post','107106XTvyNr','https','1619888GjOcdq','/bacnet/connections/devices/','/writeMultipleProperties'];a9_0x1f16=function(){return _0x5db043;};return a9_0x1f16();}const a9_0x59bd4f=a9_0x287a;(function(_0x4dc889,_0x21f86c){const _0x792a19=a9_0x287a,_0x3bd612=_0x4dc889();while(!![]){try{const _0x4f5977=-parseInt(_0x792a19(0x210))/0x1+-parseInt(_0x792a19(0x206))/0x2+-parseInt(_0x792a19(0x20b))/0x3*(parseInt(_0x792a19(0x1f2))/0x4)+parseInt(_0x792a19(0x202))/0x5+-parseInt(_0x792a19(0x20e))/0x6+-parseInt(_0x792a19(0x1fd))/0x7+parseInt(_0x792a19(0x1f5))/0x8;if(_0x4f5977===_0x21f86c)break;else _0x3bd612['push'](_0x3bd612['shift']());}catch(_0x5085c6){_0x3bd612['push'](_0x3bd612['shift']());}}}(a9_0x1f16,0xe3270));function a9_0x287a(_0x315f37,_0x503d2d){const _0x1f16c2=a9_0x1f16();return a9_0x287a=function(_0x287a0f,_0x3d93b7){_0x287a0f=_0x287a0f-0x1f1;let _0x137c57=_0x1f16c2[_0x287a0f];return _0x137c57;},a9_0x287a(_0x315f37,_0x503d2d);}const fetch=require(a9_0x59bd4f(0x1f1)),https=require(a9_0x59bd4f(0x20f));class OCNAPIClient{constructor(_0x13b6c1,_0x40d175){const _0x551f53=a9_0x59bd4f;this[_0x551f53(0x1f6)]=_0x13b6c1,this[_0x551f53(0x1fc)]=_0x40d175;const _0x39d90f=new https[(_0x551f53(0x200))]({'rejectUnauthorized':![]});this[_0x551f53(0x201)]=_0x39d90f;}['getDevices'](){const _0x3b5189=a9_0x59bd4f,_0x11c654=fetch(this[_0x3b5189(0x1f6)]+_0x3b5189(0x20a),{'headers':{'Authorization':_0x3b5189(0x1ff)+this['token']},'agent':this[_0x3b5189(0x201)]});return _0x11c654;}[a9_0x59bd4f(0x207)](_0x12cb72,_0x691ca5,_0xf1c15b,_0x3424c3){const _0x54846f=a9_0x59bd4f,_0x27d3a4=this[_0x54846f(0x1f6)]+_0x54846f(0x211)+_0x12cb72+'/'+_0x691ca5+'/'+_0xf1c15b,_0x226142=fetch(_0x27d3a4,{'method':_0x54846f(0x20d),'body':JSON[_0x54846f(0x1f4)](_0x3424c3),'headers':{'Authorization':_0x54846f(0x1ff)+this[_0x54846f(0x1fc)],'Content-Type':_0x54846f(0x20c)},'agent':this[_0x54846f(0x201)]});return _0x226142;}[a9_0x59bd4f(0x1f8)](_0x1dce71,_0x2d925e){const _0xdaff96=a9_0x59bd4f,_0x429b3d=this['url']+_0xdaff96(0x211)+_0x1dce71+_0xdaff96(0x212),_0x27def7=fetch(_0x429b3d,{'method':_0xdaff96(0x20d),'body':JSON[_0xdaff96(0x1f4)](_0x2d925e),'headers':{'Authorization':'Bearer\x20'+this[_0xdaff96(0x1fc)],'Content-Type':_0xdaff96(0x20c)},'agent':this[_0xdaff96(0x201)]});return _0x27def7;}[a9_0x59bd4f(0x1f9)](_0x39a8f9,_0xc2e25c,_0x33cb1c){const _0x28ef8c=a9_0x59bd4f,_0x1ecbfe=this[_0x28ef8c(0x1f6)]+'/bacnet/connections/devices/'+_0x39a8f9+'/'+_0xc2e25c+'/'+_0x33cb1c+_0x28ef8c(0x1f3),_0x400903=fetch(_0x1ecbfe,{'headers':{'Authorization':'Bearer\x20'+this[_0x28ef8c(0x1fc)]},'agent':this['httpsAgent']});return _0x400903;}async[a9_0x59bd4f(0x1fa)](){const _0x5abe8c=a9_0x59bd4f,_0x1fee9f=this[_0x5abe8c(0x1f6)]+_0x5abe8c(0x213);return await fetch(_0x1fee9f,{'headers':{'Authorization':'Bearer\x20'+this[_0x5abe8c(0x1fc)]},'agent':this['httpsAgent']});}async[a9_0x59bd4f(0x214)](_0x1fd4c1){const _0x1a2298=a9_0x59bd4f;_0x1fd4c1[_0x1a2298(0x1fb)]=0x0,_0x1fd4c1[_0x1a2298(0x209)]=_0x1fd4c1[_0x1a2298(0x209)]||![];for(let _0x3f6454=0x0;_0x3f6454<_0x1fd4c1[_0x1a2298(0x204)][_0x1a2298(0x208)];_0x3f6454++){_0x1fd4c1['uniqueObjectIds'][_0x3f6454][_0x1a2298(0x1f7)]='00000000-0000-0000-0000-000000000000';}const _0x3682ec=this[_0x1a2298(0x1f6)]+_0x1a2298(0x205);return await fetch(_0x3682ec,{'method':'post','body':JSON[_0x1a2298(0x1f4)](_0x1fd4c1),'headers':{'Authorization':_0x1a2298(0x1ff)+this[_0x1a2298(0x1fc)],'Content-Type':'application/json'},'agent':this[_0x1a2298(0x201)]});}}typeof module!==a9_0x59bd4f(0x203)&&typeof module[a9_0x59bd4f(0x1fe)]!=='undefined'&&(module[a9_0x59bd4f(0x1fe)]=OCNAPIClient);