Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / trigger / trigger.controller.js
index 805345e..6ad2748 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08cc=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','Triggers','error','stack','name','index','map','Trigger','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','keys','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x19973d,_0x1bf449){var _0x34acbc=function(_0x4901d7){while(--_0x4901d7){_0x19973d['push'](_0x19973d['shift']());}};_0x34acbc(++_0x1bf449);}(_0x08cc,0x1ba));var _0xc08c=function(_0x250a4c,_0x1e7220){_0x250a4c=_0x250a4c-0x0;var _0x3ff33d=_0x08cc[_0x250a4c];return _0x3ff33d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc08c('0x0'));var zipdir=require(_0xc08c('0x1'));var jsonpatch=require(_0xc08c('0x2'));var rp=require(_0xc08c('0x3'));var moment=require(_0xc08c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc08c('0x5'));var util=require('util');var path=require(_0xc08c('0x6'));var sox=require(_0xc08c('0x7'));var csv=require(_0xc08c('0x8'));var ejs=require(_0xc08c('0x9'));var fs=require('fs');var _=require(_0xc08c('0xa'));var squel=require(_0xc08c('0xb'));var crypto=require(_0xc08c('0xc'));var jsforce=require(_0xc08c('0xd'));var deskjs=require(_0xc08c('0xe'));var toCsv=require(_0xc08c('0x8'));var querystring=require(_0xc08c('0xf'));var Papa=require(_0xc08c('0x10'));var Redis=require(_0xc08c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc08c('0x12'));var as=require(_0xc08c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc08c('0x14'))(_0xc08c('0x15'));var utils=require('../../config/utils');var config=require(_0xc08c('0x16'));var db=require(_0xc08c('0x17'))['db'];function respondWithStatusCode(_0x5a56b3,_0x731281){_0x731281=_0x731281||0xcc;return function(_0xb4ba87){if(_0xb4ba87){return _0x5a56b3[_0xc08c('0x18')](_0x731281);}return _0x5a56b3['status'](_0x731281)[_0xc08c('0x19')]();};}function respondWithResult(_0x31e2be,_0x5d1e40){_0x5d1e40=_0x5d1e40||0xc8;return function(_0x3f802a){if(_0x3f802a){return _0x31e2be['status'](_0x5d1e40)[_0xc08c('0x1a')](_0x3f802a);}};}function respondWithFilteredResult(_0x1621aa,_0x43bb42){return function(_0x42f82a){if(_0x42f82a){var _0x5dce04=_0x42f82a[_0xc08c('0x1b')],_0xff8ca8=_0x43bb42[_0xc08c('0x1c')],_0x2fbf30=_0x43bb42[_0xc08c('0x1c')]+_0x43bb42[_0xc08c('0x1d')],_0x15dd51;if(_0x2fbf30>=_0x5dce04){_0x2fbf30=_0x5dce04;_0x15dd51=0xc8;}else{_0x15dd51=0xce;}_0x1621aa[_0xc08c('0x1e')](_0x15dd51);return _0x1621aa[_0xc08c('0x1f')](_0xc08c('0x20'),_0xff8ca8+'-'+_0x2fbf30+'/'+_0x5dce04)['json'](_0x42f82a);}return null;};}function patchUpdates(_0xd439f){return function(_0x604975){try{jsonpatch[_0xc08c('0x21')](_0x604975,_0xd439f,!![]);}catch(_0x52913c){return BPromise['reject'](_0x52913c);}return _0x604975[_0xc08c('0x22')]();};}function saveUpdates(_0x59af5e,_0x55e63f){return function(_0x6cfae1){if(_0x6cfae1){return _0x6cfae1[_0xc08c('0x23')](_0x59af5e)[_0xc08c('0x24')](function(_0x830b11){return _0x830b11;});}return null;};}function removeEntity(_0x452611,_0x5268f1){return function(_0x38d037){if(_0x38d037){return _0x38d037[_0xc08c('0x25')]()[_0xc08c('0x24')](function(){var _0x551e32=_0x38d037['get']({'plain':!![]});var _0x2de4e2=_0xc08c('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2de4e2,'resourceId':_0x551e32['id']}})[_0xc08c('0x24')](function(){return _0x38d037;});})[_0xc08c('0x24')](function(){_0x452611['status'](0xcc)[_0xc08c('0x19')]();});}};}function handleEntityNotFound(_0x5704dc,_0x4f55fb){return function(_0xcdcf3d){if(!_0xcdcf3d){_0x5704dc[_0xc08c('0x18')](0x194);}return _0xcdcf3d;};}function handleError(_0x11a767,_0x53f69b){_0x53f69b=_0x53f69b||0x1f4;return function(_0x1cbdf6){logger[_0xc08c('0x27')](_0x1cbdf6[_0xc08c('0x28')]);if(_0x1cbdf6[_0xc08c('0x29')]){delete _0x1cbdf6[_0xc08c('0x29')];}_0x11a767['status'](_0x53f69b)['send'](_0x1cbdf6);};}exports[_0xc08c('0x2a')]=function(_0x4c187c,_0x395805){var _0x4a3a34={},_0x139400={},_0x40c02b={'count':0x0,'rows':[]};var _0x1efcd7=_[_0xc08c('0x2b')](db[_0xc08c('0x2c')]['rawAttributes'],function(_0xe996e0){return{'name':_0xe996e0['fieldName'],'type':_0xe996e0[_0xc08c('0x2d')]['key']};});_0x139400[_0xc08c('0x2e')]=_[_0xc08c('0x2b')](_0x1efcd7,'name');_0x139400[_0xc08c('0x2f')]=_['keys'](_0x4c187c[_0xc08c('0x2f')]);_0x139400[_0xc08c('0x30')]=_['intersection'](_0x139400[_0xc08c('0x2e')],_0x139400[_0xc08c('0x2f')]);_0x4a3a34['attributes']=_['intersection'](_0x139400['model'],qs[_0xc08c('0x31')](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x4a3a34[_0xc08c('0x32')]=_0x4a3a34[_0xc08c('0x32')][_0xc08c('0x33')]?_0x4a3a34[_0xc08c('0x32')]:_0x139400[_0xc08c('0x2e')];if(!_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x34')](_0xc08c('0x35'))){_0x4a3a34[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x1d')]);_0x4a3a34[_0xc08c('0x1c')]=qs['offset'](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x1c')]);}_0x4a3a34[_0xc08c('0x36')]=qs['sort'](_0x4c187c['query'][_0xc08c('0x37')]);_0x4a3a34['where']=qs['filters'](_[_0xc08c('0x38')](_0x4c187c[_0xc08c('0x2f')],_0x139400[_0xc08c('0x30')]),_0x1efcd7);if(_0x4c187c['query'][_0xc08c('0x39')]){_0x4a3a34[_0xc08c('0x3a')]=_[_0xc08c('0x3b')](_0x4a3a34['where'],{'$or':_[_0xc08c('0x2b')](_0x1efcd7,function(_0x5be1fb){if(_0x5be1fb[_0xc08c('0x2d')]!=='VIRTUAL'){var _0x1327d2={};_0x1327d2[_0x5be1fb['name']]={'$like':'%'+_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x1327d2;}})});}_0x4a3a34=_[_0xc08c('0x3b')]({},_0x4a3a34,_0x4c187c[_0xc08c('0x3c')]);var _0x59b703={'where':_0x4a3a34['where']};return db[_0xc08c('0x2c')]['count'](_0x59b703)[_0xc08c('0x24')](function(_0x4be9bc){_0x40c02b[_0xc08c('0x1b')]=_0x4be9bc;if(_0x4c187c['query']['includeAll']){_0x4a3a34[_0xc08c('0x3d')]=[{'all':!![]}];}return db['Trigger'][_0xc08c('0x3e')](_0x4a3a34);})['then'](function(_0x1eca4d){_0x40c02b[_0xc08c('0x3f')]=_0x1eca4d;return _0x40c02b;})['then'](respondWithFilteredResult(_0x395805,_0x4a3a34))['catch'](handleError(_0x395805,null));};exports['show']=function(_0xaab9d9,_0x3efc6e){var _0x481498={'raw':![],'where':{'id':_0xaab9d9[_0xc08c('0x40')]['id']}},_0x1e6e3e={};_0x1e6e3e[_0xc08c('0x2e')]=_['keys'](db[_0xc08c('0x2c')][_0xc08c('0x41')]);_0x1e6e3e[_0xc08c('0x2f')]=_['keys'](_0xaab9d9[_0xc08c('0x2f')]);_0x1e6e3e[_0xc08c('0x30')]=_[_0xc08c('0x42')](_0x1e6e3e['model'],_0x1e6e3e['query']);_0x481498[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x1e6e3e[_0xc08c('0x2e')],qs[_0xc08c('0x31')](_0xaab9d9[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x481498[_0xc08c('0x32')]=_0x481498[_0xc08c('0x32')][_0xc08c('0x33')]?_0x481498[_0xc08c('0x32')]:_0x1e6e3e['model'];if(_0xaab9d9[_0xc08c('0x2f')][_0xc08c('0x43')]){_0x481498[_0xc08c('0x3d')]=[{'all':!![]}];}_0x481498=_[_0xc08c('0x3b')]({},_0x481498,_0xaab9d9[_0xc08c('0x3c')]);return db[_0xc08c('0x2c')][_0xc08c('0x44')](_0x481498)[_0xc08c('0x24')](handleEntityNotFound(_0x3efc6e,null))[_0xc08c('0x24')](respondWithResult(_0x3efc6e,null))[_0xc08c('0x45')](handleError(_0x3efc6e,null));};exports['create']=function(_0x4ccdbd,_0x4f330f){return db['Trigger'][_0xc08c('0x46')](_0x4ccdbd[_0xc08c('0x47')],{})[_0xc08c('0x24')](function(_0xb07560){var _0x46cc8b=_0x4ccdbd['user'][_0xc08c('0x48')]({'plain':!![]});if(!_0x46cc8b)throw new Error(_0xc08c('0x49'));if(_0x46cc8b[_0xc08c('0x4a')]==='user'){var _0x82336d=_0xb07560['get']({'plain':!![]});var _0x306bb7=_0xc08c('0x26');return db[_0xc08c('0x4b')][_0xc08c('0x44')]({'where':{'name':_0x306bb7,'userProfileId':_0x46cc8b[_0xc08c('0x4c')]},'raw':!![]})[_0xc08c('0x24')](function(_0x5f9c4c){if(_0x5f9c4c&&_0x5f9c4c[_0xc08c('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x82336d[_0xc08c('0x29')],'resourceId':_0x82336d['id'],'type':_0x5f9c4c[_0xc08c('0x29')],'sectionId':_0x5f9c4c['id']},{})['then'](function(){return _0xb07560;});}else{return _0xb07560;}})['catch'](function(_0x2e450f){logger['error'](_0xc08c('0x4e'),_0x2e450f);throw _0x2e450f;});}return _0xb07560;})[_0xc08c('0x24')](respondWithResult(_0x4f330f,0xc9))[_0xc08c('0x45')](handleError(_0x4f330f,null));};exports['update']=function(_0x51f117,_0x2d8e84){if(_0x51f117['body']['id']){delete _0x51f117[_0xc08c('0x47')]['id'];}return db['Trigger'][_0xc08c('0x44')]({'where':{'id':_0x51f117[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x2d8e84,null))[_0xc08c('0x24')](saveUpdates(_0x51f117[_0xc08c('0x47')],null))[_0xc08c('0x24')](respondWithResult(_0x2d8e84,null))[_0xc08c('0x45')](handleError(_0x2d8e84,null));};exports[_0xc08c('0x25')]=function(_0x1a70ae,_0x541742){return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x1a70ae[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x541742,null))['then'](removeEntity(_0x541742,null))[_0xc08c('0x45')](handleError(_0x541742,null));};exports[_0xc08c('0x4f')]=function(_0x2d3190,_0x21aba6,_0x315df8){if(_0x2d3190['body']['id']){delete _0x2d3190[_0xc08c('0x47')]['id'];}return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x2d3190[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x21aba6,null))[_0xc08c('0x24')](function(_0x30d5e5){if(_0x30d5e5){_0x2d3190['body']['TriggerAllId']=_0x30d5e5['id'];return db[_0xc08c('0x50')][_0xc08c('0x46')](_0x2d3190[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0x21aba6,null))[_0xc08c('0x45')](handleError(_0x21aba6,null));};exports[_0xc08c('0x51')]=function(_0x55e328,_0x1117e5,_0x199155){if(_0x55e328['body']['id']){delete _0x55e328['body']['id'];}return db['Trigger'][_0xc08c('0x44')]({'where':{'id':_0x55e328[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1117e5,null))[_0xc08c('0x24')](function(_0x28fab5){if(_0x28fab5){_0x55e328[_0xc08c('0x47')][_0xc08c('0x52')]=_0x28fab5['id'];return db[_0xc08c('0x50')][_0xc08c('0x46')](_0x55e328[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0x1117e5,null))[_0xc08c('0x45')](handleError(_0x1117e5,null));};exports['getAllConditions']=function(_0x10e380,_0x1de777,_0x54a8e3){var _0x386bc8={};var _0x39b820={};var _0x4fd1c;var _0x7ea515;return db['Trigger'][_0xc08c('0x53')]({'where':{'id':_0x10e380[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x1de777,null))[_0xc08c('0x24')](function(_0x48d9fe){if(_0x48d9fe){_0x4fd1c=_0x48d9fe;_0x39b820[_0xc08c('0x2e')]=_[_0xc08c('0x54')](db['Condition'][_0xc08c('0x41')]);_0x39b820[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x10e380[_0xc08c('0x2f')]);_0x39b820['filters']=_[_0xc08c('0x42')](_0x39b820[_0xc08c('0x2e')],_0x39b820[_0xc08c('0x2f')]);_0x386bc8[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x39b820['model'],qs[_0xc08c('0x31')](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x386bc8[_0xc08c('0x32')]=_0x386bc8[_0xc08c('0x32')][_0xc08c('0x33')]?_0x386bc8[_0xc08c('0x32')]:_0x39b820[_0xc08c('0x2e')];_0x386bc8['order']=qs[_0xc08c('0x37')](_0x10e380['query'][_0xc08c('0x37')]);_0x386bc8[_0xc08c('0x3a')]=qs[_0xc08c('0x30')](_[_0xc08c('0x38')](_0x10e380[_0xc08c('0x2f')],_0x39b820['filters']));if(_0x10e380[_0xc08c('0x2f')]['filter']){_0x386bc8[_0xc08c('0x3a')]=_['merge'](_0x386bc8[_0xc08c('0x3a')],{'$or':_['map'](_0x386bc8[_0xc08c('0x32')],function(_0x3c926d){var _0x38466b={};_0x38466b[_0x3c926d]={'$like':'%'+_0x10e380['query'][_0xc08c('0x39')]+'%'};return _0x38466b;})});}_0x386bc8=_[_0xc08c('0x3b')]({},_0x386bc8,_0x10e380[_0xc08c('0x3c')]);return _0x4fd1c[_0xc08c('0x55')](_0x386bc8);}})[_0xc08c('0x24')](function(_0x53f95f){if(_0x53f95f){_0x7ea515=_0x53f95f[_0xc08c('0x33')];if(!_0x10e380[_0xc08c('0x2f')]['hasOwnProperty'](_0xc08c('0x35'))){_0x386bc8[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x1d')]);_0x386bc8[_0xc08c('0x1c')]=qs['offset'](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x4fd1c[_0xc08c('0x55')](_0x386bc8);}})['then'](function(_0xa02026){if(_0xa02026){return _0xa02026?{'count':_0x7ea515,'rows':_0xa02026}:null;}})[_0xc08c('0x24')](respondWithResult(_0x1de777,null))[_0xc08c('0x45')](handleError(_0x1de777,null));};exports['getAnyConditions']=function(_0x391d46,_0x16c31b,_0x2f36c5){var _0xb8370c={};var _0x208270={};var _0x23eebf;var _0x13c99a;return db[_0xc08c('0x2c')]['findOne']({'where':{'id':_0x391d46[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x16c31b,null))[_0xc08c('0x24')](function(_0x4cd8a7){if(_0x4cd8a7){_0x23eebf=_0x4cd8a7;_0x208270['model']=_['keys'](db['Condition'][_0xc08c('0x41')]);_0x208270[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x391d46[_0xc08c('0x2f')]);_0x208270['filters']=_[_0xc08c('0x42')](_0x208270[_0xc08c('0x2e')],_0x208270[_0xc08c('0x2f')]);_0xb8370c['attributes']=_[_0xc08c('0x42')](_0x208270[_0xc08c('0x2e')],qs[_0xc08c('0x31')](_0x391d46[_0xc08c('0x2f')][_0xc08c('0x31')]));_0xb8370c['attributes']=_0xb8370c['attributes'][_0xc08c('0x33')]?_0xb8370c[_0xc08c('0x32')]:_0x208270[_0xc08c('0x2e')];_0xb8370c[_0xc08c('0x36')]=qs[_0xc08c('0x37')](_0x391d46['query'][_0xc08c('0x37')]);_0xb8370c[_0xc08c('0x3a')]=qs['filters'](_[_0xc08c('0x38')](_0x391d46['query'],_0x208270['filters']));if(_0x391d46['query'][_0xc08c('0x39')]){_0xb8370c['where']=_[_0xc08c('0x3b')](_0xb8370c[_0xc08c('0x3a')],{'$or':_[_0xc08c('0x2b')](_0xb8370c['attributes'],function(_0x54e3f6){var _0x2b58db={};_0x2b58db[_0x54e3f6]={'$like':'%'+_0x391d46[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x2b58db;})});}_0xb8370c=_[_0xc08c('0x3b')]({},_0xb8370c,_0x391d46['options']);return _0x23eebf[_0xc08c('0x56')](_0xb8370c);}})[_0xc08c('0x24')](function(_0x233242){if(_0x233242){_0x13c99a=_0x233242[_0xc08c('0x33')];if(!_0x391d46[_0xc08c('0x2f')][_0xc08c('0x34')]('nolimit')){_0xb8370c[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x391d46['query']['limit']);_0xb8370c[_0xc08c('0x1c')]=qs[_0xc08c('0x1c')](_0x391d46[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x23eebf[_0xc08c('0x56')](_0xb8370c);}})['then'](function(_0x8f3f31){if(_0x8f3f31){return _0x8f3f31?{'count':_0x13c99a,'rows':_0x8f3f31}:null;}})[_0xc08c('0x24')](respondWithResult(_0x16c31b,null))[_0xc08c('0x45')](handleError(_0x16c31b,null));};exports[_0xc08c('0x57')]=function(_0x5e5ce5,_0xaa83c4,_0x31fc11){if(_0x5e5ce5[_0xc08c('0x47')]['id']){delete _0x5e5ce5[_0xc08c('0x47')]['id'];}return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x5e5ce5[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0xaa83c4,null))[_0xc08c('0x24')](function(_0x577fc8){if(_0x577fc8){_0x5e5ce5[_0xc08c('0x47')][_0xc08c('0x58')]=_0x577fc8['id'];return db[_0xc08c('0x59')][_0xc08c('0x46')](_0x5e5ce5[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0xaa83c4,null))[_0xc08c('0x45')](handleError(_0xaa83c4,null));};exports[_0xc08c('0x5a')]=function(_0x1bd635,_0x4fa2cd,_0x3ee8e0){var _0x37fe41={};var _0x4b62a4={};var _0x1aee66;var _0x1b8251;return db[_0xc08c('0x2c')][_0xc08c('0x53')]({'where':{'id':_0x1bd635[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x4fa2cd,null))['then'](function(_0xeebbba){if(_0xeebbba){_0x1aee66=_0xeebbba;_0x4b62a4[_0xc08c('0x2e')]=_['keys'](db[_0xc08c('0x59')][_0xc08c('0x41')]);_0x4b62a4[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x1bd635[_0xc08c('0x2f')]);_0x4b62a4[_0xc08c('0x30')]=_[_0xc08c('0x42')](_0x4b62a4[_0xc08c('0x2e')],_0x4b62a4[_0xc08c('0x2f')]);_0x37fe41[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x4b62a4['model'],qs[_0xc08c('0x31')](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x37fe41[_0xc08c('0x32')]=_0x37fe41[_0xc08c('0x32')][_0xc08c('0x33')]?_0x37fe41[_0xc08c('0x32')]:_0x4b62a4['model'];_0x37fe41[_0xc08c('0x36')]=qs['sort'](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x37')]);_0x37fe41[_0xc08c('0x3a')]=qs[_0xc08c('0x30')](_['pick'](_0x1bd635['query'],_0x4b62a4[_0xc08c('0x30')]));if(_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x39')]){_0x37fe41['where']=_[_0xc08c('0x3b')](_0x37fe41['where'],{'$or':_[_0xc08c('0x2b')](_0x37fe41[_0xc08c('0x32')],function(_0x4af94c){var _0x5820c9={};_0x5820c9[_0x4af94c]={'$like':'%'+_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x5820c9;})});}_0x37fe41=_[_0xc08c('0x3b')]({},_0x37fe41,_0x1bd635[_0xc08c('0x3c')]);return _0x1aee66[_0xc08c('0x5a')](_0x37fe41);}})[_0xc08c('0x24')](function(_0x314fc8){if(_0x314fc8){_0x1b8251=_0x314fc8[_0xc08c('0x33')];if(!_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x34')]('nolimit')){_0x37fe41['limit']=qs[_0xc08c('0x1d')](_0x1bd635['query'][_0xc08c('0x1d')]);_0x37fe41[_0xc08c('0x1c')]=qs[_0xc08c('0x1c')](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x1aee66[_0xc08c('0x5a')](_0x37fe41);}})[_0xc08c('0x24')](function(_0x5c8abe){if(_0x5c8abe){return _0x5c8abe?{'count':_0x1b8251,'rows':_0x5c8abe}:null;}})['then'](respondWithResult(_0x4fa2cd,null))[_0xc08c('0x45')](handleError(_0x4fa2cd,null));};
\ No newline at end of file
+var _0x99fb=['stack','name','send','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','order','pick','getAnyConditions','nolimit','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x99fb,0x92));var _0xb99f=function(_0x32d3b8,_0x3f2f99){_0x32d3b8=_0x32d3b8-0x0;var _0x272525=_0x99fb[_0x32d3b8];return _0x272525;};'use strict';var pdf=require(_0xb99f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb99f('0x1'));var zipdir=require(_0xb99f('0x2'));var jsonpatch=require(_0xb99f('0x3'));var rp=require(_0xb99f('0x4'));var moment=require(_0xb99f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb99f('0x6'));var util=require(_0xb99f('0x7'));var path=require('path');var sox=require(_0xb99f('0x8'));var csv=require(_0xb99f('0x9'));var ejs=require(_0xb99f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb99f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb99f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb99f('0x9'));var querystring=require(_0xb99f('0xd'));var Papa=require('papaparse');var Redis=require(_0xb99f('0xe'));var authService=require(_0xb99f('0xf'));var qs=require(_0xb99f('0x10'));var as=require(_0xb99f('0x11'));var hardwareService=require(_0xb99f('0x12'));var logger=require(_0xb99f('0x13'))(_0xb99f('0x14'));var utils=require('../../config/utils');var config=require(_0xb99f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e1e6e,_0x130bc8){_0x130bc8=_0x130bc8||0xcc;return function(_0x2ede66){if(_0x2ede66){return _0x1e1e6e[_0xb99f('0x16')](_0x130bc8);}return _0x1e1e6e[_0xb99f('0x17')](_0x130bc8)['end']();};}function respondWithResult(_0x15a7de,_0x57ac59){_0x57ac59=_0x57ac59||0xc8;return function(_0x1086d7){if(_0x1086d7){return _0x15a7de[_0xb99f('0x17')](_0x57ac59)['json'](_0x1086d7);}};}function respondWithFilteredResult(_0x3743bf,_0x4b5b61){return function(_0x1504de){if(_0x1504de){var _0x58db95=_0x1504de['count'],_0x383d9d=_0x4b5b61[_0xb99f('0x18')],_0x56f0b9=_0x4b5b61[_0xb99f('0x18')]+_0x4b5b61[_0xb99f('0x19')],_0x37a14c;if(_0x56f0b9>=_0x58db95){_0x56f0b9=_0x58db95;_0x37a14c=0xc8;}else{_0x37a14c=0xce;}_0x3743bf[_0xb99f('0x17')](_0x37a14c);return _0x3743bf[_0xb99f('0x1a')](_0xb99f('0x1b'),_0x383d9d+'-'+_0x56f0b9+'/'+_0x58db95)[_0xb99f('0x1c')](_0x1504de);}return null;};}function patchUpdates(_0x1692d7){return function(_0x29c5ff){try{jsonpatch[_0xb99f('0x1d')](_0x29c5ff,_0x1692d7,!![]);}catch(_0x46a283){return BPromise[_0xb99f('0x1e')](_0x46a283);}return _0x29c5ff[_0xb99f('0x1f')]();};}function saveUpdates(_0x3273f6,_0x5ac27e){return function(_0x542ba8){if(_0x542ba8){return _0x542ba8[_0xb99f('0x20')](_0x3273f6)[_0xb99f('0x21')](function(_0x1dcd3e){return _0x1dcd3e;});}return null;};}function removeEntity(_0x38b49b,_0x1faec2){return function(_0x36a8d9){if(_0x36a8d9){return _0x36a8d9[_0xb99f('0x22')]()[_0xb99f('0x21')](function(){var _0x1572ff=_0x36a8d9[_0xb99f('0x23')]({'plain':!![]});var _0x1a90ad='Triggers';return db[_0xb99f('0x24')][_0xb99f('0x22')]({'where':{'type':_0x1a90ad,'resourceId':_0x1572ff['id']}})[_0xb99f('0x21')](function(){return _0x36a8d9;});})[_0xb99f('0x21')](function(){_0x38b49b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2b1a,_0x3f66fd){return function(_0x4c5731){if(!_0x4c5731){_0x5c2b1a[_0xb99f('0x16')](0x194);}return _0x4c5731;};}function handleError(_0x3f77cb,_0x1369ac){_0x1369ac=_0x1369ac||0x1f4;return function(_0x3c4f27){logger[_0xb99f('0x25')](_0x3c4f27[_0xb99f('0x26')]);if(_0x3c4f27[_0xb99f('0x27')]){delete _0x3c4f27[_0xb99f('0x27')];}_0x3f77cb['status'](_0x1369ac)[_0xb99f('0x28')](_0x3c4f27);};}exports['index']=function(_0x311456,_0x154acb){var _0x29c96c={},_0x2b74c5={},_0x1a1993={'count':0x0,'rows':[]};var _0x318c70=_[_0xb99f('0x29')](db[_0xb99f('0x2a')]['rawAttributes'],function(_0x4d447b){return{'name':_0x4d447b[_0xb99f('0x2b')],'type':_0x4d447b[_0xb99f('0x2c')][_0xb99f('0x2d')]};});_0x2b74c5[_0xb99f('0x2e')]=_['map'](_0x318c70,_0xb99f('0x27'));_0x2b74c5[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x311456['query']);_0x2b74c5[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x2b74c5[_0xb99f('0x2e')],_0x2b74c5[_0xb99f('0x2f')]);_0x29c96c[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x2b74c5['model'],qs[_0xb99f('0x34')](_0x311456[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x29c96c[_0xb99f('0x33')]=_0x29c96c[_0xb99f('0x33')]['length']?_0x29c96c[_0xb99f('0x33')]:_0x2b74c5['model'];if(!_0x311456[_0xb99f('0x2f')][_0xb99f('0x35')]('nolimit')){_0x29c96c[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x311456[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x29c96c[_0xb99f('0x18')]=qs[_0xb99f('0x18')](_0x311456[_0xb99f('0x2f')]['offset']);}_0x29c96c['order']=qs['sort'](_0x311456['query'][_0xb99f('0x36')]);_0x29c96c[_0xb99f('0x37')]=qs[_0xb99f('0x31')](_['pick'](_0x311456[_0xb99f('0x2f')],_0x2b74c5['filters']),_0x318c70);if(_0x311456[_0xb99f('0x2f')][_0xb99f('0x38')]){_0x29c96c[_0xb99f('0x37')]=_['merge'](_0x29c96c[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x318c70,function(_0x7bf04a){if(_0x7bf04a[_0xb99f('0x2c')]!==_0xb99f('0x39')){var _0x16227b={};_0x16227b[_0x7bf04a[_0xb99f('0x27')]]={'$like':'%'+_0x311456[_0xb99f('0x2f')][_0xb99f('0x38')]+'%'};return _0x16227b;}})});}_0x29c96c=_['merge']({},_0x29c96c,_0x311456[_0xb99f('0x3a')]);var _0x18b812={'where':_0x29c96c[_0xb99f('0x37')]};return db[_0xb99f('0x2a')][_0xb99f('0x3b')](_0x18b812)[_0xb99f('0x21')](function(_0x1d12ed){_0x1a1993[_0xb99f('0x3b')]=_0x1d12ed;if(_0x311456[_0xb99f('0x2f')][_0xb99f('0x3c')]){_0x29c96c[_0xb99f('0x3d')]=[{'all':!![]}];}return db[_0xb99f('0x2a')][_0xb99f('0x3e')](_0x29c96c);})[_0xb99f('0x21')](function(_0x566b61){_0x1a1993['rows']=_0x566b61;return _0x1a1993;})[_0xb99f('0x21')](respondWithFilteredResult(_0x154acb,_0x29c96c))[_0xb99f('0x3f')](handleError(_0x154acb,null));};exports['show']=function(_0x259202,_0x61e6d){var _0x517589={'raw':![],'where':{'id':_0x259202[_0xb99f('0x40')]['id']}},_0x3bcb53={};_0x3bcb53[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db['Trigger'][_0xb99f('0x41')]);_0x3bcb53[_0xb99f('0x2f')]=_['keys'](_0x259202[_0xb99f('0x2f')]);_0x3bcb53[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x3bcb53[_0xb99f('0x2e')],_0x3bcb53[_0xb99f('0x2f')]);_0x517589['attributes']=_[_0xb99f('0x32')](_0x3bcb53[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x259202[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x517589[_0xb99f('0x33')]=_0x517589[_0xb99f('0x33')]['length']?_0x517589['attributes']:_0x3bcb53[_0xb99f('0x2e')];if(_0x259202[_0xb99f('0x2f')][_0xb99f('0x3c')]){_0x517589['include']=[{'all':!![]}];}_0x517589=_[_0xb99f('0x42')]({},_0x517589,_0x259202['options']);return db[_0xb99f('0x2a')][_0xb99f('0x43')](_0x517589)[_0xb99f('0x21')](handleEntityNotFound(_0x61e6d,null))[_0xb99f('0x21')](respondWithResult(_0x61e6d,null))[_0xb99f('0x3f')](handleError(_0x61e6d,null));};exports[_0xb99f('0x44')]=function(_0x50e339,_0x1b4de9){return db[_0xb99f('0x2a')][_0xb99f('0x44')](_0x50e339[_0xb99f('0x45')],{})[_0xb99f('0x21')](function(_0x1025be){var _0x5eda52=_0x50e339[_0xb99f('0x46')][_0xb99f('0x23')]({'plain':!![]});if(!_0x5eda52)throw new Error(_0xb99f('0x47'));if(_0x5eda52[_0xb99f('0x48')]==='user'){var _0x516c8e=_0x1025be[_0xb99f('0x23')]({'plain':!![]});var _0x331205=_0xb99f('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x331205,'userProfileId':_0x5eda52[_0xb99f('0x4a')]},'raw':!![]})[_0xb99f('0x21')](function(_0x30f0c4){if(_0x30f0c4&&_0x30f0c4['autoAssociation']===0x0){return db[_0xb99f('0x24')][_0xb99f('0x44')]({'name':_0x516c8e['name'],'resourceId':_0x516c8e['id'],'type':_0x30f0c4[_0xb99f('0x27')],'sectionId':_0x30f0c4['id']},{})[_0xb99f('0x21')](function(){return _0x1025be;});}else{return _0x1025be;}})['catch'](function(_0x3ed882){logger[_0xb99f('0x25')](_0xb99f('0x4b'),_0x3ed882);throw _0x3ed882;});}return _0x1025be;})['then'](respondWithResult(_0x1b4de9,0xc9))['catch'](handleError(_0x1b4de9,null));};exports[_0xb99f('0x20')]=function(_0x4213da,_0x490959){if(_0x4213da[_0xb99f('0x45')]['id']){delete _0x4213da[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x4213da[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x490959,null))[_0xb99f('0x21')](saveUpdates(_0x4213da[_0xb99f('0x45')],null))['then'](respondWithResult(_0x490959,null))[_0xb99f('0x3f')](handleError(_0x490959,null));};exports['destroy']=function(_0x4f2c50,_0x2cd200){return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x4f2c50[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x2cd200,null))[_0xb99f('0x21')](removeEntity(_0x2cd200,null))['catch'](handleError(_0x2cd200,null));};exports[_0xb99f('0x4c')]=function(_0x1a144a,_0x434238,_0x52328a){if(_0x1a144a[_0xb99f('0x45')]['id']){delete _0x1a144a[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x1a144a[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x434238,null))[_0xb99f('0x21')](function(_0x21f9db){if(_0x21f9db){_0x1a144a[_0xb99f('0x45')][_0xb99f('0x4d')]=_0x21f9db['id'];return db[_0xb99f('0x4e')][_0xb99f('0x44')](_0x1a144a['body']);}})[_0xb99f('0x21')](respondWithResult(_0x434238,null))['catch'](handleError(_0x434238,null));};exports[_0xb99f('0x4f')]=function(_0x3bf89e,_0x425664,_0x48335a){if(_0x3bf89e[_0xb99f('0x45')]['id']){delete _0x3bf89e['body']['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x3bf89e[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x425664,null))['then'](function(_0x5732d0){if(_0x5732d0){_0x3bf89e[_0xb99f('0x45')][_0xb99f('0x50')]=_0x5732d0['id'];return db[_0xb99f('0x4e')][_0xb99f('0x44')](_0x3bf89e[_0xb99f('0x45')]);}})[_0xb99f('0x21')](respondWithResult(_0x425664,null))['catch'](handleError(_0x425664,null));};exports[_0xb99f('0x51')]=function(_0x122f71,_0x10c95d,_0x160226){var _0x990beb={};var _0xd2b849={};var _0x3565ff;var _0x150a6e;return db[_0xb99f('0x2a')][_0xb99f('0x52')]({'where':{'id':_0x122f71['params']['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x10c95d,null))[_0xb99f('0x21')](function(_0x4ee91f){if(_0x4ee91f){_0x3565ff=_0x4ee91f;_0xd2b849[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db[_0xb99f('0x4e')]['rawAttributes']);_0xd2b849[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x122f71[_0xb99f('0x2f')]);_0xd2b849[_0xb99f('0x31')]=_['intersection'](_0xd2b849['model'],_0xd2b849[_0xb99f('0x2f')]);_0x990beb['attributes']=_[_0xb99f('0x32')](_0xd2b849['model'],qs['fields'](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x990beb['attributes']=_0x990beb[_0xb99f('0x33')][_0xb99f('0x53')]?_0x990beb[_0xb99f('0x33')]:_0xd2b849['model'];_0x990beb[_0xb99f('0x54')]=qs[_0xb99f('0x36')](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x36')]);_0x990beb[_0xb99f('0x37')]=qs['filters'](_['pick'](_0x122f71['query'],_0xd2b849[_0xb99f('0x31')]));if(_0x122f71[_0xb99f('0x2f')]['filter']){_0x990beb[_0xb99f('0x37')]=_[_0xb99f('0x42')](_0x990beb[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x990beb[_0xb99f('0x33')],function(_0x599ce3){var _0x308b8c={};_0x308b8c[_0x599ce3]={'$like':'%'+_0x122f71['query']['filter']+'%'};return _0x308b8c;})});}_0x990beb=_['merge']({},_0x990beb,_0x122f71[_0xb99f('0x3a')]);return _0x3565ff[_0xb99f('0x51')](_0x990beb);}})[_0xb99f('0x21')](function(_0x440469){if(_0x440469){_0x150a6e=_0x440469['length'];if(!_0x122f71['query']['hasOwnProperty']('nolimit')){_0x990beb[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x990beb[_0xb99f('0x18')]=qs['offset'](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x18')]);}return _0x3565ff[_0xb99f('0x51')](_0x990beb);}})[_0xb99f('0x21')](function(_0x411297){if(_0x411297){return _0x411297?{'count':_0x150a6e,'rows':_0x411297}:null;}})['then'](respondWithResult(_0x10c95d,null))['catch'](handleError(_0x10c95d,null));};exports['getAnyConditions']=function(_0x1801b5,_0x413436,_0x28317d){var _0x47656c={};var _0x2002d9={};var _0x5bcf63;var _0x562d31;return db['Trigger'][_0xb99f('0x52')]({'where':{'id':_0x1801b5['params']['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x413436,null))[_0xb99f('0x21')](function(_0x2e272e){if(_0x2e272e){_0x5bcf63=_0x2e272e;_0x2002d9['model']=_[_0xb99f('0x30')](db[_0xb99f('0x4e')][_0xb99f('0x41')]);_0x2002d9['query']=_[_0xb99f('0x30')](_0x1801b5[_0xb99f('0x2f')]);_0x2002d9[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x2002d9[_0xb99f('0x2e')],_0x2002d9['query']);_0x47656c[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x2002d9[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x1801b5['query'][_0xb99f('0x34')]));_0x47656c[_0xb99f('0x33')]=_0x47656c[_0xb99f('0x33')][_0xb99f('0x53')]?_0x47656c['attributes']:_0x2002d9[_0xb99f('0x2e')];_0x47656c['order']=qs[_0xb99f('0x36')](_0x1801b5[_0xb99f('0x2f')]['sort']);_0x47656c['where']=qs['filters'](_[_0xb99f('0x55')](_0x1801b5['query'],_0x2002d9['filters']));if(_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x38')]){_0x47656c[_0xb99f('0x37')]=_[_0xb99f('0x42')](_0x47656c[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x47656c['attributes'],function(_0x9dc29e){var _0x41f128={};_0x41f128[_0x9dc29e]={'$like':'%'+_0x1801b5['query'][_0xb99f('0x38')]+'%'};return _0x41f128;})});}_0x47656c=_[_0xb99f('0x42')]({},_0x47656c,_0x1801b5[_0xb99f('0x3a')]);return _0x5bcf63[_0xb99f('0x56')](_0x47656c);}})[_0xb99f('0x21')](function(_0x3b9bab){if(_0x3b9bab){_0x562d31=_0x3b9bab[_0xb99f('0x53')];if(!_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x35')](_0xb99f('0x57'))){_0x47656c['limit']=qs[_0xb99f('0x19')](_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x47656c['offset']=qs[_0xb99f('0x18')](_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x18')]);}return _0x5bcf63[_0xb99f('0x56')](_0x47656c);}})['then'](function(_0x315d13){if(_0x315d13){return _0x315d13?{'count':_0x562d31,'rows':_0x315d13}:null;}})[_0xb99f('0x21')](respondWithResult(_0x413436,null))[_0xb99f('0x3f')](handleError(_0x413436,null));};exports[_0xb99f('0x58')]=function(_0x5d947e,_0x48f61d,_0x5a87a8){if(_0x5d947e['body']['id']){delete _0x5d947e[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x5d947e[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x48f61d,null))[_0xb99f('0x21')](function(_0x3fa180){if(_0x3fa180){_0x5d947e[_0xb99f('0x45')][_0xb99f('0x59')]=_0x3fa180['id'];return db[_0xb99f('0x5a')]['create'](_0x5d947e[_0xb99f('0x45')]);}})[_0xb99f('0x21')](respondWithResult(_0x48f61d,null))[_0xb99f('0x3f')](handleError(_0x48f61d,null));};exports[_0xb99f('0x5b')]=function(_0x395da2,_0x29760a,_0x57a3a9){var _0x29acf9={};var _0x19c0c8={};var _0x424f5e;var _0xa9e3e8;return db[_0xb99f('0x2a')]['findOne']({'where':{'id':_0x395da2[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x29760a,null))[_0xb99f('0x21')](function(_0xe8524d){if(_0xe8524d){_0x424f5e=_0xe8524d;_0x19c0c8[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db[_0xb99f('0x5a')][_0xb99f('0x41')]);_0x19c0c8[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x395da2['query']);_0x19c0c8[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x19c0c8[_0xb99f('0x2e')],_0x19c0c8['query']);_0x29acf9[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x19c0c8[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x395da2['query'][_0xb99f('0x34')]));_0x29acf9[_0xb99f('0x33')]=_0x29acf9[_0xb99f('0x33')][_0xb99f('0x53')]?_0x29acf9[_0xb99f('0x33')]:_0x19c0c8[_0xb99f('0x2e')];_0x29acf9['order']=qs[_0xb99f('0x36')](_0x395da2[_0xb99f('0x2f')]['sort']);_0x29acf9['where']=qs['filters'](_['pick'](_0x395da2[_0xb99f('0x2f')],_0x19c0c8[_0xb99f('0x31')]));if(_0x395da2[_0xb99f('0x2f')]['filter']){_0x29acf9['where']=_[_0xb99f('0x42')](_0x29acf9[_0xb99f('0x37')],{'$or':_['map'](_0x29acf9[_0xb99f('0x33')],function(_0xbe3b99){var _0x19b30a={};_0x19b30a[_0xbe3b99]={'$like':'%'+_0x395da2['query'][_0xb99f('0x38')]+'%'};return _0x19b30a;})});}_0x29acf9=_[_0xb99f('0x42')]({},_0x29acf9,_0x395da2[_0xb99f('0x3a')]);return _0x424f5e['getActions'](_0x29acf9);}})[_0xb99f('0x21')](function(_0x1f5a7d){if(_0x1f5a7d){_0xa9e3e8=_0x1f5a7d[_0xb99f('0x53')];if(!_0x395da2[_0xb99f('0x2f')][_0xb99f('0x35')](_0xb99f('0x57'))){_0x29acf9[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x395da2[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x29acf9['offset']=qs[_0xb99f('0x18')](_0x395da2[_0xb99f('0x2f')]['offset']);}return _0x424f5e[_0xb99f('0x5b')](_0x29acf9);}})['then'](function(_0x2a7ca3){if(_0x2a7ca3){return _0x2a7ca3?{'count':_0xa9e3e8,'rows':_0x2a7ca3}:null;}})[_0xb99f('0x21')](respondWithResult(_0x29760a,null))['catch'](handleError(_0x29760a,null));};
\ No newline at end of file