Built motion from commit ddca4d0d.|2.5.47
[motion2.git] / server / api / trigger / trigger.controller.js
index c743230..93268d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf318=['status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','options','Trigger','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','body','TriggerAllId','addAnyCondition','Condition','filter','getAllConditions','hasOwnProperty','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x3f9e5e,_0x20ab1b){var _0x2826e2=function(_0x19ba0e){while(--_0x19ba0e){_0x3f9e5e['push'](_0x3f9e5e['shift']());}};_0x2826e2(++_0x20ab1b);}(_0xf318,0x9f));var _0x8f31=function(_0x4289cc,_0x4a5691){_0x4289cc=_0x4289cc-0x0;var _0x4a26be=_0xf318[_0x4289cc];return _0x4a26be;};'use strict';var emlformat=require(_0x8f31('0x0'));var rimraf=require(_0x8f31('0x1'));var zipdir=require(_0x8f31('0x2'));var jsonpatch=require(_0x8f31('0x3'));var rp=require(_0x8f31('0x4'));var moment=require(_0x8f31('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8f31('0x6'));var util=require(_0x8f31('0x7'));var path=require(_0x8f31('0x8'));var sox=require(_0x8f31('0x9'));var csv=require(_0x8f31('0xa'));var ejs=require(_0x8f31('0xb'));var fs=require('fs');var fs_extra=require(_0x8f31('0xc'));var _=require(_0x8f31('0xd'));var squel=require(_0x8f31('0xe'));var crypto=require(_0x8f31('0xf'));var jsforce=require(_0x8f31('0x10'));var deskjs=require(_0x8f31('0x11'));var toCsv=require(_0x8f31('0xa'));var querystring=require('querystring');var Papa=require(_0x8f31('0x12'));var Redis=require(_0x8f31('0x13'));var authService=require(_0x8f31('0x14'));var qs=require(_0x8f31('0x15'));var as=require(_0x8f31('0x16'));var hardwareService=require(_0x8f31('0x17'));var logger=require(_0x8f31('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x8f31('0x19'));var licenseUtil=require(_0x8f31('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57702d,_0x38cc76){_0x38cc76=_0x38cc76||0xcc;return function(_0x8fccdf){if(_0x8fccdf){return _0x57702d[_0x8f31('0x1b')](_0x38cc76);}return _0x57702d['status'](_0x38cc76)[_0x8f31('0x1c')]();};}function respondWithResult(_0x534c2a,_0x3a1f43){_0x3a1f43=_0x3a1f43||0xc8;return function(_0x506107){if(_0x506107){return _0x534c2a[_0x8f31('0x1d')](_0x3a1f43)[_0x8f31('0x1e')](_0x506107);}};}function respondWithFilteredResult(_0xe61f6d,_0x107154){return function(_0x3b08dc){if(_0x3b08dc){var _0x54c407=_0x3b08dc[_0x8f31('0x1f')],_0x767438=_0x107154[_0x8f31('0x20')],_0x489455=_0x107154[_0x8f31('0x20')]+_0x107154[_0x8f31('0x21')],_0x438c2b;if(_0x489455>=_0x54c407){_0x489455=_0x54c407;_0x438c2b=0xc8;}else{_0x438c2b=0xce;}_0xe61f6d[_0x8f31('0x1d')](_0x438c2b);return _0xe61f6d[_0x8f31('0x22')](_0x8f31('0x23'),_0x767438+'-'+_0x489455+'/'+_0x54c407)[_0x8f31('0x1e')](_0x3b08dc);}return null;};}function patchUpdates(_0x8b1f){return function(_0x23c8f5){try{jsonpatch[_0x8f31('0x24')](_0x23c8f5,_0x8b1f,!![]);}catch(_0xc2103b){return BPromise['reject'](_0xc2103b);}return _0x23c8f5['save']();};}function saveUpdates(_0x549e87,_0x2a4060){return function(_0x19b072){if(_0x19b072){return _0x19b072[_0x8f31('0x25')](_0x549e87)[_0x8f31('0x26')](function(_0x8e16f9){return _0x8e16f9;});}return null;};}function removeEntity(_0x21871c,_0x50166b){return function(_0xfc05c6){if(_0xfc05c6){return _0xfc05c6[_0x8f31('0x27')]()[_0x8f31('0x26')](function(){var _0x37cab8=_0xfc05c6[_0x8f31('0x28')]({'plain':!![]});var _0xd34a0b='Triggers';return db[_0x8f31('0x29')][_0x8f31('0x27')]({'where':{'type':_0xd34a0b,'resourceId':_0x37cab8['id']}})['then'](function(){return _0xfc05c6;});})[_0x8f31('0x26')](function(){_0x21871c[_0x8f31('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfa77,_0x31f614){return function(_0x31fe09){if(!_0x31fe09){_0x1cfa77[_0x8f31('0x1b')](0x194);}return _0x31fe09;};}function handleError(_0x59c27f,_0x23b930){_0x23b930=_0x23b930||0x1f4;return function(_0x571cee){logger[_0x8f31('0x2a')](_0x571cee[_0x8f31('0x2b')]);if(_0x571cee['name']){delete _0x571cee[_0x8f31('0x2c')];}_0x59c27f[_0x8f31('0x1d')](_0x23b930)['send'](_0x571cee);};}exports[_0x8f31('0x2d')]=function(_0x379dfd,_0x5e3020){var _0x3734d1={},_0xd2b53={},_0x59ab65={'count':0x0,'rows':[]};var _0x52e290=_[_0x8f31('0x2e')](db['Trigger']['rawAttributes'],function(_0x2132c1){return{'name':_0x2132c1[_0x8f31('0x2f')],'type':_0x2132c1[_0x8f31('0x30')][_0x8f31('0x31')]};});_0xd2b53[_0x8f31('0x32')]=_[_0x8f31('0x2e')](_0x52e290,_0x8f31('0x2c'));_0xd2b53[_0x8f31('0x33')]=_['keys'](_0x379dfd[_0x8f31('0x33')]);_0xd2b53['filters']=_[_0x8f31('0x34')](_0xd2b53[_0x8f31('0x32')],_0xd2b53[_0x8f31('0x33')]);_0x3734d1[_0x8f31('0x35')]=_[_0x8f31('0x34')](_0xd2b53[_0x8f31('0x32')],qs[_0x8f31('0x36')](_0x379dfd[_0x8f31('0x33')][_0x8f31('0x36')]));_0x3734d1['attributes']=_0x3734d1[_0x8f31('0x35')][_0x8f31('0x37')]?_0x3734d1['attributes']:_0xd2b53['model'];if(!_0x379dfd['query']['hasOwnProperty'](_0x8f31('0x38'))){_0x3734d1[_0x8f31('0x21')]=qs[_0x8f31('0x21')](_0x379dfd[_0x8f31('0x33')][_0x8f31('0x21')]);_0x3734d1[_0x8f31('0x20')]=qs['offset'](_0x379dfd['query']['offset']);}_0x3734d1[_0x8f31('0x39')]=qs[_0x8f31('0x3a')](_0x379dfd['query'][_0x8f31('0x3a')]);_0x3734d1[_0x8f31('0x3b')]=qs[_0x8f31('0x3c')](_[_0x8f31('0x3d')](_0x379dfd[_0x8f31('0x33')],_0xd2b53['filters']),_0x52e290);if(_0x379dfd['query']['filter']){_0x3734d1[_0x8f31('0x3b')]=_['merge'](_0x3734d1[_0x8f31('0x3b')],{'$or':_[_0x8f31('0x2e')](_0x52e290,function(_0x150c80){if(_0x150c80[_0x8f31('0x30')]!=='VIRTUAL'){var _0x422ce4={};_0x422ce4[_0x150c80[_0x8f31('0x2c')]]={'$like':'%'+_0x379dfd[_0x8f31('0x33')]['filter']+'%'};return _0x422ce4;}})});}_0x3734d1=_[_0x8f31('0x3e')]({},_0x3734d1,_0x379dfd[_0x8f31('0x3f')]);var _0x3d91fe={'where':_0x3734d1['where']};return db[_0x8f31('0x40')][_0x8f31('0x1f')](_0x3d91fe)[_0x8f31('0x26')](function(_0x1357a9){_0x59ab65['count']=_0x1357a9;if(_0x379dfd['query']['includeAll']){_0x3734d1[_0x8f31('0x41')]=[{'all':!![]}];}return db[_0x8f31('0x40')][_0x8f31('0x42')](_0x3734d1);})[_0x8f31('0x26')](function(_0x50606a){_0x59ab65[_0x8f31('0x43')]=_0x50606a;return _0x59ab65;})['then'](respondWithFilteredResult(_0x5e3020,_0x3734d1))[_0x8f31('0x44')](handleError(_0x5e3020,null));};exports[_0x8f31('0x45')]=function(_0x53c32c,_0x1e046){var _0x119cde={'raw':![],'where':{'id':_0x53c32c[_0x8f31('0x46')]['id']}},_0x2323d9={};_0x2323d9['model']=_[_0x8f31('0x47')](db['Trigger'][_0x8f31('0x48')]);_0x2323d9[_0x8f31('0x33')]=_['keys'](_0x53c32c[_0x8f31('0x33')]);_0x2323d9[_0x8f31('0x3c')]=_[_0x8f31('0x34')](_0x2323d9[_0x8f31('0x32')],_0x2323d9['query']);_0x119cde[_0x8f31('0x35')]=_[_0x8f31('0x34')](_0x2323d9[_0x8f31('0x32')],qs[_0x8f31('0x36')](_0x53c32c[_0x8f31('0x33')]['fields']));_0x119cde[_0x8f31('0x35')]=_0x119cde[_0x8f31('0x35')][_0x8f31('0x37')]?_0x119cde[_0x8f31('0x35')]:_0x2323d9[_0x8f31('0x32')];if(_0x53c32c[_0x8f31('0x33')]['includeAll']){_0x119cde[_0x8f31('0x41')]=[{'all':!![]}];}_0x119cde=_[_0x8f31('0x3e')]({},_0x119cde,_0x53c32c[_0x8f31('0x3f')]);return db['Trigger'][_0x8f31('0x49')](_0x119cde)['then'](handleEntityNotFound(_0x1e046,null))[_0x8f31('0x26')](respondWithResult(_0x1e046,null))['catch'](handleError(_0x1e046,null));};exports[_0x8f31('0x4a')]=function(_0x5cad2e,_0x99a1d2){return db[_0x8f31('0x40')][_0x8f31('0x4a')](_0x5cad2e['body'],{})[_0x8f31('0x26')](function(_0x1c71eb){var _0x2b173b=_0x5cad2e[_0x8f31('0x4b')][_0x8f31('0x28')]({'plain':!![]});if(!_0x2b173b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b173b['role']===_0x8f31('0x4b')){var _0x433c92=_0x1c71eb[_0x8f31('0x28')]({'plain':!![]});var _0x5682cd=_0x8f31('0x4c');return db[_0x8f31('0x4d')][_0x8f31('0x49')]({'where':{'name':_0x5682cd,'userProfileId':_0x2b173b[_0x8f31('0x4e')]},'raw':!![]})[_0x8f31('0x26')](function(_0x2abc36){if(_0x2abc36&&_0x2abc36[_0x8f31('0x4f')]===0x0){return db[_0x8f31('0x29')][_0x8f31('0x4a')]({'name':_0x433c92[_0x8f31('0x2c')],'resourceId':_0x433c92['id'],'type':_0x2abc36[_0x8f31('0x2c')],'sectionId':_0x2abc36['id']},{})[_0x8f31('0x26')](function(){return _0x1c71eb;});}else{return _0x1c71eb;}})[_0x8f31('0x44')](function(_0x15e282){logger[_0x8f31('0x2a')](_0x8f31('0x50'),_0x15e282);throw _0x15e282;});}return _0x1c71eb;})[_0x8f31('0x26')](respondWithResult(_0x99a1d2,0xc9))[_0x8f31('0x44')](handleError(_0x99a1d2,null));};exports[_0x8f31('0x25')]=function(_0x1d9e61,_0xcd183d){if(_0x1d9e61['body']['id']){delete _0x1d9e61['body']['id'];}return db[_0x8f31('0x40')][_0x8f31('0x49')]({'where':{'id':_0x1d9e61[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0xcd183d,null))[_0x8f31('0x26')](saveUpdates(_0x1d9e61['body'],null))[_0x8f31('0x26')](respondWithResult(_0xcd183d,null))[_0x8f31('0x44')](handleError(_0xcd183d,null));};exports[_0x8f31('0x27')]=function(_0x18a13a,_0x49283e){return db[_0x8f31('0x40')][_0x8f31('0x49')]({'where':{'id':_0x18a13a['params']['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x49283e,null))[_0x8f31('0x26')](removeEntity(_0x49283e,null))[_0x8f31('0x44')](handleError(_0x49283e,null));};exports[_0x8f31('0x51')]=function(_0x2cd115,_0x2a2ee9,_0x2cdeea){if(_0x2cd115[_0x8f31('0x52')]['id']){delete _0x2cd115[_0x8f31('0x52')]['id'];}return db[_0x8f31('0x40')]['find']({'where':{'id':_0x2cd115['params']['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x2a2ee9,null))['then'](function(_0x2c20c7){if(_0x2c20c7){_0x2cd115[_0x8f31('0x52')][_0x8f31('0x53')]=_0x2c20c7['id'];return db['Condition'][_0x8f31('0x4a')](_0x2cd115[_0x8f31('0x52')]);}})['then'](respondWithResult(_0x2a2ee9,null))[_0x8f31('0x44')](handleError(_0x2a2ee9,null));};exports[_0x8f31('0x54')]=function(_0x1d1c2b,_0x226ef6,_0x2f16a3){if(_0x1d1c2b['body']['id']){delete _0x1d1c2b['body']['id'];}return db[_0x8f31('0x40')][_0x8f31('0x49')]({'where':{'id':_0x1d1c2b[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x226ef6,null))[_0x8f31('0x26')](function(_0x5ed8b3){if(_0x5ed8b3){_0x1d1c2b[_0x8f31('0x52')]['TriggerAnyId']=_0x5ed8b3['id'];return db[_0x8f31('0x55')][_0x8f31('0x4a')](_0x1d1c2b[_0x8f31('0x52')]);}})['then'](respondWithResult(_0x226ef6,null))[_0x8f31('0x44')](handleError(_0x226ef6,null));};exports['getAllConditions']=function(_0x1815eb,_0x4bf401,_0x474294){var _0x302e0c={};var _0x190312={};var _0x2c03f8;var _0x2b49fc;return db[_0x8f31('0x40')]['findOne']({'where':{'id':_0x1815eb[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x4bf401,null))['then'](function(_0x49f7ab){if(_0x49f7ab){_0x2c03f8=_0x49f7ab;_0x190312['model']=_[_0x8f31('0x47')](db[_0x8f31('0x55')][_0x8f31('0x48')]);_0x190312[_0x8f31('0x33')]=_['keys'](_0x1815eb[_0x8f31('0x33')]);_0x190312['filters']=_['intersection'](_0x190312[_0x8f31('0x32')],_0x190312['query']);_0x302e0c[_0x8f31('0x35')]=_[_0x8f31('0x34')](_0x190312[_0x8f31('0x32')],qs['fields'](_0x1815eb[_0x8f31('0x33')][_0x8f31('0x36')]));_0x302e0c[_0x8f31('0x35')]=_0x302e0c[_0x8f31('0x35')]['length']?_0x302e0c['attributes']:_0x190312[_0x8f31('0x32')];_0x302e0c['order']=qs[_0x8f31('0x3a')](_0x1815eb[_0x8f31('0x33')]['sort']);_0x302e0c[_0x8f31('0x3b')]=qs[_0x8f31('0x3c')](_['pick'](_0x1815eb[_0x8f31('0x33')],_0x190312[_0x8f31('0x3c')]));if(_0x1815eb[_0x8f31('0x33')][_0x8f31('0x56')]){_0x302e0c['where']=_[_0x8f31('0x3e')](_0x302e0c[_0x8f31('0x3b')],{'$or':_[_0x8f31('0x2e')](_0x302e0c['attributes'],function(_0x147ef5){var _0x5ede0d={};_0x5ede0d[_0x147ef5]={'$like':'%'+_0x1815eb[_0x8f31('0x33')][_0x8f31('0x56')]+'%'};return _0x5ede0d;})});}_0x302e0c=_['merge']({},_0x302e0c,_0x1815eb['options']);return _0x2c03f8[_0x8f31('0x57')](_0x302e0c);}})[_0x8f31('0x26')](function(_0x145f46){if(_0x145f46){_0x2b49fc=_0x145f46[_0x8f31('0x37')];if(!_0x1815eb[_0x8f31('0x33')][_0x8f31('0x58')](_0x8f31('0x38'))){_0x302e0c[_0x8f31('0x21')]=qs[_0x8f31('0x21')](_0x1815eb[_0x8f31('0x33')][_0x8f31('0x21')]);_0x302e0c[_0x8f31('0x20')]=qs[_0x8f31('0x20')](_0x1815eb['query'][_0x8f31('0x20')]);}return _0x2c03f8[_0x8f31('0x57')](_0x302e0c);}})[_0x8f31('0x26')](function(_0x58a768){if(_0x58a768){return _0x58a768?{'count':_0x2b49fc,'rows':_0x58a768}:null;}})[_0x8f31('0x26')](respondWithResult(_0x4bf401,null))[_0x8f31('0x44')](handleError(_0x4bf401,null));};exports[_0x8f31('0x59')]=function(_0x3a2993,_0x75d8de,_0xdc56fc){var _0x210d13={};var _0x40c86d={};var _0x538dc6;var _0x173b35;return db[_0x8f31('0x40')][_0x8f31('0x5a')]({'where':{'id':_0x3a2993[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x75d8de,null))[_0x8f31('0x26')](function(_0x1b0eec){if(_0x1b0eec){_0x538dc6=_0x1b0eec;_0x40c86d[_0x8f31('0x32')]=_['keys'](db[_0x8f31('0x55')]['rawAttributes']);_0x40c86d[_0x8f31('0x33')]=_['keys'](_0x3a2993[_0x8f31('0x33')]);_0x40c86d['filters']=_['intersection'](_0x40c86d[_0x8f31('0x32')],_0x40c86d[_0x8f31('0x33')]);_0x210d13[_0x8f31('0x35')]=_['intersection'](_0x40c86d[_0x8f31('0x32')],qs[_0x8f31('0x36')](_0x3a2993[_0x8f31('0x33')][_0x8f31('0x36')]));_0x210d13[_0x8f31('0x35')]=_0x210d13[_0x8f31('0x35')][_0x8f31('0x37')]?_0x210d13[_0x8f31('0x35')]:_0x40c86d['model'];_0x210d13[_0x8f31('0x39')]=qs[_0x8f31('0x3a')](_0x3a2993[_0x8f31('0x33')][_0x8f31('0x3a')]);_0x210d13[_0x8f31('0x3b')]=qs[_0x8f31('0x3c')](_[_0x8f31('0x3d')](_0x3a2993[_0x8f31('0x33')],_0x40c86d[_0x8f31('0x3c')]));if(_0x3a2993[_0x8f31('0x33')][_0x8f31('0x56')]){_0x210d13[_0x8f31('0x3b')]=_[_0x8f31('0x3e')](_0x210d13[_0x8f31('0x3b')],{'$or':_[_0x8f31('0x2e')](_0x210d13[_0x8f31('0x35')],function(_0x344063){var _0x25a812={};_0x25a812[_0x344063]={'$like':'%'+_0x3a2993[_0x8f31('0x33')][_0x8f31('0x56')]+'%'};return _0x25a812;})});}_0x210d13=_['merge']({},_0x210d13,_0x3a2993[_0x8f31('0x3f')]);return _0x538dc6[_0x8f31('0x59')](_0x210d13);}})[_0x8f31('0x26')](function(_0xcc9555){if(_0xcc9555){_0x173b35=_0xcc9555['length'];if(!_0x3a2993[_0x8f31('0x33')][_0x8f31('0x58')](_0x8f31('0x38'))){_0x210d13[_0x8f31('0x21')]=qs[_0x8f31('0x21')](_0x3a2993['query'][_0x8f31('0x21')]);_0x210d13['offset']=qs[_0x8f31('0x20')](_0x3a2993['query'][_0x8f31('0x20')]);}return _0x538dc6['getAnyConditions'](_0x210d13);}})[_0x8f31('0x26')](function(_0x498d33){if(_0x498d33){return _0x498d33?{'count':_0x173b35,'rows':_0x498d33}:null;}})[_0x8f31('0x26')](respondWithResult(_0x75d8de,null))[_0x8f31('0x44')](handleError(_0x75d8de,null));};exports[_0x8f31('0x5b')]=function(_0x159007,_0xad1e84,_0x29407e){if(_0x159007[_0x8f31('0x52')]['id']){delete _0x159007['body']['id'];}return db[_0x8f31('0x40')][_0x8f31('0x49')]({'where':{'id':_0x159007[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0xad1e84,null))['then'](function(_0x2f7daa){if(_0x2f7daa){_0x159007[_0x8f31('0x52')]['TriggerId']=_0x2f7daa['id'];return db[_0x8f31('0x5c')][_0x8f31('0x4a')](_0x159007[_0x8f31('0x52')]);}})[_0x8f31('0x26')](respondWithResult(_0xad1e84,null))[_0x8f31('0x44')](handleError(_0xad1e84,null));};exports[_0x8f31('0x5d')]=function(_0x593543,_0x289ef3,_0x303d84){var _0x277891={};var _0x173f57={};var _0x448187;var _0xb55436;return db[_0x8f31('0x40')][_0x8f31('0x5a')]({'where':{'id':_0x593543[_0x8f31('0x46')]['id']}})[_0x8f31('0x26')](handleEntityNotFound(_0x289ef3,null))[_0x8f31('0x26')](function(_0x160bb2){if(_0x160bb2){_0x448187=_0x160bb2;_0x173f57[_0x8f31('0x32')]=_[_0x8f31('0x47')](db[_0x8f31('0x5c')][_0x8f31('0x48')]);_0x173f57['query']=_['keys'](_0x593543[_0x8f31('0x33')]);_0x173f57['filters']=_[_0x8f31('0x34')](_0x173f57[_0x8f31('0x32')],_0x173f57[_0x8f31('0x33')]);_0x277891['attributes']=_[_0x8f31('0x34')](_0x173f57[_0x8f31('0x32')],qs['fields'](_0x593543[_0x8f31('0x33')]['fields']));_0x277891['attributes']=_0x277891[_0x8f31('0x35')][_0x8f31('0x37')]?_0x277891[_0x8f31('0x35')]:_0x173f57[_0x8f31('0x32')];_0x277891[_0x8f31('0x39')]=qs[_0x8f31('0x3a')](_0x593543['query'][_0x8f31('0x3a')]);_0x277891[_0x8f31('0x3b')]=qs[_0x8f31('0x3c')](_['pick'](_0x593543[_0x8f31('0x33')],_0x173f57[_0x8f31('0x3c')]));if(_0x593543[_0x8f31('0x33')][_0x8f31('0x56')]){_0x277891['where']=_[_0x8f31('0x3e')](_0x277891[_0x8f31('0x3b')],{'$or':_[_0x8f31('0x2e')](_0x277891[_0x8f31('0x35')],function(_0x5bcc2c){var _0x298c96={};_0x298c96[_0x5bcc2c]={'$like':'%'+_0x593543[_0x8f31('0x33')][_0x8f31('0x56')]+'%'};return _0x298c96;})});}_0x277891=_[_0x8f31('0x3e')]({},_0x277891,_0x593543[_0x8f31('0x3f')]);return _0x448187[_0x8f31('0x5d')](_0x277891);}})[_0x8f31('0x26')](function(_0x17de2f){if(_0x17de2f){_0xb55436=_0x17de2f[_0x8f31('0x37')];if(!_0x593543[_0x8f31('0x33')][_0x8f31('0x58')](_0x8f31('0x38'))){_0x277891[_0x8f31('0x21')]=qs['limit'](_0x593543[_0x8f31('0x33')][_0x8f31('0x21')]);_0x277891[_0x8f31('0x20')]=qs['offset'](_0x593543['query'][_0x8f31('0x20')]);}return _0x448187[_0x8f31('0x5d')](_0x277891);}})['then'](function(_0x22922a){if(_0x22922a){return _0x22922a?{'count':_0xb55436,'rows':_0x22922a}:null;}})[_0x8f31('0x26')](respondWithResult(_0x289ef3,null))[_0x8f31('0x44')](handleError(_0x289ef3,null));};
\ No newline at end of file
+var _0x0e8f=['addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','sort','getAnyConditions','getActions','rimraf','zip-dir','fast-json-patch','bluebird','util','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','get','Triggers','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','Trigger','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x20366e,_0x450fd1){var _0x4bc6eb=function(_0x16d07b){while(--_0x16d07b){_0x20366e['push'](_0x20366e['shift']());}};_0x4bc6eb(++_0x450fd1);}(_0x0e8f,0x1c2));var _0xf0e8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0e8f[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0e8('0x0'));var zipdir=require(_0xf0e8('0x1'));var jsonpatch=require(_0xf0e8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0e8('0x3'));var Mustache=require('mustache');var util=require(_0xf0e8('0x4'));var path=require(_0xf0e8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0e8('0x6'));var _=require('lodash');var squel=require(_0xf0e8('0x7'));var crypto=require(_0xf0e8('0x8'));var jsforce=require(_0xf0e8('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf0e8('0xa'));var querystring=require(_0xf0e8('0xb'));var Papa=require(_0xf0e8('0xc'));var Redis=require('ioredis');var authService=require(_0xf0e8('0xd'));var qs=require(_0xf0e8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0e8('0xf'))(_0xf0e8('0x10'));var utils=require(_0xf0e8('0x11'));var config=require(_0xf0e8('0x12'));var licenseUtil=require(_0xf0e8('0x13'));var db=require(_0xf0e8('0x14'))['db'];function respondWithStatusCode(_0x3a0a9b,_0x98568f){_0x98568f=_0x98568f||0xcc;return function(_0x51d2f6){if(_0x51d2f6){return _0x3a0a9b['sendStatus'](_0x98568f);}return _0x3a0a9b[_0xf0e8('0x15')](_0x98568f)[_0xf0e8('0x16')]();};}function respondWithResult(_0x2ec4ab,_0x1f56ac){_0x1f56ac=_0x1f56ac||0xc8;return function(_0x4bd69b){if(_0x4bd69b){return _0x2ec4ab[_0xf0e8('0x15')](_0x1f56ac)['json'](_0x4bd69b);}};}function respondWithFilteredResult(_0x53988f,_0x1ad430){return function(_0x1cc8fd){if(_0x1cc8fd){var _0x101e81=typeof _0x1ad430[_0xf0e8('0x17')]===_0xf0e8('0x18')&&typeof _0x1ad430[_0xf0e8('0x19')]===_0xf0e8('0x18');var _0x5b8f5b=_0x1cc8fd[_0xf0e8('0x1a')];var _0xb8a464=_0x101e81?0x0:_0x1ad430[_0xf0e8('0x17')];var _0x3d958d=_0x101e81?_0x1cc8fd['count']:_0x1ad430[_0xf0e8('0x17')]+_0x1ad430[_0xf0e8('0x19')];var _0x3346d9;if(_0x3d958d>=_0x5b8f5b){_0x3d958d=_0x5b8f5b;_0x3346d9=0xc8;}else{_0x3346d9=0xce;}_0x53988f['status'](_0x3346d9);return _0x53988f[_0xf0e8('0x1b')](_0xf0e8('0x1c'),_0xb8a464+'-'+_0x3d958d+'/'+_0x5b8f5b)[_0xf0e8('0x1d')](_0x1cc8fd);}return null;};}function patchUpdates(_0x4e8b77){return function(_0x5b22d0){try{jsonpatch['apply'](_0x5b22d0,_0x4e8b77,!![]);}catch(_0x28f445){return BPromise[_0xf0e8('0x1e')](_0x28f445);}return _0x5b22d0[_0xf0e8('0x1f')]();};}function saveUpdates(_0x1b4e40,_0x4b0149){return function(_0x51f5ae){if(_0x51f5ae){return _0x51f5ae['update'](_0x1b4e40)['then'](function(_0x4aafa5){return _0x4aafa5;});}return null;};}function removeEntity(_0xcc2727,_0x541bb6){return function(_0x910bb){if(_0x910bb){return _0x910bb[_0xf0e8('0x20')]()[_0xf0e8('0x21')](function(){var _0x44e161=_0x910bb[_0xf0e8('0x22')]({'plain':!![]});var _0x216786=_0xf0e8('0x23');return db[_0xf0e8('0x24')][_0xf0e8('0x20')]({'where':{'type':_0x216786,'resourceId':_0x44e161['id']}})[_0xf0e8('0x21')](function(){return _0x910bb;});})[_0xf0e8('0x21')](function(){_0xcc2727[_0xf0e8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b10ea,_0x58455d){return function(_0x275ed1){if(!_0x275ed1){_0x1b10ea[_0xf0e8('0x25')](0x194);}return _0x275ed1;};}function handleError(_0x595d7c,_0x539f4e){_0x539f4e=_0x539f4e||0x1f4;return function(_0x5d17eb){logger[_0xf0e8('0x26')](_0x5d17eb[_0xf0e8('0x27')]);if(_0x5d17eb[_0xf0e8('0x28')]){delete _0x5d17eb['name'];}_0x595d7c['status'](_0x539f4e)['send'](_0x5d17eb);};}exports['index']=function(_0xdcef4f,_0x1d8bdf){var _0x55e5={},_0x5cbc27={},_0x2e7160={'count':0x0,'rows':[]};var _0x11ea26=_[_0xf0e8('0x29')](db['Trigger'][_0xf0e8('0x2a')],function(_0x25bf4a){return{'name':_0x25bf4a['fieldName'],'type':_0x25bf4a[_0xf0e8('0x2b')][_0xf0e8('0x2c')]};});_0x5cbc27[_0xf0e8('0x2d')]=_[_0xf0e8('0x29')](_0x11ea26,_0xf0e8('0x28'));_0x5cbc27[_0xf0e8('0x2e')]=_[_0xf0e8('0x2f')](_0xdcef4f[_0xf0e8('0x2e')]);_0x5cbc27['filters']=_[_0xf0e8('0x30')](_0x5cbc27[_0xf0e8('0x2d')],_0x5cbc27[_0xf0e8('0x2e')]);_0x55e5['attributes']=_[_0xf0e8('0x30')](_0x5cbc27[_0xf0e8('0x2d')],qs[_0xf0e8('0x31')](_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x31')]));_0x55e5[_0xf0e8('0x32')]=_0x55e5['attributes']['length']?_0x55e5['attributes']:_0x5cbc27[_0xf0e8('0x2d')];if(!_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x33')](_0xf0e8('0x34'))){_0x55e5[_0xf0e8('0x19')]=qs[_0xf0e8('0x19')](_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x19')]);_0x55e5[_0xf0e8('0x17')]=qs[_0xf0e8('0x17')](_0xdcef4f[_0xf0e8('0x2e')]['offset']);}_0x55e5[_0xf0e8('0x35')]=qs['sort'](_0xdcef4f[_0xf0e8('0x2e')]['sort']);_0x55e5[_0xf0e8('0x36')]=qs[_0xf0e8('0x37')](_[_0xf0e8('0x38')](_0xdcef4f['query'],_0x5cbc27[_0xf0e8('0x37')]),_0x11ea26);if(_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x39')]){_0x55e5[_0xf0e8('0x36')]=_[_0xf0e8('0x3a')](_0x55e5['where'],{'$or':_[_0xf0e8('0x29')](_0x11ea26,function(_0x95df15){if(_0x95df15[_0xf0e8('0x2b')]!==_0xf0e8('0x3b')){var _0x11ad28={};_0x11ad28[_0x95df15[_0xf0e8('0x28')]]={'$like':'%'+_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x39')]+'%'};return _0x11ad28;}})});}_0x55e5=_[_0xf0e8('0x3a')]({},_0x55e5,_0xdcef4f[_0xf0e8('0x3c')]);var _0x5d6c96={'where':_0x55e5[_0xf0e8('0x36')]};return db['Trigger'][_0xf0e8('0x1a')](_0x5d6c96)[_0xf0e8('0x21')](function(_0x34c287){_0x2e7160['count']=_0x34c287;if(_0xdcef4f[_0xf0e8('0x2e')][_0xf0e8('0x3d')]){_0x55e5[_0xf0e8('0x3e')]=[{'all':!![]}];}return db[_0xf0e8('0x3f')][_0xf0e8('0x40')](_0x55e5);})['then'](function(_0x515d4a){_0x2e7160[_0xf0e8('0x41')]=_0x515d4a;return _0x2e7160;})[_0xf0e8('0x21')](respondWithFilteredResult(_0x1d8bdf,_0x55e5))['catch'](handleError(_0x1d8bdf,null));};exports[_0xf0e8('0x42')]=function(_0x4f936f,_0x75b2ec){var _0x590315={'raw':![],'where':{'id':_0x4f936f[_0xf0e8('0x43')]['id']}},_0x3bbb9d={};_0x3bbb9d['model']=_['keys'](db['Trigger'][_0xf0e8('0x2a')]);_0x3bbb9d[_0xf0e8('0x2e')]=_[_0xf0e8('0x2f')](_0x4f936f[_0xf0e8('0x2e')]);_0x3bbb9d['filters']=_['intersection'](_0x3bbb9d[_0xf0e8('0x2d')],_0x3bbb9d[_0xf0e8('0x2e')]);_0x590315[_0xf0e8('0x32')]=_['intersection'](_0x3bbb9d[_0xf0e8('0x2d')],qs['fields'](_0x4f936f['query'][_0xf0e8('0x31')]));_0x590315[_0xf0e8('0x32')]=_0x590315['attributes'][_0xf0e8('0x44')]?_0x590315[_0xf0e8('0x32')]:_0x3bbb9d[_0xf0e8('0x2d')];if(_0x4f936f[_0xf0e8('0x2e')][_0xf0e8('0x3d')]){_0x590315[_0xf0e8('0x3e')]=[{'all':!![]}];}_0x590315=_['merge']({},_0x590315,_0x4f936f['options']);return db[_0xf0e8('0x3f')][_0xf0e8('0x45')](_0x590315)['then'](handleEntityNotFound(_0x75b2ec,null))[_0xf0e8('0x21')](respondWithResult(_0x75b2ec,null))[_0xf0e8('0x46')](handleError(_0x75b2ec,null));};exports[_0xf0e8('0x47')]=function(_0x580bf4,_0xd906af){return db[_0xf0e8('0x3f')][_0xf0e8('0x47')](_0x580bf4['body'],{})[_0xf0e8('0x21')](function(_0x5dc949){var _0x29ce54=_0x580bf4[_0xf0e8('0x48')]['get']({'plain':!![]});if(!_0x29ce54)throw new Error(_0xf0e8('0x49'));if(_0x29ce54['role']==='user'){var _0x20dd33=_0x5dc949[_0xf0e8('0x22')]({'plain':!![]});var _0x2676b0=_0xf0e8('0x23');return db[_0xf0e8('0x4a')][_0xf0e8('0x45')]({'where':{'name':_0x2676b0,'userProfileId':_0x29ce54['userProfileId']},'raw':!![]})[_0xf0e8('0x21')](function(_0x1117c9){if(_0x1117c9&&_0x1117c9[_0xf0e8('0x4b')]===0x0){return db[_0xf0e8('0x24')]['create']({'name':_0x20dd33[_0xf0e8('0x28')],'resourceId':_0x20dd33['id'],'type':_0x1117c9['name'],'sectionId':_0x1117c9['id']},{})['then'](function(){return _0x5dc949;});}else{return _0x5dc949;}})[_0xf0e8('0x46')](function(_0x5f1284){logger[_0xf0e8('0x26')](_0xf0e8('0x4c'),_0x5f1284);throw _0x5f1284;});}return _0x5dc949;})['then'](respondWithResult(_0xd906af,0xc9))[_0xf0e8('0x46')](handleError(_0xd906af,null));};exports['update']=function(_0x15b6c,_0x1fd9da){if(_0x15b6c[_0xf0e8('0x4d')]['id']){delete _0x15b6c[_0xf0e8('0x4d')]['id'];}return db[_0xf0e8('0x3f')][_0xf0e8('0x45')]({'where':{'id':_0x15b6c[_0xf0e8('0x43')]['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x1fd9da,null))[_0xf0e8('0x21')](saveUpdates(_0x15b6c[_0xf0e8('0x4d')],null))['then'](respondWithResult(_0x1fd9da,null))[_0xf0e8('0x46')](handleError(_0x1fd9da,null));};exports[_0xf0e8('0x20')]=function(_0x385e78,_0x548afa){return db['Trigger']['find']({'where':{'id':_0x385e78[_0xf0e8('0x43')]['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x548afa,null))['then'](removeEntity(_0x548afa,null))[_0xf0e8('0x46')](handleError(_0x548afa,null));};exports[_0xf0e8('0x4e')]=function(_0x5215d5,_0x983a5b,_0x4af231){if(_0x5215d5[_0xf0e8('0x4d')]['id']){delete _0x5215d5[_0xf0e8('0x4d')]['id'];}return db[_0xf0e8('0x3f')][_0xf0e8('0x45')]({'where':{'id':_0x5215d5[_0xf0e8('0x43')]['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x983a5b,null))[_0xf0e8('0x21')](function(_0x3d97ee){if(_0x3d97ee){_0x5215d5[_0xf0e8('0x4d')][_0xf0e8('0x4f')]=_0x3d97ee['id'];return db['Condition'][_0xf0e8('0x47')](_0x5215d5[_0xf0e8('0x4d')]);}})[_0xf0e8('0x21')](respondWithResult(_0x983a5b,null))[_0xf0e8('0x46')](handleError(_0x983a5b,null));};exports[_0xf0e8('0x50')]=function(_0x477122,_0x2c504f,_0x554cfe){if(_0x477122['body']['id']){delete _0x477122[_0xf0e8('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x477122['params']['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x2c504f,null))[_0xf0e8('0x21')](function(_0x39882b){if(_0x39882b){_0x477122[_0xf0e8('0x4d')][_0xf0e8('0x51')]=_0x39882b['id'];return db[_0xf0e8('0x52')][_0xf0e8('0x47')](_0x477122[_0xf0e8('0x4d')]);}})[_0xf0e8('0x21')](respondWithResult(_0x2c504f,null))[_0xf0e8('0x46')](handleError(_0x2c504f,null));};exports[_0xf0e8('0x53')]=function(_0x730e39,_0xea02ac,_0xe1a886){var _0x1894a7={};var _0x45ea33={};var _0x154f4e;var _0x3ed3b3;return db['Trigger'][_0xf0e8('0x54')]({'where':{'id':_0x730e39[_0xf0e8('0x43')]['id']}})['then'](handleEntityNotFound(_0xea02ac,null))['then'](function(_0x881109){if(_0x881109){_0x154f4e=_0x881109;_0x45ea33[_0xf0e8('0x2d')]=_['keys'](db['Condition'][_0xf0e8('0x2a')]);_0x45ea33[_0xf0e8('0x2e')]=_[_0xf0e8('0x2f')](_0x730e39['query']);_0x45ea33[_0xf0e8('0x37')]=_[_0xf0e8('0x30')](_0x45ea33['model'],_0x45ea33['query']);_0x1894a7[_0xf0e8('0x32')]=_[_0xf0e8('0x30')](_0x45ea33[_0xf0e8('0x2d')],qs['fields'](_0x730e39[_0xf0e8('0x2e')]['fields']));_0x1894a7['attributes']=_0x1894a7[_0xf0e8('0x32')][_0xf0e8('0x44')]?_0x1894a7[_0xf0e8('0x32')]:_0x45ea33[_0xf0e8('0x2d')];_0x1894a7['order']=qs[_0xf0e8('0x55')](_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x55')]);_0x1894a7[_0xf0e8('0x36')]=qs['filters'](_['pick'](_0x730e39['query'],_0x45ea33['filters']));if(_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x39')]){_0x1894a7[_0xf0e8('0x36')]=_[_0xf0e8('0x3a')](_0x1894a7[_0xf0e8('0x36')],{'$or':_['map'](_0x1894a7[_0xf0e8('0x32')],function(_0x232317){var _0x3a9dba={};_0x3a9dba[_0x232317]={'$like':'%'+_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x39')]+'%'};return _0x3a9dba;})});}_0x1894a7=_[_0xf0e8('0x3a')]({},_0x1894a7,_0x730e39[_0xf0e8('0x3c')]);return _0x154f4e[_0xf0e8('0x53')](_0x1894a7);}})[_0xf0e8('0x21')](function(_0x53050e){if(_0x53050e){_0x3ed3b3=_0x53050e[_0xf0e8('0x44')];if(!_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x33')](_0xf0e8('0x34'))){_0x1894a7['limit']=qs['limit'](_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x19')]);_0x1894a7['offset']=qs['offset'](_0x730e39[_0xf0e8('0x2e')][_0xf0e8('0x17')]);}return _0x154f4e[_0xf0e8('0x53')](_0x1894a7);}})['then'](function(_0x1eaf83){if(_0x1eaf83){return _0x1eaf83?{'count':_0x3ed3b3,'rows':_0x1eaf83}:null;}})[_0xf0e8('0x21')](respondWithResult(_0xea02ac,null))[_0xf0e8('0x46')](handleError(_0xea02ac,null));};exports[_0xf0e8('0x56')]=function(_0x4a789e,_0x397ea1,_0x359524){var _0x1ad7e6={};var _0xbe1f95={};var _0x1b4ccb;var _0x5f5c59;return db[_0xf0e8('0x3f')][_0xf0e8('0x54')]({'where':{'id':_0x4a789e[_0xf0e8('0x43')]['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x397ea1,null))['then'](function(_0x45c221){if(_0x45c221){_0x1b4ccb=_0x45c221;_0xbe1f95['model']=_[_0xf0e8('0x2f')](db[_0xf0e8('0x52')]['rawAttributes']);_0xbe1f95[_0xf0e8('0x2e')]=_['keys'](_0x4a789e[_0xf0e8('0x2e')]);_0xbe1f95[_0xf0e8('0x37')]=_[_0xf0e8('0x30')](_0xbe1f95['model'],_0xbe1f95[_0xf0e8('0x2e')]);_0x1ad7e6[_0xf0e8('0x32')]=_['intersection'](_0xbe1f95[_0xf0e8('0x2d')],qs[_0xf0e8('0x31')](_0x4a789e[_0xf0e8('0x2e')][_0xf0e8('0x31')]));_0x1ad7e6[_0xf0e8('0x32')]=_0x1ad7e6[_0xf0e8('0x32')][_0xf0e8('0x44')]?_0x1ad7e6[_0xf0e8('0x32')]:_0xbe1f95[_0xf0e8('0x2d')];_0x1ad7e6[_0xf0e8('0x35')]=qs[_0xf0e8('0x55')](_0x4a789e['query'][_0xf0e8('0x55')]);_0x1ad7e6[_0xf0e8('0x36')]=qs[_0xf0e8('0x37')](_[_0xf0e8('0x38')](_0x4a789e[_0xf0e8('0x2e')],_0xbe1f95['filters']));if(_0x4a789e[_0xf0e8('0x2e')]['filter']){_0x1ad7e6[_0xf0e8('0x36')]=_[_0xf0e8('0x3a')](_0x1ad7e6['where'],{'$or':_[_0xf0e8('0x29')](_0x1ad7e6['attributes'],function(_0x114bdb){var _0x5c32d1={};_0x5c32d1[_0x114bdb]={'$like':'%'+_0x4a789e[_0xf0e8('0x2e')]['filter']+'%'};return _0x5c32d1;})});}_0x1ad7e6=_[_0xf0e8('0x3a')]({},_0x1ad7e6,_0x4a789e[_0xf0e8('0x3c')]);return _0x1b4ccb[_0xf0e8('0x56')](_0x1ad7e6);}})[_0xf0e8('0x21')](function(_0x3149e7){if(_0x3149e7){_0x5f5c59=_0x3149e7[_0xf0e8('0x44')];if(!_0x4a789e[_0xf0e8('0x2e')][_0xf0e8('0x33')]('nolimit')){_0x1ad7e6['limit']=qs['limit'](_0x4a789e['query'][_0xf0e8('0x19')]);_0x1ad7e6[_0xf0e8('0x17')]=qs['offset'](_0x4a789e[_0xf0e8('0x2e')][_0xf0e8('0x17')]);}return _0x1b4ccb['getAnyConditions'](_0x1ad7e6);}})[_0xf0e8('0x21')](function(_0x41dd0a){if(_0x41dd0a){return _0x41dd0a?{'count':_0x5f5c59,'rows':_0x41dd0a}:null;}})[_0xf0e8('0x21')](respondWithResult(_0x397ea1,null))['catch'](handleError(_0x397ea1,null));};exports['addAction']=function(_0x4efd4b,_0x4c59a9,_0x96229a){if(_0x4efd4b[_0xf0e8('0x4d')]['id']){delete _0x4efd4b[_0xf0e8('0x4d')]['id'];}return db[_0xf0e8('0x3f')][_0xf0e8('0x45')]({'where':{'id':_0x4efd4b[_0xf0e8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c59a9,null))['then'](function(_0x52906a){if(_0x52906a){_0x4efd4b[_0xf0e8('0x4d')]['TriggerId']=_0x52906a['id'];return db['Action'][_0xf0e8('0x47')](_0x4efd4b[_0xf0e8('0x4d')]);}})[_0xf0e8('0x21')](respondWithResult(_0x4c59a9,null))[_0xf0e8('0x46')](handleError(_0x4c59a9,null));};exports[_0xf0e8('0x57')]=function(_0x57fc67,_0x27d6e4,_0x476ba7){var _0x2c51b3={};var _0x5a7dcb={};var _0x322ef4;var _0xad380d;return db[_0xf0e8('0x3f')][_0xf0e8('0x54')]({'where':{'id':_0x57fc67[_0xf0e8('0x43')]['id']}})[_0xf0e8('0x21')](handleEntityNotFound(_0x27d6e4,null))['then'](function(_0x159449){if(_0x159449){_0x322ef4=_0x159449;_0x5a7dcb[_0xf0e8('0x2d')]=_['keys'](db['Action'][_0xf0e8('0x2a')]);_0x5a7dcb[_0xf0e8('0x2e')]=_[_0xf0e8('0x2f')](_0x57fc67[_0xf0e8('0x2e')]);_0x5a7dcb['filters']=_['intersection'](_0x5a7dcb[_0xf0e8('0x2d')],_0x5a7dcb[_0xf0e8('0x2e')]);_0x2c51b3[_0xf0e8('0x32')]=_[_0xf0e8('0x30')](_0x5a7dcb[_0xf0e8('0x2d')],qs[_0xf0e8('0x31')](_0x57fc67['query'][_0xf0e8('0x31')]));_0x2c51b3['attributes']=_0x2c51b3['attributes'][_0xf0e8('0x44')]?_0x2c51b3[_0xf0e8('0x32')]:_0x5a7dcb['model'];_0x2c51b3['order']=qs[_0xf0e8('0x55')](_0x57fc67[_0xf0e8('0x2e')][_0xf0e8('0x55')]);_0x2c51b3['where']=qs[_0xf0e8('0x37')](_['pick'](_0x57fc67[_0xf0e8('0x2e')],_0x5a7dcb[_0xf0e8('0x37')]));if(_0x57fc67[_0xf0e8('0x2e')][_0xf0e8('0x39')]){_0x2c51b3[_0xf0e8('0x36')]=_[_0xf0e8('0x3a')](_0x2c51b3[_0xf0e8('0x36')],{'$or':_[_0xf0e8('0x29')](_0x2c51b3[_0xf0e8('0x32')],function(_0x13117c){var _0x49d5f4={};_0x49d5f4[_0x13117c]={'$like':'%'+_0x57fc67[_0xf0e8('0x2e')][_0xf0e8('0x39')]+'%'};return _0x49d5f4;})});}_0x2c51b3=_[_0xf0e8('0x3a')]({},_0x2c51b3,_0x57fc67['options']);return _0x322ef4['getActions'](_0x2c51b3);}})[_0xf0e8('0x21')](function(_0x300494){if(_0x300494){_0xad380d=_0x300494[_0xf0e8('0x44')];if(!_0x57fc67['query']['hasOwnProperty'](_0xf0e8('0x34'))){_0x2c51b3[_0xf0e8('0x19')]=qs['limit'](_0x57fc67[_0xf0e8('0x2e')][_0xf0e8('0x19')]);_0x2c51b3[_0xf0e8('0x17')]=qs[_0xf0e8('0x17')](_0x57fc67['query'][_0xf0e8('0x17')]);}return _0x322ef4[_0xf0e8('0x57')](_0x2c51b3);}})[_0xf0e8('0x21')](function(_0x37dc8a){if(_0x37dc8a){return _0x37dc8a?{'count':_0xad380d,'rows':_0x37dc8a}:null;}})['then'](respondWithResult(_0x27d6e4,null))[_0xf0e8('0x46')](handleError(_0x27d6e4,null));};
\ No newline at end of file