Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / trigger / trigger.controller.js
index afef471..4badb9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb715=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','crypto','jsforce','desk.js'];(function(_0x5ea9bc,_0x1668b1){var _0x216667=function(_0x2cdc94){while(--_0x2cdc94){_0x5ea9bc['push'](_0x5ea9bc['shift']());}};_0x216667(++_0x1668b1);}(_0xb715,0x16d));var _0x5b71=function(_0x5e1093,_0x22b620){_0x5e1093=_0x5e1093-0x0;var _0x1f2a37=_0xb715[_0x5e1093];return _0x1f2a37;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b71('0x1'));var jsonpatch=require(_0x5b71('0x2'));var rp=require('request-promise');var moment=require(_0x5b71('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5b71('0x4'));var util=require(_0x5b71('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5b71('0x6'));var ejs=require(_0x5b71('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5b71('0x8'));var jsforce=require(_0x5b71('0x9'));var deskjs=require(_0x5b71('0xa'));var toCsv=require(_0x5b71('0x6'));var querystring=require(_0x5b71('0xb'));var Papa=require(_0x5b71('0xc'));var Redis=require(_0x5b71('0xd'));var authService=require(_0x5b71('0xe'));var qs=require(_0x5b71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b71('0x10'));var logger=require(_0x5b71('0x11'))(_0x5b71('0x12'));var utils=require(_0x5b71('0x13'));var config=require(_0x5b71('0x14'));var licenseUtil=require(_0x5b71('0x15'));var db=require(_0x5b71('0x16'))['db'];function respondWithStatusCode(_0x15842a,_0xc5b01e){_0xc5b01e=_0xc5b01e||0xcc;return function(_0x3dabff){if(_0x3dabff){return _0x15842a[_0x5b71('0x17')](_0xc5b01e);}return _0x15842a[_0x5b71('0x18')](_0xc5b01e)[_0x5b71('0x19')]();};}function respondWithResult(_0x3a5a46,_0x56e9fa){_0x56e9fa=_0x56e9fa||0xc8;return function(_0x37c2c0){if(_0x37c2c0){return _0x3a5a46[_0x5b71('0x18')](_0x56e9fa)[_0x5b71('0x1a')](_0x37c2c0);}};}function respondWithFilteredResult(_0xf26ae8,_0x3f0615){return function(_0x236d44){if(_0x236d44){var _0x8a6ed6=_0x236d44['count'],_0x5c7893=_0x3f0615[_0x5b71('0x1b')],_0x42fe55=_0x3f0615[_0x5b71('0x1b')]+_0x3f0615['limit'],_0x10a817;if(_0x42fe55>=_0x8a6ed6){_0x42fe55=_0x8a6ed6;_0x10a817=0xc8;}else{_0x10a817=0xce;}_0xf26ae8[_0x5b71('0x18')](_0x10a817);return _0xf26ae8[_0x5b71('0x1c')](_0x5b71('0x1d'),_0x5c7893+'-'+_0x42fe55+'/'+_0x8a6ed6)[_0x5b71('0x1a')](_0x236d44);}return null;};}function patchUpdates(_0x3a4c00){return function(_0xe33bea){try{jsonpatch[_0x5b71('0x1e')](_0xe33bea,_0x3a4c00,!![]);}catch(_0x36560e){return BPromise[_0x5b71('0x1f')](_0x36560e);}return _0xe33bea[_0x5b71('0x20')]();};}function saveUpdates(_0x10400c,_0x7a5296){return function(_0x4cd27a){if(_0x4cd27a){return _0x4cd27a[_0x5b71('0x21')](_0x10400c)[_0x5b71('0x22')](function(_0x5688d9){return _0x5688d9;});}return null;};}function removeEntity(_0x335a86,_0x49469b){return function(_0x8825e3){if(_0x8825e3){return _0x8825e3[_0x5b71('0x23')]()['then'](function(){var _0x433b5b=_0x8825e3['get']({'plain':!![]});var _0x53b380='Triggers';return db[_0x5b71('0x24')][_0x5b71('0x23')]({'where':{'type':_0x53b380,'resourceId':_0x433b5b['id']}})[_0x5b71('0x22')](function(){return _0x8825e3;});})['then'](function(){_0x335a86['status'](0xcc)[_0x5b71('0x19')]();});}};}function handleEntityNotFound(_0x53b088,_0x21c310){return function(_0x2f027c){if(!_0x2f027c){_0x53b088[_0x5b71('0x17')](0x194);}return _0x2f027c;};}function handleError(_0x22fc89,_0x5b38ab){_0x5b38ab=_0x5b38ab||0x1f4;return function(_0x3b02e7){logger[_0x5b71('0x25')](_0x3b02e7[_0x5b71('0x26')]);if(_0x3b02e7[_0x5b71('0x27')]){delete _0x3b02e7[_0x5b71('0x27')];}_0x22fc89[_0x5b71('0x18')](_0x5b38ab)['send'](_0x3b02e7);};}exports['index']=function(_0x7387ab,_0x37491b){var _0x526dc2={},_0x591a42={},_0x22cd99={'count':0x0,'rows':[]};var _0xd71245=_[_0x5b71('0x28')](db[_0x5b71('0x29')][_0x5b71('0x2a')],function(_0x5952e9){return{'name':_0x5952e9[_0x5b71('0x2b')],'type':_0x5952e9[_0x5b71('0x2c')]['key']};});_0x591a42[_0x5b71('0x2d')]=_[_0x5b71('0x28')](_0xd71245,_0x5b71('0x27'));_0x591a42[_0x5b71('0x2e')]=_[_0x5b71('0x2f')](_0x7387ab[_0x5b71('0x2e')]);_0x591a42[_0x5b71('0x30')]=_[_0x5b71('0x31')](_0x591a42[_0x5b71('0x2d')],_0x591a42[_0x5b71('0x2e')]);_0x526dc2[_0x5b71('0x32')]=_['intersection'](_0x591a42[_0x5b71('0x2d')],qs['fields'](_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x33')]));_0x526dc2['attributes']=_0x526dc2[_0x5b71('0x32')][_0x5b71('0x34')]?_0x526dc2[_0x5b71('0x32')]:_0x591a42[_0x5b71('0x2d')];if(!_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x35')](_0x5b71('0x36'))){_0x526dc2[_0x5b71('0x37')]=qs[_0x5b71('0x37')](_0x7387ab['query'][_0x5b71('0x37')]);_0x526dc2[_0x5b71('0x1b')]=qs['offset'](_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x1b')]);}_0x526dc2[_0x5b71('0x38')]=qs['sort'](_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x39')]);_0x526dc2[_0x5b71('0x3a')]=qs['filters'](_[_0x5b71('0x3b')](_0x7387ab[_0x5b71('0x2e')],_0x591a42[_0x5b71('0x30')]),_0xd71245);if(_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x3c')]){_0x526dc2['where']=_[_0x5b71('0x3d')](_0x526dc2[_0x5b71('0x3a')],{'$or':_[_0x5b71('0x28')](_0xd71245,function(_0x492a09){if(_0x492a09[_0x5b71('0x2c')]!==_0x5b71('0x3e')){var _0x6f2749={};_0x6f2749[_0x492a09[_0x5b71('0x27')]]={'$like':'%'+_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x3c')]+'%'};return _0x6f2749;}})});}_0x526dc2=_[_0x5b71('0x3d')]({},_0x526dc2,_0x7387ab[_0x5b71('0x3f')]);var _0x31b1c1={'where':_0x526dc2[_0x5b71('0x3a')]};return db[_0x5b71('0x29')][_0x5b71('0x40')](_0x31b1c1)[_0x5b71('0x22')](function(_0x2e7727){_0x22cd99[_0x5b71('0x40')]=_0x2e7727;if(_0x7387ab[_0x5b71('0x2e')][_0x5b71('0x41')]){_0x526dc2[_0x5b71('0x42')]=[{'all':!![]}];}return db[_0x5b71('0x29')][_0x5b71('0x43')](_0x526dc2);})['then'](function(_0x3797b1){_0x22cd99[_0x5b71('0x44')]=_0x3797b1;return _0x22cd99;})[_0x5b71('0x22')](respondWithFilteredResult(_0x37491b,_0x526dc2))[_0x5b71('0x45')](handleError(_0x37491b,null));};exports[_0x5b71('0x46')]=function(_0x45ac03,_0x30ef68){var _0x2ce85d={'raw':![],'where':{'id':_0x45ac03[_0x5b71('0x47')]['id']}},_0xa35557={};_0xa35557['model']=_['keys'](db[_0x5b71('0x29')][_0x5b71('0x2a')]);_0xa35557[_0x5b71('0x2e')]=_[_0x5b71('0x2f')](_0x45ac03[_0x5b71('0x2e')]);_0xa35557[_0x5b71('0x30')]=_[_0x5b71('0x31')](_0xa35557['model'],_0xa35557[_0x5b71('0x2e')]);_0x2ce85d[_0x5b71('0x32')]=_['intersection'](_0xa35557[_0x5b71('0x2d')],qs[_0x5b71('0x33')](_0x45ac03['query']['fields']));_0x2ce85d['attributes']=_0x2ce85d[_0x5b71('0x32')][_0x5b71('0x34')]?_0x2ce85d['attributes']:_0xa35557[_0x5b71('0x2d')];if(_0x45ac03['query'][_0x5b71('0x41')]){_0x2ce85d[_0x5b71('0x42')]=[{'all':!![]}];}_0x2ce85d=_['merge']({},_0x2ce85d,_0x45ac03[_0x5b71('0x3f')]);return db[_0x5b71('0x29')][_0x5b71('0x48')](_0x2ce85d)['then'](handleEntityNotFound(_0x30ef68,null))['then'](respondWithResult(_0x30ef68,null))[_0x5b71('0x45')](handleError(_0x30ef68,null));};exports[_0x5b71('0x49')]=function(_0x5596b1,_0x4cf914){return db[_0x5b71('0x29')][_0x5b71('0x49')](_0x5596b1[_0x5b71('0x4a')],{})[_0x5b71('0x22')](function(_0x4e6edb){var _0x1ec77b=_0x5596b1[_0x5b71('0x4b')]['get']({'plain':!![]});if(!_0x1ec77b)throw new Error(_0x5b71('0x4c'));if(_0x1ec77b[_0x5b71('0x4d')]===_0x5b71('0x4b')){var _0x336a8e=_0x4e6edb[_0x5b71('0x4e')]({'plain':!![]});var _0x2de699='Triggers';return db['UserProfileSection'][_0x5b71('0x48')]({'where':{'name':_0x2de699,'userProfileId':_0x1ec77b[_0x5b71('0x4f')]},'raw':!![]})[_0x5b71('0x22')](function(_0x46a6a8){if(_0x46a6a8&&_0x46a6a8[_0x5b71('0x50')]===0x0){return db['UserProfileResource'][_0x5b71('0x49')]({'name':_0x336a8e[_0x5b71('0x27')],'resourceId':_0x336a8e['id'],'type':_0x46a6a8[_0x5b71('0x27')],'sectionId':_0x46a6a8['id']},{})[_0x5b71('0x22')](function(){return _0x4e6edb;});}else{return _0x4e6edb;}})[_0x5b71('0x45')](function(_0x5e10f6){logger[_0x5b71('0x25')](_0x5b71('0x51'),_0x5e10f6);throw _0x5e10f6;});}return _0x4e6edb;})[_0x5b71('0x22')](respondWithResult(_0x4cf914,0xc9))[_0x5b71('0x45')](handleError(_0x4cf914,null));};exports[_0x5b71('0x21')]=function(_0x2f1e4f,_0x5112c2){if(_0x2f1e4f[_0x5b71('0x4a')]['id']){delete _0x2f1e4f[_0x5b71('0x4a')]['id'];}return db[_0x5b71('0x29')][_0x5b71('0x48')]({'where':{'id':_0x2f1e4f[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x5112c2,null))[_0x5b71('0x22')](saveUpdates(_0x2f1e4f[_0x5b71('0x4a')],null))[_0x5b71('0x22')](respondWithResult(_0x5112c2,null))[_0x5b71('0x45')](handleError(_0x5112c2,null));};exports[_0x5b71('0x23')]=function(_0x329d94,_0x38efcf){return db[_0x5b71('0x29')][_0x5b71('0x48')]({'where':{'id':_0x329d94[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x38efcf,null))[_0x5b71('0x22')](removeEntity(_0x38efcf,null))[_0x5b71('0x45')](handleError(_0x38efcf,null));};exports[_0x5b71('0x52')]=function(_0x514363,_0x5ec16c,_0x5b4617){if(_0x514363[_0x5b71('0x4a')]['id']){delete _0x514363[_0x5b71('0x4a')]['id'];}return db[_0x5b71('0x29')][_0x5b71('0x48')]({'where':{'id':_0x514363[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x5ec16c,null))[_0x5b71('0x22')](function(_0x2eac31){if(_0x2eac31){_0x514363['body'][_0x5b71('0x53')]=_0x2eac31['id'];return db[_0x5b71('0x54')]['create'](_0x514363[_0x5b71('0x4a')]);}})[_0x5b71('0x22')](respondWithResult(_0x5ec16c,null))[_0x5b71('0x45')](handleError(_0x5ec16c,null));};exports[_0x5b71('0x55')]=function(_0x32c0de,_0x4988a5,_0x36e28f){if(_0x32c0de[_0x5b71('0x4a')]['id']){delete _0x32c0de[_0x5b71('0x4a')]['id'];}return db[_0x5b71('0x29')][_0x5b71('0x48')]({'where':{'id':_0x32c0de[_0x5b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x4988a5,null))[_0x5b71('0x22')](function(_0x4495d0){if(_0x4495d0){_0x32c0de[_0x5b71('0x4a')][_0x5b71('0x56')]=_0x4495d0['id'];return db[_0x5b71('0x54')][_0x5b71('0x49')](_0x32c0de['body']);}})['then'](respondWithResult(_0x4988a5,null))[_0x5b71('0x45')](handleError(_0x4988a5,null));};exports[_0x5b71('0x57')]=function(_0x11d0f4,_0xcbe3d4,_0x4a9609){var _0x1c8a13={};var _0x454e64={};var _0x3a2179;var _0x51dabb;return db['Trigger'][_0x5b71('0x58')]({'where':{'id':_0x11d0f4[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0xcbe3d4,null))['then'](function(_0x1d4281){if(_0x1d4281){_0x3a2179=_0x1d4281;_0x454e64['model']=_[_0x5b71('0x2f')](db[_0x5b71('0x54')][_0x5b71('0x2a')]);_0x454e64['query']=_['keys'](_0x11d0f4['query']);_0x454e64[_0x5b71('0x30')]=_[_0x5b71('0x31')](_0x454e64[_0x5b71('0x2d')],_0x454e64['query']);_0x1c8a13[_0x5b71('0x32')]=_[_0x5b71('0x31')](_0x454e64[_0x5b71('0x2d')],qs['fields'](_0x11d0f4[_0x5b71('0x2e')]['fields']));_0x1c8a13[_0x5b71('0x32')]=_0x1c8a13[_0x5b71('0x32')][_0x5b71('0x34')]?_0x1c8a13[_0x5b71('0x32')]:_0x454e64[_0x5b71('0x2d')];_0x1c8a13[_0x5b71('0x38')]=qs['sort'](_0x11d0f4[_0x5b71('0x2e')][_0x5b71('0x39')]);_0x1c8a13[_0x5b71('0x3a')]=qs[_0x5b71('0x30')](_[_0x5b71('0x3b')](_0x11d0f4[_0x5b71('0x2e')],_0x454e64[_0x5b71('0x30')]));if(_0x11d0f4['query'][_0x5b71('0x3c')]){_0x1c8a13[_0x5b71('0x3a')]=_['merge'](_0x1c8a13[_0x5b71('0x3a')],{'$or':_[_0x5b71('0x28')](_0x1c8a13[_0x5b71('0x32')],function(_0x3dd60f){var _0x530634={};_0x530634[_0x3dd60f]={'$like':'%'+_0x11d0f4[_0x5b71('0x2e')][_0x5b71('0x3c')]+'%'};return _0x530634;})});}_0x1c8a13=_[_0x5b71('0x3d')]({},_0x1c8a13,_0x11d0f4[_0x5b71('0x3f')]);return _0x3a2179[_0x5b71('0x57')](_0x1c8a13);}})[_0x5b71('0x22')](function(_0x37e789){if(_0x37e789){_0x51dabb=_0x37e789[_0x5b71('0x34')];if(!_0x11d0f4['query'][_0x5b71('0x35')]('nolimit')){_0x1c8a13[_0x5b71('0x37')]=qs[_0x5b71('0x37')](_0x11d0f4[_0x5b71('0x2e')][_0x5b71('0x37')]);_0x1c8a13[_0x5b71('0x1b')]=qs['offset'](_0x11d0f4['query'][_0x5b71('0x1b')]);}return _0x3a2179[_0x5b71('0x57')](_0x1c8a13);}})[_0x5b71('0x22')](function(_0x2fad42){if(_0x2fad42){return _0x2fad42?{'count':_0x51dabb,'rows':_0x2fad42}:null;}})[_0x5b71('0x22')](respondWithResult(_0xcbe3d4,null))[_0x5b71('0x45')](handleError(_0xcbe3d4,null));};exports[_0x5b71('0x59')]=function(_0x278142,_0x3e7f9b,_0xa4df1c){var _0xddcec2={};var _0x2b1223={};var _0x439e35;var _0x56805d;return db[_0x5b71('0x29')]['findOne']({'where':{'id':_0x278142[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x3e7f9b,null))[_0x5b71('0x22')](function(_0x7ecfe8){if(_0x7ecfe8){_0x439e35=_0x7ecfe8;_0x2b1223[_0x5b71('0x2d')]=_[_0x5b71('0x2f')](db[_0x5b71('0x54')][_0x5b71('0x2a')]);_0x2b1223[_0x5b71('0x2e')]=_[_0x5b71('0x2f')](_0x278142[_0x5b71('0x2e')]);_0x2b1223['filters']=_['intersection'](_0x2b1223[_0x5b71('0x2d')],_0x2b1223[_0x5b71('0x2e')]);_0xddcec2['attributes']=_[_0x5b71('0x31')](_0x2b1223['model'],qs['fields'](_0x278142[_0x5b71('0x2e')][_0x5b71('0x33')]));_0xddcec2[_0x5b71('0x32')]=_0xddcec2[_0x5b71('0x32')][_0x5b71('0x34')]?_0xddcec2[_0x5b71('0x32')]:_0x2b1223['model'];_0xddcec2[_0x5b71('0x38')]=qs[_0x5b71('0x39')](_0x278142['query'][_0x5b71('0x39')]);_0xddcec2[_0x5b71('0x3a')]=qs[_0x5b71('0x30')](_[_0x5b71('0x3b')](_0x278142[_0x5b71('0x2e')],_0x2b1223[_0x5b71('0x30')]));if(_0x278142[_0x5b71('0x2e')][_0x5b71('0x3c')]){_0xddcec2['where']=_[_0x5b71('0x3d')](_0xddcec2[_0x5b71('0x3a')],{'$or':_['map'](_0xddcec2[_0x5b71('0x32')],function(_0x4d22e3){var _0x4d4a85={};_0x4d4a85[_0x4d22e3]={'$like':'%'+_0x278142[_0x5b71('0x2e')][_0x5b71('0x3c')]+'%'};return _0x4d4a85;})});}_0xddcec2=_[_0x5b71('0x3d')]({},_0xddcec2,_0x278142['options']);return _0x439e35['getAnyConditions'](_0xddcec2);}})[_0x5b71('0x22')](function(_0x2f971c){if(_0x2f971c){_0x56805d=_0x2f971c[_0x5b71('0x34')];if(!_0x278142[_0x5b71('0x2e')][_0x5b71('0x35')](_0x5b71('0x36'))){_0xddcec2[_0x5b71('0x37')]=qs['limit'](_0x278142[_0x5b71('0x2e')][_0x5b71('0x37')]);_0xddcec2[_0x5b71('0x1b')]=qs['offset'](_0x278142['query']['offset']);}return _0x439e35[_0x5b71('0x59')](_0xddcec2);}})['then'](function(_0x2e6e02){if(_0x2e6e02){return _0x2e6e02?{'count':_0x56805d,'rows':_0x2e6e02}:null;}})[_0x5b71('0x22')](respondWithResult(_0x3e7f9b,null))[_0x5b71('0x45')](handleError(_0x3e7f9b,null));};exports[_0x5b71('0x5a')]=function(_0x48b561,_0x2da664,_0x487836){if(_0x48b561[_0x5b71('0x4a')]['id']){delete _0x48b561[_0x5b71('0x4a')]['id'];}return db['Trigger'][_0x5b71('0x48')]({'where':{'id':_0x48b561[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x2da664,null))[_0x5b71('0x22')](function(_0x435d73){if(_0x435d73){_0x48b561[_0x5b71('0x4a')][_0x5b71('0x5b')]=_0x435d73['id'];return db['Action']['create'](_0x48b561[_0x5b71('0x4a')]);}})[_0x5b71('0x22')](respondWithResult(_0x2da664,null))[_0x5b71('0x45')](handleError(_0x2da664,null));};exports[_0x5b71('0x5c')]=function(_0x52f96b,_0x3d8b8d,_0x25c80c){var _0x32a267={};var _0x51399f={};var _0x3ba7b3;var _0x148103;return db[_0x5b71('0x29')][_0x5b71('0x58')]({'where':{'id':_0x52f96b[_0x5b71('0x47')]['id']}})[_0x5b71('0x22')](handleEntityNotFound(_0x3d8b8d,null))[_0x5b71('0x22')](function(_0x1e1052){if(_0x1e1052){_0x3ba7b3=_0x1e1052;_0x51399f[_0x5b71('0x2d')]=_[_0x5b71('0x2f')](db[_0x5b71('0x5d')]['rawAttributes']);_0x51399f[_0x5b71('0x2e')]=_[_0x5b71('0x2f')](_0x52f96b[_0x5b71('0x2e')]);_0x51399f[_0x5b71('0x30')]=_[_0x5b71('0x31')](_0x51399f[_0x5b71('0x2d')],_0x51399f['query']);_0x32a267[_0x5b71('0x32')]=_['intersection'](_0x51399f[_0x5b71('0x2d')],qs[_0x5b71('0x33')](_0x52f96b['query'][_0x5b71('0x33')]));_0x32a267[_0x5b71('0x32')]=_0x32a267[_0x5b71('0x32')][_0x5b71('0x34')]?_0x32a267[_0x5b71('0x32')]:_0x51399f['model'];_0x32a267[_0x5b71('0x38')]=qs['sort'](_0x52f96b[_0x5b71('0x2e')]['sort']);_0x32a267[_0x5b71('0x3a')]=qs['filters'](_[_0x5b71('0x3b')](_0x52f96b[_0x5b71('0x2e')],_0x51399f[_0x5b71('0x30')]));if(_0x52f96b[_0x5b71('0x2e')][_0x5b71('0x3c')]){_0x32a267[_0x5b71('0x3a')]=_[_0x5b71('0x3d')](_0x32a267[_0x5b71('0x3a')],{'$or':_[_0x5b71('0x28')](_0x32a267['attributes'],function(_0x3c33e7){var _0x51a9bb={};_0x51a9bb[_0x3c33e7]={'$like':'%'+_0x52f96b[_0x5b71('0x2e')]['filter']+'%'};return _0x51a9bb;})});}_0x32a267=_[_0x5b71('0x3d')]({},_0x32a267,_0x52f96b[_0x5b71('0x3f')]);return _0x3ba7b3[_0x5b71('0x5c')](_0x32a267);}})[_0x5b71('0x22')](function(_0x2c7584){if(_0x2c7584){_0x148103=_0x2c7584[_0x5b71('0x34')];if(!_0x52f96b[_0x5b71('0x2e')][_0x5b71('0x35')](_0x5b71('0x36'))){_0x32a267[_0x5b71('0x37')]=qs[_0x5b71('0x37')](_0x52f96b[_0x5b71('0x2e')][_0x5b71('0x37')]);_0x32a267[_0x5b71('0x1b')]=qs[_0x5b71('0x1b')](_0x52f96b[_0x5b71('0x2e')][_0x5b71('0x1b')]);}return _0x3ba7b3['getActions'](_0x32a267);}})[_0x5b71('0x22')](function(_0x5b0ee4){if(_0x5b0ee4){return _0x5b0ee4?{'count':_0x148103,'rows':_0x5b0ee4}:null;}})[_0x5b71('0x22')](respondWithResult(_0x3d8b8d,null))[_0x5b71('0x45')](handleError(_0x3d8b8d,null));};
\ No newline at end of file
+var _0x1cf8=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','map','Trigger','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create'];(function(_0xc545f4,_0x587830){var _0x8484a8=function(_0x2b29d1){while(--_0x2b29d1){_0xc545f4['push'](_0xc545f4['shift']());}};_0x8484a8(++_0x587830);}(_0x1cf8,0x76));var _0x81cf=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x1cf8[_0x3c487b];return _0x1d65f6;};'use strict';var emlformat=require(_0x81cf('0x0'));var rimraf=require(_0x81cf('0x1'));var zipdir=require(_0x81cf('0x2'));var jsonpatch=require(_0x81cf('0x3'));var rp=require(_0x81cf('0x4'));var moment=require('moment');var BPromise=require(_0x81cf('0x5'));var Mustache=require(_0x81cf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x81cf('0x7'));var csv=require(_0x81cf('0x8'));var ejs=require(_0x81cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81cf('0xa'));var squel=require(_0x81cf('0xb'));var crypto=require(_0x81cf('0xc'));var jsforce=require(_0x81cf('0xd'));var deskjs=require(_0x81cf('0xe'));var toCsv=require(_0x81cf('0x8'));var querystring=require(_0x81cf('0xf'));var Papa=require(_0x81cf('0x10'));var Redis=require(_0x81cf('0x11'));var authService=require(_0x81cf('0x12'));var qs=require(_0x81cf('0x13'));var as=require(_0x81cf('0x14'));var hardwareService=require(_0x81cf('0x15'));var logger=require(_0x81cf('0x16'))(_0x81cf('0x17'));var utils=require(_0x81cf('0x18'));var config=require(_0x81cf('0x19'));var licenseUtil=require(_0x81cf('0x1a'));var db=require(_0x81cf('0x1b'))['db'];function respondWithStatusCode(_0x35473f,_0xced836){_0xced836=_0xced836||0xcc;return function(_0x51d0d6){if(_0x51d0d6){return _0x35473f[_0x81cf('0x1c')](_0xced836);}return _0x35473f['status'](_0xced836)[_0x81cf('0x1d')]();};}function respondWithResult(_0xa83d31,_0x730c4b){_0x730c4b=_0x730c4b||0xc8;return function(_0x2bddf7){if(_0x2bddf7){return _0xa83d31[_0x81cf('0x1e')](_0x730c4b)['json'](_0x2bddf7);}};}function respondWithFilteredResult(_0x2b6bae,_0x376e41){return function(_0x55169f){if(_0x55169f){var _0x3abcea=typeof _0x376e41[_0x81cf('0x1f')]===_0x81cf('0x20')&&typeof _0x376e41[_0x81cf('0x21')]==='undefined';var _0x2e33e0=_0x55169f[_0x81cf('0x22')];var _0xbd9a99=_0x3abcea?0x0:_0x376e41[_0x81cf('0x1f')];var _0xeb6dc3=_0x3abcea?_0x55169f[_0x81cf('0x22')]:_0x376e41[_0x81cf('0x1f')]+_0x376e41['limit'];var _0x524a76;if(_0xeb6dc3>=_0x2e33e0){_0xeb6dc3=_0x2e33e0;_0x524a76=0xc8;}else{_0x524a76=0xce;}_0x2b6bae[_0x81cf('0x1e')](_0x524a76);return _0x2b6bae[_0x81cf('0x23')](_0x81cf('0x24'),_0xbd9a99+'-'+_0xeb6dc3+'/'+_0x2e33e0)[_0x81cf('0x25')](_0x55169f);}return null;};}function patchUpdates(_0x59862a){return function(_0x1b4768){try{jsonpatch['apply'](_0x1b4768,_0x59862a,!![]);}catch(_0x2cf9f7){return BPromise['reject'](_0x2cf9f7);}return _0x1b4768[_0x81cf('0x26')]();};}function saveUpdates(_0x21e81c,_0x4bae0c){return function(_0x348314){if(_0x348314){return _0x348314['update'](_0x21e81c)[_0x81cf('0x27')](function(_0x4bfd61){return _0x4bfd61;});}return null;};}function removeEntity(_0x25afeb,_0x179ae3){return function(_0x38ef7f){if(_0x38ef7f){return _0x38ef7f[_0x81cf('0x28')]()[_0x81cf('0x27')](function(){var _0x473e17=_0x38ef7f[_0x81cf('0x29')]({'plain':!![]});var _0x5b75d9=_0x81cf('0x2a');return db[_0x81cf('0x2b')][_0x81cf('0x28')]({'where':{'type':_0x5b75d9,'resourceId':_0x473e17['id']}})['then'](function(){return _0x38ef7f;});})[_0x81cf('0x27')](function(){_0x25afeb[_0x81cf('0x1e')](0xcc)[_0x81cf('0x1d')]();});}};}function handleEntityNotFound(_0x18ac79,_0x5b6b66){return function(_0x5ca3b8){if(!_0x5ca3b8){_0x18ac79[_0x81cf('0x1c')](0x194);}return _0x5ca3b8;};}function handleError(_0x408a24,_0xa07049){_0xa07049=_0xa07049||0x1f4;return function(_0x327194){logger[_0x81cf('0x2c')](_0x327194[_0x81cf('0x2d')]);if(_0x327194[_0x81cf('0x2e')]){delete _0x327194[_0x81cf('0x2e')];}_0x408a24[_0x81cf('0x1e')](_0xa07049)['send'](_0x327194);};}exports['index']=function(_0x44e97,_0x315265){var _0x3bbc45={},_0x55c3b9={},_0x22226d={'count':0x0,'rows':[]};var _0x16ca44=_[_0x81cf('0x2f')](db[_0x81cf('0x30')][_0x81cf('0x31')],function(_0x4e6057){return{'name':_0x4e6057[_0x81cf('0x32')],'type':_0x4e6057['type']['key']};});_0x55c3b9[_0x81cf('0x33')]=_['map'](_0x16ca44,'name');_0x55c3b9[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x44e97[_0x81cf('0x34')]);_0x55c3b9[_0x81cf('0x36')]=_['intersection'](_0x55c3b9[_0x81cf('0x33')],_0x55c3b9['query']);_0x3bbc45[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0x55c3b9[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x44e97[_0x81cf('0x34')]['fields']));_0x3bbc45[_0x81cf('0x37')]=_0x3bbc45[_0x81cf('0x37')][_0x81cf('0x3a')]?_0x3bbc45[_0x81cf('0x37')]:_0x55c3b9[_0x81cf('0x33')];if(!_0x44e97['query'][_0x81cf('0x3b')](_0x81cf('0x3c'))){_0x3bbc45[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x44e97[_0x81cf('0x34')]['limit']);_0x3bbc45[_0x81cf('0x1f')]=qs[_0x81cf('0x1f')](_0x44e97[_0x81cf('0x34')][_0x81cf('0x1f')]);}_0x3bbc45[_0x81cf('0x3d')]=qs[_0x81cf('0x3e')](_0x44e97[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x3bbc45[_0x81cf('0x3f')]=qs['filters'](_[_0x81cf('0x40')](_0x44e97['query'],_0x55c3b9[_0x81cf('0x36')]),_0x16ca44);if(_0x44e97[_0x81cf('0x34')][_0x81cf('0x41')]){_0x3bbc45[_0x81cf('0x3f')]=_[_0x81cf('0x42')](_0x3bbc45[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x16ca44,function(_0x5a64c1){if(_0x5a64c1[_0x81cf('0x43')]!==_0x81cf('0x44')){var _0x3d883b={};_0x3d883b[_0x5a64c1[_0x81cf('0x2e')]]={'$like':'%'+_0x44e97[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x3d883b;}})});}_0x3bbc45=_[_0x81cf('0x42')]({},_0x3bbc45,_0x44e97[_0x81cf('0x45')]);var _0x399bc5={'where':_0x3bbc45['where']};return db[_0x81cf('0x30')][_0x81cf('0x22')](_0x399bc5)['then'](function(_0x476f06){_0x22226d[_0x81cf('0x22')]=_0x476f06;if(_0x44e97[_0x81cf('0x34')][_0x81cf('0x46')]){_0x3bbc45[_0x81cf('0x47')]=[{'all':!![]}];}return db[_0x81cf('0x30')][_0x81cf('0x48')](_0x3bbc45);})['then'](function(_0x44f311){_0x22226d[_0x81cf('0x49')]=_0x44f311;return _0x22226d;})['then'](respondWithFilteredResult(_0x315265,_0x3bbc45))['catch'](handleError(_0x315265,null));};exports[_0x81cf('0x4a')]=function(_0x2301ed,_0x53dba7){var _0x574c30={'raw':![],'where':{'id':_0x2301ed[_0x81cf('0x4b')]['id']}},_0x257863={};_0x257863[_0x81cf('0x33')]=_['keys'](db[_0x81cf('0x30')][_0x81cf('0x31')]);_0x257863[_0x81cf('0x34')]=_['keys'](_0x2301ed[_0x81cf('0x34')]);_0x257863[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0x257863['model'],_0x257863[_0x81cf('0x34')]);_0x574c30[_0x81cf('0x37')]=_['intersection'](_0x257863[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x2301ed[_0x81cf('0x34')]['fields']));_0x574c30[_0x81cf('0x37')]=_0x574c30['attributes'][_0x81cf('0x3a')]?_0x574c30[_0x81cf('0x37')]:_0x257863[_0x81cf('0x33')];if(_0x2301ed['query'][_0x81cf('0x46')]){_0x574c30[_0x81cf('0x47')]=[{'all':!![]}];}_0x574c30=_[_0x81cf('0x42')]({},_0x574c30,_0x2301ed[_0x81cf('0x45')]);return db[_0x81cf('0x30')][_0x81cf('0x4c')](_0x574c30)[_0x81cf('0x27')](handleEntityNotFound(_0x53dba7,null))['then'](respondWithResult(_0x53dba7,null))['catch'](handleError(_0x53dba7,null));};exports[_0x81cf('0x4d')]=function(_0x5653e2,_0x2ab33e){return db[_0x81cf('0x30')]['create'](_0x5653e2[_0x81cf('0x4e')],{})[_0x81cf('0x27')](function(_0x1a0bad){var _0x585610=_0x5653e2[_0x81cf('0x4f')][_0x81cf('0x29')]({'plain':!![]});if(!_0x585610)throw new Error(_0x81cf('0x50'));if(_0x585610[_0x81cf('0x51')]==='user'){var _0x3261e9=_0x1a0bad[_0x81cf('0x29')]({'plain':!![]});var _0x4c1a77=_0x81cf('0x2a');return db[_0x81cf('0x52')][_0x81cf('0x4c')]({'where':{'name':_0x4c1a77,'userProfileId':_0x585610['userProfileId']},'raw':!![]})[_0x81cf('0x27')](function(_0x4bad73){if(_0x4bad73&&_0x4bad73[_0x81cf('0x53')]===0x0){return db[_0x81cf('0x2b')][_0x81cf('0x4d')]({'name':_0x3261e9[_0x81cf('0x2e')],'resourceId':_0x3261e9['id'],'type':_0x4bad73[_0x81cf('0x2e')],'sectionId':_0x4bad73['id']},{})[_0x81cf('0x27')](function(){return _0x1a0bad;});}else{return _0x1a0bad;}})[_0x81cf('0x54')](function(_0x248431){logger['error'](_0x81cf('0x55'),_0x248431);throw _0x248431;});}return _0x1a0bad;})[_0x81cf('0x27')](respondWithResult(_0x2ab33e,0xc9))[_0x81cf('0x54')](handleError(_0x2ab33e,null));};exports[_0x81cf('0x56')]=function(_0x2ccbea,_0x970f10){if(_0x2ccbea[_0x81cf('0x4e')]['id']){delete _0x2ccbea[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x2ccbea[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x970f10,null))[_0x81cf('0x27')](saveUpdates(_0x2ccbea[_0x81cf('0x4e')],null))['then'](respondWithResult(_0x970f10,null))[_0x81cf('0x54')](handleError(_0x970f10,null));};exports[_0x81cf('0x28')]=function(_0x3039e3,_0x4730f3){return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x3039e3[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x4730f3,null))['then'](removeEntity(_0x4730f3,null))[_0x81cf('0x54')](handleError(_0x4730f3,null));};exports[_0x81cf('0x57')]=function(_0x47066b,_0x22e7cb,_0x1a5169){if(_0x47066b[_0x81cf('0x4e')]['id']){delete _0x47066b[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')]['find']({'where':{'id':_0x47066b[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x22e7cb,null))[_0x81cf('0x27')](function(_0x472e83){if(_0x472e83){_0x47066b[_0x81cf('0x4e')][_0x81cf('0x58')]=_0x472e83['id'];return db[_0x81cf('0x59')]['create'](_0x47066b[_0x81cf('0x4e')]);}})[_0x81cf('0x27')](respondWithResult(_0x22e7cb,null))[_0x81cf('0x54')](handleError(_0x22e7cb,null));};exports[_0x81cf('0x5a')]=function(_0x13323a,_0x5924bb,_0x49327e){if(_0x13323a[_0x81cf('0x4e')]['id']){delete _0x13323a['body']['id'];}return db[_0x81cf('0x30')]['find']({'where':{'id':_0x13323a[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x5924bb,null))[_0x81cf('0x27')](function(_0x1e7f3b){if(_0x1e7f3b){_0x13323a['body'][_0x81cf('0x5b')]=_0x1e7f3b['id'];return db[_0x81cf('0x59')]['create'](_0x13323a['body']);}})[_0x81cf('0x27')](respondWithResult(_0x5924bb,null))['catch'](handleError(_0x5924bb,null));};exports['getAllConditions']=function(_0x4d183a,_0xa87c54,_0xbf0e24){var _0x133206={};var _0x3eea61={};var _0x52ffcc;var _0x554ccc;return db['Trigger'][_0x81cf('0x5c')]({'where':{'id':_0x4d183a['params']['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0xa87c54,null))[_0x81cf('0x27')](function(_0xdf2679){if(_0xdf2679){_0x52ffcc=_0xdf2679;_0x3eea61['model']=_[_0x81cf('0x35')](db['Condition']['rawAttributes']);_0x3eea61['query']=_['keys'](_0x4d183a[_0x81cf('0x34')]);_0x3eea61['filters']=_[_0x81cf('0x38')](_0x3eea61[_0x81cf('0x33')],_0x3eea61['query']);_0x133206[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0x3eea61['model'],qs[_0x81cf('0x39')](_0x4d183a['query'][_0x81cf('0x39')]));_0x133206[_0x81cf('0x37')]=_0x133206[_0x81cf('0x37')]['length']?_0x133206[_0x81cf('0x37')]:_0x3eea61[_0x81cf('0x33')];_0x133206[_0x81cf('0x3d')]=qs[_0x81cf('0x3e')](_0x4d183a['query'][_0x81cf('0x3e')]);_0x133206['where']=qs[_0x81cf('0x36')](_['pick'](_0x4d183a[_0x81cf('0x34')],_0x3eea61[_0x81cf('0x36')]));if(_0x4d183a[_0x81cf('0x34')][_0x81cf('0x41')]){_0x133206['where']=_['merge'](_0x133206[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x133206[_0x81cf('0x37')],function(_0x7d4906){var _0x3f2096={};_0x3f2096[_0x7d4906]={'$like':'%'+_0x4d183a[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x3f2096;})});}_0x133206=_['merge']({},_0x133206,_0x4d183a[_0x81cf('0x45')]);return _0x52ffcc[_0x81cf('0x5d')](_0x133206);}})['then'](function(_0x4481ef){if(_0x4481ef){_0x554ccc=_0x4481ef['length'];if(!_0x4d183a[_0x81cf('0x34')]['hasOwnProperty'](_0x81cf('0x3c'))){_0x133206[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x4d183a['query']['limit']);_0x133206['offset']=qs[_0x81cf('0x1f')](_0x4d183a[_0x81cf('0x34')][_0x81cf('0x1f')]);}return _0x52ffcc[_0x81cf('0x5d')](_0x133206);}})[_0x81cf('0x27')](function(_0x284f8c){if(_0x284f8c){return _0x284f8c?{'count':_0x554ccc,'rows':_0x284f8c}:null;}})[_0x81cf('0x27')](respondWithResult(_0xa87c54,null))['catch'](handleError(_0xa87c54,null));};exports['getAnyConditions']=function(_0x54b0c4,_0x2f2700,_0x52d421){var _0x2d279d={};var _0x319061={};var _0x37a0b1;var _0x18fa2a;return db[_0x81cf('0x30')][_0x81cf('0x5c')]({'where':{'id':_0x54b0c4[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x2f2700,null))['then'](function(_0x433bbe){if(_0x433bbe){_0x37a0b1=_0x433bbe;_0x319061[_0x81cf('0x33')]=_[_0x81cf('0x35')](db[_0x81cf('0x59')]['rawAttributes']);_0x319061[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x54b0c4['query']);_0x319061[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0x319061[_0x81cf('0x33')],_0x319061[_0x81cf('0x34')]);_0x2d279d['attributes']=_['intersection'](_0x319061[_0x81cf('0x33')],qs['fields'](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x39')]));_0x2d279d['attributes']=_0x2d279d[_0x81cf('0x37')][_0x81cf('0x3a')]?_0x2d279d['attributes']:_0x319061[_0x81cf('0x33')];_0x2d279d['order']=qs[_0x81cf('0x3e')](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x2d279d[_0x81cf('0x3f')]=qs[_0x81cf('0x36')](_[_0x81cf('0x40')](_0x54b0c4[_0x81cf('0x34')],_0x319061['filters']));if(_0x54b0c4[_0x81cf('0x34')]['filter']){_0x2d279d[_0x81cf('0x3f')]=_[_0x81cf('0x42')](_0x2d279d[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x2d279d['attributes'],function(_0x5059f8){var _0x908ca7={};_0x908ca7[_0x5059f8]={'$like':'%'+_0x54b0c4['query'][_0x81cf('0x41')]+'%'};return _0x908ca7;})});}_0x2d279d=_[_0x81cf('0x42')]({},_0x2d279d,_0x54b0c4[_0x81cf('0x45')]);return _0x37a0b1[_0x81cf('0x5e')](_0x2d279d);}})['then'](function(_0x2ee30a){if(_0x2ee30a){_0x18fa2a=_0x2ee30a[_0x81cf('0x3a')];if(!_0x54b0c4['query'][_0x81cf('0x3b')](_0x81cf('0x3c'))){_0x2d279d['limit']=qs[_0x81cf('0x21')](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x21')]);_0x2d279d['offset']=qs[_0x81cf('0x1f')](_0x54b0c4['query'][_0x81cf('0x1f')]);}return _0x37a0b1['getAnyConditions'](_0x2d279d);}})[_0x81cf('0x27')](function(_0x31423d){if(_0x31423d){return _0x31423d?{'count':_0x18fa2a,'rows':_0x31423d}:null;}})[_0x81cf('0x27')](respondWithResult(_0x2f2700,null))['catch'](handleError(_0x2f2700,null));};exports['addAction']=function(_0x1d4f4d,_0x28f9ba,_0xb1b191){if(_0x1d4f4d[_0x81cf('0x4e')]['id']){delete _0x1d4f4d[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x1d4f4d[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x28f9ba,null))[_0x81cf('0x27')](function(_0x48b70a){if(_0x48b70a){_0x1d4f4d['body'][_0x81cf('0x5f')]=_0x48b70a['id'];return db[_0x81cf('0x60')]['create'](_0x1d4f4d[_0x81cf('0x4e')]);}})['then'](respondWithResult(_0x28f9ba,null))[_0x81cf('0x54')](handleError(_0x28f9ba,null));};exports[_0x81cf('0x61')]=function(_0x6af14a,_0x5cc509,_0x4c1f12){var _0x2882fe={};var _0xb4e2c2={};var _0xf68ffb;var _0x2e8c57;return db[_0x81cf('0x30')][_0x81cf('0x5c')]({'where':{'id':_0x6af14a[_0x81cf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cc509,null))[_0x81cf('0x27')](function(_0x1f37d5){if(_0x1f37d5){_0xf68ffb=_0x1f37d5;_0xb4e2c2[_0x81cf('0x33')]=_[_0x81cf('0x35')](db[_0x81cf('0x60')][_0x81cf('0x31')]);_0xb4e2c2[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x6af14a[_0x81cf('0x34')]);_0xb4e2c2[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0xb4e2c2[_0x81cf('0x33')],_0xb4e2c2[_0x81cf('0x34')]);_0x2882fe[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0xb4e2c2[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x39')]));_0x2882fe['attributes']=_0x2882fe[_0x81cf('0x37')]['length']?_0x2882fe[_0x81cf('0x37')]:_0xb4e2c2[_0x81cf('0x33')];_0x2882fe['order']=qs[_0x81cf('0x3e')](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x2882fe[_0x81cf('0x3f')]=qs[_0x81cf('0x36')](_[_0x81cf('0x40')](_0x6af14a[_0x81cf('0x34')],_0xb4e2c2[_0x81cf('0x36')]));if(_0x6af14a['query']['filter']){_0x2882fe[_0x81cf('0x3f')]=_['merge'](_0x2882fe[_0x81cf('0x3f')],{'$or':_['map'](_0x2882fe['attributes'],function(_0x4e3792){var _0x99c5f0={};_0x99c5f0[_0x4e3792]={'$like':'%'+_0x6af14a[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x99c5f0;})});}_0x2882fe=_[_0x81cf('0x42')]({},_0x2882fe,_0x6af14a[_0x81cf('0x45')]);return _0xf68ffb['getActions'](_0x2882fe);}})[_0x81cf('0x27')](function(_0x584532){if(_0x584532){_0x2e8c57=_0x584532['length'];if(!_0x6af14a['query']['hasOwnProperty']('nolimit')){_0x2882fe[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x6af14a['query'][_0x81cf('0x21')]);_0x2882fe[_0x81cf('0x1f')]=qs['offset'](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x1f')]);}return _0xf68ffb[_0x81cf('0x61')](_0x2882fe);}})[_0x81cf('0x27')](function(_0x3fa8fd){if(_0x3fa8fd){return _0x3fa8fd?{'count':_0x2e8c57,'rows':_0x3fa8fd}:null;}})[_0x81cf('0x27')](respondWithResult(_0x5cc509,null))[_0x81cf('0x54')](handleError(_0x5cc509,null));};
\ No newline at end of file