@searchability/admin-client 0.0.42 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var TokenStatus;(function(_0x3538ba){_0x3538ba[_0x3538ba['Ok']=0x0]='Ok',_0x3538ba[_0x3538ba['Refresh']=0x1]='Refresh',_0x3538ba[_0x3538ba['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x16c42d){this['isSuccess']=_0x16c42d;}}class SuccessfulAccountResponse extends Response{constructor(_0x39a57a){super(!![]),this['account']=_0x39a57a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2cfba2){super(![]),this['problem']=_0x2cfba2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4308f2){super(!![]),this['tokens']=_0x4308f2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x59789b){super(![]),this['problem']=_0x59789b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x3062f4){super(!![]),this['apiKey']=_0x3062f4;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1f4a3d){super(![]),this['problem']=_0x1f4a3d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0xcdf71d){super(!![]),this['searchService']=_0xcdf71d;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x145690){super(![]),this['problem']=_0x145690;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x50f15a){super(!![]),this['searchService']=_0x50f15a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x5b41c4){super(![]),this['problem']=_0x5b41c4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x397fc3){super(!![]),this['apiKeyValue']=_0x397fc3;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x1f9897){super(!![]),this['obj']=_0x1f9897;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x110db8){super(![]),this['problem']=_0x110db8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x4cccf1){super(![]),this['problem']=_0x4cccf1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x50a3c9,_0x586433,_0x145ca8,_0x22a5ae){function _0x36b57b(_0xadfd0){return _0xadfd0 instanceof _0x145ca8?_0xadfd0:new _0x145ca8(function(_0x2a24ed){_0x2a24ed(_0xadfd0);});}return new(_0x145ca8||(_0x145ca8=Promise))(function(_0xdf23ef,_0x2b884f){function _0x45faf6(_0x2cf5e6){try{_0x1985bb(_0x22a5ae['next'](_0x2cf5e6));}catch(_0x2a3572){_0x2b884f(_0x2a3572);}}function _0x2bd217(_0x20794d){try{_0x1985bb(_0x22a5ae['throw'](_0x20794d));}catch(_0x592c90){_0x2b884f(_0x592c90);}}function _0x1985bb(_0x3315fc){_0x3315fc['done']?_0xdf23ef(_0x3315fc['value']):_0x36b57b(_0x3315fc['value'])['then'](_0x45faf6,_0x2bd217);}_0x1985bb((_0x22a5ae=_0x22a5ae['apply'](_0x50a3c9,_0x586433||[]))['next']());});};class AccountService{constructor(_0x510641){this['fetch']=_0x510641;}['get'](_0x33ed0c,_0x164838){return __awaiter$5(this,void 0,void 0,function*(){const _0x201bfb='Account/'+_0x33ed0c+'/',_0x5667bd=yield this['fetch']['get'](_0x201bfb,_0x164838);try{if(_0x5667bd['status']>0xc7&&_0x5667bd['status']<0x12c){const _0x2922d7=yield _0x5667bd['json']();return new SuccessfulAccountResponse(_0x2922d7);}const _0x4420cf=yield _0x5667bd['json']();return new FailedAccountResponse(_0x4420cf);}catch(_0x154c13){if(_0x154c13 instanceof Error)return new FailedAccountResponse({'detail':_0x154c13['message'],'title':_0x154c13['name'],'status':0x1f4,'instance':'','type':''});throw _0x154c13;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x495d37,_0x54d20e,_0x13606a,_0x4a9157){function _0x15e583(_0x102b10){return _0x102b10 instanceof _0x13606a?_0x102b10:new _0x13606a(function(_0xb2a19d){_0xb2a19d(_0x102b10);});}return new(_0x13606a||(_0x13606a=Promise))(function(_0x4bc6b4,_0xf8a53f){function _0x2d0dd0(_0x5967ed){try{_0x44f35a(_0x4a9157['next'](_0x5967ed));}catch(_0x2d01f0){_0xf8a53f(_0x2d01f0);}}function _0xaa517d(_0x49aea6){try{_0x44f35a(_0x4a9157['throw'](_0x49aea6));}catch(_0x253ee4){_0xf8a53f(_0x253ee4);}}function _0x44f35a(_0x1a6b78){_0x1a6b78['done']?_0x4bc6b4(_0x1a6b78['value']):_0x15e583(_0x1a6b78['value'])['then'](_0x2d0dd0,_0xaa517d);}_0x44f35a((_0x4a9157=_0x4a9157['apply'](_0x495d37,_0x54d20e||[]))['next']());});};class ApiKeyService{constructor(_0x1775a5){this['fetch']=_0x1775a5,this['path']='api-key';}['create'](_0x3dda47,_0x3954c3,_0x4b5b5f){return __awaiter$4(this,void 0,void 0,function*(){const _0x38c8c1={'account_name':_0x3dda47,'api_key_name':_0x3954c3};try{const _0x49950c=yield this['fetch']['post'](this['path'],_0x4b5b5f,_0x38c8c1);if(_0x49950c['status']>0xc7&&_0x49950c['status']<0x12c){const _0x22fc65=yield _0x49950c['json']();return new SuccessfulApiKeyResponse(_0x22fc65);}const _0x4c3d69=yield _0x49950c['json']();return new FailedApiKeyResponse(_0x4c3d69);}catch(_0x39624d){if(_0x39624d instanceof Error)return new FailedApiKeyResponse({'detail':_0x39624d['message'],'title':_0x39624d['name'],'status':0x1f4,'instance':'','type':''});throw _0x39624d;}});}['view'](_0x104630,_0x3226c9,_0x39f7f8){return __awaiter$4(this,void 0,void 0,function*(){const _0xd999eb=this['path']+'/'+_0x104630+'/'+_0x3226c9;try{const _0x540492=yield this['fetch']['get'](_0xd999eb,_0x39f7f8);if(_0x540492['status']>0xc7&&_0x540492['status']<0x12c){const _0x2a464d=yield _0x540492['json']();return new SuccessfulApiKeyValueResponse(_0x2a464d);}const _0x14c815=yield _0x540492['json']();return new FailedApiKeyValueResponse(_0x14c815);}catch(_0x4725f7){if(_0x4725f7 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4725f7['message'],'title':_0x4725f7['name'],'status':0x1f4,'instance':'','type':''});throw _0x4725f7;}});}['delete'](_0x37f254,_0x35c5f4,_0x3fb721){return __awaiter$4(this,void 0,void 0,function*(){const _0x2198e5=this['path']+'/'+_0x37f254+'/'+_0x35c5f4;try{const _0x2ef813=yield this['fetch']['delete'](_0x2198e5,_0x3fb721);if(_0x2ef813['status']>0xc7&&_0x2ef813['status']<0x12c)return new SuccessfulResponse({});const _0x1f6903=yield _0x2ef813['json']();return new FailedResponse(_0x1f6903);}catch(_0x161bec){if(_0x161bec instanceof Error)return new FailedResponse({'detail':_0x161bec['message'],'title':_0x161bec['name'],'status':0x1f4,'instance':'','type':''});throw _0x161bec;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x4262e7,_0x896abb,_0x3abf5e,_0x1394de){function _0x6c8e48(_0x2ac293){return _0x2ac293 instanceof _0x3abf5e?_0x2ac293:new _0x3abf5e(function(_0xed3f6a){_0xed3f6a(_0x2ac293);});}return new(_0x3abf5e||(_0x3abf5e=Promise))(function(_0x21e9e3,_0x37f372){function _0x4fa78b(_0xfaf999){try{_0x1558fd(_0x1394de['next'](_0xfaf999));}catch(_0x20505d){_0x37f372(_0x20505d);}}function _0x25db80(_0x1fc64e){try{_0x1558fd(_0x1394de['throw'](_0x1fc64e));}catch(_0x498e82){_0x37f372(_0x498e82);}}function _0x1558fd(_0x30d317){_0x30d317['done']?_0x21e9e3(_0x30d317['value']):_0x6c8e48(_0x30d317['value'])['then'](_0x4fa78b,_0x25db80);}_0x1558fd((_0x1394de=_0x1394de['apply'](_0x4262e7,_0x896abb||[]))['next']());});};class ListService{constructor(_0x58fb76){this['fetch']=_0x58fb76;}['add'](_0x553c82,_0x294abc,_0x3eb2c0){return __awaiter$3(this,void 0,void 0,function*(){const _0x53e11a='List',_0x3f193d={'account_name':_0x553c82,'list_name':_0x294abc};try{const _0x155cb4=yield this['fetch']['post'](_0x53e11a,_0x3eb2c0,_0x3f193d);if(_0x155cb4['status']>0xc7&&_0x155cb4['status']<0x12c){const _0x5d18b3=yield _0x155cb4['json']();return new SuccessfulAccountResponse(_0x5d18b3);}const _0x497210=yield _0x155cb4['json']();return new FailedAccountResponse(_0x497210);}catch(_0xe3e3b){if(_0xe3e3b instanceof Error)return new FailedAccountResponse({'detail':_0xe3e3b['message'],'title':_0xe3e3b['name'],'status':0x1f4,'instance':'','type':''});throw _0xe3e3b;}});}['remove'](_0x195da,_0x366cb8,_0x7924d){return __awaiter$3(this,void 0,void 0,function*(){const _0x3045ee='List/'+_0x195da+'/'+_0x366cb8,_0x165220=yield this['fetch']['delete'](_0x3045ee,_0x7924d);try{if(_0x165220['status']>0xc7&&_0x165220['status']<0x12c){const _0x171bd0=yield _0x165220['json']();return new SuccessfulAccountResponse(_0x171bd0);}const _0xf6da3e=yield _0x165220['json']();return new FailedAccountResponse(_0xf6da3e);}catch(_0x1cc5d9){if(_0x1cc5d9 instanceof Error)return new FailedAccountResponse({'detail':_0x1cc5d9['message'],'title':_0x1cc5d9['name'],'status':0x1f4,'instance':'','type':''});throw _0x1cc5d9;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xbf9695,_0x12b2f1,_0x19ab8f,_0x34da1a){function _0x1673d9(_0x18ea3){return _0x18ea3 instanceof _0x19ab8f?_0x18ea3:new _0x19ab8f(function(_0x580534){_0x580534(_0x18ea3);});}return new(_0x19ab8f||(_0x19ab8f=Promise))(function(_0x11a659,_0xfabf82){function _0x320a0e(_0xcb3227){try{_0x5aaf59(_0x34da1a['next'](_0xcb3227));}catch(_0x2f9838){_0xfabf82(_0x2f9838);}}function _0x52ab89(_0x2110d2){try{_0x5aaf59(_0x34da1a['throw'](_0x2110d2));}catch(_0x1a0833){_0xfabf82(_0x1a0833);}}function _0x5aaf59(_0x5d29f9){_0x5d29f9['done']?_0x11a659(_0x5d29f9['value']):_0x1673d9(_0x5d29f9['value'])['then'](_0x320a0e,_0x52ab89);}_0x5aaf59((_0x34da1a=_0x34da1a['apply'](_0xbf9695,_0x12b2f1||[]))['next']());});};class Fetch{constructor(_0xfb9a42){this['baseUri']=_0xfb9a42,this['getUrl']=_0x297a58=>{return _0x297a58['startsWith']('/')&&(_0x297a58=_0x297a58['replace']('/','')),''+this['baseUri']+_0x297a58;},!_0xfb9a42['endsWith']('/')&&(_0xfb9a42=_0xfb9a42+'/');}['get'](_0x2728ac,_0x3673a6){return __awaiter$2(this,void 0,void 0,function*(){const _0xb298e0=this['getUrl'](_0x2728ac);return yield fetch(_0xb298e0,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3673a6}});});}['post'](_0x36fc06,_0x58d8b3,_0x22484d){return __awaiter$2(this,void 0,void 0,function*(){const _0x1a5e8c=this['getUrl'](_0x36fc06);return yield fetch(_0x1a5e8c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x58d8b3},'body':_0x22484d?JSON['stringify'](_0x22484d):null});});}['PostNoAuth'](_0x1cc3a5,_0x5cad82){return __awaiter$2(this,void 0,void 0,function*(){const _0x330faf=this['getUrl'](_0x1cc3a5);return yield fetch(_0x330faf,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5cad82?JSON['stringify'](_0x5cad82):null});});}['put'](_0x211122,_0x594fc4,_0x25adfc){return __awaiter$2(this,void 0,void 0,function*(){const _0x3ea47b=this['getUrl'](_0x211122);return yield fetch(_0x3ea47b,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x594fc4},'body':_0x25adfc?JSON['stringify'](_0x25adfc):null});});}['delete'](_0x1781a2,_0x3969f7){return __awaiter$2(this,void 0,void 0,function*(){const _0x4b2b6a=this['getUrl'](_0x1781a2);return yield fetch(_0x4b2b6a,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3969f7}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x49ad91,_0x14d32b,_0x597176,_0x38cb5e){function _0x4b04f7(_0x32d671){return _0x32d671 instanceof _0x597176?_0x32d671:new _0x597176(function(_0x28e074){_0x28e074(_0x32d671);});}return new(_0x597176||(_0x597176=Promise))(function(_0x4eacf9,_0x31a1d8){function _0xacd5f4(_0x438bd3){try{_0x15bd31(_0x38cb5e['next'](_0x438bd3));}catch(_0x2b8d81){_0x31a1d8(_0x2b8d81);}}function _0x33cdaf(_0x529ccf){try{_0x15bd31(_0x38cb5e['throw'](_0x529ccf));}catch(_0x5525e3){_0x31a1d8(_0x5525e3);}}function _0x15bd31(_0x201dfd){_0x201dfd['done']?_0x4eacf9(_0x201dfd['value']):_0x4b04f7(_0x201dfd['value'])['then'](_0xacd5f4,_0x33cdaf);}_0x15bd31((_0x38cb5e=_0x38cb5e['apply'](_0x49ad91,_0x14d32b||[]))['next']());});};class SearchServersService{constructor(_0x2f4faf){this['fetch']=_0x2f4faf,this['path']='search-services';}['create'](_0x4f6edf,_0x1988ed,_0x129cd4,_0x460690,_0x5b0849,_0x16c5a0,_0x450bb2,_0x5f4114){return __awaiter$1(this,void 0,void 0,function*(){const _0x542281={'account_name':_0x4f6edf,'search_service_name':_0x1988ed,'endpoint':_0x129cd4,'key':_0x460690,'country':_0x5b0849,'provider':_0x16c5a0,'index_name':_0x450bb2};try{const _0x193b40=yield this['fetch']['post'](this['path'],_0x5f4114,_0x542281);if(_0x193b40['status']>0xc7&&_0x193b40['status']<0x12c){const _0x4a04aa=yield _0x193b40['json']();return new SuccessfulSearchServiceResponse(_0x4a04aa);}const _0x420295=yield _0x193b40['json']();return new FailedSearchServiceResponse(_0x420295);}catch(_0x1e10f3){if(_0x1e10f3 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1e10f3['message'],'title':_0x1e10f3['name'],'status':0x1f4,'instance':'','type':''});throw _0x1e10f3;}});}['delete'](_0x1cad5c,_0x280b8f,_0x295d7b){return __awaiter$1(this,void 0,void 0,function*(){const _0x1d550d=this['path']+'/'+_0x1cad5c+'/'+_0x280b8f;try{const _0x525fd2=yield this['fetch']['delete'](_0x1d550d,_0x295d7b);if(_0x525fd2['status']>0xc7&&_0x525fd2['status']<0x12c)return new SuccessfulResponse({});const _0x42d0a6=yield _0x525fd2['json']();return new FailedResponse(_0x42d0a6);}catch(_0x5c8026){if(_0x5c8026 instanceof Error)return new FailedResponse({'detail':_0x5c8026['message'],'title':_0x5c8026['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c8026;}});}['view'](_0x21b61d,_0x2965dc,_0x2adef9){return __awaiter$1(this,void 0,void 0,function*(){const _0x493783=this['path']+'/'+_0x21b61d+'/'+_0x2965dc;try{const _0x5e2a9e=yield this['fetch']['get'](_0x493783,_0x2adef9);if(_0x5e2a9e['status']>0xc7&&_0x5e2a9e['status']<0x12c){const _0x12bd6f=yield _0x5e2a9e['json']();return new SuccessfulViewSearchServiceResponse(_0x12bd6f);}const _0x5401ee=yield _0x5e2a9e['json']();return new FailedViewSearchServiceResponse(_0x5401ee);}catch(_0x360da7){if(_0x360da7 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x360da7['message'],'title':_0x360da7['name'],'status':0x1f4,'instance':'','type':''});throw _0x360da7;}});}['edit'](_0x574c6c,_0x2be1b2,_0x3d0dfc,_0x4550d0,_0x3f40dd,_0x238495){return __awaiter$1(this,void 0,void 0,function*(){const _0x344472={'account_name':_0x574c6c,'search_service_name':_0x2be1b2,'new_search_service_name':_0x3d0dfc,'key':_0x4550d0,'country':_0x3f40dd};try{const _0x2ea75e=yield this['fetch']['put'](this['path'],_0x238495,_0x344472);if(_0x2ea75e['status']>0xc7&&_0x2ea75e['status']<0x12c){const _0x55056d=yield _0x2ea75e['json']();return new SuccessfulSearchServiceResponse(_0x55056d);}const _0x41fa66=yield _0x2ea75e['json']();return new FailedSearchServiceResponse(_0x41fa66);}catch(_0x1ae6be){if(_0x1ae6be instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1ae6be['message'],'title':_0x1ae6be['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ae6be;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x580498,_0x3e739a,_0x31964f,_0x490fab){function _0x1c60b8(_0x4783cb){return _0x4783cb instanceof _0x31964f?_0x4783cb:new _0x31964f(function(_0x1bab0c){_0x1bab0c(_0x4783cb);});}return new(_0x31964f||(_0x31964f=Promise))(function(_0x53a3da,_0xa666f2){function _0x2167a2(_0x53c867){try{_0x4e9ff8(_0x490fab['next'](_0x53c867));}catch(_0x5c9235){_0xa666f2(_0x5c9235);}}function _0x146f80(_0x3cc9f6){try{_0x4e9ff8(_0x490fab['throw'](_0x3cc9f6));}catch(_0x525e60){_0xa666f2(_0x525e60);}}function _0x4e9ff8(_0xd2af22){_0xd2af22['done']?_0x53a3da(_0xd2af22['value']):_0x1c60b8(_0xd2af22['value'])['then'](_0x2167a2,_0x146f80);}_0x4e9ff8((_0x490fab=_0x490fab['apply'](_0x580498,_0x3e739a||[]))['next']());});};class AdminClient{constructor(_0x4bf181='https://admin.searchability.dev/'){var _0x4b3ebf=new Fetch(_0x4bf181);this['Accounts']=new AccountService(_0x4b3ebf),this['Lists']=new ListService(_0x4b3ebf),this['ApiKeys']=new ApiKeyService(_0x4b3ebf),this['SearchServices']=new SearchServersService(_0x4b3ebf);}}class AuthClient{constructor(_0x25ba4e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x25ba4e);}['login'](_0xe1f699){return __awaiter(this,void 0,void 0,function*(){const _0x51e9b4='login/'+_0xe1f699;try{const _0x50a6b5=yield yield fetch(_0x51e9b4);if(_0x50a6b5['status']>0xc7&&_0x50a6b5['status']<0x12c){const _0x199b66=yield _0x50a6b5['json']();return new SuccessfulAuthResponse(_0x199b66);}const _0x187e58=yield _0x50a6b5['json']();return new FailedAuthResponse(_0x187e58);}catch(_0x14f369){if(_0x14f369 instanceof Error)return new FailedAuthResponse({'detail':_0x14f369['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x14f369;}});}['refresh'](_0x289975){return __awaiter(this,void 0,void 0,function*(){const _0x2bebfe='refresh',_0xc99217={'refresh_token':_0x289975};try{const _0x1faa9f=yield this['fetch']['PostNoAuth'](_0x2bebfe,_0xc99217);if(_0x1faa9f['status']>0xc7&&_0x1faa9f['status']<0x12c){const _0x35289d=yield _0x1faa9f['json']();return new SuccessfulAuthResponse(_0x35289d);}const _0x4d8c6f=yield _0x1faa9f['json']();return new FailedAuthResponse(_0x4d8c6f);}catch(_0x273c50){if(_0x273c50 instanceof Error)return new FailedAuthResponse({'detail':_0x273c50['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x273c50;}});}['getTokenStatus'](_0x23c085){if(Date['now']()<_0x23c085['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x23c085['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
+
|
|
15
|
+
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x4266d1){_0x4266d1[_0x4266d1['Ok']=0x0]='Ok',_0x4266d1[_0x4266d1['Refresh']=0x1]='Refresh',_0x4266d1[_0x4266d1['Expired']=0x2]='Expired';}(exports.TokenStatus||(exports.TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x190e38){this['isSuccess']=_0x190e38;}}class SuccessfulAccountResponse extends Response{constructor(_0x5ec4c4){super(!![]),this['account']=_0x5ec4c4;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x1d820f){super(![]),this['problem']=_0x1d820f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x47da5b){super(!![]),this['tokens']=_0x47da5b;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x28736f){super(![]),this['problem']=_0x28736f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0xd96cf1){super(!![]),this['apiKey']=_0xd96cf1;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x7f381e){super(![]),this['problem']=_0x7f381e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x268cf6){super(!![]),this['searchService']=_0x268cf6;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x51b8dc){super(![]),this['problem']=_0x51b8dc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x5667ab){super(!![]),this['searchService']=_0x5667ab;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1bcb6f){super(![]),this['problem']=_0x1bcb6f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x16dc8c){super(!![]),this['apiKeyValue']=_0x16dc8c;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x4dcc8d){super(!![]),this['obj']=_0x4dcc8d;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0xadbd46){super(![]),this['problem']=_0xadbd46;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x421bfa){super(![]),this['problem']=_0x421bfa;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x1b4c21,_0xe81850,_0x43884c,_0xd18604){function _0x3fd056(_0x17a780){return _0x17a780 instanceof _0x43884c?_0x17a780:new _0x43884c(function(_0x19e9a2){_0x19e9a2(_0x17a780);});}return new(_0x43884c||(_0x43884c=Promise))(function(_0x316878,_0x304032){function _0xc933e1(_0x493c47){try{_0xce7557(_0xd18604['next'](_0x493c47));}catch(_0x2faf61){_0x304032(_0x2faf61);}}function _0x51a1a4(_0x34ae81){try{_0xce7557(_0xd18604['throw'](_0x34ae81));}catch(_0x3701a8){_0x304032(_0x3701a8);}}function _0xce7557(_0x1136b2){_0x1136b2['done']?_0x316878(_0x1136b2['value']):_0x3fd056(_0x1136b2['value'])['then'](_0xc933e1,_0x51a1a4);}_0xce7557((_0xd18604=_0xd18604['apply'](_0x1b4c21,_0xe81850||[]))['next']());});};class AccountService{constructor(_0x1c638e){this['fetch']=_0x1c638e;}['get'](_0x545fd7,_0x4f1199){return __awaiter$5(this,void 0,void 0,function*(){const _0x16f5f2='Account/'+_0x545fd7+'/',_0x2189b4=yield this['fetch']['get'](_0x16f5f2,_0x4f1199);try{if(_0x2189b4['status']>0xc7&&_0x2189b4['status']<0x12c){const _0x16dc4c=yield _0x2189b4['json']();return new SuccessfulAccountResponse(_0x16dc4c);}const _0x41a292=yield _0x2189b4['json']();return new FailedAccountResponse(_0x41a292);}catch(_0x134eba){if(_0x134eba instanceof Error)return new FailedAccountResponse({'detail':_0x134eba['message'],'title':_0x134eba['name'],'status':0x1f4,'instance':'','type':''});throw _0x134eba;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5097bf,_0x202df4,_0x5dec8f,_0x2eee95){function _0x52fa23(_0xbb2ce3){return _0xbb2ce3 instanceof _0x5dec8f?_0xbb2ce3:new _0x5dec8f(function(_0x4b7cb9){_0x4b7cb9(_0xbb2ce3);});}return new(_0x5dec8f||(_0x5dec8f=Promise))(function(_0x2a8799,_0xe6119c){function _0x16fcf6(_0x1fbc1f){try{_0x26392b(_0x2eee95['next'](_0x1fbc1f));}catch(_0x4794c2){_0xe6119c(_0x4794c2);}}function _0x340114(_0x57130a){try{_0x26392b(_0x2eee95['throw'](_0x57130a));}catch(_0x14828d){_0xe6119c(_0x14828d);}}function _0x26392b(_0x46cfa5){_0x46cfa5['done']?_0x2a8799(_0x46cfa5['value']):_0x52fa23(_0x46cfa5['value'])['then'](_0x16fcf6,_0x340114);}_0x26392b((_0x2eee95=_0x2eee95['apply'](_0x5097bf,_0x202df4||[]))['next']());});};class ApiKeyService{constructor(_0xa50ea7){this['fetch']=_0xa50ea7,this['path']='api-key';}['create'](_0x550f4a,_0x4bd049,_0x226cd2){return __awaiter$4(this,void 0,void 0,function*(){const _0x262051={'account_name':_0x550f4a,'api_key_name':_0x4bd049};try{const _0x4bd347=yield this['fetch']['post'](this['path'],_0x226cd2,_0x262051);if(_0x4bd347['status']>0xc7&&_0x4bd347['status']<0x12c){const _0x3ee07d=yield _0x4bd347['json']();return new SuccessfulApiKeyResponse(_0x3ee07d);}const _0xed201b=yield _0x4bd347['json']();return new FailedApiKeyResponse(_0xed201b);}catch(_0x3a7c43){if(_0x3a7c43 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3a7c43['message'],'title':_0x3a7c43['name'],'status':0x1f4,'instance':'','type':''});throw _0x3a7c43;}});}['view'](_0x3fa01a,_0x5e0964,_0x5d4201){return __awaiter$4(this,void 0,void 0,function*(){const _0xf8aab1=this['path']+'/'+_0x3fa01a+'/'+_0x5e0964;try{const _0x14ccdf=yield this['fetch']['get'](_0xf8aab1,_0x5d4201);if(_0x14ccdf['status']>0xc7&&_0x14ccdf['status']<0x12c){const _0xd5fa12=yield _0x14ccdf['json']();return new SuccessfulApiKeyValueResponse(_0xd5fa12);}const _0x490774=yield _0x14ccdf['json']();return new FailedApiKeyValueResponse(_0x490774);}catch(_0x42c05a){if(_0x42c05a instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x42c05a['message'],'title':_0x42c05a['name'],'status':0x1f4,'instance':'','type':''});throw _0x42c05a;}});}['delete'](_0xabe050,_0x5de05d,_0xb205fa){return __awaiter$4(this,void 0,void 0,function*(){const _0x311491=this['path']+'/'+_0xabe050+'/'+_0x5de05d;try{const _0x526a50=yield this['fetch']['delete'](_0x311491,_0xb205fa);if(_0x526a50['status']>0xc7&&_0x526a50['status']<0x12c)return new SuccessfulResponse({});const _0x2ad633=yield _0x526a50['json']();return new FailedResponse(_0x2ad633);}catch(_0x3e1812){if(_0x3e1812 instanceof Error)return new FailedResponse({'detail':_0x3e1812['message'],'title':_0x3e1812['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e1812;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x11a295,_0x3aea31,_0x294ab0,_0x389eeb){function _0x1d6663(_0x48d43a){return _0x48d43a instanceof _0x294ab0?_0x48d43a:new _0x294ab0(function(_0x13c022){_0x13c022(_0x48d43a);});}return new(_0x294ab0||(_0x294ab0=Promise))(function(_0x3ae4cc,_0xec3871){function _0x22d508(_0x9a7ae4){try{_0x287fc4(_0x389eeb['next'](_0x9a7ae4));}catch(_0x3e2896){_0xec3871(_0x3e2896);}}function _0x24ff57(_0x5c7029){try{_0x287fc4(_0x389eeb['throw'](_0x5c7029));}catch(_0x584e52){_0xec3871(_0x584e52);}}function _0x287fc4(_0x1007b8){_0x1007b8['done']?_0x3ae4cc(_0x1007b8['value']):_0x1d6663(_0x1007b8['value'])['then'](_0x22d508,_0x24ff57);}_0x287fc4((_0x389eeb=_0x389eeb['apply'](_0x11a295,_0x3aea31||[]))['next']());});};class ListService{constructor(_0x3de860){this['fetch']=_0x3de860;}['add'](_0x198256,_0x327d30,_0x4d454b){return __awaiter$3(this,void 0,void 0,function*(){const _0x118864='List',_0x4be88d={'account_name':_0x198256,'list_name':_0x327d30};try{const _0x2c69ce=yield this['fetch']['post'](_0x118864,_0x4d454b,_0x4be88d);if(_0x2c69ce['status']>0xc7&&_0x2c69ce['status']<0x12c){const _0x193cda=yield _0x2c69ce['json']();return new SuccessfulAccountResponse(_0x193cda);}const _0x49a980=yield _0x2c69ce['json']();return new FailedAccountResponse(_0x49a980);}catch(_0x3dff23){if(_0x3dff23 instanceof Error)return new FailedAccountResponse({'detail':_0x3dff23['message'],'title':_0x3dff23['name'],'status':0x1f4,'instance':'','type':''});throw _0x3dff23;}});}['remove'](_0x169f93,_0x5ae8ef,_0x37c1c3){return __awaiter$3(this,void 0,void 0,function*(){const _0xba99cb='List/'+_0x169f93+'/'+_0x5ae8ef,_0x410710=yield this['fetch']['delete'](_0xba99cb,_0x37c1c3);try{if(_0x410710['status']>0xc7&&_0x410710['status']<0x12c){const _0x35fac1=yield _0x410710['json']();return new SuccessfulAccountResponse(_0x35fac1);}const _0x36ccc2=yield _0x410710['json']();return new FailedAccountResponse(_0x36ccc2);}catch(_0x4ad713){if(_0x4ad713 instanceof Error)return new FailedAccountResponse({'detail':_0x4ad713['message'],'title':_0x4ad713['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ad713;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x497825,_0x3a7a20,_0x4123f0,_0x525f25){function _0xae6383(_0x5b6978){return _0x5b6978 instanceof _0x4123f0?_0x5b6978:new _0x4123f0(function(_0x5ca883){_0x5ca883(_0x5b6978);});}return new(_0x4123f0||(_0x4123f0=Promise))(function(_0x55e8f6,_0x485629){function _0x5b7e6b(_0x23c3a8){try{_0x393fd3(_0x525f25['next'](_0x23c3a8));}catch(_0x5caf1d){_0x485629(_0x5caf1d);}}function _0x1f1e3f(_0x3f971e){try{_0x393fd3(_0x525f25['throw'](_0x3f971e));}catch(_0x57b924){_0x485629(_0x57b924);}}function _0x393fd3(_0x44d897){_0x44d897['done']?_0x55e8f6(_0x44d897['value']):_0xae6383(_0x44d897['value'])['then'](_0x5b7e6b,_0x1f1e3f);}_0x393fd3((_0x525f25=_0x525f25['apply'](_0x497825,_0x3a7a20||[]))['next']());});};class Fetch{constructor(_0x16f501){this['baseUri']=_0x16f501,this['getUrl']=_0x14d6b8=>{return _0x14d6b8['startsWith']('/')&&(_0x14d6b8=_0x14d6b8['replace']('/','')),''+this['baseUri']+_0x14d6b8;},!_0x16f501['endsWith']('/')&&(_0x16f501=_0x16f501+'/');}['get'](_0x56b0cc,_0xd2f7e1){return __awaiter$2(this,void 0,void 0,function*(){const _0x3f4fc3=this['getUrl'](_0x56b0cc);return yield fetch(_0x3f4fc3,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xd2f7e1}});});}['post'](_0x5ecf15,_0x39d15d,_0x2ef8cb){return __awaiter$2(this,void 0,void 0,function*(){const _0x4828e6=this['getUrl'](_0x5ecf15);return yield fetch(_0x4828e6,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x39d15d},'body':_0x2ef8cb?JSON['stringify'](_0x2ef8cb):null});});}['PostNoAuth'](_0x5847dc,_0x194487){return __awaiter$2(this,void 0,void 0,function*(){const _0x16fa0b=this['getUrl'](_0x5847dc);return yield fetch(_0x16fa0b,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x194487?JSON['stringify'](_0x194487):null});});}['put'](_0x3ec7de,_0x242c44,_0x4ae95a){return __awaiter$2(this,void 0,void 0,function*(){const _0x33641c=this['getUrl'](_0x3ec7de);return yield fetch(_0x33641c,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x242c44},'body':_0x4ae95a?JSON['stringify'](_0x4ae95a):null});});}['delete'](_0x1cb041,_0x8db22a){return __awaiter$2(this,void 0,void 0,function*(){const _0x419205=this['getUrl'](_0x1cb041);return yield fetch(_0x419205,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x8db22a}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xec7368,_0x4265a9,_0x1bce36,_0x2ce035){function _0x5e61d0(_0x20fede){return _0x20fede instanceof _0x1bce36?_0x20fede:new _0x1bce36(function(_0x5bf9a7){_0x5bf9a7(_0x20fede);});}return new(_0x1bce36||(_0x1bce36=Promise))(function(_0x24796e,_0x3d04f4){function _0x352e2c(_0x1288b1){try{_0x160767(_0x2ce035['next'](_0x1288b1));}catch(_0x776e9e){_0x3d04f4(_0x776e9e);}}function _0x273e12(_0x4bf54d){try{_0x160767(_0x2ce035['throw'](_0x4bf54d));}catch(_0x23438d){_0x3d04f4(_0x23438d);}}function _0x160767(_0x3f4aea){_0x3f4aea['done']?_0x24796e(_0x3f4aea['value']):_0x5e61d0(_0x3f4aea['value'])['then'](_0x352e2c,_0x273e12);}_0x160767((_0x2ce035=_0x2ce035['apply'](_0xec7368,_0x4265a9||[]))['next']());});};class SearchServersService{constructor(_0x3f1e41){this['fetch']=_0x3f1e41,this['path']='search-services';}['create'](_0x1da71b,_0x20c46a,_0x4de549,_0x26cdc6,_0xc120a7,_0x4a2dd4,_0x56d016,_0x125016){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f6749={'account_name':_0x1da71b,'search_service_name':_0x20c46a,'endpoint':_0x4de549,'key':_0x26cdc6,'country':_0xc120a7,'provider':_0x4a2dd4,'index_name':_0x56d016};try{const _0x202c9d=yield this['fetch']['post'](this['path'],_0x125016,_0x3f6749);if(_0x202c9d['status']>0xc7&&_0x202c9d['status']<0x12c){const _0x265125=yield _0x202c9d['json']();return new SuccessfulSearchServiceResponse(_0x265125);}const _0x448e5b=yield _0x202c9d['json']();return new FailedSearchServiceResponse(_0x448e5b);}catch(_0x2f08bb){if(_0x2f08bb instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2f08bb['message'],'title':_0x2f08bb['name'],'status':0x1f4,'instance':'','type':''});throw _0x2f08bb;}});}['delete'](_0x2bf79e,_0x3f72d2,_0x3a173f){return __awaiter$1(this,void 0,void 0,function*(){const _0x5d5ed7=this['path']+'/'+_0x2bf79e+'/'+_0x3f72d2;try{const _0x544d40=yield this['fetch']['delete'](_0x5d5ed7,_0x3a173f);if(_0x544d40['status']>0xc7&&_0x544d40['status']<0x12c)return new SuccessfulResponse({});const _0x574c13=yield _0x544d40['json']();return new FailedResponse(_0x574c13);}catch(_0x4ece7e){if(_0x4ece7e instanceof Error)return new FailedResponse({'detail':_0x4ece7e['message'],'title':_0x4ece7e['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ece7e;}});}['view'](_0x14d55a,_0x2110e2,_0x1adf1b){return __awaiter$1(this,void 0,void 0,function*(){const _0x46f808=this['path']+'/'+_0x14d55a+'/'+_0x2110e2;try{const _0x1e22fb=yield this['fetch']['get'](_0x46f808,_0x1adf1b);if(_0x1e22fb['status']>0xc7&&_0x1e22fb['status']<0x12c){const _0x4fd2f4=yield _0x1e22fb['json']();return new SuccessfulViewSearchServiceResponse(_0x4fd2f4);}const _0x51e0e9=yield _0x1e22fb['json']();return new FailedViewSearchServiceResponse(_0x51e0e9);}catch(_0x278ed5){if(_0x278ed5 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x278ed5['message'],'title':_0x278ed5['name'],'status':0x1f4,'instance':'','type':''});throw _0x278ed5;}});}['edit'](_0x1c698d,_0x401d2a,_0x4fda80,_0x4089f9,_0x16df4d,_0x3caa13){return __awaiter$1(this,void 0,void 0,function*(){const _0x3bd531={'account_name':_0x1c698d,'search_service_name':_0x401d2a,'new_search_service_name':_0x4fda80,'key':_0x4089f9,'country':_0x16df4d};try{const _0xd76266=yield this['fetch']['put'](this['path'],_0x3caa13,_0x3bd531);if(_0xd76266['status']>0xc7&&_0xd76266['status']<0x12c){const _0x5a0c44=yield _0xd76266['json']();return new SuccessfulSearchServiceResponse(_0x5a0c44);}const _0xcf9669=yield _0xd76266['json']();return new FailedSearchServiceResponse(_0xcf9669);}catch(_0x15aab1){if(_0x15aab1 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x15aab1['message'],'title':_0x15aab1['name'],'status':0x1f4,'instance':'','type':''});throw _0x15aab1;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0xcc568d,_0x17c0e7,_0xbf2245,_0x246a9c){function _0x1731e4(_0x5a3617){return _0x5a3617 instanceof _0xbf2245?_0x5a3617:new _0xbf2245(function(_0x404f20){_0x404f20(_0x5a3617);});}return new(_0xbf2245||(_0xbf2245=Promise))(function(_0x33d736,_0x2edf1f){function _0x23a752(_0x132a0f){try{_0x48febe(_0x246a9c['next'](_0x132a0f));}catch(_0x4c8597){_0x2edf1f(_0x4c8597);}}function _0x19eeec(_0x47109f){try{_0x48febe(_0x246a9c['throw'](_0x47109f));}catch(_0x2dd4db){_0x2edf1f(_0x2dd4db);}}function _0x48febe(_0x351363){_0x351363['done']?_0x33d736(_0x351363['value']):_0x1731e4(_0x351363['value'])['then'](_0x23a752,_0x19eeec);}_0x48febe((_0x246a9c=_0x246a9c['apply'](_0xcc568d,_0x17c0e7||[]))['next']());});};class AdminClient{constructor(_0x464225='https://admin.searchability.dev/'){var _0x1c489e=new Fetch(_0x464225);this['Accounts']=new AccountService(_0x1c489e),this['Lists']=new ListService(_0x1c489e),this['ApiKeys']=new ApiKeyService(_0x1c489e),this['SearchServices']=new SearchServersService(_0x1c489e);}}class AuthClient{constructor(_0x3f3a30='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x3f3a30);}['login'](_0x479f1f){return __awaiter(this,void 0,void 0,function*(){const _0x572176='login/'+_0x479f1f;try{const _0x1989e9=yield yield fetch(_0x572176);if(_0x1989e9['status']>0xc7&&_0x1989e9['status']<0x12c){const _0x14ac1d=yield _0x1989e9['json']();return new SuccessfulAuthResponse(_0x14ac1d);}const _0x18477e=yield _0x1989e9['json']();return new FailedAuthResponse(_0x18477e);}catch(_0xba0995){if(_0xba0995 instanceof Error)return new FailedAuthResponse({'detail':_0xba0995['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xba0995;}});}['refresh'](_0x1fd4b7){return __awaiter(this,void 0,void 0,function*(){const _0x5bf38f='refresh',_0x53ed7d={'refresh_token':_0x1fd4b7};try{const _0x4f723c=yield this['fetch']['PostNoAuth'](_0x5bf38f,_0x53ed7d);if(_0x4f723c['status']>0xc7&&_0x4f723c['status']<0x12c){const _0x2d4ffb=yield _0x4f723c['json']();return new SuccessfulAuthResponse(_0x2d4ffb);}const _0x41abfd=yield _0x4f723c['json']();return new FailedAuthResponse(_0x41abfd);}catch(_0x5b3997){if(_0x5b3997 instanceof Error)return new FailedAuthResponse({'detail':_0x5b3997['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5b3997;}});}['getTokenStatus'](_0x9e6a2f){if(Date['now']()<_0x9e6a2f['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x9e6a2f['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
16
16
|
|
|
17
17
|
exports.AdminClient = AdminClient;
|
|
18
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x586c99){_0x586c99[_0x586c99['Ok']=0x0]='Ok',_0x586c99[_0x586c99['Refresh']=0x1]='Refresh',_0x586c99[_0x586c99['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x53f224){this['isSuccess']=_0x53f224;}}class SuccessfulAccountResponse extends Response{constructor(_0x3b7690){super(!![]),this['account']=_0x3b7690;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x214be3){super(![]),this['problem']=_0x214be3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0xce52d4){super(!![]),this['tokens']=_0xce52d4;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x1e5ae1){super(![]),this['problem']=_0x1e5ae1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1a8699){super(!![]),this['apiKey']=_0x1a8699;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x30aef5){super(![]),this['problem']=_0x30aef5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x1c2298){super(!![]),this['searchService']=_0x1c2298;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x2a199e){super(![]),this['problem']=_0x2a199e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x160940){super(!![]),this['searchService']=_0x160940;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x129879){super(![]),this['problem']=_0x129879;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0xb67755){super(!![]),this['apiKeyValue']=_0xb67755;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x4c108a){super(!![]),this['obj']=_0x4c108a;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x7cd99f){super(![]),this['problem']=_0x7cd99f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x3afe5f){super(![]),this['problem']=_0x3afe5f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
2
|
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0xa1dcc0,_0x47f5aa,_0x19437e,_0x1763e4){function _0x1ce90f(_0x1e06ab){return _0x1e06ab instanceof _0x19437e?_0x1e06ab:new _0x19437e(function(_0x12c1a2){_0x12c1a2(_0x1e06ab);});}return new(_0x19437e||(_0x19437e=Promise))(function(_0x411e7b,_0x39638a){function _0x2ff95e(_0x2e871d){try{_0x52463e(_0x1763e4['next'](_0x2e871d));}catch(_0x3ff50b){_0x39638a(_0x3ff50b);}}function _0xe45d3f(_0x1d8649){try{_0x52463e(_0x1763e4['throw'](_0x1d8649));}catch(_0x50e377){_0x39638a(_0x50e377);}}function _0x52463e(_0x315f4b){_0x315f4b['done']?_0x411e7b(_0x315f4b['value']):_0x1ce90f(_0x315f4b['value'])['then'](_0x2ff95e,_0xe45d3f);}_0x52463e((_0x1763e4=_0x1763e4['apply'](_0xa1dcc0,_0x47f5aa||[]))['next']());});};class AccountService{constructor(_0x1431d7){this['fetch']=_0x1431d7;}['get'](_0x4ae8aa,_0x4910a8){return __awaiter$5(this,void 0,void 0,function*(){const _0x205e07='Account/'+_0x4ae8aa+'/',_0x5b0e7e=yield this['fetch']['get'](_0x205e07,_0x4910a8);try{if(_0x5b0e7e['status']>0xc7&&_0x5b0e7e['status']<0x12c){const _0x1bdc6c=yield _0x5b0e7e['json']();return new SuccessfulAccountResponse(_0x1bdc6c);}const _0x174a38=yield _0x5b0e7e['json']();return new FailedAccountResponse(_0x174a38);}catch(_0x101a0d){if(_0x101a0d instanceof Error)return new FailedAccountResponse({'detail':_0x101a0d['message'],'title':_0x101a0d['name'],'status':0x1f4,'instance':'','type':''});throw _0x101a0d;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x35b659,_0x319e11,_0x284fe4,_0x3181db){function _0x328710(_0xaa7410){return _0xaa7410 instanceof _0x284fe4?_0xaa7410:new _0x284fe4(function(_0x5f59cf){_0x5f59cf(_0xaa7410);});}return new(_0x284fe4||(_0x284fe4=Promise))(function(_0x4de485,_0x4e4412){function _0x2e2514(_0xeba0be){try{_0xb165a(_0x3181db['next'](_0xeba0be));}catch(_0xd20884){_0x4e4412(_0xd20884);}}function _0xb5fd89(_0xe8f75e){try{_0xb165a(_0x3181db['throw'](_0xe8f75e));}catch(_0x46b79d){_0x4e4412(_0x46b79d);}}function _0xb165a(_0x42cf9c){_0x42cf9c['done']?_0x4de485(_0x42cf9c['value']):_0x328710(_0x42cf9c['value'])['then'](_0x2e2514,_0xb5fd89);}_0xb165a((_0x3181db=_0x3181db['apply'](_0x35b659,_0x319e11||[]))['next']());});};class ApiKeyService{constructor(_0x2d2bf4){this['fetch']=_0x2d2bf4,this['path']='api-key';}['create'](_0x81473b,_0x5ac088,_0x3e1254){return __awaiter$4(this,void 0,void 0,function*(){const _0x287eaf={'account_name':_0x81473b,'api_key_name':_0x5ac088};try{const _0x423b47=yield this['fetch']['post'](this['path'],_0x3e1254,_0x287eaf);if(_0x423b47['status']>0xc7&&_0x423b47['status']<0x12c){const _0x2b4f3e=yield _0x423b47['json']();return new SuccessfulApiKeyResponse(_0x2b4f3e);}const _0x170240=yield _0x423b47['json']();return new FailedApiKeyResponse(_0x170240);}catch(_0x1530a2){if(_0x1530a2 instanceof Error)return new FailedApiKeyResponse({'detail':_0x1530a2['message'],'title':_0x1530a2['name'],'status':0x1f4,'instance':'','type':''});throw _0x1530a2;}});}['view'](_0x179b02,_0x2fcbf2,_0x4e2366){return __awaiter$4(this,void 0,void 0,function*(){const _0x467786=this['path']+'/'+_0x179b02+'/'+_0x2fcbf2;try{const _0x1fc8b7=yield this['fetch']['get'](_0x467786,_0x4e2366);if(_0x1fc8b7['status']>0xc7&&_0x1fc8b7['status']<0x12c){const _0x1b6a9e=yield _0x1fc8b7['json']();return new SuccessfulApiKeyValueResponse(_0x1b6a9e);}const _0x42b435=yield _0x1fc8b7['json']();return new FailedApiKeyValueResponse(_0x42b435);}catch(_0x13311d){if(_0x13311d instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x13311d['message'],'title':_0x13311d['name'],'status':0x1f4,'instance':'','type':''});throw _0x13311d;}});}['delete'](_0x591b82,_0x4170d2,_0x14db60){return __awaiter$4(this,void 0,void 0,function*(){const _0x42979=this['path']+'/'+_0x591b82+'/'+_0x4170d2;try{const _0x3466c8=yield this['fetch']['delete'](_0x42979,_0x14db60);if(_0x3466c8['status']>0xc7&&_0x3466c8['status']<0x12c)return new SuccessfulResponse({});const _0x180c3b=yield _0x3466c8['json']();return new FailedResponse(_0x180c3b);}catch(_0x2d0599){if(_0x2d0599 instanceof Error)return new FailedResponse({'detail':_0x2d0599['message'],'title':_0x2d0599['name'],'status':0x1f4,'instance':'','type':''});throw _0x2d0599;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x4abed7,_0x5e26a1,_0x2381d0,_0x649862){function _0x1f80ec(_0x50962c){return _0x50962c instanceof _0x2381d0?_0x50962c:new _0x2381d0(function(_0x56594d){_0x56594d(_0x50962c);});}return new(_0x2381d0||(_0x2381d0=Promise))(function(_0x5a0b99,_0x566830){function _0xf10e14(_0x2bf8bd){try{_0x1d6fc6(_0x649862['next'](_0x2bf8bd));}catch(_0x289642){_0x566830(_0x289642);}}function _0xd13102(_0x5fae1d){try{_0x1d6fc6(_0x649862['throw'](_0x5fae1d));}catch(_0x5258ee){_0x566830(_0x5258ee);}}function _0x1d6fc6(_0x313834){_0x313834['done']?_0x5a0b99(_0x313834['value']):_0x1f80ec(_0x313834['value'])['then'](_0xf10e14,_0xd13102);}_0x1d6fc6((_0x649862=_0x649862['apply'](_0x4abed7,_0x5e26a1||[]))['next']());});};class ListService{constructor(_0x4d34a3){this['fetch']=_0x4d34a3;}['add'](_0x50e995,_0x5424c5,_0x10359a){return __awaiter$3(this,void 0,void 0,function*(){const _0x17f885='List',_0x1e5e3a={'account_name':_0x50e995,'list_name':_0x5424c5};try{const _0x274f1b=yield this['fetch']['post'](_0x17f885,_0x10359a,_0x1e5e3a);if(_0x274f1b['status']>0xc7&&_0x274f1b['status']<0x12c){const _0x2d2670=yield _0x274f1b['json']();return new SuccessfulAccountResponse(_0x2d2670);}const _0x42ac58=yield _0x274f1b['json']();return new FailedAccountResponse(_0x42ac58);}catch(_0x149a89){if(_0x149a89 instanceof Error)return new FailedAccountResponse({'detail':_0x149a89['message'],'title':_0x149a89['name'],'status':0x1f4,'instance':'','type':''});throw _0x149a89;}});}['remove'](_0x29a09d,_0x16f882,_0x11aa0d){return __awaiter$3(this,void 0,void 0,function*(){const _0xf0993f='List/'+_0x29a09d+'/'+_0x16f882,_0x5b6fd0=yield this['fetch']['delete'](_0xf0993f,_0x11aa0d);try{if(_0x5b6fd0['status']>0xc7&&_0x5b6fd0['status']<0x12c){const _0x518186=yield _0x5b6fd0['json']();return new SuccessfulAccountResponse(_0x518186);}const _0x478ff2=yield _0x5b6fd0['json']();return new FailedAccountResponse(_0x478ff2);}catch(_0xeeb970){if(_0xeeb970 instanceof Error)return new FailedAccountResponse({'detail':_0xeeb970['message'],'title':_0xeeb970['name'],'status':0x1f4,'instance':'','type':''});throw _0xeeb970;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x54ab92,_0x530af8,_0x51ed8a,_0x469bba){function _0x3a194b(_0x3baced){return _0x3baced instanceof _0x51ed8a?_0x3baced:new _0x51ed8a(function(_0x3b7e2e){_0x3b7e2e(_0x3baced);});}return new(_0x51ed8a||(_0x51ed8a=Promise))(function(_0x28cce1,_0x19dd29){function _0x8e30b4(_0x3f4ca2){try{_0x560f6b(_0x469bba['next'](_0x3f4ca2));}catch(_0x8421f9){_0x19dd29(_0x8421f9);}}function _0x489000(_0x2a93ed){try{_0x560f6b(_0x469bba['throw'](_0x2a93ed));}catch(_0x465be6){_0x19dd29(_0x465be6);}}function _0x560f6b(_0xd7f216){_0xd7f216['done']?_0x28cce1(_0xd7f216['value']):_0x3a194b(_0xd7f216['value'])['then'](_0x8e30b4,_0x489000);}_0x560f6b((_0x469bba=_0x469bba['apply'](_0x54ab92,_0x530af8||[]))['next']());});};class Fetch{constructor(_0x570b2e){this['baseUri']=_0x570b2e,this['getUrl']=_0x36b1a7=>{return _0x36b1a7['startsWith']('/')&&(_0x36b1a7=_0x36b1a7['replace']('/','')),''+this['baseUri']+_0x36b1a7;},!_0x570b2e['endsWith']('/')&&(_0x570b2e=_0x570b2e+'/');}['get'](_0x198bb8,_0x4b9157){return __awaiter$2(this,void 0,void 0,function*(){const _0x24fed2=this['getUrl'](_0x198bb8);return yield fetch(_0x24fed2,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4b9157}});});}['post'](_0x4e571c,_0x36d454,_0x246a3c){return __awaiter$2(this,void 0,void 0,function*(){const _0x1f85ed=this['getUrl'](_0x4e571c);return yield fetch(_0x1f85ed,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x36d454},'body':_0x246a3c?JSON['stringify'](_0x246a3c):null});});}['PostNoAuth'](_0xa03310,_0x192fa8){return __awaiter$2(this,void 0,void 0,function*(){const _0x3ec2d0=this['getUrl'](_0xa03310);return yield fetch(_0x3ec2d0,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x192fa8?JSON['stringify'](_0x192fa8):null});});}['put'](_0x4b9665,_0x497e1c,_0x3120f1){return __awaiter$2(this,void 0,void 0,function*(){const _0x3842c0=this['getUrl'](_0x4b9665);return yield fetch(_0x3842c0,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x497e1c},'body':_0x3120f1?JSON['stringify'](_0x3120f1):null});});}['delete'](_0x53e94a,_0x2fa308){return __awaiter$2(this,void 0,void 0,function*(){const _0x4c825d=this['getUrl'](_0x53e94a);return yield fetch(_0x4c825d,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2fa308}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x21766e,_0x12f01b,_0x18e721,_0xd99b0a){function _0x43e121(_0x3059ad){return _0x3059ad instanceof _0x18e721?_0x3059ad:new _0x18e721(function(_0x4adafd){_0x4adafd(_0x3059ad);});}return new(_0x18e721||(_0x18e721=Promise))(function(_0xbfb347,_0x534236){function _0x4ac058(_0x34fee0){try{_0x153bb3(_0xd99b0a['next'](_0x34fee0));}catch(_0x2131b5){_0x534236(_0x2131b5);}}function _0x580706(_0x1bc418){try{_0x153bb3(_0xd99b0a['throw'](_0x1bc418));}catch(_0x1103b2){_0x534236(_0x1103b2);}}function _0x153bb3(_0x37f2ab){_0x37f2ab['done']?_0xbfb347(_0x37f2ab['value']):_0x43e121(_0x37f2ab['value'])['then'](_0x4ac058,_0x580706);}_0x153bb3((_0xd99b0a=_0xd99b0a['apply'](_0x21766e,_0x12f01b||[]))['next']());});};class SearchServersService{constructor(_0x43fcfc){this['fetch']=_0x43fcfc,this['path']='search-services';}['create'](_0x4dea2d,_0x4de4eb,_0x27676e,_0x298a63,_0x55ccfb,_0x59fba5,_0xb80cce,_0x8d82c6){return __awaiter$1(this,void 0,void 0,function*(){const _0x340e98={'account_name':_0x4dea2d,'search_service_name':_0x4de4eb,'endpoint':_0x27676e,'key':_0x298a63,'country':_0x55ccfb,'provider':_0x59fba5,'index_name':_0xb80cce};try{const _0x5bf5bf=yield this['fetch']['post'](this['path'],_0x8d82c6,_0x340e98);if(_0x5bf5bf['status']>0xc7&&_0x5bf5bf['status']<0x12c){const _0x142f1e=yield _0x5bf5bf['json']();return new SuccessfulSearchServiceResponse(_0x142f1e);}const _0x5e1f57=yield _0x5bf5bf['json']();return new FailedSearchServiceResponse(_0x5e1f57);}catch(_0x27eafd){if(_0x27eafd instanceof Error)return new FailedSearchServiceResponse({'detail':_0x27eafd['message'],'title':_0x27eafd['name'],'status':0x1f4,'instance':'','type':''});throw _0x27eafd;}});}['delete'](_0x4c1ff2,_0x47f7b6,_0x2e2c0d){return __awaiter$1(this,void 0,void 0,function*(){const _0x2b6f46=this['path']+'/'+_0x4c1ff2+'/'+_0x47f7b6;try{const _0x5e01ee=yield this['fetch']['delete'](_0x2b6f46,_0x2e2c0d);if(_0x5e01ee['status']>0xc7&&_0x5e01ee['status']<0x12c)return new SuccessfulResponse({});const _0x51bbcb=yield _0x5e01ee['json']();return new FailedResponse(_0x51bbcb);}catch(_0x1c6c06){if(_0x1c6c06 instanceof Error)return new FailedResponse({'detail':_0x1c6c06['message'],'title':_0x1c6c06['name'],'status':0x1f4,'instance':'','type':''});throw _0x1c6c06;}});}['view'](_0x11aeec,_0x47e605,_0x4763b2){return __awaiter$1(this,void 0,void 0,function*(){const _0x9a8376=this['path']+'/'+_0x11aeec+'/'+_0x47e605;try{const _0x27cace=yield this['fetch']['get'](_0x9a8376,_0x4763b2);if(_0x27cace['status']>0xc7&&_0x27cace['status']<0x12c){const _0x1f29e4=yield _0x27cace['json']();return new SuccessfulViewSearchServiceResponse(_0x1f29e4);}const _0x627132=yield _0x27cace['json']();return new FailedViewSearchServiceResponse(_0x627132);}catch(_0x27acc8){if(_0x27acc8 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x27acc8['message'],'title':_0x27acc8['name'],'status':0x1f4,'instance':'','type':''});throw _0x27acc8;}});}['edit'](_0xf052e9,_0x3cf73e,_0x1ae929,_0x3949e1,_0xf855fb,_0x324008){return __awaiter$1(this,void 0,void 0,function*(){const _0x19eed0={'account_name':_0xf052e9,'search_service_name':_0x3cf73e,'new_search_service_name':_0x1ae929,'key':_0x3949e1,'country':_0xf855fb};try{const _0x118eac=yield this['fetch']['put'](this['path'],_0x324008,_0x19eed0);if(_0x118eac['status']>0xc7&&_0x118eac['status']<0x12c){const _0x2b0496=yield _0x118eac['json']();return new SuccessfulSearchServiceResponse(_0x2b0496);}const _0x2ec859=yield _0x118eac['json']();return new FailedSearchServiceResponse(_0x2ec859);}catch(_0x215b0a){if(_0x215b0a instanceof Error)return new FailedSearchServiceResponse({'detail':_0x215b0a['message'],'title':_0x215b0a['name'],'status':0x1f4,'instance':'','type':''});throw _0x215b0a;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4da6ef,_0xd3a1bc,_0x167696,_0x43dcab){function _0x38306f(_0x3d0a53){return _0x3d0a53 instanceof _0x167696?_0x3d0a53:new _0x167696(function(_0x1cd603){_0x1cd603(_0x3d0a53);});}return new(_0x167696||(_0x167696=Promise))(function(_0x122e1b,_0x2aa2fa){function _0x39cd1b(_0x2e1868){try{_0x357bf0(_0x43dcab['next'](_0x2e1868));}catch(_0x3a8f86){_0x2aa2fa(_0x3a8f86);}}function _0x5abfd6(_0x1f0767){try{_0x357bf0(_0x43dcab['throw'](_0x1f0767));}catch(_0x34a61b){_0x2aa2fa(_0x34a61b);}}function _0x357bf0(_0x37a654){_0x37a654['done']?_0x122e1b(_0x37a654['value']):_0x38306f(_0x37a654['value'])['then'](_0x39cd1b,_0x5abfd6);}_0x357bf0((_0x43dcab=_0x43dcab['apply'](_0x4da6ef,_0xd3a1bc||[]))['next']());});};class AdminClient{constructor(_0x286ec4='https://admin.searchability.dev/'){var _0x1021ca=new Fetch(_0x286ec4);this['Accounts']=new AccountService(_0x1021ca),this['Lists']=new ListService(_0x1021ca),this['ApiKeys']=new ApiKeyService(_0x1021ca),this['SearchServices']=new SearchServersService(_0x1021ca);}}class AuthClient{constructor(_0x3136a0='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x3136a0);}['login'](_0x3bc298){return __awaiter(this,void 0,void 0,function*(){const _0x567721='login/'+_0x3bc298;try{const _0x42624e=yield yield fetch(_0x567721);if(_0x42624e['status']>0xc7&&_0x42624e['status']<0x12c){const _0x4223f4=yield _0x42624e['json']();return new SuccessfulAuthResponse(_0x4223f4);}const _0x19485e=yield _0x42624e['json']();return new FailedAuthResponse(_0x19485e);}catch(_0xa9cc39){if(_0xa9cc39 instanceof Error)return new FailedAuthResponse({'detail':_0xa9cc39['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xa9cc39;}});}['refresh'](_0x5e21fb){return __awaiter(this,void 0,void 0,function*(){const _0x311e48='refresh',_0x5cd55d={'refresh_token':_0x5e21fb};try{const _0x2eb912=yield this['fetch']['PostNoAuth'](_0x311e48,_0x5cd55d);if(_0x2eb912['status']>0xc7&&_0x2eb912['status']<0x12c){const _0x565862=yield _0x2eb912['json']();return new SuccessfulAuthResponse(_0x565862);}const _0x53c458=yield _0x2eb912['json']();return new FailedAuthResponse(_0x53c458);}catch(_0xb94047){if(_0xb94047 instanceof Error)return new FailedAuthResponse({'detail':_0xb94047['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xb94047;}});}['getTokenStatus'](_0x5f485c){if(Date['now']()<_0x5f485c['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x5f485c['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare class SearchServersService {
|
|
|
38
38
|
create(account_name: string, search_service_name: string, endpoint: string, key: string, country: string, provider: string, index_name: string, access_token: string): Promise<Response<SearchService, Problem>>;
|
|
39
39
|
delete(account_name: string, search_service_name: string, access_token: string): Promise<Response<any, Problem>>;
|
|
40
40
|
view(account_name: string, search_service_name: string, access_token: string): Promise<Response<SearchServiceDetails, Problem>>;
|
|
41
|
+
edit(account_name: string, search_service_name: string, new_search_service_name: string, key: string, country: string, access_token: string): Promise<Response<SearchService, Problem>>;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
declare class AdminClient {
|
|
@@ -98,7 +99,9 @@ type SearchService = {
|
|
|
98
99
|
};
|
|
99
100
|
type SearchServiceDetails = {
|
|
100
101
|
endpoint: string;
|
|
101
|
-
key:
|
|
102
|
+
key: string;
|
|
103
|
+
search_service_name: string;
|
|
104
|
+
country: string;
|
|
102
105
|
};
|
|
103
106
|
type ApiKeyValue = {
|
|
104
107
|
value: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchability/admin-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "Searchability admin client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/types.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist/*"
|
|
20
20
|
],
|
|
21
|
-
"author": "
|
|
21
|
+
"author": "Searchability LLC",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x11d440){_0x11d440[_0x11d440['Ok']=0x0]='Ok',_0x11d440[_0x11d440['Refresh']=0x1]='Refresh',_0x11d440[_0x11d440['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x102230){this['isSuccess']=_0x102230;}}class SuccessfulAccountResponse extends Response{constructor(_0x1c9f27){super(!![]),this['account']=_0x1c9f27;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4ce2e3){super(![]),this['problem']=_0x4ce2e3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x5790c5){super(!![]),this['tokens']=_0x5790c5;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x345d41){super(![]),this['problem']=_0x345d41;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1eaf7a){super(!![]),this['apiKey']=_0x1eaf7a;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x420599){super(![]),this['problem']=_0x420599;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x441268){super(!![]),this['searchService']=_0x441268;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x33e46b){super(![]),this['problem']=_0x33e46b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x197d3b){super(!![]),this['searchService']=_0x197d3b;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x56c163){super(![]),this['problem']=_0x56c163;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x55f04f){super(!![]),this['apiKeyValue']=_0x55f04f;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x3eb84b){super(!![]),this['obj']=_0x3eb84b;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x155c91){super(![]),this['problem']=_0x155c91;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x9e7e39){super(![]),this['problem']=_0x9e7e39;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x3c4c88,_0x4580d4,_0x27bf3e,_0x1ebdc1){function _0x369274(_0x5b737b){return _0x5b737b instanceof _0x27bf3e?_0x5b737b:new _0x27bf3e(function(_0x50560b){_0x50560b(_0x5b737b);});}return new(_0x27bf3e||(_0x27bf3e=Promise))(function(_0x1c7540,_0x1fd10b){function _0x151c67(_0x406d48){try{_0x52aa6e(_0x1ebdc1['next'](_0x406d48));}catch(_0xdbede1){_0x1fd10b(_0xdbede1);}}function _0x230851(_0x56dbec){try{_0x52aa6e(_0x1ebdc1['throw'](_0x56dbec));}catch(_0xe9a3ee){_0x1fd10b(_0xe9a3ee);}}function _0x52aa6e(_0x2ca49c){_0x2ca49c['done']?_0x1c7540(_0x2ca49c['value']):_0x369274(_0x2ca49c['value'])['then'](_0x151c67,_0x230851);}_0x52aa6e((_0x1ebdc1=_0x1ebdc1['apply'](_0x3c4c88,_0x4580d4||[]))['next']());});};class AccountService{constructor(_0x429034){this['fetch']=_0x429034;}['get'](_0x3a298b,_0x540bec){return __awaiter$5(this,void 0,void 0,function*(){const _0x3ed165='Account/'+_0x3a298b+'/',_0x347f2f=yield this['fetch']['get'](_0x3ed165,_0x540bec);try{if(_0x347f2f['status']>0xc7&&_0x347f2f['status']<0x12c){const _0x53f464=yield _0x347f2f['json']();return new SuccessfulAccountResponse(_0x53f464);}const _0xe46891=yield _0x347f2f['json']();return new FailedAccountResponse(_0xe46891);}catch(_0x2afce8){if(_0x2afce8 instanceof Error)return new FailedAccountResponse({'detail':_0x2afce8['message'],'title':_0x2afce8['name'],'status':0x1f4,'instance':'','type':''});throw _0x2afce8;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x40688a,_0x1a4c28,_0x40f8c6,_0x55c028){function _0x58e013(_0x29a6ee){return _0x29a6ee instanceof _0x40f8c6?_0x29a6ee:new _0x40f8c6(function(_0xdc9941){_0xdc9941(_0x29a6ee);});}return new(_0x40f8c6||(_0x40f8c6=Promise))(function(_0x26a468,_0x1c2c2c){function _0x196a14(_0x5d8f38){try{_0x288b9b(_0x55c028['next'](_0x5d8f38));}catch(_0x16061f){_0x1c2c2c(_0x16061f);}}function _0x257be3(_0x3b31a9){try{_0x288b9b(_0x55c028['throw'](_0x3b31a9));}catch(_0x13e90d){_0x1c2c2c(_0x13e90d);}}function _0x288b9b(_0x3f902e){_0x3f902e['done']?_0x26a468(_0x3f902e['value']):_0x58e013(_0x3f902e['value'])['then'](_0x196a14,_0x257be3);}_0x288b9b((_0x55c028=_0x55c028['apply'](_0x40688a,_0x1a4c28||[]))['next']());});};class ApiKeyService{constructor(_0x31dce4){this['fetch']=_0x31dce4,this['path']='api-key';}['create'](_0x58ec33,_0x16323f,_0x520c41){return __awaiter$4(this,void 0,void 0,function*(){const _0xa1da63={'account_name':_0x58ec33,'api_key_name':_0x16323f};try{const _0x3a0b2c=yield this['fetch']['post'](this['path'],_0x520c41,_0xa1da63);if(_0x3a0b2c['status']>0xc7&&_0x3a0b2c['status']<0x12c){const _0x3b3b48=yield _0x3a0b2c['json']();return new SuccessfulApiKeyResponse(_0x3b3b48);}const _0xa3dcee=yield _0x3a0b2c['json']();return new FailedApiKeyResponse(_0xa3dcee);}catch(_0x2ed6a5){if(_0x2ed6a5 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2ed6a5['message'],'title':_0x2ed6a5['name'],'status':0x1f4,'instance':'','type':''});throw _0x2ed6a5;}});}['view'](_0x3b0151,_0x45604b,_0x16b318){return __awaiter$4(this,void 0,void 0,function*(){const _0x277ae3=this['path']+'/'+_0x3b0151+'/'+_0x45604b;try{const _0x435b57=yield this['fetch']['get'](_0x277ae3,_0x16b318);if(_0x435b57['status']>0xc7&&_0x435b57['status']<0x12c){const _0x27725a=yield _0x435b57['json']();return new SuccessfulApiKeyValueResponse(_0x27725a);}const _0x156749=yield _0x435b57['json']();return new FailedApiKeyValueResponse(_0x156749);}catch(_0x291321){if(_0x291321 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x291321['message'],'title':_0x291321['name'],'status':0x1f4,'instance':'','type':''});throw _0x291321;}});}['delete'](_0x3c10e3,_0x49146c,_0x4b071d){return __awaiter$4(this,void 0,void 0,function*(){const _0x56e95c=this['path']+'/'+_0x3c10e3+'/'+_0x49146c;try{const _0x226c71=yield this['fetch']['delete'](_0x56e95c,_0x4b071d);if(_0x226c71['status']>0xc7&&_0x226c71['status']<0x12c)return new SuccessfulResponse({});const _0x386fcb=yield _0x226c71['json']();return new FailedResponse(_0x386fcb);}catch(_0x160445){if(_0x160445 instanceof Error)return new FailedResponse({'detail':_0x160445['message'],'title':_0x160445['name'],'status':0x1f4,'instance':'','type':''});throw _0x160445;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0xc17f57,_0x4e2f80,_0x363f73,_0x1bef2c){function _0x5c4942(_0x5b1acc){return _0x5b1acc instanceof _0x363f73?_0x5b1acc:new _0x363f73(function(_0x6f2457){_0x6f2457(_0x5b1acc);});}return new(_0x363f73||(_0x363f73=Promise))(function(_0x4c4e66,_0x58d813){function _0x336589(_0x4a9af4){try{_0x43709d(_0x1bef2c['next'](_0x4a9af4));}catch(_0xc17ff9){_0x58d813(_0xc17ff9);}}function _0x4c0705(_0x42ab25){try{_0x43709d(_0x1bef2c['throw'](_0x42ab25));}catch(_0x363a64){_0x58d813(_0x363a64);}}function _0x43709d(_0x57a338){_0x57a338['done']?_0x4c4e66(_0x57a338['value']):_0x5c4942(_0x57a338['value'])['then'](_0x336589,_0x4c0705);}_0x43709d((_0x1bef2c=_0x1bef2c['apply'](_0xc17f57,_0x4e2f80||[]))['next']());});};class ListService{constructor(_0x4c4f93){this['fetch']=_0x4c4f93;}['add'](_0x2e5ab5,_0x282eff,_0x1e2f4){return __awaiter$3(this,void 0,void 0,function*(){const _0x2981ae='List',_0xe52e77={'account_name':_0x2e5ab5,'list_name':_0x282eff};try{const _0xfeb13=yield this['fetch']['post'](_0x2981ae,_0x1e2f4,_0xe52e77);if(_0xfeb13['status']>0xc7&&_0xfeb13['status']<0x12c){const _0x14d1de=yield _0xfeb13['json']();return new SuccessfulAccountResponse(_0x14d1de);}const _0x4d5e9d=yield _0xfeb13['json']();return new FailedAccountResponse(_0x4d5e9d);}catch(_0x5b75a0){if(_0x5b75a0 instanceof Error)return new FailedAccountResponse({'detail':_0x5b75a0['message'],'title':_0x5b75a0['name'],'status':0x1f4,'instance':'','type':''});throw _0x5b75a0;}});}['remove'](_0x15bbc3,_0x5012ae,_0x441e9e){return __awaiter$3(this,void 0,void 0,function*(){const _0x1d6b5c='List/'+_0x15bbc3+'/'+_0x5012ae,_0x1dfa84=yield this['fetch']['delete'](_0x1d6b5c,_0x441e9e);try{if(_0x1dfa84['status']>0xc7&&_0x1dfa84['status']<0x12c){const _0x1a72d7=yield _0x1dfa84['json']();return new SuccessfulAccountResponse(_0x1a72d7);}const _0x122145=yield _0x1dfa84['json']();return new FailedAccountResponse(_0x122145);}catch(_0x44a661){if(_0x44a661 instanceof Error)return new FailedAccountResponse({'detail':_0x44a661['message'],'title':_0x44a661['name'],'status':0x1f4,'instance':'','type':''});throw _0x44a661;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x412d83,_0x313f02,_0x53ea18,_0x23680a){function _0x35f9a7(_0x256ad9){return _0x256ad9 instanceof _0x53ea18?_0x256ad9:new _0x53ea18(function(_0x5b0e60){_0x5b0e60(_0x256ad9);});}return new(_0x53ea18||(_0x53ea18=Promise))(function(_0x4bef7c,_0x4d2de2){function _0x3a2ddf(_0x140713){try{_0x11566c(_0x23680a['next'](_0x140713));}catch(_0x1c70fb){_0x4d2de2(_0x1c70fb);}}function _0xda8b21(_0x4d700b){try{_0x11566c(_0x23680a['throw'](_0x4d700b));}catch(_0x300e14){_0x4d2de2(_0x300e14);}}function _0x11566c(_0x3c4837){_0x3c4837['done']?_0x4bef7c(_0x3c4837['value']):_0x35f9a7(_0x3c4837['value'])['then'](_0x3a2ddf,_0xda8b21);}_0x11566c((_0x23680a=_0x23680a['apply'](_0x412d83,_0x313f02||[]))['next']());});};class Fetch{constructor(_0x455c1f){this['baseUri']=_0x455c1f,this['getUrl']=_0x1e008a=>{return _0x1e008a['startsWith']('/')&&(_0x1e008a=_0x1e008a['replace']('/','')),''+this['baseUri']+_0x1e008a;},!_0x455c1f['endsWith']('/')&&(_0x455c1f=_0x455c1f+'/');}['get'](_0x3bc6bf,_0xaeb6d6){return __awaiter$2(this,void 0,void 0,function*(){const _0x4f5a90=this['getUrl'](_0x3bc6bf);return yield fetch(_0x4f5a90,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xaeb6d6}});});}['post'](_0x22373d,_0x210e42,_0x40d353){return __awaiter$2(this,void 0,void 0,function*(){const _0x29bf2d=this['getUrl'](_0x22373d);return yield fetch(_0x29bf2d,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x210e42},'body':_0x40d353?JSON['stringify'](_0x40d353):null});});}['PostNoAuth'](_0xde91c8,_0x40d99b){return __awaiter$2(this,void 0,void 0,function*(){const _0x3dba3f=this['getUrl'](_0xde91c8);return yield fetch(_0x3dba3f,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x40d99b?JSON['stringify'](_0x40d99b):null});});}['put'](_0x521bbf,_0x45e40f,_0x2deec7){return __awaiter$2(this,void 0,void 0,function*(){const _0x17206f=this['getUrl'](_0x521bbf);return yield fetch(_0x17206f,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x45e40f},'body':_0x2deec7?JSON['stringify'](_0x2deec7):null});});}['delete'](_0x4d5b4e,_0x4dc7fa){return __awaiter$2(this,void 0,void 0,function*(){const _0x8c11b4=this['getUrl'](_0x4d5b4e);return yield fetch(_0x8c11b4,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4dc7fa}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2d19cf,_0x5e7116,_0x1fc3ef,_0x425b48){function _0x34cf81(_0x4d838e){return _0x4d838e instanceof _0x1fc3ef?_0x4d838e:new _0x1fc3ef(function(_0x1c7c79){_0x1c7c79(_0x4d838e);});}return new(_0x1fc3ef||(_0x1fc3ef=Promise))(function(_0x277d1b,_0x41d6d9){function _0xaa8cb4(_0x7d2e21){try{_0x3617c5(_0x425b48['next'](_0x7d2e21));}catch(_0x25bdc3){_0x41d6d9(_0x25bdc3);}}function _0x397df5(_0x371bea){try{_0x3617c5(_0x425b48['throw'](_0x371bea));}catch(_0x282790){_0x41d6d9(_0x282790);}}function _0x3617c5(_0x5dacc7){_0x5dacc7['done']?_0x277d1b(_0x5dacc7['value']):_0x34cf81(_0x5dacc7['value'])['then'](_0xaa8cb4,_0x397df5);}_0x3617c5((_0x425b48=_0x425b48['apply'](_0x2d19cf,_0x5e7116||[]))['next']());});};class SearchServersService{constructor(_0x23cd31){this['fetch']=_0x23cd31,this['path']='search-services';}['create'](_0x5c9718,_0x25d925,_0x1fbd9c,_0x4a7409,_0x1bcdf3,_0xcdc58b,_0x426e55,_0x43f3bd){return __awaiter$1(this,void 0,void 0,function*(){const _0x562f79={'account_name':_0x5c9718,'search_service_name':_0x25d925,'endpoint':_0x1fbd9c,'key':_0x4a7409,'country':_0x1bcdf3,'provider':_0xcdc58b,'index_name':_0x426e55};try{const _0x21d779=yield this['fetch']['post'](this['path'],_0x43f3bd,_0x562f79);if(_0x21d779['status']>0xc7&&_0x21d779['status']<0x12c){const _0x3fbbc6=yield _0x21d779['json']();return new SuccessfulSearchServiceResponse(_0x3fbbc6);}const _0x57440b=yield _0x21d779['json']();return new FailedSearchServiceResponse(_0x57440b);}catch(_0x5158fd){if(_0x5158fd instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5158fd['message'],'title':_0x5158fd['name'],'status':0x1f4,'instance':'','type':''});throw _0x5158fd;}});}['delete'](_0x2d486a,_0x144dcd,_0x25973a){return __awaiter$1(this,void 0,void 0,function*(){const _0x403f67=this['path']+'/'+_0x2d486a+'/'+_0x144dcd;try{const _0x2d4860=yield this['fetch']['delete'](_0x403f67,_0x25973a);if(_0x2d4860['status']>0xc7&&_0x2d4860['status']<0x12c)return new SuccessfulResponse({});const _0x80aa07=yield _0x2d4860['json']();return new FailedResponse(_0x80aa07);}catch(_0x4836f8){if(_0x4836f8 instanceof Error)return new FailedResponse({'detail':_0x4836f8['message'],'title':_0x4836f8['name'],'status':0x1f4,'instance':'','type':''});throw _0x4836f8;}});}['view'](_0x52855a,_0x3f0889,_0x36c047){return __awaiter$1(this,void 0,void 0,function*(){const _0x364209=this['path']+'/'+_0x52855a+'/'+_0x3f0889;try{const _0x383651=yield this['fetch']['get'](_0x364209,_0x36c047);if(_0x383651['status']>0xc7&&_0x383651['status']<0x12c){const _0x20b1b9=yield _0x383651['json']();return new SuccessfulViewSearchServiceResponse(_0x20b1b9);}const _0x38c00f=yield _0x383651['json']();return new FailedViewSearchServiceResponse(_0x38c00f);}catch(_0x1f549e){if(_0x1f549e instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x1f549e['message'],'title':_0x1f549e['name'],'status':0x1f4,'instance':'','type':''});throw _0x1f549e;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1e8cd3,_0x44ce49,_0x29568d,_0x405858){function _0x46545f(_0x20e906){return _0x20e906 instanceof _0x29568d?_0x20e906:new _0x29568d(function(_0x489f45){_0x489f45(_0x20e906);});}return new(_0x29568d||(_0x29568d=Promise))(function(_0x3b6eba,_0x3aa206){function _0x41ff66(_0x11f07e){try{_0x477755(_0x405858['next'](_0x11f07e));}catch(_0x35ca05){_0x3aa206(_0x35ca05);}}function _0x47a0bc(_0x938114){try{_0x477755(_0x405858['throw'](_0x938114));}catch(_0x279159){_0x3aa206(_0x279159);}}function _0x477755(_0x56c781){_0x56c781['done']?_0x3b6eba(_0x56c781['value']):_0x46545f(_0x56c781['value'])['then'](_0x41ff66,_0x47a0bc);}_0x477755((_0x405858=_0x405858['apply'](_0x1e8cd3,_0x44ce49||[]))['next']());});};class AdminClient{constructor(_0x4a406a='https://admin.searchability.dev/'){var _0x310f26=new Fetch(_0x4a406a);this['Accounts']=new AccountService(_0x310f26),this['Lists']=new ListService(_0x310f26),this['ApiKeys']=new ApiKeyService(_0x310f26),this['SearchServices']=new SearchServersService(_0x310f26);}}class AuthClient{constructor(_0x4164d4='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x4164d4);}['login'](_0x5090aa){return __awaiter(this,void 0,void 0,function*(){const _0x54f122='login/'+_0x5090aa;try{const _0x4977a7=yield yield fetch(_0x54f122);if(_0x4977a7['status']>0xc7&&_0x4977a7['status']<0x12c){const _0x162396=yield _0x4977a7['json']();return new SuccessfulAuthResponse(_0x162396);}const _0x326eb9=yield _0x4977a7['json']();return new FailedAuthResponse(_0x326eb9);}catch(_0x24db77){if(_0x24db77 instanceof Error)return new FailedAuthResponse({'detail':_0x24db77['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x24db77;}});}['refresh'](_0x450324){return __awaiter(this,void 0,void 0,function*(){const _0x472e65='refresh',_0x97d047={'refresh_token':_0x450324};try{const _0x4f8af9=yield this['fetch']['PostNoAuth'](_0x472e65,_0x97d047);if(_0x4f8af9['status']>0xc7&&_0x4f8af9['status']<0x12c){const _0x2351e3=yield _0x4f8af9['json']();return new SuccessfulAuthResponse(_0x2351e3);}const _0x176a2a=yield _0x4f8af9['json']();return new FailedAuthResponse(_0x176a2a);}catch(_0x593a50){if(_0x593a50 instanceof Error)return new FailedAuthResponse({'detail':_0x593a50['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x593a50;}});}['getTokenStatus'](_0x3ecc57){if(Date['now']()<_0x3ecc57['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3ecc57['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|