Built motion from commit (unavailable).|2.5.5
[motion2.git] / server / api / automation / automation.controller.js
index 3d57d83..88ee783 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbff1=['save','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','Action','omit','getActions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject'];(function(_0x377152,_0x2566af){var _0x10f15e=function(_0x4e3777){while(--_0x4e3777){_0x377152['push'](_0x377152['shift']());}};_0x10f15e(++_0x2566af);}(_0xbff1,0x7e));var _0x1bff=function(_0x2699d7,_0x41d731){_0x2699d7=_0x2699d7-0x0;var _0x350f71=_0xbff1[_0x2699d7];return _0x350f71;};'use strict';var pdf=require(_0x1bff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1bff('0x1'));var zipdir=require(_0x1bff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bff('0x3'));var moment=require(_0x1bff('0x4'));var BPromise=require(_0x1bff('0x5'));var Mustache=require('mustache');var util=require(_0x1bff('0x6'));var path=require(_0x1bff('0x7'));var sox=require(_0x1bff('0x8'));var csv=require(_0x1bff('0x9'));var ejs=require(_0x1bff('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1bff('0xb'));var Redis=require(_0x1bff('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1bff('0xd'));var as=require(_0x1bff('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bff('0xf'))('api');var utils=require(_0x1bff('0x10'));var config=require(_0x1bff('0x11'));var db=require(_0x1bff('0x12'))['db'];function respondWithStatusCode(_0x3e9ef2,_0x72ffc2){_0x72ffc2=_0x72ffc2||0xcc;return function(_0x31a5ab){if(_0x31a5ab){return _0x3e9ef2[_0x1bff('0x13')](_0x72ffc2);}return _0x3e9ef2[_0x1bff('0x14')](_0x72ffc2)[_0x1bff('0x15')]();};}function respondWithResult(_0x27ee1c,_0x1a4b03){_0x1a4b03=_0x1a4b03||0xc8;return function(_0x13d468){if(_0x13d468){return _0x27ee1c[_0x1bff('0x14')](_0x1a4b03)[_0x1bff('0x16')](_0x13d468);}};}function respondWithFilteredResult(_0x53d1ce,_0x2dd007){return function(_0x1b2482){if(_0x1b2482){var _0x23ddc0=_0x1b2482[_0x1bff('0x17')],_0x266877=_0x2dd007[_0x1bff('0x18')],_0x2481d8=_0x2dd007[_0x1bff('0x18')]+_0x2dd007[_0x1bff('0x19')],_0x9e0cb8;if(_0x2481d8>=_0x23ddc0){_0x2481d8=_0x23ddc0;_0x9e0cb8=0xc8;}else{_0x9e0cb8=0xce;}_0x53d1ce['status'](_0x9e0cb8);return _0x53d1ce['set'](_0x1bff('0x1a'),_0x266877+'-'+_0x2481d8+'/'+_0x23ddc0)[_0x1bff('0x16')](_0x1b2482);}return null;};}function patchUpdates(_0x824a56){return function(_0x5ebb06){try{jsonpatch['apply'](_0x5ebb06,_0x824a56,!![]);}catch(_0x824bf1){return BPromise[_0x1bff('0x1b')](_0x824bf1);}return _0x5ebb06[_0x1bff('0x1c')]();};}function saveUpdates(_0x23015d,_0x390f05){return function(_0xf6ecd){if(_0xf6ecd){return _0xf6ecd[_0x1bff('0x1d')](_0x23015d)['then'](function(_0x199f45){return _0x199f45;});}return null;};}function removeEntity(_0x2938c8,_0x2c6090){return function(_0x42d707){if(_0x42d707){return _0x42d707[_0x1bff('0x1e')]()[_0x1bff('0x1f')](function(){_0x2938c8[_0x1bff('0x14')](0xcc)[_0x1bff('0x15')]();});}};}function handleEntityNotFound(_0x36faec,_0x50c790){return function(_0x3e7eca){if(!_0x3e7eca){_0x36faec[_0x1bff('0x13')](0x194);}return _0x3e7eca;};}function handleError(_0x252374,_0x252fc6){_0x252fc6=_0x252fc6||0x1f4;return function(_0x2d01a5){logger[_0x1bff('0x20')](_0x2d01a5[_0x1bff('0x21')]);if(_0x2d01a5[_0x1bff('0x22')]){delete _0x2d01a5[_0x1bff('0x22')];}_0x252374[_0x1bff('0x14')](_0x252fc6)[_0x1bff('0x23')](_0x2d01a5);};}exports[_0x1bff('0x24')]=function(_0x5d081b,_0x13fb08){var _0x435c3d={},_0x1bef75={},_0x1b94d9={'count':0x0,'rows':[]};var _0x348cb0=_[_0x1bff('0x25')](db[_0x1bff('0x26')][_0x1bff('0x27')],function(_0x25daf4){return{'name':_0x25daf4['fieldName'],'type':_0x25daf4[_0x1bff('0x28')][_0x1bff('0x29')]};});_0x1bef75[_0x1bff('0x2a')]=_['map'](_0x348cb0,_0x1bff('0x22'));_0x1bef75['query']=_['keys'](_0x5d081b['query']);_0x1bef75[_0x1bff('0x2b')]=_[_0x1bff('0x2c')](_0x1bef75[_0x1bff('0x2a')],_0x1bef75[_0x1bff('0x2d')]);_0x435c3d[_0x1bff('0x2e')]=_[_0x1bff('0x2c')](_0x1bef75[_0x1bff('0x2a')],qs['fields'](_0x5d081b[_0x1bff('0x2d')][_0x1bff('0x2f')]));_0x435c3d[_0x1bff('0x2e')]=_0x435c3d[_0x1bff('0x2e')][_0x1bff('0x30')]?_0x435c3d['attributes']:_0x1bef75[_0x1bff('0x2a')];if(!_0x5d081b[_0x1bff('0x2d')][_0x1bff('0x31')](_0x1bff('0x32'))){_0x435c3d[_0x1bff('0x19')]=qs[_0x1bff('0x19')](_0x5d081b['query']['limit']);_0x435c3d[_0x1bff('0x18')]=qs[_0x1bff('0x18')](_0x5d081b[_0x1bff('0x2d')]['offset']);}_0x435c3d[_0x1bff('0x33')]=qs[_0x1bff('0x34')](_0x5d081b[_0x1bff('0x2d')][_0x1bff('0x34')]);_0x435c3d[_0x1bff('0x35')]=qs['filters'](_[_0x1bff('0x36')](_0x5d081b[_0x1bff('0x2d')],_0x1bef75[_0x1bff('0x2b')]),_0x348cb0);if(_0x5d081b[_0x1bff('0x2d')][_0x1bff('0x37')]){_0x435c3d['where']=_[_0x1bff('0x38')](_0x435c3d[_0x1bff('0x35')],{'$or':_[_0x1bff('0x25')](_0x348cb0,function(_0x2d19b5){if(_0x2d19b5['type']!==_0x1bff('0x39')){var _0x2712fa={};_0x2712fa[_0x2d19b5[_0x1bff('0x22')]]={'$like':'%'+_0x5d081b['query'][_0x1bff('0x37')]+'%'};return _0x2712fa;}})});}_0x435c3d=_[_0x1bff('0x38')]({},_0x435c3d,_0x5d081b[_0x1bff('0x3a')]);var _0x51083c={'where':_0x435c3d['where']};return db['Automation'][_0x1bff('0x17')](_0x51083c)[_0x1bff('0x1f')](function(_0x3a4788){_0x1b94d9[_0x1bff('0x17')]=_0x3a4788;if(_0x5d081b[_0x1bff('0x2d')][_0x1bff('0x3b')]){_0x435c3d[_0x1bff('0x3c')]=[{'all':!![]}];}return db['Automation'][_0x1bff('0x3d')](_0x435c3d);})['then'](function(_0x150a4d){_0x1b94d9['rows']=_0x150a4d;return _0x1b94d9;})[_0x1bff('0x1f')](respondWithFilteredResult(_0x13fb08,_0x435c3d))[_0x1bff('0x3e')](handleError(_0x13fb08,null));};exports['show']=function(_0xa528a9,_0x41dc5e){var _0x82ff73={'raw':![],'where':{'id':_0xa528a9[_0x1bff('0x3f')]['id']}},_0x5c1886={};_0x5c1886[_0x1bff('0x2a')]=_['keys'](db[_0x1bff('0x26')][_0x1bff('0x27')]);_0x5c1886['query']=_[_0x1bff('0x40')](_0xa528a9[_0x1bff('0x2d')]);_0x5c1886['filters']=_[_0x1bff('0x2c')](_0x5c1886[_0x1bff('0x2a')],_0x5c1886[_0x1bff('0x2d')]);_0x82ff73[_0x1bff('0x2e')]=_[_0x1bff('0x2c')](_0x5c1886[_0x1bff('0x2a')],qs[_0x1bff('0x2f')](_0xa528a9['query']['fields']));_0x82ff73[_0x1bff('0x2e')]=_0x82ff73[_0x1bff('0x2e')][_0x1bff('0x30')]?_0x82ff73[_0x1bff('0x2e')]:_0x5c1886[_0x1bff('0x2a')];if(_0xa528a9[_0x1bff('0x2d')][_0x1bff('0x3b')]){_0x82ff73[_0x1bff('0x3c')]=[{'all':!![]}];}_0x82ff73=_[_0x1bff('0x38')]({},_0x82ff73,_0xa528a9[_0x1bff('0x3a')]);return db['Automation'][_0x1bff('0x41')](_0x82ff73)[_0x1bff('0x1f')](handleEntityNotFound(_0x41dc5e,null))[_0x1bff('0x1f')](respondWithResult(_0x41dc5e,null))[_0x1bff('0x3e')](handleError(_0x41dc5e,null));};exports['create']=function(_0x146dc9,_0x4c8b85){return db[_0x1bff('0x26')][_0x1bff('0x42')](_0x146dc9['body'],{})[_0x1bff('0x1f')](respondWithResult(_0x4c8b85,0xc9))[_0x1bff('0x3e')](handleError(_0x4c8b85,null));};exports['update']=function(_0xafe59c,_0x429414){if(_0xafe59c[_0x1bff('0x43')]['id']){delete _0xafe59c[_0x1bff('0x43')]['id'];}return db[_0x1bff('0x26')]['find']({'where':{'id':_0xafe59c[_0x1bff('0x3f')]['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0x429414,null))['then'](saveUpdates(_0xafe59c[_0x1bff('0x43')],null))[_0x1bff('0x1f')](respondWithResult(_0x429414,null))[_0x1bff('0x3e')](handleError(_0x429414,null));};exports[_0x1bff('0x1e')]=function(_0x439b61,_0xde7d79){return db[_0x1bff('0x26')][_0x1bff('0x41')]({'where':{'id':_0x439b61['params']['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0xde7d79,null))[_0x1bff('0x1f')](removeEntity(_0xde7d79,null))[_0x1bff('0x3e')](handleError(_0xde7d79,null));};exports[_0x1bff('0x44')]=function(_0x333fc6,_0x257101,_0x5e300c){return db[_0x1bff('0x45')]['find']({'where':{'id':_0x333fc6['params']['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0x257101,null))[_0x1bff('0x1f')](function(_0x43f164){if(_0x43f164){return _0x43f164['addConditions'](_0x333fc6['body'][_0x1bff('0x46')],_['omit'](_0x333fc6[_0x1bff('0x43')],['ids','id'])||{});}})[_0x1bff('0x1f')](respondWithResult(_0x257101,null))[_0x1bff('0x3e')](handleError(_0x257101,null));};exports[_0x1bff('0x47')]=function(_0x1221e0,_0x1455a3,_0x1561aa){var _0x4bfc3f={};var _0x1cf7d8={};var _0x39136e;var _0x1fc342;return db[_0x1bff('0x26')][_0x1bff('0x48')]({'where':{'id':_0x1221e0[_0x1bff('0x3f')]['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0x1455a3,null))[_0x1bff('0x1f')](function(_0x34f13a){if(_0x34f13a){_0x39136e=_0x34f13a;_0x1cf7d8['model']=_[_0x1bff('0x40')](db[_0x1bff('0x45')][_0x1bff('0x27')]);_0x1cf7d8[_0x1bff('0x2d')]=_[_0x1bff('0x40')](_0x1221e0[_0x1bff('0x2d')]);_0x1cf7d8[_0x1bff('0x2b')]=_[_0x1bff('0x2c')](_0x1cf7d8[_0x1bff('0x2a')],_0x1cf7d8['query']);_0x4bfc3f[_0x1bff('0x2e')]=_['intersection'](_0x1cf7d8['model'],qs[_0x1bff('0x2f')](_0x1221e0[_0x1bff('0x2d')]['fields']));_0x4bfc3f[_0x1bff('0x2e')]=_0x4bfc3f[_0x1bff('0x2e')][_0x1bff('0x30')]?_0x4bfc3f[_0x1bff('0x2e')]:_0x1cf7d8['model'];_0x4bfc3f[_0x1bff('0x33')]=qs[_0x1bff('0x34')](_0x1221e0[_0x1bff('0x2d')][_0x1bff('0x34')]);_0x4bfc3f[_0x1bff('0x35')]=qs[_0x1bff('0x2b')](_[_0x1bff('0x36')](_0x1221e0[_0x1bff('0x2d')],_0x1cf7d8[_0x1bff('0x2b')]));if(_0x1221e0[_0x1bff('0x2d')]['filter']){_0x4bfc3f[_0x1bff('0x35')]=_[_0x1bff('0x38')](_0x4bfc3f['where'],{'$or':_[_0x1bff('0x25')](_0x4bfc3f[_0x1bff('0x2e')],function(_0x2da94e){var _0x41828e={};_0x41828e[_0x2da94e]={'$like':'%'+_0x1221e0[_0x1bff('0x2d')][_0x1bff('0x37')]+'%'};return _0x41828e;})});}_0x4bfc3f=_[_0x1bff('0x38')]({},_0x4bfc3f,_0x1221e0[_0x1bff('0x3a')]);return _0x39136e['getConditions'](_0x4bfc3f);}})[_0x1bff('0x1f')](function(_0x473f16){if(_0x473f16){_0x1fc342=_0x473f16['length'];if(!_0x1221e0[_0x1bff('0x2d')]['hasOwnProperty'](_0x1bff('0x32'))){_0x4bfc3f[_0x1bff('0x19')]=qs[_0x1bff('0x19')](_0x1221e0['query'][_0x1bff('0x19')]);_0x4bfc3f[_0x1bff('0x18')]=qs['offset'](_0x1221e0[_0x1bff('0x2d')]['offset']);}return _0x39136e[_0x1bff('0x47')](_0x4bfc3f);}})[_0x1bff('0x1f')](function(_0x2cea69){if(_0x2cea69){return _0x2cea69?{'count':_0x1fc342,'rows':_0x2cea69}:null;}})[_0x1bff('0x1f')](respondWithResult(_0x1455a3,null))[_0x1bff('0x3e')](handleError(_0x1455a3,null));};exports[_0x1bff('0x49')]=function(_0x20a7ed,_0x81cb5a,_0x4c3b68){return db[_0x1bff('0x4a')]['find']({'where':{'id':_0x20a7ed[_0x1bff('0x3f')]['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0x81cb5a,null))['then'](function(_0x42c463){if(_0x42c463){return _0x42c463[_0x1bff('0x49')](_0x20a7ed[_0x1bff('0x43')][_0x1bff('0x46')],_[_0x1bff('0x4b')](_0x20a7ed[_0x1bff('0x43')],['ids','id'])||{});}})[_0x1bff('0x1f')](respondWithResult(_0x81cb5a,null))['catch'](handleError(_0x81cb5a,null));};exports[_0x1bff('0x4c')]=function(_0x28a23b,_0x5e643f,_0x43bf83){var _0x16868c={};var _0x1744ec={};var _0x34f14c;var _0xa0e727;return db[_0x1bff('0x26')][_0x1bff('0x48')]({'where':{'id':_0x28a23b['params']['id']}})[_0x1bff('0x1f')](handleEntityNotFound(_0x5e643f,null))['then'](function(_0x2b7a40){if(_0x2b7a40){_0x34f14c=_0x2b7a40;_0x1744ec[_0x1bff('0x2a')]=_[_0x1bff('0x40')](db[_0x1bff('0x4a')][_0x1bff('0x27')]);_0x1744ec[_0x1bff('0x2d')]=_[_0x1bff('0x40')](_0x28a23b[_0x1bff('0x2d')]);_0x1744ec[_0x1bff('0x2b')]=_[_0x1bff('0x2c')](_0x1744ec[_0x1bff('0x2a')],_0x1744ec[_0x1bff('0x2d')]);_0x16868c[_0x1bff('0x2e')]=_['intersection'](_0x1744ec['model'],qs[_0x1bff('0x2f')](_0x28a23b[_0x1bff('0x2d')][_0x1bff('0x2f')]));_0x16868c[_0x1bff('0x2e')]=_0x16868c['attributes'][_0x1bff('0x30')]?_0x16868c['attributes']:_0x1744ec[_0x1bff('0x2a')];_0x16868c[_0x1bff('0x33')]=qs['sort'](_0x28a23b[_0x1bff('0x2d')][_0x1bff('0x34')]);_0x16868c[_0x1bff('0x35')]=qs[_0x1bff('0x2b')](_[_0x1bff('0x36')](_0x28a23b[_0x1bff('0x2d')],_0x1744ec['filters']));if(_0x28a23b['query'][_0x1bff('0x37')]){_0x16868c[_0x1bff('0x35')]=_[_0x1bff('0x38')](_0x16868c[_0x1bff('0x35')],{'$or':_[_0x1bff('0x25')](_0x16868c[_0x1bff('0x2e')],function(_0x18294b){var _0x20e33a={};_0x20e33a[_0x18294b]={'$like':'%'+_0x28a23b[_0x1bff('0x2d')]['filter']+'%'};return _0x20e33a;})});}_0x16868c=_[_0x1bff('0x38')]({},_0x16868c,_0x28a23b[_0x1bff('0x3a')]);return _0x34f14c[_0x1bff('0x4c')](_0x16868c);}})[_0x1bff('0x1f')](function(_0x157cd7){if(_0x157cd7){_0xa0e727=_0x157cd7['length'];if(!_0x28a23b['query'][_0x1bff('0x31')](_0x1bff('0x32'))){_0x16868c[_0x1bff('0x19')]=qs[_0x1bff('0x19')](_0x28a23b[_0x1bff('0x2d')]['limit']);_0x16868c[_0x1bff('0x18')]=qs['offset'](_0x28a23b[_0x1bff('0x2d')]['offset']);}return _0x34f14c[_0x1bff('0x4c')](_0x16868c);}})['then'](function(_0x30e0e9){if(_0x30e0e9){return _0x30e0e9?{'count':_0xa0e727,'rows':_0x30e0e9}:null;}})['then'](respondWithResult(_0x5e643f,null))[_0x1bff('0x3e')](handleError(_0x5e643f,null));};
\ No newline at end of file
+var _0x86da=['status','end','count','limit','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','Automation','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','filter','type','merge','options','includeAll','include','rows','show','params','keys','find','create','body','catch','update','addConditions','omit','ids','getConditions','Condition','order','pick','hasOwnProperty','addActions','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x86da,0x175));var _0xa86d=function(_0x4e481f,_0x5ee0ed){_0x4e481f=_0x4e481f-0x0;var _0x24f910=_0x86da[_0x4e481f];return _0x24f910;};'use strict';var pdf=require(_0xa86d('0x0'));var emlformat=require(_0xa86d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa86d('0x2'));var jsonpatch=require(_0xa86d('0x3'));var rp=require('request-promise');var moment=require(_0xa86d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa86d('0x5'));var util=require(_0xa86d('0x6'));var path=require('path');var sox=require(_0xa86d('0x7'));var csv=require('to-csv');var ejs=require(_0xa86d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa86d('0x9'));var crypto=require('crypto');var jsforce=require(_0xa86d('0xa'));var deskjs=require(_0xa86d('0xb'));var toCsv=require(_0xa86d('0xc'));var querystring=require('querystring');var Papa=require(_0xa86d('0xd'));var Redis=require(_0xa86d('0xe'));var authService=require(_0xa86d('0xf'));var qs=require(_0xa86d('0x10'));var as=require(_0xa86d('0x11'));var hardwareService=require(_0xa86d('0x12'));var logger=require(_0xa86d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa86d('0x14'));var licenseUtil=require(_0xa86d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6d44b7,_0x105861){_0x105861=_0x105861||0xcc;return function(_0x559020){if(_0x559020){return _0x6d44b7['sendStatus'](_0x105861);}return _0x6d44b7[_0xa86d('0x16')](_0x105861)[_0xa86d('0x17')]();};}function respondWithResult(_0x4575d7,_0x12b4f2){_0x12b4f2=_0x12b4f2||0xc8;return function(_0x12638c){if(_0x12638c){return _0x4575d7['status'](_0x12b4f2)['json'](_0x12638c);}};}function respondWithFilteredResult(_0x42ae2d,_0x2a27ba){return function(_0x1fb800){if(_0x1fb800){var _0x4db8c9=_0x1fb800[_0xa86d('0x18')],_0x115472=_0x2a27ba['offset'],_0x444be5=_0x2a27ba['offset']+_0x2a27ba[_0xa86d('0x19')],_0x4b31c1;if(_0x444be5>=_0x4db8c9){_0x444be5=_0x4db8c9;_0x4b31c1=0xc8;}else{_0x4b31c1=0xce;}_0x42ae2d[_0xa86d('0x16')](_0x4b31c1);return _0x42ae2d['set'](_0xa86d('0x1a'),_0x115472+'-'+_0x444be5+'/'+_0x4db8c9)[_0xa86d('0x1b')](_0x1fb800);}return null;};}function patchUpdates(_0x48eae8){return function(_0x1a2cf9){try{jsonpatch[_0xa86d('0x1c')](_0x1a2cf9,_0x48eae8,!![]);}catch(_0xa991db){return BPromise[_0xa86d('0x1d')](_0xa991db);}return _0x1a2cf9[_0xa86d('0x1e')]();};}function saveUpdates(_0x318d8e,_0x72d769){return function(_0x343023){if(_0x343023){return _0x343023['update'](_0x318d8e)[_0xa86d('0x1f')](function(_0x30edd6){return _0x30edd6;});}return null;};}function removeEntity(_0x148675,_0x59b940){return function(_0x4129ae){if(_0x4129ae){return _0x4129ae[_0xa86d('0x20')]()[_0xa86d('0x1f')](function(){_0x148675[_0xa86d('0x16')](0xcc)[_0xa86d('0x17')]();});}};}function handleEntityNotFound(_0x3e5e76,_0x1782bd){return function(_0x373ee5){if(!_0x373ee5){_0x3e5e76[_0xa86d('0x21')](0x194);}return _0x373ee5;};}function handleError(_0x47ae8c,_0x2f98b0){_0x2f98b0=_0x2f98b0||0x1f4;return function(_0x182249){logger[_0xa86d('0x22')](_0x182249[_0xa86d('0x23')]);if(_0x182249[_0xa86d('0x24')]){delete _0x182249[_0xa86d('0x24')];}_0x47ae8c[_0xa86d('0x16')](_0x2f98b0)['send'](_0x182249);};}exports['index']=function(_0xc21d9c,_0x540184){var _0x12172c={},_0x1275d8={},_0x59635b={'count':0x0,'rows':[]};var _0x7c5901=_[_0xa86d('0x25')](db[_0xa86d('0x26')][_0xa86d('0x27')],function(_0x426657){return{'name':_0x426657[_0xa86d('0x28')],'type':_0x426657['type'][_0xa86d('0x29')]};});_0x1275d8[_0xa86d('0x2a')]=_[_0xa86d('0x25')](_0x7c5901,_0xa86d('0x24'));_0x1275d8[_0xa86d('0x2b')]=_['keys'](_0xc21d9c[_0xa86d('0x2b')]);_0x1275d8[_0xa86d('0x2c')]=_[_0xa86d('0x2d')](_0x1275d8[_0xa86d('0x2a')],_0x1275d8[_0xa86d('0x2b')]);_0x12172c[_0xa86d('0x2e')]=_[_0xa86d('0x2d')](_0x1275d8['model'],qs['fields'](_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x2f')]));_0x12172c[_0xa86d('0x2e')]=_0x12172c[_0xa86d('0x2e')][_0xa86d('0x30')]?_0x12172c[_0xa86d('0x2e')]:_0x1275d8['model'];if(!_0xc21d9c[_0xa86d('0x2b')]['hasOwnProperty'](_0xa86d('0x31'))){_0x12172c[_0xa86d('0x19')]=qs[_0xa86d('0x19')](_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x19')]);_0x12172c[_0xa86d('0x32')]=qs['offset'](_0xc21d9c['query'][_0xa86d('0x32')]);}_0x12172c['order']=qs[_0xa86d('0x33')](_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x33')]);_0x12172c[_0xa86d('0x34')]=qs[_0xa86d('0x2c')](_['pick'](_0xc21d9c['query'],_0x1275d8[_0xa86d('0x2c')]),_0x7c5901);if(_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x35')]){_0x12172c[_0xa86d('0x34')]=_['merge'](_0x12172c[_0xa86d('0x34')],{'$or':_['map'](_0x7c5901,function(_0x2505c8){if(_0x2505c8[_0xa86d('0x36')]!=='VIRTUAL'){var _0x3cc0e9={};_0x3cc0e9[_0x2505c8[_0xa86d('0x24')]]={'$like':'%'+_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x35')]+'%'};return _0x3cc0e9;}})});}_0x12172c=_[_0xa86d('0x37')]({},_0x12172c,_0xc21d9c[_0xa86d('0x38')]);var _0x5cc3f1={'where':_0x12172c[_0xa86d('0x34')]};return db[_0xa86d('0x26')][_0xa86d('0x18')](_0x5cc3f1)[_0xa86d('0x1f')](function(_0x5ca562){_0x59635b['count']=_0x5ca562;if(_0xc21d9c[_0xa86d('0x2b')][_0xa86d('0x39')]){_0x12172c[_0xa86d('0x3a')]=[{'all':!![]}];}return db[_0xa86d('0x26')]['findAll'](_0x12172c);})[_0xa86d('0x1f')](function(_0x3e26a7){_0x59635b[_0xa86d('0x3b')]=_0x3e26a7;return _0x59635b;})[_0xa86d('0x1f')](respondWithFilteredResult(_0x540184,_0x12172c))['catch'](handleError(_0x540184,null));};exports[_0xa86d('0x3c')]=function(_0x20c687,_0xb63f1b){var _0x504f62={'raw':![],'where':{'id':_0x20c687[_0xa86d('0x3d')]['id']}},_0x333993={};_0x333993['model']=_[_0xa86d('0x3e')](db[_0xa86d('0x26')]['rawAttributes']);_0x333993[_0xa86d('0x2b')]=_[_0xa86d('0x3e')](_0x20c687[_0xa86d('0x2b')]);_0x333993[_0xa86d('0x2c')]=_[_0xa86d('0x2d')](_0x333993[_0xa86d('0x2a')],_0x333993[_0xa86d('0x2b')]);_0x504f62['attributes']=_['intersection'](_0x333993[_0xa86d('0x2a')],qs['fields'](_0x20c687['query']['fields']));_0x504f62[_0xa86d('0x2e')]=_0x504f62['attributes'][_0xa86d('0x30')]?_0x504f62[_0xa86d('0x2e')]:_0x333993['model'];if(_0x20c687[_0xa86d('0x2b')]['includeAll']){_0x504f62[_0xa86d('0x3a')]=[{'all':!![]}];}_0x504f62=_['merge']({},_0x504f62,_0x20c687[_0xa86d('0x38')]);return db[_0xa86d('0x26')][_0xa86d('0x3f')](_0x504f62)[_0xa86d('0x1f')](handleEntityNotFound(_0xb63f1b,null))[_0xa86d('0x1f')](respondWithResult(_0xb63f1b,null))['catch'](handleError(_0xb63f1b,null));};exports[_0xa86d('0x40')]=function(_0x43193b,_0x2da546){return db[_0xa86d('0x26')][_0xa86d('0x40')](_0x43193b[_0xa86d('0x41')],{})[_0xa86d('0x1f')](respondWithResult(_0x2da546,0xc9))[_0xa86d('0x42')](handleError(_0x2da546,null));};exports[_0xa86d('0x43')]=function(_0x576bb4,_0x45d71a){if(_0x576bb4[_0xa86d('0x41')]['id']){delete _0x576bb4[_0xa86d('0x41')]['id'];}return db[_0xa86d('0x26')][_0xa86d('0x3f')]({'where':{'id':_0x576bb4[_0xa86d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x45d71a,null))['then'](saveUpdates(_0x576bb4[_0xa86d('0x41')],null))[_0xa86d('0x1f')](respondWithResult(_0x45d71a,null))[_0xa86d('0x42')](handleError(_0x45d71a,null));};exports['destroy']=function(_0x13ee58,_0x1e3805){return db[_0xa86d('0x26')][_0xa86d('0x3f')]({'where':{'id':_0x13ee58[_0xa86d('0x3d')]['id']}})[_0xa86d('0x1f')](handleEntityNotFound(_0x1e3805,null))['then'](removeEntity(_0x1e3805,null))[_0xa86d('0x42')](handleError(_0x1e3805,null));};exports[_0xa86d('0x44')]=function(_0x580bc9,_0x5ec12c,_0x45b178){return db['Condition']['find']({'where':{'id':_0x580bc9[_0xa86d('0x3d')]['id']}})[_0xa86d('0x1f')](handleEntityNotFound(_0x5ec12c,null))['then'](function(_0x19f231){if(_0x19f231){return _0x19f231[_0xa86d('0x44')](_0x580bc9['body']['ids'],_[_0xa86d('0x45')](_0x580bc9[_0xa86d('0x41')],[_0xa86d('0x46'),'id'])||{});}})['then'](respondWithResult(_0x5ec12c,null))[_0xa86d('0x42')](handleError(_0x5ec12c,null));};exports[_0xa86d('0x47')]=function(_0xadc9e1,_0x1db955,_0xa8c206){var _0x1fa48d={};var _0x4becd2={};var _0x12ce16;var _0x250854;return db['Automation']['findOne']({'where':{'id':_0xadc9e1[_0xa86d('0x3d')]['id']}})[_0xa86d('0x1f')](handleEntityNotFound(_0x1db955,null))[_0xa86d('0x1f')](function(_0x29cb26){if(_0x29cb26){_0x12ce16=_0x29cb26;_0x4becd2[_0xa86d('0x2a')]=_[_0xa86d('0x3e')](db[_0xa86d('0x48')]['rawAttributes']);_0x4becd2['query']=_[_0xa86d('0x3e')](_0xadc9e1[_0xa86d('0x2b')]);_0x4becd2['filters']=_['intersection'](_0x4becd2[_0xa86d('0x2a')],_0x4becd2['query']);_0x1fa48d[_0xa86d('0x2e')]=_['intersection'](_0x4becd2['model'],qs[_0xa86d('0x2f')](_0xadc9e1[_0xa86d('0x2b')][_0xa86d('0x2f')]));_0x1fa48d[_0xa86d('0x2e')]=_0x1fa48d[_0xa86d('0x2e')][_0xa86d('0x30')]?_0x1fa48d['attributes']:_0x4becd2[_0xa86d('0x2a')];_0x1fa48d[_0xa86d('0x49')]=qs['sort'](_0xadc9e1['query']['sort']);_0x1fa48d[_0xa86d('0x34')]=qs[_0xa86d('0x2c')](_[_0xa86d('0x4a')](_0xadc9e1[_0xa86d('0x2b')],_0x4becd2['filters']));if(_0xadc9e1[_0xa86d('0x2b')][_0xa86d('0x35')]){_0x1fa48d['where']=_[_0xa86d('0x37')](_0x1fa48d[_0xa86d('0x34')],{'$or':_[_0xa86d('0x25')](_0x1fa48d[_0xa86d('0x2e')],function(_0x39a7c7){var _0x39394f={};_0x39394f[_0x39a7c7]={'$like':'%'+_0xadc9e1[_0xa86d('0x2b')][_0xa86d('0x35')]+'%'};return _0x39394f;})});}_0x1fa48d=_['merge']({},_0x1fa48d,_0xadc9e1['options']);return _0x12ce16[_0xa86d('0x47')](_0x1fa48d);}})[_0xa86d('0x1f')](function(_0x4dda51){if(_0x4dda51){_0x250854=_0x4dda51[_0xa86d('0x30')];if(!_0xadc9e1[_0xa86d('0x2b')][_0xa86d('0x4b')](_0xa86d('0x31'))){_0x1fa48d[_0xa86d('0x19')]=qs[_0xa86d('0x19')](_0xadc9e1[_0xa86d('0x2b')]['limit']);_0x1fa48d['offset']=qs[_0xa86d('0x32')](_0xadc9e1[_0xa86d('0x2b')]['offset']);}return _0x12ce16[_0xa86d('0x47')](_0x1fa48d);}})['then'](function(_0x583341){if(_0x583341){return _0x583341?{'count':_0x250854,'rows':_0x583341}:null;}})[_0xa86d('0x1f')](respondWithResult(_0x1db955,null))[_0xa86d('0x42')](handleError(_0x1db955,null));};exports[_0xa86d('0x4c')]=function(_0x532776,_0x5b4d6b,_0x2598c2){return db[_0xa86d('0x4d')]['find']({'where':{'id':_0x532776[_0xa86d('0x3d')]['id']}})[_0xa86d('0x1f')](handleEntityNotFound(_0x5b4d6b,null))[_0xa86d('0x1f')](function(_0x2980e7){if(_0x2980e7){return _0x2980e7['addActions'](_0x532776['body'][_0xa86d('0x46')],_[_0xa86d('0x45')](_0x532776[_0xa86d('0x41')],[_0xa86d('0x46'),'id'])||{});}})[_0xa86d('0x1f')](respondWithResult(_0x5b4d6b,null))['catch'](handleError(_0x5b4d6b,null));};exports['getActions']=function(_0x866ed4,_0x29a5c2,_0x341b9f){var _0x356e2={};var _0x450669={};var _0x1205b7;var _0x32e967;return db[_0xa86d('0x26')]['findOne']({'where':{'id':_0x866ed4['params']['id']}})[_0xa86d('0x1f')](handleEntityNotFound(_0x29a5c2,null))[_0xa86d('0x1f')](function(_0x3001d1){if(_0x3001d1){_0x1205b7=_0x3001d1;_0x450669[_0xa86d('0x2a')]=_['keys'](db['Action'][_0xa86d('0x27')]);_0x450669[_0xa86d('0x2b')]=_[_0xa86d('0x3e')](_0x866ed4[_0xa86d('0x2b')]);_0x450669[_0xa86d('0x2c')]=_[_0xa86d('0x2d')](_0x450669['model'],_0x450669[_0xa86d('0x2b')]);_0x356e2['attributes']=_[_0xa86d('0x2d')](_0x450669[_0xa86d('0x2a')],qs['fields'](_0x866ed4[_0xa86d('0x2b')][_0xa86d('0x2f')]));_0x356e2[_0xa86d('0x2e')]=_0x356e2[_0xa86d('0x2e')][_0xa86d('0x30')]?_0x356e2[_0xa86d('0x2e')]:_0x450669[_0xa86d('0x2a')];_0x356e2[_0xa86d('0x49')]=qs[_0xa86d('0x33')](_0x866ed4['query'][_0xa86d('0x33')]);_0x356e2[_0xa86d('0x34')]=qs[_0xa86d('0x2c')](_['pick'](_0x866ed4['query'],_0x450669[_0xa86d('0x2c')]));if(_0x866ed4['query']['filter']){_0x356e2[_0xa86d('0x34')]=_['merge'](_0x356e2['where'],{'$or':_[_0xa86d('0x25')](_0x356e2[_0xa86d('0x2e')],function(_0x4d80e3){var _0x46b89d={};_0x46b89d[_0x4d80e3]={'$like':'%'+_0x866ed4[_0xa86d('0x2b')][_0xa86d('0x35')]+'%'};return _0x46b89d;})});}_0x356e2=_['merge']({},_0x356e2,_0x866ed4[_0xa86d('0x38')]);return _0x1205b7['getActions'](_0x356e2);}})[_0xa86d('0x1f')](function(_0x3866b7){if(_0x3866b7){_0x32e967=_0x3866b7[_0xa86d('0x30')];if(!_0x866ed4[_0xa86d('0x2b')][_0xa86d('0x4b')]('nolimit')){_0x356e2[_0xa86d('0x19')]=qs['limit'](_0x866ed4[_0xa86d('0x2b')][_0xa86d('0x19')]);_0x356e2[_0xa86d('0x32')]=qs[_0xa86d('0x32')](_0x866ed4[_0xa86d('0x2b')]['offset']);}return _0x1205b7[_0xa86d('0x4e')](_0x356e2);}})[_0xa86d('0x1f')](function(_0x61447c){if(_0x61447c){return _0x61447c?{'count':_0x32e967,'rows':_0x61447c}:null;}})['then'](respondWithResult(_0x29a5c2,null))[_0xa86d('0x42')](handleError(_0x29a5c2,null));};
\ No newline at end of file