Built motion from commit 5fcd269f5146f10cf3129722d518881dfac64576. Version 3.0.0...
[motion-next.git] / server / api / intZohoAccount / intZohoAccount.model.js
index 171581d..1d58516 100644 (file)
@@ -1 +1 @@
-const a347_0x4361=['serverUrl','format','POST','inspect','slice','error','define','clientId','catch','https://accounts.zoho.com.au','refresh_token','https://accounts.zoho.com.cn','authorization_code','code','exports','substring','zone','changed','https://accounts.zoho.com','../../config/logger','info','lastIndexOf','refreshToken','then','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','api','host','parse','application/x-www-form-urlencoded','clientSecret','/oauth/v2/token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.in','ZohoAccount','https://accounts.zoho.eu','name','util'];(function(_0x42e57e,_0x43615b){const _0x5ca911=function(_0x454f8d){while(--_0x454f8d){_0x42e57e['push'](_0x42e57e['shift']());}};_0x5ca911(++_0x43615b);}(a347_0x4361,0x160));const a347_0x5ca9=function(_0x42e57e,_0x43615b){_0x42e57e=_0x42e57e-0x0;let _0x5ca911=a347_0x4361[_0x42e57e];return _0x5ca911;};const _0x429305=a347_0x5ca9;'use strict';const util=require(_0x429305('0x11')),logger=require(_0x429305('0x0'))(_0x429305('0x6')),rp=require('request-promise-native'),attributes=require('./intZohoAccount.attributes');module[_0x429305('0x20')]=function(_0x454f8d){const _0x8bf0e8=_0x429305,_0x330acc=_0x454f8d[_0x8bf0e8('0x18')](_0x8bf0e8('0xe'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x62fa5c){const _0x439ea8=_0x8bf0e8;if(_0x62fa5c['changed'](_0x439ea8('0x22'))||_0x62fa5c[_0x439ea8('0x23')](_0x439ea8('0x12'))||_0x62fa5c[_0x439ea8('0x23')](_0x439ea8('0x19'))||_0x62fa5c['changed'](_0x439ea8('0xa'))||_0x62fa5c[_0x439ea8('0x23')](_0x439ea8('0x1f'))||_0x62fa5c[_0x439ea8('0x23')](_0x439ea8('0x7'))){let _0x1044ad,_0x5c9f5e;_0x1044ad=_0x62fa5c['serverUrl'];const _0x3c5a69=_0x1044ad[_0x439ea8('0x16')](-0x1);(_0x3c5a69==='/'||_0x3c5a69==='\x5c'||_0x3c5a69===':')&&(_0x1044ad=_0x1044ad[_0x439ea8('0x21')](0x0,_0x1044ad[_0x439ea8('0x2')](_0x3c5a69)));switch(_0x62fa5c[_0x439ea8('0x22')]){case'US':_0x5c9f5e=_0x439ea8('0x24');break;case'AU':_0x5c9f5e='https://accounts.zoho.com.au';break;case'IN':_0x5c9f5e=_0x439ea8('0xd');break;case'CN':_0x5c9f5e=_0x439ea8('0x1d');break;default:_0x5c9f5e=_0x439ea8('0xf');break;}const _0x146276={'method':'POST','uri':_0x5c9f5e+_0x439ea8('0xb'),'form':{'grant_type':_0x439ea8('0x1e'),'client_id':_0x62fa5c['clientId'],'client_secret':_0x62fa5c[_0x439ea8('0xa')],'redirect_uri':_0x62fa5c[_0x439ea8('0x12')],'code':_0x62fa5c['code']},'headers':{'Content-Type':_0x439ea8('0x9')}};let _0x13ce80=null;return rp(_0x146276)[_0x439ea8('0x4')](function(_0xe3f336){const _0x542301=_0x439ea8;return _0x13ce80=JSON['parse'](_0xe3f336),_0x13ce80[_0x542301('0x1c')]?(_0x62fa5c[_0x542301('0x3')]=_0x13ce80[_0x542301('0x1c')],logger[_0x542301('0x1')](util[_0x542301('0x13')](_0x542301('0xc'),_0x62fa5c[_0x542301('0x10')],_0x62fa5c['id']))):logger['error'](util[_0x542301('0x13')](_0x542301('0x5'),_0x62fa5c[_0x542301('0x10')],_0x62fa5c['id']),util[_0x542301('0x15')](_0x13ce80,{'showHidden':![],'depth':null})),null;})[_0x439ea8('0x1a')](function(_0x1b9f68){const _0x5a2829=_0x439ea8;return logger['error'](util[_0x5a2829('0x13')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x62fa5c[_0x5a2829('0x10')],_0x62fa5c['id']),util[_0x5a2829('0x15')](_0x13ce80,{'showHidden':![],'depth':null})),_0x1b9f68;});}else return null;},'beforeUpdate':function(_0x276c99){const _0x13083c=_0x8bf0e8;if(_0x276c99[_0x13083c('0x23')](_0x13083c('0x22'))||_0x276c99[_0x13083c('0x23')](_0x13083c('0x12'))||_0x276c99[_0x13083c('0x23')]('clientId')||_0x276c99[_0x13083c('0x23')](_0x13083c('0xa'))||_0x276c99[_0x13083c('0x23')](_0x13083c('0x1f'))||_0x276c99[_0x13083c('0x23')](_0x13083c('0x7'))){let _0x11fc1c,_0x373094;_0x11fc1c=_0x276c99[_0x13083c('0x12')];const _0x1ff362=_0x11fc1c['slice'](-0x1);(_0x1ff362==='/'||_0x1ff362==='\x5c'||_0x1ff362===':')&&(_0x11fc1c=_0x11fc1c[_0x13083c('0x21')](0x0,_0x11fc1c['lastIndexOf'](_0x1ff362)));switch(_0x276c99[_0x13083c('0x22')]){case'US':_0x373094=_0x13083c('0x24');break;case'AU':_0x373094=_0x13083c('0x1b');break;case'IN':_0x373094=_0x13083c('0xd');break;case'CN':_0x373094=_0x13083c('0x1d');break;default:_0x373094=_0x13083c('0xf');break;}const _0x37275d={'method':_0x13083c('0x14'),'uri':_0x373094+_0x13083c('0xb'),'form':{'grant_type':_0x13083c('0x1e'),'client_id':_0x276c99[_0x13083c('0x19')],'client_secret':_0x276c99[_0x13083c('0xa')],'redirect_uri':_0x276c99[_0x13083c('0x12')],'code':_0x276c99[_0x13083c('0x1f')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};let _0x222e80=null;return rp(_0x37275d)[_0x13083c('0x4')](function(_0x300c34){const _0x5f6a92=_0x13083c;return _0x222e80=JSON[_0x5f6a92('0x8')](_0x300c34),_0x222e80[_0x5f6a92('0x1c')]?(_0x276c99[_0x5f6a92('0x3')]=_0x222e80[_0x5f6a92('0x1c')],logger['info'](util[_0x5f6a92('0x13')](_0x5f6a92('0xc'),_0x276c99[_0x5f6a92('0x10')],_0x276c99['id']))):logger[_0x5f6a92('0x17')](util[_0x5f6a92('0x13')](_0x5f6a92('0x5'),_0x276c99[_0x5f6a92('0x10')],_0x276c99['id']),util[_0x5f6a92('0x15')](_0x222e80,{'showHidden':![],'depth':null})),null;})['catch'](function(_0x395e2f){const _0x2cf27b=_0x13083c;return logger['error'](util[_0x2cf27b('0x13')](_0x2cf27b('0x5'),_0x276c99[_0x2cf27b('0x10')],_0x276c99['id']),util[_0x2cf27b('0x15')](_0x222e80,{'showHidden':![],'depth':null})),_0x395e2f;});}else return null;}}});return _0x330acc;};
\ No newline at end of file
+const a347_0xfca9=['clientSecret','name','slice','application/x-www-form-urlencoded','refreshToken','refresh_token','../../config/logger','then','format','https://accounts.zoho.eu','ZohoAccount','info','substring','exports','changed','request-promise-native','api','https://accounts.zoho.in','serverUrl','define','POST','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','authorization_code','clientId','https://accounts.zoho.com.au','https://accounts.zoho.com','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','zone','host','parse','error','/oauth/v2/token','lastIndexOf','code','catch'];(function(_0x30e83c,_0xfca9b2){const _0x622919=function(_0xd7b80e){while(--_0xd7b80e){_0x30e83c['push'](_0x30e83c['shift']());}};_0x622919(++_0xfca9b2);}(a347_0xfca9,0xc1));const a347_0x6229=function(_0x30e83c,_0xfca9b2){_0x30e83c=_0x30e83c-0x0;let _0x622919=a347_0xfca9[_0x30e83c];return _0x622919;};const _0x182410=a347_0x6229;'use strict';const util=require('util'),logger=require(_0x182410('0x1d'))(_0x182410('0x3')),rp=require(_0x182410('0x2')),attributes=require('./intZohoAccount.attributes');module[_0x182410('0x0')]=function(_0xd7b80e){const _0x281be4=_0x182410,_0x4f6489=_0xd7b80e[_0x281be4('0x6')](_0x281be4('0x21'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x432103){const _0x16db44=_0x281be4;if(_0x432103[_0x16db44('0x1')](_0x16db44('0xf'))||_0x432103['changed'](_0x16db44('0x5'))||_0x432103[_0x16db44('0x1')](_0x16db44('0xb'))||_0x432103['changed']('clientSecret')||_0x432103[_0x16db44('0x1')](_0x16db44('0x15'))||_0x432103[_0x16db44('0x1')](_0x16db44('0x10'))){let _0x1345f5,_0x36cd32;_0x1345f5=_0x432103['serverUrl'];const _0x28eb25=_0x1345f5[_0x16db44('0x19')](-0x1);(_0x28eb25==='/'||_0x28eb25==='\x5c'||_0x28eb25===':')&&(_0x1345f5=_0x1345f5[_0x16db44('0x23')](0x0,_0x1345f5[_0x16db44('0x14')](_0x28eb25)));switch(_0x432103[_0x16db44('0xf')]){case'US':_0x36cd32=_0x16db44('0xd');break;case'AU':_0x36cd32=_0x16db44('0xc');break;case'IN':_0x36cd32='https://accounts.zoho.in';break;case'CN':_0x36cd32='https://accounts.zoho.com.cn';break;default:_0x36cd32=_0x16db44('0x20');break;}const _0x25eb8c={'method':_0x16db44('0x7'),'uri':_0x36cd32+'/oauth/v2/token','form':{'grant_type':_0x16db44('0xa'),'client_id':_0x432103['clientId'],'client_secret':_0x432103['clientSecret'],'redirect_uri':_0x432103['serverUrl'],'code':_0x432103[_0x16db44('0x15')]},'headers':{'Content-Type':_0x16db44('0x1a')}};let _0x54d331=null;return rp(_0x25eb8c)[_0x16db44('0x1e')](function(_0x13f1c3){const _0xf81d9c=_0x16db44;return _0x54d331=JSON[_0xf81d9c('0x11')](_0x13f1c3),_0x54d331['refresh_token']?(_0x432103[_0xf81d9c('0x1b')]=_0x54d331[_0xf81d9c('0x1c')],logger[_0xf81d9c('0x22')](util[_0xf81d9c('0x1f')](_0xf81d9c('0xe'),_0x432103[_0xf81d9c('0x18')],_0x432103['id']))):logger[_0xf81d9c('0x12')](util[_0xf81d9c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x432103[_0xf81d9c('0x18')],_0x432103['id']),util[_0xf81d9c('0x9')](_0x54d331,{'showHidden':![],'depth':null})),null;})[_0x16db44('0x16')](function(_0x3efdd6){const _0x353d69=_0x16db44;return logger[_0x353d69('0x12')](util[_0x353d69('0x1f')](_0x353d69('0x8'),_0x432103[_0x353d69('0x18')],_0x432103['id']),util[_0x353d69('0x9')](_0x54d331,{'showHidden':![],'depth':null})),_0x3efdd6;});}else return null;},'beforeUpdate':function(_0x1fcb2c){const _0x4fb973=_0x281be4;if(_0x1fcb2c[_0x4fb973('0x1')](_0x4fb973('0xf'))||_0x1fcb2c[_0x4fb973('0x1')](_0x4fb973('0x5'))||_0x1fcb2c[_0x4fb973('0x1')](_0x4fb973('0xb'))||_0x1fcb2c[_0x4fb973('0x1')](_0x4fb973('0x17'))||_0x1fcb2c[_0x4fb973('0x1')](_0x4fb973('0x15'))||_0x1fcb2c[_0x4fb973('0x1')]('host')){let _0x16aef0,_0x4c94d7;_0x16aef0=_0x1fcb2c[_0x4fb973('0x5')];const _0x4d0e7d=_0x16aef0[_0x4fb973('0x19')](-0x1);(_0x4d0e7d==='/'||_0x4d0e7d==='\x5c'||_0x4d0e7d===':')&&(_0x16aef0=_0x16aef0[_0x4fb973('0x23')](0x0,_0x16aef0[_0x4fb973('0x14')](_0x4d0e7d)));switch(_0x1fcb2c[_0x4fb973('0xf')]){case'US':_0x4c94d7=_0x4fb973('0xd');break;case'AU':_0x4c94d7='https://accounts.zoho.com.au';break;case'IN':_0x4c94d7=_0x4fb973('0x4');break;case'CN':_0x4c94d7='https://accounts.zoho.com.cn';break;default:_0x4c94d7=_0x4fb973('0x20');break;}const _0x52ed71={'method':_0x4fb973('0x7'),'uri':_0x4c94d7+_0x4fb973('0x13'),'form':{'grant_type':_0x4fb973('0xa'),'client_id':_0x1fcb2c[_0x4fb973('0xb')],'client_secret':_0x1fcb2c['clientSecret'],'redirect_uri':_0x1fcb2c[_0x4fb973('0x5')],'code':_0x1fcb2c[_0x4fb973('0x15')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};let _0x578eba=null;return rp(_0x52ed71)[_0x4fb973('0x1e')](function(_0x1dea4e){const _0x326207=_0x4fb973;return _0x578eba=JSON[_0x326207('0x11')](_0x1dea4e),_0x578eba[_0x326207('0x1c')]?(_0x1fcb2c[_0x326207('0x1b')]=_0x578eba['refresh_token'],logger['info'](util[_0x326207('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1fcb2c['name'],_0x1fcb2c['id']))):logger['error'](util[_0x326207('0x1f')](_0x326207('0x8'),_0x1fcb2c[_0x326207('0x18')],_0x1fcb2c['id']),util[_0x326207('0x9')](_0x578eba,{'showHidden':![],'depth':null})),null;})[_0x4fb973('0x16')](function(_0x3223c6){const _0x347bb7=_0x4fb973;return logger['error'](util[_0x347bb7('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1fcb2c['name'],_0x1fcb2c['id']),util[_0x347bb7('0x9')](_0x578eba,{'showHidden':![],'depth':null})),_0x3223c6;});}else return null;}}});return _0x4f6489;};
\ No newline at end of file