Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / trigger / trigger.controller.js
index ad5a52e..4badb9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54c5=['zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','offset','limit','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','status','sendStatus','error','name','send','index','map','Trigger','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','eml-format'];(function(_0x5d58a8,_0x1c4c28){var _0x59278b=function(_0x5bc3a6){while(--_0x5bc3a6){_0x5d58a8['push'](_0x5d58a8['shift']());}};_0x59278b(++_0x1c4c28);}(_0x54c5,0x10a));var _0x554c=function(_0x176947,_0x591cb4){_0x176947=_0x176947-0x0;var _0x5360a4=_0x54c5[_0x176947];return _0x5360a4;};'use strict';var emlformat=require(_0x554c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x554c('0x1'));var jsonpatch=require(_0x554c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x554c('0x3'));var util=require(_0x554c('0x4'));var path=require('path');var sox=require(_0x554c('0x5'));var csv=require(_0x554c('0x6'));var ejs=require(_0x554c('0x7'));var fs=require('fs');var fs_extra=require(_0x554c('0x8'));var _=require('lodash');var squel=require(_0x554c('0x9'));var crypto=require(_0x554c('0xa'));var jsforce=require(_0x554c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x554c('0xc'));var Papa=require(_0x554c('0xd'));var Redis=require(_0x554c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x554c('0xf'));var as=require(_0x554c('0x10'));var hardwareService=require(_0x554c('0x11'));var logger=require('../../config/logger')(_0x554c('0x12'));var utils=require(_0x554c('0x13'));var config=require(_0x554c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x554c('0x15'))['db'];function respondWithStatusCode(_0xb3dbb,_0x1ea23e){_0x1ea23e=_0x1ea23e||0xcc;return function(_0x196697){if(_0x196697){return _0xb3dbb['sendStatus'](_0x1ea23e);}return _0xb3dbb['status'](_0x1ea23e)[_0x554c('0x16')]();};}function respondWithResult(_0x4b8a42,_0x5c7862){_0x5c7862=_0x5c7862||0xc8;return function(_0x48c4df){if(_0x48c4df){return _0x4b8a42['status'](_0x5c7862)[_0x554c('0x17')](_0x48c4df);}};}function respondWithFilteredResult(_0x23a345,_0x2cc798){return function(_0x19c05e){if(_0x19c05e){var _0x4789f2=typeof _0x2cc798['offset']===_0x554c('0x18')&&typeof _0x2cc798['limit']===_0x554c('0x18');var _0x260834=_0x19c05e['count'];var _0x2955e2=_0x4789f2?0x0:_0x2cc798[_0x554c('0x19')];var _0x4f6781=_0x4789f2?_0x19c05e['count']:_0x2cc798[_0x554c('0x19')]+_0x2cc798[_0x554c('0x1a')];var _0x38962a;if(_0x4f6781>=_0x260834){_0x4f6781=_0x260834;_0x38962a=0xc8;}else{_0x38962a=0xce;}_0x23a345['status'](_0x38962a);return _0x23a345['set']('Content-Range',_0x2955e2+'-'+_0x4f6781+'/'+_0x260834)[_0x554c('0x17')](_0x19c05e);}return null;};}function patchUpdates(_0x9c8589){return function(_0x3a9ecf){try{jsonpatch[_0x554c('0x1b')](_0x3a9ecf,_0x9c8589,!![]);}catch(_0x1a8975){return BPromise[_0x554c('0x1c')](_0x1a8975);}return _0x3a9ecf[_0x554c('0x1d')]();};}function saveUpdates(_0x448b34,_0x4cec2b){return function(_0x375844){if(_0x375844){return _0x375844['update'](_0x448b34)[_0x554c('0x1e')](function(_0x2d122b){return _0x2d122b;});}return null;};}function removeEntity(_0xbd8ddf,_0x1b7763){return function(_0x4c81fc){if(_0x4c81fc){return _0x4c81fc[_0x554c('0x1f')]()[_0x554c('0x1e')](function(){var _0x50a5d9=_0x4c81fc[_0x554c('0x20')]({'plain':!![]});var _0x574032=_0x554c('0x21');return db[_0x554c('0x22')]['destroy']({'where':{'type':_0x574032,'resourceId':_0x50a5d9['id']}})[_0x554c('0x1e')](function(){return _0x4c81fc;});})[_0x554c('0x1e')](function(){_0xbd8ddf[_0x554c('0x23')](0xcc)[_0x554c('0x16')]();});}};}function handleEntityNotFound(_0x38bb5d,_0x55d95b){return function(_0x574943){if(!_0x574943){_0x38bb5d[_0x554c('0x24')](0x194);}return _0x574943;};}function handleError(_0x4cb354,_0x2377d0){_0x2377d0=_0x2377d0||0x1f4;return function(_0x9cc65d){logger[_0x554c('0x25')](_0x9cc65d['stack']);if(_0x9cc65d[_0x554c('0x26')]){delete _0x9cc65d[_0x554c('0x26')];}_0x4cb354[_0x554c('0x23')](_0x2377d0)[_0x554c('0x27')](_0x9cc65d);};}exports[_0x554c('0x28')]=function(_0x26e075,_0x591a7b){var _0x2d9500={},_0x1d99a2={},_0x2e096d={'count':0x0,'rows':[]};var _0x2da671=_[_0x554c('0x29')](db[_0x554c('0x2a')][_0x554c('0x2b')],function(_0x267ed4){return{'name':_0x267ed4['fieldName'],'type':_0x267ed4['type']['key']};});_0x1d99a2[_0x554c('0x2c')]=_['map'](_0x2da671,_0x554c('0x26'));_0x1d99a2[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x26e075['query']);_0x1d99a2[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x1d99a2[_0x554c('0x2c')],_0x1d99a2[_0x554c('0x2d')]);_0x2d9500[_0x554c('0x31')]=_['intersection'](_0x1d99a2['model'],qs[_0x554c('0x32')](_0x26e075[_0x554c('0x2d')][_0x554c('0x32')]));_0x2d9500[_0x554c('0x31')]=_0x2d9500['attributes'][_0x554c('0x33')]?_0x2d9500[_0x554c('0x31')]:_0x1d99a2['model'];if(!_0x26e075[_0x554c('0x2d')][_0x554c('0x34')](_0x554c('0x35'))){_0x2d9500[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x26e075['query'][_0x554c('0x1a')]);_0x2d9500[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x26e075[_0x554c('0x2d')][_0x554c('0x19')]);}_0x2d9500[_0x554c('0x36')]=qs[_0x554c('0x37')](_0x26e075['query'][_0x554c('0x37')]);_0x2d9500[_0x554c('0x38')]=qs[_0x554c('0x2f')](_['pick'](_0x26e075[_0x554c('0x2d')],_0x1d99a2['filters']),_0x2da671);if(_0x26e075[_0x554c('0x2d')][_0x554c('0x39')]){_0x2d9500[_0x554c('0x38')]=_[_0x554c('0x3a')](_0x2d9500[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x2da671,function(_0x221a3c){if(_0x221a3c['type']!=='VIRTUAL'){var _0x6c1abe={};_0x6c1abe[_0x221a3c[_0x554c('0x26')]]={'$like':'%'+_0x26e075[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x6c1abe;}})});}_0x2d9500=_[_0x554c('0x3a')]({},_0x2d9500,_0x26e075['options']);var _0x5a33a0={'where':_0x2d9500[_0x554c('0x38')]};return db[_0x554c('0x2a')][_0x554c('0x3b')](_0x5a33a0)[_0x554c('0x1e')](function(_0xc9902c){_0x2e096d[_0x554c('0x3b')]=_0xc9902c;if(_0x26e075[_0x554c('0x2d')]['includeAll']){_0x2d9500[_0x554c('0x3c')]=[{'all':!![]}];}return db[_0x554c('0x2a')]['findAll'](_0x2d9500);})['then'](function(_0x470950){_0x2e096d[_0x554c('0x3d')]=_0x470950;return _0x2e096d;})[_0x554c('0x1e')](respondWithFilteredResult(_0x591a7b,_0x2d9500))['catch'](handleError(_0x591a7b,null));};exports[_0x554c('0x3e')]=function(_0x31a697,_0x2389e7){var _0x29d646={'raw':![],'where':{'id':_0x31a697[_0x554c('0x3f')]['id']}},_0x42d882={};_0x42d882['model']=_['keys'](db[_0x554c('0x2a')][_0x554c('0x2b')]);_0x42d882[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x31a697['query']);_0x42d882[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x42d882[_0x554c('0x2c')],_0x42d882['query']);_0x29d646[_0x554c('0x31')]=_['intersection'](_0x42d882[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x31a697[_0x554c('0x2d')][_0x554c('0x32')]));_0x29d646['attributes']=_0x29d646[_0x554c('0x31')][_0x554c('0x33')]?_0x29d646[_0x554c('0x31')]:_0x42d882[_0x554c('0x2c')];if(_0x31a697[_0x554c('0x2d')]['includeAll']){_0x29d646[_0x554c('0x3c')]=[{'all':!![]}];}_0x29d646=_['merge']({},_0x29d646,_0x31a697[_0x554c('0x40')]);return db[_0x554c('0x2a')][_0x554c('0x41')](_0x29d646)['then'](handleEntityNotFound(_0x2389e7,null))['then'](respondWithResult(_0x2389e7,null))[_0x554c('0x42')](handleError(_0x2389e7,null));};exports['create']=function(_0x591597,_0x1b93d2){return db[_0x554c('0x2a')][_0x554c('0x43')](_0x591597[_0x554c('0x44')],{})[_0x554c('0x1e')](function(_0xf4eb77){var _0x287efe=_0x591597[_0x554c('0x45')][_0x554c('0x20')]({'plain':!![]});if(!_0x287efe)throw new Error(_0x554c('0x46'));if(_0x287efe[_0x554c('0x47')]===_0x554c('0x45')){var _0x4ce001=_0xf4eb77['get']({'plain':!![]});var _0x2ee88d='Triggers';return db[_0x554c('0x48')]['find']({'where':{'name':_0x2ee88d,'userProfileId':_0x287efe[_0x554c('0x49')]},'raw':!![]})['then'](function(_0x1f6018){if(_0x1f6018&&_0x1f6018[_0x554c('0x4a')]===0x0){return db['UserProfileResource'][_0x554c('0x43')]({'name':_0x4ce001[_0x554c('0x26')],'resourceId':_0x4ce001['id'],'type':_0x1f6018[_0x554c('0x26')],'sectionId':_0x1f6018['id']},{})[_0x554c('0x1e')](function(){return _0xf4eb77;});}else{return _0xf4eb77;}})[_0x554c('0x42')](function(_0x4b139d){logger[_0x554c('0x25')](_0x554c('0x4b'),_0x4b139d);throw _0x4b139d;});}return _0xf4eb77;})[_0x554c('0x1e')](respondWithResult(_0x1b93d2,0xc9))[_0x554c('0x42')](handleError(_0x1b93d2,null));};exports[_0x554c('0x4c')]=function(_0x1b0a6c,_0x579c1a){if(_0x1b0a6c[_0x554c('0x44')]['id']){delete _0x1b0a6c['body']['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x1b0a6c[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x579c1a,null))[_0x554c('0x1e')](saveUpdates(_0x1b0a6c[_0x554c('0x44')],null))[_0x554c('0x1e')](respondWithResult(_0x579c1a,null))['catch'](handleError(_0x579c1a,null));};exports[_0x554c('0x1f')]=function(_0x37fb4d,_0x360f85){return db['Trigger'][_0x554c('0x41')]({'where':{'id':_0x37fb4d[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x360f85,null))[_0x554c('0x1e')](removeEntity(_0x360f85,null))[_0x554c('0x42')](handleError(_0x360f85,null));};exports[_0x554c('0x4d')]=function(_0x48e71b,_0x15354d,_0x452724){if(_0x48e71b[_0x554c('0x44')]['id']){delete _0x48e71b[_0x554c('0x44')]['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x48e71b['params']['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x15354d,null))[_0x554c('0x1e')](function(_0x38ccc8){if(_0x38ccc8){_0x48e71b[_0x554c('0x44')][_0x554c('0x4e')]=_0x38ccc8['id'];return db['Condition'][_0x554c('0x43')](_0x48e71b[_0x554c('0x44')]);}})[_0x554c('0x1e')](respondWithResult(_0x15354d,null))['catch'](handleError(_0x15354d,null));};exports[_0x554c('0x4f')]=function(_0x115f54,_0x136580,_0x12c000){if(_0x115f54[_0x554c('0x44')]['id']){delete _0x115f54[_0x554c('0x44')]['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x115f54[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x136580,null))['then'](function(_0x4d3b13){if(_0x4d3b13){_0x115f54[_0x554c('0x44')][_0x554c('0x50')]=_0x4d3b13['id'];return db[_0x554c('0x51')]['create'](_0x115f54['body']);}})[_0x554c('0x1e')](respondWithResult(_0x136580,null))[_0x554c('0x42')](handleError(_0x136580,null));};exports['getAllConditions']=function(_0x1cfab9,_0x3c3218,_0x59c73c){var _0x4b8de7={};var _0x5b6da8={};var _0xc37be7;var _0x5c8ee3;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0x1cfab9[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x3c3218,null))[_0x554c('0x1e')](function(_0x536076){if(_0x536076){_0xc37be7=_0x536076;_0x5b6da8[_0x554c('0x2c')]=_[_0x554c('0x2e')](db['Condition'][_0x554c('0x2b')]);_0x5b6da8[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x1cfab9['query']);_0x5b6da8[_0x554c('0x2f')]=_['intersection'](_0x5b6da8[_0x554c('0x2c')],_0x5b6da8[_0x554c('0x2d')]);_0x4b8de7[_0x554c('0x31')]=_['intersection'](_0x5b6da8[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x32')]));_0x4b8de7[_0x554c('0x31')]=_0x4b8de7['attributes'][_0x554c('0x33')]?_0x4b8de7['attributes']:_0x5b6da8[_0x554c('0x2c')];_0x4b8de7['order']=qs[_0x554c('0x37')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x37')]);_0x4b8de7['where']=qs[_0x554c('0x2f')](_[_0x554c('0x53')](_0x1cfab9[_0x554c('0x2d')],_0x5b6da8[_0x554c('0x2f')]));if(_0x1cfab9[_0x554c('0x2d')][_0x554c('0x39')]){_0x4b8de7[_0x554c('0x38')]=_['merge'](_0x4b8de7[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x4b8de7[_0x554c('0x31')],function(_0x2d5802){var _0x6a4c87={};_0x6a4c87[_0x2d5802]={'$like':'%'+_0x1cfab9[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x6a4c87;})});}_0x4b8de7=_[_0x554c('0x3a')]({},_0x4b8de7,_0x1cfab9[_0x554c('0x40')]);return _0xc37be7[_0x554c('0x54')](_0x4b8de7);}})[_0x554c('0x1e')](function(_0x3024a6){if(_0x3024a6){_0x5c8ee3=_0x3024a6[_0x554c('0x33')];if(!_0x1cfab9[_0x554c('0x2d')][_0x554c('0x34')]('nolimit')){_0x4b8de7[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x1a')]);_0x4b8de7[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x19')]);}return _0xc37be7[_0x554c('0x54')](_0x4b8de7);}})[_0x554c('0x1e')](function(_0x5b495d){if(_0x5b495d){return _0x5b495d?{'count':_0x5c8ee3,'rows':_0x5b495d}:null;}})['then'](respondWithResult(_0x3c3218,null))['catch'](handleError(_0x3c3218,null));};exports[_0x554c('0x55')]=function(_0xa85073,_0x2c2ab9,_0x302acf){var _0x1f1429={};var _0x7962f3={};var _0x420774;var _0x1bfa55;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0xa85073['params']['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x2c2ab9,null))[_0x554c('0x1e')](function(_0x3d2f96){if(_0x3d2f96){_0x420774=_0x3d2f96;_0x7962f3['model']=_[_0x554c('0x2e')](db[_0x554c('0x51')]['rawAttributes']);_0x7962f3[_0x554c('0x2d')]=_['keys'](_0xa85073['query']);_0x7962f3[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x7962f3[_0x554c('0x2c')],_0x7962f3[_0x554c('0x2d')]);_0x1f1429[_0x554c('0x31')]=_[_0x554c('0x30')](_0x7962f3[_0x554c('0x2c')],qs[_0x554c('0x32')](_0xa85073['query']['fields']));_0x1f1429[_0x554c('0x31')]=_0x1f1429[_0x554c('0x31')][_0x554c('0x33')]?_0x1f1429[_0x554c('0x31')]:_0x7962f3[_0x554c('0x2c')];_0x1f1429[_0x554c('0x36')]=qs[_0x554c('0x37')](_0xa85073[_0x554c('0x2d')]['sort']);_0x1f1429['where']=qs['filters'](_['pick'](_0xa85073[_0x554c('0x2d')],_0x7962f3[_0x554c('0x2f')]));if(_0xa85073[_0x554c('0x2d')][_0x554c('0x39')]){_0x1f1429['where']=_[_0x554c('0x3a')](_0x1f1429[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x1f1429[_0x554c('0x31')],function(_0x47876c){var _0x87e793={};_0x87e793[_0x47876c]={'$like':'%'+_0xa85073['query'][_0x554c('0x39')]+'%'};return _0x87e793;})});}_0x1f1429=_[_0x554c('0x3a')]({},_0x1f1429,_0xa85073[_0x554c('0x40')]);return _0x420774[_0x554c('0x55')](_0x1f1429);}})[_0x554c('0x1e')](function(_0x35dc7f){if(_0x35dc7f){_0x1bfa55=_0x35dc7f[_0x554c('0x33')];if(!_0xa85073['query'][_0x554c('0x34')]('nolimit')){_0x1f1429['limit']=qs[_0x554c('0x1a')](_0xa85073[_0x554c('0x2d')]['limit']);_0x1f1429[_0x554c('0x19')]=qs[_0x554c('0x19')](_0xa85073[_0x554c('0x2d')][_0x554c('0x19')]);}return _0x420774['getAnyConditions'](_0x1f1429);}})['then'](function(_0x16e3fa){if(_0x16e3fa){return _0x16e3fa?{'count':_0x1bfa55,'rows':_0x16e3fa}:null;}})[_0x554c('0x1e')](respondWithResult(_0x2c2ab9,null))['catch'](handleError(_0x2c2ab9,null));};exports[_0x554c('0x56')]=function(_0x390baf,_0x44697c,_0x3a0596){if(_0x390baf[_0x554c('0x44')]['id']){delete _0x390baf[_0x554c('0x44')]['id'];}return db['Trigger']['find']({'where':{'id':_0x390baf[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x44697c,null))['then'](function(_0x4bc11f){if(_0x4bc11f){_0x390baf[_0x554c('0x44')][_0x554c('0x57')]=_0x4bc11f['id'];return db['Action']['create'](_0x390baf[_0x554c('0x44')]);}})[_0x554c('0x1e')](respondWithResult(_0x44697c,null))['catch'](handleError(_0x44697c,null));};exports[_0x554c('0x58')]=function(_0x200404,_0x486efc,_0x187d26){var _0x1f93d3={};var _0x21e30b={};var _0x160ca7;var _0x31e98c;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0x200404[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x486efc,null))[_0x554c('0x1e')](function(_0x22b806){if(_0x22b806){_0x160ca7=_0x22b806;_0x21e30b['model']=_[_0x554c('0x2e')](db['Action']['rawAttributes']);_0x21e30b[_0x554c('0x2d')]=_['keys'](_0x200404['query']);_0x21e30b[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x21e30b['model'],_0x21e30b[_0x554c('0x2d')]);_0x1f93d3[_0x554c('0x31')]=_[_0x554c('0x30')](_0x21e30b[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x200404[_0x554c('0x2d')]['fields']));_0x1f93d3[_0x554c('0x31')]=_0x1f93d3['attributes']['length']?_0x1f93d3[_0x554c('0x31')]:_0x21e30b[_0x554c('0x2c')];_0x1f93d3[_0x554c('0x36')]=qs[_0x554c('0x37')](_0x200404[_0x554c('0x2d')][_0x554c('0x37')]);_0x1f93d3['where']=qs[_0x554c('0x2f')](_[_0x554c('0x53')](_0x200404[_0x554c('0x2d')],_0x21e30b['filters']));if(_0x200404[_0x554c('0x2d')]['filter']){_0x1f93d3[_0x554c('0x38')]=_[_0x554c('0x3a')](_0x1f93d3[_0x554c('0x38')],{'$or':_['map'](_0x1f93d3[_0x554c('0x31')],function(_0x4ce14a){var _0x5a52be={};_0x5a52be[_0x4ce14a]={'$like':'%'+_0x200404[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x5a52be;})});}_0x1f93d3=_[_0x554c('0x3a')]({},_0x1f93d3,_0x200404['options']);return _0x160ca7['getActions'](_0x1f93d3);}})[_0x554c('0x1e')](function(_0x1041da){if(_0x1041da){_0x31e98c=_0x1041da[_0x554c('0x33')];if(!_0x200404[_0x554c('0x2d')]['hasOwnProperty'](_0x554c('0x35'))){_0x1f93d3[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x200404['query'][_0x554c('0x1a')]);_0x1f93d3[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x200404[_0x554c('0x2d')][_0x554c('0x19')]);}return _0x160ca7['getActions'](_0x1f93d3);}})['then'](function(_0x4ebf68){if(_0x4ebf68){return _0x4ebf68?{'count':_0x31e98c,'rows':_0x4ebf68}:null;}})[_0x554c('0x1e')](respondWithResult(_0x486efc,null))[_0x554c('0x42')](handleError(_0x486efc,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