Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / intSalesforceAccount / intSalesforceAccount.controller.js
index 06d5d04..2824928 100644 (file)
@@ -1 +1 @@
-const a281_0x113d=['Subjects','catch','json','set','filters','clientSecret','then','length','SalesforceField','include','findAll','intersection','includeAll','getConfigurations','create','status','where','picklistValues','username','getFields','Case','slice','CallType','fieldName','model','Reason','securityToken','show','substring','test','true','end','findOne','body','options','Type','Task','nolimit','AccountId','order','destroy','type','attributes','False','sendStatus','SuppliedName','getFields,\x20%s,\x20%s,\x20%s','rawAttributes','describe','Wrong\x20credentials','count','CallDurationInSeconds','ticketType','../../config/logger','boolean','SalesforceAccount','Descriptions','getSubjects','index','concat','key','custom','limit','statusCode','filter','remoteUri','update','false','fields','like','../../mysqldb','undefined','params','label','clientId','channel','password','isNil','IsArchived','map','offset','lastIndexOf','True','merge','sort','keys','Connection','query','addConfiguration','Status','name','lodash','stringify','SuppliedCompany','send','stack','IsEscalated','sobject','login','Priority'];(function(_0x23db70,_0x113d14){const _0x8fa1c5=function(_0x955eba){while(--_0x955eba){_0x23db70['push'](_0x23db70['shift']());}};_0x8fa1c5(++_0x113d14);}(a281_0x113d,0x79));const a281_0x8fa1=function(_0x23db70,_0x113d14){_0x23db70=_0x23db70-0x0;let _0x8fa1c5=a281_0x113d[_0x23db70];return _0x8fa1c5;};const _0x7aa29e=a281_0x8fa1;'use strict';const _=require(_0x7aa29e('0x46')),jsforce=require('jsforce'),qs=require('../../components/parsers/qs'),logger=require(_0x7aa29e('0x20'))('api'),db=require(_0x7aa29e('0x31'))['db'],{Op}=require('sequelize'),integrations=require('../../components/integrations/configuration');function respondWithResult(_0x955eba,_0x3e6619){return _0x3e6619=_0x3e6619||0xc8,function(_0x17c2a0){const _0x2cdec3=a281_0x8fa1;if(_0x17c2a0)return _0x955eba[_0x2cdec3('0x5e')](_0x3e6619)[_0x2cdec3('0x51')](_0x17c2a0);};}function respondWithFilteredResult(_0x2d5596,_0x58fd0e){return function(_0x4ae7ab){const _0x36af3a=a281_0x8fa1;if(_0x4ae7ab){const _0x4fcf00=_0x4ae7ab[_0x36af3a('0x1d')],_0x19dbe3=_0x58fd0e[_0x36af3a('0x3b')];let _0x56c57e=_0x58fd0e['offset']+_0x58fd0e[_0x36af3a('0x29')],_0x5b9257;return _0x56c57e>=_0x4fcf00?(_0x56c57e=_0x4fcf00,_0x5b9257=0xc8):_0x5b9257=0xce,_0x2d5596['status'](_0x5b9257),_0x2d5596[_0x36af3a('0x52')]('Content-Range',_0x19dbe3+'-'+_0x56c57e+'/'+_0x4fcf00)[_0x36af3a('0x51')](_0x4ae7ab);}return null;};}function saveUpdates(_0x569429){return function(_0x1ac794){const _0x26c9ba=a281_0x8fa1;if(_0x1ac794)return _0x1ac794[_0x26c9ba('0x2d')](_0x569429)[_0x26c9ba('0x55')](function(_0x16c978){return _0x16c978;});return null;};}function removeEntity(_0x4316fa){return function(_0x4112c9){const _0x52aab2=a281_0x8fa1;if(_0x4112c9)return _0x4112c9[_0x52aab2('0x13')]()[_0x52aab2('0x55')](function(){const _0x54fb93=_0x52aab2;_0x4316fa['status'](0xcc)[_0x54fb93('0xa')]();});};}function handleEntityNotFound(_0x35a47c){return function(_0x88f230){const _0x300a14=a281_0x8fa1;return!_0x88f230&&_0x35a47c[_0x300a14('0x17')](0x194),_0x88f230;};}function handleError(_0x31aa2d,_0x27906c){return _0x27906c=_0x27906c||0x1f4,function(_0x3aa6ab){const _0x1c7e9c=a281_0x8fa1;logger['error'](_0x3aa6ab[_0x1c7e9c('0x4a')]),_0x3aa6ab[_0x1c7e9c('0x45')]&&delete _0x3aa6ab['name'],_0x31aa2d[_0x1c7e9c('0x5e')](_0x27906c)[_0x1c7e9c('0x49')](_0x3aa6ab);};}exports[_0x7aa29e('0x25')]=function(_0x3d0b92,_0x2f088b){const _0x3d6eeb=_0x7aa29e;let _0x52ed67={};const _0x21b6bf={},_0x10db18={'count':0x0,'rows':[]},_0x3c0c24=_[_0x3d6eeb('0x3a')](db[_0x3d6eeb('0x22')][_0x3d6eeb('0x1a')],function(_0x1c0d02){const _0x4ffbf5=_0x3d6eeb;return{'name':_0x1c0d02[_0x4ffbf5('0x2')],'type':_0x1c0d02[_0x4ffbf5('0x14')][_0x4ffbf5('0x27')]};});_0x21b6bf[_0x3d6eeb('0x3')]=_['map'](_0x3c0c24,_0x3d6eeb('0x45')),_0x21b6bf[_0x3d6eeb('0x42')]=_['keys'](_0x3d0b92[_0x3d6eeb('0x42')]),_0x21b6bf[_0x3d6eeb('0x53')]=_[_0x3d6eeb('0x5a')](_0x21b6bf[_0x3d6eeb('0x3')],_0x21b6bf[_0x3d6eeb('0x42')]),_0x52ed67['attributes']=_[_0x3d6eeb('0x5a')](_0x21b6bf[_0x3d6eeb('0x3')],qs['fields'](_0x3d0b92[_0x3d6eeb('0x42')][_0x3d6eeb('0x2f')])),_0x52ed67['attributes']=_0x52ed67[_0x3d6eeb('0x15')][_0x3d6eeb('0x56')]?_0x52ed67[_0x3d6eeb('0x15')]:_0x21b6bf['model'];typeof _0x3d0b92[_0x3d6eeb('0x42')][_0x3d6eeb('0x10')]===_0x3d6eeb('0x32')&&(_0x52ed67['limit']=qs[_0x3d6eeb('0x29')](_0x3d0b92['query'][_0x3d6eeb('0x29')]),_0x52ed67[_0x3d6eeb('0x3b')]=qs[_0x3d6eeb('0x3b')](_0x3d0b92[_0x3d6eeb('0x42')]['offset']));_0x52ed67['order']=qs[_0x3d6eeb('0x3f')](_0x3d0b92['query'][_0x3d6eeb('0x3f')]),_0x52ed67['where']=qs[_0x3d6eeb('0x53')](_['pick'](_0x3d0b92[_0x3d6eeb('0x42')],_0x21b6bf[_0x3d6eeb('0x53')]),_0x3c0c24);_0x3d0b92['query']['filter']&&(_0x52ed67['where']=_[_0x3d6eeb('0x3e')](_0x52ed67[_0x3d6eeb('0x5f')],{[Op['or']]:_[_0x3d6eeb('0x3a')](_0x3c0c24,function(_0x5696ae){const _0x4d50f1=_0x3d6eeb;if(_0x5696ae[_0x4d50f1('0x14')]!=='VIRTUAL'){const _0x9f3923={};return _0x9f3923[_0x5696ae[_0x4d50f1('0x45')]]={[Op[_0x4d50f1('0x30')]]:'%'+_0x3d0b92['query'][_0x4d50f1('0x2b')]+'%'},_0x9f3923;}})}));_0x52ed67=_[_0x3d6eeb('0x3e')]({},_0x52ed67,_0x3d0b92[_0x3d6eeb('0xd')]);const _0x5ec4c6={'where':_0x52ed67[_0x3d6eeb('0x5f')]};return db[_0x3d6eeb('0x22')][_0x3d6eeb('0x1d')](_0x5ec4c6)[_0x3d6eeb('0x55')](function(_0x431d2b){const _0x5a9923=_0x3d6eeb;return _0x10db18[_0x5a9923('0x1d')]=_0x431d2b,_0x3d0b92[_0x5a9923('0x42')][_0x5a9923('0x5b')]&&(_0x52ed67['include']=[{'all':!![]}]),db['SalesforceAccount'][_0x5a9923('0x59')](_0x52ed67);})['then'](function(_0x288348){return _0x10db18['rows']=_0x288348,_0x10db18;})['then'](respondWithFilteredResult(_0x2f088b,_0x52ed67))[_0x3d6eeb('0x50')](handleError(_0x2f088b,null));},exports[_0x7aa29e('0x6')]=function(_0x587c37,_0x4c2be5){const _0x68efed=_0x7aa29e;let _0x6a62db={'raw':![],'where':{'id':_0x587c37[_0x68efed('0x33')]['id']}};const _0x35a6ab={};return _0x35a6ab['model']=_['keys'](db[_0x68efed('0x22')][_0x68efed('0x1a')]),_0x35a6ab[_0x68efed('0x42')]=_['keys'](_0x587c37[_0x68efed('0x42')]),_0x35a6ab[_0x68efed('0x53')]=_[_0x68efed('0x5a')](_0x35a6ab[_0x68efed('0x3')],_0x35a6ab['query']),_0x6a62db[_0x68efed('0x15')]=_[_0x68efed('0x5a')](_0x35a6ab[_0x68efed('0x3')],qs[_0x68efed('0x2f')](_0x587c37['query']['fields'])),_0x6a62db[_0x68efed('0x15')]=_0x6a62db[_0x68efed('0x15')][_0x68efed('0x56')]?_0x6a62db[_0x68efed('0x15')]:_0x35a6ab[_0x68efed('0x3')],_0x587c37[_0x68efed('0x42')][_0x68efed('0x5b')]&&(_0x6a62db[_0x68efed('0x58')]=[{'all':!![]}]),_0x6a62db=_['merge']({},_0x6a62db,_0x587c37[_0x68efed('0xd')]),db['SalesforceAccount']['findOne'](_0x6a62db)[_0x68efed('0x55')](handleEntityNotFound(_0x4c2be5,null))['then'](respondWithResult(_0x4c2be5,null))[_0x68efed('0x50')](handleError(_0x4c2be5,null));},exports[_0x7aa29e('0x5d')]=function(_0x505428,_0x3539fd){const _0x2711cb=_0x7aa29e;return db[_0x2711cb('0x22')][_0x2711cb('0x5d')](_0x505428[_0x2711cb('0xc')],{})['then'](respondWithResult(_0x3539fd,0xc9))[_0x2711cb('0x50')](handleError(_0x3539fd,null));},exports['update']=function(_0x3a6985,_0x7b16e7){const _0x505e28=_0x7aa29e;return _0x3a6985[_0x505e28('0xc')]['id']&&delete _0x3a6985['body']['id'],db['SalesforceAccount'][_0x505e28('0xb')]({'where':{'id':_0x3a6985[_0x505e28('0x33')]['id']}})['then'](handleEntityNotFound(_0x7b16e7,null))[_0x505e28('0x55')](saveUpdates(_0x3a6985['body'],null))[_0x505e28('0x55')](respondWithResult(_0x7b16e7,null))['catch'](handleError(_0x7b16e7,null));},exports[_0x7aa29e('0x13')]=function(_0x3b1f6c,_0x989fe7){const _0x3e2316=_0x7aa29e;return db[_0x3e2316('0x22')][_0x3e2316('0xb')]({'where':{'id':_0x3b1f6c[_0x3e2316('0x33')]['id']}})['then'](handleEntityNotFound(_0x989fe7,null))['then'](removeEntity(_0x989fe7,null))['catch'](handleError(_0x989fe7,null));},exports[_0x7aa29e('0x5c')]=function(_0x52bfa9,_0x27b979){const _0x1fcb23=_0x7aa29e;let _0x1fb70a={};const _0x505c04={};let _0x534a7c,_0x72da54;return db[_0x1fcb23('0x22')][_0x1fcb23('0xb')]({'where':{'id':_0x52bfa9[_0x1fcb23('0x33')]['id']}})[_0x1fcb23('0x55')](handleEntityNotFound(_0x27b979,null))['then'](function(_0x39efed){const _0x215bc9=_0x1fcb23;if(_0x39efed)return _0x534a7c=_0x39efed,_0x505c04[_0x215bc9('0x3')]=_['keys'](db['SalesforceConfiguration'][_0x215bc9('0x1a')]),_0x505c04[_0x215bc9('0x42')]=_[_0x215bc9('0x40')](_0x52bfa9[_0x215bc9('0x42')]),_0x505c04[_0x215bc9('0x53')]=_[_0x215bc9('0x5a')](_0x505c04['model'],_0x505c04[_0x215bc9('0x42')]),_0x1fb70a['attributes']=_['intersection'](_0x505c04[_0x215bc9('0x3')],qs[_0x215bc9('0x2f')](_0x52bfa9['query'][_0x215bc9('0x2f')])),_0x1fb70a['attributes']=_0x1fb70a[_0x215bc9('0x15')]['length']?_0x1fb70a[_0x215bc9('0x15')]:_0x505c04['model'],_0x1fb70a[_0x215bc9('0x12')]=qs[_0x215bc9('0x3f')](_0x52bfa9['query'][_0x215bc9('0x3f')]),_0x1fb70a[_0x215bc9('0x5f')]=qs[_0x215bc9('0x53')](_['pick'](_0x52bfa9[_0x215bc9('0x42')],_0x505c04[_0x215bc9('0x53')])),_0x52bfa9[_0x215bc9('0x42')][_0x215bc9('0x2b')]&&(_0x1fb70a[_0x215bc9('0x5f')]=_[_0x215bc9('0x3e')](_0x1fb70a[_0x215bc9('0x5f')],{[Op['or']]:_[_0x215bc9('0x3a')](_0x1fb70a[_0x215bc9('0x15')],function(_0x48298e){const _0x3366e8=_0x215bc9,_0x4bd49a={};return _0x4bd49a[_0x48298e]={[Op[_0x3366e8('0x30')]]:'%'+_0x52bfa9[_0x3366e8('0x42')]['filter']+'%'},_0x4bd49a;})})),_0x1fb70a=_[_0x215bc9('0x3e')]({},_0x1fb70a,_0x52bfa9[_0x215bc9('0xd')]),_0x534a7c[_0x215bc9('0x5c')](_0x1fb70a);})['then'](function(_0x30a789){const _0x5f1ba0=_0x1fcb23;if(_0x30a789)return _0x72da54=_0x30a789['length'],typeof _0x52bfa9[_0x5f1ba0('0x42')]['nolimit']===_0x5f1ba0('0x32')&&(_0x1fb70a[_0x5f1ba0('0x29')]=qs['limit'](_0x52bfa9[_0x5f1ba0('0x42')][_0x5f1ba0('0x29')]),_0x1fb70a[_0x5f1ba0('0x3b')]=qs[_0x5f1ba0('0x3b')](_0x52bfa9['query'][_0x5f1ba0('0x3b')])),_0x534a7c[_0x5f1ba0('0x5c')](_0x1fb70a);})['then'](function(_0x31f82){if(_0x31f82)return _0x31f82?{'count':_0x72da54,'rows':_0x31f82}:null;})[_0x1fcb23('0x55')](respondWithResult(_0x27b979,null))[_0x1fcb23('0x50')](handleError(_0x27b979,null));},exports[_0x7aa29e('0x43')]=function(_0x4780a7,_0x598eb3){const _0x129591=_0x7aa29e;return _0x4780a7[_0x129591('0xc')]['id']&&delete _0x4780a7[_0x129591('0xc')]['id'],db['SalesforceAccount'][_0x129591('0xb')]({'where':{'id':_0x4780a7['params']['id']}})[_0x129591('0x55')](handleEntityNotFound(_0x598eb3,null))[_0x129591('0x55')](function(_0x4c766e){const _0x19b35a=_0x129591;if(_0x4c766e)return _0x4780a7[_0x19b35a('0xc')][_0x19b35a('0x11')]=_0x4c766e['id'],_0x4780a7[_0x19b35a('0xc')]['Subjects']=integrations[_0x19b35a('0x24')](_0x4780a7[_0x19b35a('0xc')][_0x19b35a('0x36')],_0x4780a7[_0x19b35a('0xc')]['type']),_0x4780a7[_0x19b35a('0xc')][_0x19b35a('0x23')]=integrations['getDescriptions'](_0x4780a7['body'][_0x19b35a('0x36')],_0x4780a7['body'][_0x19b35a('0x14')]),db['SalesforceConfiguration']['create'](_0x4780a7['body'],{'include':[{'model':db[_0x19b35a('0x57')],'as':_0x19b35a('0x4f')},{'model':db[_0x19b35a('0x57')],'as':'Descriptions'}]});return null;})[_0x129591('0x55')](respondWithResult(_0x598eb3,null))[_0x129591('0x50')](handleError(_0x598eb3,null));},exports[_0x7aa29e('0x62')]=function(_0x578b6e,_0x1a911e){const _0x2d0efd=_0x7aa29e;let _0x16407b,_0x1dd294='',_0x2ca498=_0x2d0efd('0xf');return db['SalesforceAccount'][_0x2d0efd('0xb')]({'where':{'id':_0x578b6e['params']['id']},'attributes':['id',_0x2d0efd('0x2c'),_0x2d0efd('0x35'),'clientSecret',_0x2d0efd('0x61'),_0x2d0efd('0x37'),_0x2d0efd('0x5')]})['then'](handleEntityNotFound(_0x1a911e,null))[_0x2d0efd('0x55')](function(_0x3f4489){const _0x2b7bce=_0x2d0efd;if(_0x3f4489){_0x1dd294=_0x3f4489[_0x2b7bce('0x2c')];const _0x3b4dc4=_0x1dd294[_0x2b7bce('0x0')](-0x1);return _0x3b4dc4==='/'&&(_0x1dd294=_0x1dd294[_0x2b7bce('0x7')](0x0,_0x1dd294[_0x2b7bce('0x3c')](_0x3b4dc4))),_0x16407b=new jsforce[(_0x2b7bce('0x41'))]({'oauth2':{'loginUrl':_0x1dd294,'clientId':_0x3f4489['clientId'],'clientSecret':_0x3f4489[_0x2b7bce('0x54')]}}),_0x16407b[_0x2b7bce('0x4d')](_0x3f4489[_0x2b7bce('0x61')],_0x3f4489[_0x2b7bce('0x37')][_0x2b7bce('0x26')](_0x3f4489[_0x2b7bce('0x5')]));}})[_0x2d0efd('0x55')](function(_0x2529b6){const _0x22279e=_0x2d0efd;if(_0x2529b6)return!_[_0x22279e('0x38')](_0x578b6e[_0x22279e('0x42')][_0x22279e('0x1f')])&&(_0x2ca498=_0x578b6e[_0x22279e('0x42')][_0x22279e('0x1f')]),_0x16407b[_0x22279e('0x4c')](_0x2ca498)[_0x22279e('0x1b')]();})['then'](function(_0x1a2e88){const _0x139870=_0x2d0efd;let _0x2c59cc=['CallDisposition',_0x139870('0x1e'),'CallObject',_0x139870('0x1'),_0x139870('0x39'),_0x139870('0x4e'),_0x139870('0x44'),_0x139870('0xe')];!_['isNil'](_0x578b6e[_0x139870('0x42')]['ticketType'])&&_0x578b6e['query']['ticketType']===_0x139870('0x63')&&(_0x2c59cc=[_0x139870('0xe'),'Origin',_0x139870('0x4'),_0x139870('0x44'),_0x139870('0x4e'),_0x139870('0x4b'),_0x139870('0x18'),_0x139870('0x48')]);if(_0x1a2e88)return _['remove'](_0x1a2e88[_0x139870('0x2f')],function(_0x2b29c9){const _0xd70247=_0x139870;return _0x2b29c9[_0xd70247('0x28')]===![]&&!_0x2c59cc['includes'](_0x2b29c9['name']);}),{'count':_0x1a2e88['fields'][_0x139870('0x56')],'rows':_[_0x139870('0x3a')](_0x1a2e88[_0x139870('0x2f')],function(_0x1e7df5){const _0x495a34=_0x139870;return{'id':_0x1e7df5[_0x495a34('0x45')],'name':_0x1e7df5[_0x495a34('0x34')],'custom':_0x1e7df5[_0x495a34('0x28')],'options':_0x1e7df5[_0x495a34('0x60')]['length']>0x0?_[_0x495a34('0x3a')](_0x1e7df5[_0x495a34('0x60')],function(_0x16876b){return{'name':_0x16876b['label'],'value':_0x16876b['value']};}):_0x1e7df5[_0x495a34('0x14')]==_0x495a34('0x21')?[{'name':_0x495a34('0x3d'),'value':_0x495a34('0x9')},{'name':_0x495a34('0x16'),'value':_0x495a34('0x2e')}]:[]};})};})[_0x2d0efd('0x55')](respondWithResult(_0x1a911e,null))[_0x2d0efd('0x50')](function(_0x4a8389){const _0x1b19ae=_0x2d0efd;let _0x18e3b6=_0x578b6e[_0x1b19ae('0x42')][_0x1b19ae('0x8')]?0x1f4:_0x4a8389[_0x1b19ae('0x2a')]||0x1f4;logger['error'](_0x1b19ae('0x19'),_0x1b19ae('0x62'),_0x18e3b6,JSON[_0x1b19ae('0x47')](_0x4a8389)),delete _0x4a8389[_0x1b19ae('0x45')],_0x18e3b6===0x191&&(_0x18e3b6=0x190),_0x1a911e[_0x1b19ae('0x5e')](_0x18e3b6)[_0x1b19ae('0x49')](_0x578b6e['query'][_0x1b19ae('0x8')]?{'message':_0x1b19ae('0x1c'),'statusCode':_0x4a8389['statusCode']}:_0x4a8389);});};
\ No newline at end of file
+const a281_0x16a3=['includes','send','Status','limit','true','getDescriptions','fieldName','picklistValues','then','lastIndexOf','remove','channel','stringify','securityToken','IsEscalated','value','pick','False','rows','username','name','keys','lodash','IsArchived','merge','error','false','label','SalesforceConfiguration','nolimit','map','where','show','model','type','findOne','SalesforceField','SalesforceAccount','Case','remoteUri','attributes','boolean','stack','custom','offset','status','Priority','slice','body','undefined','params','sort','addConfiguration','destroy','test','VIRTUAL','statusCode','clientId','include','SuppliedName','CallDurationInSeconds','ticketType','getFields,\x20%s,\x20%s,\x20%s','intersection','sobject','isNil','Origin','length','../../components/integrations/configuration','password','end','substring','getConfigurations','True','query','Subjects','catch','options','includeAll','fields','../../components/parsers/qs','findAll','concat','CallDisposition','count','create','login','Type','rawAttributes','filter','filters','index','jsforce','getFields','Descriptions','json'];(function(_0x215965,_0x16a3e7){const _0x7c4b2f=function(_0x28375b){while(--_0x28375b){_0x215965['push'](_0x215965['shift']());}};_0x7c4b2f(++_0x16a3e7);}(a281_0x16a3,0x109));const a281_0x7c4b=function(_0x215965,_0x16a3e7){_0x215965=_0x215965-0x0;let _0x7c4b2f=a281_0x16a3[_0x215965];return _0x7c4b2f;};const _0x3b846d=a281_0x7c4b;'use strict';const _=require(_0x3b846d('0x2d')),jsforce=require(_0x3b846d('0x13')),qs=require(_0x3b846d('0x7')),logger=require('../../config/logger')('api'),db=require('../../mysqldb')['db'],{Op}=require('sequelize'),integrations=require(_0x3b846d('0x5b'));function respondWithResult(_0x28375b,_0x4650fe){return _0x4650fe=_0x4650fe||0xc8,function(_0x29939c){const _0x272c2=a281_0x7c4b;if(_0x29939c)return _0x28375b[_0x272c2('0x44')](_0x4650fe)[_0x272c2('0x16')](_0x29939c);};}function respondWithFilteredResult(_0x487736,_0x18b0a2){return function(_0x1e2982){const _0x32b813=a281_0x7c4b;if(_0x1e2982){const _0x4f72a7=_0x1e2982['count'],_0x25adfb=_0x18b0a2['offset'];let _0x1be6b8=_0x18b0a2[_0x32b813('0x43')]+_0x18b0a2[_0x32b813('0x1a')],_0x219ac6;return _0x1be6b8>=_0x4f72a7?(_0x1be6b8=_0x4f72a7,_0x219ac6=0xc8):_0x219ac6=0xce,_0x487736[_0x32b813('0x44')](_0x219ac6),_0x487736['set']('Content-Range',_0x25adfb+'-'+_0x1be6b8+'/'+_0x4f72a7)[_0x32b813('0x16')](_0x1e2982);}return null;};}function saveUpdates(_0x3ba3b0){return function(_0x5b2278){const _0xc8a0d9=a281_0x7c4b;if(_0x5b2278)return _0x5b2278['update'](_0x3ba3b0)[_0xc8a0d9('0x1f')](function(_0x5e8716){return _0x5e8716;});return null;};}function removeEntity(_0x578bbc){return function(_0xb17926){const _0x13af9e=a281_0x7c4b;if(_0xb17926)return _0xb17926[_0x13af9e('0x4c')]()[_0x13af9e('0x1f')](function(){const _0x4b7fa3=_0x13af9e;_0x578bbc[_0x4b7fa3('0x44')](0xcc)[_0x4b7fa3('0x5d')]();});};}function handleEntityNotFound(_0x211b06){return function(_0x319a66){return!_0x319a66&&_0x211b06['sendStatus'](0x194),_0x319a66;};}function handleError(_0x2636e6,_0x52dab8){return _0x52dab8=_0x52dab8||0x1f4,function(_0x427d3d){const _0xf07d54=a281_0x7c4b;logger[_0xf07d54('0x30')](_0x427d3d[_0xf07d54('0x41')]),_0x427d3d[_0xf07d54('0x2b')]&&delete _0x427d3d[_0xf07d54('0x2b')],_0x2636e6[_0xf07d54('0x44')](_0x52dab8)[_0xf07d54('0x18')](_0x427d3d);};}exports[_0x3b846d('0x12')]=function(_0x4cabe8,_0x5a128d){const _0x9259ba=_0x3b846d;let _0x23a469={};const _0x2307a6={},_0x3679ed={'count':0x0,'rows':[]},_0x2727a6=_[_0x9259ba('0x35')](db[_0x9259ba('0x3c')][_0x9259ba('0xf')],function(_0x34d185){const _0x34a7be=_0x9259ba;return{'name':_0x34d185[_0x34a7be('0x1d')],'type':_0x34d185['type']['key']};});_0x2307a6[_0x9259ba('0x38')]=_[_0x9259ba('0x35')](_0x2727a6,'name'),_0x2307a6[_0x9259ba('0x1')]=_['keys'](_0x4cabe8[_0x9259ba('0x1')]),_0x2307a6[_0x9259ba('0x11')]=_[_0x9259ba('0x56')](_0x2307a6['model'],_0x2307a6[_0x9259ba('0x1')]),_0x23a469[_0x9259ba('0x3f')]=_['intersection'](_0x2307a6[_0x9259ba('0x38')],qs[_0x9259ba('0x6')](_0x4cabe8[_0x9259ba('0x1')][_0x9259ba('0x6')])),_0x23a469[_0x9259ba('0x3f')]=_0x23a469['attributes'][_0x9259ba('0x5a')]?_0x23a469[_0x9259ba('0x3f')]:_0x2307a6['model'];typeof _0x4cabe8[_0x9259ba('0x1')][_0x9259ba('0x34')]===_0x9259ba('0x48')&&(_0x23a469[_0x9259ba('0x1a')]=qs[_0x9259ba('0x1a')](_0x4cabe8['query']['limit']),_0x23a469['offset']=qs[_0x9259ba('0x43')](_0x4cabe8['query']['offset']));_0x23a469['order']=qs[_0x9259ba('0x4a')](_0x4cabe8[_0x9259ba('0x1')]['sort']),_0x23a469[_0x9259ba('0x36')]=qs[_0x9259ba('0x11')](_['pick'](_0x4cabe8[_0x9259ba('0x1')],_0x2307a6['filters']),_0x2727a6);_0x4cabe8[_0x9259ba('0x1')]['filter']&&(_0x23a469['where']=_['merge'](_0x23a469[_0x9259ba('0x36')],{[Op['or']]:_[_0x9259ba('0x35')](_0x2727a6,function(_0x1eb4a4){const _0xa3b3b9=_0x9259ba;if(_0x1eb4a4[_0xa3b3b9('0x39')]!==_0xa3b3b9('0x4e')){const _0x38a577={};return _0x38a577[_0x1eb4a4[_0xa3b3b9('0x2b')]]={[Op['like']]:'%'+_0x4cabe8['query'][_0xa3b3b9('0x10')]+'%'},_0x38a577;}})}));_0x23a469=_['merge']({},_0x23a469,_0x4cabe8[_0x9259ba('0x4')]);const _0x1262b9={'where':_0x23a469['where']};return db[_0x9259ba('0x3c')][_0x9259ba('0xb')](_0x1262b9)[_0x9259ba('0x1f')](function(_0x190dbf){const _0x1a1c6b=_0x9259ba;return _0x3679ed[_0x1a1c6b('0xb')]=_0x190dbf,_0x4cabe8[_0x1a1c6b('0x1')][_0x1a1c6b('0x5')]&&(_0x23a469[_0x1a1c6b('0x51')]=[{'all':!![]}]),db[_0x1a1c6b('0x3c')][_0x1a1c6b('0x8')](_0x23a469);})['then'](function(_0x138a09){const _0xe0018c=_0x9259ba;return _0x3679ed[_0xe0018c('0x29')]=_0x138a09,_0x3679ed;})['then'](respondWithFilteredResult(_0x5a128d,_0x23a469))[_0x9259ba('0x3')](handleError(_0x5a128d,null));},exports[_0x3b846d('0x37')]=function(_0x22fe2a,_0x294e43){const _0x52db74=_0x3b846d;let _0x7c3ac7={'raw':![],'where':{'id':_0x22fe2a['params']['id']}};const _0x31e000={};return _0x31e000[_0x52db74('0x38')]=_[_0x52db74('0x2c')](db['SalesforceAccount']['rawAttributes']),_0x31e000['query']=_[_0x52db74('0x2c')](_0x22fe2a[_0x52db74('0x1')]),_0x31e000['filters']=_[_0x52db74('0x56')](_0x31e000[_0x52db74('0x38')],_0x31e000[_0x52db74('0x1')]),_0x7c3ac7[_0x52db74('0x3f')]=_['intersection'](_0x31e000[_0x52db74('0x38')],qs[_0x52db74('0x6')](_0x22fe2a[_0x52db74('0x1')][_0x52db74('0x6')])),_0x7c3ac7[_0x52db74('0x3f')]=_0x7c3ac7[_0x52db74('0x3f')]['length']?_0x7c3ac7['attributes']:_0x31e000[_0x52db74('0x38')],_0x22fe2a[_0x52db74('0x1')][_0x52db74('0x5')]&&(_0x7c3ac7[_0x52db74('0x51')]=[{'all':!![]}]),_0x7c3ac7=_[_0x52db74('0x2f')]({},_0x7c3ac7,_0x22fe2a[_0x52db74('0x4')]),db[_0x52db74('0x3c')][_0x52db74('0x3a')](_0x7c3ac7)[_0x52db74('0x1f')](handleEntityNotFound(_0x294e43,null))[_0x52db74('0x1f')](respondWithResult(_0x294e43,null))[_0x52db74('0x3')](handleError(_0x294e43,null));},exports['create']=function(_0x4d07c4,_0x35a653){const _0x4a5292=_0x3b846d;return db[_0x4a5292('0x3c')]['create'](_0x4d07c4[_0x4a5292('0x47')],{})[_0x4a5292('0x1f')](respondWithResult(_0x35a653,0xc9))[_0x4a5292('0x3')](handleError(_0x35a653,null));},exports['update']=function(_0x51addb,_0x117e1d){const _0xdcbb94=_0x3b846d;return _0x51addb['body']['id']&&delete _0x51addb[_0xdcbb94('0x47')]['id'],db[_0xdcbb94('0x3c')][_0xdcbb94('0x3a')]({'where':{'id':_0x51addb['params']['id']}})[_0xdcbb94('0x1f')](handleEntityNotFound(_0x117e1d,null))['then'](saveUpdates(_0x51addb[_0xdcbb94('0x47')],null))[_0xdcbb94('0x1f')](respondWithResult(_0x117e1d,null))[_0xdcbb94('0x3')](handleError(_0x117e1d,null));},exports[_0x3b846d('0x4c')]=function(_0x197c4c,_0x2e2324){const _0x287423=_0x3b846d;return db[_0x287423('0x3c')][_0x287423('0x3a')]({'where':{'id':_0x197c4c[_0x287423('0x49')]['id']}})[_0x287423('0x1f')](handleEntityNotFound(_0x2e2324,null))[_0x287423('0x1f')](removeEntity(_0x2e2324,null))['catch'](handleError(_0x2e2324,null));},exports[_0x3b846d('0x5f')]=function(_0x52af57,_0x3c3d06){const _0x153553=_0x3b846d;let _0x2bc344={};const _0x59ff9c={};let _0x403999,_0x240cef;return db[_0x153553('0x3c')][_0x153553('0x3a')]({'where':{'id':_0x52af57[_0x153553('0x49')]['id']}})[_0x153553('0x1f')](handleEntityNotFound(_0x3c3d06,null))[_0x153553('0x1f')](function(_0x2463dd){const _0x4638dc=_0x153553;if(_0x2463dd)return _0x403999=_0x2463dd,_0x59ff9c['model']=_[_0x4638dc('0x2c')](db[_0x4638dc('0x33')][_0x4638dc('0xf')]),_0x59ff9c[_0x4638dc('0x1')]=_['keys'](_0x52af57[_0x4638dc('0x1')]),_0x59ff9c[_0x4638dc('0x11')]=_[_0x4638dc('0x56')](_0x59ff9c['model'],_0x59ff9c['query']),_0x2bc344['attributes']=_['intersection'](_0x59ff9c[_0x4638dc('0x38')],qs[_0x4638dc('0x6')](_0x52af57['query']['fields'])),_0x2bc344['attributes']=_0x2bc344[_0x4638dc('0x3f')]['length']?_0x2bc344[_0x4638dc('0x3f')]:_0x59ff9c['model'],_0x2bc344['order']=qs['sort'](_0x52af57[_0x4638dc('0x1')]['sort']),_0x2bc344['where']=qs[_0x4638dc('0x11')](_[_0x4638dc('0x27')](_0x52af57[_0x4638dc('0x1')],_0x59ff9c[_0x4638dc('0x11')])),_0x52af57['query'][_0x4638dc('0x10')]&&(_0x2bc344[_0x4638dc('0x36')]=_[_0x4638dc('0x2f')](_0x2bc344[_0x4638dc('0x36')],{[Op['or']]:_['map'](_0x2bc344[_0x4638dc('0x3f')],function(_0x8fa8a8){const _0x5e2060=_0x4638dc,_0xdd33b5={};return _0xdd33b5[_0x8fa8a8]={[Op['like']]:'%'+_0x52af57[_0x5e2060('0x1')][_0x5e2060('0x10')]+'%'},_0xdd33b5;})})),_0x2bc344=_[_0x4638dc('0x2f')]({},_0x2bc344,_0x52af57['options']),_0x403999['getConfigurations'](_0x2bc344);})[_0x153553('0x1f')](function(_0x3c59cc){const _0x175518=_0x153553;if(_0x3c59cc)return _0x240cef=_0x3c59cc[_0x175518('0x5a')],typeof _0x52af57['query'][_0x175518('0x34')]===_0x175518('0x48')&&(_0x2bc344['limit']=qs[_0x175518('0x1a')](_0x52af57[_0x175518('0x1')][_0x175518('0x1a')]),_0x2bc344[_0x175518('0x43')]=qs['offset'](_0x52af57[_0x175518('0x1')][_0x175518('0x43')])),_0x403999[_0x175518('0x5f')](_0x2bc344);})[_0x153553('0x1f')](function(_0x494ce9){if(_0x494ce9)return _0x494ce9?{'count':_0x240cef,'rows':_0x494ce9}:null;})[_0x153553('0x1f')](respondWithResult(_0x3c3d06,null))[_0x153553('0x3')](handleError(_0x3c3d06,null));},exports[_0x3b846d('0x4b')]=function(_0x57718f,_0x1b7c85){const _0x2ebb7c=_0x3b846d;return _0x57718f[_0x2ebb7c('0x47')]['id']&&delete _0x57718f['body']['id'],db['SalesforceAccount']['findOne']({'where':{'id':_0x57718f[_0x2ebb7c('0x49')]['id']}})[_0x2ebb7c('0x1f')](handleEntityNotFound(_0x1b7c85,null))[_0x2ebb7c('0x1f')](function(_0x2f683e){const _0x64012a=_0x2ebb7c;if(_0x2f683e)return _0x57718f['body']['AccountId']=_0x2f683e['id'],_0x57718f[_0x64012a('0x47')]['Subjects']=integrations['getSubjects'](_0x57718f['body'][_0x64012a('0x22')],_0x57718f[_0x64012a('0x47')]['type']),_0x57718f[_0x64012a('0x47')][_0x64012a('0x15')]=integrations[_0x64012a('0x1c')](_0x57718f[_0x64012a('0x47')]['channel'],_0x57718f['body'][_0x64012a('0x39')]),db['SalesforceConfiguration'][_0x64012a('0xc')](_0x57718f[_0x64012a('0x47')],{'include':[{'model':db[_0x64012a('0x3b')],'as':_0x64012a('0x2')},{'model':db[_0x64012a('0x3b')],'as':_0x64012a('0x15')}]});return null;})['then'](respondWithResult(_0x1b7c85,null))[_0x2ebb7c('0x3')](handleError(_0x1b7c85,null));},exports['getFields']=function(_0x561732,_0x5c6c00){const _0x16369a=_0x3b846d;let _0x31199e,_0xc8411c='',_0x31db25='Task';return db[_0x16369a('0x3c')][_0x16369a('0x3a')]({'where':{'id':_0x561732[_0x16369a('0x49')]['id']},'attributes':['id',_0x16369a('0x3e'),_0x16369a('0x50'),'clientSecret',_0x16369a('0x2a'),_0x16369a('0x5c'),'securityToken']})[_0x16369a('0x1f')](handleEntityNotFound(_0x5c6c00,null))[_0x16369a('0x1f')](function(_0x19eda5){const _0x5dbdfe=_0x16369a;if(_0x19eda5){_0xc8411c=_0x19eda5[_0x5dbdfe('0x3e')];const _0x28075c=_0xc8411c[_0x5dbdfe('0x46')](-0x1);return _0x28075c==='/'&&(_0xc8411c=_0xc8411c[_0x5dbdfe('0x5e')](0x0,_0xc8411c[_0x5dbdfe('0x20')](_0x28075c))),_0x31199e=new jsforce['Connection']({'oauth2':{'loginUrl':_0xc8411c,'clientId':_0x19eda5['clientId'],'clientSecret':_0x19eda5['clientSecret']}}),_0x31199e[_0x5dbdfe('0xd')](_0x19eda5[_0x5dbdfe('0x2a')],_0x19eda5['password'][_0x5dbdfe('0x9')](_0x19eda5[_0x5dbdfe('0x24')]));}})[_0x16369a('0x1f')](function(_0x584d76){const _0xa60758=_0x16369a;if(_0x584d76)return!_[_0xa60758('0x58')](_0x561732[_0xa60758('0x1')][_0xa60758('0x54')])&&(_0x31db25=_0x561732[_0xa60758('0x1')][_0xa60758('0x54')]),_0x31199e[_0xa60758('0x57')](_0x31db25)['describe']();})[_0x16369a('0x1f')](function(_0x10c514){const _0x2dc2c3=_0x16369a;let _0xb62501=[_0x2dc2c3('0xa'),_0x2dc2c3('0x53'),'CallObject','CallType',_0x2dc2c3('0x2e'),'Priority',_0x2dc2c3('0x19'),'Type'];!_[_0x2dc2c3('0x58')](_0x561732[_0x2dc2c3('0x1')][_0x2dc2c3('0x54')])&&_0x561732[_0x2dc2c3('0x1')][_0x2dc2c3('0x54')]===_0x2dc2c3('0x3d')&&(_0xb62501=[_0x2dc2c3('0xe'),_0x2dc2c3('0x59'),'Reason',_0x2dc2c3('0x19'),_0x2dc2c3('0x45'),_0x2dc2c3('0x25'),_0x2dc2c3('0x52'),'SuppliedCompany']);if(_0x10c514)return _[_0x2dc2c3('0x21')](_0x10c514[_0x2dc2c3('0x6')],function(_0x3dc969){const _0x47e362=_0x2dc2c3;return _0x3dc969[_0x47e362('0x42')]===![]&&!_0xb62501[_0x47e362('0x17')](_0x3dc969['name']);}),{'count':_0x10c514[_0x2dc2c3('0x6')][_0x2dc2c3('0x5a')],'rows':_[_0x2dc2c3('0x35')](_0x10c514[_0x2dc2c3('0x6')],function(_0x35e44d){const _0x1eb6ef=_0x2dc2c3;return{'id':_0x35e44d['name'],'name':_0x35e44d[_0x1eb6ef('0x32')],'custom':_0x35e44d[_0x1eb6ef('0x42')],'options':_0x35e44d[_0x1eb6ef('0x1e')][_0x1eb6ef('0x5a')]>0x0?_[_0x1eb6ef('0x35')](_0x35e44d[_0x1eb6ef('0x1e')],function(_0x10df2a){const _0x21747d=_0x1eb6ef;return{'name':_0x10df2a[_0x21747d('0x32')],'value':_0x10df2a[_0x21747d('0x26')]};}):_0x35e44d[_0x1eb6ef('0x39')]==_0x1eb6ef('0x40')?[{'name':_0x1eb6ef('0x0'),'value':_0x1eb6ef('0x1b')},{'name':_0x1eb6ef('0x28'),'value':_0x1eb6ef('0x31')}]:[]};})};})[_0x16369a('0x1f')](respondWithResult(_0x5c6c00,null))[_0x16369a('0x3')](function(_0x242361){const _0x3ffe32=_0x16369a;let _0x528b78=_0x561732[_0x3ffe32('0x1')][_0x3ffe32('0x4d')]?0x1f4:_0x242361[_0x3ffe32('0x4f')]||0x1f4;logger[_0x3ffe32('0x30')](_0x3ffe32('0x55'),_0x3ffe32('0x14'),_0x528b78,JSON[_0x3ffe32('0x23')](_0x242361)),delete _0x242361[_0x3ffe32('0x2b')],_0x528b78===0x191&&(_0x528b78=0x190),_0x5c6c00[_0x3ffe32('0x44')](_0x528b78)['send'](_0x561732[_0x3ffe32('0x1')][_0x3ffe32('0x4d')]?{'message':'Wrong\x20credentials','statusCode':_0x242361['statusCode']}:_0x242361);});};
\ No newline at end of file