Built motion from commit 129fb4d95212661e48f0db455e75d668addbaddf. Version 3.0.0...
[motion-next.git] / server / api / intSalesforceAccount / intSalesforceAccount.controller.js
index d758d52..aa2825d 100644 (file)
@@ -1 +1 @@
-const a281_0x352b=['keys','test','destroy','custom','Priority','False','describe','body','params','pick','label','lastIndexOf','IsEscalated','CallObject','Task','../../components/parsers/qs','Subjects','api','catch','length','rawAttributes','stringify','getFields,\x20%s,\x20%s,\x20%s','findOne','True','fieldName','statusCode','getFields','include','picklistValues','clientSecret','sequelize','stack','filters','SalesforceConfiguration','sobject','then','username','set','limit','includeAll','map','VIRTUAL','order','json','channel','getSubjects','slice','remove','like','nolimit','findAll','count','status','show','offset','type','create','false','jsforce','SuppliedName','CallDisposition','options','Type','merge','ticketType','undefined','sendStatus','fields','name','getDescriptions','CallType','error','password','includes','where','Content-Range','update','attributes','intersection','AccountId','IsArchived','SalesforceField','isNil','Status','boolean','SuppliedCompany','key','../../components/integrations/configuration','concat','CallDurationInSeconds','send','value','Descriptions','Wrong\x20credentials','filter','query','model','sort','securityToken','SalesforceAccount','login','getConfigurations'];(function(_0x436d4b,_0x352b3d){const _0xffbb18=function(_0x5b2513){while(--_0x5b2513){_0x436d4b['push'](_0x436d4b['shift']());}};_0xffbb18(++_0x352b3d);}(a281_0x352b,0x122));const a281_0xffbb=function(_0x436d4b,_0x352b3d){_0x436d4b=_0x436d4b-0x0;let _0xffbb18=a281_0x352b[_0x436d4b];return _0xffbb18;};const _0x5d0f48=a281_0xffbb;'use strict';const _=require('lodash'),jsforce=require(_0x5d0f48('0x4e')),qs=require(_0x5d0f48('0x22')),logger=require('../../config/logger')(_0x5d0f48('0x24')),db=require('../../mysqldb')['db'],{Op}=require(_0x5d0f48('0x32')),integrations=require(_0x5d0f48('0x4'));function respondWithResult(_0x5b2513,_0x374c6f){return _0x374c6f=_0x374c6f||0xc8,function(_0x2f8c10){const _0x4314bf=a281_0xffbb;if(_0x2f8c10)return _0x5b2513[_0x4314bf('0x48')](_0x374c6f)[_0x4314bf('0x3f')](_0x2f8c10);};}function respondWithFilteredResult(_0x5ae4e3,_0x1d903c){return function(_0x521a0f){const _0x1d74d2=a281_0xffbb;if(_0x521a0f){const _0x1e986a=_0x521a0f['count'],_0x3492ac=_0x1d903c[_0x1d74d2('0x4a')];let _0x502401=_0x1d903c['offset']+_0x1d903c['limit'],_0x4aca7a;return _0x502401>=_0x1e986a?(_0x502401=_0x1e986a,_0x4aca7a=0xc8):_0x4aca7a=0xce,_0x5ae4e3[_0x1d74d2('0x48')](_0x4aca7a),_0x5ae4e3[_0x1d74d2('0x39')](_0x1d74d2('0x5f'),_0x3492ac+'-'+_0x502401+'/'+_0x1e986a)[_0x1d74d2('0x3f')](_0x521a0f);}return null;};}function saveUpdates(_0x4f4ae6){return function(_0x51e42b){const _0x4653ed=a281_0xffbb;if(_0x51e42b)return _0x51e42b[_0x4653ed('0x60')](_0x4f4ae6)[_0x4653ed('0x37')](function(_0x31667d){return _0x31667d;});return null;};}function removeEntity(_0x3e562a){return function(_0x936a6e){const _0x55e40c=a281_0xffbb;if(_0x936a6e)return _0x936a6e['destroy']()[_0x55e40c('0x37')](function(){const _0x2b9ed2=_0x55e40c;_0x3e562a[_0x2b9ed2('0x48')](0xcc)['end']();});};}function handleEntityNotFound(_0x390c8a){return function(_0x281ab2){const _0x49684d=a281_0xffbb;return!_0x281ab2&&_0x390c8a[_0x49684d('0x56')](0x194),_0x281ab2;};}function handleError(_0x566d3a,_0x210340){return _0x210340=_0x210340||0x1f4,function(_0x19a6f7){const _0x5ae924=a281_0xffbb;logger[_0x5ae924('0x5b')](_0x19a6f7[_0x5ae924('0x33')]),_0x19a6f7[_0x5ae924('0x58')]&&delete _0x19a6f7[_0x5ae924('0x58')],_0x566d3a[_0x5ae924('0x48')](_0x210340)[_0x5ae924('0x7')](_0x19a6f7);};}exports['index']=function(_0x14fa28,_0x29dd8a){const _0x2273c7=_0x5d0f48;let _0x2d29e1={};const _0x582ca4={},_0x125cac={'count':0x0,'rows':[]},_0x35dd3a=_[_0x2273c7('0x3c')](db[_0x2273c7('0x10')]['rawAttributes'],function(_0x486476){const _0x49770c=_0x2273c7;return{'name':_0x486476[_0x49770c('0x2c')],'type':_0x486476[_0x49770c('0x4b')][_0x49770c('0x3')]};});_0x582ca4[_0x2273c7('0xd')]=_[_0x2273c7('0x3c')](_0x35dd3a,_0x2273c7('0x58')),_0x582ca4[_0x2273c7('0xc')]=_[_0x2273c7('0x13')](_0x14fa28['query']),_0x582ca4[_0x2273c7('0x34')]=_[_0x2273c7('0x62')](_0x582ca4[_0x2273c7('0xd')],_0x582ca4[_0x2273c7('0xc')]),_0x2d29e1[_0x2273c7('0x61')]=_['intersection'](_0x582ca4[_0x2273c7('0xd')],qs[_0x2273c7('0x57')](_0x14fa28[_0x2273c7('0xc')][_0x2273c7('0x57')])),_0x2d29e1['attributes']=_0x2d29e1[_0x2273c7('0x61')]['length']?_0x2d29e1['attributes']:_0x582ca4['model'];typeof _0x14fa28['query'][_0x2273c7('0x45')]==='undefined'&&(_0x2d29e1[_0x2273c7('0x3a')]=qs['limit'](_0x14fa28[_0x2273c7('0xc')][_0x2273c7('0x3a')]),_0x2d29e1['offset']=qs[_0x2273c7('0x4a')](_0x14fa28[_0x2273c7('0xc')]['offset']));_0x2d29e1['order']=qs[_0x2273c7('0xe')](_0x14fa28['query'][_0x2273c7('0xe')]),_0x2d29e1['where']=qs[_0x2273c7('0x34')](_[_0x2273c7('0x1c')](_0x14fa28[_0x2273c7('0xc')],_0x582ca4[_0x2273c7('0x34')]),_0x35dd3a);_0x14fa28[_0x2273c7('0xc')][_0x2273c7('0xb')]&&(_0x2d29e1[_0x2273c7('0x5e')]=_[_0x2273c7('0x53')](_0x2d29e1[_0x2273c7('0x5e')],{[Op['or']]:_[_0x2273c7('0x3c')](_0x35dd3a,function(_0x5c5f4c){const _0x5612eb=_0x2273c7;if(_0x5c5f4c[_0x5612eb('0x4b')]!==_0x5612eb('0x3d')){const _0x21b6f6={};return _0x21b6f6[_0x5c5f4c[_0x5612eb('0x58')]]={[Op[_0x5612eb('0x44')]]:'%'+_0x14fa28[_0x5612eb('0xc')]['filter']+'%'},_0x21b6f6;}})}));_0x2d29e1=_[_0x2273c7('0x53')]({},_0x2d29e1,_0x14fa28[_0x2273c7('0x51')]);const _0x33cec5={'where':_0x2d29e1[_0x2273c7('0x5e')]};return db[_0x2273c7('0x10')]['count'](_0x33cec5)[_0x2273c7('0x37')](function(_0x4dc5b7){const _0x53f8f4=_0x2273c7;return _0x125cac[_0x53f8f4('0x47')]=_0x4dc5b7,_0x14fa28['query'][_0x53f8f4('0x3b')]&&(_0x2d29e1[_0x53f8f4('0x2f')]=[{'all':!![]}]),db['SalesforceAccount'][_0x53f8f4('0x46')](_0x2d29e1);})[_0x2273c7('0x37')](function(_0x36f995){return _0x125cac['rows']=_0x36f995,_0x125cac;})[_0x2273c7('0x37')](respondWithFilteredResult(_0x29dd8a,_0x2d29e1))[_0x2273c7('0x25')](handleError(_0x29dd8a,null));},exports[_0x5d0f48('0x49')]=function(_0x4cb7c7,_0x5c3f55){const _0x13a5f5=_0x5d0f48;let _0x584bc6={'raw':![],'where':{'id':_0x4cb7c7[_0x13a5f5('0x1b')]['id']}};const _0x2f8d59={};return _0x2f8d59[_0x13a5f5('0xd')]=_[_0x13a5f5('0x13')](db[_0x13a5f5('0x10')][_0x13a5f5('0x27')]),_0x2f8d59[_0x13a5f5('0xc')]=_[_0x13a5f5('0x13')](_0x4cb7c7[_0x13a5f5('0xc')]),_0x2f8d59[_0x13a5f5('0x34')]=_['intersection'](_0x2f8d59['model'],_0x2f8d59['query']),_0x584bc6[_0x13a5f5('0x61')]=_[_0x13a5f5('0x62')](_0x2f8d59[_0x13a5f5('0xd')],qs[_0x13a5f5('0x57')](_0x4cb7c7[_0x13a5f5('0xc')][_0x13a5f5('0x57')])),_0x584bc6[_0x13a5f5('0x61')]=_0x584bc6['attributes'][_0x13a5f5('0x26')]?_0x584bc6['attributes']:_0x2f8d59[_0x13a5f5('0xd')],_0x4cb7c7[_0x13a5f5('0xc')][_0x13a5f5('0x3b')]&&(_0x584bc6[_0x13a5f5('0x2f')]=[{'all':!![]}]),_0x584bc6=_[_0x13a5f5('0x53')]({},_0x584bc6,_0x4cb7c7[_0x13a5f5('0x51')]),db[_0x13a5f5('0x10')][_0x13a5f5('0x2a')](_0x584bc6)[_0x13a5f5('0x37')](handleEntityNotFound(_0x5c3f55,null))[_0x13a5f5('0x37')](respondWithResult(_0x5c3f55,null))[_0x13a5f5('0x25')](handleError(_0x5c3f55,null));},exports[_0x5d0f48('0x4c')]=function(_0x15d556,_0x56c2e1){const _0x3cd974=_0x5d0f48;return db['SalesforceAccount']['create'](_0x15d556[_0x3cd974('0x1a')],{})[_0x3cd974('0x37')](respondWithResult(_0x56c2e1,0xc9))[_0x3cd974('0x25')](handleError(_0x56c2e1,null));},exports[_0x5d0f48('0x60')]=function(_0x1df31f,_0x5c2f58){const _0x1dcff0=_0x5d0f48;return _0x1df31f['body']['id']&&delete _0x1df31f[_0x1dcff0('0x1a')]['id'],db[_0x1dcff0('0x10')][_0x1dcff0('0x2a')]({'where':{'id':_0x1df31f[_0x1dcff0('0x1b')]['id']}})[_0x1dcff0('0x37')](handleEntityNotFound(_0x5c2f58,null))['then'](saveUpdates(_0x1df31f[_0x1dcff0('0x1a')],null))['then'](respondWithResult(_0x5c2f58,null))['catch'](handleError(_0x5c2f58,null));},exports[_0x5d0f48('0x15')]=function(_0x5994e4,_0x4b70ca){const _0x12dba5=_0x5d0f48;return db[_0x12dba5('0x10')]['findOne']({'where':{'id':_0x5994e4['params']['id']}})[_0x12dba5('0x37')](handleEntityNotFound(_0x4b70ca,null))[_0x12dba5('0x37')](removeEntity(_0x4b70ca,null))[_0x12dba5('0x25')](handleError(_0x4b70ca,null));},exports['getConfigurations']=function(_0x1c4911,_0x201675){const _0x12f76f=_0x5d0f48;let _0x5f57bf={};const _0x54ba32={};let _0x4eb4b1,_0x528757;return db[_0x12f76f('0x10')][_0x12f76f('0x2a')]({'where':{'id':_0x1c4911[_0x12f76f('0x1b')]['id']}})['then'](handleEntityNotFound(_0x201675,null))[_0x12f76f('0x37')](function(_0x21e046){const _0x568c0c=_0x12f76f;if(_0x21e046)return _0x4eb4b1=_0x21e046,_0x54ba32[_0x568c0c('0xd')]=_[_0x568c0c('0x13')](db[_0x568c0c('0x35')][_0x568c0c('0x27')]),_0x54ba32[_0x568c0c('0xc')]=_['keys'](_0x1c4911[_0x568c0c('0xc')]),_0x54ba32[_0x568c0c('0x34')]=_['intersection'](_0x54ba32[_0x568c0c('0xd')],_0x54ba32[_0x568c0c('0xc')]),_0x5f57bf[_0x568c0c('0x61')]=_[_0x568c0c('0x62')](_0x54ba32[_0x568c0c('0xd')],qs[_0x568c0c('0x57')](_0x1c4911['query'][_0x568c0c('0x57')])),_0x5f57bf[_0x568c0c('0x61')]=_0x5f57bf['attributes']['length']?_0x5f57bf[_0x568c0c('0x61')]:_0x54ba32['model'],_0x5f57bf[_0x568c0c('0x3e')]=qs[_0x568c0c('0xe')](_0x1c4911['query'][_0x568c0c('0xe')]),_0x5f57bf[_0x568c0c('0x5e')]=qs[_0x568c0c('0x34')](_[_0x568c0c('0x1c')](_0x1c4911[_0x568c0c('0xc')],_0x54ba32[_0x568c0c('0x34')])),_0x1c4911[_0x568c0c('0xc')][_0x568c0c('0xb')]&&(_0x5f57bf['where']=_[_0x568c0c('0x53')](_0x5f57bf[_0x568c0c('0x5e')],{[Op['or']]:_[_0x568c0c('0x3c')](_0x5f57bf['attributes'],function(_0x2c4edc){const _0x50ecae=_0x568c0c,_0x153f32={};return _0x153f32[_0x2c4edc]={[Op[_0x50ecae('0x44')]]:'%'+_0x1c4911[_0x50ecae('0xc')][_0x50ecae('0xb')]+'%'},_0x153f32;})})),_0x5f57bf=_['merge']({},_0x5f57bf,_0x1c4911['options']),_0x4eb4b1[_0x568c0c('0x12')](_0x5f57bf);})['then'](function(_0x478b8a){const _0x7b1840=_0x12f76f;if(_0x478b8a)return _0x528757=_0x478b8a[_0x7b1840('0x26')],typeof _0x1c4911[_0x7b1840('0xc')]['nolimit']===_0x7b1840('0x55')&&(_0x5f57bf[_0x7b1840('0x3a')]=qs[_0x7b1840('0x3a')](_0x1c4911[_0x7b1840('0xc')][_0x7b1840('0x3a')]),_0x5f57bf[_0x7b1840('0x4a')]=qs[_0x7b1840('0x4a')](_0x1c4911[_0x7b1840('0xc')][_0x7b1840('0x4a')])),_0x4eb4b1[_0x7b1840('0x12')](_0x5f57bf);})['then'](function(_0x464985){if(_0x464985)return _0x464985?{'count':_0x528757,'rows':_0x464985}:null;})[_0x12f76f('0x37')](respondWithResult(_0x201675,null))['catch'](handleError(_0x201675,null));},exports['addConfiguration']=function(_0x179e0e,_0x2733bf){const _0x253f6a=_0x5d0f48;return _0x179e0e[_0x253f6a('0x1a')]['id']&&delete _0x179e0e['body']['id'],db[_0x253f6a('0x10')][_0x253f6a('0x2a')]({'where':{'id':_0x179e0e['params']['id']}})['then'](handleEntityNotFound(_0x2733bf,null))[_0x253f6a('0x37')](function(_0xfa985d){const _0x387364=_0x253f6a;if(_0xfa985d)return _0x179e0e[_0x387364('0x1a')][_0x387364('0x63')]=_0xfa985d['id'],_0x179e0e[_0x387364('0x1a')]['Subjects']=integrations[_0x387364('0x41')](_0x179e0e['body'][_0x387364('0x40')],_0x179e0e[_0x387364('0x1a')][_0x387364('0x4b')]),_0x179e0e['body'][_0x387364('0x9')]=integrations[_0x387364('0x59')](_0x179e0e[_0x387364('0x1a')]['channel'],_0x179e0e['body'][_0x387364('0x4b')]),db[_0x387364('0x35')][_0x387364('0x4c')](_0x179e0e['body'],{'include':[{'model':db['SalesforceField'],'as':_0x387364('0x23')},{'model':db[_0x387364('0x65')],'as':_0x387364('0x9')}]});return null;})[_0x253f6a('0x37')](respondWithResult(_0x2733bf,null))['catch'](handleError(_0x2733bf,null));},exports[_0x5d0f48('0x2e')]=function(_0x238fb4,_0x506ce6){const _0x452179=_0x5d0f48;let _0x1a74cc,_0xe40711='',_0x33b368=_0x452179('0x21');return db[_0x452179('0x10')][_0x452179('0x2a')]({'where':{'id':_0x238fb4[_0x452179('0x1b')]['id']},'attributes':['id','remoteUri','clientId',_0x452179('0x31'),_0x452179('0x38'),_0x452179('0x5c'),'securityToken']})[_0x452179('0x37')](handleEntityNotFound(_0x506ce6,null))['then'](function(_0x52320f){const _0x5ab497=_0x452179;if(_0x52320f){_0xe40711=_0x52320f['remoteUri'];const _0x62b6b0=_0xe40711[_0x5ab497('0x42')](-0x1);return _0x62b6b0==='/'&&(_0xe40711=_0xe40711['substring'](0x0,_0xe40711[_0x5ab497('0x1e')](_0x62b6b0))),_0x1a74cc=new jsforce['Connection']({'oauth2':{'loginUrl':_0xe40711,'clientId':_0x52320f['clientId'],'clientSecret':_0x52320f[_0x5ab497('0x31')]}}),_0x1a74cc[_0x5ab497('0x11')](_0x52320f['username'],_0x52320f['password'][_0x5ab497('0x5')](_0x52320f[_0x5ab497('0xf')]));}})[_0x452179('0x37')](function(_0x28a4f7){const _0x38109b=_0x452179;if(_0x28a4f7)return!_['isNil'](_0x238fb4[_0x38109b('0xc')][_0x38109b('0x54')])&&(_0x33b368=_0x238fb4[_0x38109b('0xc')][_0x38109b('0x54')]),_0x1a74cc[_0x38109b('0x36')](_0x33b368)[_0x38109b('0x19')]();})['then'](function(_0x268c82){const _0x2a790c=_0x452179;let _0xef52bc=[_0x2a790c('0x50'),_0x2a790c('0x6'),_0x2a790c('0x20'),_0x2a790c('0x5a'),_0x2a790c('0x64'),_0x2a790c('0x17'),_0x2a790c('0x0'),'Type'];!_[_0x2a790c('0x66')](_0x238fb4[_0x2a790c('0xc')]['ticketType'])&&_0x238fb4[_0x2a790c('0xc')][_0x2a790c('0x54')]==='Case'&&(_0xef52bc=[_0x2a790c('0x52'),'Origin','Reason',_0x2a790c('0x0'),_0x2a790c('0x17'),_0x2a790c('0x1f'),_0x2a790c('0x4f'),_0x2a790c('0x2')]);if(_0x268c82)return _[_0x2a790c('0x43')](_0x268c82[_0x2a790c('0x57')],function(_0x4cd25f){const _0x35a84a=_0x2a790c;return _0x4cd25f['custom']===![]&&!_0xef52bc[_0x35a84a('0x5d')](_0x4cd25f[_0x35a84a('0x58')]);}),{'count':_0x268c82[_0x2a790c('0x57')][_0x2a790c('0x26')],'rows':_[_0x2a790c('0x3c')](_0x268c82[_0x2a790c('0x57')],function(_0x15eaa6){const _0x24bdcf=_0x2a790c;return{'id':_0x15eaa6[_0x24bdcf('0x58')],'name':_0x15eaa6['label'],'custom':_0x15eaa6[_0x24bdcf('0x16')],'options':_0x15eaa6[_0x24bdcf('0x30')][_0x24bdcf('0x26')]>0x0?_[_0x24bdcf('0x3c')](_0x15eaa6[_0x24bdcf('0x30')],function(_0x3c381b){const _0x4c375c=_0x24bdcf;return{'name':_0x3c381b[_0x4c375c('0x1d')],'value':_0x3c381b[_0x4c375c('0x8')]};}):_0x15eaa6[_0x24bdcf('0x4b')]==_0x24bdcf('0x1')?[{'name':_0x24bdcf('0x2b'),'value':'true'},{'name':_0x24bdcf('0x18'),'value':_0x24bdcf('0x4d')}]:[]};})};})['then'](respondWithResult(_0x506ce6,null))['catch'](function(_0x276524){const _0x3f9d53=_0x452179;let _0x54bf92=_0x238fb4[_0x3f9d53('0xc')][_0x3f9d53('0x14')]?0x1f4:_0x276524[_0x3f9d53('0x2d')]||0x1f4;logger[_0x3f9d53('0x5b')](_0x3f9d53('0x29'),_0x3f9d53('0x2e'),_0x54bf92,JSON[_0x3f9d53('0x28')](_0x276524)),delete _0x276524['name'],_0x54bf92===0x191&&(_0x54bf92=0x190),_0x506ce6[_0x3f9d53('0x48')](_0x54bf92)[_0x3f9d53('0x7')](_0x238fb4[_0x3f9d53('0xc')][_0x3f9d53('0x14')]?{'message':_0x3f9d53('0xa'),'statusCode':_0x276524[_0x3f9d53('0x2d')]}:_0x276524);});};
\ No newline at end of file
+const a336_0x4ae9=['substring','Reason','end','False','where','getDescriptions','catch','getFields','fields','statusCode','SuppliedName','Descriptions','Wrong\x20credentials','SuppliedCompany','SalesforceField','VIRTUAL','../../components/integrations/configuration','label','stringify','name','Status','order','jsforce','attributes','merge','sobject','json','password','custom','Priority','api','channel','AccountId','keys','rawAttributes','CallDurationInSeconds','concat','SalesforceAccount','query','CallType','pick','send','count','destroy','error','../../components/parsers/qs','Origin','Connection','intersection','getConfigurations','slice','findAll','stack','clientId','lodash','isNil','then','undefined','test','sendStatus','Case','SalesforceConfiguration','key','login','Subjects','status','rows','includeAll','IsArchived','offset','length','getFields,\x20%s,\x20%s,\x20%s','value','Type','findOne','IsEscalated','model','describe','include','sort','create','limit','CallObject','boolean','update','params','filter','map','true','body','../../mysqldb','lastIndexOf','type','filters','options','True','show','ticketType','picklistValues','sequelize','CallDisposition','like','remoteUri','username'];(function(_0x28bfb9,_0x53077f){const _0x4ae9d0=function(_0x4d771d){while(--_0x4d771d){_0x28bfb9['push'](_0x28bfb9['shift']());}};_0x4ae9d0(++_0x53077f);}(a336_0x4ae9,0x137));const a336_0x4d77=function(_0x28bfb9,_0x53077f){_0x28bfb9=_0x28bfb9-0x1ac;let _0x4ae9d0=a336_0x4ae9[_0x28bfb9];return _0x4ae9d0;};const a336_0xb7b50=a336_0x4d77;'use strict';const _=require(a336_0xb7b50(0x1e3)),jsforce=require(a336_0xb7b50(0x1c3)),qs=require(a336_0xb7b50(0x1da)),logger=require('../../config/logger')(a336_0xb7b50(0x1cb)),{db}=require(a336_0xb7b50(0x207)),{Op}=require(a336_0xb7b50(0x210)),integrations=require(a336_0xb7b50(0x1bd));function respondWithResult(_0x4f1a68,_0x436786){return _0x436786=_0x436786||0xc8,function(_0x22d334){const _0x410a0e=a336_0x4d77;if(_0x22d334)return _0x4f1a68[_0x410a0e(0x1ee)](_0x436786)[_0x410a0e(0x1c7)](_0x22d334);};}function respondWithFilteredResult(_0x57a249,_0x2875e8){return function(_0x3029ad){const _0x29e9e5=a336_0x4d77;if(_0x3029ad){const _0x1a2238=_0x3029ad['count'],_0x2d46f4=_0x2875e8['offset'];let _0x3aaa0a=_0x2875e8[_0x29e9e5(0x1f2)]+_0x2875e8['limit'],_0x8d71ab;return _0x3aaa0a>=_0x1a2238?(_0x3aaa0a=_0x1a2238,_0x8d71ab=0xc8):_0x8d71ab=0xce,_0x57a249[_0x29e9e5(0x1ee)](_0x8d71ab),_0x57a249['set']('Content-Range',_0x2d46f4+'-'+_0x3aaa0a+'/'+_0x1a2238)[_0x29e9e5(0x1c7)](_0x3029ad);}return null;};}function saveUpdates(_0x4268c4){return function(_0x1e470d){const _0x1a78ec=a336_0x4d77;if(_0x1e470d)return _0x1e470d[_0x1a78ec(0x201)](_0x4268c4)[_0x1a78ec(0x1e5)](function(_0x398cb0){return _0x398cb0;});return null;};}function removeEntity(_0x44ca3c){return function(_0x372482){const _0x371121=a336_0x4d77;if(_0x372482)return _0x372482[_0x371121(0x1d8)]()[_0x371121(0x1e5)](function(){const _0x14aa3a=_0x371121;_0x44ca3c[_0x14aa3a(0x1ee)](0xcc)[_0x14aa3a(0x1af)]();});};}function handleEntityNotFound(_0x122002){return function(_0x28e403){const _0x2aeae4=a336_0x4d77;return!_0x28e403&&_0x122002[_0x2aeae4(0x1e8)](0x194),_0x28e403;};}function handleError(_0xe2cfec,_0x56c1b0){return _0x56c1b0=_0x56c1b0||0x1f4,function(_0x325112){const _0x281aa0=a336_0x4d77;logger[_0x281aa0(0x1d9)](_0x325112[_0x281aa0(0x1e1)]),_0x325112['name']&&delete _0x325112['name'],_0xe2cfec[_0x281aa0(0x1ee)](_0x56c1b0)[_0x281aa0(0x1d6)](_0x325112);};}exports['index']=function(_0x368ce1,_0x5f30fe){const _0x3ffd22=a336_0xb7b50;let _0x2b3a5f={};const _0x262f26={},_0x4c047e={'count':0x0,'rows':[]},_0x5d0299=_[_0x3ffd22(0x204)](db['SalesforceAccount'][_0x3ffd22(0x1cf)],function(_0x33b924){const _0x5d0fb8=_0x3ffd22;return{'name':_0x33b924['fieldName'],'type':_0x33b924[_0x5d0fb8(0x209)][_0x5d0fb8(0x1eb)]};});_0x262f26[_0x3ffd22(0x1f9)]=_[_0x3ffd22(0x204)](_0x5d0299,_0x3ffd22(0x1c0)),_0x262f26[_0x3ffd22(0x1d3)]=_[_0x3ffd22(0x1ce)](_0x368ce1['query']),_0x262f26[_0x3ffd22(0x20a)]=_[_0x3ffd22(0x1dd)](_0x262f26[_0x3ffd22(0x1f9)],_0x262f26[_0x3ffd22(0x1d3)]),_0x2b3a5f['attributes']=_[_0x3ffd22(0x1dd)](_0x262f26[_0x3ffd22(0x1f9)],qs['fields'](_0x368ce1[_0x3ffd22(0x1d3)]['fields'])),_0x2b3a5f[_0x3ffd22(0x1c4)]=_0x2b3a5f[_0x3ffd22(0x1c4)][_0x3ffd22(0x1f3)]?_0x2b3a5f[_0x3ffd22(0x1c4)]:_0x262f26['model'];typeof _0x368ce1[_0x3ffd22(0x1d3)]['nolimit']===_0x3ffd22(0x1e6)&&(_0x2b3a5f[_0x3ffd22(0x1fe)]=qs[_0x3ffd22(0x1fe)](_0x368ce1[_0x3ffd22(0x1d3)][_0x3ffd22(0x1fe)]),_0x2b3a5f[_0x3ffd22(0x1f2)]=qs[_0x3ffd22(0x1f2)](_0x368ce1['query'][_0x3ffd22(0x1f2)]));_0x2b3a5f[_0x3ffd22(0x1c2)]=qs[_0x3ffd22(0x1fc)](_0x368ce1[_0x3ffd22(0x1d3)][_0x3ffd22(0x1fc)]),_0x2b3a5f['where']=qs[_0x3ffd22(0x20a)](_['pick'](_0x368ce1[_0x3ffd22(0x1d3)],_0x262f26[_0x3ffd22(0x20a)]),_0x5d0299);_0x368ce1[_0x3ffd22(0x1d3)][_0x3ffd22(0x203)]&&(_0x2b3a5f['where']=_['merge'](_0x2b3a5f[_0x3ffd22(0x1b1)],{[Op['or']]:_[_0x3ffd22(0x204)](_0x5d0299,function(_0x149007){const _0x49536c=_0x3ffd22;if(_0x149007[_0x49536c(0x209)]!==_0x49536c(0x1bc)){const _0x556c6c={};return _0x556c6c[_0x149007['name']]={[Op[_0x49536c(0x212)]]:'%'+_0x368ce1[_0x49536c(0x1d3)][_0x49536c(0x203)]+'%'},_0x556c6c;}})}));_0x2b3a5f=_[_0x3ffd22(0x1c5)]({},_0x2b3a5f,_0x368ce1[_0x3ffd22(0x20b)]);const _0x4be171={'where':_0x2b3a5f[_0x3ffd22(0x1b1)]};return db[_0x3ffd22(0x1d2)][_0x3ffd22(0x1d7)](_0x4be171)['then'](function(_0x2b3ee2){const _0x2a5835=_0x3ffd22;return _0x4c047e[_0x2a5835(0x1d7)]=_0x2b3ee2,_0x368ce1[_0x2a5835(0x1d3)]['includeAll']&&(_0x2b3a5f[_0x2a5835(0x1fb)]=[{'all':!![]}]),db[_0x2a5835(0x1d2)][_0x2a5835(0x1e0)](_0x2b3a5f);})['then'](function(_0x4b6520){const _0x3964d6=_0x3ffd22;return _0x4c047e[_0x3964d6(0x1ef)]=_0x4b6520,_0x4c047e;})['then'](respondWithFilteredResult(_0x5f30fe,_0x2b3a5f))['catch'](handleError(_0x5f30fe,null));},exports[a336_0xb7b50(0x20d)]=function(_0x1dacb3,_0x4fbf75){const _0x36f9ca=a336_0xb7b50;let _0x4147c4={'raw':![],'where':{'id':_0x1dacb3[_0x36f9ca(0x202)]['id']}};const _0x2eb208={};return _0x2eb208[_0x36f9ca(0x1f9)]=_[_0x36f9ca(0x1ce)](db[_0x36f9ca(0x1d2)]['rawAttributes']),_0x2eb208[_0x36f9ca(0x1d3)]=_[_0x36f9ca(0x1ce)](_0x1dacb3['query']),_0x2eb208['filters']=_['intersection'](_0x2eb208[_0x36f9ca(0x1f9)],_0x2eb208[_0x36f9ca(0x1d3)]),_0x4147c4[_0x36f9ca(0x1c4)]=_[_0x36f9ca(0x1dd)](_0x2eb208[_0x36f9ca(0x1f9)],qs[_0x36f9ca(0x1b5)](_0x1dacb3['query']['fields'])),_0x4147c4['attributes']=_0x4147c4['attributes']['length']?_0x4147c4['attributes']:_0x2eb208[_0x36f9ca(0x1f9)],_0x1dacb3['query'][_0x36f9ca(0x1f0)]&&(_0x4147c4[_0x36f9ca(0x1fb)]=[{'all':!![]}]),_0x4147c4=_[_0x36f9ca(0x1c5)]({},_0x4147c4,_0x1dacb3[_0x36f9ca(0x20b)]),db['SalesforceAccount']['findOne'](_0x4147c4)[_0x36f9ca(0x1e5)](handleEntityNotFound(_0x4fbf75,null))[_0x36f9ca(0x1e5)](respondWithResult(_0x4fbf75,null))[_0x36f9ca(0x1b3)](handleError(_0x4fbf75,null));},exports['create']=function(_0x14337d,_0x2e60e8){const _0x564793=a336_0xb7b50;return db['SalesforceAccount'][_0x564793(0x1fd)](_0x14337d[_0x564793(0x206)],{})[_0x564793(0x1e5)](respondWithResult(_0x2e60e8,0xc9))[_0x564793(0x1b3)](handleError(_0x2e60e8,null));},exports[a336_0xb7b50(0x201)]=function(_0x38b69c,_0x1989be){const _0x52720d=a336_0xb7b50;return _0x38b69c[_0x52720d(0x206)]['id']&&delete _0x38b69c['body']['id'],db[_0x52720d(0x1d2)][_0x52720d(0x1f7)]({'where':{'id':_0x38b69c[_0x52720d(0x202)]['id']}})[_0x52720d(0x1e5)](handleEntityNotFound(_0x1989be,null))[_0x52720d(0x1e5)](saveUpdates(_0x38b69c['body'],null))[_0x52720d(0x1e5)](respondWithResult(_0x1989be,null))[_0x52720d(0x1b3)](handleError(_0x1989be,null));},exports[a336_0xb7b50(0x1d8)]=function(_0x3eee8a,_0x1dc97a){const _0x12abbe=a336_0xb7b50;return db['SalesforceAccount'][_0x12abbe(0x1f7)]({'where':{'id':_0x3eee8a[_0x12abbe(0x202)]['id']}})[_0x12abbe(0x1e5)](handleEntityNotFound(_0x1dc97a,null))[_0x12abbe(0x1e5)](removeEntity(_0x1dc97a,null))[_0x12abbe(0x1b3)](handleError(_0x1dc97a,null));},exports[a336_0xb7b50(0x1de)]=function(_0x5ed7ca,_0x469984){const _0x32d132=a336_0xb7b50;let _0x5e62cc={};const _0x548b1={};let _0x1698e0,_0x311961;return db[_0x32d132(0x1d2)][_0x32d132(0x1f7)]({'where':{'id':_0x5ed7ca['params']['id']}})[_0x32d132(0x1e5)](handleEntityNotFound(_0x469984,null))[_0x32d132(0x1e5)](function(_0x25466d){const _0x3f2463=_0x32d132;if(_0x25466d)return _0x1698e0=_0x25466d,_0x548b1[_0x3f2463(0x1f9)]=_['keys'](db[_0x3f2463(0x1ea)][_0x3f2463(0x1cf)]),_0x548b1[_0x3f2463(0x1d3)]=_[_0x3f2463(0x1ce)](_0x5ed7ca[_0x3f2463(0x1d3)]),_0x548b1[_0x3f2463(0x20a)]=_['intersection'](_0x548b1['model'],_0x548b1['query']),_0x5e62cc['attributes']=_[_0x3f2463(0x1dd)](_0x548b1[_0x3f2463(0x1f9)],qs[_0x3f2463(0x1b5)](_0x5ed7ca[_0x3f2463(0x1d3)][_0x3f2463(0x1b5)])),_0x5e62cc[_0x3f2463(0x1c4)]=_0x5e62cc[_0x3f2463(0x1c4)][_0x3f2463(0x1f3)]?_0x5e62cc[_0x3f2463(0x1c4)]:_0x548b1[_0x3f2463(0x1f9)],_0x5e62cc[_0x3f2463(0x1c2)]=qs[_0x3f2463(0x1fc)](_0x5ed7ca[_0x3f2463(0x1d3)][_0x3f2463(0x1fc)]),_0x5e62cc[_0x3f2463(0x1b1)]=qs[_0x3f2463(0x20a)](_[_0x3f2463(0x1d5)](_0x5ed7ca['query'],_0x548b1[_0x3f2463(0x20a)])),_0x5ed7ca[_0x3f2463(0x1d3)][_0x3f2463(0x203)]&&(_0x5e62cc[_0x3f2463(0x1b1)]=_[_0x3f2463(0x1c5)](_0x5e62cc['where'],{[Op['or']]:_[_0x3f2463(0x204)](_0x5e62cc[_0x3f2463(0x1c4)],function(_0xf4facb){const _0x597a93=_0x3f2463,_0x36058a={};return _0x36058a[_0xf4facb]={[Op[_0x597a93(0x212)]]:'%'+_0x5ed7ca['query'][_0x597a93(0x203)]+'%'},_0x36058a;})})),_0x5e62cc=_[_0x3f2463(0x1c5)]({},_0x5e62cc,_0x5ed7ca[_0x3f2463(0x20b)]),_0x1698e0['getConfigurations'](_0x5e62cc);})[_0x32d132(0x1e5)](function(_0x25af60){const _0x8c9a69=_0x32d132;if(_0x25af60)return _0x311961=_0x25af60[_0x8c9a69(0x1f3)],typeof _0x5ed7ca[_0x8c9a69(0x1d3)]['nolimit']===_0x8c9a69(0x1e6)&&(_0x5e62cc[_0x8c9a69(0x1fe)]=qs[_0x8c9a69(0x1fe)](_0x5ed7ca[_0x8c9a69(0x1d3)][_0x8c9a69(0x1fe)]),_0x5e62cc[_0x8c9a69(0x1f2)]=qs[_0x8c9a69(0x1f2)](_0x5ed7ca['query']['offset'])),_0x1698e0['getConfigurations'](_0x5e62cc);})['then'](function(_0x5d954e){if(_0x5d954e)return _0x5d954e?{'count':_0x311961,'rows':_0x5d954e}:null;})[_0x32d132(0x1e5)](respondWithResult(_0x469984,null))[_0x32d132(0x1b3)](handleError(_0x469984,null));},exports['addConfiguration']=function(_0x310f38,_0x4ebdef){const _0x3a21fa=a336_0xb7b50;return _0x310f38[_0x3a21fa(0x206)]['id']&&delete _0x310f38[_0x3a21fa(0x206)]['id'],db[_0x3a21fa(0x1d2)][_0x3a21fa(0x1f7)]({'where':{'id':_0x310f38[_0x3a21fa(0x202)]['id']}})[_0x3a21fa(0x1e5)](handleEntityNotFound(_0x4ebdef,null))[_0x3a21fa(0x1e5)](function(_0x42022d){const _0x2cb66c=_0x3a21fa;if(_0x42022d)return _0x310f38['body'][_0x2cb66c(0x1cd)]=_0x42022d['id'],_0x310f38[_0x2cb66c(0x206)][_0x2cb66c(0x1ed)]=integrations['getSubjects'](_0x310f38['body'][_0x2cb66c(0x1cc)],_0x310f38['body']['type']),_0x310f38['body'][_0x2cb66c(0x1b8)]=integrations[_0x2cb66c(0x1b2)](_0x310f38[_0x2cb66c(0x206)]['channel'],_0x310f38['body'][_0x2cb66c(0x209)]),db[_0x2cb66c(0x1ea)][_0x2cb66c(0x1fd)](_0x310f38[_0x2cb66c(0x206)],{'include':[{'model':db[_0x2cb66c(0x1bb)],'as':_0x2cb66c(0x1ed)},{'model':db[_0x2cb66c(0x1bb)],'as':_0x2cb66c(0x1b8)}]});return null;})[_0x3a21fa(0x1e5)](respondWithResult(_0x4ebdef,null))[_0x3a21fa(0x1b3)](handleError(_0x4ebdef,null));},exports[a336_0xb7b50(0x1b4)]=function(_0x56ca98,_0x3bc341){const _0x47f59d=a336_0xb7b50;let _0x5035f6,_0x2d5dd8='',_0x550079='Task';return db[_0x47f59d(0x1d2)]['findOne']({'where':{'id':_0x56ca98[_0x47f59d(0x202)]['id']},'attributes':['id',_0x47f59d(0x213),'clientId','clientSecret',_0x47f59d(0x1ac),_0x47f59d(0x1c8),'securityToken']})[_0x47f59d(0x1e5)](handleEntityNotFound(_0x3bc341,null))[_0x47f59d(0x1e5)](function(_0x2b34f8){const _0x25443e=_0x47f59d;if(_0x2b34f8){_0x2d5dd8=_0x2b34f8['remoteUri'];const _0x1d20cc=_0x2d5dd8[_0x25443e(0x1df)](-0x1);return _0x1d20cc==='/'&&(_0x2d5dd8=_0x2d5dd8[_0x25443e(0x1ad)](0x0,_0x2d5dd8[_0x25443e(0x208)](_0x1d20cc))),_0x5035f6=new jsforce[(_0x25443e(0x1dc))]({'oauth2':{'loginUrl':_0x2d5dd8,'clientId':_0x2b34f8[_0x25443e(0x1e2)],'clientSecret':_0x2b34f8['clientSecret']}}),_0x5035f6[_0x25443e(0x1ec)](_0x2b34f8['username'],_0x2b34f8[_0x25443e(0x1c8)][_0x25443e(0x1d1)](_0x2b34f8['securityToken']));}})['then'](function(_0x3aadda){const _0x36855a=_0x47f59d;if(_0x3aadda)return!_[_0x36855a(0x1e4)](_0x56ca98[_0x36855a(0x1d3)]['ticketType'])&&(_0x550079=_0x56ca98['query'][_0x36855a(0x20e)]),_0x5035f6[_0x36855a(0x1c6)](_0x550079)[_0x36855a(0x1fa)]();})[_0x47f59d(0x1e5)](function(_0x1c4c8a){const _0x2485fd=_0x47f59d;let _0x2b01e7=[_0x2485fd(0x211),_0x2485fd(0x1d0),_0x2485fd(0x1ff),_0x2485fd(0x1d4),_0x2485fd(0x1f1),_0x2485fd(0x1ca),_0x2485fd(0x1c1),_0x2485fd(0x1f6)];!_[_0x2485fd(0x1e4)](_0x56ca98[_0x2485fd(0x1d3)][_0x2485fd(0x20e)])&&_0x56ca98[_0x2485fd(0x1d3)][_0x2485fd(0x20e)]===_0x2485fd(0x1e9)&&(_0x2b01e7=[_0x2485fd(0x1f6),_0x2485fd(0x1db),_0x2485fd(0x1ae),_0x2485fd(0x1c1),_0x2485fd(0x1ca),_0x2485fd(0x1f8),_0x2485fd(0x1b7),_0x2485fd(0x1ba)]);if(_0x1c4c8a)return _['remove'](_0x1c4c8a[_0x2485fd(0x1b5)],function(_0x444c88){const _0x5eb839=_0x2485fd;return _0x444c88[_0x5eb839(0x1c9)]===![]&&!_0x2b01e7['includes'](_0x444c88[_0x5eb839(0x1c0)]);}),{'count':_0x1c4c8a[_0x2485fd(0x1b5)]['length'],'rows':_[_0x2485fd(0x204)](_0x1c4c8a[_0x2485fd(0x1b5)],function(_0x591308){const _0x41a074=_0x2485fd;return{'id':_0x591308[_0x41a074(0x1c0)],'name':_0x591308['label'],'custom':_0x591308[_0x41a074(0x1c9)],'options':_0x591308['picklistValues'][_0x41a074(0x1f3)]>0x0?_[_0x41a074(0x204)](_0x591308[_0x41a074(0x20f)],function(_0x178e38){const _0xa1f3af=_0x41a074;return{'name':_0x178e38[_0xa1f3af(0x1be)],'value':_0x178e38[_0xa1f3af(0x1f5)]};}):_0x591308[_0x41a074(0x209)]==_0x41a074(0x200)?[{'name':_0x41a074(0x20c),'value':_0x41a074(0x205)},{'name':_0x41a074(0x1b0),'value':'false'}]:[]};})};})[_0x47f59d(0x1e5)](respondWithResult(_0x3bc341,null))['catch'](function(_0x2a9a82){const _0x4960d2=_0x47f59d;let _0x1d7bdf=_0x56ca98[_0x4960d2(0x1d3)][_0x4960d2(0x1e7)]?0x1f4:_0x2a9a82[_0x4960d2(0x1b6)]||0x1f4;logger['error'](_0x4960d2(0x1f4),'getFields',_0x1d7bdf,JSON[_0x4960d2(0x1bf)](_0x2a9a82)),delete _0x2a9a82['name'],_0x1d7bdf===0x191&&(_0x1d7bdf=0x190),_0x3bc341[_0x4960d2(0x1ee)](_0x1d7bdf)[_0x4960d2(0x1d6)](_0x56ca98[_0x4960d2(0x1d3)][_0x4960d2(0x1e7)]?{'message':_0x4960d2(0x1b9),'statusCode':_0x2a9a82[_0x4960d2(0x1b6)]}:_0x2a9a82);});};
\ No newline at end of file