Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / intSugarcrmAccount / intSugarcrmAccount.controller.js
index 186f165..6c98171 100644 (file)
@@ -1 +1 @@
-const a307_0x5184=['undefined','parent_type','model','JSON','values','catch','stack','attributes','POST','set','fieldName','xCALLY\x20Motion\x20Integration','util','includes','sendStatus','getFields,\x20%s,\x20%s,\x20%s','send','parent_name','getSubjects','login','format','addConfiguration','get_module_fields','/service/v4_1/rest.php','getConfigurations','options','map','Descriptions','username','substring','create','where','length','count','rawAttributes','findOne','include','merge','label','api','index','intersection','pick','Subjects','filter','password','test','AccountId','Password\x20Expired','Content-Range','rows','getDescriptions','type','SugarcrmConfiguration','update','params','duration_minutes','Calls','fields','lastIndexOf','limit','Wrong\x20credentials','then','PLAIN','json','request-promise-native','getFields','nolimit','SugarcrmField','value','direction','error','module_fields','%s%s','like','show','statusCode','body','sort','sequelize','filters','end','remoteUri','SugarcrmAccount','stringify','key','assigned_user_id','status','date_start','includeAll','order','keys','parent_id','../../components/integrations/configuration','description','destroy','../../mysqldb','name','offset','query','../../components/parsers/qs'];(function(_0x2e8811,_0x518430){const _0x321202=function(_0x23e977){while(--_0x23e977){_0x2e8811['push'](_0x2e8811['shift']());}};_0x321202(++_0x518430);}(a307_0x5184,0x1e0));const a307_0x3212=function(_0x2e8811,_0x518430){_0x2e8811=_0x2e8811-0x0;let _0x321202=a307_0x5184[_0x2e8811];return _0x321202;};const _0x9d0ace=a307_0x3212;'use strict';const rp=require(_0x9d0ace('0x5a')),util=require(_0x9d0ace('0x25')),_=require('lodash'),qs=require(_0x9d0ace('0x18')),logger=require('../../config/logger')(_0x9d0ace('0x40')),db=require(_0x9d0ace('0x14'))['db'],{Op}=require(_0x9d0ace('0x3')),integrations=require(_0x9d0ace('0x11'));function respondWithResult(_0x23e977,_0x46f77a){return _0x46f77a=_0x46f77a||0xc8,function(_0x1e19b6){const _0x226dd2=a307_0x3212;if(_0x1e19b6)return _0x23e977['status'](_0x46f77a)[_0x226dd2('0x59')](_0x1e19b6);};}function respondWithFilteredResult(_0x4edf01,_0x14b590){return function(_0x10d063){const _0x1fb01c=a307_0x3212;if(_0x10d063){const _0x38658f=_0x10d063[_0x1fb01c('0x3a')],_0x35bf59=_0x14b590['offset'];let _0x428c4d=_0x14b590['offset']+_0x14b590[_0x1fb01c('0x55')],_0x2bf495;return _0x428c4d>=_0x38658f?(_0x428c4d=_0x38658f,_0x2bf495=0xc8):_0x2bf495=0xce,_0x4edf01[_0x1fb01c('0xb')](_0x2bf495),_0x4edf01[_0x1fb01c('0x22')](_0x1fb01c('0x4a'),_0x35bf59+'-'+_0x428c4d+'/'+_0x38658f)[_0x1fb01c('0x59')](_0x10d063);}return null;};}function saveUpdates(_0x58231c){return function(_0x3f6751){const _0x3f1028=a307_0x3212;if(_0x3f6751)return _0x3f6751[_0x3f1028('0x4f')](_0x58231c)[_0x3f1028('0x57')](function(_0x3f9412){return _0x3f9412;});return null;};}function removeEntity(_0x3dcacc){return function(_0x25eaa3){const _0xdaadfc=a307_0x3212;if(_0x25eaa3)return _0x25eaa3[_0xdaadfc('0x13')]()['then'](function(){const _0x47cbeb=_0xdaadfc;_0x3dcacc[_0x47cbeb('0xb')](0xcc)[_0x47cbeb('0x5')]();});};}function handleEntityNotFound(_0x13c68e){return function(_0x267392){const _0x4e3a51=a307_0x3212;return!_0x267392&&_0x13c68e[_0x4e3a51('0x27')](0x194),_0x267392;};}function handleError(_0xccae8e,_0x5af344){return _0x5af344=_0x5af344||0x1f4,function(_0x4c2160){const _0x3d9818=a307_0x3212;logger[_0x3d9818('0x60')](_0x4c2160[_0x3d9818('0x1f')]),_0x4c2160[_0x3d9818('0x15')]&&delete _0x4c2160[_0x3d9818('0x15')],_0xccae8e[_0x3d9818('0xb')](_0x5af344)[_0x3d9818('0x29')](_0x4c2160);};}exports[_0x9d0ace('0x41')]=function(_0x40a25d,_0x545b36){const _0x39e707=_0x9d0ace;let _0x3573e6={};const _0x8cfc32={},_0x2be921={'count':0x0,'rows':[]},_0xf42520=_[_0x39e707('0x33')](db['SugarcrmAccount'][_0x39e707('0x3b')],function(_0x1ee332){const _0x8600f3=_0x39e707;return{'name':_0x1ee332[_0x8600f3('0x23')],'type':_0x1ee332['type'][_0x8600f3('0x9')]};});_0x8cfc32['model']=_[_0x39e707('0x33')](_0xf42520,_0x39e707('0x15')),_0x8cfc32['query']=_[_0x39e707('0xf')](_0x40a25d[_0x39e707('0x17')]),_0x8cfc32[_0x39e707('0x4')]=_[_0x39e707('0x42')](_0x8cfc32[_0x39e707('0x1b')],_0x8cfc32[_0x39e707('0x17')]),_0x3573e6['attributes']=_['intersection'](_0x8cfc32[_0x39e707('0x1b')],qs[_0x39e707('0x53')](_0x40a25d[_0x39e707('0x17')]['fields'])),_0x3573e6[_0x39e707('0x20')]=_0x3573e6[_0x39e707('0x20')][_0x39e707('0x39')]?_0x3573e6['attributes']:_0x8cfc32[_0x39e707('0x1b')];typeof _0x40a25d['query'][_0x39e707('0x5c')]===_0x39e707('0x19')&&(_0x3573e6[_0x39e707('0x55')]=qs[_0x39e707('0x55')](_0x40a25d['query'][_0x39e707('0x55')]),_0x3573e6[_0x39e707('0x16')]=qs[_0x39e707('0x16')](_0x40a25d[_0x39e707('0x17')][_0x39e707('0x16')]));_0x3573e6['order']=qs['sort'](_0x40a25d['query'][_0x39e707('0x2')]),_0x3573e6[_0x39e707('0x38')]=qs['filters'](_[_0x39e707('0x43')](_0x40a25d[_0x39e707('0x17')],_0x8cfc32[_0x39e707('0x4')]),_0xf42520);_0x40a25d[_0x39e707('0x17')][_0x39e707('0x45')]&&(_0x3573e6[_0x39e707('0x38')]=_[_0x39e707('0x3e')](_0x3573e6['where'],{[Op['or']]:_['map'](_0xf42520,function(_0x3d3db7){const _0x39cee6=_0x39e707;if(_0x3d3db7[_0x39cee6('0x4d')]!=='VIRTUAL'){const _0x4f819d={};return _0x4f819d[_0x3d3db7['name']]={[Op['like']]:'%'+_0x40a25d['query']['filter']+'%'},_0x4f819d;}})}));_0x3573e6=_[_0x39e707('0x3e')]({},_0x3573e6,_0x40a25d[_0x39e707('0x32')]);const _0x3777ff={'where':_0x3573e6[_0x39e707('0x38')]};return db['SugarcrmAccount'][_0x39e707('0x3a')](_0x3777ff)[_0x39e707('0x57')](function(_0x4d3fb0){const _0x37de0f=_0x39e707;return _0x2be921['count']=_0x4d3fb0,_0x40a25d[_0x37de0f('0x17')][_0x37de0f('0xd')]&&(_0x3573e6[_0x37de0f('0x3d')]=[{'all':!![]}]),db[_0x37de0f('0x7')]['findAll'](_0x3573e6);})[_0x39e707('0x57')](function(_0x7ed7f4){const _0x57a0c1=_0x39e707;return _0x2be921[_0x57a0c1('0x4b')]=_0x7ed7f4,_0x2be921;})['then'](respondWithFilteredResult(_0x545b36,_0x3573e6))[_0x39e707('0x1e')](handleError(_0x545b36,null));},exports[_0x9d0ace('0x64')]=function(_0x1248cf,_0x3ed74d){const _0x37a764=_0x9d0ace;let _0x46da29={'raw':![],'where':{'id':_0x1248cf['params']['id']}};const _0x227c6d={};return _0x227c6d[_0x37a764('0x1b')]=_[_0x37a764('0xf')](db[_0x37a764('0x7')][_0x37a764('0x3b')]),_0x227c6d[_0x37a764('0x17')]=_[_0x37a764('0xf')](_0x1248cf[_0x37a764('0x17')]),_0x227c6d[_0x37a764('0x4')]=_[_0x37a764('0x42')](_0x227c6d[_0x37a764('0x1b')],_0x227c6d[_0x37a764('0x17')]),_0x46da29['attributes']=_[_0x37a764('0x42')](_0x227c6d[_0x37a764('0x1b')],qs[_0x37a764('0x53')](_0x1248cf[_0x37a764('0x17')][_0x37a764('0x53')])),_0x46da29[_0x37a764('0x20')]=_0x46da29['attributes']['length']?_0x46da29[_0x37a764('0x20')]:_0x227c6d['model'],_0x1248cf[_0x37a764('0x17')][_0x37a764('0xd')]&&(_0x46da29['include']=[{'all':!![]}]),_0x46da29=_[_0x37a764('0x3e')]({},_0x46da29,_0x1248cf[_0x37a764('0x32')]),db[_0x37a764('0x7')][_0x37a764('0x3c')](_0x46da29)['then'](handleEntityNotFound(_0x3ed74d,null))[_0x37a764('0x57')](respondWithResult(_0x3ed74d,null))[_0x37a764('0x1e')](handleError(_0x3ed74d,null));},exports['create']=function(_0x4f1107,_0x35a586){const _0x36bfad=_0x9d0ace;return db['SugarcrmAccount'][_0x36bfad('0x37')](_0x4f1107[_0x36bfad('0x1')],{})[_0x36bfad('0x57')](respondWithResult(_0x35a586,0xc9))[_0x36bfad('0x1e')](handleError(_0x35a586,null));},exports['update']=function(_0x508ab6,_0x15b69d){const _0x3b30cb=_0x9d0ace;return _0x508ab6['body']['id']&&delete _0x508ab6[_0x3b30cb('0x1')]['id'],db[_0x3b30cb('0x7')][_0x3b30cb('0x3c')]({'where':{'id':_0x508ab6[_0x3b30cb('0x50')]['id']}})[_0x3b30cb('0x57')](handleEntityNotFound(_0x15b69d,null))[_0x3b30cb('0x57')](saveUpdates(_0x508ab6[_0x3b30cb('0x1')],null))['then'](respondWithResult(_0x15b69d,null))['catch'](handleError(_0x15b69d,null));},exports[_0x9d0ace('0x13')]=function(_0x4b0524,_0x278967){const _0x39835f=_0x9d0ace;return db[_0x39835f('0x7')][_0x39835f('0x3c')]({'where':{'id':_0x4b0524[_0x39835f('0x50')]['id']}})['then'](handleEntityNotFound(_0x278967,null))[_0x39835f('0x57')](removeEntity(_0x278967,null))['catch'](handleError(_0x278967,null));},exports['getConfigurations']=function(_0x30d1d1,_0x2b3d50){const _0x3b9e7b=_0x9d0ace;let _0x3381de={};const _0x5bde22={};let _0x98807d,_0x2de633;return db[_0x3b9e7b('0x7')][_0x3b9e7b('0x3c')]({'where':{'id':_0x30d1d1[_0x3b9e7b('0x50')]['id']}})[_0x3b9e7b('0x57')](handleEntityNotFound(_0x2b3d50,null))[_0x3b9e7b('0x57')](function(_0x4111de){const _0x57334e=_0x3b9e7b;if(_0x4111de)return _0x98807d=_0x4111de,_0x5bde22[_0x57334e('0x1b')]=_[_0x57334e('0xf')](db[_0x57334e('0x4e')]['rawAttributes']),_0x5bde22[_0x57334e('0x17')]=_[_0x57334e('0xf')](_0x30d1d1[_0x57334e('0x17')]),_0x5bde22[_0x57334e('0x4')]=_[_0x57334e('0x42')](_0x5bde22[_0x57334e('0x1b')],_0x5bde22[_0x57334e('0x17')]),_0x3381de[_0x57334e('0x20')]=_[_0x57334e('0x42')](_0x5bde22[_0x57334e('0x1b')],qs[_0x57334e('0x53')](_0x30d1d1[_0x57334e('0x17')]['fields'])),_0x3381de['attributes']=_0x3381de[_0x57334e('0x20')][_0x57334e('0x39')]?_0x3381de[_0x57334e('0x20')]:_0x5bde22[_0x57334e('0x1b')],_0x3381de[_0x57334e('0xe')]=qs[_0x57334e('0x2')](_0x30d1d1['query'][_0x57334e('0x2')]),_0x3381de[_0x57334e('0x38')]=qs[_0x57334e('0x4')](_[_0x57334e('0x43')](_0x30d1d1[_0x57334e('0x17')],_0x5bde22[_0x57334e('0x4')])),_0x30d1d1[_0x57334e('0x17')][_0x57334e('0x45')]&&(_0x3381de['where']=_['merge'](_0x3381de['where'],{[Op['or']]:_[_0x57334e('0x33')](_0x3381de['attributes'],function(_0x2a3201){const _0x2abc47=_0x57334e,_0x416f95={};return _0x416f95[_0x2a3201]={[Op[_0x2abc47('0x63')]]:'%'+_0x30d1d1[_0x2abc47('0x17')][_0x2abc47('0x45')]+'%'},_0x416f95;})})),_0x3381de=_[_0x57334e('0x3e')]({},_0x3381de,_0x30d1d1[_0x57334e('0x32')]),_0x98807d[_0x57334e('0x31')](_0x3381de);})[_0x3b9e7b('0x57')](function(_0x55011b){const _0x4ea190=_0x3b9e7b;if(_0x55011b)return _0x2de633=_0x55011b['length'],typeof _0x30d1d1[_0x4ea190('0x17')][_0x4ea190('0x5c')]==='undefined'&&(_0x3381de['limit']=qs[_0x4ea190('0x55')](_0x30d1d1[_0x4ea190('0x17')][_0x4ea190('0x55')]),_0x3381de[_0x4ea190('0x16')]=qs[_0x4ea190('0x16')](_0x30d1d1['query'][_0x4ea190('0x16')])),_0x98807d[_0x4ea190('0x31')](_0x3381de);})[_0x3b9e7b('0x57')](function(_0xed5520){if(_0xed5520)return _0xed5520?{'count':_0x2de633,'rows':_0xed5520}:null;})[_0x3b9e7b('0x57')](respondWithResult(_0x2b3d50,null))['catch'](handleError(_0x2b3d50,null));},exports[_0x9d0ace('0x2e')]=function(_0x2b270f,_0x1e11f3){const _0x548442=_0x9d0ace;return _0x2b270f[_0x548442('0x1')]['id']&&delete _0x2b270f['body']['id'],db[_0x548442('0x7')]['findOne']({'where':{'id':_0x2b270f[_0x548442('0x50')]['id']}})[_0x548442('0x57')](handleEntityNotFound(_0x1e11f3,null))['then'](function(_0x474a10){const _0x5df657=_0x548442;if(_0x474a10)return _0x2b270f[_0x5df657('0x1')][_0x5df657('0x48')]=_0x474a10['id'],_0x2b270f[_0x5df657('0x1')]['Subjects']=integrations[_0x5df657('0x2b')](_0x2b270f[_0x5df657('0x1')]['channel'],_0x2b270f['body']['type']),_0x2b270f[_0x5df657('0x1')][_0x5df657('0x34')]=integrations[_0x5df657('0x4c')](_0x2b270f['body']['channel'],_0x2b270f[_0x5df657('0x1')][_0x5df657('0x4d')]),db[_0x5df657('0x4e')][_0x5df657('0x37')](_0x2b270f[_0x5df657('0x1')],{'include':[{'model':db[_0x5df657('0x5d')],'as':_0x5df657('0x44')},{'model':db[_0x5df657('0x5d')],'as':_0x5df657('0x34')}]});return null;})[_0x548442('0x57')](respondWithResult(_0x1e11f3,null))[_0x548442('0x1e')](handleError(_0x1e11f3,null));},exports[_0x9d0ace('0x5b')]=function(_0x19ffbb,_0x470e02){const _0x2f3370=_0x9d0ace;let _0x55fda2='';const _0x24c2df=['id',_0x2f3370('0x15'),_0x2f3370('0xa'),'created_by',_0x2f3370('0x12'),_0x2f3370('0xc'),'duration_hours',_0x2f3370('0x51'),_0x2f3370('0x10'),_0x2f3370('0x1a'),_0x2f3370('0x2a'),_0x2f3370('0x5f')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x19ffbb[_0x2f3370('0x50')]['id']},'attributes':['id',_0x2f3370('0x35'),_0x2f3370('0x46'),'remoteUri']})[_0x2f3370('0x57')](handleEntityNotFound(_0x470e02,null))['then'](function(_0x2f10b9){const _0x1c2040=_0x2f3370;if(_0x2f10b9){_0x55fda2=_0x2f10b9[_0x1c2040('0x6')];const _0x1726e0=_0x55fda2['slice'](-0x1);return _0x1726e0==='/'&&(_0x55fda2=_0x55fda2[_0x1c2040('0x36')](0x0,_0x55fda2[_0x1c2040('0x54')](_0x1726e0))),rp({'method':_0x1c2040('0x21'),'uri':util[_0x1c2040('0x2d')](_0x1c2040('0x62'),_0x55fda2,_0x1c2040('0x30')),'json':!![],'form':{'method':_0x1c2040('0x2c'),'input_type':_0x1c2040('0x1c'),'response_type':_0x1c2040('0x1c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2f10b9[_0x1c2040('0x35')],'password':_0x2f10b9['password'],'encryption':_0x1c2040('0x58')},'application':_0x1c2040('0x24')})}});}})[_0x2f3370('0x57')](function(_0x480bde){const _0x5117e5=_0x2f3370;if(_0x480bde&&_0x480bde[_0x5117e5('0x15')]!=='Invalid\x20Login'&&_0x480bde['name']!==_0x5117e5('0x49'))return rp({'method':_0x5117e5('0x21'),'uri':util[_0x5117e5('0x2d')](_0x5117e5('0x62'),_0x55fda2,_0x5117e5('0x30')),'json':!![],'form':{'method':_0x5117e5('0x2f'),'input_type':_0x5117e5('0x1c'),'response_type':_0x5117e5('0x1c'),'rest_data':JSON[_0x5117e5('0x8')]({'session':_0x480bde['id'],'module_name':_0x5117e5('0x52')})}})[_0x5117e5('0x57')](function(_0x2ae2d9){const _0xb59b79=_0x5117e5;if(_0x2ae2d9){const _0x7a6e51=_['values'](_0x2ae2d9[_0xb59b79('0x61')]);return _['remove'](_0x7a6e51,function(_0x3e47a5){const _0x2c0b81=_0xb59b79;return _0x24c2df[_0x2c0b81('0x26')](_0x3e47a5[_0x2c0b81('0x15')]);}),{'count':_0x7a6e51[_0xb59b79('0x39')],'rows':_[_0xb59b79('0x33')](_0x7a6e51,function(_0x1a0850){const _0x300c83=_0xb59b79;return{'id':_0x1a0850['name'],'name':_0x1a0850[_0x300c83('0x3f')],'custom':_['endsWith'](_0x1a0850[_0x300c83('0x15')],'_c')?!![]:![],'options':_0x1a0850['options']?_['map'](_[_0x300c83('0x1d')](_0x1a0850[_0x300c83('0x32')]),function(_0x557bde){const _0x37936c=_0x300c83;return{'name':_0x557bde[_0x37936c('0x5e')],'value':_0x557bde['name']};}):[]};})};}})['then'](respondWithResult(_0x470e02,null))['catch'](function(_0x4ad37b){const _0x248639=_0x5117e5;let _0x289434=_0x19ffbb[_0x248639('0x17')][_0x248639('0x47')]?0x1f4:_0x4ad37b[_0x248639('0x0')]||0x1f4;logger[_0x248639('0x60')](_0x248639('0x28'),_0x248639('0x5b'),_0x289434,JSON[_0x248639('0x8')](_0x4ad37b)),delete _0x4ad37b[_0x248639('0x15')],_0x289434===0x191&&(_0x289434=0x190),_0x470e02[_0x248639('0xb')](_0x289434)[_0x248639('0x29')](_0x19ffbb[_0x248639('0x17')][_0x248639('0x47')]?{'message':_0x248639('0x56'),'statusCode':_0x4ad37b[_0x248639('0x0')]}:_0x4ad37b);});else{const _0x435a26=0x1f4;_0x470e02[_0x5117e5('0xb')](_0x435a26)[_0x5117e5('0x29')]({'message':_0x5117e5('0x56'),'statusCode':0x190});}});};
\ No newline at end of file
+const a307_0x4b26=['undefined','filters','getFields,\x20%s,\x20%s,\x20%s','name','module_fields','count','getSubjects','get_module_fields','Descriptions','password','substring','../../mysqldb','Content-Range','intersection','remoteUri','Invalid\x20Login','AccountId','duration_hours','POST','error','status','JSON','getFields','lodash','findOne','sort','model','stringify','Wrong\x20credentials','date_start','SugarcrmConfiguration','label','rawAttributes','where','destroy','query','filter','like','api','parent_type','set','value','key','format','Calls','../../config/logger','body','offset','assigned_user_id','pick','merge','test','send','%s%s','fieldName','params','sendStatus','../../components/parsers/qs','attributes','index','created_by','parent_id','SugarcrmField','Subjects','lastIndexOf','channel','description','sequelize','limit','request-promise-native','login','getConfigurations','../../components/integrations/configuration','end','map','options','type','xCALLY\x20Motion\x20Integration','endsWith','fields','SugarcrmAccount','/service/v4_1/rest.php','getDescriptions','values','VIRTUAL','stack','includeAll','rows','then','statusCode','update','nolimit','keys','length','findAll','PLAIN','catch','order','include','util','Password\x20Expired','show','create'];(function(_0x5f5051,_0x4b2664){const _0x57dbcd=function(_0x1a42ad){while(--_0x1a42ad){_0x5f5051['push'](_0x5f5051['shift']());}};_0x57dbcd(++_0x4b2664);}(a307_0x4b26,0x1b2));const a307_0x57db=function(_0x5f5051,_0x4b2664){_0x5f5051=_0x5f5051-0x0;let _0x57dbcd=a307_0x4b26[_0x5f5051];return _0x57dbcd;};const _0x1312f5=a307_0x57db;'use strict';const rp=require(_0x1312f5('0x2f')),util=require(_0x1312f5('0x4d')),_=require(_0x1312f5('0x1')),qs=require(_0x1312f5('0x23')),logger=require(_0x1312f5('0x17'))(_0x1312f5('0x10')),db=require(_0x1312f5('0x5c'))['db'],{Op}=require(_0x1312f5('0x2d')),integrations=require(_0x1312f5('0x32'));function respondWithResult(_0x1a42ad,_0x6a0f2c){return _0x6a0f2c=_0x6a0f2c||0xc8,function(_0x3af95f){const _0x78c256=a307_0x57db;if(_0x3af95f)return _0x1a42ad[_0x78c256('0x65')](_0x6a0f2c)['json'](_0x3af95f);};}function respondWithFilteredResult(_0x1ff601,_0xd6995f){return function(_0x59c61e){const _0x34cfc8=a307_0x57db;if(_0x59c61e){const _0x3254f8=_0x59c61e[_0x34cfc8('0x56')],_0x2ce2c9=_0xd6995f[_0x34cfc8('0x19')];let _0x36d920=_0xd6995f[_0x34cfc8('0x19')]+_0xd6995f[_0x34cfc8('0x2e')],_0x40fd7e;return _0x36d920>=_0x3254f8?(_0x36d920=_0x3254f8,_0x40fd7e=0xc8):_0x40fd7e=0xce,_0x1ff601[_0x34cfc8('0x65')](_0x40fd7e),_0x1ff601[_0x34cfc8('0x12')](_0x34cfc8('0x5d'),_0x2ce2c9+'-'+_0x36d920+'/'+_0x3254f8)['json'](_0x59c61e);}return null;};}function saveUpdates(_0x5e9dc4){return function(_0x53329c){const _0xf45c02=a307_0x57db;if(_0x53329c)return _0x53329c[_0xf45c02('0x44')](_0x5e9dc4)[_0xf45c02('0x42')](function(_0x4e9bf3){return _0x4e9bf3;});return null;};}function removeEntity(_0x1895e7){return function(_0x3c9016){const _0x45b995=a307_0x57db;if(_0x3c9016)return _0x3c9016[_0x45b995('0xc')]()['then'](function(){const _0x1ae427=_0x45b995;_0x1895e7[_0x1ae427('0x65')](0xcc)[_0x1ae427('0x33')]();});};}function handleEntityNotFound(_0x3a953e){return function(_0x28274b){const _0x2e0c58=a307_0x57db;return!_0x28274b&&_0x3a953e[_0x2e0c58('0x22')](0x194),_0x28274b;};}function handleError(_0x2c5740,_0x3fefc7){return _0x3fefc7=_0x3fefc7||0x1f4,function(_0x44d7b2){const _0x5b3de3=a307_0x57db;logger[_0x5b3de3('0x64')](_0x44d7b2[_0x5b3de3('0x3f')]),_0x44d7b2['name']&&delete _0x44d7b2[_0x5b3de3('0x54')],_0x2c5740['status'](_0x3fefc7)['send'](_0x44d7b2);};}exports[_0x1312f5('0x25')]=function(_0x598d0c,_0x46ee36){const _0x523183=_0x1312f5;let _0x18dcc5={};const _0x36710f={},_0x1a59f5={'count':0x0,'rows':[]},_0x193972=_['map'](db[_0x523183('0x3a')]['rawAttributes'],function(_0x38a095){const _0x341285=_0x523183;return{'name':_0x38a095[_0x341285('0x20')],'type':_0x38a095['type'][_0x341285('0x14')]};});_0x36710f[_0x523183('0x4')]=_[_0x523183('0x34')](_0x193972,_0x523183('0x54')),_0x36710f[_0x523183('0xd')]=_[_0x523183('0x46')](_0x598d0c[_0x523183('0xd')]),_0x36710f[_0x523183('0x52')]=_['intersection'](_0x36710f['model'],_0x36710f[_0x523183('0xd')]),_0x18dcc5[_0x523183('0x24')]=_[_0x523183('0x5e')](_0x36710f[_0x523183('0x4')],qs[_0x523183('0x39')](_0x598d0c[_0x523183('0xd')][_0x523183('0x39')])),_0x18dcc5[_0x523183('0x24')]=_0x18dcc5[_0x523183('0x24')]['length']?_0x18dcc5[_0x523183('0x24')]:_0x36710f[_0x523183('0x4')];typeof _0x598d0c[_0x523183('0xd')][_0x523183('0x45')]==='undefined'&&(_0x18dcc5[_0x523183('0x2e')]=qs[_0x523183('0x2e')](_0x598d0c[_0x523183('0xd')][_0x523183('0x2e')]),_0x18dcc5[_0x523183('0x19')]=qs[_0x523183('0x19')](_0x598d0c[_0x523183('0xd')]['offset']));_0x18dcc5[_0x523183('0x4b')]=qs[_0x523183('0x3')](_0x598d0c[_0x523183('0xd')][_0x523183('0x3')]),_0x18dcc5['where']=qs['filters'](_[_0x523183('0x1b')](_0x598d0c[_0x523183('0xd')],_0x36710f[_0x523183('0x52')]),_0x193972);_0x598d0c[_0x523183('0xd')]['filter']&&(_0x18dcc5[_0x523183('0xb')]=_[_0x523183('0x1c')](_0x18dcc5[_0x523183('0xb')],{[Op['or']]:_[_0x523183('0x34')](_0x193972,function(_0x3514b1){const _0x1d73aa=_0x523183;if(_0x3514b1['type']!==_0x1d73aa('0x3e')){const _0x50159d={};return _0x50159d[_0x3514b1[_0x1d73aa('0x54')]]={[Op[_0x1d73aa('0xf')]]:'%'+_0x598d0c[_0x1d73aa('0xd')][_0x1d73aa('0xe')]+'%'},_0x50159d;}})}));_0x18dcc5=_[_0x523183('0x1c')]({},_0x18dcc5,_0x598d0c[_0x523183('0x35')]);const _0x5dfeaa={'where':_0x18dcc5[_0x523183('0xb')]};return db[_0x523183('0x3a')][_0x523183('0x56')](_0x5dfeaa)['then'](function(_0x44ff03){const _0x387220=_0x523183;return _0x1a59f5[_0x387220('0x56')]=_0x44ff03,_0x598d0c[_0x387220('0xd')]['includeAll']&&(_0x18dcc5[_0x387220('0x4c')]=[{'all':!![]}]),db[_0x387220('0x3a')][_0x387220('0x48')](_0x18dcc5);})['then'](function(_0x385f56){const _0x1ce057=_0x523183;return _0x1a59f5[_0x1ce057('0x41')]=_0x385f56,_0x1a59f5;})['then'](respondWithFilteredResult(_0x46ee36,_0x18dcc5))[_0x523183('0x4a')](handleError(_0x46ee36,null));},exports[_0x1312f5('0x4f')]=function(_0x1b5563,_0x2f1717){const _0x1c0ccd=_0x1312f5;let _0x1f8d0={'raw':![],'where':{'id':_0x1b5563[_0x1c0ccd('0x21')]['id']}};const _0x4e75d9={};return _0x4e75d9['model']=_[_0x1c0ccd('0x46')](db['SugarcrmAccount'][_0x1c0ccd('0xa')]),_0x4e75d9[_0x1c0ccd('0xd')]=_[_0x1c0ccd('0x46')](_0x1b5563[_0x1c0ccd('0xd')]),_0x4e75d9['filters']=_[_0x1c0ccd('0x5e')](_0x4e75d9[_0x1c0ccd('0x4')],_0x4e75d9[_0x1c0ccd('0xd')]),_0x1f8d0[_0x1c0ccd('0x24')]=_[_0x1c0ccd('0x5e')](_0x4e75d9[_0x1c0ccd('0x4')],qs[_0x1c0ccd('0x39')](_0x1b5563[_0x1c0ccd('0xd')][_0x1c0ccd('0x39')])),_0x1f8d0[_0x1c0ccd('0x24')]=_0x1f8d0[_0x1c0ccd('0x24')][_0x1c0ccd('0x47')]?_0x1f8d0['attributes']:_0x4e75d9[_0x1c0ccd('0x4')],_0x1b5563[_0x1c0ccd('0xd')][_0x1c0ccd('0x40')]&&(_0x1f8d0['include']=[{'all':!![]}]),_0x1f8d0=_[_0x1c0ccd('0x1c')]({},_0x1f8d0,_0x1b5563['options']),db['SugarcrmAccount'][_0x1c0ccd('0x2')](_0x1f8d0)[_0x1c0ccd('0x42')](handleEntityNotFound(_0x2f1717,null))['then'](respondWithResult(_0x2f1717,null))[_0x1c0ccd('0x4a')](handleError(_0x2f1717,null));},exports[_0x1312f5('0x50')]=function(_0x5b2040,_0x10eac6){const _0x35c533=_0x1312f5;return db[_0x35c533('0x3a')]['create'](_0x5b2040[_0x35c533('0x18')],{})[_0x35c533('0x42')](respondWithResult(_0x10eac6,0xc9))['catch'](handleError(_0x10eac6,null));},exports[_0x1312f5('0x44')]=function(_0x19f1bf,_0x945cf2){const _0x4e9ed5=_0x1312f5;return _0x19f1bf[_0x4e9ed5('0x18')]['id']&&delete _0x19f1bf['body']['id'],db[_0x4e9ed5('0x3a')]['findOne']({'where':{'id':_0x19f1bf[_0x4e9ed5('0x21')]['id']}})[_0x4e9ed5('0x42')](handleEntityNotFound(_0x945cf2,null))[_0x4e9ed5('0x42')](saveUpdates(_0x19f1bf['body'],null))[_0x4e9ed5('0x42')](respondWithResult(_0x945cf2,null))[_0x4e9ed5('0x4a')](handleError(_0x945cf2,null));},exports[_0x1312f5('0xc')]=function(_0xeb7eb6,_0x20987a){const _0x17c042=_0x1312f5;return db[_0x17c042('0x3a')][_0x17c042('0x2')]({'where':{'id':_0xeb7eb6['params']['id']}})['then'](handleEntityNotFound(_0x20987a,null))[_0x17c042('0x42')](removeEntity(_0x20987a,null))[_0x17c042('0x4a')](handleError(_0x20987a,null));},exports[_0x1312f5('0x31')]=function(_0x156d6c,_0x4d6b4f){const _0x6ee77=_0x1312f5;let _0x320092={};const _0x310ff8={};let _0x3a3f4f,_0x5ee41a;return db[_0x6ee77('0x3a')][_0x6ee77('0x2')]({'where':{'id':_0x156d6c[_0x6ee77('0x21')]['id']}})['then'](handleEntityNotFound(_0x4d6b4f,null))['then'](function(_0x47c48d){const _0x3e118c=_0x6ee77;if(_0x47c48d)return _0x3a3f4f=_0x47c48d,_0x310ff8[_0x3e118c('0x4')]=_[_0x3e118c('0x46')](db[_0x3e118c('0x8')][_0x3e118c('0xa')]),_0x310ff8[_0x3e118c('0xd')]=_['keys'](_0x156d6c[_0x3e118c('0xd')]),_0x310ff8['filters']=_[_0x3e118c('0x5e')](_0x310ff8[_0x3e118c('0x4')],_0x310ff8[_0x3e118c('0xd')]),_0x320092[_0x3e118c('0x24')]=_['intersection'](_0x310ff8['model'],qs[_0x3e118c('0x39')](_0x156d6c[_0x3e118c('0xd')][_0x3e118c('0x39')])),_0x320092[_0x3e118c('0x24')]=_0x320092[_0x3e118c('0x24')]['length']?_0x320092[_0x3e118c('0x24')]:_0x310ff8[_0x3e118c('0x4')],_0x320092[_0x3e118c('0x4b')]=qs[_0x3e118c('0x3')](_0x156d6c[_0x3e118c('0xd')]['sort']),_0x320092[_0x3e118c('0xb')]=qs[_0x3e118c('0x52')](_[_0x3e118c('0x1b')](_0x156d6c[_0x3e118c('0xd')],_0x310ff8['filters'])),_0x156d6c[_0x3e118c('0xd')][_0x3e118c('0xe')]&&(_0x320092['where']=_[_0x3e118c('0x1c')](_0x320092[_0x3e118c('0xb')],{[Op['or']]:_[_0x3e118c('0x34')](_0x320092['attributes'],function(_0x11ee85){const _0x439a6f=_0x3e118c,_0x19c56b={};return _0x19c56b[_0x11ee85]={[Op[_0x439a6f('0xf')]]:'%'+_0x156d6c[_0x439a6f('0xd')][_0x439a6f('0xe')]+'%'},_0x19c56b;})})),_0x320092=_[_0x3e118c('0x1c')]({},_0x320092,_0x156d6c[_0x3e118c('0x35')]),_0x3a3f4f[_0x3e118c('0x31')](_0x320092);})['then'](function(_0x2ce1ab){const _0x1cd930=_0x6ee77;if(_0x2ce1ab)return _0x5ee41a=_0x2ce1ab[_0x1cd930('0x47')],typeof _0x156d6c[_0x1cd930('0xd')][_0x1cd930('0x45')]===_0x1cd930('0x51')&&(_0x320092[_0x1cd930('0x2e')]=qs[_0x1cd930('0x2e')](_0x156d6c[_0x1cd930('0xd')][_0x1cd930('0x2e')]),_0x320092[_0x1cd930('0x19')]=qs['offset'](_0x156d6c[_0x1cd930('0xd')][_0x1cd930('0x19')])),_0x3a3f4f['getConfigurations'](_0x320092);})[_0x6ee77('0x42')](function(_0x5c2d74){if(_0x5c2d74)return _0x5c2d74?{'count':_0x5ee41a,'rows':_0x5c2d74}:null;})[_0x6ee77('0x42')](respondWithResult(_0x4d6b4f,null))[_0x6ee77('0x4a')](handleError(_0x4d6b4f,null));},exports['addConfiguration']=function(_0x2118b1,_0x10f497){const _0x1f6745=_0x1312f5;return _0x2118b1[_0x1f6745('0x18')]['id']&&delete _0x2118b1[_0x1f6745('0x18')]['id'],db[_0x1f6745('0x3a')][_0x1f6745('0x2')]({'where':{'id':_0x2118b1[_0x1f6745('0x21')]['id']}})['then'](handleEntityNotFound(_0x10f497,null))[_0x1f6745('0x42')](function(_0x54210e){const _0xd6f5d3=_0x1f6745;if(_0x54210e)return _0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x61')]=_0x54210e['id'],_0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x29')]=integrations[_0xd6f5d3('0x57')](_0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x2b')],_0x2118b1['body'][_0xd6f5d3('0x36')]),_0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x59')]=integrations[_0xd6f5d3('0x3c')](_0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x2b')],_0x2118b1[_0xd6f5d3('0x18')][_0xd6f5d3('0x36')]),db[_0xd6f5d3('0x8')][_0xd6f5d3('0x50')](_0x2118b1[_0xd6f5d3('0x18')],{'include':[{'model':db[_0xd6f5d3('0x28')],'as':_0xd6f5d3('0x29')},{'model':db[_0xd6f5d3('0x28')],'as':_0xd6f5d3('0x59')}]});return null;})[_0x1f6745('0x42')](respondWithResult(_0x10f497,null))[_0x1f6745('0x4a')](handleError(_0x10f497,null));},exports[_0x1312f5('0x0')]=function(_0x5e8921,_0x3d5105){const _0x42b14b=_0x1312f5;let _0x377d56='';const _0x296b40=['id',_0x42b14b('0x54'),_0x42b14b('0x1a'),_0x42b14b('0x26'),_0x42b14b('0x2c'),_0x42b14b('0x7'),_0x42b14b('0x62'),'duration_minutes',_0x42b14b('0x27'),_0x42b14b('0x11'),'parent_name','direction'];return db[_0x42b14b('0x3a')][_0x42b14b('0x2')]({'where':{'id':_0x5e8921['params']['id']},'attributes':['id','username',_0x42b14b('0x5a'),_0x42b14b('0x5f')]})[_0x42b14b('0x42')](handleEntityNotFound(_0x3d5105,null))[_0x42b14b('0x42')](function(_0x141bed){const _0x214430=_0x42b14b;if(_0x141bed){_0x377d56=_0x141bed[_0x214430('0x5f')];const _0x5f173f=_0x377d56['slice'](-0x1);return _0x5f173f==='/'&&(_0x377d56=_0x377d56[_0x214430('0x5b')](0x0,_0x377d56[_0x214430('0x2a')](_0x5f173f))),rp({'method':'POST','uri':util[_0x214430('0x15')](_0x214430('0x1f'),_0x377d56,_0x214430('0x3b')),'json':!![],'form':{'method':_0x214430('0x30'),'input_type':_0x214430('0x66'),'response_type':'JSON','rest_data':JSON[_0x214430('0x5')]({'user_auth':{'user_name':_0x141bed['username'],'password':_0x141bed[_0x214430('0x5a')],'encryption':_0x214430('0x49')},'application':_0x214430('0x37')})}});}})[_0x42b14b('0x42')](function(_0x3d7564){const _0x2204f7=_0x42b14b;if(_0x3d7564&&_0x3d7564[_0x2204f7('0x54')]!==_0x2204f7('0x60')&&_0x3d7564[_0x2204f7('0x54')]!==_0x2204f7('0x4e'))return rp({'method':_0x2204f7('0x63'),'uri':util['format'](_0x2204f7('0x1f'),_0x377d56,_0x2204f7('0x3b')),'json':!![],'form':{'method':_0x2204f7('0x58'),'input_type':'JSON','response_type':_0x2204f7('0x66'),'rest_data':JSON['stringify']({'session':_0x3d7564['id'],'module_name':_0x2204f7('0x16')})}})[_0x2204f7('0x42')](function(_0x3d154e){const _0x9abd2d=_0x2204f7;if(_0x3d154e){const _0x590b64=_[_0x9abd2d('0x3d')](_0x3d154e[_0x9abd2d('0x55')]);return _['remove'](_0x590b64,function(_0x1882b4){return _0x296b40['includes'](_0x1882b4['name']);}),{'count':_0x590b64[_0x9abd2d('0x47')],'rows':_[_0x9abd2d('0x34')](_0x590b64,function(_0x7e2a58){const _0x2eacbb=_0x9abd2d;return{'id':_0x7e2a58[_0x2eacbb('0x54')],'name':_0x7e2a58[_0x2eacbb('0x9')],'custom':_[_0x2eacbb('0x38')](_0x7e2a58[_0x2eacbb('0x54')],'_c')?!![]:![],'options':_0x7e2a58[_0x2eacbb('0x35')]?_[_0x2eacbb('0x34')](_[_0x2eacbb('0x3d')](_0x7e2a58[_0x2eacbb('0x35')]),function(_0x3035f0){const _0x19dfdc=_0x2eacbb;return{'name':_0x3035f0[_0x19dfdc('0x13')],'value':_0x3035f0[_0x19dfdc('0x54')]};}):[]};})};}})[_0x2204f7('0x42')](respondWithResult(_0x3d5105,null))[_0x2204f7('0x4a')](function(_0xd3bc1a){const _0x130a40=_0x2204f7;let _0x27c6ca=_0x5e8921[_0x130a40('0xd')][_0x130a40('0x1d')]?0x1f4:_0xd3bc1a['statusCode']||0x1f4;logger[_0x130a40('0x64')](_0x130a40('0x53'),_0x130a40('0x0'),_0x27c6ca,JSON[_0x130a40('0x5')](_0xd3bc1a)),delete _0xd3bc1a[_0x130a40('0x54')],_0x27c6ca===0x191&&(_0x27c6ca=0x190),_0x3d5105['status'](_0x27c6ca)[_0x130a40('0x1e')](_0x5e8921['query'][_0x130a40('0x1d')]?{'message':_0x130a40('0x6'),'statusCode':_0xd3bc1a[_0x130a40('0x43')]}:_0xd3bc1a);});else{const _0x172fa2=0x1f4;_0x3d5105[_0x2204f7('0x65')](_0x172fa2)['send']({'message':_0x2204f7('0x6'),'statusCode':0x190});}});};
\ No newline at end of file