Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / trigger / trigger.controller.js
index 9fe22c4..de86c35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf108=['params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','length','getAllConditions','getAnyConditions','order','nolimit','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf108,0x1cd));var _0x8f10=function(_0xb0dfae,_0x226e4e){_0xb0dfae=_0xb0dfae-0x0;var _0x382016=_0xf108[_0xb0dfae];return _0x382016;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require(_0x8f10('0x1'));var zipdir=require(_0x8f10('0x2'));var jsonpatch=require(_0x8f10('0x3'));var rp=require(_0x8f10('0x4'));var moment=require(_0x8f10('0x5'));var BPromise=require(_0x8f10('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8f10('0x7'));var sox=require(_0x8f10('0x8'));var csv=require(_0x8f10('0x9'));var ejs=require(_0x8f10('0xa'));var fs=require('fs');var fs_extra=require(_0x8f10('0xb'));var _=require(_0x8f10('0xc'));var squel=require(_0x8f10('0xd'));var crypto=require(_0x8f10('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f10('0xf'));var toCsv=require(_0x8f10('0x9'));var querystring=require(_0x8f10('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f10('0x12'));var as=require(_0x8f10('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f10('0x14'));var utils=require('../../config/utils');var config=require(_0x8f10('0x15'));var licenseUtil=require(_0x8f10('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bc458,_0x4158dc){_0x4158dc=_0x4158dc||0xcc;return function(_0x10c2e4){if(_0x10c2e4){return _0x1bc458[_0x8f10('0x17')](_0x4158dc);}return _0x1bc458[_0x8f10('0x18')](_0x4158dc)['end']();};}function respondWithResult(_0x34cf04,_0x595221){_0x595221=_0x595221||0xc8;return function(_0x2bfa06){if(_0x2bfa06){return _0x34cf04[_0x8f10('0x18')](_0x595221)[_0x8f10('0x19')](_0x2bfa06);}};}function respondWithFilteredResult(_0x2ae6df,_0x1817e){return function(_0x983b4){if(_0x983b4){var _0xf655e0=typeof _0x1817e['offset']===_0x8f10('0x1a')&&typeof _0x1817e[_0x8f10('0x1b')]===_0x8f10('0x1a');var _0x4b864a=_0x983b4[_0x8f10('0x1c')];var _0x3d0cfc=_0xf655e0?0x0:_0x1817e[_0x8f10('0x1d')];var _0x5b27db=_0xf655e0?_0x983b4[_0x8f10('0x1c')]:_0x1817e['offset']+_0x1817e[_0x8f10('0x1b')];var _0x15e337;if(_0x5b27db>=_0x4b864a){_0x5b27db=_0x4b864a;_0x15e337=0xc8;}else{_0x15e337=0xce;}_0x2ae6df[_0x8f10('0x18')](_0x15e337);return _0x2ae6df[_0x8f10('0x1e')](_0x8f10('0x1f'),_0x3d0cfc+'-'+_0x5b27db+'/'+_0x4b864a)['json'](_0x983b4);}return null;};}function patchUpdates(_0x2f5c10){return function(_0x164c91){try{jsonpatch['apply'](_0x164c91,_0x2f5c10,!![]);}catch(_0x2888cf){return BPromise['reject'](_0x2888cf);}return _0x164c91['save']();};}function saveUpdates(_0x3e916a,_0x35f990){return function(_0x314613){if(_0x314613){return _0x314613[_0x8f10('0x20')](_0x3e916a)[_0x8f10('0x21')](function(_0x27fd49){return _0x27fd49;});}return null;};}function removeEntity(_0x23d7e8,_0x7cb15f){return function(_0x4eb9){if(_0x4eb9){return _0x4eb9[_0x8f10('0x22')]()[_0x8f10('0x21')](function(){var _0x31fd1d=_0x4eb9[_0x8f10('0x23')]({'plain':!![]});var _0x2537e2=_0x8f10('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x2537e2,'resourceId':_0x31fd1d['id']}})[_0x8f10('0x21')](function(){return _0x4eb9;});})['then'](function(){_0x23d7e8[_0x8f10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5c20,_0x540dae){return function(_0x2f11bc){if(!_0x2f11bc){_0x4b5c20['sendStatus'](0x194);}return _0x2f11bc;};}function handleError(_0x2dd999,_0x3dcba1){_0x3dcba1=_0x3dcba1||0x1f4;return function(_0x5ef125){logger[_0x8f10('0x25')](_0x5ef125[_0x8f10('0x26')]);if(_0x5ef125[_0x8f10('0x27')]){delete _0x5ef125['name'];}_0x2dd999['status'](_0x3dcba1)[_0x8f10('0x28')](_0x5ef125);};}exports[_0x8f10('0x29')]=function(_0x52ee1f,_0x580b4d){var _0x453d84={},_0x23eb38={},_0x22689b={'count':0x0,'rows':[]};var _0xe7a283=_[_0x8f10('0x2a')](db[_0x8f10('0x2b')][_0x8f10('0x2c')],function(_0x52a94c){return{'name':_0x52a94c[_0x8f10('0x2d')],'type':_0x52a94c['type'][_0x8f10('0x2e')]};});_0x23eb38[_0x8f10('0x2f')]=_[_0x8f10('0x2a')](_0xe7a283,'name');_0x23eb38[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x52ee1f[_0x8f10('0x30')]);_0x23eb38['filters']=_[_0x8f10('0x32')](_0x23eb38[_0x8f10('0x2f')],_0x23eb38[_0x8f10('0x30')]);_0x453d84[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x23eb38[_0x8f10('0x2f')],qs['fields'](_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x34')]));_0x453d84['attributes']=_0x453d84[_0x8f10('0x33')]['length']?_0x453d84[_0x8f10('0x33')]:_0x23eb38[_0x8f10('0x2f')];if(!_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x35')]('nolimit')){_0x453d84[_0x8f10('0x1b')]=qs['limit'](_0x52ee1f['query'][_0x8f10('0x1b')]);_0x453d84[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x52ee1f['query'][_0x8f10('0x1d')]);}_0x453d84['order']=qs[_0x8f10('0x36')](_0x52ee1f[_0x8f10('0x30')]['sort']);_0x453d84[_0x8f10('0x37')]=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x52ee1f[_0x8f10('0x30')],_0x23eb38[_0x8f10('0x38')]),_0xe7a283);if(_0x52ee1f['query'][_0x8f10('0x3a')]){_0x453d84[_0x8f10('0x37')]=_[_0x8f10('0x3b')](_0x453d84[_0x8f10('0x37')],{'$or':_[_0x8f10('0x2a')](_0xe7a283,function(_0x5305d5){if(_0x5305d5[_0x8f10('0x3c')]!==_0x8f10('0x3d')){var _0x2e6e27={};_0x2e6e27[_0x5305d5[_0x8f10('0x27')]]={'$like':'%'+_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x2e6e27;}})});}_0x453d84=_[_0x8f10('0x3b')]({},_0x453d84,_0x52ee1f[_0x8f10('0x3e')]);var _0x5c830e={'where':_0x453d84[_0x8f10('0x37')]};return db[_0x8f10('0x2b')][_0x8f10('0x1c')](_0x5c830e)[_0x8f10('0x21')](function(_0x5c4368){_0x22689b[_0x8f10('0x1c')]=_0x5c4368;if(_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x453d84['include']=[{'all':!![]}];}return db[_0x8f10('0x2b')]['findAll'](_0x453d84);})[_0x8f10('0x21')](function(_0x41df69){_0x22689b[_0x8f10('0x40')]=_0x41df69;return _0x22689b;})['then'](respondWithFilteredResult(_0x580b4d,_0x453d84))[_0x8f10('0x41')](handleError(_0x580b4d,null));};exports['show']=function(_0x28f134,_0x22e02e){var _0x25349e={'raw':![],'where':{'id':_0x28f134['params']['id']}},_0xedfe9c={};_0xedfe9c[_0x8f10('0x2f')]=_[_0x8f10('0x31')](db[_0x8f10('0x2b')][_0x8f10('0x2c')]);_0xedfe9c['query']=_[_0x8f10('0x31')](_0x28f134[_0x8f10('0x30')]);_0xedfe9c[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0xedfe9c[_0x8f10('0x2f')],_0xedfe9c[_0x8f10('0x30')]);_0x25349e['attributes']=_[_0x8f10('0x32')](_0xedfe9c[_0x8f10('0x2f')],qs[_0x8f10('0x34')](_0x28f134[_0x8f10('0x30')][_0x8f10('0x34')]));_0x25349e[_0x8f10('0x33')]=_0x25349e[_0x8f10('0x33')]['length']?_0x25349e['attributes']:_0xedfe9c[_0x8f10('0x2f')];if(_0x28f134[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x25349e[_0x8f10('0x42')]=[{'all':!![]}];}_0x25349e=_[_0x8f10('0x3b')]({},_0x25349e,_0x28f134['options']);return db[_0x8f10('0x2b')][_0x8f10('0x43')](_0x25349e)[_0x8f10('0x21')](handleEntityNotFound(_0x22e02e,null))[_0x8f10('0x21')](respondWithResult(_0x22e02e,null))[_0x8f10('0x41')](handleError(_0x22e02e,null));};exports[_0x8f10('0x44')]=function(_0x4f81ab,_0x49d013){return db['Trigger']['create'](_0x4f81ab[_0x8f10('0x45')],{})[_0x8f10('0x21')](function(_0x262636){var _0x378084=_0x4f81ab[_0x8f10('0x46')][_0x8f10('0x23')]({'plain':!![]});if(!_0x378084)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378084['role']===_0x8f10('0x46')){var _0x242b37=_0x262636[_0x8f10('0x23')]({'plain':!![]});var _0x1c9843='Triggers';return db[_0x8f10('0x47')]['find']({'where':{'name':_0x1c9843,'userProfileId':_0x378084['userProfileId']},'raw':!![]})[_0x8f10('0x21')](function(_0x2bf1a1){if(_0x2bf1a1&&_0x2bf1a1['autoAssociation']===0x0){return db['UserProfileResource'][_0x8f10('0x44')]({'name':_0x242b37[_0x8f10('0x27')],'resourceId':_0x242b37['id'],'type':_0x2bf1a1[_0x8f10('0x27')],'sectionId':_0x2bf1a1['id']},{})[_0x8f10('0x21')](function(){return _0x262636;});}else{return _0x262636;}})[_0x8f10('0x41')](function(_0x4a712d){logger['error'](_0x8f10('0x48'),_0x4a712d);throw _0x4a712d;});}return _0x262636;})[_0x8f10('0x21')](respondWithResult(_0x49d013,0xc9))[_0x8f10('0x41')](handleError(_0x49d013,null));};exports['update']=function(_0x30be68,_0x523d56){if(_0x30be68['body']['id']){delete _0x30be68[_0x8f10('0x45')]['id'];}return db['Trigger'][_0x8f10('0x43')]({'where':{'id':_0x30be68[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x523d56,null))[_0x8f10('0x21')](saveUpdates(_0x30be68['body'],null))[_0x8f10('0x21')](respondWithResult(_0x523d56,null))[_0x8f10('0x41')](handleError(_0x523d56,null));};exports[_0x8f10('0x22')]=function(_0x499835,_0x289b51){return db[_0x8f10('0x2b')][_0x8f10('0x43')]({'where':{'id':_0x499835[_0x8f10('0x49')]['id']}})['then'](handleEntityNotFound(_0x289b51,null))[_0x8f10('0x21')](removeEntity(_0x289b51,null))[_0x8f10('0x41')](handleError(_0x289b51,null));};exports[_0x8f10('0x4a')]=function(_0x21a594,_0x1900b9,_0x20035d){if(_0x21a594[_0x8f10('0x45')]['id']){delete _0x21a594['body']['id'];}return db['Trigger'][_0x8f10('0x43')]({'where':{'id':_0x21a594[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x1900b9,null))[_0x8f10('0x21')](function(_0x5b3d3a){if(_0x5b3d3a){_0x21a594[_0x8f10('0x45')][_0x8f10('0x4b')]=_0x5b3d3a['id'];return db[_0x8f10('0x4c')][_0x8f10('0x44')](_0x21a594[_0x8f10('0x45')]);}})['then'](respondWithResult(_0x1900b9,null))[_0x8f10('0x41')](handleError(_0x1900b9,null));};exports[_0x8f10('0x4d')]=function(_0x3d21e8,_0x411fde,_0x5cd2ee){if(_0x3d21e8[_0x8f10('0x45')]['id']){delete _0x3d21e8['body']['id'];}return db[_0x8f10('0x2b')]['find']({'where':{'id':_0x3d21e8[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x411fde,null))[_0x8f10('0x21')](function(_0x53305d){if(_0x53305d){_0x3d21e8[_0x8f10('0x45')][_0x8f10('0x4e')]=_0x53305d['id'];return db[_0x8f10('0x4c')][_0x8f10('0x44')](_0x3d21e8[_0x8f10('0x45')]);}})[_0x8f10('0x21')](respondWithResult(_0x411fde,null))[_0x8f10('0x41')](handleError(_0x411fde,null));};exports['getAllConditions']=function(_0x51d038,_0x44c1e9,_0x5524da){var _0x5f1f57={};var _0x25116f={};var _0x170143;var _0x27f235;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x51d038[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x44c1e9,null))[_0x8f10('0x21')](function(_0x49f250){if(_0x49f250){_0x170143=_0x49f250;_0x25116f[_0x8f10('0x2f')]=_[_0x8f10('0x31')](db['Condition'][_0x8f10('0x2c')]);_0x25116f[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x51d038[_0x8f10('0x30')]);_0x25116f['filters']=_['intersection'](_0x25116f[_0x8f10('0x2f')],_0x25116f[_0x8f10('0x30')]);_0x5f1f57[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x25116f[_0x8f10('0x2f')],qs['fields'](_0x51d038['query']['fields']));_0x5f1f57[_0x8f10('0x33')]=_0x5f1f57[_0x8f10('0x33')][_0x8f10('0x50')]?_0x5f1f57[_0x8f10('0x33')]:_0x25116f[_0x8f10('0x2f')];_0x5f1f57['order']=qs[_0x8f10('0x36')](_0x51d038[_0x8f10('0x30')][_0x8f10('0x36')]);_0x5f1f57['where']=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x51d038['query'],_0x25116f['filters']));if(_0x51d038[_0x8f10('0x30')][_0x8f10('0x3a')]){_0x5f1f57[_0x8f10('0x37')]=_['merge'](_0x5f1f57[_0x8f10('0x37')],{'$or':_[_0x8f10('0x2a')](_0x5f1f57['attributes'],function(_0x5d4d2f){var _0x55a526={};_0x55a526[_0x5d4d2f]={'$like':'%'+_0x51d038[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x55a526;})});}_0x5f1f57=_['merge']({},_0x5f1f57,_0x51d038[_0x8f10('0x3e')]);return _0x170143[_0x8f10('0x51')](_0x5f1f57);}})[_0x8f10('0x21')](function(_0x47a0ac){if(_0x47a0ac){_0x27f235=_0x47a0ac['length'];if(!_0x51d038[_0x8f10('0x30')]['hasOwnProperty']('nolimit')){_0x5f1f57[_0x8f10('0x1b')]=qs[_0x8f10('0x1b')](_0x51d038['query']['limit']);_0x5f1f57[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x51d038[_0x8f10('0x30')][_0x8f10('0x1d')]);}return _0x170143['getAllConditions'](_0x5f1f57);}})['then'](function(_0xe62738){if(_0xe62738){return _0xe62738?{'count':_0x27f235,'rows':_0xe62738}:null;}})[_0x8f10('0x21')](respondWithResult(_0x44c1e9,null))[_0x8f10('0x41')](handleError(_0x44c1e9,null));};exports[_0x8f10('0x52')]=function(_0x1759f9,_0x13c788,_0x2ec9ff){var _0x46e4d6={};var _0x45004a={};var _0x434032;var _0x135a0a;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x1759f9[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x13c788,null))[_0x8f10('0x21')](function(_0x403e6f){if(_0x403e6f){_0x434032=_0x403e6f;_0x45004a['model']=_[_0x8f10('0x31')](db[_0x8f10('0x4c')]['rawAttributes']);_0x45004a[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x1759f9[_0x8f10('0x30')]);_0x45004a[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0x45004a[_0x8f10('0x2f')],_0x45004a[_0x8f10('0x30')]);_0x46e4d6[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x45004a[_0x8f10('0x2f')],qs['fields'](_0x1759f9['query'][_0x8f10('0x34')]));_0x46e4d6[_0x8f10('0x33')]=_0x46e4d6[_0x8f10('0x33')][_0x8f10('0x50')]?_0x46e4d6[_0x8f10('0x33')]:_0x45004a[_0x8f10('0x2f')];_0x46e4d6[_0x8f10('0x53')]=qs[_0x8f10('0x36')](_0x1759f9['query']['sort']);_0x46e4d6[_0x8f10('0x37')]=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x1759f9['query'],_0x45004a[_0x8f10('0x38')]));if(_0x1759f9[_0x8f10('0x30')]['filter']){_0x46e4d6[_0x8f10('0x37')]=_['merge'](_0x46e4d6[_0x8f10('0x37')],{'$or':_['map'](_0x46e4d6['attributes'],function(_0x52feb9){var _0x135378={};_0x135378[_0x52feb9]={'$like':'%'+_0x1759f9[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x135378;})});}_0x46e4d6=_['merge']({},_0x46e4d6,_0x1759f9[_0x8f10('0x3e')]);return _0x434032['getAnyConditions'](_0x46e4d6);}})[_0x8f10('0x21')](function(_0x1df02a){if(_0x1df02a){_0x135a0a=_0x1df02a[_0x8f10('0x50')];if(!_0x1759f9[_0x8f10('0x30')]['hasOwnProperty'](_0x8f10('0x54'))){_0x46e4d6[_0x8f10('0x1b')]=qs[_0x8f10('0x1b')](_0x1759f9[_0x8f10('0x30')][_0x8f10('0x1b')]);_0x46e4d6[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x1759f9['query'][_0x8f10('0x1d')]);}return _0x434032[_0x8f10('0x52')](_0x46e4d6);}})[_0x8f10('0x21')](function(_0x3e64c7){if(_0x3e64c7){return _0x3e64c7?{'count':_0x135a0a,'rows':_0x3e64c7}:null;}})[_0x8f10('0x21')](respondWithResult(_0x13c788,null))[_0x8f10('0x41')](handleError(_0x13c788,null));};exports[_0x8f10('0x55')]=function(_0x551bd6,_0x5ce5cf,_0x31382c){if(_0x551bd6[_0x8f10('0x45')]['id']){delete _0x551bd6['body']['id'];}return db[_0x8f10('0x2b')][_0x8f10('0x43')]({'where':{'id':_0x551bd6['params']['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x5ce5cf,null))[_0x8f10('0x21')](function(_0x423048){if(_0x423048){_0x551bd6['body'][_0x8f10('0x56')]=_0x423048['id'];return db[_0x8f10('0x57')]['create'](_0x551bd6['body']);}})[_0x8f10('0x21')](respondWithResult(_0x5ce5cf,null))['catch'](handleError(_0x5ce5cf,null));};exports[_0x8f10('0x58')]=function(_0x32481e,_0x14c04d,_0x4b7a60){var _0x131b51={};var _0x17cc07={};var _0x2fca87;var _0x310760;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x32481e[_0x8f10('0x49')]['id']}})['then'](handleEntityNotFound(_0x14c04d,null))[_0x8f10('0x21')](function(_0x412ce6){if(_0x412ce6){_0x2fca87=_0x412ce6;_0x17cc07[_0x8f10('0x2f')]=_['keys'](db['Action'][_0x8f10('0x2c')]);_0x17cc07[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x32481e[_0x8f10('0x30')]);_0x17cc07[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0x17cc07[_0x8f10('0x2f')],_0x17cc07[_0x8f10('0x30')]);_0x131b51[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x17cc07['model'],qs[_0x8f10('0x34')](_0x32481e[_0x8f10('0x30')]['fields']));_0x131b51[_0x8f10('0x33')]=_0x131b51[_0x8f10('0x33')][_0x8f10('0x50')]?_0x131b51[_0x8f10('0x33')]:_0x17cc07['model'];_0x131b51[_0x8f10('0x53')]=qs[_0x8f10('0x36')](_0x32481e['query'][_0x8f10('0x36')]);_0x131b51[_0x8f10('0x37')]=qs['filters'](_[_0x8f10('0x39')](_0x32481e[_0x8f10('0x30')],_0x17cc07[_0x8f10('0x38')]));if(_0x32481e[_0x8f10('0x30')]['filter']){_0x131b51[_0x8f10('0x37')]=_['merge'](_0x131b51['where'],{'$or':_[_0x8f10('0x2a')](_0x131b51[_0x8f10('0x33')],function(_0x174e74){var _0x5ecb64={};_0x5ecb64[_0x174e74]={'$like':'%'+_0x32481e['query'][_0x8f10('0x3a')]+'%'};return _0x5ecb64;})});}_0x131b51=_['merge']({},_0x131b51,_0x32481e[_0x8f10('0x3e')]);return _0x2fca87[_0x8f10('0x58')](_0x131b51);}})[_0x8f10('0x21')](function(_0x15b82d){if(_0x15b82d){_0x310760=_0x15b82d['length'];if(!_0x32481e[_0x8f10('0x30')][_0x8f10('0x35')](_0x8f10('0x54'))){_0x131b51[_0x8f10('0x1b')]=qs['limit'](_0x32481e[_0x8f10('0x30')][_0x8f10('0x1b')]);_0x131b51[_0x8f10('0x1d')]=qs['offset'](_0x32481e['query'][_0x8f10('0x1d')]);}return _0x2fca87[_0x8f10('0x58')](_0x131b51);}})['then'](function(_0x5daf01){if(_0x5daf01){return _0x5daf01?{'count':_0x310760,'rows':_0x5daf01}:null;}})[_0x8f10('0x21')](respondWithResult(_0x14c04d,null))['catch'](handleError(_0x14c04d,null));};
\ No newline at end of file
+var _0xb04e=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Trigger','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user'];(function(_0x9f6556,_0x28414f){var _0x5ee21e=function(_0x337b35){while(--_0x337b35){_0x9f6556['push'](_0x9f6556['shift']());}};_0x5ee21e(++_0x28414f);}(_0xb04e,0x185));var _0xeb04=function(_0x18329c,_0x5804b7){_0x18329c=_0x18329c-0x0;var _0x19cbc5=_0xb04e[_0x18329c];return _0x19cbc5;};'use strict';var emlformat=require(_0xeb04('0x0'));var rimraf=require(_0xeb04('0x1'));var zipdir=require(_0xeb04('0x2'));var jsonpatch=require(_0xeb04('0x3'));var rp=require(_0xeb04('0x4'));var moment=require(_0xeb04('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb04('0x6'));var util=require(_0xeb04('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb04('0x8'));var ejs=require(_0xeb04('0x9'));var fs=require('fs');var fs_extra=require(_0xeb04('0xa'));var _=require(_0xeb04('0xb'));var squel=require(_0xeb04('0xc'));var crypto=require(_0xeb04('0xd'));var jsforce=require(_0xeb04('0xe'));var deskjs=require(_0xeb04('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb04('0x10'));var Papa=require(_0xeb04('0x11'));var Redis=require(_0xeb04('0x12'));var authService=require(_0xeb04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb04('0x14'));var hardwareService=require(_0xeb04('0x15'));var logger=require(_0xeb04('0x16'))(_0xeb04('0x17'));var utils=require(_0xeb04('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeb04('0x19'));var db=require(_0xeb04('0x1a'))['db'];function respondWithStatusCode(_0x413d39,_0x45512a){_0x45512a=_0x45512a||0xcc;return function(_0x1affae){if(_0x1affae){return _0x413d39['sendStatus'](_0x45512a);}return _0x413d39[_0xeb04('0x1b')](_0x45512a)[_0xeb04('0x1c')]();};}function respondWithResult(_0x8aaa97,_0xfcf7ed){_0xfcf7ed=_0xfcf7ed||0xc8;return function(_0x43c44d){if(_0x43c44d){return _0x8aaa97[_0xeb04('0x1b')](_0xfcf7ed)[_0xeb04('0x1d')](_0x43c44d);}};}function respondWithFilteredResult(_0xa5ab17,_0x1ce32f){return function(_0x3c6960){if(_0x3c6960){var _0xb1e9cf=typeof _0x1ce32f[_0xeb04('0x1e')]===_0xeb04('0x1f')&&typeof _0x1ce32f[_0xeb04('0x20')]===_0xeb04('0x1f');var _0x472da9=_0x3c6960[_0xeb04('0x21')];var _0x442555=_0xb1e9cf?0x0:_0x1ce32f[_0xeb04('0x1e')];var _0x2f80a1=_0xb1e9cf?_0x3c6960['count']:_0x1ce32f[_0xeb04('0x1e')]+_0x1ce32f[_0xeb04('0x20')];var _0x25bec9;if(_0x2f80a1>=_0x472da9){_0x2f80a1=_0x472da9;_0x25bec9=0xc8;}else{_0x25bec9=0xce;}_0xa5ab17[_0xeb04('0x1b')](_0x25bec9);return _0xa5ab17['set'](_0xeb04('0x22'),_0x442555+'-'+_0x2f80a1+'/'+_0x472da9)[_0xeb04('0x1d')](_0x3c6960);}return null;};}function patchUpdates(_0x2925b9){return function(_0x30ba1b){try{jsonpatch[_0xeb04('0x23')](_0x30ba1b,_0x2925b9,!![]);}catch(_0xae52bc){return BPromise[_0xeb04('0x24')](_0xae52bc);}return _0x30ba1b['save']();};}function saveUpdates(_0x4b1cf8,_0x1d3376){return function(_0x21aec0){if(_0x21aec0){return _0x21aec0[_0xeb04('0x25')](_0x4b1cf8)[_0xeb04('0x26')](function(_0x413032){return _0x413032;});}return null;};}function removeEntity(_0x3567e4,_0x4dc02b){return function(_0x38e92e){if(_0x38e92e){return _0x38e92e[_0xeb04('0x27')]()[_0xeb04('0x26')](function(){var _0x4cea31=_0x38e92e['get']({'plain':!![]});var _0x231488='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x231488,'resourceId':_0x4cea31['id']}})['then'](function(){return _0x38e92e;});})[_0xeb04('0x26')](function(){_0x3567e4[_0xeb04('0x1b')](0xcc)[_0xeb04('0x1c')]();});}};}function handleEntityNotFound(_0x5370a4,_0x395052){return function(_0x2d9061){if(!_0x2d9061){_0x5370a4['sendStatus'](0x194);}return _0x2d9061;};}function handleError(_0x1a6418,_0x358578){_0x358578=_0x358578||0x1f4;return function(_0x5c0756){logger[_0xeb04('0x28')](_0x5c0756[_0xeb04('0x29')]);if(_0x5c0756[_0xeb04('0x2a')]){delete _0x5c0756[_0xeb04('0x2a')];}_0x1a6418[_0xeb04('0x1b')](_0x358578)[_0xeb04('0x2b')](_0x5c0756);};}exports['index']=function(_0x15d7e5,_0x5859c2){var _0x1fe452={},_0x2dae2c={},_0x405199={'count':0x0,'rows':[]};var _0x324585=_[_0xeb04('0x2c')](db[_0xeb04('0x2d')][_0xeb04('0x2e')],function(_0x253cbb){return{'name':_0x253cbb['fieldName'],'type':_0x253cbb['type'][_0xeb04('0x2f')]};});_0x2dae2c[_0xeb04('0x30')]=_[_0xeb04('0x2c')](_0x324585,_0xeb04('0x2a'));_0x2dae2c[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x15d7e5[_0xeb04('0x31')]);_0x2dae2c['filters']=_['intersection'](_0x2dae2c['model'],_0x2dae2c[_0xeb04('0x31')]);_0x1fe452[_0xeb04('0x33')]=_['intersection'](_0x2dae2c[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x15d7e5[_0xeb04('0x31')]['fields']));_0x1fe452[_0xeb04('0x33')]=_0x1fe452['attributes'][_0xeb04('0x35')]?_0x1fe452['attributes']:_0x2dae2c['model'];if(!_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1fe452[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x20')]);_0x1fe452[_0xeb04('0x1e')]=qs['offset'](_0x15d7e5[_0xeb04('0x31')]['offset']);}_0x1fe452[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x39')]);_0x1fe452[_0xeb04('0x3a')]=qs['filters'](_[_0xeb04('0x3b')](_0x15d7e5[_0xeb04('0x31')],_0x2dae2c[_0xeb04('0x3c')]),_0x324585);if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1fe452['where']=_[_0xeb04('0x3e')](_0x1fe452['where'],{'$or':_[_0xeb04('0x2c')](_0x324585,function(_0x41c362){if(_0x41c362['type']!==_0xeb04('0x3f')){var _0x36a0a5={};_0x36a0a5[_0x41c362['name']]={'$like':'%'+_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]+'%'};return _0x36a0a5;}})});}_0x1fe452=_[_0xeb04('0x3e')]({},_0x1fe452,_0x15d7e5[_0xeb04('0x40')]);var _0x532a22={'where':_0x1fe452[_0xeb04('0x3a')]};return db[_0xeb04('0x2d')][_0xeb04('0x21')](_0x532a22)[_0xeb04('0x26')](function(_0x5009d6){_0x405199[_0xeb04('0x21')]=_0x5009d6;if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x41')]){_0x1fe452[_0xeb04('0x42')]=[{'all':!![]}];}return db[_0xeb04('0x2d')][_0xeb04('0x43')](_0x1fe452);})['then'](function(_0x163f4b){_0x405199[_0xeb04('0x44')]=_0x163f4b;return _0x405199;})[_0xeb04('0x26')](respondWithFilteredResult(_0x5859c2,_0x1fe452))[_0xeb04('0x45')](handleError(_0x5859c2,null));};exports[_0xeb04('0x46')]=function(_0x46a67e,_0x1e5870){var _0x4210f4={'raw':![],'where':{'id':_0x46a67e[_0xeb04('0x47')]['id']}},_0x1fe994={};_0x1fe994[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x2d')]['rawAttributes']);_0x1fe994['query']=_[_0xeb04('0x32')](_0x46a67e[_0xeb04('0x31')]);_0x1fe994[_0xeb04('0x3c')]=_[_0xeb04('0x48')](_0x1fe994[_0xeb04('0x30')],_0x1fe994['query']);_0x4210f4[_0xeb04('0x33')]=_['intersection'](_0x1fe994[_0xeb04('0x30')],qs['fields'](_0x46a67e[_0xeb04('0x31')][_0xeb04('0x34')]));_0x4210f4['attributes']=_0x4210f4[_0xeb04('0x33')]['length']?_0x4210f4[_0xeb04('0x33')]:_0x1fe994[_0xeb04('0x30')];if(_0x46a67e['query'][_0xeb04('0x41')]){_0x4210f4[_0xeb04('0x42')]=[{'all':!![]}];}_0x4210f4=_[_0xeb04('0x3e')]({},_0x4210f4,_0x46a67e['options']);return db['Trigger'][_0xeb04('0x49')](_0x4210f4)[_0xeb04('0x26')](handleEntityNotFound(_0x1e5870,null))[_0xeb04('0x26')](respondWithResult(_0x1e5870,null))['catch'](handleError(_0x1e5870,null));};exports['create']=function(_0x1e7a9b,_0x46ec82){return db['Trigger'][_0xeb04('0x4a')](_0x1e7a9b['body'],{})[_0xeb04('0x26')](function(_0x421edc){var _0x2aa7ca=_0x1e7a9b[_0xeb04('0x4b')][_0xeb04('0x4c')]({'plain':!![]});if(!_0x2aa7ca)throw new Error(_0xeb04('0x4d'));if(_0x2aa7ca[_0xeb04('0x4e')]===_0xeb04('0x4b')){var _0x590464=_0x421edc[_0xeb04('0x4c')]({'plain':!![]});var _0x260692='Triggers';return db[_0xeb04('0x4f')]['find']({'where':{'name':_0x260692,'userProfileId':_0x2aa7ca['userProfileId']},'raw':!![]})[_0xeb04('0x26')](function(_0x51ddea){if(_0x51ddea&&_0x51ddea['autoAssociation']===0x0){return db[_0xeb04('0x50')]['create']({'name':_0x590464[_0xeb04('0x2a')],'resourceId':_0x590464['id'],'type':_0x51ddea[_0xeb04('0x2a')],'sectionId':_0x51ddea['id']},{})[_0xeb04('0x26')](function(){return _0x421edc;});}else{return _0x421edc;}})[_0xeb04('0x45')](function(_0x51e1d6){logger[_0xeb04('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51e1d6);throw _0x51e1d6;});}return _0x421edc;})[_0xeb04('0x26')](respondWithResult(_0x46ec82,0xc9))[_0xeb04('0x45')](handleError(_0x46ec82,null));};exports[_0xeb04('0x25')]=function(_0x37bcf2,_0x49a0aa){if(_0x37bcf2['body']['id']){delete _0x37bcf2[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')]['find']({'where':{'id':_0x37bcf2['params']['id']}})['then'](handleEntityNotFound(_0x49a0aa,null))[_0xeb04('0x26')](saveUpdates(_0x37bcf2['body'],null))['then'](respondWithResult(_0x49a0aa,null))[_0xeb04('0x45')](handleError(_0x49a0aa,null));};exports[_0xeb04('0x27')]=function(_0x15fe25,_0x271339){return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x15fe25[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x271339,null))[_0xeb04('0x26')](removeEntity(_0x271339,null))[_0xeb04('0x45')](handleError(_0x271339,null));};exports['addAllCondition']=function(_0x4b9171,_0x4a075a,_0x34e070){if(_0x4b9171[_0xeb04('0x51')]['id']){delete _0x4b9171[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x4b9171['params']['id']}})['then'](handleEntityNotFound(_0x4a075a,null))['then'](function(_0x323ef8){if(_0x323ef8){_0x4b9171[_0xeb04('0x51')][_0xeb04('0x52')]=_0x323ef8['id'];return db[_0xeb04('0x53')]['create'](_0x4b9171[_0xeb04('0x51')]);}})['then'](respondWithResult(_0x4a075a,null))['catch'](handleError(_0x4a075a,null));};exports[_0xeb04('0x54')]=function(_0x169062,_0x323c93,_0x117cfc){if(_0x169062['body']['id']){delete _0x169062[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x169062[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x323c93,null))[_0xeb04('0x26')](function(_0x152b3f){if(_0x152b3f){_0x169062[_0xeb04('0x51')][_0xeb04('0x55')]=_0x152b3f['id'];return db[_0xeb04('0x53')][_0xeb04('0x4a')](_0x169062[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x323c93,null))[_0xeb04('0x45')](handleError(_0x323c93,null));};exports[_0xeb04('0x56')]=function(_0x146a10,_0x2dadf6,_0x2b1b2b){var _0x49c3f3={};var _0x57ca1f={};var _0x2b558e;var _0x2eb9fa;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x146a10[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x2dadf6,null))[_0xeb04('0x26')](function(_0x3039b1){if(_0x3039b1){_0x2b558e=_0x3039b1;_0x57ca1f[_0xeb04('0x30')]=_['keys'](db['Condition'][_0xeb04('0x2e')]);_0x57ca1f[_0xeb04('0x31')]=_['keys'](_0x146a10['query']);_0x57ca1f['filters']=_[_0xeb04('0x48')](_0x57ca1f['model'],_0x57ca1f[_0xeb04('0x31')]);_0x49c3f3['attributes']=_['intersection'](_0x57ca1f[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x34')]));_0x49c3f3['attributes']=_0x49c3f3['attributes'][_0xeb04('0x35')]?_0x49c3f3[_0xeb04('0x33')]:_0x57ca1f[_0xeb04('0x30')];_0x49c3f3['order']=qs[_0xeb04('0x39')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x39')]);_0x49c3f3[_0xeb04('0x3a')]=qs[_0xeb04('0x3c')](_['pick'](_0x146a10[_0xeb04('0x31')],_0x57ca1f[_0xeb04('0x3c')]));if(_0x146a10[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x49c3f3[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x49c3f3[_0xeb04('0x3a')],{'$or':_['map'](_0x49c3f3[_0xeb04('0x33')],function(_0x5b79ad){var _0x21c60b={};_0x21c60b[_0x5b79ad]={'$like':'%'+_0x146a10[_0xeb04('0x31')]['filter']+'%'};return _0x21c60b;})});}_0x49c3f3=_['merge']({},_0x49c3f3,_0x146a10[_0xeb04('0x40')]);return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x7925b){if(_0x7925b){_0x2eb9fa=_0x7925b[_0xeb04('0x35')];if(!_0x146a10[_0xeb04('0x31')]['hasOwnProperty'](_0xeb04('0x37'))){_0x49c3f3[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x146a10['query']['limit']);_0x49c3f3[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x126965){if(_0x126965){return _0x126965?{'count':_0x2eb9fa,'rows':_0x126965}:null;}})[_0xeb04('0x26')](respondWithResult(_0x2dadf6,null))[_0xeb04('0x45')](handleError(_0x2dadf6,null));};exports[_0xeb04('0x58')]=function(_0x5c7875,_0x1623ea,_0x3eb531){var _0x1754ae={};var _0x3cd737={};var _0x12ba9b;var _0x49d34b;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x5c7875[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x1623ea,null))[_0xeb04('0x26')](function(_0x1f3065){if(_0x1f3065){_0x12ba9b=_0x1f3065;_0x3cd737[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x53')][_0xeb04('0x2e')]);_0x3cd737[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x5c7875[_0xeb04('0x31')]);_0x3cd737['filters']=_['intersection'](_0x3cd737[_0xeb04('0x30')],_0x3cd737[_0xeb04('0x31')]);_0x1754ae[_0xeb04('0x33')]=_[_0xeb04('0x48')](_0x3cd737[_0xeb04('0x30')],qs['fields'](_0x5c7875['query'][_0xeb04('0x34')]));_0x1754ae['attributes']=_0x1754ae[_0xeb04('0x33')][_0xeb04('0x35')]?_0x1754ae[_0xeb04('0x33')]:_0x3cd737['model'];_0x1754ae[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x5c7875[_0xeb04('0x31')]['sort']);_0x1754ae['where']=qs['filters'](_[_0xeb04('0x3b')](_0x5c7875['query'],_0x3cd737[_0xeb04('0x3c')]));if(_0x5c7875[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1754ae[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x1754ae[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x1754ae[_0xeb04('0x33')],function(_0x144b43){var _0x25d7e4={};_0x25d7e4[_0x144b43]={'$like':'%'+_0x5c7875['query'][_0xeb04('0x3d')]+'%'};return _0x25d7e4;})});}_0x1754ae=_[_0xeb04('0x3e')]({},_0x1754ae,_0x5c7875[_0xeb04('0x40')]);return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x459b86){if(_0x459b86){_0x49d34b=_0x459b86[_0xeb04('0x35')];if(!_0x5c7875[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1754ae[_0xeb04('0x20')]=qs['limit'](_0x5c7875['query'][_0xeb04('0x20')]);_0x1754ae[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x5c7875[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x1387de){if(_0x1387de){return _0x1387de?{'count':_0x49d34b,'rows':_0x1387de}:null;}})[_0xeb04('0x26')](respondWithResult(_0x1623ea,null))['catch'](handleError(_0x1623ea,null));};exports[_0xeb04('0x59')]=function(_0x3d6ffb,_0x1f4587,_0x27caa3){if(_0x3d6ffb['body']['id']){delete _0x3d6ffb[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x3d6ffb[_0xeb04('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f4587,null))['then'](function(_0x5e4d4b){if(_0x5e4d4b){_0x3d6ffb['body'][_0xeb04('0x5a')]=_0x5e4d4b['id'];return db[_0xeb04('0x5b')][_0xeb04('0x4a')](_0x3d6ffb[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x1f4587,null))[_0xeb04('0x45')](handleError(_0x1f4587,null));};exports['getActions']=function(_0x894ba9,_0xa27e79,_0xb12294){var _0x27b44f={};var _0x1aa65b={};var _0x3601b3;var _0x43d482;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x894ba9[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0xa27e79,null))['then'](function(_0x3f2c14){if(_0x3f2c14){_0x3601b3=_0x3f2c14;_0x1aa65b[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x5b')][_0xeb04('0x2e')]);_0x1aa65b[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x894ba9[_0xeb04('0x31')]);_0x1aa65b['filters']=_[_0xeb04('0x48')](_0x1aa65b['model'],_0x1aa65b[_0xeb04('0x31')]);_0x27b44f[_0xeb04('0x33')]=_['intersection'](_0x1aa65b[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x34')]));_0x27b44f[_0xeb04('0x33')]=_0x27b44f[_0xeb04('0x33')][_0xeb04('0x35')]?_0x27b44f[_0xeb04('0x33')]:_0x1aa65b[_0xeb04('0x30')];_0x27b44f['order']=qs[_0xeb04('0x39')](_0x894ba9['query']['sort']);_0x27b44f['where']=qs['filters'](_[_0xeb04('0x3b')](_0x894ba9[_0xeb04('0x31')],_0x1aa65b[_0xeb04('0x3c')]));if(_0x894ba9['query'][_0xeb04('0x3d')]){_0x27b44f['where']=_[_0xeb04('0x3e')](_0x27b44f[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x27b44f[_0xeb04('0x33')],function(_0x49ce0e){var _0x402e49={};_0x402e49[_0x49ce0e]={'$like':'%'+_0x894ba9['query'][_0xeb04('0x3d')]+'%'};return _0x402e49;})});}_0x27b44f=_[_0xeb04('0x3e')]({},_0x27b44f,_0x894ba9[_0xeb04('0x40')]);return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})['then'](function(_0x38f8f2){if(_0x38f8f2){_0x43d482=_0x38f8f2[_0xeb04('0x35')];if(!_0x894ba9[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x27b44f[_0xeb04('0x20')]=qs['limit'](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x20')]);_0x27b44f[_0xeb04('0x1e')]=qs['offset'](_0x894ba9['query']['offset']);}return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})[_0xeb04('0x26')](function(_0x407b0b){if(_0x407b0b){return _0x407b0b?{'count':_0x43d482,'rows':_0x407b0b}:null;}})[_0xeb04('0x26')](respondWithResult(_0xa27e79,null))['catch'](handleError(_0xa27e79,null));};
\ No newline at end of file