Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / trigger / trigger.controller.js
index e95c5b5..0e0cada 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56cd=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','Trigger','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','json','apply','save','update','then','destroy','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x50d058,_0xdf595b){var _0x143e07=function(_0x56ba8e){while(--_0x56ba8e){_0x50d058['push'](_0x50d058['shift']());}};_0x143e07(++_0xdf595b);}(_0x56cd,0x135));var _0xd56c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x56cd[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require(_0xd56c('0x0'));var emlformat=require(_0xd56c('0x1'));var rimraf=require(_0xd56c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd56c('0x3'));var rp=require(_0xd56c('0x4'));var moment=require(_0xd56c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd56c('0x6'));var util=require(_0xd56c('0x7'));var path=require(_0xd56c('0x8'));var sox=require(_0xd56c('0x9'));var csv=require(_0xd56c('0xa'));var ejs=require(_0xd56c('0xb'));var fs=require('fs');var _=require(_0xd56c('0xc'));var squel=require(_0xd56c('0xd'));var crypto=require(_0xd56c('0xe'));var jsforce=require(_0xd56c('0xf'));var deskjs=require(_0xd56c('0x10'));var toCsv=require(_0xd56c('0xa'));var querystring=require(_0xd56c('0x11'));var Papa=require(_0xd56c('0x12'));var Redis=require(_0xd56c('0x13'));var authService=require(_0xd56c('0x14'));var qs=require(_0xd56c('0x15'));var as=require(_0xd56c('0x16'));var hardwareService=require(_0xd56c('0x17'));var logger=require('../../config/logger')(_0xd56c('0x18'));var utils=require('../../config/utils');var config=require(_0xd56c('0x19'));var db=require(_0xd56c('0x1a'))['db'];function respondWithStatusCode(_0x859172,_0x507316){_0x507316=_0x507316||0xcc;return function(_0x5b271c){if(_0x5b271c){return _0x859172[_0xd56c('0x1b')](_0x507316);}return _0x859172['status'](_0x507316)[_0xd56c('0x1c')]();};}function respondWithResult(_0x3bbd77,_0x31d93c){_0x31d93c=_0x31d93c||0xc8;return function(_0x59623d){if(_0x59623d){return _0x3bbd77[_0xd56c('0x1d')](_0x31d93c)['json'](_0x59623d);}};}function respondWithFilteredResult(_0x504bc1,_0x30ad31){return function(_0x5c8ce0){if(_0x5c8ce0){var _0x21ada7=_0x5c8ce0['count'],_0x4bd51d=_0x30ad31[_0xd56c('0x1e')],_0x4f9182=_0x30ad31[_0xd56c('0x1e')]+_0x30ad31[_0xd56c('0x1f')],_0x2a22d3;if(_0x4f9182>=_0x21ada7){_0x4f9182=_0x21ada7;_0x2a22d3=0xc8;}else{_0x2a22d3=0xce;}_0x504bc1[_0xd56c('0x1d')](_0x2a22d3);return _0x504bc1['set']('Content-Range',_0x4bd51d+'-'+_0x4f9182+'/'+_0x21ada7)[_0xd56c('0x20')](_0x5c8ce0);}return null;};}function patchUpdates(_0x30c24a){return function(_0x5c8a5a){try{jsonpatch[_0xd56c('0x21')](_0x5c8a5a,_0x30c24a,!![]);}catch(_0x4d3956){return BPromise['reject'](_0x4d3956);}return _0x5c8a5a[_0xd56c('0x22')]();};}function saveUpdates(_0x507b26,_0x440460){return function(_0x1a1d5c){if(_0x1a1d5c){return _0x1a1d5c[_0xd56c('0x23')](_0x507b26)[_0xd56c('0x24')](function(_0xebb1d0){return _0xebb1d0;});}return null;};}function removeEntity(_0x2d75c8,_0x4f50eb){return function(_0x29c641){if(_0x29c641){return _0x29c641[_0xd56c('0x25')]()[_0xd56c('0x24')](function(){var _0x4d6118=_0x29c641['get']({'plain':!![]});var _0x30c54c='Triggers';return db[_0xd56c('0x26')][_0xd56c('0x25')]({'where':{'type':_0x30c54c,'resourceId':_0x4d6118['id']}})['then'](function(){return _0x29c641;});})[_0xd56c('0x24')](function(){_0x2d75c8['status'](0xcc)[_0xd56c('0x1c')]();});}};}function handleEntityNotFound(_0x1535dc,_0x97411d){return function(_0x2a5997){if(!_0x2a5997){_0x1535dc[_0xd56c('0x1b')](0x194);}return _0x2a5997;};}function handleError(_0x5057f5,_0x15aef8){_0x15aef8=_0x15aef8||0x1f4;return function(_0x24e29a){logger[_0xd56c('0x27')](_0x24e29a[_0xd56c('0x28')]);if(_0x24e29a[_0xd56c('0x29')]){delete _0x24e29a[_0xd56c('0x29')];}_0x5057f5[_0xd56c('0x1d')](_0x15aef8)['send'](_0x24e29a);};}exports['index']=function(_0x36a163,_0x3e4f59){var _0x20a809={},_0x2d12df={},_0x3b5e58={'count':0x0,'rows':[]};var _0x330783=_[_0xd56c('0x2a')](db['Trigger'][_0xd56c('0x2b')],function(_0x313f5c){return{'name':_0x313f5c[_0xd56c('0x2c')],'type':_0x313f5c[_0xd56c('0x2d')][_0xd56c('0x2e')]};});_0x2d12df['model']=_[_0xd56c('0x2a')](_0x330783,_0xd56c('0x29'));_0x2d12df[_0xd56c('0x2f')]=_[_0xd56c('0x30')](_0x36a163[_0xd56c('0x2f')]);_0x2d12df[_0xd56c('0x31')]=_[_0xd56c('0x32')](_0x2d12df[_0xd56c('0x33')],_0x2d12df[_0xd56c('0x2f')]);_0x20a809[_0xd56c('0x34')]=_[_0xd56c('0x32')](_0x2d12df[_0xd56c('0x33')],qs['fields'](_0x36a163[_0xd56c('0x2f')][_0xd56c('0x35')]));_0x20a809[_0xd56c('0x34')]=_0x20a809[_0xd56c('0x34')][_0xd56c('0x36')]?_0x20a809[_0xd56c('0x34')]:_0x2d12df['model'];if(!_0x36a163[_0xd56c('0x2f')][_0xd56c('0x37')](_0xd56c('0x38'))){_0x20a809[_0xd56c('0x1f')]=qs[_0xd56c('0x1f')](_0x36a163[_0xd56c('0x2f')][_0xd56c('0x1f')]);_0x20a809[_0xd56c('0x1e')]=qs[_0xd56c('0x1e')](_0x36a163['query']['offset']);}_0x20a809[_0xd56c('0x39')]=qs[_0xd56c('0x3a')](_0x36a163[_0xd56c('0x2f')][_0xd56c('0x3a')]);_0x20a809[_0xd56c('0x3b')]=qs[_0xd56c('0x31')](_[_0xd56c('0x3c')](_0x36a163[_0xd56c('0x2f')],_0x2d12df[_0xd56c('0x31')]),_0x330783);if(_0x36a163[_0xd56c('0x2f')][_0xd56c('0x3d')]){_0x20a809[_0xd56c('0x3b')]=_[_0xd56c('0x3e')](_0x20a809[_0xd56c('0x3b')],{'$or':_['map'](_0x330783,function(_0x2676a9){if(_0x2676a9[_0xd56c('0x2d')]!==_0xd56c('0x3f')){var _0x33ef23={};_0x33ef23[_0x2676a9['name']]={'$like':'%'+_0x36a163['query']['filter']+'%'};return _0x33ef23;}})});}_0x20a809=_['merge']({},_0x20a809,_0x36a163[_0xd56c('0x40')]);var _0x30997f={'where':_0x20a809[_0xd56c('0x3b')]};return db['Trigger']['count'](_0x30997f)[_0xd56c('0x24')](function(_0x3987b4){_0x3b5e58[_0xd56c('0x41')]=_0x3987b4;if(_0x36a163[_0xd56c('0x2f')][_0xd56c('0x42')]){_0x20a809['include']=[{'all':!![]}];}return db[_0xd56c('0x43')][_0xd56c('0x44')](_0x20a809);})[_0xd56c('0x24')](function(_0x367fb2){_0x3b5e58[_0xd56c('0x45')]=_0x367fb2;return _0x3b5e58;})[_0xd56c('0x24')](respondWithFilteredResult(_0x3e4f59,_0x20a809))[_0xd56c('0x46')](handleError(_0x3e4f59,null));};exports[_0xd56c('0x47')]=function(_0x10637d,_0x3ea444){var _0x4d5f8e={'raw':![],'where':{'id':_0x10637d['params']['id']}},_0x12a6c8={};_0x12a6c8[_0xd56c('0x33')]=_['keys'](db[_0xd56c('0x43')]['rawAttributes']);_0x12a6c8[_0xd56c('0x2f')]=_[_0xd56c('0x30')](_0x10637d[_0xd56c('0x2f')]);_0x12a6c8[_0xd56c('0x31')]=_['intersection'](_0x12a6c8['model'],_0x12a6c8['query']);_0x4d5f8e[_0xd56c('0x34')]=_[_0xd56c('0x32')](_0x12a6c8[_0xd56c('0x33')],qs['fields'](_0x10637d[_0xd56c('0x2f')][_0xd56c('0x35')]));_0x4d5f8e[_0xd56c('0x34')]=_0x4d5f8e[_0xd56c('0x34')][_0xd56c('0x36')]?_0x4d5f8e[_0xd56c('0x34')]:_0x12a6c8[_0xd56c('0x33')];if(_0x10637d[_0xd56c('0x2f')][_0xd56c('0x42')]){_0x4d5f8e['include']=[{'all':!![]}];}_0x4d5f8e=_[_0xd56c('0x3e')]({},_0x4d5f8e,_0x10637d[_0xd56c('0x40')]);return db[_0xd56c('0x43')][_0xd56c('0x48')](_0x4d5f8e)['then'](handleEntityNotFound(_0x3ea444,null))[_0xd56c('0x24')](respondWithResult(_0x3ea444,null))[_0xd56c('0x46')](handleError(_0x3ea444,null));};exports[_0xd56c('0x49')]=function(_0x1316a4,_0x2195ae){return db[_0xd56c('0x43')][_0xd56c('0x49')](_0x1316a4[_0xd56c('0x4a')],{})[_0xd56c('0x24')](function(_0x151760){var _0x54116d=_0x1316a4['user']['get']({'plain':!![]});if(!_0x54116d)throw new Error(_0xd56c('0x4b'));if(_0x54116d['role']==='user'){var _0x5430cf=_0x151760[_0xd56c('0x4c')]({'plain':!![]});var _0x15e705='Triggers';return db['UserProfileSection'][_0xd56c('0x48')]({'where':{'name':_0x15e705,'userProfileId':_0x54116d[_0xd56c('0x4d')]},'raw':!![]})[_0xd56c('0x24')](function(_0x53ff76){if(_0x53ff76&&_0x53ff76[_0xd56c('0x4e')]===0x0){return db['UserProfileResource'][_0xd56c('0x49')]({'name':_0x5430cf[_0xd56c('0x29')],'resourceId':_0x5430cf['id'],'type':_0x53ff76['name'],'sectionId':_0x53ff76['id']},{})[_0xd56c('0x24')](function(){return _0x151760;});}else{return _0x151760;}})['catch'](function(_0x5001a2){logger[_0xd56c('0x27')](_0xd56c('0x4f'),_0x5001a2);throw _0x5001a2;});}return _0x151760;})[_0xd56c('0x24')](respondWithResult(_0x2195ae,0xc9))[_0xd56c('0x46')](handleError(_0x2195ae,null));};exports[_0xd56c('0x23')]=function(_0x20d6f7,_0x1edb38){if(_0x20d6f7[_0xd56c('0x4a')]['id']){delete _0x20d6f7[_0xd56c('0x4a')]['id'];}return db[_0xd56c('0x43')][_0xd56c('0x48')]({'where':{'id':_0x20d6f7[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0x1edb38,null))[_0xd56c('0x24')](saveUpdates(_0x20d6f7[_0xd56c('0x4a')],null))[_0xd56c('0x24')](respondWithResult(_0x1edb38,null))[_0xd56c('0x46')](handleError(_0x1edb38,null));};exports[_0xd56c('0x25')]=function(_0x19fe69,_0x461784){return db[_0xd56c('0x43')][_0xd56c('0x48')]({'where':{'id':_0x19fe69[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0x461784,null))['then'](removeEntity(_0x461784,null))[_0xd56c('0x46')](handleError(_0x461784,null));};exports[_0xd56c('0x51')]=function(_0x18e346,_0x4ca300,_0x1a0e2e){if(_0x18e346['body']['id']){delete _0x18e346[_0xd56c('0x4a')]['id'];}return db[_0xd56c('0x43')][_0xd56c('0x48')]({'where':{'id':_0x18e346[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0x4ca300,null))['then'](function(_0x518078){if(_0x518078){_0x18e346[_0xd56c('0x4a')][_0xd56c('0x52')]=_0x518078['id'];return db[_0xd56c('0x53')][_0xd56c('0x49')](_0x18e346['body']);}})[_0xd56c('0x24')](respondWithResult(_0x4ca300,null))[_0xd56c('0x46')](handleError(_0x4ca300,null));};exports[_0xd56c('0x54')]=function(_0x562af1,_0xfd64a2,_0x59d0a3){if(_0x562af1[_0xd56c('0x4a')]['id']){delete _0x562af1['body']['id'];}return db[_0xd56c('0x43')][_0xd56c('0x48')]({'where':{'id':_0x562af1['params']['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0xfd64a2,null))[_0xd56c('0x24')](function(_0x97cf01){if(_0x97cf01){_0x562af1[_0xd56c('0x4a')]['TriggerAnyId']=_0x97cf01['id'];return db[_0xd56c('0x53')][_0xd56c('0x49')](_0x562af1['body']);}})[_0xd56c('0x24')](respondWithResult(_0xfd64a2,null))[_0xd56c('0x46')](handleError(_0xfd64a2,null));};exports[_0xd56c('0x55')]=function(_0x25a230,_0x26192f,_0x2c4c5c){var _0x5b34bc={};var _0x154be9={};var _0x2ef2f2;var _0x35b604;return db[_0xd56c('0x43')][_0xd56c('0x56')]({'where':{'id':_0x25a230['params']['id']}})['then'](handleEntityNotFound(_0x26192f,null))[_0xd56c('0x24')](function(_0x3fc896){if(_0x3fc896){_0x2ef2f2=_0x3fc896;_0x154be9[_0xd56c('0x33')]=_[_0xd56c('0x30')](db[_0xd56c('0x53')]['rawAttributes']);_0x154be9[_0xd56c('0x2f')]=_[_0xd56c('0x30')](_0x25a230[_0xd56c('0x2f')]);_0x154be9[_0xd56c('0x31')]=_[_0xd56c('0x32')](_0x154be9[_0xd56c('0x33')],_0x154be9[_0xd56c('0x2f')]);_0x5b34bc[_0xd56c('0x34')]=_[_0xd56c('0x32')](_0x154be9[_0xd56c('0x33')],qs['fields'](_0x25a230[_0xd56c('0x2f')][_0xd56c('0x35')]));_0x5b34bc[_0xd56c('0x34')]=_0x5b34bc[_0xd56c('0x34')][_0xd56c('0x36')]?_0x5b34bc[_0xd56c('0x34')]:_0x154be9[_0xd56c('0x33')];_0x5b34bc[_0xd56c('0x39')]=qs[_0xd56c('0x3a')](_0x25a230[_0xd56c('0x2f')][_0xd56c('0x3a')]);_0x5b34bc[_0xd56c('0x3b')]=qs['filters'](_[_0xd56c('0x3c')](_0x25a230[_0xd56c('0x2f')],_0x154be9[_0xd56c('0x31')]));if(_0x25a230['query'][_0xd56c('0x3d')]){_0x5b34bc['where']=_[_0xd56c('0x3e')](_0x5b34bc[_0xd56c('0x3b')],{'$or':_[_0xd56c('0x2a')](_0x5b34bc[_0xd56c('0x34')],function(_0x5af06a){var _0x220fd8={};_0x220fd8[_0x5af06a]={'$like':'%'+_0x25a230[_0xd56c('0x2f')][_0xd56c('0x3d')]+'%'};return _0x220fd8;})});}_0x5b34bc=_[_0xd56c('0x3e')]({},_0x5b34bc,_0x25a230[_0xd56c('0x40')]);return _0x2ef2f2[_0xd56c('0x55')](_0x5b34bc);}})[_0xd56c('0x24')](function(_0x4e4169){if(_0x4e4169){_0x35b604=_0x4e4169['length'];if(!_0x25a230[_0xd56c('0x2f')][_0xd56c('0x37')]('nolimit')){_0x5b34bc[_0xd56c('0x1f')]=qs[_0xd56c('0x1f')](_0x25a230['query']['limit']);_0x5b34bc[_0xd56c('0x1e')]=qs[_0xd56c('0x1e')](_0x25a230[_0xd56c('0x2f')][_0xd56c('0x1e')]);}return _0x2ef2f2['getAllConditions'](_0x5b34bc);}})[_0xd56c('0x24')](function(_0x19a3a4){if(_0x19a3a4){return _0x19a3a4?{'count':_0x35b604,'rows':_0x19a3a4}:null;}})[_0xd56c('0x24')](respondWithResult(_0x26192f,null))['catch'](handleError(_0x26192f,null));};exports[_0xd56c('0x57')]=function(_0x287b05,_0x10727f,_0x16f01b){var _0x278ae3={};var _0x2513bd={};var _0x10c60f;var _0x45ebce;return db[_0xd56c('0x43')][_0xd56c('0x56')]({'where':{'id':_0x287b05[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0x10727f,null))['then'](function(_0x4e864c){if(_0x4e864c){_0x10c60f=_0x4e864c;_0x2513bd['model']=_['keys'](db[_0xd56c('0x53')]['rawAttributes']);_0x2513bd[_0xd56c('0x2f')]=_[_0xd56c('0x30')](_0x287b05[_0xd56c('0x2f')]);_0x2513bd[_0xd56c('0x31')]=_[_0xd56c('0x32')](_0x2513bd[_0xd56c('0x33')],_0x2513bd['query']);_0x278ae3['attributes']=_['intersection'](_0x2513bd[_0xd56c('0x33')],qs[_0xd56c('0x35')](_0x287b05[_0xd56c('0x2f')][_0xd56c('0x35')]));_0x278ae3['attributes']=_0x278ae3[_0xd56c('0x34')][_0xd56c('0x36')]?_0x278ae3[_0xd56c('0x34')]:_0x2513bd[_0xd56c('0x33')];_0x278ae3['order']=qs[_0xd56c('0x3a')](_0x287b05[_0xd56c('0x2f')][_0xd56c('0x3a')]);_0x278ae3['where']=qs[_0xd56c('0x31')](_[_0xd56c('0x3c')](_0x287b05[_0xd56c('0x2f')],_0x2513bd[_0xd56c('0x31')]));if(_0x287b05[_0xd56c('0x2f')][_0xd56c('0x3d')]){_0x278ae3[_0xd56c('0x3b')]=_['merge'](_0x278ae3['where'],{'$or':_[_0xd56c('0x2a')](_0x278ae3[_0xd56c('0x34')],function(_0x4ec7fa){var _0x35b84b={};_0x35b84b[_0x4ec7fa]={'$like':'%'+_0x287b05[_0xd56c('0x2f')]['filter']+'%'};return _0x35b84b;})});}_0x278ae3=_[_0xd56c('0x3e')]({},_0x278ae3,_0x287b05[_0xd56c('0x40')]);return _0x10c60f[_0xd56c('0x57')](_0x278ae3);}})[_0xd56c('0x24')](function(_0x174f24){if(_0x174f24){_0x45ebce=_0x174f24[_0xd56c('0x36')];if(!_0x287b05[_0xd56c('0x2f')]['hasOwnProperty'](_0xd56c('0x38'))){_0x278ae3[_0xd56c('0x1f')]=qs[_0xd56c('0x1f')](_0x287b05[_0xd56c('0x2f')]['limit']);_0x278ae3['offset']=qs[_0xd56c('0x1e')](_0x287b05[_0xd56c('0x2f')][_0xd56c('0x1e')]);}return _0x10c60f[_0xd56c('0x57')](_0x278ae3);}})[_0xd56c('0x24')](function(_0x5bf513){if(_0x5bf513){return _0x5bf513?{'count':_0x45ebce,'rows':_0x5bf513}:null;}})[_0xd56c('0x24')](respondWithResult(_0x10727f,null))[_0xd56c('0x46')](handleError(_0x10727f,null));};exports[_0xd56c('0x58')]=function(_0xdbfe50,_0xb8f93f,_0x5bc9c7){if(_0xdbfe50[_0xd56c('0x4a')]['id']){delete _0xdbfe50[_0xd56c('0x4a')]['id'];}return db[_0xd56c('0x43')][_0xd56c('0x48')]({'where':{'id':_0xdbfe50[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0xb8f93f,null))['then'](function(_0x4e7a3b){if(_0x4e7a3b){_0xdbfe50[_0xd56c('0x4a')]['TriggerId']=_0x4e7a3b['id'];return db[_0xd56c('0x59')]['create'](_0xdbfe50[_0xd56c('0x4a')]);}})[_0xd56c('0x24')](respondWithResult(_0xb8f93f,null))[_0xd56c('0x46')](handleError(_0xb8f93f,null));};exports['getActions']=function(_0x39f48d,_0x46ade1,_0x5a6fac){var _0x2705a1={};var _0x206286={};var _0x372642;var _0x37a0ad;return db['Trigger'][_0xd56c('0x56')]({'where':{'id':_0x39f48d[_0xd56c('0x50')]['id']}})[_0xd56c('0x24')](handleEntityNotFound(_0x46ade1,null))[_0xd56c('0x24')](function(_0x12dc1a){if(_0x12dc1a){_0x372642=_0x12dc1a;_0x206286[_0xd56c('0x33')]=_[_0xd56c('0x30')](db[_0xd56c('0x59')]['rawAttributes']);_0x206286[_0xd56c('0x2f')]=_[_0xd56c('0x30')](_0x39f48d[_0xd56c('0x2f')]);_0x206286[_0xd56c('0x31')]=_['intersection'](_0x206286['model'],_0x206286['query']);_0x2705a1[_0xd56c('0x34')]=_[_0xd56c('0x32')](_0x206286[_0xd56c('0x33')],qs[_0xd56c('0x35')](_0x39f48d[_0xd56c('0x2f')][_0xd56c('0x35')]));_0x2705a1['attributes']=_0x2705a1[_0xd56c('0x34')]['length']?_0x2705a1[_0xd56c('0x34')]:_0x206286[_0xd56c('0x33')];_0x2705a1['order']=qs['sort'](_0x39f48d['query'][_0xd56c('0x3a')]);_0x2705a1[_0xd56c('0x3b')]=qs[_0xd56c('0x31')](_[_0xd56c('0x3c')](_0x39f48d['query'],_0x206286['filters']));if(_0x39f48d[_0xd56c('0x2f')][_0xd56c('0x3d')]){_0x2705a1[_0xd56c('0x3b')]=_[_0xd56c('0x3e')](_0x2705a1['where'],{'$or':_[_0xd56c('0x2a')](_0x2705a1[_0xd56c('0x34')],function(_0xc36785){var _0xfbdb66={};_0xfbdb66[_0xc36785]={'$like':'%'+_0x39f48d[_0xd56c('0x2f')]['filter']+'%'};return _0xfbdb66;})});}_0x2705a1=_['merge']({},_0x2705a1,_0x39f48d[_0xd56c('0x40')]);return _0x372642[_0xd56c('0x5a')](_0x2705a1);}})['then'](function(_0xdeef91){if(_0xdeef91){_0x37a0ad=_0xdeef91['length'];if(!_0x39f48d['query'][_0xd56c('0x37')](_0xd56c('0x38'))){_0x2705a1[_0xd56c('0x1f')]=qs[_0xd56c('0x1f')](_0x39f48d[_0xd56c('0x2f')][_0xd56c('0x1f')]);_0x2705a1['offset']=qs[_0xd56c('0x1e')](_0x39f48d[_0xd56c('0x2f')][_0xd56c('0x1e')]);}return _0x372642[_0xd56c('0x5a')](_0x2705a1);}})['then'](function(_0x18b4f7){if(_0x18b4f7){return _0x18b4f7?{'count':_0x37a0ad,'rows':_0x18b4f7}:null;}})[_0xd56c('0x24')](respondWithResult(_0x46ade1,null))[_0xd56c('0x46')](handleError(_0x46ade1,null));};
\ No newline at end of file
+var _0xf485=['getActions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Triggers','UserProfileResource','error','stack','name','index','map','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','Trigger','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','Action'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0xf485,0x1e1));var _0x5f48=function(_0x35d940,_0x43bf93){_0x35d940=_0x35d940-0x0;var _0x7bf56c=_0xf485[_0x35d940];return _0x7bf56c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f48('0x0'));var zipdir=require(_0x5f48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f48('0x2'));var moment=require(_0x5f48('0x3'));var BPromise=require(_0x5f48('0x4'));var Mustache=require(_0x5f48('0x5'));var util=require(_0x5f48('0x6'));var path=require(_0x5f48('0x7'));var sox=require(_0x5f48('0x8'));var csv=require(_0x5f48('0x9'));var ejs=require(_0x5f48('0xa'));var fs=require('fs');var fs_extra=require(_0x5f48('0xb'));var _=require(_0x5f48('0xc'));var squel=require(_0x5f48('0xd'));var crypto=require('crypto');var jsforce=require(_0x5f48('0xe'));var deskjs=require(_0x5f48('0xf'));var toCsv=require(_0x5f48('0x9'));var querystring=require(_0x5f48('0x10'));var Papa=require('papaparse');var Redis=require(_0x5f48('0x11'));var authService=require(_0x5f48('0x12'));var qs=require(_0x5f48('0x13'));var as=require(_0x5f48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f48('0x15'))(_0x5f48('0x16'));var utils=require(_0x5f48('0x17'));var config=require(_0x5f48('0x18'));var licenseUtil=require(_0x5f48('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44c500,_0x3af296){_0x3af296=_0x3af296||0xcc;return function(_0x34ec95){if(_0x34ec95){return _0x44c500[_0x5f48('0x1a')](_0x3af296);}return _0x44c500['status'](_0x3af296)[_0x5f48('0x1b')]();};}function respondWithResult(_0x480def,_0x14e58a){_0x14e58a=_0x14e58a||0xc8;return function(_0x1cd991){if(_0x1cd991){return _0x480def[_0x5f48('0x1c')](_0x14e58a)[_0x5f48('0x1d')](_0x1cd991);}};}function respondWithFilteredResult(_0x5d39da,_0x208bf3){return function(_0x5b20a1){if(_0x5b20a1){var _0x4cf1b7=typeof _0x208bf3[_0x5f48('0x1e')]===_0x5f48('0x1f')&&typeof _0x208bf3[_0x5f48('0x20')]==='undefined';var _0x3314f1=_0x5b20a1[_0x5f48('0x21')];var _0xe5fde8=_0x4cf1b7?0x0:_0x208bf3['offset'];var _0x9b42b3=_0x4cf1b7?_0x5b20a1[_0x5f48('0x21')]:_0x208bf3[_0x5f48('0x1e')]+_0x208bf3[_0x5f48('0x20')];var _0x2b39d5;if(_0x9b42b3>=_0x3314f1){_0x9b42b3=_0x3314f1;_0x2b39d5=0xc8;}else{_0x2b39d5=0xce;}_0x5d39da[_0x5f48('0x1c')](_0x2b39d5);return _0x5d39da[_0x5f48('0x22')](_0x5f48('0x23'),_0xe5fde8+'-'+_0x9b42b3+'/'+_0x3314f1)[_0x5f48('0x1d')](_0x5b20a1);}return null;};}function patchUpdates(_0x6a71dd){return function(_0x3bcac8){try{jsonpatch[_0x5f48('0x24')](_0x3bcac8,_0x6a71dd,!![]);}catch(_0x371a5b){return BPromise[_0x5f48('0x25')](_0x371a5b);}return _0x3bcac8[_0x5f48('0x26')]();};}function saveUpdates(_0x2134cf,_0x4d9aee){return function(_0x475125){if(_0x475125){return _0x475125['update'](_0x2134cf)[_0x5f48('0x27')](function(_0x1e5c7b){return _0x1e5c7b;});}return null;};}function removeEntity(_0x4acdb2,_0x3a59ac){return function(_0xe8e1e5){if(_0xe8e1e5){return _0xe8e1e5[_0x5f48('0x28')]()[_0x5f48('0x27')](function(){var _0x2e053a=_0xe8e1e5['get']({'plain':!![]});var _0x1c77be=_0x5f48('0x29');return db[_0x5f48('0x2a')][_0x5f48('0x28')]({'where':{'type':_0x1c77be,'resourceId':_0x2e053a['id']}})[_0x5f48('0x27')](function(){return _0xe8e1e5;});})[_0x5f48('0x27')](function(){_0x4acdb2[_0x5f48('0x1c')](0xcc)[_0x5f48('0x1b')]();});}};}function handleEntityNotFound(_0xa683c4,_0x1d08b3){return function(_0xe816bb){if(!_0xe816bb){_0xa683c4[_0x5f48('0x1a')](0x194);}return _0xe816bb;};}function handleError(_0x1ae6ac,_0x3c8586){_0x3c8586=_0x3c8586||0x1f4;return function(_0x1efc0d){logger[_0x5f48('0x2b')](_0x1efc0d[_0x5f48('0x2c')]);if(_0x1efc0d[_0x5f48('0x2d')]){delete _0x1efc0d[_0x5f48('0x2d')];}_0x1ae6ac[_0x5f48('0x1c')](_0x3c8586)['send'](_0x1efc0d);};}exports[_0x5f48('0x2e')]=function(_0xe0b060,_0x57dedd){var _0x4ada7a={},_0x205e6b={},_0x5caa34={'count':0x0,'rows':[]};var _0x54d553=_[_0x5f48('0x2f')](db['Trigger']['rawAttributes'],function(_0x32373c){return{'name':_0x32373c[_0x5f48('0x30')],'type':_0x32373c['type']['key']};});_0x205e6b['model']=_[_0x5f48('0x2f')](_0x54d553,_0x5f48('0x2d'));_0x205e6b[_0x5f48('0x31')]=_[_0x5f48('0x32')](_0xe0b060[_0x5f48('0x31')]);_0x205e6b['filters']=_[_0x5f48('0x33')](_0x205e6b[_0x5f48('0x34')],_0x205e6b[_0x5f48('0x31')]);_0x4ada7a[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x205e6b['model'],qs[_0x5f48('0x36')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x36')]));_0x4ada7a[_0x5f48('0x35')]=_0x4ada7a['attributes'][_0x5f48('0x37')]?_0x4ada7a[_0x5f48('0x35')]:_0x205e6b['model'];if(!_0xe0b060[_0x5f48('0x31')][_0x5f48('0x38')](_0x5f48('0x39'))){_0x4ada7a['limit']=qs[_0x5f48('0x20')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x20')]);_0x4ada7a['offset']=qs['offset'](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x1e')]);}_0x4ada7a[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x3b')]);_0x4ada7a[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0xe0b060[_0x5f48('0x31')],_0x205e6b['filters']),_0x54d553);if(_0xe0b060[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x4ada7a[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x4ada7a[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x54d553,function(_0x310bca){if(_0x310bca[_0x5f48('0x41')]!=='VIRTUAL'){var _0x28c486={};_0x28c486[_0x310bca['name']]={'$like':'%'+_0xe0b060[_0x5f48('0x31')]['filter']+'%'};return _0x28c486;}})});}_0x4ada7a=_['merge']({},_0x4ada7a,_0xe0b060['options']);var _0x53e53e={'where':_0x4ada7a[_0x5f48('0x3c')]};return db[_0x5f48('0x42')][_0x5f48('0x21')](_0x53e53e)[_0x5f48('0x27')](function(_0x11e112){_0x5caa34['count']=_0x11e112;if(_0xe0b060[_0x5f48('0x31')][_0x5f48('0x43')]){_0x4ada7a['include']=[{'all':!![]}];}return db[_0x5f48('0x42')][_0x5f48('0x44')](_0x4ada7a);})[_0x5f48('0x27')](function(_0x56c0fe){_0x5caa34[_0x5f48('0x45')]=_0x56c0fe;return _0x5caa34;})['then'](respondWithFilteredResult(_0x57dedd,_0x4ada7a))[_0x5f48('0x46')](handleError(_0x57dedd,null));};exports[_0x5f48('0x47')]=function(_0x45fdf2,_0x2c17e3){var _0x5260f1={'raw':![],'where':{'id':_0x45fdf2[_0x5f48('0x48')]['id']}},_0x49885e={};_0x49885e[_0x5f48('0x34')]=_[_0x5f48('0x32')](db[_0x5f48('0x42')][_0x5f48('0x49')]);_0x49885e[_0x5f48('0x31')]=_['keys'](_0x45fdf2[_0x5f48('0x31')]);_0x49885e[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x49885e['model'],_0x49885e[_0x5f48('0x31')]);_0x5260f1[_0x5f48('0x35')]=_['intersection'](_0x49885e[_0x5f48('0x34')],qs[_0x5f48('0x36')](_0x45fdf2[_0x5f48('0x31')][_0x5f48('0x36')]));_0x5260f1[_0x5f48('0x35')]=_0x5260f1[_0x5f48('0x35')]['length']?_0x5260f1[_0x5f48('0x35')]:_0x49885e['model'];if(_0x45fdf2[_0x5f48('0x31')][_0x5f48('0x43')]){_0x5260f1[_0x5f48('0x4a')]=[{'all':!![]}];}_0x5260f1=_[_0x5f48('0x40')]({},_0x5260f1,_0x45fdf2[_0x5f48('0x4b')]);return db['Trigger'][_0x5f48('0x4c')](_0x5260f1)['then'](handleEntityNotFound(_0x2c17e3,null))[_0x5f48('0x27')](respondWithResult(_0x2c17e3,null))[_0x5f48('0x46')](handleError(_0x2c17e3,null));};exports[_0x5f48('0x4d')]=function(_0x216060,_0x29ffe5){return db[_0x5f48('0x42')][_0x5f48('0x4d')](_0x216060['body'],{})[_0x5f48('0x27')](function(_0x2fdb3c){var _0x24c033=_0x216060['user']['get']({'plain':!![]});if(!_0x24c033)throw new Error(_0x5f48('0x4e'));if(_0x24c033[_0x5f48('0x4f')]===_0x5f48('0x50')){var _0x2f7ceb=_0x2fdb3c[_0x5f48('0x51')]({'plain':!![]});var _0x988ef4='Triggers';return db['UserProfileSection'][_0x5f48('0x4c')]({'where':{'name':_0x988ef4,'userProfileId':_0x24c033['userProfileId']},'raw':!![]})[_0x5f48('0x27')](function(_0x4f5a2f){if(_0x4f5a2f&&_0x4f5a2f[_0x5f48('0x52')]===0x0){return db[_0x5f48('0x2a')][_0x5f48('0x4d')]({'name':_0x2f7ceb[_0x5f48('0x2d')],'resourceId':_0x2f7ceb['id'],'type':_0x4f5a2f[_0x5f48('0x2d')],'sectionId':_0x4f5a2f['id']},{})[_0x5f48('0x27')](function(){return _0x2fdb3c;});}else{return _0x2fdb3c;}})[_0x5f48('0x46')](function(_0x14b5d3){logger[_0x5f48('0x2b')](_0x5f48('0x53'),_0x14b5d3);throw _0x14b5d3;});}return _0x2fdb3c;})['then'](respondWithResult(_0x29ffe5,0xc9))['catch'](handleError(_0x29ffe5,null));};exports[_0x5f48('0x54')]=function(_0x5f35e8,_0x93a662){if(_0x5f35e8[_0x5f48('0x55')]['id']){delete _0x5f35e8[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')]['find']({'where':{'id':_0x5f35e8[_0x5f48('0x48')]['id']}})['then'](handleEntityNotFound(_0x93a662,null))[_0x5f48('0x27')](saveUpdates(_0x5f35e8['body'],null))[_0x5f48('0x27')](respondWithResult(_0x93a662,null))[_0x5f48('0x46')](handleError(_0x93a662,null));};exports[_0x5f48('0x28')]=function(_0x44a085,_0x588041){return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x44a085[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x588041,null))['then'](removeEntity(_0x588041,null))[_0x5f48('0x46')](handleError(_0x588041,null));};exports['addAllCondition']=function(_0x5e3e,_0x2fd6ce,_0x3bf215){if(_0x5e3e['body']['id']){delete _0x5e3e[_0x5f48('0x55')]['id'];}return db['Trigger'][_0x5f48('0x4c')]({'where':{'id':_0x5e3e['params']['id']}})['then'](handleEntityNotFound(_0x2fd6ce,null))[_0x5f48('0x27')](function(_0x41a9b8){if(_0x41a9b8){_0x5e3e[_0x5f48('0x55')][_0x5f48('0x56')]=_0x41a9b8['id'];return db[_0x5f48('0x57')][_0x5f48('0x4d')](_0x5e3e['body']);}})[_0x5f48('0x27')](respondWithResult(_0x2fd6ce,null))[_0x5f48('0x46')](handleError(_0x2fd6ce,null));};exports[_0x5f48('0x58')]=function(_0x599b6b,_0x1f6a2c,_0x3445dc){if(_0x599b6b[_0x5f48('0x55')]['id']){delete _0x599b6b[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x599b6b[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x1f6a2c,null))['then'](function(_0x456a83){if(_0x456a83){_0x599b6b[_0x5f48('0x55')][_0x5f48('0x59')]=_0x456a83['id'];return db[_0x5f48('0x57')]['create'](_0x599b6b[_0x5f48('0x55')]);}})[_0x5f48('0x27')](respondWithResult(_0x1f6a2c,null))[_0x5f48('0x46')](handleError(_0x1f6a2c,null));};exports['getAllConditions']=function(_0x50b6dc,_0x34b28d,_0x440e7a){var _0x1db09e={};var _0x55955c={};var _0xb4e2f7;var _0x434230;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x50b6dc[_0x5f48('0x48')]['id']}})['then'](handleEntityNotFound(_0x34b28d,null))[_0x5f48('0x27')](function(_0xc5944){if(_0xc5944){_0xb4e2f7=_0xc5944;_0x55955c[_0x5f48('0x34')]=_[_0x5f48('0x32')](db['Condition']['rawAttributes']);_0x55955c['query']=_[_0x5f48('0x32')](_0x50b6dc['query']);_0x55955c[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x55955c[_0x5f48('0x34')],_0x55955c[_0x5f48('0x31')]);_0x1db09e[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x55955c[_0x5f48('0x34')],qs[_0x5f48('0x36')](_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x36')]));_0x1db09e[_0x5f48('0x35')]=_0x1db09e[_0x5f48('0x35')]['length']?_0x1db09e[_0x5f48('0x35')]:_0x55955c[_0x5f48('0x34')];_0x1db09e[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x50b6dc[_0x5f48('0x31')]['sort']);_0x1db09e[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x50b6dc[_0x5f48('0x31')],_0x55955c[_0x5f48('0x3d')]));if(_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x1db09e[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x1db09e[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x1db09e[_0x5f48('0x35')],function(_0x5f2c6d){var _0xd42dba={};_0xd42dba[_0x5f2c6d]={'$like':'%'+_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x3f')]+'%'};return _0xd42dba;})});}_0x1db09e=_[_0x5f48('0x40')]({},_0x1db09e,_0x50b6dc[_0x5f48('0x4b')]);return _0xb4e2f7[_0x5f48('0x5b')](_0x1db09e);}})[_0x5f48('0x27')](function(_0x265578){if(_0x265578){_0x434230=_0x265578[_0x5f48('0x37')];if(!_0x50b6dc[_0x5f48('0x31')]['hasOwnProperty'](_0x5f48('0x39'))){_0x1db09e['limit']=qs[_0x5f48('0x20')](_0x50b6dc[_0x5f48('0x31')]['limit']);_0x1db09e[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0xb4e2f7[_0x5f48('0x5b')](_0x1db09e);}})[_0x5f48('0x27')](function(_0x3aa5e3){if(_0x3aa5e3){return _0x3aa5e3?{'count':_0x434230,'rows':_0x3aa5e3}:null;}})[_0x5f48('0x27')](respondWithResult(_0x34b28d,null))['catch'](handleError(_0x34b28d,null));};exports[_0x5f48('0x5c')]=function(_0x26d068,_0x3ece7a,_0x2cb814){var _0x3ddd8e={};var _0x40681b={};var _0x4536e6;var _0x512c0a;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x26d068['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x3ece7a,null))[_0x5f48('0x27')](function(_0x2e2b9f){if(_0x2e2b9f){_0x4536e6=_0x2e2b9f;_0x40681b[_0x5f48('0x34')]=_[_0x5f48('0x32')](db[_0x5f48('0x57')][_0x5f48('0x49')]);_0x40681b[_0x5f48('0x31')]=_['keys'](_0x26d068[_0x5f48('0x31')]);_0x40681b[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x40681b[_0x5f48('0x34')],_0x40681b[_0x5f48('0x31')]);_0x3ddd8e[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x40681b['model'],qs[_0x5f48('0x36')](_0x26d068[_0x5f48('0x31')][_0x5f48('0x36')]));_0x3ddd8e[_0x5f48('0x35')]=_0x3ddd8e['attributes'][_0x5f48('0x37')]?_0x3ddd8e[_0x5f48('0x35')]:_0x40681b['model'];_0x3ddd8e[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x26d068['query']['sort']);_0x3ddd8e[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x26d068[_0x5f48('0x31')],_0x40681b['filters']));if(_0x26d068[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x3ddd8e[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x3ddd8e[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x3ddd8e['attributes'],function(_0x3fd369){var _0x4cecf2={};_0x4cecf2[_0x3fd369]={'$like':'%'+_0x26d068['query']['filter']+'%'};return _0x4cecf2;})});}_0x3ddd8e=_[_0x5f48('0x40')]({},_0x3ddd8e,_0x26d068[_0x5f48('0x4b')]);return _0x4536e6[_0x5f48('0x5c')](_0x3ddd8e);}})[_0x5f48('0x27')](function(_0x504e1d){if(_0x504e1d){_0x512c0a=_0x504e1d[_0x5f48('0x37')];if(!_0x26d068['query'][_0x5f48('0x38')](_0x5f48('0x39'))){_0x3ddd8e[_0x5f48('0x20')]=qs[_0x5f48('0x20')](_0x26d068['query']['limit']);_0x3ddd8e[_0x5f48('0x1e')]=qs['offset'](_0x26d068[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0x4536e6['getAnyConditions'](_0x3ddd8e);}})[_0x5f48('0x27')](function(_0x5578c6){if(_0x5578c6){return _0x5578c6?{'count':_0x512c0a,'rows':_0x5578c6}:null;}})[_0x5f48('0x27')](respondWithResult(_0x3ece7a,null))[_0x5f48('0x46')](handleError(_0x3ece7a,null));};exports['addAction']=function(_0x5bf785,_0x27b615,_0x2f0f21){if(_0x5bf785[_0x5f48('0x55')]['id']){delete _0x5bf785[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x5bf785[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x27b615,null))[_0x5f48('0x27')](function(_0xec4fad){if(_0xec4fad){_0x5bf785[_0x5f48('0x55')][_0x5f48('0x5d')]=_0xec4fad['id'];return db[_0x5f48('0x5e')][_0x5f48('0x4d')](_0x5bf785[_0x5f48('0x55')]);}})[_0x5f48('0x27')](respondWithResult(_0x27b615,null))[_0x5f48('0x46')](handleError(_0x27b615,null));};exports[_0x5f48('0x5f')]=function(_0x2dcfdd,_0x2afa6b,_0x3e0a76){var _0x43ce9c={};var _0x24368e={};var _0x57d721;var _0x24dda6;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x2dcfdd[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x2afa6b,null))[_0x5f48('0x27')](function(_0x1c9a95){if(_0x1c9a95){_0x57d721=_0x1c9a95;_0x24368e[_0x5f48('0x34')]=_['keys'](db['Action'][_0x5f48('0x49')]);_0x24368e[_0x5f48('0x31')]=_[_0x5f48('0x32')](_0x2dcfdd[_0x5f48('0x31')]);_0x24368e['filters']=_[_0x5f48('0x33')](_0x24368e['model'],_0x24368e[_0x5f48('0x31')]);_0x43ce9c['attributes']=_[_0x5f48('0x33')](_0x24368e['model'],qs['fields'](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x36')]));_0x43ce9c[_0x5f48('0x35')]=_0x43ce9c['attributes'][_0x5f48('0x37')]?_0x43ce9c[_0x5f48('0x35')]:_0x24368e[_0x5f48('0x34')];_0x43ce9c['order']=qs[_0x5f48('0x3b')](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x3b')]);_0x43ce9c[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x2dcfdd[_0x5f48('0x31')],_0x24368e['filters']));if(_0x2dcfdd['query']['filter']){_0x43ce9c[_0x5f48('0x3c')]=_['merge'](_0x43ce9c[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x43ce9c[_0x5f48('0x35')],function(_0x57b0a1){var _0x693f38={};_0x693f38[_0x57b0a1]={'$like':'%'+_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x3f')]+'%'};return _0x693f38;})});}_0x43ce9c=_['merge']({},_0x43ce9c,_0x2dcfdd['options']);return _0x57d721[_0x5f48('0x5f')](_0x43ce9c);}})[_0x5f48('0x27')](function(_0x33d3cd){if(_0x33d3cd){_0x24dda6=_0x33d3cd['length'];if(!_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x38')](_0x5f48('0x39'))){_0x43ce9c['limit']=qs['limit'](_0x2dcfdd[_0x5f48('0x31')]['limit']);_0x43ce9c[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0x57d721['getActions'](_0x43ce9c);}})[_0x5f48('0x27')](function(_0x37dfde){if(_0x37dfde){return _0x37dfde?{'count':_0x24dda6,'rows':_0x37dfde}:null;}})['then'](respondWithResult(_0x2afa6b,null))[_0x5f48('0x46')](handleError(_0x2afa6b,null));};
\ No newline at end of file