Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / api / intZohoAccount / intZohoAccount.model.js
index 844f835..8f84c2d 100644 (file)
@@ -1 +1 @@
-const a347_0x43bf=['serverUrl','ZohoAccount','request-promise-native','POST','clientId','refreshToken','application/x-www-form-urlencoded','error','host','/oauth/v2/token','code','substring','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lastIndexOf','define','refresh_token','clientSecret','../../config/logger','name','exports','https://accounts.zoho.eu','changed','https://accounts.zoho.com.cn','catch','zone','https://accounts.zoho.com','then','https://accounts.zoho.in','authorization_code','info','inspect','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','parse','https://accounts.zoho.com.au'];(function(_0x321481,_0x43bfe1){const _0x535faa=function(_0x3df364){while(--_0x3df364){_0x321481['push'](_0x321481['shift']());}};_0x535faa(++_0x43bfe1);}(a347_0x43bf,0x150));const a347_0x535f=function(_0x321481,_0x43bfe1){_0x321481=_0x321481-0x0;let _0x535faa=a347_0x43bf[_0x321481];return _0x535faa;};const _0x506415=a347_0x535f;'use strict';const util=require('util'),logger=require(_0x506415('0x20'))('api'),rp=require(_0x506415('0x10')),attributes=require('./intZohoAccount.attributes');module[_0x506415('0x22')]=function(_0x3df364){const _0xfe9181=_0x506415,_0x2503cc=_0x3df364[_0xfe9181('0x1d')](_0xfe9181('0xf'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e1af5){const _0x4c8e44=_0xfe9181;if(_0x2e1af5[_0x4c8e44('0x1')](_0x4c8e44('0x4'))||_0x2e1af5['changed']('serverUrl')||_0x2e1af5[_0x4c8e44('0x1')](_0x4c8e44('0x12'))||_0x2e1af5[_0x4c8e44('0x1')](_0x4c8e44('0x1f'))||_0x2e1af5[_0x4c8e44('0x1')](_0x4c8e44('0x18'))||_0x2e1af5['changed']('host')){let _0x3615ec,_0x5e1536;_0x3615ec=_0x2e1af5['serverUrl'];const _0x4f1755=_0x3615ec['slice'](-0x1);(_0x4f1755==='/'||_0x4f1755==='\x5c'||_0x4f1755===':')&&(_0x3615ec=_0x3615ec[_0x4c8e44('0x19')](0x0,_0x3615ec[_0x4c8e44('0x1c')](_0x4f1755)));switch(_0x2e1af5[_0x4c8e44('0x4')]){case'US':_0x5e1536=_0x4c8e44('0x5');break;case'AU':_0x5e1536=_0x4c8e44('0xd');break;case'IN':_0x5e1536=_0x4c8e44('0x7');break;case'CN':_0x5e1536=_0x4c8e44('0x2');break;default:_0x5e1536=_0x4c8e44('0x0');break;}const _0x37cab2={'method':_0x4c8e44('0x11'),'uri':_0x5e1536+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2e1af5[_0x4c8e44('0x12')],'client_secret':_0x2e1af5[_0x4c8e44('0x1f')],'redirect_uri':_0x2e1af5[_0x4c8e44('0xe')],'code':_0x2e1af5[_0x4c8e44('0x18')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};let _0x435dc9=null;return rp(_0x37cab2)[_0x4c8e44('0x6')](function(_0x58cec0){const _0x361812=_0x4c8e44;return _0x435dc9=JSON[_0x361812('0xc')](_0x58cec0),_0x435dc9['refresh_token']?(_0x2e1af5[_0x361812('0x13')]=_0x435dc9['refresh_token'],logger[_0x361812('0x9')](util[_0x361812('0x1a')](_0x361812('0xb'),_0x2e1af5[_0x361812('0x21')],_0x2e1af5['id']))):logger[_0x361812('0x15')](util[_0x361812('0x1a')](_0x361812('0x1b'),_0x2e1af5[_0x361812('0x21')],_0x2e1af5['id']),util[_0x361812('0xa')](_0x435dc9,{'showHidden':![],'depth':null})),null;})[_0x4c8e44('0x3')](function(_0x5522ee){const _0x2bc999=_0x4c8e44;return logger[_0x2bc999('0x15')](util[_0x2bc999('0x1a')](_0x2bc999('0x1b'),_0x2e1af5[_0x2bc999('0x21')],_0x2e1af5['id']),util[_0x2bc999('0xa')](_0x435dc9,{'showHidden':![],'depth':null})),_0x5522ee;});}else return null;},'beforeUpdate':function(_0x35c840){const _0x5c2156=_0xfe9181;if(_0x35c840[_0x5c2156('0x1')]('zone')||_0x35c840[_0x5c2156('0x1')](_0x5c2156('0xe'))||_0x35c840[_0x5c2156('0x1')](_0x5c2156('0x12'))||_0x35c840[_0x5c2156('0x1')](_0x5c2156('0x1f'))||_0x35c840[_0x5c2156('0x1')](_0x5c2156('0x18'))||_0x35c840[_0x5c2156('0x1')](_0x5c2156('0x16'))){let _0x29321d,_0x5cd4ed;_0x29321d=_0x35c840[_0x5c2156('0xe')];const _0x4bb8c6=_0x29321d['slice'](-0x1);(_0x4bb8c6==='/'||_0x4bb8c6==='\x5c'||_0x4bb8c6===':')&&(_0x29321d=_0x29321d['substring'](0x0,_0x29321d[_0x5c2156('0x1c')](_0x4bb8c6)));switch(_0x35c840['zone']){case'US':_0x5cd4ed=_0x5c2156('0x5');break;case'AU':_0x5cd4ed=_0x5c2156('0xd');break;case'IN':_0x5cd4ed=_0x5c2156('0x7');break;case'CN':_0x5cd4ed=_0x5c2156('0x2');break;default:_0x5cd4ed=_0x5c2156('0x0');break;}const _0x31a496={'method':_0x5c2156('0x11'),'uri':_0x5cd4ed+_0x5c2156('0x17'),'form':{'grant_type':_0x5c2156('0x8'),'client_id':_0x35c840[_0x5c2156('0x12')],'client_secret':_0x35c840[_0x5c2156('0x1f')],'redirect_uri':_0x35c840[_0x5c2156('0xe')],'code':_0x35c840[_0x5c2156('0x18')]},'headers':{'Content-Type':_0x5c2156('0x14')}};let _0x5806fe=null;return rp(_0x31a496)[_0x5c2156('0x6')](function(_0x39016d){const _0x1fa61e=_0x5c2156;return _0x5806fe=JSON['parse'](_0x39016d),_0x5806fe[_0x1fa61e('0x1e')]?(_0x35c840['refreshToken']=_0x5806fe[_0x1fa61e('0x1e')],logger[_0x1fa61e('0x9')](util[_0x1fa61e('0x1a')](_0x1fa61e('0xb'),_0x35c840[_0x1fa61e('0x21')],_0x35c840['id']))):logger[_0x1fa61e('0x15')](util[_0x1fa61e('0x1a')](_0x1fa61e('0x1b'),_0x35c840[_0x1fa61e('0x21')],_0x35c840['id']),util['inspect'](_0x5806fe,{'showHidden':![],'depth':null})),null;})[_0x5c2156('0x3')](function(_0xc21bf0){const _0x14c761=_0x5c2156;return logger[_0x14c761('0x15')](util[_0x14c761('0x1a')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35c840[_0x14c761('0x21')],_0x35c840['id']),util['inspect'](_0x5806fe,{'showHidden':![],'depth':null})),_0xc21bf0;});}else return null;}}});return _0x2503cc;};
\ No newline at end of file
+const a347_0x111f=['host','https://accounts.zoho.com.cn','inspect','format','clientSecret','refresh_token','define','serverUrl','substring','POST','lastIndexOf','util','/oauth/v2/token','api','https://accounts.zoho.in','then','refreshToken','catch','error','changed','clientId','https://accounts.zoho.com','slice','exports','info','name','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.au','code','zone','https://accounts.zoho.eu','./intZohoAccount.attributes','authorization_code','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','application/x-www-form-urlencoded'];(function(_0x4112c5,_0x111ff0){const _0x3a53f4=function(_0x480969){while(--_0x480969){_0x4112c5['push'](_0x4112c5['shift']());}};_0x3a53f4(++_0x111ff0);}(a347_0x111f,0x186));const a347_0x3a53=function(_0x4112c5,_0x111ff0){_0x4112c5=_0x4112c5-0x0;let _0x3a53f4=a347_0x111f[_0x4112c5];return _0x3a53f4;};const _0x5775b0=a347_0x3a53;'use strict';const util=require(_0x5775b0('0x11')),logger=require('../../config/logger')(_0x5775b0('0x13')),rp=require('request-promise-native'),attributes=require(_0x5775b0('0x2'));module[_0x5775b0('0x1d')]=function(_0x480969){const _0x35ab70=_0x5775b0,_0x26413d=_0x480969[_0x35ab70('0xc')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b0f6e){const _0x4a9a2f=_0x35ab70;if(_0x3b0f6e[_0x4a9a2f('0x19')](_0x4a9a2f('0x0'))||_0x3b0f6e[_0x4a9a2f('0x19')]('serverUrl')||_0x3b0f6e['changed'](_0x4a9a2f('0x1a'))||_0x3b0f6e[_0x4a9a2f('0x19')](_0x4a9a2f('0xa'))||_0x3b0f6e['changed'](_0x4a9a2f('0x23'))||_0x3b0f6e[_0x4a9a2f('0x19')]('host')){let _0xd6bc4b,_0x44c4fb;_0xd6bc4b=_0x3b0f6e[_0x4a9a2f('0xd')];const _0x1370f2=_0xd6bc4b[_0x4a9a2f('0x1c')](-0x1);(_0x1370f2==='/'||_0x1370f2==='\x5c'||_0x1370f2===':')&&(_0xd6bc4b=_0xd6bc4b[_0x4a9a2f('0xe')](0x0,_0xd6bc4b[_0x4a9a2f('0x10')](_0x1370f2)));switch(_0x3b0f6e[_0x4a9a2f('0x0')]){case'US':_0x44c4fb='https://accounts.zoho.com';break;case'AU':_0x44c4fb=_0x4a9a2f('0x22');break;case'IN':_0x44c4fb=_0x4a9a2f('0x14');break;case'CN':_0x44c4fb=_0x4a9a2f('0x7');break;default:_0x44c4fb=_0x4a9a2f('0x1');break;}const _0xd8c798={'method':_0x4a9a2f('0xf'),'uri':_0x44c4fb+'/oauth/v2/token','form':{'grant_type':_0x4a9a2f('0x3'),'client_id':_0x3b0f6e['clientId'],'client_secret':_0x3b0f6e[_0x4a9a2f('0xa')],'redirect_uri':_0x3b0f6e[_0x4a9a2f('0xd')],'code':_0x3b0f6e[_0x4a9a2f('0x23')]},'headers':{'Content-Type':_0x4a9a2f('0x5')}};let _0x1bd77d=null;return rp(_0xd8c798)[_0x4a9a2f('0x15')](function(_0x5b9a2d){const _0x15a50c=_0x4a9a2f;return _0x1bd77d=JSON[_0x15a50c('0x20')](_0x5b9a2d),_0x1bd77d[_0x15a50c('0xb')]?(_0x3b0f6e[_0x15a50c('0x16')]=_0x1bd77d['refresh_token'],logger[_0x15a50c('0x1e')](util[_0x15a50c('0x9')](_0x15a50c('0x21'),_0x3b0f6e[_0x15a50c('0x1f')],_0x3b0f6e['id']))):logger[_0x15a50c('0x18')](util[_0x15a50c('0x9')](_0x15a50c('0x4'),_0x3b0f6e['name'],_0x3b0f6e['id']),util[_0x15a50c('0x8')](_0x1bd77d,{'showHidden':![],'depth':null})),null;})['catch'](function(_0x23d56c){const _0x31c3d5=_0x4a9a2f;return logger['error'](util['format'](_0x31c3d5('0x4'),_0x3b0f6e[_0x31c3d5('0x1f')],_0x3b0f6e['id']),util['inspect'](_0x1bd77d,{'showHidden':![],'depth':null})),_0x23d56c;});}else return null;},'beforeUpdate':function(_0x305802){const _0x316d80=_0x35ab70;if(_0x305802[_0x316d80('0x19')](_0x316d80('0x0'))||_0x305802[_0x316d80('0x19')]('serverUrl')||_0x305802[_0x316d80('0x19')](_0x316d80('0x1a'))||_0x305802[_0x316d80('0x19')](_0x316d80('0xa'))||_0x305802[_0x316d80('0x19')](_0x316d80('0x23'))||_0x305802[_0x316d80('0x19')](_0x316d80('0x6'))){let _0x4e37ea,_0x47b7ee;_0x4e37ea=_0x305802[_0x316d80('0xd')];const _0x5183d0=_0x4e37ea['slice'](-0x1);(_0x5183d0==='/'||_0x5183d0==='\x5c'||_0x5183d0===':')&&(_0x4e37ea=_0x4e37ea[_0x316d80('0xe')](0x0,_0x4e37ea[_0x316d80('0x10')](_0x5183d0)));switch(_0x305802[_0x316d80('0x0')]){case'US':_0x47b7ee=_0x316d80('0x1b');break;case'AU':_0x47b7ee='https://accounts.zoho.com.au';break;case'IN':_0x47b7ee=_0x316d80('0x14');break;case'CN':_0x47b7ee=_0x316d80('0x7');break;default:_0x47b7ee=_0x316d80('0x1');break;}const _0x374421={'method':_0x316d80('0xf'),'uri':_0x47b7ee+_0x316d80('0x12'),'form':{'grant_type':_0x316d80('0x3'),'client_id':_0x305802[_0x316d80('0x1a')],'client_secret':_0x305802[_0x316d80('0xa')],'redirect_uri':_0x305802[_0x316d80('0xd')],'code':_0x305802[_0x316d80('0x23')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};let _0x2c15eb=null;return rp(_0x374421)['then'](function(_0x6badf6){const _0x3c5ee1=_0x316d80;return _0x2c15eb=JSON[_0x3c5ee1('0x20')](_0x6badf6),_0x2c15eb[_0x3c5ee1('0xb')]?(_0x305802[_0x3c5ee1('0x16')]=_0x2c15eb['refresh_token'],logger['info'](util[_0x3c5ee1('0x9')](_0x3c5ee1('0x21'),_0x305802[_0x3c5ee1('0x1f')],_0x305802['id']))):logger['error'](util[_0x3c5ee1('0x9')](_0x3c5ee1('0x4'),_0x305802['name'],_0x305802['id']),util[_0x3c5ee1('0x8')](_0x2c15eb,{'showHidden':![],'depth':null})),null;})[_0x316d80('0x17')](function(_0x3d9902){const _0x558e90=_0x316d80;return logger['error'](util[_0x558e90('0x9')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x305802[_0x558e90('0x1f')],_0x305802['id']),util[_0x558e90('0x8')](_0x2c15eb,{'showHidden':![],'depth':null})),_0x3d9902;});}else return null;}}});return _0x26413d;};
\ No newline at end of file