Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / intSalesforceAccount / intSalesforceAccount.controller.js
index 6fcdb27..06d5d04 100644 (file)
@@ -1 +1 @@
-const a281_0x4ecc=['count','keys','lastIndexOf','addConfiguration','value','../../config/logger','Connection','includes','offset','test','sort','getFields,\x20%s,\x20%s,\x20%s','update','label','nolimit','Reason','stringify','isNil','intersection','params','api','attributes','clientSecret','statusCode','IsEscalated','end','options','SalesforceAccount','describe','CallType','channel','rows','getDescriptions','SuppliedName','map','custom','destroy','body','../../components/parsers/qs','show','name','order','lodash','getConfigurations','SalesforceConfiguration','send','SalesforceField','sendStatus','password','Wrong\x20credentials','SuppliedCompany','limit','include','error','json','key','remove','ticketType','boolean','rawAttributes','like','Content-Range','length','findOne','filters','getFields','sequelize','Status','then','includeAll','AccountId','getSubjects','create','pick','undefined','Priority','status','../../mysqldb','catch','fields','type','VIRTUAL','Descriptions','username','sobject','slice','stack','where','Subjects','securityToken','index','picklistValues','concat','clientId','substring','query','filter','True','findAll','model','set','merge','Origin','remoteUri'];(function(_0x5e96f7,_0x4eccf9){const _0x5ad1fc=function(_0x85507a){while(--_0x85507a){_0x5e96f7['push'](_0x5e96f7['shift']());}};_0x5ad1fc(++_0x4eccf9);}(a281_0x4ecc,0x168));const a281_0x5ad1=function(_0x5e96f7,_0x4eccf9){_0x5e96f7=_0x5e96f7-0x0;let _0x5ad1fc=a281_0x4ecc[_0x5e96f7];return _0x5ad1fc;};const _0x480bbd=a281_0x5ad1;'use strict';const _=require(_0x480bbd('0x62')),jsforce=require('jsforce'),qs=require(_0x480bbd('0x5e')),logger=require(_0x480bbd('0x3d'))(_0x480bbd('0x4c')),db=require(_0x480bbd('0x1d'))['db'],{Op}=require(_0x480bbd('0x12')),integrations=require('../../components/integrations/configuration');function respondWithResult(_0x85507a,_0x952edb){return _0x952edb=_0x952edb||0xc8,function(_0x29a670){const _0x2349d7=a281_0x5ad1;if(_0x29a670)return _0x85507a[_0x2349d7('0x1c')](_0x952edb)[_0x2349d7('0x6')](_0x29a670);};}function respondWithFilteredResult(_0x16bfaf,_0x21381b){return function(_0x11cc4b){const _0x3e3610=a281_0x5ad1;if(_0x11cc4b){const _0x3003c2=_0x11cc4b[_0x3e3610('0x38')],_0xbf6664=_0x21381b[_0x3e3610('0x40')];let _0x263b5d=_0x21381b['offset']+_0x21381b[_0x3e3610('0x3')],_0x2eec22;return _0x263b5d>=_0x3003c2?(_0x263b5d=_0x3003c2,_0x2eec22=0xc8):_0x2eec22=0xce,_0x16bfaf[_0x3e3610('0x1c')](_0x2eec22),_0x16bfaf[_0x3e3610('0x34')](_0x3e3610('0xd'),_0xbf6664+'-'+_0x263b5d+'/'+_0x3003c2)['json'](_0x11cc4b);}return null;};}function saveUpdates(_0xecd45d){return function(_0x3f5017){const _0x13ebb2=a281_0x5ad1;if(_0x3f5017)return _0x3f5017[_0x13ebb2('0x44')](_0xecd45d)['then'](function(_0x199c41){return _0x199c41;});return null;};}function removeEntity(_0x18d48e){return function(_0x5a5b82){const _0x5514b2=a281_0x5ad1;if(_0x5a5b82)return _0x5a5b82[_0x5514b2('0x5c')]()['then'](function(){const _0x2bf3a2=_0x5514b2;_0x18d48e[_0x2bf3a2('0x1c')](0xcc)[_0x2bf3a2('0x51')]();});};}function handleEntityNotFound(_0x24f157){return function(_0x5b57bb){const _0x15bc24=a281_0x5ad1;return!_0x5b57bb&&_0x24f157[_0x15bc24('0x67')](0x194),_0x5b57bb;};}function handleError(_0x32eeeb,_0x466801){return _0x466801=_0x466801||0x1f4,function(_0x46d199){const _0x4bfc32=a281_0x5ad1;logger[_0x4bfc32('0x5')](_0x46d199[_0x4bfc32('0x26')]),_0x46d199[_0x4bfc32('0x60')]&&delete _0x46d199[_0x4bfc32('0x60')],_0x32eeeb[_0x4bfc32('0x1c')](_0x466801)[_0x4bfc32('0x65')](_0x46d199);};}exports[_0x480bbd('0x2a')]=function(_0x33e31c,_0x284221){const _0x2d1d98=_0x480bbd;let _0x2a1188={};const _0x3a3316={},_0x424305={'count':0x0,'rows':[]},_0x2725bf=_['map'](db[_0x2d1d98('0x53')][_0x2d1d98('0xb')],function(_0x556713){const _0x4d12dc=_0x2d1d98;return{'name':_0x556713['fieldName'],'type':_0x556713[_0x4d12dc('0x20')][_0x4d12dc('0x7')]};});_0x3a3316[_0x2d1d98('0x33')]=_[_0x2d1d98('0x5a')](_0x2725bf,_0x2d1d98('0x60')),_0x3a3316['query']=_[_0x2d1d98('0x39')](_0x33e31c['query']),_0x3a3316[_0x2d1d98('0x10')]=_['intersection'](_0x3a3316[_0x2d1d98('0x33')],_0x3a3316[_0x2d1d98('0x2f')]),_0x2a1188[_0x2d1d98('0x4d')]=_['intersection'](_0x3a3316[_0x2d1d98('0x33')],qs[_0x2d1d98('0x1f')](_0x33e31c['query']['fields'])),_0x2a1188[_0x2d1d98('0x4d')]=_0x2a1188[_0x2d1d98('0x4d')][_0x2d1d98('0xe')]?_0x2a1188[_0x2d1d98('0x4d')]:_0x3a3316[_0x2d1d98('0x33')];typeof _0x33e31c['query'][_0x2d1d98('0x46')]==='undefined'&&(_0x2a1188[_0x2d1d98('0x3')]=qs[_0x2d1d98('0x3')](_0x33e31c['query'][_0x2d1d98('0x3')]),_0x2a1188[_0x2d1d98('0x40')]=qs[_0x2d1d98('0x40')](_0x33e31c['query'][_0x2d1d98('0x40')]));_0x2a1188[_0x2d1d98('0x61')]=qs[_0x2d1d98('0x42')](_0x33e31c[_0x2d1d98('0x2f')][_0x2d1d98('0x42')]),_0x2a1188[_0x2d1d98('0x27')]=qs[_0x2d1d98('0x10')](_[_0x2d1d98('0x19')](_0x33e31c['query'],_0x3a3316['filters']),_0x2725bf);_0x33e31c[_0x2d1d98('0x2f')][_0x2d1d98('0x30')]&&(_0x2a1188['where']=_[_0x2d1d98('0x35')](_0x2a1188['where'],{[Op['or']]:_[_0x2d1d98('0x5a')](_0x2725bf,function(_0x2ce9d6){const _0x3af628=_0x2d1d98;if(_0x2ce9d6[_0x3af628('0x20')]!==_0x3af628('0x21')){const _0x146959={};return _0x146959[_0x2ce9d6[_0x3af628('0x60')]]={[Op[_0x3af628('0xc')]]:'%'+_0x33e31c['query'][_0x3af628('0x30')]+'%'},_0x146959;}})}));_0x2a1188=_[_0x2d1d98('0x35')]({},_0x2a1188,_0x33e31c[_0x2d1d98('0x52')]);const _0x463331={'where':_0x2a1188[_0x2d1d98('0x27')]};return db[_0x2d1d98('0x53')]['count'](_0x463331)['then'](function(_0x4677e6){const _0xa095dc=_0x2d1d98;return _0x424305[_0xa095dc('0x38')]=_0x4677e6,_0x33e31c['query'][_0xa095dc('0x15')]&&(_0x2a1188[_0xa095dc('0x4')]=[{'all':!![]}]),db[_0xa095dc('0x53')][_0xa095dc('0x32')](_0x2a1188);})[_0x2d1d98('0x14')](function(_0x1c2e8c){const _0xa17ad6=_0x2d1d98;return _0x424305[_0xa17ad6('0x57')]=_0x1c2e8c,_0x424305;})[_0x2d1d98('0x14')](respondWithFilteredResult(_0x284221,_0x2a1188))[_0x2d1d98('0x1e')](handleError(_0x284221,null));},exports[_0x480bbd('0x5f')]=function(_0xdbe3e6,_0x37c19f){const _0x3fc85e=_0x480bbd;let _0x192fd1={'raw':![],'where':{'id':_0xdbe3e6[_0x3fc85e('0x4b')]['id']}};const _0x4c9804={};return _0x4c9804[_0x3fc85e('0x33')]=_[_0x3fc85e('0x39')](db[_0x3fc85e('0x53')]['rawAttributes']),_0x4c9804[_0x3fc85e('0x2f')]=_[_0x3fc85e('0x39')](_0xdbe3e6['query']),_0x4c9804[_0x3fc85e('0x10')]=_[_0x3fc85e('0x4a')](_0x4c9804[_0x3fc85e('0x33')],_0x4c9804[_0x3fc85e('0x2f')]),_0x192fd1[_0x3fc85e('0x4d')]=_['intersection'](_0x4c9804[_0x3fc85e('0x33')],qs[_0x3fc85e('0x1f')](_0xdbe3e6[_0x3fc85e('0x2f')]['fields'])),_0x192fd1[_0x3fc85e('0x4d')]=_0x192fd1[_0x3fc85e('0x4d')]['length']?_0x192fd1[_0x3fc85e('0x4d')]:_0x4c9804[_0x3fc85e('0x33')],_0xdbe3e6[_0x3fc85e('0x2f')][_0x3fc85e('0x15')]&&(_0x192fd1[_0x3fc85e('0x4')]=[{'all':!![]}]),_0x192fd1=_[_0x3fc85e('0x35')]({},_0x192fd1,_0xdbe3e6[_0x3fc85e('0x52')]),db['SalesforceAccount'][_0x3fc85e('0xf')](_0x192fd1)[_0x3fc85e('0x14')](handleEntityNotFound(_0x37c19f,null))['then'](respondWithResult(_0x37c19f,null))['catch'](handleError(_0x37c19f,null));},exports[_0x480bbd('0x18')]=function(_0x50885e,_0x224a56){const _0x5b68fb=_0x480bbd;return db[_0x5b68fb('0x53')][_0x5b68fb('0x18')](_0x50885e['body'],{})[_0x5b68fb('0x14')](respondWithResult(_0x224a56,0xc9))['catch'](handleError(_0x224a56,null));},exports['update']=function(_0x2764f2,_0x195c02){const _0x4d2057=_0x480bbd;return _0x2764f2[_0x4d2057('0x5d')]['id']&&delete _0x2764f2[_0x4d2057('0x5d')]['id'],db['SalesforceAccount']['findOne']({'where':{'id':_0x2764f2[_0x4d2057('0x4b')]['id']}})[_0x4d2057('0x14')](handleEntityNotFound(_0x195c02,null))[_0x4d2057('0x14')](saveUpdates(_0x2764f2[_0x4d2057('0x5d')],null))[_0x4d2057('0x14')](respondWithResult(_0x195c02,null))['catch'](handleError(_0x195c02,null));},exports['destroy']=function(_0x180831,_0x1019d4){const _0x3fff3f=_0x480bbd;return db[_0x3fff3f('0x53')]['findOne']({'where':{'id':_0x180831[_0x3fff3f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1019d4,null))[_0x3fff3f('0x14')](removeEntity(_0x1019d4,null))['catch'](handleError(_0x1019d4,null));},exports[_0x480bbd('0x63')]=function(_0x1f54e8,_0x3fe2a1){const _0x31dbfe=_0x480bbd;let _0x3ab646={};const _0x74e6ea={};let _0x57fbae,_0x39168a;return db[_0x31dbfe('0x53')][_0x31dbfe('0xf')]({'where':{'id':_0x1f54e8[_0x31dbfe('0x4b')]['id']}})[_0x31dbfe('0x14')](handleEntityNotFound(_0x3fe2a1,null))[_0x31dbfe('0x14')](function(_0x142d98){const _0x2bf741=_0x31dbfe;if(_0x142d98)return _0x57fbae=_0x142d98,_0x74e6ea[_0x2bf741('0x33')]=_[_0x2bf741('0x39')](db[_0x2bf741('0x64')][_0x2bf741('0xb')]),_0x74e6ea[_0x2bf741('0x2f')]=_[_0x2bf741('0x39')](_0x1f54e8[_0x2bf741('0x2f')]),_0x74e6ea[_0x2bf741('0x10')]=_[_0x2bf741('0x4a')](_0x74e6ea[_0x2bf741('0x33')],_0x74e6ea[_0x2bf741('0x2f')]),_0x3ab646[_0x2bf741('0x4d')]=_[_0x2bf741('0x4a')](_0x74e6ea[_0x2bf741('0x33')],qs[_0x2bf741('0x1f')](_0x1f54e8[_0x2bf741('0x2f')]['fields'])),_0x3ab646[_0x2bf741('0x4d')]=_0x3ab646[_0x2bf741('0x4d')][_0x2bf741('0xe')]?_0x3ab646[_0x2bf741('0x4d')]:_0x74e6ea[_0x2bf741('0x33')],_0x3ab646[_0x2bf741('0x61')]=qs['sort'](_0x1f54e8[_0x2bf741('0x2f')][_0x2bf741('0x42')]),_0x3ab646[_0x2bf741('0x27')]=qs['filters'](_[_0x2bf741('0x19')](_0x1f54e8[_0x2bf741('0x2f')],_0x74e6ea[_0x2bf741('0x10')])),_0x1f54e8[_0x2bf741('0x2f')][_0x2bf741('0x30')]&&(_0x3ab646[_0x2bf741('0x27')]=_[_0x2bf741('0x35')](_0x3ab646['where'],{[Op['or']]:_[_0x2bf741('0x5a')](_0x3ab646[_0x2bf741('0x4d')],function(_0x2289c3){const _0x1319ee=_0x2bf741,_0x8523c={};return _0x8523c[_0x2289c3]={[Op[_0x1319ee('0xc')]]:'%'+_0x1f54e8[_0x1319ee('0x2f')][_0x1319ee('0x30')]+'%'},_0x8523c;})})),_0x3ab646=_[_0x2bf741('0x35')]({},_0x3ab646,_0x1f54e8[_0x2bf741('0x52')]),_0x57fbae[_0x2bf741('0x63')](_0x3ab646);})[_0x31dbfe('0x14')](function(_0x4e761f){const _0x4520b3=_0x31dbfe;if(_0x4e761f)return _0x39168a=_0x4e761f[_0x4520b3('0xe')],typeof _0x1f54e8[_0x4520b3('0x2f')][_0x4520b3('0x46')]===_0x4520b3('0x1a')&&(_0x3ab646[_0x4520b3('0x3')]=qs[_0x4520b3('0x3')](_0x1f54e8[_0x4520b3('0x2f')][_0x4520b3('0x3')]),_0x3ab646['offset']=qs[_0x4520b3('0x40')](_0x1f54e8[_0x4520b3('0x2f')]['offset'])),_0x57fbae['getConfigurations'](_0x3ab646);})[_0x31dbfe('0x14')](function(_0x1c53d9){if(_0x1c53d9)return _0x1c53d9?{'count':_0x39168a,'rows':_0x1c53d9}:null;})[_0x31dbfe('0x14')](respondWithResult(_0x3fe2a1,null))[_0x31dbfe('0x1e')](handleError(_0x3fe2a1,null));},exports[_0x480bbd('0x3b')]=function(_0x1bd0d2,_0x5a0959){const _0x46c6d6=_0x480bbd;return _0x1bd0d2['body']['id']&&delete _0x1bd0d2[_0x46c6d6('0x5d')]['id'],db[_0x46c6d6('0x53')]['findOne']({'where':{'id':_0x1bd0d2[_0x46c6d6('0x4b')]['id']}})[_0x46c6d6('0x14')](handleEntityNotFound(_0x5a0959,null))[_0x46c6d6('0x14')](function(_0x322536){const _0x2d2e41=_0x46c6d6;if(_0x322536)return _0x1bd0d2[_0x2d2e41('0x5d')][_0x2d2e41('0x16')]=_0x322536['id'],_0x1bd0d2['body'][_0x2d2e41('0x28')]=integrations[_0x2d2e41('0x17')](_0x1bd0d2[_0x2d2e41('0x5d')][_0x2d2e41('0x56')],_0x1bd0d2[_0x2d2e41('0x5d')][_0x2d2e41('0x20')]),_0x1bd0d2[_0x2d2e41('0x5d')][_0x2d2e41('0x22')]=integrations[_0x2d2e41('0x58')](_0x1bd0d2['body'][_0x2d2e41('0x56')],_0x1bd0d2[_0x2d2e41('0x5d')][_0x2d2e41('0x20')]),db['SalesforceConfiguration'][_0x2d2e41('0x18')](_0x1bd0d2['body'],{'include':[{'model':db[_0x2d2e41('0x66')],'as':_0x2d2e41('0x28')},{'model':db[_0x2d2e41('0x66')],'as':_0x2d2e41('0x22')}]});return null;})[_0x46c6d6('0x14')](respondWithResult(_0x5a0959,null))['catch'](handleError(_0x5a0959,null));},exports[_0x480bbd('0x11')]=function(_0x127689,_0x56b830){const _0x68f27a=_0x480bbd;let _0x49aadc,_0x1fc367='',_0x5d3b22='Task';return db[_0x68f27a('0x53')][_0x68f27a('0xf')]({'where':{'id':_0x127689[_0x68f27a('0x4b')]['id']},'attributes':['id',_0x68f27a('0x37'),_0x68f27a('0x2d'),'clientSecret',_0x68f27a('0x23'),_0x68f27a('0x0'),'securityToken']})[_0x68f27a('0x14')](handleEntityNotFound(_0x56b830,null))[_0x68f27a('0x14')](function(_0x21c7b1){const _0xe68ca6=_0x68f27a;if(_0x21c7b1){_0x1fc367=_0x21c7b1['remoteUri'];const _0x4c1499=_0x1fc367[_0xe68ca6('0x25')](-0x1);return _0x4c1499==='/'&&(_0x1fc367=_0x1fc367[_0xe68ca6('0x2e')](0x0,_0x1fc367[_0xe68ca6('0x3a')](_0x4c1499))),_0x49aadc=new jsforce[(_0xe68ca6('0x3e'))]({'oauth2':{'loginUrl':_0x1fc367,'clientId':_0x21c7b1[_0xe68ca6('0x2d')],'clientSecret':_0x21c7b1[_0xe68ca6('0x4e')]}}),_0x49aadc['login'](_0x21c7b1[_0xe68ca6('0x23')],_0x21c7b1[_0xe68ca6('0x0')][_0xe68ca6('0x2c')](_0x21c7b1[_0xe68ca6('0x29')]));}})[_0x68f27a('0x14')](function(_0x39f7ec){const _0x51e0fc=_0x68f27a;if(_0x39f7ec)return!_['isNil'](_0x127689[_0x51e0fc('0x2f')][_0x51e0fc('0x9')])&&(_0x5d3b22=_0x127689[_0x51e0fc('0x2f')][_0x51e0fc('0x9')]),_0x49aadc[_0x51e0fc('0x24')](_0x5d3b22)[_0x51e0fc('0x54')]();})[_0x68f27a('0x14')](function(_0x51a382){const _0x4e53be=_0x68f27a;let _0x2346fa=['CallDisposition','CallDurationInSeconds','CallObject',_0x4e53be('0x55'),'IsArchived',_0x4e53be('0x1b'),_0x4e53be('0x13'),'Type'];!_[_0x4e53be('0x49')](_0x127689[_0x4e53be('0x2f')][_0x4e53be('0x9')])&&_0x127689[_0x4e53be('0x2f')]['ticketType']==='Case'&&(_0x2346fa=['Type',_0x4e53be('0x36'),_0x4e53be('0x47'),_0x4e53be('0x13'),_0x4e53be('0x1b'),_0x4e53be('0x50'),_0x4e53be('0x59'),_0x4e53be('0x2')]);if(_0x51a382)return _[_0x4e53be('0x8')](_0x51a382['fields'],function(_0x326def){const _0x57bc65=_0x4e53be;return _0x326def[_0x57bc65('0x5b')]===![]&&!_0x2346fa[_0x57bc65('0x3f')](_0x326def[_0x57bc65('0x60')]);}),{'count':_0x51a382[_0x4e53be('0x1f')][_0x4e53be('0xe')],'rows':_[_0x4e53be('0x5a')](_0x51a382['fields'],function(_0x49528b){const _0x453eea=_0x4e53be;return{'id':_0x49528b[_0x453eea('0x60')],'name':_0x49528b[_0x453eea('0x45')],'custom':_0x49528b[_0x453eea('0x5b')],'options':_0x49528b[_0x453eea('0x2b')][_0x453eea('0xe')]>0x0?_[_0x453eea('0x5a')](_0x49528b['picklistValues'],function(_0x41f227){const _0x430927=_0x453eea;return{'name':_0x41f227[_0x430927('0x45')],'value':_0x41f227[_0x430927('0x3c')]};}):_0x49528b[_0x453eea('0x20')]==_0x453eea('0xa')?[{'name':_0x453eea('0x31'),'value':'true'},{'name':'False','value':'false'}]:[]};})};})[_0x68f27a('0x14')](respondWithResult(_0x56b830,null))[_0x68f27a('0x1e')](function(_0x45b685){const _0x510c21=_0x68f27a;let _0x5b5016=_0x127689[_0x510c21('0x2f')][_0x510c21('0x41')]?0x1f4:_0x45b685['statusCode']||0x1f4;logger[_0x510c21('0x5')](_0x510c21('0x43'),_0x510c21('0x11'),_0x5b5016,JSON[_0x510c21('0x48')](_0x45b685)),delete _0x45b685[_0x510c21('0x60')],_0x5b5016===0x191&&(_0x5b5016=0x190),_0x56b830[_0x510c21('0x1c')](_0x5b5016)[_0x510c21('0x65')](_0x127689[_0x510c21('0x2f')][_0x510c21('0x41')]?{'message':_0x510c21('0x1'),'statusCode':_0x45b685[_0x510c21('0x4f')]}:_0x45b685);});};
\ No newline at end of file
+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