Built motion from commit 8dca541896b0ff92bb88a36cc13f4f385b593b4b. Version 3.0.0...
[motion-next.git] / server / api / intZohoAccount / intZohoAccount.model.js
index 90faba0..477614a 100644 (file)
@@ -1 +1 @@
-const a347_0x391b=['slice','refresh_token','lastIndexOf','ZohoAccount','substring','parse','refreshToken','error','https://accounts.zoho.com','then','format','https://accounts.zoho.com.au','clientId','application/x-www-form-urlencoded','zone','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','POST','/oauth/v2/token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','api','clientSecret','host','catch','info','util','serverUrl','name','int_zoho_accounts','https://accounts.zoho.eu','./intZohoAccount.attributes','changed','https://accounts.zoho.com.cn','inspect','code','https://accounts.zoho.in'];(function(_0x147855,_0x391bf4){const _0xf40995=function(_0x24701e){while(--_0x24701e){_0x147855['push'](_0x147855['shift']());}};_0xf40995(++_0x391bf4);}(a347_0x391b,0x103));const a347_0xf409=function(_0x147855,_0x391bf4){_0x147855=_0x147855-0x0;let _0xf40995=a347_0x391b[_0x147855];return _0xf40995;};const _0x1cbddd=a347_0xf409;'use strict';const util=require(_0x1cbddd('0xa')),logger=require('../../config/logger')(_0x1cbddd('0x5')),rp=require('request-promise-native'),attributes=require(_0x1cbddd('0xf'));module['exports']=function(_0x24701e){const _0x304110=_0x1cbddd,_0x3f49a2=_0x24701e['define'](_0x304110('0x18'),attributes,{'tableName':_0x304110('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4329eb){const _0x3bc45f=_0x304110;if(_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0x0'))||_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0xb'))||_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0x21'))||_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0x6'))||_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0x13'))||_0x4329eb[_0x3bc45f('0x10')](_0x3bc45f('0x7'))){let _0x4a077f,_0x3285bc;_0x4a077f=_0x4329eb['serverUrl'];const _0x4a8abd=_0x4a077f['slice'](-0x1);(_0x4a8abd==='/'||_0x4a8abd==='\x5c'||_0x4a8abd===':')&&(_0x4a077f=_0x4a077f['substring'](0x0,_0x4a077f[_0x3bc45f('0x17')](_0x4a8abd)));switch(_0x4329eb[_0x3bc45f('0x0')]){case'US':_0x3285bc=_0x3bc45f('0x1d');break;case'AU':_0x3285bc=_0x3bc45f('0x20');break;case'IN':_0x3285bc=_0x3bc45f('0x14');break;case'CN':_0x3285bc=_0x3bc45f('0x11');break;default:_0x3285bc=_0x3bc45f('0xe');break;}const _0x73f64={'method':'POST','uri':_0x3285bc+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4329eb[_0x3bc45f('0x21')],'client_secret':_0x4329eb[_0x3bc45f('0x6')],'redirect_uri':_0x4329eb[_0x3bc45f('0xb')],'code':_0x4329eb[_0x3bc45f('0x13')]},'headers':{'Content-Type':_0x3bc45f('0x22')}};let _0x49b88e=null;return rp(_0x73f64)[_0x3bc45f('0x1e')](function(_0x51e7ef){const _0x3969b0=_0x3bc45f;return _0x49b88e=JSON[_0x3969b0('0x1a')](_0x51e7ef),_0x49b88e['refresh_token']?(_0x4329eb[_0x3969b0('0x1b')]=_0x49b88e['refresh_token'],logger['info'](util[_0x3969b0('0x1f')](_0x3969b0('0x4'),_0x4329eb[_0x3969b0('0xc')],_0x4329eb['id']))):logger['error'](util[_0x3969b0('0x1f')](_0x3969b0('0x1'),_0x4329eb['name'],_0x4329eb['id']),util[_0x3969b0('0x12')](_0x49b88e,{'showHidden':![],'depth':null})),null;})[_0x3bc45f('0x8')](function(_0x4340a8){const _0x5ade60=_0x3bc45f;return logger['error'](util[_0x5ade60('0x1f')](_0x5ade60('0x1'),_0x4329eb['name'],_0x4329eb['id']),util[_0x5ade60('0x12')](_0x49b88e,{'showHidden':![],'depth':null})),_0x4340a8;});}else return null;},'beforeUpdate':function(_0x5e85f9){const _0x2a27ed=_0x304110;if(_0x5e85f9[_0x2a27ed('0x10')](_0x2a27ed('0x0'))||_0x5e85f9['changed'](_0x2a27ed('0xb'))||_0x5e85f9[_0x2a27ed('0x10')]('clientId')||_0x5e85f9['changed'](_0x2a27ed('0x6'))||_0x5e85f9[_0x2a27ed('0x10')](_0x2a27ed('0x13'))||_0x5e85f9[_0x2a27ed('0x10')]('host')){let _0x11b9b4,_0x2c0af3;_0x11b9b4=_0x5e85f9[_0x2a27ed('0xb')];const _0x2ba3d5=_0x11b9b4[_0x2a27ed('0x15')](-0x1);(_0x2ba3d5==='/'||_0x2ba3d5==='\x5c'||_0x2ba3d5===':')&&(_0x11b9b4=_0x11b9b4[_0x2a27ed('0x19')](0x0,_0x11b9b4[_0x2a27ed('0x17')](_0x2ba3d5)));switch(_0x5e85f9[_0x2a27ed('0x0')]){case'US':_0x2c0af3=_0x2a27ed('0x1d');break;case'AU':_0x2c0af3=_0x2a27ed('0x20');break;case'IN':_0x2c0af3='https://accounts.zoho.in';break;case'CN':_0x2c0af3=_0x2a27ed('0x11');break;default:_0x2c0af3=_0x2a27ed('0xe');break;}const _0x213c68={'method':_0x2a27ed('0x2'),'uri':_0x2c0af3+_0x2a27ed('0x3'),'form':{'grant_type':'authorization_code','client_id':_0x5e85f9[_0x2a27ed('0x21')],'client_secret':_0x5e85f9[_0x2a27ed('0x6')],'redirect_uri':_0x5e85f9['serverUrl'],'code':_0x5e85f9['code']},'headers':{'Content-Type':_0x2a27ed('0x22')}};let _0x543198=null;return rp(_0x213c68)[_0x2a27ed('0x1e')](function(_0x157c7f){const _0x5a39e5=_0x2a27ed;return _0x543198=JSON['parse'](_0x157c7f),_0x543198[_0x5a39e5('0x16')]?(_0x5e85f9[_0x5a39e5('0x1b')]=_0x543198['refresh_token'],logger[_0x5a39e5('0x9')](util[_0x5a39e5('0x1f')](_0x5a39e5('0x4'),_0x5e85f9[_0x5a39e5('0xc')],_0x5e85f9['id']))):logger[_0x5a39e5('0x1c')](util['format'](_0x5a39e5('0x1'),_0x5e85f9['name'],_0x5e85f9['id']),util[_0x5a39e5('0x12')](_0x543198,{'showHidden':![],'depth':null})),null;})['catch'](function(_0x23b281){const _0x469e6a=_0x2a27ed;return logger[_0x469e6a('0x1c')](util[_0x469e6a('0x1f')](_0x469e6a('0x1'),_0x5e85f9[_0x469e6a('0xc')],_0x5e85f9['id']),util['inspect'](_0x543198,{'showHidden':![],'depth':null})),_0x23b281;});}else return null;}}});return _0x3f49a2;};
\ No newline at end of file
+const a347_0x1370=['info','refreshToken','error','inspect','host','api','then','changed','https://accounts.zoho.eu','https://accounts.zoho.com','../../config/logger','format','authorization_code','code','define','ZohoAccount','exports','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.au','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','/oauth/v2/token','https://accounts.zoho.in','slice','zone','substring','application/x-www-form-urlencoded','refresh_token','int_zoho_accounts','name','serverUrl','lastIndexOf','POST','catch','clientSecret','clientId','parse','request-promise-native','https://accounts.zoho.com.cn'];(function(_0x379712,_0x137045){const _0x4281d3=function(_0x2bc7aa){while(--_0x2bc7aa){_0x379712['push'](_0x379712['shift']());}};_0x4281d3(++_0x137045);}(a347_0x1370,0x9b));const a347_0x4281=function(_0x379712,_0x137045){_0x379712=_0x379712-0x0;let _0x4281d3=a347_0x1370[_0x379712];return _0x4281d3;};const _0x463ce6=a347_0x4281;'use strict';const util=require('util'),logger=require(_0x463ce6('0x7'))(_0x463ce6('0x2')),rp=require(_0x463ce6('0x21')),attributes=require('./intZohoAccount.attributes');module[_0x463ce6('0xd')]=function(_0x2bc7aa){const _0x408206=_0x463ce6,_0x2d491f=_0x2bc7aa[_0x408206('0xb')](_0x408206('0xc'),attributes,{'tableName':_0x408206('0x18'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x324e75){const _0x28c66a=_0x408206;if(_0x324e75['changed'](_0x28c66a('0x14'))||_0x324e75['changed']('serverUrl')||_0x324e75[_0x28c66a('0x4')](_0x28c66a('0x1f'))||_0x324e75[_0x28c66a('0x4')](_0x28c66a('0x1e'))||_0x324e75[_0x28c66a('0x4')](_0x28c66a('0xa'))||_0x324e75[_0x28c66a('0x4')](_0x28c66a('0x1'))){let _0x4b2b5c,_0x4a4d01;_0x4b2b5c=_0x324e75[_0x28c66a('0x1a')];const _0xd69840=_0x4b2b5c[_0x28c66a('0x13')](-0x1);(_0xd69840==='/'||_0xd69840==='\x5c'||_0xd69840===':')&&(_0x4b2b5c=_0x4b2b5c[_0x28c66a('0x15')](0x0,_0x4b2b5c[_0x28c66a('0x1b')](_0xd69840)));switch(_0x324e75[_0x28c66a('0x14')]){case'US':_0x4a4d01=_0x28c66a('0x6');break;case'AU':_0x4a4d01=_0x28c66a('0xf');break;case'IN':_0x4a4d01=_0x28c66a('0x12');break;case'CN':_0x4a4d01='https://accounts.zoho.com.cn';break;default:_0x4a4d01=_0x28c66a('0x5');break;}const _0x5ca86d={'method':_0x28c66a('0x1c'),'uri':_0x4a4d01+_0x28c66a('0x11'),'form':{'grant_type':_0x28c66a('0x9'),'client_id':_0x324e75['clientId'],'client_secret':_0x324e75[_0x28c66a('0x1e')],'redirect_uri':_0x324e75[_0x28c66a('0x1a')],'code':_0x324e75[_0x28c66a('0xa')]},'headers':{'Content-Type':_0x28c66a('0x16')}};let _0x513d55=null;return rp(_0x5ca86d)[_0x28c66a('0x3')](function(_0x55e73d){const _0x4180d9=_0x28c66a;return _0x513d55=JSON['parse'](_0x55e73d),_0x513d55[_0x4180d9('0x17')]?(_0x324e75[_0x4180d9('0x24')]=_0x513d55[_0x4180d9('0x17')],logger[_0x4180d9('0x23')](util[_0x4180d9('0x8')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x324e75[_0x4180d9('0x19')],_0x324e75['id']))):logger['error'](util[_0x4180d9('0x8')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x324e75[_0x4180d9('0x19')],_0x324e75['id']),util[_0x4180d9('0x0')](_0x513d55,{'showHidden':![],'depth':null})),null;})[_0x28c66a('0x1d')](function(_0x45ac26){const _0x3d43e2=_0x28c66a;return logger[_0x3d43e2('0x25')](util['format'](_0x3d43e2('0xe'),_0x324e75['name'],_0x324e75['id']),util['inspect'](_0x513d55,{'showHidden':![],'depth':null})),_0x45ac26;});}else return null;},'beforeUpdate':function(_0x1cf732){const _0x3ea517=_0x408206;if(_0x1cf732[_0x3ea517('0x4')](_0x3ea517('0x14'))||_0x1cf732[_0x3ea517('0x4')](_0x3ea517('0x1a'))||_0x1cf732[_0x3ea517('0x4')]('clientId')||_0x1cf732[_0x3ea517('0x4')](_0x3ea517('0x1e'))||_0x1cf732[_0x3ea517('0x4')](_0x3ea517('0xa'))||_0x1cf732['changed'](_0x3ea517('0x1'))){let _0x2b9cae,_0x14f34e;_0x2b9cae=_0x1cf732[_0x3ea517('0x1a')];const _0x5629c1=_0x2b9cae[_0x3ea517('0x13')](-0x1);(_0x5629c1==='/'||_0x5629c1==='\x5c'||_0x5629c1===':')&&(_0x2b9cae=_0x2b9cae[_0x3ea517('0x15')](0x0,_0x2b9cae[_0x3ea517('0x1b')](_0x5629c1)));switch(_0x1cf732['zone']){case'US':_0x14f34e='https://accounts.zoho.com';break;case'AU':_0x14f34e=_0x3ea517('0xf');break;case'IN':_0x14f34e=_0x3ea517('0x12');break;case'CN':_0x14f34e=_0x3ea517('0x22');break;default:_0x14f34e=_0x3ea517('0x5');break;}const _0x3b3391={'method':_0x3ea517('0x1c'),'uri':_0x14f34e+'/oauth/v2/token','form':{'grant_type':_0x3ea517('0x9'),'client_id':_0x1cf732[_0x3ea517('0x1f')],'client_secret':_0x1cf732[_0x3ea517('0x1e')],'redirect_uri':_0x1cf732[_0x3ea517('0x1a')],'code':_0x1cf732[_0x3ea517('0xa')]},'headers':{'Content-Type':_0x3ea517('0x16')}};let _0x25b237=null;return rp(_0x3b3391)[_0x3ea517('0x3')](function(_0x396608){const _0x1e31fe=_0x3ea517;return _0x25b237=JSON[_0x1e31fe('0x20')](_0x396608),_0x25b237[_0x1e31fe('0x17')]?(_0x1cf732[_0x1e31fe('0x24')]=_0x25b237[_0x1e31fe('0x17')],logger[_0x1e31fe('0x23')](util[_0x1e31fe('0x8')](_0x1e31fe('0x10'),_0x1cf732['name'],_0x1cf732['id']))):logger['error'](util[_0x1e31fe('0x8')](_0x1e31fe('0xe'),_0x1cf732['name'],_0x1cf732['id']),util[_0x1e31fe('0x0')](_0x25b237,{'showHidden':![],'depth':null})),null;})[_0x3ea517('0x1d')](function(_0x1b183d){const _0x3403d2=_0x3ea517;return logger[_0x3403d2('0x25')](util[_0x3403d2('0x8')](_0x3403d2('0xe'),_0x1cf732[_0x3403d2('0x19')],_0x1cf732['id']),util[_0x3403d2('0x0')](_0x25b237,{'showHidden':![],'depth':null})),_0x1b183d;});}else return null;}}});return _0x2d491f;};
\ No newline at end of file