Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / services / xdr / utils.js
index 6ab585d..5197050 100644 (file)
@@ -1 +1 @@
-const a1394_0x2e19=['internal','error','diff','stack','type','name','FOUND','GETVOICEQUEUEBYNAME|','getUserByInterface','debug','info','http','add','then','getUserByName','YYYY-MM-DD\x20HH:mm:ss','stringify','subtractTime','length','request','jayson/promise','addTime','result','interface','seconds','isAfter','subtract','NOTFOUND','isBefore','acwTimeout','getVoiceQueueByName','diffTime','getUserByInternal','format','xdr','moment','catch','sumTime'];(function(_0x498a40,_0x2c9e79){const _0x2e19ee=function(_0x4ab8a2){while(--_0x4ab8a2){_0x498a40['push'](_0x498a40['shift']());}};_0x2e19ee(++_0x2c9e79);}(a1394_0x2e19,0x162));const a1394_0x4ab8=function(_0x498a40,_0x2c9e79){_0x498a40=_0x498a40-0x1e4;let _0x2e19ee=a1394_0x2e19[_0x498a40];return _0x2e19ee;};const a1394_0x42f698=a1394_0x4ab8;'use strict';const jayson=require(a1394_0x42f698(0x1ec)),moment=require(a1394_0x42f698(0x1fb)),client=jayson['client'][a1394_0x42f698(0x209)]({'port':0x2329}),logger=require('../../config/logger')(a1394_0x42f698(0x1fa));exports['info']=function(_0x2039b2){const _0x1dad26=a1394_0x42f698;logger[_0x1dad26(0x208)](_0x2039b2);},exports[a1394_0x42f698(0x207)]=function(_0xb806a3){const _0x366161=a1394_0x42f698;logger[_0x366161(0x207)](JSON[_0x366161(0x1e8)](_0xb806a3));},exports[a1394_0x42f698(0x1ff)]=function(_0x491eca){const _0x369968=a1394_0x42f698;logger[_0x369968(0x1ff)](_0x491eca[_0x369968(0x201)]);},exports[a1394_0x42f698(0x1eb)]=function(_0x5d96cd,_0x352498){const _0xed849=a1394_0x42f698;return client['request'](_0x5d96cd,{'body':_0x352498})[_0xed849(0x1e5)](function(_0x20816d){const _0x5fb5f5=_0xed849;logger[_0x5fb5f5(0x207)](JSON[_0x5fb5f5(0x1e8)](_0x20816d));})[_0xed849(0x1fc)](function(_0x408202){const _0x206e10=_0xed849;logger['error'](_0x408202[_0x206e10(0x201)]);});};function getUser(_0x237774){const _0x346a9a=a1394_0x42f698;return client[_0x346a9a(0x1eb)]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x346a9a(0x1fe),_0x346a9a(0x203),_0x346a9a(0x1ef)],'where':_0x237774,'limit':0x1}})[_0x346a9a(0x1e5)](function(_0x42ea92){const _0x31bef0=_0x346a9a;return logger[_0x31bef0(0x208)]('GETUSER|'+JSON[_0x31bef0(0x1e8)](_0x237774)+'|'+(_0x42ea92[_0x31bef0(0x1ee)][_0x31bef0(0x1ea)]?_0x31bef0(0x204):_0x31bef0(0x1f3))),_0x42ea92[_0x31bef0(0x1ee)]['length']?_0x42ea92[_0x31bef0(0x1ee)][0x0]:null;});}exports[a1394_0x42f698(0x1f8)]=function(_0x51ef23){return new Promise(function(_0x344bea){const _0x2b1bd1=a1394_0x4ab8;return _0x51ef23?getUser({'internal':_0x51ef23})[_0x2b1bd1(0x1e5)](function(_0x45c892){return _0x344bea(_0x45c892);})['catch'](function(_0x3b76d8){const _0x18329=_0x2b1bd1;return logger['error'](_0x3b76d8[_0x18329(0x201)]),_0x344bea(null);}):_0x344bea(null);});},exports[a1394_0x42f698(0x206)]=function(_0x305698){return new Promise(function(_0x36fd82){const _0x1bfa9b=a1394_0x4ab8;return _0x305698?getUser({'interface':_0x305698})[_0x1bfa9b(0x1e5)](function(_0xb3384f){return _0x36fd82(_0xb3384f);})[_0x1bfa9b(0x1fc)](function(_0x19f1a1){const _0x38707c=_0x1bfa9b;return logger['error'](_0x19f1a1[_0x38707c(0x201)]),_0x36fd82(null);}):_0x36fd82(null);});},exports[a1394_0x42f698(0x1e6)]=function(_0x46e9f7){return new Promise(function(_0x3af242){const _0x465700=a1394_0x4ab8;return _0x46e9f7?getUser({'name':_0x46e9f7})[_0x465700(0x1e5)](function(_0x1385a2){return _0x3af242(_0x1385a2);})[_0x465700(0x1fc)](function(_0x225e8a){return logger['error'](_0x225e8a['stack']),_0x3af242(null);}):_0x3af242(null);});},exports[a1394_0x42f698(0x1f6)]=function(_0x2bfb93){return new Promise(function(_0x1ef7ed){const _0x50d3f9=a1394_0x4ab8;return _0x2bfb93?client[_0x50d3f9(0x1eb)]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x50d3f9(0x202),'acw',_0x50d3f9(0x1f5)],'where':{'name':_0x2bfb93},'limit':0x1}})[_0x50d3f9(0x1e5)](function(_0x426e98){const _0x3ef6b7=_0x50d3f9;return logger[_0x3ef6b7(0x208)](_0x3ef6b7(0x205)+_0x2bfb93+'|'+(_0x426e98['result']['length']?'FOUND':'NOTFOUND')),_0x1ef7ed(_0x426e98[_0x3ef6b7(0x1ee)][_0x3ef6b7(0x1ea)]?_0x426e98[_0x3ef6b7(0x1ee)][0x0]:null);})[_0x50d3f9(0x1fc)](function(_0x4694fa){const _0x36fe47=_0x50d3f9;return logger[_0x36fe47(0x1ff)](_0x4694fa[_0x36fe47(0x201)]),_0x1ef7ed(null);}):_0x1ef7ed(null);});},exports[a1394_0x42f698(0x1ed)]=function(_0x59d26c,_0x2076ec){const _0x1fd92d=a1394_0x42f698;return moment(_0x59d26c)[_0x1fd92d(0x1e4)](_0x2076ec,'seconds')[_0x1fd92d(0x1f9)](_0x1fd92d(0x1e7));},exports[a1394_0x42f698(0x1e9)]=function(_0x393e8c,_0x5d3caf){const _0x5af934=a1394_0x42f698;return moment(_0x393e8c)[_0x5af934(0x1f2)](_0x5d3caf,_0x5af934(0x1f0))['format'](_0x5af934(0x1e7));},exports[a1394_0x42f698(0x1f7)]=function(_0x3d67c3,_0x282ec1){const _0xc0b0d6=a1394_0x42f698;return moment(_0x3d67c3)[_0xc0b0d6(0x200)](moment(_0x282ec1),_0xc0b0d6(0x1f0));},exports[a1394_0x42f698(0x1fd)]=function(_0x1abff8,_0x2acc26){return parseInt(_0x1abff8,0xa)+parseInt(_0x2acc26,0xa);},exports['now']=function(){const _0x2c461a=a1394_0x42f698;return moment()[_0x2c461a(0x1f9)](_0x2c461a(0x1e7));},exports[a1394_0x42f698(0x1f1)]=function(_0x57cb4f,_0x9c5b11){const _0x4cb3a6=a1394_0x42f698;return _0x9c5b11?moment(_0x57cb4f)[_0x4cb3a6(0x1f1)](_0x9c5b11):!![];},exports[a1394_0x42f698(0x1f4)]=function(_0x2f260e,_0x4993aa){if(_0x4993aa)return moment(_0x2f260e)['isBefore'](_0x4993aa);else return _0x2f260e?!![]:![];};
\ No newline at end of file
+const a1398_0x143b=['catch','getUserByInterface','[utils][request]\x20name:%s','isAfter','interface','[utils][getUserByInterface]\x20interface:%s\x20%s','xdr','YYYY-MM-DD\x20HH:mm:ss','format','then','acw','http','isBefore','subtract','found','getUserByInternal','[utils][getUser]\x20where:%s','info','debug','util','error','stringify','sumTime','getVoiceQueueByName','type','GetVoiceQueue','now','notfound','seconds','[utils][getVoiceQueueByName]\x20name:%s','name','[utils][getUserByName]\x20name:%s\x20%s','addTime','../../config/logger','internal','[utils][getUserByName]','length','inspect','diff','request','getUserByName','GetUser','result'];(function(_0x420f8c,_0x4e0d9d){const _0x143b6e=function(_0x98fd84){while(--_0x98fd84){_0x420f8c['push'](_0x420f8c['shift']());}};_0x143b6e(++_0x4e0d9d);}(a1398_0x143b,0x13f));const a1398_0x98fd=function(_0x420f8c,_0x4e0d9d){_0x420f8c=_0x420f8c-0xe1;let _0x143b6e=a1398_0x143b[_0x420f8c];return _0x143b6e;};const a1398_0x40a901=a1398_0x98fd;'use strict';const util=require(a1398_0x40a901(0xe2)),jayson=require('jayson/promise'),moment=require('moment'),client=jayson['client'][a1398_0x40a901(0x105)]({'port':0x2329}),logger=require(a1398_0x40a901(0xf0))(a1398_0x40a901(0x100));exports[a1398_0x40a901(0x10b)]=function(_0x2d8c1f,_0x58b67c){const _0x18ff55=a1398_0x40a901;logger[_0x18ff55(0x10b)](_0x2d8c1f,_0x58b67c?util[_0x18ff55(0xf4)](_0x58b67c,{'showHidden':![],'depth':null}):'');},exports[a1398_0x40a901(0xe1)]=function(_0x301db3,_0x43516f){const _0x3052c0=a1398_0x40a901;logger[_0x3052c0(0xe1)](_0x301db3,_0x43516f?util[_0x3052c0(0xf4)](_0x43516f,{'showHidden':![],'depth':null}):'');},exports[a1398_0x40a901(0xe3)]=function(_0x3eec7c,_0x38fc41){const _0x5a78c5=a1398_0x40a901;logger['error'](_0x3eec7c,_0x38fc41?util[_0x5a78c5(0xf4)](_0x38fc41,{'showHidden':![],'depth':null}):'');},exports[a1398_0x40a901(0xf6)]=function(_0x451c2a,_0x2e5f06){const _0x414b83=a1398_0x40a901;return client[_0x414b83(0xf6)](_0x451c2a,{'body':_0x2e5f06})[_0x414b83(0x103)](function(_0x29f58a){logger['debug']('[utils][request]\x20name:%s',_0x451c2a,_0x29f58a?util['inspect'](_0x29f58a,{'showHidden':![],'depth':null}):'');})[_0x414b83(0xfa)](function(_0x58cecb){const _0x199d74=_0x414b83;logger['error'](_0x199d74(0xfc),_0x451c2a,_0x58cecb?util[_0x199d74(0xf4)](_0x58cecb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2f6032){const _0x2f8494=a1398_0x40a901;return client[_0x2f8494(0xf6)](_0x2f8494(0xf8),{'options':{'raw':!![],'attributes':['id',_0x2f8494(0xf1),_0x2f8494(0xed),_0x2f8494(0xfe)],'where':_0x2f6032,'limit':0x1}})['then'](function(_0x4110cf){const _0x38b181=_0x2f8494;return logger[_0x38b181(0xe1)](_0x38b181(0x10a),JSON[_0x38b181(0xe4)](_0x2f6032),_0x4110cf?util['inspect'](_0x4110cf,{'showHidden':![],'depth':null}):''),_0x4110cf[_0x38b181(0xf9)][_0x38b181(0xf3)]?_0x4110cf[_0x38b181(0xf9)][0x0]:null;});}exports[a1398_0x40a901(0x109)]=function(_0xc4f5b9){return new Promise(function(_0x5439ee){const _0x199e47=a1398_0x98fd;if(_0xc4f5b9)return getUser({'internal':_0xc4f5b9})[_0x199e47(0x103)](function(_0x3ec9c8){const _0x1603a9=_0x199e47;return logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xc4f5b9,_0x3ec9c8?'found':_0x1603a9(0xea)),_0x5439ee(_0x3ec9c8);})[_0x199e47(0xfa)](function(_0x200d36){const _0x5d1396=_0x199e47;return logger[_0x5d1396(0xe3)]('[utils][getUserByInternal]',_0x200d36?util[_0x5d1396(0xf4)](_0x200d36,{'showHidden':![],'depth':null}):''),_0x5439ee(null);});return _0x5439ee(null);});},exports[a1398_0x40a901(0xfb)]=function(_0x266080){return new Promise(function(_0x4c2bea){const _0x518f8a=a1398_0x98fd;if(_0x266080)return getUser({'interface':_0x266080})[_0x518f8a(0x103)](function(_0x3ed4cb){const _0xffd5bb=_0x518f8a;return logger[_0xffd5bb(0x10b)](_0xffd5bb(0xff),_0x266080,_0x3ed4cb?_0xffd5bb(0x108):_0xffd5bb(0xea)),_0x4c2bea(_0x3ed4cb);})[_0x518f8a(0xfa)](function(_0x258a43){const _0x565331=_0x518f8a;return logger[_0x565331(0xe3)]('[utils][getUserByInterface]',_0x258a43?util[_0x565331(0xf4)](_0x258a43,{'showHidden':![],'depth':null}):''),_0x4c2bea(null);});return _0x4c2bea(null);});},exports[a1398_0x40a901(0xf7)]=function(_0x2f92b8){return new Promise(function(_0x1f1935){const _0x258559=a1398_0x98fd;if(_0x2f92b8)return getUser({'name':_0x2f92b8})[_0x258559(0x103)](function(_0x2d867d){const _0x56e8d2=_0x258559;return logger[_0x56e8d2(0x10b)](_0x56e8d2(0xee),_0x2f92b8,_0x2d867d?_0x56e8d2(0x108):_0x56e8d2(0xea)),_0x1f1935(_0x2d867d);})['catch'](function(_0x2ef763){const _0x6eb7c9=_0x258559;return logger[_0x6eb7c9(0xe3)](_0x6eb7c9(0xf2),_0x2ef763?util[_0x6eb7c9(0xf4)](_0x2ef763,{'showHidden':![],'depth':null}):''),_0x1f1935(null);});return _0x1f1935(null);});},exports[a1398_0x40a901(0xe6)]=function(_0x50d0aa){return new Promise(function(_0x224c10){const _0x581f62=a1398_0x98fd;if(_0x50d0aa)return client[_0x581f62(0xf6)](_0x581f62(0xe8),{'options':{'raw':!![],'attributes':['id',_0x581f62(0xed),_0x581f62(0xe7),_0x581f62(0x104),'acwTimeout'],'where':{'name':_0x50d0aa},'limit':0x1}})[_0x581f62(0x103)](function(_0x2e7fc8){const _0x35b391=_0x581f62;return logger[_0x35b391(0xe1)](_0x35b391(0xec),_0x50d0aa,_0x2e7fc8?util[_0x35b391(0xf4)](_0x2e7fc8,{'showHidden':![],'depth':null}):''),logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x50d0aa,_0x2e7fc8?'found':_0x35b391(0xea)),_0x224c10(_0x2e7fc8['result'][_0x35b391(0xf3)]?_0x2e7fc8['result'][0x0]:null);})[_0x581f62(0xfa)](function(_0x162466){const _0x6dff6=_0x581f62;return logger[_0x6dff6(0xe3)]('[utils][getVoiceQueueByName]',_0x162466?util[_0x6dff6(0xf4)](_0x162466,{'showHidden':![],'depth':null}):''),_0x224c10(null);});return _0x224c10(null);});},exports[a1398_0x40a901(0xef)]=function(_0x5a5d3a,_0x36284f){const _0xe515ba=a1398_0x40a901;return moment(_0x5a5d3a)['add'](_0x36284f,_0xe515ba(0xeb))['format'](_0xe515ba(0x101));},exports['subtractTime']=function(_0x342c6b,_0x5ee0b1){const _0x1728e2=a1398_0x40a901;return moment(_0x342c6b)[_0x1728e2(0x107)](_0x5ee0b1,_0x1728e2(0xeb))[_0x1728e2(0x102)](_0x1728e2(0x101));},exports['diffTime']=function(_0x2335ed,_0x584a13){const _0x2848f4=a1398_0x40a901;return moment(_0x2335ed)[_0x2848f4(0xf5)](moment(_0x584a13),_0x2848f4(0xeb));},exports[a1398_0x40a901(0xe5)]=function(_0x4c8dff,_0x4fd761){return parseInt(_0x4c8dff,0xa)+parseInt(_0x4fd761,0xa);},exports[a1398_0x40a901(0xe9)]=function(){const _0x3331a6=a1398_0x40a901;return moment()[_0x3331a6(0x102)](_0x3331a6(0x101));},exports[a1398_0x40a901(0xfd)]=function(_0x3f62af,_0x4d9821){if(_0x4d9821)return moment(_0x3f62af)['isAfter'](_0x4d9821);return!![];},exports['isBefore']=function(_0x373846,_0x1216c6){const _0x53ae32=a1398_0x40a901;if(_0x1216c6)return moment(_0x373846)[_0x53ae32(0x106)](_0x1216c6);else{if(_0x373846)return!![];}return![];};
\ No newline at end of file