Built motion from commit 449495f6.|2.6.27
[motion2.git] / server / api / trigger / trigger.controller.js
index 71f788c..c28d131 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c8f=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','UserProfileResource','destroy','end','stack','name','send','map','Trigger','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','update','body','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','rawAttributes','hasOwnProperty','getAnyConditions','findOne','addAction','TriggerId','Action','getActions'];(function(_0x57ec06,_0x2184c0){var _0x4c1cbc=function(_0x4abe26){while(--_0x4abe26){_0x57ec06['push'](_0x57ec06['shift']());}};_0x4c1cbc(++_0x2184c0);}(_0x9c8f,0x1e5));var _0xf9c8=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x9c8f[_0x41382c];return _0x4da35b;};'use strict';var emlformat=require(_0xf9c8('0x0'));var rimraf=require(_0xf9c8('0x1'));var zipdir=require(_0xf9c8('0x2'));var jsonpatch=require(_0xf9c8('0x3'));var rp=require('request-promise');var moment=require(_0xf9c8('0x4'));var BPromise=require(_0xf9c8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf9c8('0x6'));var sox=require(_0xf9c8('0x7'));var csv=require(_0xf9c8('0x8'));var ejs=require(_0xf9c8('0x9'));var fs=require('fs');var fs_extra=require(_0xf9c8('0xa'));var _=require(_0xf9c8('0xb'));var squel=require('squel');var crypto=require(_0xf9c8('0xc'));var jsforce=require(_0xf9c8('0xd'));var deskjs=require(_0xf9c8('0xe'));var toCsv=require(_0xf9c8('0x8'));var querystring=require(_0xf9c8('0xf'));var Papa=require(_0xf9c8('0x10'));var Redis=require('ioredis');var authService=require(_0xf9c8('0x11'));var qs=require(_0xf9c8('0x12'));var as=require(_0xf9c8('0x13'));var hardwareService=require(_0xf9c8('0x14'));var logger=require(_0xf9c8('0x15'))('api');var utils=require(_0xf9c8('0x16'));var config=require(_0xf9c8('0x17'));var licenseUtil=require(_0xf9c8('0x18'));var db=require(_0xf9c8('0x19'))['db'];function respondWithStatusCode(_0x12a46d,_0x14a50d){_0x14a50d=_0x14a50d||0xcc;return function(_0x5429c1){if(_0x5429c1){return _0x12a46d[_0xf9c8('0x1a')](_0x14a50d);}return _0x12a46d['status'](_0x14a50d)['end']();};}function respondWithResult(_0x1c16c1,_0x17bd5c){_0x17bd5c=_0x17bd5c||0xc8;return function(_0x4d9c18){if(_0x4d9c18){return _0x1c16c1[_0xf9c8('0x1b')](_0x17bd5c)[_0xf9c8('0x1c')](_0x4d9c18);}};}function respondWithFilteredResult(_0x1297d9,_0x464ad4){return function(_0x37ed35){if(_0x37ed35){var _0x32640e=typeof _0x464ad4['offset']===_0xf9c8('0x1d')&&typeof _0x464ad4[_0xf9c8('0x1e')]===_0xf9c8('0x1d');var _0x52475b=_0x37ed35[_0xf9c8('0x1f')];var _0x35be0f=_0x32640e?0x0:_0x464ad4[_0xf9c8('0x20')];var _0x2daf97=_0x32640e?_0x37ed35[_0xf9c8('0x1f')]:_0x464ad4['offset']+_0x464ad4[_0xf9c8('0x1e')];var _0x5c001e;if(_0x2daf97>=_0x52475b){_0x2daf97=_0x52475b;_0x5c001e=0xc8;}else{_0x5c001e=0xce;}_0x1297d9['status'](_0x5c001e);return _0x1297d9[_0xf9c8('0x21')]('Content-Range',_0x35be0f+'-'+_0x2daf97+'/'+_0x52475b)[_0xf9c8('0x1c')](_0x37ed35);}return null;};}function patchUpdates(_0x517d5d){return function(_0x29a430){try{jsonpatch[_0xf9c8('0x22')](_0x29a430,_0x517d5d,!![]);}catch(_0x464d28){return BPromise[_0xf9c8('0x23')](_0x464d28);}return _0x29a430[_0xf9c8('0x24')]();};}function saveUpdates(_0xd5087c,_0x300b2a){return function(_0x357650){if(_0x357650){return _0x357650['update'](_0xd5087c)[_0xf9c8('0x25')](function(_0x43a448){return _0x43a448;});}return null;};}function removeEntity(_0x371afa,_0x4b1514){return function(_0x2807f2){if(_0x2807f2){return _0x2807f2['destroy']()[_0xf9c8('0x25')](function(){var _0x5d8159=_0x2807f2['get']({'plain':!![]});var _0x4e5741='Triggers';return db[_0xf9c8('0x26')][_0xf9c8('0x27')]({'where':{'type':_0x4e5741,'resourceId':_0x5d8159['id']}})[_0xf9c8('0x25')](function(){return _0x2807f2;});})[_0xf9c8('0x25')](function(){_0x371afa[_0xf9c8('0x1b')](0xcc)[_0xf9c8('0x28')]();});}};}function handleEntityNotFound(_0x3f8f7b,_0x29b181){return function(_0x5e85e5){if(!_0x5e85e5){_0x3f8f7b[_0xf9c8('0x1a')](0x194);}return _0x5e85e5;};}function handleError(_0x3d6e0f,_0x287337){_0x287337=_0x287337||0x1f4;return function(_0x5c6864){logger['error'](_0x5c6864[_0xf9c8('0x29')]);if(_0x5c6864[_0xf9c8('0x2a')]){delete _0x5c6864['name'];}_0x3d6e0f['status'](_0x287337)[_0xf9c8('0x2b')](_0x5c6864);};}exports['index']=function(_0x13d05d,_0x16c292){var _0x275080={},_0x25bf1c={},_0x56e895={'count':0x0,'rows':[]};var _0x1d5c75=_[_0xf9c8('0x2c')](db[_0xf9c8('0x2d')]['rawAttributes'],function(_0x5c65dc){return{'name':_0x5c65dc[_0xf9c8('0x2e')],'type':_0x5c65dc[_0xf9c8('0x2f')][_0xf9c8('0x30')]};});_0x25bf1c[_0xf9c8('0x31')]=_[_0xf9c8('0x2c')](_0x1d5c75,_0xf9c8('0x2a'));_0x25bf1c['query']=_[_0xf9c8('0x32')](_0x13d05d[_0xf9c8('0x33')]);_0x25bf1c['filters']=_[_0xf9c8('0x34')](_0x25bf1c[_0xf9c8('0x31')],_0x25bf1c[_0xf9c8('0x33')]);_0x275080[_0xf9c8('0x35')]=_[_0xf9c8('0x34')](_0x25bf1c['model'],qs[_0xf9c8('0x36')](_0x13d05d[_0xf9c8('0x33')][_0xf9c8('0x36')]));_0x275080[_0xf9c8('0x35')]=_0x275080[_0xf9c8('0x35')]['length']?_0x275080[_0xf9c8('0x35')]:_0x25bf1c[_0xf9c8('0x31')];if(!_0x13d05d[_0xf9c8('0x33')]['hasOwnProperty'](_0xf9c8('0x37'))){_0x275080[_0xf9c8('0x1e')]=qs[_0xf9c8('0x1e')](_0x13d05d['query'][_0xf9c8('0x1e')]);_0x275080[_0xf9c8('0x20')]=qs[_0xf9c8('0x20')](_0x13d05d['query']['offset']);}_0x275080[_0xf9c8('0x38')]=qs[_0xf9c8('0x39')](_0x13d05d[_0xf9c8('0x33')][_0xf9c8('0x39')]);_0x275080[_0xf9c8('0x3a')]=qs[_0xf9c8('0x3b')](_[_0xf9c8('0x3c')](_0x13d05d['query'],_0x25bf1c[_0xf9c8('0x3b')]),_0x1d5c75);if(_0x13d05d[_0xf9c8('0x33')][_0xf9c8('0x3d')]){_0x275080[_0xf9c8('0x3a')]=_['merge'](_0x275080[_0xf9c8('0x3a')],{'$or':_[_0xf9c8('0x2c')](_0x1d5c75,function(_0x530ab9){if(_0x530ab9['type']!==_0xf9c8('0x3e')){var _0x35769c={};_0x35769c[_0x530ab9['name']]={'$like':'%'+_0x13d05d[_0xf9c8('0x33')][_0xf9c8('0x3d')]+'%'};return _0x35769c;}})});}_0x275080=_[_0xf9c8('0x3f')]({},_0x275080,_0x13d05d[_0xf9c8('0x40')]);var _0x1becdc={'where':_0x275080[_0xf9c8('0x3a')]};return db[_0xf9c8('0x2d')]['count'](_0x1becdc)['then'](function(_0x75af7a){_0x56e895['count']=_0x75af7a;if(_0x13d05d[_0xf9c8('0x33')]['includeAll']){_0x275080[_0xf9c8('0x41')]=[{'all':!![]}];}return db[_0xf9c8('0x2d')]['findAll'](_0x275080);})[_0xf9c8('0x25')](function(_0x5c6f55){_0x56e895[_0xf9c8('0x42')]=_0x5c6f55;return _0x56e895;})[_0xf9c8('0x25')](respondWithFilteredResult(_0x16c292,_0x275080))[_0xf9c8('0x43')](handleError(_0x16c292,null));};exports[_0xf9c8('0x44')]=function(_0x59cc30,_0x2973b5){var _0x35bff1={'raw':![],'where':{'id':_0x59cc30['params']['id']}},_0x3b10b5={};_0x3b10b5[_0xf9c8('0x31')]=_[_0xf9c8('0x32')](db[_0xf9c8('0x2d')]['rawAttributes']);_0x3b10b5[_0xf9c8('0x33')]=_[_0xf9c8('0x32')](_0x59cc30['query']);_0x3b10b5[_0xf9c8('0x3b')]=_['intersection'](_0x3b10b5[_0xf9c8('0x31')],_0x3b10b5[_0xf9c8('0x33')]);_0x35bff1[_0xf9c8('0x35')]=_[_0xf9c8('0x34')](_0x3b10b5['model'],qs[_0xf9c8('0x36')](_0x59cc30[_0xf9c8('0x33')][_0xf9c8('0x36')]));_0x35bff1[_0xf9c8('0x35')]=_0x35bff1[_0xf9c8('0x35')][_0xf9c8('0x45')]?_0x35bff1[_0xf9c8('0x35')]:_0x3b10b5['model'];if(_0x59cc30[_0xf9c8('0x33')][_0xf9c8('0x46')]){_0x35bff1[_0xf9c8('0x41')]=[{'all':!![]}];}_0x35bff1=_[_0xf9c8('0x3f')]({},_0x35bff1,_0x59cc30[_0xf9c8('0x40')]);return db['Trigger'][_0xf9c8('0x47')](_0x35bff1)[_0xf9c8('0x25')](handleEntityNotFound(_0x2973b5,null))[_0xf9c8('0x25')](respondWithResult(_0x2973b5,null))[_0xf9c8('0x43')](handleError(_0x2973b5,null));};exports['create']=function(_0x538393,_0x490ce2){return db[_0xf9c8('0x2d')][_0xf9c8('0x48')](_0x538393['body'],{})[_0xf9c8('0x25')](function(_0x289cef){var _0xd47d4b=_0x538393['user'][_0xf9c8('0x49')]({'plain':!![]});if(!_0xd47d4b)throw new Error(_0xf9c8('0x4a'));if(_0xd47d4b[_0xf9c8('0x4b')]==='user'){var _0x77599e=_0x289cef[_0xf9c8('0x49')]({'plain':!![]});var _0x3d9a01=_0xf9c8('0x4c');return db[_0xf9c8('0x4d')]['find']({'where':{'name':_0x3d9a01,'userProfileId':_0xd47d4b[_0xf9c8('0x4e')]},'raw':!![]})[_0xf9c8('0x25')](function(_0x467acd){if(_0x467acd&&_0x467acd[_0xf9c8('0x4f')]===0x0){return db[_0xf9c8('0x26')][_0xf9c8('0x48')]({'name':_0x77599e[_0xf9c8('0x2a')],'resourceId':_0x77599e['id'],'type':_0x467acd[_0xf9c8('0x2a')],'sectionId':_0x467acd['id']},{})[_0xf9c8('0x25')](function(){return _0x289cef;});}else{return _0x289cef;}})[_0xf9c8('0x43')](function(_0x19dbdf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19dbdf);throw _0x19dbdf;});}return _0x289cef;})[_0xf9c8('0x25')](respondWithResult(_0x490ce2,0xc9))[_0xf9c8('0x43')](handleError(_0x490ce2,null));};exports[_0xf9c8('0x50')]=function(_0x13b37,_0x30ba9c){if(_0x13b37[_0xf9c8('0x51')]['id']){delete _0x13b37[_0xf9c8('0x51')]['id'];}return db[_0xf9c8('0x2d')][_0xf9c8('0x47')]({'where':{'id':_0x13b37['params']['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x30ba9c,null))[_0xf9c8('0x25')](saveUpdates(_0x13b37['body'],null))['then'](respondWithResult(_0x30ba9c,null))[_0xf9c8('0x43')](handleError(_0x30ba9c,null));};exports[_0xf9c8('0x27')]=function(_0x13c15d,_0x4a3db9){return db[_0xf9c8('0x2d')]['find']({'where':{'id':_0x13c15d[_0xf9c8('0x52')]['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x4a3db9,null))[_0xf9c8('0x25')](removeEntity(_0x4a3db9,null))[_0xf9c8('0x43')](handleError(_0x4a3db9,null));};exports[_0xf9c8('0x53')]=function(_0x773e33,_0x40beeb,_0x12fe98){if(_0x773e33[_0xf9c8('0x51')]['id']){delete _0x773e33['body']['id'];}return db[_0xf9c8('0x2d')][_0xf9c8('0x47')]({'where':{'id':_0x773e33['params']['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x40beeb,null))[_0xf9c8('0x25')](function(_0x2443e4){if(_0x2443e4){_0x773e33[_0xf9c8('0x51')][_0xf9c8('0x54')]=_0x2443e4['id'];return db['Condition'][_0xf9c8('0x48')](_0x773e33['body']);}})['then'](respondWithResult(_0x40beeb,null))[_0xf9c8('0x43')](handleError(_0x40beeb,null));};exports[_0xf9c8('0x55')]=function(_0x55254b,_0x499a72,_0x3cc95d){if(_0x55254b[_0xf9c8('0x51')]['id']){delete _0x55254b['body']['id'];}return db['Trigger'][_0xf9c8('0x47')]({'where':{'id':_0x55254b['params']['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x499a72,null))[_0xf9c8('0x25')](function(_0x3c5f17){if(_0x3c5f17){_0x55254b[_0xf9c8('0x51')][_0xf9c8('0x56')]=_0x3c5f17['id'];return db[_0xf9c8('0x57')]['create'](_0x55254b[_0xf9c8('0x51')]);}})['then'](respondWithResult(_0x499a72,null))[_0xf9c8('0x43')](handleError(_0x499a72,null));};exports[_0xf9c8('0x58')]=function(_0x2fb33f,_0x5cfa7a,_0x4b4a34){var _0x36e939={};var _0x1d41da={};var _0x4ca162;var _0x3ebf2d;return db['Trigger']['findOne']({'where':{'id':_0x2fb33f[_0xf9c8('0x52')]['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x5cfa7a,null))[_0xf9c8('0x25')](function(_0xbb7bf6){if(_0xbb7bf6){_0x4ca162=_0xbb7bf6;_0x1d41da[_0xf9c8('0x31')]=_[_0xf9c8('0x32')](db[_0xf9c8('0x57')][_0xf9c8('0x59')]);_0x1d41da[_0xf9c8('0x33')]=_[_0xf9c8('0x32')](_0x2fb33f[_0xf9c8('0x33')]);_0x1d41da[_0xf9c8('0x3b')]=_['intersection'](_0x1d41da[_0xf9c8('0x31')],_0x1d41da['query']);_0x36e939[_0xf9c8('0x35')]=_[_0xf9c8('0x34')](_0x1d41da['model'],qs[_0xf9c8('0x36')](_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x36')]));_0x36e939[_0xf9c8('0x35')]=_0x36e939[_0xf9c8('0x35')][_0xf9c8('0x45')]?_0x36e939[_0xf9c8('0x35')]:_0x1d41da['model'];_0x36e939[_0xf9c8('0x38')]=qs[_0xf9c8('0x39')](_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x39')]);_0x36e939['where']=qs[_0xf9c8('0x3b')](_[_0xf9c8('0x3c')](_0x2fb33f[_0xf9c8('0x33')],_0x1d41da[_0xf9c8('0x3b')]));if(_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x3d')]){_0x36e939[_0xf9c8('0x3a')]=_[_0xf9c8('0x3f')](_0x36e939[_0xf9c8('0x3a')],{'$or':_['map'](_0x36e939[_0xf9c8('0x35')],function(_0x4db57e){var _0x2c9f8c={};_0x2c9f8c[_0x4db57e]={'$like':'%'+_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x3d')]+'%'};return _0x2c9f8c;})});}_0x36e939=_[_0xf9c8('0x3f')]({},_0x36e939,_0x2fb33f[_0xf9c8('0x40')]);return _0x4ca162[_0xf9c8('0x58')](_0x36e939);}})[_0xf9c8('0x25')](function(_0x10bd7f){if(_0x10bd7f){_0x3ebf2d=_0x10bd7f[_0xf9c8('0x45')];if(!_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x5a')](_0xf9c8('0x37'))){_0x36e939[_0xf9c8('0x1e')]=qs[_0xf9c8('0x1e')](_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x1e')]);_0x36e939['offset']=qs['offset'](_0x2fb33f[_0xf9c8('0x33')][_0xf9c8('0x20')]);}return _0x4ca162[_0xf9c8('0x58')](_0x36e939);}})['then'](function(_0x2cc4da){if(_0x2cc4da){return _0x2cc4da?{'count':_0x3ebf2d,'rows':_0x2cc4da}:null;}})[_0xf9c8('0x25')](respondWithResult(_0x5cfa7a,null))[_0xf9c8('0x43')](handleError(_0x5cfa7a,null));};exports[_0xf9c8('0x5b')]=function(_0x4713c1,_0x55ac61,_0x16c87e){var _0x2e561a={};var _0x1faddd={};var _0x1a39d1;var _0x2a92bd;return db[_0xf9c8('0x2d')][_0xf9c8('0x5c')]({'where':{'id':_0x4713c1[_0xf9c8('0x52')]['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x55ac61,null))[_0xf9c8('0x25')](function(_0x75f9e9){if(_0x75f9e9){_0x1a39d1=_0x75f9e9;_0x1faddd[_0xf9c8('0x31')]=_[_0xf9c8('0x32')](db[_0xf9c8('0x57')][_0xf9c8('0x59')]);_0x1faddd[_0xf9c8('0x33')]=_['keys'](_0x4713c1[_0xf9c8('0x33')]);_0x1faddd[_0xf9c8('0x3b')]=_[_0xf9c8('0x34')](_0x1faddd[_0xf9c8('0x31')],_0x1faddd[_0xf9c8('0x33')]);_0x2e561a[_0xf9c8('0x35')]=_[_0xf9c8('0x34')](_0x1faddd[_0xf9c8('0x31')],qs[_0xf9c8('0x36')](_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x36')]));_0x2e561a[_0xf9c8('0x35')]=_0x2e561a['attributes'][_0xf9c8('0x45')]?_0x2e561a['attributes']:_0x1faddd[_0xf9c8('0x31')];_0x2e561a['order']=qs[_0xf9c8('0x39')](_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x39')]);_0x2e561a[_0xf9c8('0x3a')]=qs[_0xf9c8('0x3b')](_[_0xf9c8('0x3c')](_0x4713c1[_0xf9c8('0x33')],_0x1faddd[_0xf9c8('0x3b')]));if(_0x4713c1[_0xf9c8('0x33')]['filter']){_0x2e561a[_0xf9c8('0x3a')]=_[_0xf9c8('0x3f')](_0x2e561a[_0xf9c8('0x3a')],{'$or':_[_0xf9c8('0x2c')](_0x2e561a['attributes'],function(_0x4c5b51){var _0xe41bfc={};_0xe41bfc[_0x4c5b51]={'$like':'%'+_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x3d')]+'%'};return _0xe41bfc;})});}_0x2e561a=_[_0xf9c8('0x3f')]({},_0x2e561a,_0x4713c1[_0xf9c8('0x40')]);return _0x1a39d1[_0xf9c8('0x5b')](_0x2e561a);}})[_0xf9c8('0x25')](function(_0x5a4805){if(_0x5a4805){_0x2a92bd=_0x5a4805['length'];if(!_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x5a')](_0xf9c8('0x37'))){_0x2e561a[_0xf9c8('0x1e')]=qs[_0xf9c8('0x1e')](_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x1e')]);_0x2e561a[_0xf9c8('0x20')]=qs['offset'](_0x4713c1[_0xf9c8('0x33')][_0xf9c8('0x20')]);}return _0x1a39d1[_0xf9c8('0x5b')](_0x2e561a);}})[_0xf9c8('0x25')](function(_0x1de26a){if(_0x1de26a){return _0x1de26a?{'count':_0x2a92bd,'rows':_0x1de26a}:null;}})[_0xf9c8('0x25')](respondWithResult(_0x55ac61,null))['catch'](handleError(_0x55ac61,null));};exports[_0xf9c8('0x5d')]=function(_0x29e9a1,_0x54b989,_0x3014d2){if(_0x29e9a1[_0xf9c8('0x51')]['id']){delete _0x29e9a1[_0xf9c8('0x51')]['id'];}return db[_0xf9c8('0x2d')][_0xf9c8('0x47')]({'where':{'id':_0x29e9a1[_0xf9c8('0x52')]['id']}})['then'](handleEntityNotFound(_0x54b989,null))['then'](function(_0x44d3bb){if(_0x44d3bb){_0x29e9a1[_0xf9c8('0x51')][_0xf9c8('0x5e')]=_0x44d3bb['id'];return db[_0xf9c8('0x5f')]['create'](_0x29e9a1['body']);}})['then'](respondWithResult(_0x54b989,null))['catch'](handleError(_0x54b989,null));};exports[_0xf9c8('0x60')]=function(_0x4399b9,_0x2c8fd2,_0x1bc04b){var _0x34e1c7={};var _0x590923={};var _0x4700bf;var _0x2040ef;return db['Trigger']['findOne']({'where':{'id':_0x4399b9[_0xf9c8('0x52')]['id']}})[_0xf9c8('0x25')](handleEntityNotFound(_0x2c8fd2,null))[_0xf9c8('0x25')](function(_0x3f8ef4){if(_0x3f8ef4){_0x4700bf=_0x3f8ef4;_0x590923[_0xf9c8('0x31')]=_['keys'](db[_0xf9c8('0x5f')][_0xf9c8('0x59')]);_0x590923[_0xf9c8('0x33')]=_[_0xf9c8('0x32')](_0x4399b9[_0xf9c8('0x33')]);_0x590923['filters']=_[_0xf9c8('0x34')](_0x590923[_0xf9c8('0x31')],_0x590923[_0xf9c8('0x33')]);_0x34e1c7[_0xf9c8('0x35')]=_[_0xf9c8('0x34')](_0x590923['model'],qs[_0xf9c8('0x36')](_0x4399b9[_0xf9c8('0x33')][_0xf9c8('0x36')]));_0x34e1c7['attributes']=_0x34e1c7[_0xf9c8('0x35')][_0xf9c8('0x45')]?_0x34e1c7[_0xf9c8('0x35')]:_0x590923['model'];_0x34e1c7[_0xf9c8('0x38')]=qs['sort'](_0x4399b9[_0xf9c8('0x33')][_0xf9c8('0x39')]);_0x34e1c7['where']=qs[_0xf9c8('0x3b')](_[_0xf9c8('0x3c')](_0x4399b9[_0xf9c8('0x33')],_0x590923[_0xf9c8('0x3b')]));if(_0x4399b9[_0xf9c8('0x33')]['filter']){_0x34e1c7[_0xf9c8('0x3a')]=_[_0xf9c8('0x3f')](_0x34e1c7[_0xf9c8('0x3a')],{'$or':_[_0xf9c8('0x2c')](_0x34e1c7[_0xf9c8('0x35')],function(_0x4c86fc){var _0x4ba07d={};_0x4ba07d[_0x4c86fc]={'$like':'%'+_0x4399b9['query'][_0xf9c8('0x3d')]+'%'};return _0x4ba07d;})});}_0x34e1c7=_['merge']({},_0x34e1c7,_0x4399b9[_0xf9c8('0x40')]);return _0x4700bf[_0xf9c8('0x60')](_0x34e1c7);}})[_0xf9c8('0x25')](function(_0x3e24c2){if(_0x3e24c2){_0x2040ef=_0x3e24c2[_0xf9c8('0x45')];if(!_0x4399b9[_0xf9c8('0x33')][_0xf9c8('0x5a')](_0xf9c8('0x37'))){_0x34e1c7[_0xf9c8('0x1e')]=qs['limit'](_0x4399b9[_0xf9c8('0x33')][_0xf9c8('0x1e')]);_0x34e1c7[_0xf9c8('0x20')]=qs[_0xf9c8('0x20')](_0x4399b9[_0xf9c8('0x33')][_0xf9c8('0x20')]);}return _0x4700bf['getActions'](_0x34e1c7);}})[_0xf9c8('0x25')](function(_0x54a037){if(_0x54a037){return _0x54a037?{'count':_0x2040ef,'rows':_0x54a037}:null;}})[_0xf9c8('0x25')](respondWithResult(_0x2c8fd2,null))['catch'](handleError(_0x2c8fd2,null));};
\ No newline at end of file
+var _0xf13a=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','Trigger','rawAttributes','type','key','model','map','query','attributes','intersection','fields','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','filter','hasOwnProperty','getAnyConditions','nolimit','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x553176,_0x5881f3){var _0x39f579=function(_0x213f82){while(--_0x213f82){_0x553176['push'](_0x553176['shift']());}};_0x39f579(++_0x5881f3);}(_0xf13a,0x111));var _0xaf13=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0xf13a[_0xb99421];return _0x4b3ec7;};'use strict';var emlformat=require(_0xaf13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf13('0x1'));var jsonpatch=require(_0xaf13('0x2'));var rp=require(_0xaf13('0x3'));var moment=require(_0xaf13('0x4'));var BPromise=require(_0xaf13('0x5'));var Mustache=require('mustache');var util=require(_0xaf13('0x6'));var path=require(_0xaf13('0x7'));var sox=require(_0xaf13('0x8'));var csv=require(_0xaf13('0x9'));var ejs=require(_0xaf13('0xa'));var fs=require('fs');var fs_extra=require(_0xaf13('0xb'));var _=require('lodash');var squel=require(_0xaf13('0xc'));var crypto=require(_0xaf13('0xd'));var jsforce=require(_0xaf13('0xe'));var deskjs=require(_0xaf13('0xf'));var toCsv=require(_0xaf13('0x9'));var querystring=require(_0xaf13('0x10'));var Papa=require(_0xaf13('0x11'));var Redis=require(_0xaf13('0x12'));var authService=require(_0xaf13('0x13'));var qs=require(_0xaf13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf13('0x15'));var logger=require('../../config/logger')(_0xaf13('0x16'));var utils=require(_0xaf13('0x17'));var config=require(_0xaf13('0x18'));var licenseUtil=require(_0xaf13('0x19'));var db=require(_0xaf13('0x1a'))['db'];function respondWithStatusCode(_0x52dd61,_0x123931){_0x123931=_0x123931||0xcc;return function(_0x1ce889){if(_0x1ce889){return _0x52dd61['sendStatus'](_0x123931);}return _0x52dd61['status'](_0x123931)['end']();};}function respondWithResult(_0x35aab2,_0x13a976){_0x13a976=_0x13a976||0xc8;return function(_0x29edaf){if(_0x29edaf){return _0x35aab2[_0xaf13('0x1b')](_0x13a976)[_0xaf13('0x1c')](_0x29edaf);}};}function respondWithFilteredResult(_0xe6d4d,_0x518792){return function(_0x41a6aa){if(_0x41a6aa){var _0x3f26e0=typeof _0x518792[_0xaf13('0x1d')]==='undefined'&&typeof _0x518792[_0xaf13('0x1e')]===_0xaf13('0x1f');var _0x613ade=_0x41a6aa[_0xaf13('0x20')];var _0x3b593d=_0x3f26e0?0x0:_0x518792['offset'];var _0x1363a7=_0x3f26e0?_0x41a6aa[_0xaf13('0x20')]:_0x518792[_0xaf13('0x1d')]+_0x518792[_0xaf13('0x1e')];var _0x40cc74;if(_0x1363a7>=_0x613ade){_0x1363a7=_0x613ade;_0x40cc74=0xc8;}else{_0x40cc74=0xce;}_0xe6d4d['status'](_0x40cc74);return _0xe6d4d[_0xaf13('0x21')](_0xaf13('0x22'),_0x3b593d+'-'+_0x1363a7+'/'+_0x613ade)[_0xaf13('0x1c')](_0x41a6aa);}return null;};}function patchUpdates(_0x1f7ff3){return function(_0x1b5ca8){try{jsonpatch[_0xaf13('0x23')](_0x1b5ca8,_0x1f7ff3,!![]);}catch(_0x1c5411){return BPromise['reject'](_0x1c5411);}return _0x1b5ca8[_0xaf13('0x24')]();};}function saveUpdates(_0x19abf3,_0x27efb0){return function(_0x41d883){if(_0x41d883){return _0x41d883[_0xaf13('0x25')](_0x19abf3)[_0xaf13('0x26')](function(_0x3a5fac){return _0x3a5fac;});}return null;};}function removeEntity(_0x40dc90,_0x1bc497){return function(_0x40f78c){if(_0x40f78c){return _0x40f78c[_0xaf13('0x27')]()[_0xaf13('0x26')](function(){var _0xe6eafb=_0x40f78c[_0xaf13('0x28')]({'plain':!![]});var _0x48591a=_0xaf13('0x29');return db[_0xaf13('0x2a')][_0xaf13('0x27')]({'where':{'type':_0x48591a,'resourceId':_0xe6eafb['id']}})[_0xaf13('0x26')](function(){return _0x40f78c;});})['then'](function(){_0x40dc90[_0xaf13('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a758f,_0xaf6c38){return function(_0x16f73a){if(!_0x16f73a){_0x3a758f['sendStatus'](0x194);}return _0x16f73a;};}function handleError(_0xcfda8f,_0x286a95){_0x286a95=_0x286a95||0x1f4;return function(_0x4f63cb){logger[_0xaf13('0x2b')](_0x4f63cb['stack']);if(_0x4f63cb['name']){delete _0x4f63cb[_0xaf13('0x2c')];}_0xcfda8f[_0xaf13('0x1b')](_0x286a95)[_0xaf13('0x2d')](_0x4f63cb);};}exports[_0xaf13('0x2e')]=function(_0x502604,_0xbbba29){var _0x1d7ce={},_0x4f6ae7={},_0x510dec={'count':0x0,'rows':[]};var _0x42f939=_['map'](db[_0xaf13('0x2f')][_0xaf13('0x30')],function(_0x227dcf){return{'name':_0x227dcf['fieldName'],'type':_0x227dcf[_0xaf13('0x31')][_0xaf13('0x32')]};});_0x4f6ae7[_0xaf13('0x33')]=_[_0xaf13('0x34')](_0x42f939,_0xaf13('0x2c'));_0x4f6ae7[_0xaf13('0x35')]=_['keys'](_0x502604['query']);_0x4f6ae7['filters']=_['intersection'](_0x4f6ae7[_0xaf13('0x33')],_0x4f6ae7['query']);_0x1d7ce[_0xaf13('0x36')]=_[_0xaf13('0x37')](_0x4f6ae7[_0xaf13('0x33')],qs[_0xaf13('0x38')](_0x502604[_0xaf13('0x35')]['fields']));_0x1d7ce[_0xaf13('0x36')]=_0x1d7ce[_0xaf13('0x36')]['length']?_0x1d7ce[_0xaf13('0x36')]:_0x4f6ae7[_0xaf13('0x33')];if(!_0x502604[_0xaf13('0x35')]['hasOwnProperty']('nolimit')){_0x1d7ce[_0xaf13('0x1e')]=qs[_0xaf13('0x1e')](_0x502604[_0xaf13('0x35')][_0xaf13('0x1e')]);_0x1d7ce[_0xaf13('0x1d')]=qs[_0xaf13('0x1d')](_0x502604['query'][_0xaf13('0x1d')]);}_0x1d7ce[_0xaf13('0x39')]=qs[_0xaf13('0x3a')](_0x502604['query'][_0xaf13('0x3a')]);_0x1d7ce['where']=qs[_0xaf13('0x3b')](_[_0xaf13('0x3c')](_0x502604[_0xaf13('0x35')],_0x4f6ae7[_0xaf13('0x3b')]),_0x42f939);if(_0x502604['query']['filter']){_0x1d7ce[_0xaf13('0x3d')]=_[_0xaf13('0x3e')](_0x1d7ce[_0xaf13('0x3d')],{'$or':_[_0xaf13('0x34')](_0x42f939,function(_0x284b02){if(_0x284b02[_0xaf13('0x31')]!==_0xaf13('0x3f')){var _0xf2968b={};_0xf2968b[_0x284b02[_0xaf13('0x2c')]]={'$like':'%'+_0x502604[_0xaf13('0x35')]['filter']+'%'};return _0xf2968b;}})});}_0x1d7ce=_['merge']({},_0x1d7ce,_0x502604[_0xaf13('0x40')]);var _0x4da3de={'where':_0x1d7ce[_0xaf13('0x3d')]};return db[_0xaf13('0x2f')][_0xaf13('0x20')](_0x4da3de)[_0xaf13('0x26')](function(_0x26d61b){_0x510dec[_0xaf13('0x20')]=_0x26d61b;if(_0x502604[_0xaf13('0x35')][_0xaf13('0x41')]){_0x1d7ce[_0xaf13('0x42')]=[{'all':!![]}];}return db['Trigger'][_0xaf13('0x43')](_0x1d7ce);})[_0xaf13('0x26')](function(_0x16dd03){_0x510dec[_0xaf13('0x44')]=_0x16dd03;return _0x510dec;})[_0xaf13('0x26')](respondWithFilteredResult(_0xbbba29,_0x1d7ce))[_0xaf13('0x45')](handleError(_0xbbba29,null));};exports['show']=function(_0x4e9688,_0x4ff560){var _0x2c23bd={'raw':![],'where':{'id':_0x4e9688[_0xaf13('0x46')]['id']}},_0x40c277={};_0x40c277['model']=_[_0xaf13('0x47')](db[_0xaf13('0x2f')][_0xaf13('0x30')]);_0x40c277[_0xaf13('0x35')]=_['keys'](_0x4e9688[_0xaf13('0x35')]);_0x40c277[_0xaf13('0x3b')]=_['intersection'](_0x40c277[_0xaf13('0x33')],_0x40c277[_0xaf13('0x35')]);_0x2c23bd[_0xaf13('0x36')]=_[_0xaf13('0x37')](_0x40c277['model'],qs[_0xaf13('0x38')](_0x4e9688[_0xaf13('0x35')][_0xaf13('0x38')]));_0x2c23bd['attributes']=_0x2c23bd[_0xaf13('0x36')]['length']?_0x2c23bd[_0xaf13('0x36')]:_0x40c277[_0xaf13('0x33')];if(_0x4e9688[_0xaf13('0x35')][_0xaf13('0x41')]){_0x2c23bd[_0xaf13('0x42')]=[{'all':!![]}];}_0x2c23bd=_[_0xaf13('0x3e')]({},_0x2c23bd,_0x4e9688['options']);return db[_0xaf13('0x2f')]['find'](_0x2c23bd)['then'](handleEntityNotFound(_0x4ff560,null))[_0xaf13('0x26')](respondWithResult(_0x4ff560,null))[_0xaf13('0x45')](handleError(_0x4ff560,null));};exports[_0xaf13('0x48')]=function(_0x476e8c,_0x4c94ea){return db[_0xaf13('0x2f')][_0xaf13('0x48')](_0x476e8c[_0xaf13('0x49')],{})[_0xaf13('0x26')](function(_0x40df07){var _0x3a1297=_0x476e8c[_0xaf13('0x4a')][_0xaf13('0x28')]({'plain':!![]});if(!_0x3a1297)throw new Error(_0xaf13('0x4b'));if(_0x3a1297[_0xaf13('0x4c')]===_0xaf13('0x4a')){var _0x539404=_0x40df07['get']({'plain':!![]});var _0x554492=_0xaf13('0x29');return db['UserProfileSection'][_0xaf13('0x4d')]({'where':{'name':_0x554492,'userProfileId':_0x3a1297[_0xaf13('0x4e')]},'raw':!![]})[_0xaf13('0x26')](function(_0x522783){if(_0x522783&&_0x522783[_0xaf13('0x4f')]===0x0){return db[_0xaf13('0x2a')][_0xaf13('0x48')]({'name':_0x539404['name'],'resourceId':_0x539404['id'],'type':_0x522783['name'],'sectionId':_0x522783['id']},{})[_0xaf13('0x26')](function(){return _0x40df07;});}else{return _0x40df07;}})['catch'](function(_0x4d77eb){logger[_0xaf13('0x2b')](_0xaf13('0x50'),_0x4d77eb);throw _0x4d77eb;});}return _0x40df07;})['then'](respondWithResult(_0x4c94ea,0xc9))[_0xaf13('0x45')](handleError(_0x4c94ea,null));};exports[_0xaf13('0x25')]=function(_0x10e844,_0x1ff120){if(_0x10e844[_0xaf13('0x49')]['id']){delete _0x10e844[_0xaf13('0x49')]['id'];}return db[_0xaf13('0x2f')][_0xaf13('0x4d')]({'where':{'id':_0x10e844[_0xaf13('0x46')]['id']}})[_0xaf13('0x26')](handleEntityNotFound(_0x1ff120,null))['then'](saveUpdates(_0x10e844['body'],null))[_0xaf13('0x26')](respondWithResult(_0x1ff120,null))[_0xaf13('0x45')](handleError(_0x1ff120,null));};exports[_0xaf13('0x27')]=function(_0x25407b,_0x247df){return db[_0xaf13('0x2f')][_0xaf13('0x4d')]({'where':{'id':_0x25407b[_0xaf13('0x46')]['id']}})[_0xaf13('0x26')](handleEntityNotFound(_0x247df,null))[_0xaf13('0x26')](removeEntity(_0x247df,null))['catch'](handleError(_0x247df,null));};exports[_0xaf13('0x51')]=function(_0x1c5b6e,_0x2b4822,_0xedfa4b){if(_0x1c5b6e[_0xaf13('0x49')]['id']){delete _0x1c5b6e[_0xaf13('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1c5b6e[_0xaf13('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b4822,null))['then'](function(_0x4814d7){if(_0x4814d7){_0x1c5b6e[_0xaf13('0x49')][_0xaf13('0x52')]=_0x4814d7['id'];return db[_0xaf13('0x53')][_0xaf13('0x48')](_0x1c5b6e[_0xaf13('0x49')]);}})[_0xaf13('0x26')](respondWithResult(_0x2b4822,null))[_0xaf13('0x45')](handleError(_0x2b4822,null));};exports[_0xaf13('0x54')]=function(_0x380daa,_0x444d6c,_0xec9be0){if(_0x380daa['body']['id']){delete _0x380daa[_0xaf13('0x49')]['id'];}return db[_0xaf13('0x2f')][_0xaf13('0x4d')]({'where':{'id':_0x380daa[_0xaf13('0x46')]['id']}})[_0xaf13('0x26')](handleEntityNotFound(_0x444d6c,null))['then'](function(_0x5e5187){if(_0x5e5187){_0x380daa['body'][_0xaf13('0x55')]=_0x5e5187['id'];return db[_0xaf13('0x53')][_0xaf13('0x48')](_0x380daa[_0xaf13('0x49')]);}})[_0xaf13('0x26')](respondWithResult(_0x444d6c,null))['catch'](handleError(_0x444d6c,null));};exports[_0xaf13('0x56')]=function(_0x13a81f,_0x1eae90,_0x5a0d58){var _0x30927c={};var _0x4f2632={};var _0x45ab1d;var _0x408b70;return db[_0xaf13('0x2f')][_0xaf13('0x57')]({'where':{'id':_0x13a81f[_0xaf13('0x46')]['id']}})['then'](handleEntityNotFound(_0x1eae90,null))[_0xaf13('0x26')](function(_0x339f11){if(_0x339f11){_0x45ab1d=_0x339f11;_0x4f2632[_0xaf13('0x33')]=_['keys'](db['Condition']['rawAttributes']);_0x4f2632['query']=_['keys'](_0x13a81f[_0xaf13('0x35')]);_0x4f2632['filters']=_[_0xaf13('0x37')](_0x4f2632[_0xaf13('0x33')],_0x4f2632[_0xaf13('0x35')]);_0x30927c[_0xaf13('0x36')]=_['intersection'](_0x4f2632[_0xaf13('0x33')],qs[_0xaf13('0x38')](_0x13a81f[_0xaf13('0x35')][_0xaf13('0x38')]));_0x30927c[_0xaf13('0x36')]=_0x30927c['attributes'][_0xaf13('0x58')]?_0x30927c[_0xaf13('0x36')]:_0x4f2632['model'];_0x30927c[_0xaf13('0x39')]=qs[_0xaf13('0x3a')](_0x13a81f[_0xaf13('0x35')]['sort']);_0x30927c['where']=qs['filters'](_[_0xaf13('0x3c')](_0x13a81f[_0xaf13('0x35')],_0x4f2632[_0xaf13('0x3b')]));if(_0x13a81f[_0xaf13('0x35')][_0xaf13('0x59')]){_0x30927c['where']=_['merge'](_0x30927c[_0xaf13('0x3d')],{'$or':_[_0xaf13('0x34')](_0x30927c[_0xaf13('0x36')],function(_0x2b2559){var _0x2fc514={};_0x2fc514[_0x2b2559]={'$like':'%'+_0x13a81f[_0xaf13('0x35')]['filter']+'%'};return _0x2fc514;})});}_0x30927c=_['merge']({},_0x30927c,_0x13a81f[_0xaf13('0x40')]);return _0x45ab1d[_0xaf13('0x56')](_0x30927c);}})['then'](function(_0x58f90c){if(_0x58f90c){_0x408b70=_0x58f90c['length'];if(!_0x13a81f[_0xaf13('0x35')][_0xaf13('0x5a')]('nolimit')){_0x30927c[_0xaf13('0x1e')]=qs[_0xaf13('0x1e')](_0x13a81f['query']['limit']);_0x30927c['offset']=qs[_0xaf13('0x1d')](_0x13a81f[_0xaf13('0x35')]['offset']);}return _0x45ab1d['getAllConditions'](_0x30927c);}})[_0xaf13('0x26')](function(_0x33e4ac){if(_0x33e4ac){return _0x33e4ac?{'count':_0x408b70,'rows':_0x33e4ac}:null;}})[_0xaf13('0x26')](respondWithResult(_0x1eae90,null))[_0xaf13('0x45')](handleError(_0x1eae90,null));};exports[_0xaf13('0x5b')]=function(_0x2fc9da,_0x30ecff,_0xbf4492){var _0x5124be={};var _0x4c9b33={};var _0x50800b;var _0x22af40;return db[_0xaf13('0x2f')][_0xaf13('0x57')]({'where':{'id':_0x2fc9da[_0xaf13('0x46')]['id']}})[_0xaf13('0x26')](handleEntityNotFound(_0x30ecff,null))['then'](function(_0x3f4b56){if(_0x3f4b56){_0x50800b=_0x3f4b56;_0x4c9b33[_0xaf13('0x33')]=_[_0xaf13('0x47')](db[_0xaf13('0x53')][_0xaf13('0x30')]);_0x4c9b33['query']=_['keys'](_0x2fc9da['query']);_0x4c9b33[_0xaf13('0x3b')]=_[_0xaf13('0x37')](_0x4c9b33[_0xaf13('0x33')],_0x4c9b33[_0xaf13('0x35')]);_0x5124be[_0xaf13('0x36')]=_['intersection'](_0x4c9b33['model'],qs[_0xaf13('0x38')](_0x2fc9da[_0xaf13('0x35')][_0xaf13('0x38')]));_0x5124be[_0xaf13('0x36')]=_0x5124be[_0xaf13('0x36')]['length']?_0x5124be[_0xaf13('0x36')]:_0x4c9b33[_0xaf13('0x33')];_0x5124be[_0xaf13('0x39')]=qs[_0xaf13('0x3a')](_0x2fc9da['query']['sort']);_0x5124be[_0xaf13('0x3d')]=qs[_0xaf13('0x3b')](_['pick'](_0x2fc9da[_0xaf13('0x35')],_0x4c9b33['filters']));if(_0x2fc9da[_0xaf13('0x35')][_0xaf13('0x59')]){_0x5124be[_0xaf13('0x3d')]=_['merge'](_0x5124be[_0xaf13('0x3d')],{'$or':_[_0xaf13('0x34')](_0x5124be[_0xaf13('0x36')],function(_0x3a0620){var _0x453cc3={};_0x453cc3[_0x3a0620]={'$like':'%'+_0x2fc9da['query'][_0xaf13('0x59')]+'%'};return _0x453cc3;})});}_0x5124be=_[_0xaf13('0x3e')]({},_0x5124be,_0x2fc9da[_0xaf13('0x40')]);return _0x50800b[_0xaf13('0x5b')](_0x5124be);}})[_0xaf13('0x26')](function(_0x525361){if(_0x525361){_0x22af40=_0x525361[_0xaf13('0x58')];if(!_0x2fc9da[_0xaf13('0x35')][_0xaf13('0x5a')](_0xaf13('0x5c'))){_0x5124be[_0xaf13('0x1e')]=qs[_0xaf13('0x1e')](_0x2fc9da[_0xaf13('0x35')][_0xaf13('0x1e')]);_0x5124be[_0xaf13('0x1d')]=qs['offset'](_0x2fc9da[_0xaf13('0x35')][_0xaf13('0x1d')]);}return _0x50800b['getAnyConditions'](_0x5124be);}})[_0xaf13('0x26')](function(_0x53a133){if(_0x53a133){return _0x53a133?{'count':_0x22af40,'rows':_0x53a133}:null;}})[_0xaf13('0x26')](respondWithResult(_0x30ecff,null))[_0xaf13('0x45')](handleError(_0x30ecff,null));};exports['addAction']=function(_0x5976a4,_0x553d5f,_0x4812b0){if(_0x5976a4[_0xaf13('0x49')]['id']){delete _0x5976a4[_0xaf13('0x49')]['id'];}return db[_0xaf13('0x2f')][_0xaf13('0x4d')]({'where':{'id':_0x5976a4[_0xaf13('0x46')]['id']}})[_0xaf13('0x26')](handleEntityNotFound(_0x553d5f,null))[_0xaf13('0x26')](function(_0x2c4a0a){if(_0x2c4a0a){_0x5976a4['body']['TriggerId']=_0x2c4a0a['id'];return db['Action']['create'](_0x5976a4['body']);}})[_0xaf13('0x26')](respondWithResult(_0x553d5f,null))[_0xaf13('0x45')](handleError(_0x553d5f,null));};exports['getActions']=function(_0x5ba463,_0xbc4e31,_0x68b33c){var _0x1710a7={};var _0x394642={};var _0x1f26b0;var _0xefa14e;return db[_0xaf13('0x2f')]['findOne']({'where':{'id':_0x5ba463['params']['id']}})['then'](handleEntityNotFound(_0xbc4e31,null))[_0xaf13('0x26')](function(_0x227e93){if(_0x227e93){_0x1f26b0=_0x227e93;_0x394642['model']=_[_0xaf13('0x47')](db[_0xaf13('0x5d')]['rawAttributes']);_0x394642[_0xaf13('0x35')]=_[_0xaf13('0x47')](_0x5ba463[_0xaf13('0x35')]);_0x394642['filters']=_['intersection'](_0x394642[_0xaf13('0x33')],_0x394642[_0xaf13('0x35')]);_0x1710a7[_0xaf13('0x36')]=_[_0xaf13('0x37')](_0x394642['model'],qs['fields'](_0x5ba463[_0xaf13('0x35')][_0xaf13('0x38')]));_0x1710a7[_0xaf13('0x36')]=_0x1710a7[_0xaf13('0x36')][_0xaf13('0x58')]?_0x1710a7[_0xaf13('0x36')]:_0x394642[_0xaf13('0x33')];_0x1710a7['order']=qs[_0xaf13('0x3a')](_0x5ba463[_0xaf13('0x35')]['sort']);_0x1710a7[_0xaf13('0x3d')]=qs[_0xaf13('0x3b')](_[_0xaf13('0x3c')](_0x5ba463[_0xaf13('0x35')],_0x394642[_0xaf13('0x3b')]));if(_0x5ba463[_0xaf13('0x35')][_0xaf13('0x59')]){_0x1710a7[_0xaf13('0x3d')]=_['merge'](_0x1710a7[_0xaf13('0x3d')],{'$or':_['map'](_0x1710a7[_0xaf13('0x36')],function(_0x370a01){var _0x1f844c={};_0x1f844c[_0x370a01]={'$like':'%'+_0x5ba463['query']['filter']+'%'};return _0x1f844c;})});}_0x1710a7=_[_0xaf13('0x3e')]({},_0x1710a7,_0x5ba463[_0xaf13('0x40')]);return _0x1f26b0[_0xaf13('0x5e')](_0x1710a7);}})[_0xaf13('0x26')](function(_0x592c51){if(_0x592c51){_0xefa14e=_0x592c51[_0xaf13('0x58')];if(!_0x5ba463[_0xaf13('0x35')][_0xaf13('0x5a')](_0xaf13('0x5c'))){_0x1710a7[_0xaf13('0x1e')]=qs['limit'](_0x5ba463[_0xaf13('0x35')][_0xaf13('0x1e')]);_0x1710a7['offset']=qs['offset'](_0x5ba463[_0xaf13('0x35')][_0xaf13('0x1d')]);}return _0x1f26b0[_0xaf13('0x5e')](_0x1710a7);}})['then'](function(_0x2fd633){if(_0x2fd633){return _0x2fd633?{'count':_0xefa14e,'rows':_0x2fd633}:null;}})['then'](respondWithResult(_0xbc4e31,null))[_0xaf13('0x45')](handleError(_0xbc4e31,null));};
\ No newline at end of file