Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / api / interval / interval.rpc.js
index 46c0dc5..65d7be6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc697=['intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','map','model','then','GetInterval','debug','stringify','catch','error','message','ShowInterval','info','all','ifTime','reduce','format','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray'];(function(_0x16d71f,_0x3d6fd6){var _0x26df33=function(_0x38a379){while(--_0x38a379){_0x16d71f['push'](_0x16d71f['shift']());}};_0x26df33(++_0x3d6fd6);}(_0xc697,0x158));var _0x7c69=function(_0x3d190e,_0x19f79e){_0x3d190e=_0x3d190e-0x0;var _0x32ede4=_0xc697[_0x3d190e];return _0x32ede4;};'use strict';var _=require(_0x7c69('0x0'));var util=require(_0x7c69('0x1'));var db=require(_0x7c69('0x2'))['db'];var iftime=require(_0x7c69('0x3'))['iftime'];var logger=require(_0x7c69('0x4'))(_0x7c69('0x5'));exports['GetInterval']=function(_0xd771e3){var _0x2e77d3=this;return new Promise(function(_0x591366,_0x2893bb){return db[_0x7c69('0x6')][_0x7c69('0x7')]({'raw':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0x9')]===undefined?!![]:![]:!![],'where':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')]['where']||null:null,'attributes':_0xd771e3[_0x7c69('0x8')]?_0xd771e3['options'][_0x7c69('0xa')]||null:null,'limit':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0xb')]||null:null,'include':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0xc')]?_[_0x7c69('0xd')](_0xd771e3[_0x7c69('0x8')][_0x7c69('0xc')],function(_0x693a17){return{'model':db[_0x693a17[_0x7c69('0xe')]],'as':_0x693a17['as'],'attributes':_0x693a17[_0x7c69('0xa')],'include':_0x693a17[_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x693a17[_0x7c69('0xc')],function(_0x32c4a4){return{'model':db[_0x32c4a4[_0x7c69('0xe')]],'as':_0x32c4a4['as'],'attributes':_0x32c4a4[_0x7c69('0xa')],'include':_0x32c4a4[_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x32c4a4[_0x7c69('0xc')],function(_0x5a9e49){return{'model':db[_0x5a9e49[_0x7c69('0xe')]],'as':_0x5a9e49['as'],'attributes':_0x5a9e49[_0x7c69('0xa')]};}):[]};}):[]};}):[]:[]})[_0x7c69('0xf')](function(_0x4de153){logger['info'](_0x7c69('0x10'),_0xd771e3);logger[_0x7c69('0x11')](_0x7c69('0x10'),_0xd771e3,JSON[_0x7c69('0x12')](_0x4de153));_0x591366(_0x4de153);})[_0x7c69('0x13')](function(_0x745e2){logger[_0x7c69('0x14')]('GetInterval',_0x745e2[_0x7c69('0x15')],_0xd771e3);_0x2893bb(_0x2e77d3[_0x7c69('0x14')](0x1f4,_0x745e2[_0x7c69('0x15')]));});});};exports[_0x7c69('0x16')]=function(_0x2d03ea){var _0x5b20cb=this;return new Promise(function(_0xaa4add,_0xa990f5){return db['Interval']['find']({'raw':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0x9')]===undefined?!![]:![]:!![],'where':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')]['where']||null:null,'attributes':_0x2d03ea['options']?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0xa')]||null:null,'include':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x2d03ea['options'][_0x7c69('0xc')],function(_0x4965c2){return{'model':db[_0x4965c2[_0x7c69('0xe')]],'as':_0x4965c2['as'],'attributes':_0x4965c2[_0x7c69('0xa')],'include':_0x4965c2['include']?_['map'](_0x4965c2[_0x7c69('0xc')],function(_0x51fb33){return{'model':db[_0x51fb33['model']],'as':_0x51fb33['as'],'attributes':_0x51fb33[_0x7c69('0xa')],'include':_0x51fb33[_0x7c69('0xc')]?_['map'](_0x51fb33[_0x7c69('0xc')],function(_0x4bf276){return{'model':db[_0x4bf276[_0x7c69('0xe')]],'as':_0x4bf276['as'],'attributes':_0x4bf276[_0x7c69('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x182e33){logger[_0x7c69('0x17')]('ShowInterval',_0x2d03ea);logger[_0x7c69('0x11')](_0x7c69('0x16'),_0x2d03ea,JSON[_0x7c69('0x12')](_0x182e33));_0xaa4add(_0x182e33);})[_0x7c69('0x13')](function(_0xa42558){logger['error']('ShowInterval',_0xa42558[_0x7c69('0x15')],_0x2d03ea);_0xa990f5(_0x5b20cb[_0x7c69('0x14')](0x1f4,_0xa42558[_0x7c69('0x15')]));});});};function checkArrayOfIntervals(_0x3ef939,_0x5db8de){var _0x2e081f=[];return db['Interval'][_0x7c69('0x7')]({'where':{'id':_0x3ef939}})[_0x7c69('0xf')](function(_0x42b6fb){_0x2e081f=_0x42b6fb;return Promise[_0x7c69('0x18')](_0x2e081f[_0x7c69('0xd')](function(_0xcba5c){return _0xcba5c[_0x7c69('0x19')](_0x5db8de);}));})[_0x7c69('0xf')](function(_0x3ebad5){var _0x209d28=_0x3ebad5[_0x7c69('0x1a')](function(_0x149508,_0x2700aa){return _0x149508||_0x2700aa;},![]);logger[_0x7c69('0x17')](util[_0x7c69('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2e081f[_0x7c69('0xd')](function(_0x155160){return _0x155160['name'];})['join'](',\x20'),_0x2e081f[_0x7c69('0xd')](function(_0x52ef52){return _0x52ef52['id'];})[_0x7c69('0x1c')](',\x20')));return _0x209d28;});}function checkSingleInterval(_0xe6b0f3,_0x4b346c){return db[_0x7c69('0x6')][_0x7c69('0x1d')](_0xe6b0f3)[_0x7c69('0xf')](function(_0x446e94){if(_0x446e94){logger[_0x7c69('0x17')](util[_0x7c69('0x1b')](_0x7c69('0x1e'),_0x446e94[_0x7c69('0x1f')],_0x446e94['id']));return _0x446e94[_0x7c69('0x19')](_0x4b346c);}});}exports[_0x7c69('0x20')]=function(_0x4d03d8){var _0x57898c=_0x4d03d8['intervalIds'];var _0x3ddb59=Array[_0x7c69('0x21')](_0x4d03d8[_0x7c69('0x22')])?_0x4d03d8['intervals']:typeof _0x4d03d8[_0x7c69('0x22')]===_0x7c69('0x23')?[_0x4d03d8[_0x7c69('0x22')]]:[];var _0x33b26e=_0x4d03d8[_0x7c69('0x24')]||undefined;var _0x1c24de=![];if(_0x3ddb59[_0x7c69('0x25')]){logger['info'](util[_0x7c69('0x1b')](_0x7c69('0x26'),_0x3ddb59[_0x7c69('0x1c')](';\x20')));}if(_0x33b26e){logger[_0x7c69('0x17')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x33b26e));}logger[_0x7c69('0x11')](_0x7c69('0x27'),_0x1c24de);logger[_0x7c69('0x28')](_0x7c69('0x20'),_0x4d03d8);return Promise[_0x7c69('0x29')]()[_0x7c69('0xf')](function(){if(Array[_0x7c69('0x21')](_0x57898c)){return checkArrayOfIntervals(_0x57898c,_0x33b26e);}else if(_0x57898c){return checkSingleInterval(_0x57898c,_0x33b26e);}})[_0x7c69('0xf')](function(_0x44b60a){var _0x5b15dd=_0x3ddb59[_0x7c69('0x1a')](function(_0x36b594,_0x30ff14){return _0x36b594||iftime(_0x30ff14,_0x33b26e);},![]);_0x1c24de=_0x44b60a||_0x5b15dd;return _0x1c24de;})[_0x7c69('0x13')](function(_0xc785a4){logger[_0x7c69('0x14')](_0x7c69('0x20'),_0x4d03d8,_0xc785a4);throw this[_0x7c69('0x14')](0x1f4,_0xc785a4[_0x7c69('0x15')]);});};
\ No newline at end of file
+var _0x8945=['intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','include','model','attributes','map','then','info','stringify','error','message','find','ShowInterval','catch','all','ifTime','format','name','join','findById','IntervalIftime','intervalIds','isArray'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8945,0x18d));var _0x5894=function(_0x5c7753,_0x25dbc9){_0x5c7753=_0x5c7753-0x0;var _0x4d7dbf=_0x8945[_0x5c7753];return _0x4d7dbf;};'use strict';var _=require(_0x5894('0x0'));var util=require('util');var db=require(_0x5894('0x1'))['db'];var iftime=require(_0x5894('0x2'))[_0x5894('0x3')];var logger=require(_0x5894('0x4'))(_0x5894('0x5'));exports[_0x5894('0x6')]=function(_0x340d5d){var _0x5eee15=this;return new Promise(function(_0x5cca8a,_0x714ed1){return db[_0x5894('0x7')][_0x5894('0x8')]({'raw':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')][_0x5894('0xa')]||null:null,'attributes':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['attributes']||null:null,'limit':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['limit']||null:null,'include':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['include']?_['map'](_0x340d5d['options'][_0x5894('0xb')],function(_0x8d2aab){return{'model':db[_0x8d2aab[_0x5894('0xc')]],'as':_0x8d2aab['as'],'attributes':_0x8d2aab[_0x5894('0xd')],'include':_0x8d2aab[_0x5894('0xb')]?_[_0x5894('0xe')](_0x8d2aab[_0x5894('0xb')],function(_0xaad43e){return{'model':db[_0xaad43e[_0x5894('0xc')]],'as':_0xaad43e['as'],'attributes':_0xaad43e['attributes'],'include':_0xaad43e[_0x5894('0xb')]?_['map'](_0xaad43e[_0x5894('0xb')],function(_0x1a484e){return{'model':db[_0x1a484e[_0x5894('0xc')]],'as':_0x1a484e['as'],'attributes':_0x1a484e[_0x5894('0xd')]};}):[]};}):[]};}):[]:[]})[_0x5894('0xf')](function(_0x12c6a2){logger[_0x5894('0x10')](_0x5894('0x6'),_0x340d5d);logger['debug'](_0x5894('0x6'),_0x340d5d,JSON[_0x5894('0x11')](_0x12c6a2));_0x5cca8a(_0x12c6a2);})['catch'](function(_0x4182c2){logger[_0x5894('0x12')]('GetInterval',_0x4182c2[_0x5894('0x13')],_0x340d5d);_0x714ed1(_0x5eee15[_0x5894('0x12')](0x1f4,_0x4182c2[_0x5894('0x13')]));});});};exports['ShowInterval']=function(_0x50f33b){var _0x44ded4=this;return new Promise(function(_0x3b9e45,_0xc5d981){return db[_0x5894('0x7')][_0x5894('0x14')]({'raw':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x50f33b['options']?_0x50f33b[_0x5894('0x9')][_0x5894('0xa')]||null:null,'attributes':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')][_0x5894('0xd')]||null:null,'include':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')][_0x5894('0xb')]?_[_0x5894('0xe')](_0x50f33b[_0x5894('0x9')]['include'],function(_0x3beab1){return{'model':db[_0x3beab1[_0x5894('0xc')]],'as':_0x3beab1['as'],'attributes':_0x3beab1[_0x5894('0xd')],'include':_0x3beab1[_0x5894('0xb')]?_[_0x5894('0xe')](_0x3beab1[_0x5894('0xb')],function(_0x5e8c0b){return{'model':db[_0x5e8c0b[_0x5894('0xc')]],'as':_0x5e8c0b['as'],'attributes':_0x5e8c0b[_0x5894('0xd')],'include':_0x5e8c0b[_0x5894('0xb')]?_[_0x5894('0xe')](_0x5e8c0b[_0x5894('0xb')],function(_0xefd41a){return{'model':db[_0xefd41a[_0x5894('0xc')]],'as':_0xefd41a['as'],'attributes':_0xefd41a[_0x5894('0xd')]};}):[]};}):[]};}):[]:[]})[_0x5894('0xf')](function(_0x3d654f){logger['info'](_0x5894('0x15'),_0x50f33b);logger['debug']('ShowInterval',_0x50f33b,JSON['stringify'](_0x3d654f));_0x3b9e45(_0x3d654f);})[_0x5894('0x16')](function(_0x721228){logger['error'](_0x5894('0x15'),_0x721228[_0x5894('0x13')],_0x50f33b);_0xc5d981(_0x44ded4[_0x5894('0x12')](0x1f4,_0x721228[_0x5894('0x13')]));});});};function checkArrayOfIntervals(_0x17bd13,_0x19b60e){var _0x254baf=[];return db['Interval'][_0x5894('0x8')]({'where':{'id':_0x17bd13}})[_0x5894('0xf')](function(_0x1e3f29){_0x254baf=_0x1e3f29;return Promise[_0x5894('0x17')](_0x254baf[_0x5894('0xe')](function(_0x5cd692){return _0x5cd692[_0x5894('0x18')](_0x19b60e);}));})['then'](function(_0x8ae036){var _0x324dad=_0x8ae036['reduce'](function(_0x52563c,_0x4c07a0){return _0x52563c||_0x4c07a0;},![]);logger[_0x5894('0x10')](util[_0x5894('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x254baf[_0x5894('0xe')](function(_0x5f1499){return _0x5f1499[_0x5894('0x1a')];})[_0x5894('0x1b')](',\x20'),_0x254baf['map'](function(_0x4898ad){return _0x4898ad['id'];})['join'](',\x20')));return _0x324dad;});}function checkSingleInterval(_0xf065f7,_0x1898ea){return db['Interval'][_0x5894('0x1c')](_0xf065f7)['then'](function(_0x280682){if(_0x280682){logger['info'](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x280682[_0x5894('0x1a')],_0x280682['id']));return _0x280682[_0x5894('0x18')](_0x1898ea);}});}exports[_0x5894('0x1d')]=function(_0x25d39a){var _0x466738=_0x25d39a[_0x5894('0x1e')];var _0x5afd7a=Array[_0x5894('0x1f')](_0x25d39a['intervals'])?_0x25d39a[_0x5894('0x20')]:typeof _0x25d39a['intervals']===_0x5894('0x21')?[_0x25d39a[_0x5894('0x20')]]:[];var _0x2cd476=_0x25d39a[_0x5894('0x22')]||undefined;var _0x353b73=![];if(_0x5afd7a['length']){logger[_0x5894('0x10')](util[_0x5894('0x19')](_0x5894('0x23'),_0x5afd7a[_0x5894('0x1b')](';\x20')));}if(_0x2cd476){logger[_0x5894('0x10')](util[_0x5894('0x19')](_0x5894('0x24'),_0x2cd476));}logger['debug'](_0x5894('0x25'),_0x353b73);logger['silly']('IntervalIftime',_0x25d39a);return Promise[_0x5894('0x26')]()[_0x5894('0xf')](function(){if(Array[_0x5894('0x1f')](_0x466738)){return checkArrayOfIntervals(_0x466738,_0x2cd476);}else if(_0x466738){return checkSingleInterval(_0x466738,_0x2cd476);}})[_0x5894('0xf')](function(_0x3d0321){var _0x24d436=_0x5afd7a['reduce'](function(_0x31e136,_0x3d929b){return _0x31e136||iftime(_0x3d929b,_0x2cd476);},![]);_0x353b73=_0x3d0321||_0x24d436;return _0x353b73;})[_0x5894('0x16')](function(_0xccf5ed){logger[_0x5894('0x12')](_0x5894('0x1d'),_0x25d39a,_0xccf5ed);throw this['error'](0x1f4,_0xccf5ed[_0x5894('0x13')]);});};
\ No newline at end of file