Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / api / interval / interval.rpc.js
index 26e3512..65d7be6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9dc1=['debug','stringify','error','message','Interval','find','where','ShowInterval','catch','all','ifTime','reduce','format','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','Iftime','silly','resolve','isArray','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','map','include','model','attributes','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9dc1,0xed));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x19dc('0x0'))['db'];var iftime=require(_0x19dc('0x1'))[_0x19dc('0x2')];var logger=require(_0x19dc('0x3'))(_0x19dc('0x4'));exports[_0x19dc('0x5')]=function(_0x357d0d){var _0x379e3b=this;return new Promise(function(_0x1c6f2f,_0x247682){return db['Interval'][_0x19dc('0x6')]({'raw':_0x357d0d[_0x19dc('0x7')]?_0x357d0d[_0x19dc('0x7')][_0x19dc('0x8')]===undefined?!![]:![]:!![],'where':_0x357d0d[_0x19dc('0x7')]?_0x357d0d['options']['where']||null:null,'attributes':_0x357d0d[_0x19dc('0x7')]?_0x357d0d[_0x19dc('0x7')]['attributes']||null:null,'limit':_0x357d0d['options']?_0x357d0d['options']['limit']||null:null,'include':_0x357d0d[_0x19dc('0x7')]?_0x357d0d[_0x19dc('0x7')]['include']?_[_0x19dc('0x9')](_0x357d0d['options'][_0x19dc('0xa')],function(_0x57695c){return{'model':db[_0x57695c[_0x19dc('0xb')]],'as':_0x57695c['as'],'attributes':_0x57695c[_0x19dc('0xc')],'include':_0x57695c[_0x19dc('0xa')]?_['map'](_0x57695c[_0x19dc('0xa')],function(_0x9353e5){return{'model':db[_0x9353e5['model']],'as':_0x9353e5['as'],'attributes':_0x9353e5['attributes'],'include':_0x9353e5[_0x19dc('0xa')]?_['map'](_0x9353e5[_0x19dc('0xa')],function(_0x432818){return{'model':db[_0x432818[_0x19dc('0xb')]],'as':_0x432818['as'],'attributes':_0x432818['attributes']};}):[]};}):[]};}):[]:[]})[_0x19dc('0xd')](function(_0xa41efb){logger[_0x19dc('0xe')]('GetInterval',_0x357d0d);logger[_0x19dc('0xf')](_0x19dc('0x5'),_0x357d0d,JSON[_0x19dc('0x10')](_0xa41efb));_0x1c6f2f(_0xa41efb);})['catch'](function(_0x3a76d9){logger[_0x19dc('0x11')](_0x19dc('0x5'),_0x3a76d9[_0x19dc('0x12')],_0x357d0d);_0x247682(_0x379e3b[_0x19dc('0x11')](0x1f4,_0x3a76d9[_0x19dc('0x12')]));});});};exports['ShowInterval']=function(_0x4007f2){var _0x3ceba7=this;return new Promise(function(_0x29b648,_0x4f1048){return db[_0x19dc('0x13')][_0x19dc('0x14')]({'raw':_0x4007f2[_0x19dc('0x7')]?_0x4007f2[_0x19dc('0x7')][_0x19dc('0x8')]===undefined?!![]:![]:!![],'where':_0x4007f2[_0x19dc('0x7')]?_0x4007f2[_0x19dc('0x7')][_0x19dc('0x15')]||null:null,'attributes':_0x4007f2[_0x19dc('0x7')]?_0x4007f2[_0x19dc('0x7')]['attributes']||null:null,'include':_0x4007f2[_0x19dc('0x7')]?_0x4007f2[_0x19dc('0x7')]['include']?_[_0x19dc('0x9')](_0x4007f2[_0x19dc('0x7')][_0x19dc('0xa')],function(_0x2aa8e4){return{'model':db[_0x2aa8e4[_0x19dc('0xb')]],'as':_0x2aa8e4['as'],'attributes':_0x2aa8e4[_0x19dc('0xc')],'include':_0x2aa8e4[_0x19dc('0xa')]?_[_0x19dc('0x9')](_0x2aa8e4['include'],function(_0x555400){return{'model':db[_0x555400['model']],'as':_0x555400['as'],'attributes':_0x555400['attributes'],'include':_0x555400['include']?_[_0x19dc('0x9')](_0x555400[_0x19dc('0xa')],function(_0x5e0da7){return{'model':db[_0x5e0da7[_0x19dc('0xb')]],'as':_0x5e0da7['as'],'attributes':_0x5e0da7['attributes']};}):[]};}):[]};}):[]:[]})[_0x19dc('0xd')](function(_0x2bf99b){logger['info']('ShowInterval',_0x4007f2);logger['debug'](_0x19dc('0x16'),_0x4007f2,JSON['stringify'](_0x2bf99b));_0x29b648(_0x2bf99b);})[_0x19dc('0x17')](function(_0x5e197b){logger[_0x19dc('0x11')](_0x19dc('0x16'),_0x5e197b[_0x19dc('0x12')],_0x4007f2);_0x4f1048(_0x3ceba7['error'](0x1f4,_0x5e197b[_0x19dc('0x12')]));});});};function checkArrayOfIntervals(_0x2bb295,_0x1cfa25){var _0x2b1c80=[];return db[_0x19dc('0x13')][_0x19dc('0x6')]({'where':{'id':_0x2bb295}})['then'](function(_0x13a805){_0x2b1c80=_0x13a805;return Promise[_0x19dc('0x18')](_0x2b1c80[_0x19dc('0x9')](function(_0x3f67c1){return _0x3f67c1[_0x19dc('0x19')](_0x1cfa25);}));})[_0x19dc('0xd')](function(_0x52200e){var _0x347441=_0x52200e[_0x19dc('0x1a')](function(_0x485793,_0x29488c){return _0x485793||_0x29488c;},![]);logger[_0x19dc('0xe')](util[_0x19dc('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2b1c80['map'](function(_0x267ef8){return _0x267ef8[_0x19dc('0x1c')];})['join'](',\x20'),_0x2b1c80[_0x19dc('0x9')](function(_0x152aae){return _0x152aae['id'];})['join'](',\x20')));return _0x347441;});}function checkSingleInterval(_0xcfc5da,_0x269a9b){return db[_0x19dc('0x13')][_0x19dc('0x1d')](_0xcfc5da)[_0x19dc('0xd')](function(_0x57a1af){if(_0x57a1af){logger[_0x19dc('0xe')](util[_0x19dc('0x1b')](_0x19dc('0x1e'),_0x57a1af['name'],_0x57a1af['id']));return _0x57a1af['ifTime'](_0x269a9b);}});}exports['IntervalIftime']=function(_0x345154){var _0x18f3bc=_0x345154[_0x19dc('0x1f')];var _0x49e6d3=Array['isArray'](_0x345154[_0x19dc('0x20')])?_0x345154[_0x19dc('0x20')]:typeof _0x345154[_0x19dc('0x20')]===_0x19dc('0x21')?[_0x345154['intervals']]:[];var _0x74b1dc=_0x345154[_0x19dc('0x22')]||undefined;var _0x3b9783=![];if(_0x49e6d3[_0x19dc('0x23')]){logger['info'](util['format'](_0x19dc('0x24'),_0x49e6d3[_0x19dc('0x25')](';\x20')));}if(_0x74b1dc){logger[_0x19dc('0xe')](util[_0x19dc('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x74b1dc));}logger[_0x19dc('0xf')](_0x19dc('0x26'),_0x3b9783);logger[_0x19dc('0x27')]('IntervalIftime',_0x345154);return Promise[_0x19dc('0x28')]()[_0x19dc('0xd')](function(){if(Array[_0x19dc('0x29')](_0x18f3bc)){return checkArrayOfIntervals(_0x18f3bc,_0x74b1dc);}else if(_0x18f3bc){return checkSingleInterval(_0x18f3bc,_0x74b1dc);}})[_0x19dc('0xd')](function(_0x91c5a4){var _0x54f44c=_0x49e6d3['reduce'](function(_0x5ac8d1,_0x27a089){return _0x5ac8d1||iftime(_0x27a089,_0x74b1dc);},![]);_0x3b9783=_0x91c5a4||_0x54f44c;return _0x3b9783;})[_0x19dc('0x17')](function(_0x11f26a){logger[_0x19dc('0x11')]('IntervalIftime',_0x345154,_0x11f26a);throw this[_0x19dc('0x11')](0x1f4,_0x11f26a[_0x19dc('0x12')]);});};
\ 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