Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / trigger / trigger.controller.js
index 69f627c..0e0cada 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x428b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','index','Trigger','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','filter','getAnyConditions','findOne','addAction','TriggerId','Action','getActions'];(function(_0x40f369,_0x11e309){var _0xd22cea=function(_0x7e2d5b){while(--_0x7e2d5b){_0x40f369['push'](_0x40f369['shift']());}};_0xd22cea(++_0x11e309);}(_0x428b,0x18c));var _0xb428=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x428b[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xb428('0x0'));var rimraf=require(_0xb428('0x1'));var zipdir=require(_0xb428('0x2'));var jsonpatch=require(_0xb428('0x3'));var rp=require(_0xb428('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb428('0x5'));var util=require(_0xb428('0x6'));var path=require(_0xb428('0x7'));var sox=require(_0xb428('0x8'));var csv=require(_0xb428('0x9'));var ejs=require(_0xb428('0xa'));var fs=require('fs');var fs_extra=require(_0xb428('0xb'));var _=require(_0xb428('0xc'));var squel=require(_0xb428('0xd'));var crypto=require(_0xb428('0xe'));var jsforce=require(_0xb428('0xf'));var deskjs=require(_0xb428('0x10'));var toCsv=require(_0xb428('0x9'));var querystring=require('querystring');var Papa=require(_0xb428('0x11'));var Redis=require(_0xb428('0x12'));var authService=require(_0xb428('0x13'));var qs=require(_0xb428('0x14'));var as=require(_0xb428('0x15'));var hardwareService=require(_0xb428('0x16'));var logger=require('../../config/logger')(_0xb428('0x17'));var utils=require(_0xb428('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb428('0x19'))['db'];function respondWithStatusCode(_0x29cd10,_0xea6e1a){_0xea6e1a=_0xea6e1a||0xcc;return function(_0x330f3b){if(_0x330f3b){return _0x29cd10['sendStatus'](_0xea6e1a);}return _0x29cd10[_0xb428('0x1a')](_0xea6e1a)[_0xb428('0x1b')]();};}function respondWithResult(_0x2c4847,_0x54ffc8){_0x54ffc8=_0x54ffc8||0xc8;return function(_0x4b7d58){if(_0x4b7d58){return _0x2c4847['status'](_0x54ffc8)[_0xb428('0x1c')](_0x4b7d58);}};}function respondWithFilteredResult(_0x218178,_0x14be58){return function(_0x1a2055){if(_0x1a2055){var _0x13efb7=typeof _0x14be58[_0xb428('0x1d')]===_0xb428('0x1e')&&typeof _0x14be58[_0xb428('0x1f')]===_0xb428('0x1e');var _0x5e22ef=_0x1a2055['count'];var _0x1090be=_0x13efb7?0x0:_0x14be58['offset'];var _0x11ba06=_0x13efb7?_0x1a2055[_0xb428('0x20')]:_0x14be58[_0xb428('0x1d')]+_0x14be58[_0xb428('0x1f')];var _0x189d1f;if(_0x11ba06>=_0x5e22ef){_0x11ba06=_0x5e22ef;_0x189d1f=0xc8;}else{_0x189d1f=0xce;}_0x218178[_0xb428('0x1a')](_0x189d1f);return _0x218178[_0xb428('0x21')]('Content-Range',_0x1090be+'-'+_0x11ba06+'/'+_0x5e22ef)[_0xb428('0x1c')](_0x1a2055);}return null;};}function patchUpdates(_0x11277e){return function(_0x37d022){try{jsonpatch[_0xb428('0x22')](_0x37d022,_0x11277e,!![]);}catch(_0x4d38d4){return BPromise[_0xb428('0x23')](_0x4d38d4);}return _0x37d022[_0xb428('0x24')]();};}function saveUpdates(_0x497d64,_0x1b23ea){return function(_0x51a188){if(_0x51a188){return _0x51a188[_0xb428('0x25')](_0x497d64)[_0xb428('0x26')](function(_0x2be104){return _0x2be104;});}return null;};}function removeEntity(_0x14bc6c,_0x1c91b2){return function(_0x160f7c){if(_0x160f7c){return _0x160f7c['destroy']()[_0xb428('0x26')](function(){var _0x3aee52=_0x160f7c[_0xb428('0x27')]({'plain':!![]});var _0x47def1=_0xb428('0x28');return db[_0xb428('0x29')][_0xb428('0x2a')]({'where':{'type':_0x47def1,'resourceId':_0x3aee52['id']}})[_0xb428('0x26')](function(){return _0x160f7c;});})[_0xb428('0x26')](function(){_0x14bc6c['status'](0xcc)[_0xb428('0x1b')]();});}};}function handleEntityNotFound(_0x249643,_0x5b0e3e){return function(_0x235861){if(!_0x235861){_0x249643['sendStatus'](0x194);}return _0x235861;};}function handleError(_0x3557a3,_0xeeedc8){_0xeeedc8=_0xeeedc8||0x1f4;return function(_0x5cc46a){logger[_0xb428('0x2b')](_0x5cc46a[_0xb428('0x2c')]);if(_0x5cc46a['name']){delete _0x5cc46a[_0xb428('0x2d')];}_0x3557a3[_0xb428('0x1a')](_0xeeedc8)[_0xb428('0x2e')](_0x5cc46a);};}exports[_0xb428('0x2f')]=function(_0x27f3a3,_0x5d5eae){var _0x4ca886={},_0x3d3c15={},_0x1051ae={'count':0x0,'rows':[]};var _0x5e3d57=_['map'](db[_0xb428('0x30')][_0xb428('0x31')],function(_0x5ee387){return{'name':_0x5ee387[_0xb428('0x32')],'type':_0x5ee387['type'][_0xb428('0x33')]};});_0x3d3c15[_0xb428('0x34')]=_['map'](_0x5e3d57,_0xb428('0x2d'));_0x3d3c15[_0xb428('0x35')]=_[_0xb428('0x36')](_0x27f3a3[_0xb428('0x35')]);_0x3d3c15[_0xb428('0x37')]=_[_0xb428('0x38')](_0x3d3c15['model'],_0x3d3c15[_0xb428('0x35')]);_0x4ca886['attributes']=_[_0xb428('0x38')](_0x3d3c15[_0xb428('0x34')],qs[_0xb428('0x39')](_0x27f3a3['query']['fields']));_0x4ca886['attributes']=_0x4ca886[_0xb428('0x3a')][_0xb428('0x3b')]?_0x4ca886[_0xb428('0x3a')]:_0x3d3c15[_0xb428('0x34')];if(!_0x27f3a3[_0xb428('0x35')][_0xb428('0x3c')](_0xb428('0x3d'))){_0x4ca886['limit']=qs[_0xb428('0x1f')](_0x27f3a3[_0xb428('0x35')][_0xb428('0x1f')]);_0x4ca886['offset']=qs[_0xb428('0x1d')](_0x27f3a3[_0xb428('0x35')][_0xb428('0x1d')]);}_0x4ca886[_0xb428('0x3e')]=qs[_0xb428('0x3f')](_0x27f3a3[_0xb428('0x35')][_0xb428('0x3f')]);_0x4ca886[_0xb428('0x40')]=qs[_0xb428('0x37')](_[_0xb428('0x41')](_0x27f3a3[_0xb428('0x35')],_0x3d3c15[_0xb428('0x37')]),_0x5e3d57);if(_0x27f3a3[_0xb428('0x35')]['filter']){_0x4ca886['where']=_[_0xb428('0x42')](_0x4ca886['where'],{'$or':_[_0xb428('0x43')](_0x5e3d57,function(_0x471643){if(_0x471643[_0xb428('0x44')]!==_0xb428('0x45')){var _0x493051={};_0x493051[_0x471643[_0xb428('0x2d')]]={'$like':'%'+_0x27f3a3[_0xb428('0x35')]['filter']+'%'};return _0x493051;}})});}_0x4ca886=_[_0xb428('0x42')]({},_0x4ca886,_0x27f3a3[_0xb428('0x46')]);var _0x57d438={'where':_0x4ca886[_0xb428('0x40')]};return db['Trigger'][_0xb428('0x20')](_0x57d438)[_0xb428('0x26')](function(_0x22f851){_0x1051ae['count']=_0x22f851;if(_0x27f3a3[_0xb428('0x35')][_0xb428('0x47')]){_0x4ca886[_0xb428('0x48')]=[{'all':!![]}];}return db[_0xb428('0x30')][_0xb428('0x49')](_0x4ca886);})['then'](function(_0x458135){_0x1051ae[_0xb428('0x4a')]=_0x458135;return _0x1051ae;})[_0xb428('0x26')](respondWithFilteredResult(_0x5d5eae,_0x4ca886))[_0xb428('0x4b')](handleError(_0x5d5eae,null));};exports[_0xb428('0x4c')]=function(_0x45aefb,_0x2dc85e){var _0xec8101={'raw':![],'where':{'id':_0x45aefb[_0xb428('0x4d')]['id']}},_0x2cdeb7={};_0x2cdeb7[_0xb428('0x34')]=_[_0xb428('0x36')](db[_0xb428('0x30')][_0xb428('0x31')]);_0x2cdeb7[_0xb428('0x35')]=_[_0xb428('0x36')](_0x45aefb['query']);_0x2cdeb7[_0xb428('0x37')]=_[_0xb428('0x38')](_0x2cdeb7[_0xb428('0x34')],_0x2cdeb7[_0xb428('0x35')]);_0xec8101['attributes']=_['intersection'](_0x2cdeb7[_0xb428('0x34')],qs[_0xb428('0x39')](_0x45aefb[_0xb428('0x35')][_0xb428('0x39')]));_0xec8101[_0xb428('0x3a')]=_0xec8101[_0xb428('0x3a')][_0xb428('0x3b')]?_0xec8101[_0xb428('0x3a')]:_0x2cdeb7[_0xb428('0x34')];if(_0x45aefb[_0xb428('0x35')][_0xb428('0x47')]){_0xec8101['include']=[{'all':!![]}];}_0xec8101=_[_0xb428('0x42')]({},_0xec8101,_0x45aefb[_0xb428('0x46')]);return db['Trigger'][_0xb428('0x4e')](_0xec8101)['then'](handleEntityNotFound(_0x2dc85e,null))[_0xb428('0x26')](respondWithResult(_0x2dc85e,null))['catch'](handleError(_0x2dc85e,null));};exports[_0xb428('0x4f')]=function(_0x273a2b,_0x595cb0){return db[_0xb428('0x30')][_0xb428('0x4f')](_0x273a2b['body'],{})[_0xb428('0x26')](function(_0x18d512){var _0x1440fa=_0x273a2b[_0xb428('0x50')]['get']({'plain':!![]});if(!_0x1440fa)throw new Error(_0xb428('0x51'));if(_0x1440fa[_0xb428('0x52')]===_0xb428('0x50')){var _0xf2eabb=_0x18d512[_0xb428('0x27')]({'plain':!![]});var _0x3cbfea=_0xb428('0x28');return db['UserProfileSection'][_0xb428('0x4e')]({'where':{'name':_0x3cbfea,'userProfileId':_0x1440fa[_0xb428('0x53')]},'raw':!![]})['then'](function(_0x293b0a){if(_0x293b0a&&_0x293b0a[_0xb428('0x54')]===0x0){return db[_0xb428('0x29')][_0xb428('0x4f')]({'name':_0xf2eabb[_0xb428('0x2d')],'resourceId':_0xf2eabb['id'],'type':_0x293b0a['name'],'sectionId':_0x293b0a['id']},{})[_0xb428('0x26')](function(){return _0x18d512;});}else{return _0x18d512;}})[_0xb428('0x4b')](function(_0x21bca2){logger[_0xb428('0x2b')](_0xb428('0x55'),_0x21bca2);throw _0x21bca2;});}return _0x18d512;})[_0xb428('0x26')](respondWithResult(_0x595cb0,0xc9))[_0xb428('0x4b')](handleError(_0x595cb0,null));};exports[_0xb428('0x25')]=function(_0x59a6ed,_0x3b2dd5){if(_0x59a6ed[_0xb428('0x56')]['id']){delete _0x59a6ed['body']['id'];}return db[_0xb428('0x30')][_0xb428('0x4e')]({'where':{'id':_0x59a6ed[_0xb428('0x4d')]['id']}})[_0xb428('0x26')](handleEntityNotFound(_0x3b2dd5,null))[_0xb428('0x26')](saveUpdates(_0x59a6ed['body'],null))['then'](respondWithResult(_0x3b2dd5,null))[_0xb428('0x4b')](handleError(_0x3b2dd5,null));};exports['destroy']=function(_0x5653b1,_0x24485f){return db[_0xb428('0x30')]['find']({'where':{'id':_0x5653b1[_0xb428('0x4d')]['id']}})[_0xb428('0x26')](handleEntityNotFound(_0x24485f,null))[_0xb428('0x26')](removeEntity(_0x24485f,null))[_0xb428('0x4b')](handleError(_0x24485f,null));};exports[_0xb428('0x57')]=function(_0x4d090b,_0x2fc8cb,_0x547339){if(_0x4d090b[_0xb428('0x56')]['id']){delete _0x4d090b[_0xb428('0x56')]['id'];}return db[_0xb428('0x30')]['find']({'where':{'id':_0x4d090b['params']['id']}})['then'](handleEntityNotFound(_0x2fc8cb,null))[_0xb428('0x26')](function(_0x1224c9){if(_0x1224c9){_0x4d090b[_0xb428('0x56')][_0xb428('0x58')]=_0x1224c9['id'];return db[_0xb428('0x59')]['create'](_0x4d090b[_0xb428('0x56')]);}})[_0xb428('0x26')](respondWithResult(_0x2fc8cb,null))[_0xb428('0x4b')](handleError(_0x2fc8cb,null));};exports[_0xb428('0x5a')]=function(_0x4b1f00,_0x2fc9cc,_0x54c6f6){if(_0x4b1f00[_0xb428('0x56')]['id']){delete _0x4b1f00[_0xb428('0x56')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4b1f00[_0xb428('0x4d')]['id']}})[_0xb428('0x26')](handleEntityNotFound(_0x2fc9cc,null))['then'](function(_0x970bcb){if(_0x970bcb){_0x4b1f00[_0xb428('0x56')]['TriggerAnyId']=_0x970bcb['id'];return db[_0xb428('0x59')][_0xb428('0x4f')](_0x4b1f00[_0xb428('0x56')]);}})[_0xb428('0x26')](respondWithResult(_0x2fc9cc,null))[_0xb428('0x4b')](handleError(_0x2fc9cc,null));};exports[_0xb428('0x5b')]=function(_0x2024f7,_0x572bd4,_0x2ffa66){var _0x241b30={};var _0x2a8e30={};var _0x56707e;var _0xac5b6e;return db[_0xb428('0x30')]['findOne']({'where':{'id':_0x2024f7[_0xb428('0x4d')]['id']}})[_0xb428('0x26')](handleEntityNotFound(_0x572bd4,null))[_0xb428('0x26')](function(_0x17e01e){if(_0x17e01e){_0x56707e=_0x17e01e;_0x2a8e30[_0xb428('0x34')]=_['keys'](db[_0xb428('0x59')][_0xb428('0x31')]);_0x2a8e30['query']=_[_0xb428('0x36')](_0x2024f7[_0xb428('0x35')]);_0x2a8e30[_0xb428('0x37')]=_['intersection'](_0x2a8e30['model'],_0x2a8e30['query']);_0x241b30[_0xb428('0x3a')]=_[_0xb428('0x38')](_0x2a8e30[_0xb428('0x34')],qs['fields'](_0x2024f7[_0xb428('0x35')][_0xb428('0x39')]));_0x241b30['attributes']=_0x241b30[_0xb428('0x3a')][_0xb428('0x3b')]?_0x241b30[_0xb428('0x3a')]:_0x2a8e30[_0xb428('0x34')];_0x241b30[_0xb428('0x3e')]=qs[_0xb428('0x3f')](_0x2024f7[_0xb428('0x35')]['sort']);_0x241b30['where']=qs[_0xb428('0x37')](_[_0xb428('0x41')](_0x2024f7[_0xb428('0x35')],_0x2a8e30[_0xb428('0x37')]));if(_0x2024f7['query'][_0xb428('0x5c')]){_0x241b30[_0xb428('0x40')]=_[_0xb428('0x42')](_0x241b30[_0xb428('0x40')],{'$or':_[_0xb428('0x43')](_0x241b30[_0xb428('0x3a')],function(_0x54dc08){var _0x2b37bc={};_0x2b37bc[_0x54dc08]={'$like':'%'+_0x2024f7[_0xb428('0x35')][_0xb428('0x5c')]+'%'};return _0x2b37bc;})});}_0x241b30=_[_0xb428('0x42')]({},_0x241b30,_0x2024f7[_0xb428('0x46')]);return _0x56707e[_0xb428('0x5b')](_0x241b30);}})['then'](function(_0x28070f){if(_0x28070f){_0xac5b6e=_0x28070f[_0xb428('0x3b')];if(!_0x2024f7[_0xb428('0x35')][_0xb428('0x3c')](_0xb428('0x3d'))){_0x241b30[_0xb428('0x1f')]=qs[_0xb428('0x1f')](_0x2024f7[_0xb428('0x35')][_0xb428('0x1f')]);_0x241b30[_0xb428('0x1d')]=qs[_0xb428('0x1d')](_0x2024f7['query']['offset']);}return _0x56707e[_0xb428('0x5b')](_0x241b30);}})['then'](function(_0x53d372){if(_0x53d372){return _0x53d372?{'count':_0xac5b6e,'rows':_0x53d372}:null;}})['then'](respondWithResult(_0x572bd4,null))[_0xb428('0x4b')](handleError(_0x572bd4,null));};exports[_0xb428('0x5d')]=function(_0x4b4418,_0xfa19c4,_0xad63fb){var _0x2abd2a={};var _0x277704={};var _0x446428;var _0x2ae6d2;return db[_0xb428('0x30')][_0xb428('0x5e')]({'where':{'id':_0x4b4418[_0xb428('0x4d')]['id']}})[_0xb428('0x26')](handleEntityNotFound(_0xfa19c4,null))[_0xb428('0x26')](function(_0x960dcd){if(_0x960dcd){_0x446428=_0x960dcd;_0x277704[_0xb428('0x34')]=_['keys'](db['Condition'][_0xb428('0x31')]);_0x277704[_0xb428('0x35')]=_['keys'](_0x4b4418[_0xb428('0x35')]);_0x277704[_0xb428('0x37')]=_[_0xb428('0x38')](_0x277704[_0xb428('0x34')],_0x277704[_0xb428('0x35')]);_0x2abd2a[_0xb428('0x3a')]=_[_0xb428('0x38')](_0x277704['model'],qs[_0xb428('0x39')](_0x4b4418[_0xb428('0x35')][_0xb428('0x39')]));_0x2abd2a[_0xb428('0x3a')]=_0x2abd2a['attributes']['length']?_0x2abd2a['attributes']:_0x277704[_0xb428('0x34')];_0x2abd2a[_0xb428('0x3e')]=qs['sort'](_0x4b4418[_0xb428('0x35')]['sort']);_0x2abd2a[_0xb428('0x40')]=qs['filters'](_[_0xb428('0x41')](_0x4b4418[_0xb428('0x35')],_0x277704[_0xb428('0x37')]));if(_0x4b4418[_0xb428('0x35')][_0xb428('0x5c')]){_0x2abd2a[_0xb428('0x40')]=_['merge'](_0x2abd2a[_0xb428('0x40')],{'$or':_[_0xb428('0x43')](_0x2abd2a[_0xb428('0x3a')],function(_0x52013e){var _0x49f8dd={};_0x49f8dd[_0x52013e]={'$like':'%'+_0x4b4418[_0xb428('0x35')]['filter']+'%'};return _0x49f8dd;})});}_0x2abd2a=_[_0xb428('0x42')]({},_0x2abd2a,_0x4b4418[_0xb428('0x46')]);return _0x446428['getAnyConditions'](_0x2abd2a);}})[_0xb428('0x26')](function(_0x4561aa){if(_0x4561aa){_0x2ae6d2=_0x4561aa[_0xb428('0x3b')];if(!_0x4b4418[_0xb428('0x35')][_0xb428('0x3c')](_0xb428('0x3d'))){_0x2abd2a[_0xb428('0x1f')]=qs[_0xb428('0x1f')](_0x4b4418['query'][_0xb428('0x1f')]);_0x2abd2a[_0xb428('0x1d')]=qs[_0xb428('0x1d')](_0x4b4418['query'][_0xb428('0x1d')]);}return _0x446428[_0xb428('0x5d')](_0x2abd2a);}})[_0xb428('0x26')](function(_0x282136){if(_0x282136){return _0x282136?{'count':_0x2ae6d2,'rows':_0x282136}:null;}})[_0xb428('0x26')](respondWithResult(_0xfa19c4,null))['catch'](handleError(_0xfa19c4,null));};exports[_0xb428('0x5f')]=function(_0x1a1c15,_0x414eaa,_0x15b0c5){if(_0x1a1c15['body']['id']){delete _0x1a1c15[_0xb428('0x56')]['id'];}return db[_0xb428('0x30')]['find']({'where':{'id':_0x1a1c15[_0xb428('0x4d')]['id']}})['then'](handleEntityNotFound(_0x414eaa,null))[_0xb428('0x26')](function(_0x4ce070){if(_0x4ce070){_0x1a1c15[_0xb428('0x56')][_0xb428('0x60')]=_0x4ce070['id'];return db[_0xb428('0x61')][_0xb428('0x4f')](_0x1a1c15[_0xb428('0x56')]);}})[_0xb428('0x26')](respondWithResult(_0x414eaa,null))['catch'](handleError(_0x414eaa,null));};exports[_0xb428('0x62')]=function(_0x211052,_0x46caab,_0x2ffe53){var _0x5b693a={};var _0x1f1d8d={};var _0x3a8415;var _0x487ad7;return db['Trigger'][_0xb428('0x5e')]({'where':{'id':_0x211052[_0xb428('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46caab,null))[_0xb428('0x26')](function(_0x312254){if(_0x312254){_0x3a8415=_0x312254;_0x1f1d8d[_0xb428('0x34')]=_['keys'](db['Action'][_0xb428('0x31')]);_0x1f1d8d[_0xb428('0x35')]=_[_0xb428('0x36')](_0x211052[_0xb428('0x35')]);_0x1f1d8d[_0xb428('0x37')]=_[_0xb428('0x38')](_0x1f1d8d[_0xb428('0x34')],_0x1f1d8d[_0xb428('0x35')]);_0x5b693a['attributes']=_['intersection'](_0x1f1d8d[_0xb428('0x34')],qs[_0xb428('0x39')](_0x211052[_0xb428('0x35')][_0xb428('0x39')]));_0x5b693a[_0xb428('0x3a')]=_0x5b693a[_0xb428('0x3a')][_0xb428('0x3b')]?_0x5b693a[_0xb428('0x3a')]:_0x1f1d8d[_0xb428('0x34')];_0x5b693a[_0xb428('0x3e')]=qs[_0xb428('0x3f')](_0x211052[_0xb428('0x35')][_0xb428('0x3f')]);_0x5b693a[_0xb428('0x40')]=qs[_0xb428('0x37')](_[_0xb428('0x41')](_0x211052['query'],_0x1f1d8d['filters']));if(_0x211052['query'][_0xb428('0x5c')]){_0x5b693a[_0xb428('0x40')]=_['merge'](_0x5b693a[_0xb428('0x40')],{'$or':_[_0xb428('0x43')](_0x5b693a[_0xb428('0x3a')],function(_0x21e7e8){var _0x3d3c14={};_0x3d3c14[_0x21e7e8]={'$like':'%'+_0x211052[_0xb428('0x35')][_0xb428('0x5c')]+'%'};return _0x3d3c14;})});}_0x5b693a=_['merge']({},_0x5b693a,_0x211052[_0xb428('0x46')]);return _0x3a8415[_0xb428('0x62')](_0x5b693a);}})['then'](function(_0x35d0ce){if(_0x35d0ce){_0x487ad7=_0x35d0ce['length'];if(!_0x211052['query'][_0xb428('0x3c')](_0xb428('0x3d'))){_0x5b693a['limit']=qs[_0xb428('0x1f')](_0x211052[_0xb428('0x35')][_0xb428('0x1f')]);_0x5b693a[_0xb428('0x1d')]=qs[_0xb428('0x1d')](_0x211052[_0xb428('0x35')]['offset']);}return _0x3a8415[_0xb428('0x62')](_0x5b693a);}})[_0xb428('0x26')](function(_0x1d5021){if(_0x1d5021){return _0x1d5021?{'count':_0x487ad7,'rows':_0x1d5021}:null;}})[_0xb428('0x26')](respondWithResult(_0x46caab,null))[_0xb428('0x4b')](handleError(_0x46caab,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