Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / trigger / trigger.controller.js
index e69a795..4badb9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7de9=['getAllConditions','nolimit','order','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Triggers','destroy','error','name','send','index','map','Trigger','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne'];(function(_0x1c81f5,_0x3dafc9){var _0x5a99c8=function(_0x7d43f6){while(--_0x7d43f6){_0x1c81f5['push'](_0x1c81f5['shift']());}};_0x5a99c8(++_0x3dafc9);}(_0x7de9,0x12a));var _0x97de=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x7de9[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x97de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97de('0x1'));var jsonpatch=require(_0x97de('0x2'));var rp=require(_0x97de('0x3'));var moment=require(_0x97de('0x4'));var BPromise=require(_0x97de('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97de('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97de('0x7'));var _=require(_0x97de('0x8'));var squel=require(_0x97de('0x9'));var crypto=require('crypto');var jsforce=require(_0x97de('0xa'));var deskjs=require(_0x97de('0xb'));var toCsv=require(_0x97de('0xc'));var querystring=require(_0x97de('0xd'));var Papa=require(_0x97de('0xe'));var Redis=require(_0x97de('0xf'));var authService=require(_0x97de('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x97de('0x11'));var hardwareService=require(_0x97de('0x12'));var logger=require(_0x97de('0x13'))('api');var utils=require(_0x97de('0x14'));var config=require(_0x97de('0x15'));var licenseUtil=require(_0x97de('0x16'));var db=require(_0x97de('0x17'))['db'];function respondWithStatusCode(_0x2b7672,_0x13d893){_0x13d893=_0x13d893||0xcc;return function(_0x35e3b9){if(_0x35e3b9){return _0x2b7672[_0x97de('0x18')](_0x13d893);}return _0x2b7672[_0x97de('0x19')](_0x13d893)[_0x97de('0x1a')]();};}function respondWithResult(_0x55f5db,_0x757e97){_0x757e97=_0x757e97||0xc8;return function(_0x1f5491){if(_0x1f5491){return _0x55f5db[_0x97de('0x19')](_0x757e97)['json'](_0x1f5491);}};}function respondWithFilteredResult(_0x427944,_0x30ceb5){return function(_0xc549e){if(_0xc549e){var _0x4c22b0=typeof _0x30ceb5[_0x97de('0x1b')]===_0x97de('0x1c')&&typeof _0x30ceb5[_0x97de('0x1d')]===_0x97de('0x1c');var _0x23ba12=_0xc549e['count'];var _0x27c70a=_0x4c22b0?0x0:_0x30ceb5[_0x97de('0x1b')];var _0x42c06a=_0x4c22b0?_0xc549e[_0x97de('0x1e')]:_0x30ceb5['offset']+_0x30ceb5[_0x97de('0x1d')];var _0x338b8e;if(_0x42c06a>=_0x23ba12){_0x42c06a=_0x23ba12;_0x338b8e=0xc8;}else{_0x338b8e=0xce;}_0x427944['status'](_0x338b8e);return _0x427944[_0x97de('0x1f')](_0x97de('0x20'),_0x27c70a+'-'+_0x42c06a+'/'+_0x23ba12)[_0x97de('0x21')](_0xc549e);}return null;};}function patchUpdates(_0x21283f){return function(_0x55f855){try{jsonpatch[_0x97de('0x22')](_0x55f855,_0x21283f,!![]);}catch(_0x2b150c){return BPromise[_0x97de('0x23')](_0x2b150c);}return _0x55f855[_0x97de('0x24')]();};}function saveUpdates(_0x4404c6,_0x24d63e){return function(_0x16bb1c){if(_0x16bb1c){return _0x16bb1c[_0x97de('0x25')](_0x4404c6)[_0x97de('0x26')](function(_0x1cfcea){return _0x1cfcea;});}return null;};}function removeEntity(_0x416e45,_0x863704){return function(_0x5ee41c){if(_0x5ee41c){return _0x5ee41c['destroy']()[_0x97de('0x26')](function(){var _0x487816=_0x5ee41c[_0x97de('0x27')]({'plain':!![]});var _0x6de8f8=_0x97de('0x28');return db['UserProfileResource'][_0x97de('0x29')]({'where':{'type':_0x6de8f8,'resourceId':_0x487816['id']}})[_0x97de('0x26')](function(){return _0x5ee41c;});})[_0x97de('0x26')](function(){_0x416e45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x373f86,_0x389169){return function(_0x108fcf){if(!_0x108fcf){_0x373f86['sendStatus'](0x194);}return _0x108fcf;};}function handleError(_0x420709,_0x405cbb){_0x405cbb=_0x405cbb||0x1f4;return function(_0x2b8bae){logger[_0x97de('0x2a')](_0x2b8bae['stack']);if(_0x2b8bae[_0x97de('0x2b')]){delete _0x2b8bae[_0x97de('0x2b')];}_0x420709[_0x97de('0x19')](_0x405cbb)[_0x97de('0x2c')](_0x2b8bae);};}exports[_0x97de('0x2d')]=function(_0x3c35b5,_0x5bbae4){var _0x161f61={},_0x59609f={},_0x17b659={'count':0x0,'rows':[]};var _0x2b0824=_[_0x97de('0x2e')](db[_0x97de('0x2f')]['rawAttributes'],function(_0x42aea2){return{'name':_0x42aea2[_0x97de('0x30')],'type':_0x42aea2[_0x97de('0x31')][_0x97de('0x32')]};});_0x59609f[_0x97de('0x33')]=_[_0x97de('0x2e')](_0x2b0824,_0x97de('0x2b'));_0x59609f['query']=_[_0x97de('0x34')](_0x3c35b5['query']);_0x59609f[_0x97de('0x35')]=_[_0x97de('0x36')](_0x59609f[_0x97de('0x33')],_0x59609f[_0x97de('0x37')]);_0x161f61[_0x97de('0x38')]=_[_0x97de('0x36')](_0x59609f[_0x97de('0x33')],qs['fields'](_0x3c35b5['query'][_0x97de('0x39')]));_0x161f61[_0x97de('0x38')]=_0x161f61[_0x97de('0x38')][_0x97de('0x3a')]?_0x161f61['attributes']:_0x59609f[_0x97de('0x33')];if(!_0x3c35b5[_0x97de('0x37')][_0x97de('0x3b')]('nolimit')){_0x161f61[_0x97de('0x1d')]=qs['limit'](_0x3c35b5[_0x97de('0x37')][_0x97de('0x1d')]);_0x161f61['offset']=qs[_0x97de('0x1b')](_0x3c35b5['query']['offset']);}_0x161f61['order']=qs[_0x97de('0x3c')](_0x3c35b5['query']['sort']);_0x161f61[_0x97de('0x3d')]=qs['filters'](_[_0x97de('0x3e')](_0x3c35b5[_0x97de('0x37')],_0x59609f[_0x97de('0x35')]),_0x2b0824);if(_0x3c35b5[_0x97de('0x37')][_0x97de('0x3f')]){_0x161f61[_0x97de('0x3d')]=_[_0x97de('0x40')](_0x161f61[_0x97de('0x3d')],{'$or':_[_0x97de('0x2e')](_0x2b0824,function(_0x5a9df0){if(_0x5a9df0[_0x97de('0x31')]!==_0x97de('0x41')){var _0x11f05c={};_0x11f05c[_0x5a9df0[_0x97de('0x2b')]]={'$like':'%'+_0x3c35b5[_0x97de('0x37')]['filter']+'%'};return _0x11f05c;}})});}_0x161f61=_['merge']({},_0x161f61,_0x3c35b5[_0x97de('0x42')]);var _0x4ad33d={'where':_0x161f61['where']};return db['Trigger']['count'](_0x4ad33d)[_0x97de('0x26')](function(_0x3c2e30){_0x17b659['count']=_0x3c2e30;if(_0x3c35b5[_0x97de('0x37')][_0x97de('0x43')]){_0x161f61[_0x97de('0x44')]=[{'all':!![]}];}return db[_0x97de('0x2f')]['findAll'](_0x161f61);})[_0x97de('0x26')](function(_0x429e20){_0x17b659[_0x97de('0x45')]=_0x429e20;return _0x17b659;})[_0x97de('0x26')](respondWithFilteredResult(_0x5bbae4,_0x161f61))['catch'](handleError(_0x5bbae4,null));};exports[_0x97de('0x46')]=function(_0x1228b2,_0x21945e){var _0x41bd45={'raw':![],'where':{'id':_0x1228b2[_0x97de('0x47')]['id']}},_0x52737e={};_0x52737e[_0x97de('0x33')]=_['keys'](db[_0x97de('0x2f')][_0x97de('0x48')]);_0x52737e[_0x97de('0x37')]=_[_0x97de('0x34')](_0x1228b2[_0x97de('0x37')]);_0x52737e[_0x97de('0x35')]=_[_0x97de('0x36')](_0x52737e[_0x97de('0x33')],_0x52737e['query']);_0x41bd45[_0x97de('0x38')]=_[_0x97de('0x36')](_0x52737e[_0x97de('0x33')],qs[_0x97de('0x39')](_0x1228b2[_0x97de('0x37')][_0x97de('0x39')]));_0x41bd45['attributes']=_0x41bd45[_0x97de('0x38')][_0x97de('0x3a')]?_0x41bd45['attributes']:_0x52737e[_0x97de('0x33')];if(_0x1228b2['query'][_0x97de('0x43')]){_0x41bd45[_0x97de('0x44')]=[{'all':!![]}];}_0x41bd45=_[_0x97de('0x40')]({},_0x41bd45,_0x1228b2[_0x97de('0x42')]);return db[_0x97de('0x2f')]['find'](_0x41bd45)['then'](handleEntityNotFound(_0x21945e,null))[_0x97de('0x26')](respondWithResult(_0x21945e,null))[_0x97de('0x49')](handleError(_0x21945e,null));};exports[_0x97de('0x4a')]=function(_0x1edad4,_0x59096c){return db[_0x97de('0x2f')][_0x97de('0x4a')](_0x1edad4[_0x97de('0x4b')],{})[_0x97de('0x26')](function(_0xa8597f){var _0x265cc2=_0x1edad4[_0x97de('0x4c')][_0x97de('0x27')]({'plain':!![]});if(!_0x265cc2)throw new Error(_0x97de('0x4d'));if(_0x265cc2[_0x97de('0x4e')]===_0x97de('0x4c')){var _0x18a136=_0xa8597f[_0x97de('0x27')]({'plain':!![]});var _0x4384e7=_0x97de('0x28');return db[_0x97de('0x4f')][_0x97de('0x50')]({'where':{'name':_0x4384e7,'userProfileId':_0x265cc2[_0x97de('0x51')]},'raw':!![]})['then'](function(_0x337efa){if(_0x337efa&&_0x337efa[_0x97de('0x52')]===0x0){return db[_0x97de('0x53')][_0x97de('0x4a')]({'name':_0x18a136[_0x97de('0x2b')],'resourceId':_0x18a136['id'],'type':_0x337efa['name'],'sectionId':_0x337efa['id']},{})[_0x97de('0x26')](function(){return _0xa8597f;});}else{return _0xa8597f;}})[_0x97de('0x49')](function(_0x59c5a0){logger[_0x97de('0x2a')](_0x97de('0x54'),_0x59c5a0);throw _0x59c5a0;});}return _0xa8597f;})[_0x97de('0x26')](respondWithResult(_0x59096c,0xc9))[_0x97de('0x49')](handleError(_0x59096c,null));};exports['update']=function(_0x1ec1aa,_0x1a9b84){if(_0x1ec1aa['body']['id']){delete _0x1ec1aa['body']['id'];}return db[_0x97de('0x2f')][_0x97de('0x50')]({'where':{'id':_0x1ec1aa[_0x97de('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9b84,null))['then'](saveUpdates(_0x1ec1aa[_0x97de('0x4b')],null))['then'](respondWithResult(_0x1a9b84,null))['catch'](handleError(_0x1a9b84,null));};exports[_0x97de('0x29')]=function(_0x4fa9ce,_0x2956b9){return db['Trigger'][_0x97de('0x50')]({'where':{'id':_0x4fa9ce[_0x97de('0x47')]['id']}})[_0x97de('0x26')](handleEntityNotFound(_0x2956b9,null))[_0x97de('0x26')](removeEntity(_0x2956b9,null))[_0x97de('0x49')](handleError(_0x2956b9,null));};exports[_0x97de('0x55')]=function(_0x44b0d1,_0x35907e,_0x3615c4){if(_0x44b0d1[_0x97de('0x4b')]['id']){delete _0x44b0d1[_0x97de('0x4b')]['id'];}return db[_0x97de('0x2f')][_0x97de('0x50')]({'where':{'id':_0x44b0d1[_0x97de('0x47')]['id']}})['then'](handleEntityNotFound(_0x35907e,null))[_0x97de('0x26')](function(_0xd4dc22){if(_0xd4dc22){_0x44b0d1['body'][_0x97de('0x56')]=_0xd4dc22['id'];return db[_0x97de('0x57')]['create'](_0x44b0d1['body']);}})[_0x97de('0x26')](respondWithResult(_0x35907e,null))['catch'](handleError(_0x35907e,null));};exports[_0x97de('0x58')]=function(_0x4136a2,_0x83faf,_0x44d9d7){if(_0x4136a2['body']['id']){delete _0x4136a2[_0x97de('0x4b')]['id'];}return db[_0x97de('0x2f')][_0x97de('0x50')]({'where':{'id':_0x4136a2['params']['id']}})['then'](handleEntityNotFound(_0x83faf,null))[_0x97de('0x26')](function(_0x4b766c){if(_0x4b766c){_0x4136a2[_0x97de('0x4b')]['TriggerAnyId']=_0x4b766c['id'];return db[_0x97de('0x57')][_0x97de('0x4a')](_0x4136a2[_0x97de('0x4b')]);}})['then'](respondWithResult(_0x83faf,null))['catch'](handleError(_0x83faf,null));};exports['getAllConditions']=function(_0x539566,_0x10a964,_0x13c8c0){var _0x4c17f2={};var _0x21c224={};var _0x21fc59;var _0x18f0c1;return db[_0x97de('0x2f')][_0x97de('0x59')]({'where':{'id':_0x539566[_0x97de('0x47')]['id']}})['then'](handleEntityNotFound(_0x10a964,null))[_0x97de('0x26')](function(_0x18dbf7){if(_0x18dbf7){_0x21fc59=_0x18dbf7;_0x21c224['model']=_[_0x97de('0x34')](db[_0x97de('0x57')][_0x97de('0x48')]);_0x21c224[_0x97de('0x37')]=_[_0x97de('0x34')](_0x539566['query']);_0x21c224['filters']=_[_0x97de('0x36')](_0x21c224[_0x97de('0x33')],_0x21c224['query']);_0x4c17f2[_0x97de('0x38')]=_['intersection'](_0x21c224[_0x97de('0x33')],qs[_0x97de('0x39')](_0x539566[_0x97de('0x37')][_0x97de('0x39')]));_0x4c17f2[_0x97de('0x38')]=_0x4c17f2[_0x97de('0x38')][_0x97de('0x3a')]?_0x4c17f2[_0x97de('0x38')]:_0x21c224[_0x97de('0x33')];_0x4c17f2['order']=qs[_0x97de('0x3c')](_0x539566[_0x97de('0x37')][_0x97de('0x3c')]);_0x4c17f2[_0x97de('0x3d')]=qs[_0x97de('0x35')](_['pick'](_0x539566[_0x97de('0x37')],_0x21c224[_0x97de('0x35')]));if(_0x539566[_0x97de('0x37')]['filter']){_0x4c17f2[_0x97de('0x3d')]=_[_0x97de('0x40')](_0x4c17f2[_0x97de('0x3d')],{'$or':_[_0x97de('0x2e')](_0x4c17f2[_0x97de('0x38')],function(_0x58953c){var _0x20788f={};_0x20788f[_0x58953c]={'$like':'%'+_0x539566['query'][_0x97de('0x3f')]+'%'};return _0x20788f;})});}_0x4c17f2=_['merge']({},_0x4c17f2,_0x539566['options']);return _0x21fc59[_0x97de('0x5a')](_0x4c17f2);}})[_0x97de('0x26')](function(_0x3ee4b3){if(_0x3ee4b3){_0x18f0c1=_0x3ee4b3[_0x97de('0x3a')];if(!_0x539566['query'][_0x97de('0x3b')](_0x97de('0x5b'))){_0x4c17f2['limit']=qs[_0x97de('0x1d')](_0x539566['query']['limit']);_0x4c17f2[_0x97de('0x1b')]=qs[_0x97de('0x1b')](_0x539566['query']['offset']);}return _0x21fc59[_0x97de('0x5a')](_0x4c17f2);}})['then'](function(_0x4ec411){if(_0x4ec411){return _0x4ec411?{'count':_0x18f0c1,'rows':_0x4ec411}:null;}})[_0x97de('0x26')](respondWithResult(_0x10a964,null))['catch'](handleError(_0x10a964,null));};exports['getAnyConditions']=function(_0x21de4a,_0x3bcb84,_0xf32a5e){var _0x2c9a3f={};var _0xae1485={};var _0xe68bce;var _0x5280e3;return db['Trigger'][_0x97de('0x59')]({'where':{'id':_0x21de4a[_0x97de('0x47')]['id']}})[_0x97de('0x26')](handleEntityNotFound(_0x3bcb84,null))['then'](function(_0x351f55){if(_0x351f55){_0xe68bce=_0x351f55;_0xae1485[_0x97de('0x33')]=_[_0x97de('0x34')](db[_0x97de('0x57')][_0x97de('0x48')]);_0xae1485[_0x97de('0x37')]=_[_0x97de('0x34')](_0x21de4a[_0x97de('0x37')]);_0xae1485['filters']=_[_0x97de('0x36')](_0xae1485[_0x97de('0x33')],_0xae1485['query']);_0x2c9a3f[_0x97de('0x38')]=_[_0x97de('0x36')](_0xae1485['model'],qs[_0x97de('0x39')](_0x21de4a[_0x97de('0x37')][_0x97de('0x39')]));_0x2c9a3f[_0x97de('0x38')]=_0x2c9a3f[_0x97de('0x38')][_0x97de('0x3a')]?_0x2c9a3f[_0x97de('0x38')]:_0xae1485[_0x97de('0x33')];_0x2c9a3f[_0x97de('0x5c')]=qs[_0x97de('0x3c')](_0x21de4a[_0x97de('0x37')][_0x97de('0x3c')]);_0x2c9a3f['where']=qs[_0x97de('0x35')](_[_0x97de('0x3e')](_0x21de4a[_0x97de('0x37')],_0xae1485['filters']));if(_0x21de4a[_0x97de('0x37')][_0x97de('0x3f')]){_0x2c9a3f[_0x97de('0x3d')]=_[_0x97de('0x40')](_0x2c9a3f[_0x97de('0x3d')],{'$or':_[_0x97de('0x2e')](_0x2c9a3f[_0x97de('0x38')],function(_0x2004c4){var _0x2cc5ea={};_0x2cc5ea[_0x2004c4]={'$like':'%'+_0x21de4a[_0x97de('0x37')]['filter']+'%'};return _0x2cc5ea;})});}_0x2c9a3f=_['merge']({},_0x2c9a3f,_0x21de4a[_0x97de('0x42')]);return _0xe68bce[_0x97de('0x5d')](_0x2c9a3f);}})[_0x97de('0x26')](function(_0x53a7ba){if(_0x53a7ba){_0x5280e3=_0x53a7ba[_0x97de('0x3a')];if(!_0x21de4a[_0x97de('0x37')][_0x97de('0x3b')](_0x97de('0x5b'))){_0x2c9a3f[_0x97de('0x1d')]=qs['limit'](_0x21de4a[_0x97de('0x37')][_0x97de('0x1d')]);_0x2c9a3f[_0x97de('0x1b')]=qs[_0x97de('0x1b')](_0x21de4a['query'][_0x97de('0x1b')]);}return _0xe68bce[_0x97de('0x5d')](_0x2c9a3f);}})[_0x97de('0x26')](function(_0x3fc261){if(_0x3fc261){return _0x3fc261?{'count':_0x5280e3,'rows':_0x3fc261}:null;}})[_0x97de('0x26')](respondWithResult(_0x3bcb84,null))[_0x97de('0x49')](handleError(_0x3bcb84,null));};exports['addAction']=function(_0x2201c9,_0xfb0a52,_0x4cd9b5){if(_0x2201c9[_0x97de('0x4b')]['id']){delete _0x2201c9[_0x97de('0x4b')]['id'];}return db[_0x97de('0x2f')][_0x97de('0x50')]({'where':{'id':_0x2201c9[_0x97de('0x47')]['id']}})[_0x97de('0x26')](handleEntityNotFound(_0xfb0a52,null))[_0x97de('0x26')](function(_0x1a7d23){if(_0x1a7d23){_0x2201c9[_0x97de('0x4b')][_0x97de('0x5e')]=_0x1a7d23['id'];return db[_0x97de('0x5f')][_0x97de('0x4a')](_0x2201c9[_0x97de('0x4b')]);}})[_0x97de('0x26')](respondWithResult(_0xfb0a52,null))['catch'](handleError(_0xfb0a52,null));};exports[_0x97de('0x60')]=function(_0x1f963c,_0xded3eb,_0x2612f9){var _0x44aa69={};var _0x13ccac={};var _0x55337f;var _0xc16d27;return db[_0x97de('0x2f')][_0x97de('0x59')]({'where':{'id':_0x1f963c['params']['id']}})[_0x97de('0x26')](handleEntityNotFound(_0xded3eb,null))[_0x97de('0x26')](function(_0x3beaa4){if(_0x3beaa4){_0x55337f=_0x3beaa4;_0x13ccac[_0x97de('0x33')]=_['keys'](db[_0x97de('0x5f')]['rawAttributes']);_0x13ccac[_0x97de('0x37')]=_[_0x97de('0x34')](_0x1f963c[_0x97de('0x37')]);_0x13ccac[_0x97de('0x35')]=_[_0x97de('0x36')](_0x13ccac[_0x97de('0x33')],_0x13ccac[_0x97de('0x37')]);_0x44aa69[_0x97de('0x38')]=_[_0x97de('0x36')](_0x13ccac[_0x97de('0x33')],qs[_0x97de('0x39')](_0x1f963c[_0x97de('0x37')]['fields']));_0x44aa69[_0x97de('0x38')]=_0x44aa69[_0x97de('0x38')][_0x97de('0x3a')]?_0x44aa69['attributes']:_0x13ccac['model'];_0x44aa69[_0x97de('0x5c')]=qs['sort'](_0x1f963c[_0x97de('0x37')]['sort']);_0x44aa69[_0x97de('0x3d')]=qs['filters'](_[_0x97de('0x3e')](_0x1f963c[_0x97de('0x37')],_0x13ccac[_0x97de('0x35')]));if(_0x1f963c[_0x97de('0x37')][_0x97de('0x3f')]){_0x44aa69[_0x97de('0x3d')]=_['merge'](_0x44aa69['where'],{'$or':_[_0x97de('0x2e')](_0x44aa69[_0x97de('0x38')],function(_0x1c1fdc){var _0x4bb779={};_0x4bb779[_0x1c1fdc]={'$like':'%'+_0x1f963c[_0x97de('0x37')]['filter']+'%'};return _0x4bb779;})});}_0x44aa69=_['merge']({},_0x44aa69,_0x1f963c['options']);return _0x55337f[_0x97de('0x60')](_0x44aa69);}})[_0x97de('0x26')](function(_0x26a776){if(_0x26a776){_0xc16d27=_0x26a776[_0x97de('0x3a')];if(!_0x1f963c[_0x97de('0x37')][_0x97de('0x3b')]('nolimit')){_0x44aa69[_0x97de('0x1d')]=qs['limit'](_0x1f963c[_0x97de('0x37')][_0x97de('0x1d')]);_0x44aa69['offset']=qs[_0x97de('0x1b')](_0x1f963c['query'][_0x97de('0x1b')]);}return _0x55337f['getActions'](_0x44aa69);}})[_0x97de('0x26')](function(_0x5e3293){if(_0x5e3293){return _0x5e3293?{'count':_0xc16d27,'rows':_0x5e3293}:null;}})[_0x97de('0x26')](respondWithResult(_0xded3eb,null))['catch'](handleError(_0xded3eb,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