@searchability/admin-client 0.0.42 → 0.0.43
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(_0x1657bc){_0x1657bc[_0x1657bc['Ok']=0x0]='Ok',_0x1657bc[_0x1657bc['Refresh']=0x1]='Refresh',_0x1657bc[_0x1657bc['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(_0x24e853){this['isSuccess']=_0x24e853;}}class SuccessfulAccountResponse extends Response{constructor(_0xa7bd23){super(!![]),this['account']=_0xa7bd23;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x37f4a0){super(![]),this['problem']=_0x37f4a0;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x1f2f3f){super(!![]),this['tokens']=_0x1f2f3f;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x3c15b9){super(![]),this['problem']=_0x3c15b9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x5c2ce5){super(!![]),this['apiKey']=_0x5c2ce5;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x4339e0){super(![]),this['problem']=_0x4339e0;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x10cf26){super(!![]),this['searchService']=_0x10cf26;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x863521){super(![]),this['problem']=_0x863521;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x38ee4f){super(!![]),this['searchService']=_0x38ee4f;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x2f3def){super(![]),this['problem']=_0x2f3def;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x41e158){super(!![]),this['apiKeyValue']=_0x41e158;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x6ec54){super(!![]),this['obj']=_0x6ec54;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x2ceca5){super(![]),this['problem']=_0x2ceca5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x45bbfe){super(![]),this['problem']=_0x45bbfe;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x3c8771,_0x565542,_0x18da64,_0x3b8021){function _0x346b9a(_0x6671b0){return _0x6671b0 instanceof _0x18da64?_0x6671b0:new _0x18da64(function(_0x5333fb){_0x5333fb(_0x6671b0);});}return new(_0x18da64||(_0x18da64=Promise))(function(_0x1e01e1,_0xf25510){function _0x2ed569(_0x1e7c6f){try{_0x1e567a(_0x3b8021['next'](_0x1e7c6f));}catch(_0xa4f8e){_0xf25510(_0xa4f8e);}}function _0x152511(_0x26c622){try{_0x1e567a(_0x3b8021['throw'](_0x26c622));}catch(_0x3bceef){_0xf25510(_0x3bceef);}}function _0x1e567a(_0x99bd8a){_0x99bd8a['done']?_0x1e01e1(_0x99bd8a['value']):_0x346b9a(_0x99bd8a['value'])['then'](_0x2ed569,_0x152511);}_0x1e567a((_0x3b8021=_0x3b8021['apply'](_0x3c8771,_0x565542||[]))['next']());});};class AccountService{constructor(_0x566705){this['fetch']=_0x566705;}['get'](_0x394835,_0x2f04d1){return __awaiter$5(this,void 0,void 0,function*(){const _0x4cad6d='Account/'+_0x394835+'/',_0x3a55a3=yield this['fetch']['get'](_0x4cad6d,_0x2f04d1);try{if(_0x3a55a3['status']>0xc7&&_0x3a55a3['status']<0x12c){const _0x241d15=yield _0x3a55a3['json']();return new SuccessfulAccountResponse(_0x241d15);}const _0x2a256a=yield _0x3a55a3['json']();return new FailedAccountResponse(_0x2a256a);}catch(_0x106b8f){if(_0x106b8f instanceof Error)return new FailedAccountResponse({'detail':_0x106b8f['message'],'title':_0x106b8f['name'],'status':0x1f4,'instance':'','type':''});throw _0x106b8f;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x31ca20,_0x1ec559,_0x5163b9,_0xd2577e){function _0x15b24d(_0x3f0834){return _0x3f0834 instanceof _0x5163b9?_0x3f0834:new _0x5163b9(function(_0x4e7889){_0x4e7889(_0x3f0834);});}return new(_0x5163b9||(_0x5163b9=Promise))(function(_0x497c44,_0x22e806){function _0x29e5bb(_0x98572c){try{_0x59cb99(_0xd2577e['next'](_0x98572c));}catch(_0x4c609a){_0x22e806(_0x4c609a);}}function _0x44215c(_0x135113){try{_0x59cb99(_0xd2577e['throw'](_0x135113));}catch(_0x1d004a){_0x22e806(_0x1d004a);}}function _0x59cb99(_0x402644){_0x402644['done']?_0x497c44(_0x402644['value']):_0x15b24d(_0x402644['value'])['then'](_0x29e5bb,_0x44215c);}_0x59cb99((_0xd2577e=_0xd2577e['apply'](_0x31ca20,_0x1ec559||[]))['next']());});};class ApiKeyService{constructor(_0x37746e){this['fetch']=_0x37746e,this['path']='api-key';}['create'](_0x4ed844,_0x23a8a2,_0x48af70){return __awaiter$4(this,void 0,void 0,function*(){const _0x10feb1={'account_name':_0x4ed844,'api_key_name':_0x23a8a2};try{const _0x1e9408=yield this['fetch']['post'](this['path'],_0x48af70,_0x10feb1);if(_0x1e9408['status']>0xc7&&_0x1e9408['status']<0x12c){const _0x2421b9=yield _0x1e9408['json']();return new SuccessfulApiKeyResponse(_0x2421b9);}const _0x3aa7d5=yield _0x1e9408['json']();return new FailedApiKeyResponse(_0x3aa7d5);}catch(_0x2c4a7b){if(_0x2c4a7b instanceof Error)return new FailedApiKeyResponse({'detail':_0x2c4a7b['message'],'title':_0x2c4a7b['name'],'status':0x1f4,'instance':'','type':''});throw _0x2c4a7b;}});}['view'](_0x34a471,_0x1fc857,_0x42cc3b){return __awaiter$4(this,void 0,void 0,function*(){const _0x397056=this['path']+'/'+_0x34a471+'/'+_0x1fc857;try{const _0x46de3d=yield this['fetch']['get'](_0x397056,_0x42cc3b);if(_0x46de3d['status']>0xc7&&_0x46de3d['status']<0x12c){const _0x489af4=yield _0x46de3d['json']();return new SuccessfulApiKeyValueResponse(_0x489af4);}const _0x127216=yield _0x46de3d['json']();return new FailedApiKeyValueResponse(_0x127216);}catch(_0x1a7c2b){if(_0x1a7c2b instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x1a7c2b['message'],'title':_0x1a7c2b['name'],'status':0x1f4,'instance':'','type':''});throw _0x1a7c2b;}});}['delete'](_0x136e89,_0x4d36a6,_0x31f866){return __awaiter$4(this,void 0,void 0,function*(){const _0x36690b=this['path']+'/'+_0x136e89+'/'+_0x4d36a6;try{const _0x2e66f2=yield this['fetch']['delete'](_0x36690b,_0x31f866);if(_0x2e66f2['status']>0xc7&&_0x2e66f2['status']<0x12c)return new SuccessfulResponse({});const _0x41caf9=yield _0x2e66f2['json']();return new FailedResponse(_0x41caf9);}catch(_0x3eccb9){if(_0x3eccb9 instanceof Error)return new FailedResponse({'detail':_0x3eccb9['message'],'title':_0x3eccb9['name'],'status':0x1f4,'instance':'','type':''});throw _0x3eccb9;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x129dd6,_0x3defb4,_0x2775d2,_0x289cd8){function _0x25614e(_0x33c4e8){return _0x33c4e8 instanceof _0x2775d2?_0x33c4e8:new _0x2775d2(function(_0x33c8c4){_0x33c8c4(_0x33c4e8);});}return new(_0x2775d2||(_0x2775d2=Promise))(function(_0x49aca9,_0x497958){function _0x1f9492(_0x14cec1){try{_0x52a68f(_0x289cd8['next'](_0x14cec1));}catch(_0x484928){_0x497958(_0x484928);}}function _0x1d6a84(_0x4c33a9){try{_0x52a68f(_0x289cd8['throw'](_0x4c33a9));}catch(_0xa520af){_0x497958(_0xa520af);}}function _0x52a68f(_0x384d06){_0x384d06['done']?_0x49aca9(_0x384d06['value']):_0x25614e(_0x384d06['value'])['then'](_0x1f9492,_0x1d6a84);}_0x52a68f((_0x289cd8=_0x289cd8['apply'](_0x129dd6,_0x3defb4||[]))['next']());});};class ListService{constructor(_0x3945f4){this['fetch']=_0x3945f4;}['add'](_0xc21631,_0x5bf506,_0x3d9539){return __awaiter$3(this,void 0,void 0,function*(){const _0x394a96='List',_0x562962={'account_name':_0xc21631,'list_name':_0x5bf506};try{const _0x136be6=yield this['fetch']['post'](_0x394a96,_0x3d9539,_0x562962);if(_0x136be6['status']>0xc7&&_0x136be6['status']<0x12c){const _0x4e78dc=yield _0x136be6['json']();return new SuccessfulAccountResponse(_0x4e78dc);}const _0x2a7762=yield _0x136be6['json']();return new FailedAccountResponse(_0x2a7762);}catch(_0x1ca36a){if(_0x1ca36a instanceof Error)return new FailedAccountResponse({'detail':_0x1ca36a['message'],'title':_0x1ca36a['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ca36a;}});}['remove'](_0x495b6c,_0x2f4c4,_0x3769bd){return __awaiter$3(this,void 0,void 0,function*(){const _0x52cdd2='List/'+_0x495b6c+'/'+_0x2f4c4,_0x3b22ce=yield this['fetch']['delete'](_0x52cdd2,_0x3769bd);try{if(_0x3b22ce['status']>0xc7&&_0x3b22ce['status']<0x12c){const _0x2c0173=yield _0x3b22ce['json']();return new SuccessfulAccountResponse(_0x2c0173);}const _0x5146f2=yield _0x3b22ce['json']();return new FailedAccountResponse(_0x5146f2);}catch(_0x41f304){if(_0x41f304 instanceof Error)return new FailedAccountResponse({'detail':_0x41f304['message'],'title':_0x41f304['name'],'status':0x1f4,'instance':'','type':''});throw _0x41f304;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x533568,_0x1e8a15,_0x26a36b,_0x4d0e6b){function _0x5092ce(_0x24ac5d){return _0x24ac5d instanceof _0x26a36b?_0x24ac5d:new _0x26a36b(function(_0x1eef8f){_0x1eef8f(_0x24ac5d);});}return new(_0x26a36b||(_0x26a36b=Promise))(function(_0xb52719,_0x1565f8){function _0x2be6f2(_0x1326fb){try{_0x4325a8(_0x4d0e6b['next'](_0x1326fb));}catch(_0x488340){_0x1565f8(_0x488340);}}function _0x432fa4(_0x519e71){try{_0x4325a8(_0x4d0e6b['throw'](_0x519e71));}catch(_0x344b33){_0x1565f8(_0x344b33);}}function _0x4325a8(_0x7d1628){_0x7d1628['done']?_0xb52719(_0x7d1628['value']):_0x5092ce(_0x7d1628['value'])['then'](_0x2be6f2,_0x432fa4);}_0x4325a8((_0x4d0e6b=_0x4d0e6b['apply'](_0x533568,_0x1e8a15||[]))['next']());});};class Fetch{constructor(_0x164cda){this['baseUri']=_0x164cda,this['getUrl']=_0x7ee547=>{return _0x7ee547['startsWith']('/')&&(_0x7ee547=_0x7ee547['replace']('/','')),''+this['baseUri']+_0x7ee547;},!_0x164cda['endsWith']('/')&&(_0x164cda=_0x164cda+'/');}['get'](_0xc9202b,_0x88a043){return __awaiter$2(this,void 0,void 0,function*(){const _0x3a6966=this['getUrl'](_0xc9202b);return yield fetch(_0x3a6966,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x88a043}});});}['post'](_0x3aa557,_0xbde142,_0x46b3d1){return __awaiter$2(this,void 0,void 0,function*(){const _0x1b1079=this['getUrl'](_0x3aa557);return yield fetch(_0x1b1079,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xbde142},'body':_0x46b3d1?JSON['stringify'](_0x46b3d1):null});});}['PostNoAuth'](_0x5c0d0e,_0x5d9d4b){return __awaiter$2(this,void 0,void 0,function*(){const _0x5754fe=this['getUrl'](_0x5c0d0e);return yield fetch(_0x5754fe,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5d9d4b?JSON['stringify'](_0x5d9d4b):null});});}['put'](_0x3a5369,_0x19d67f,_0x4455b1){return __awaiter$2(this,void 0,void 0,function*(){const _0x1e4357=this['getUrl'](_0x3a5369);return yield fetch(_0x1e4357,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x19d67f},'body':_0x4455b1?JSON['stringify'](_0x4455b1):null});});}['delete'](_0x13a073,_0x3290ff){return __awaiter$2(this,void 0,void 0,function*(){const _0x2038ca=this['getUrl'](_0x13a073);return yield fetch(_0x2038ca,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3290ff}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1a962a,_0x474c36,_0x1a4695,_0x57cceb){function _0x49864d(_0xd6495d){return _0xd6495d instanceof _0x1a4695?_0xd6495d:new _0x1a4695(function(_0x24b4cf){_0x24b4cf(_0xd6495d);});}return new(_0x1a4695||(_0x1a4695=Promise))(function(_0x11ab3d,_0x878945){function _0x2bfb9b(_0x3b986c){try{_0x15894c(_0x57cceb['next'](_0x3b986c));}catch(_0x3fcd8b){_0x878945(_0x3fcd8b);}}function _0x148532(_0x6c5d87){try{_0x15894c(_0x57cceb['throw'](_0x6c5d87));}catch(_0x1826c0){_0x878945(_0x1826c0);}}function _0x15894c(_0x4bb123){_0x4bb123['done']?_0x11ab3d(_0x4bb123['value']):_0x49864d(_0x4bb123['value'])['then'](_0x2bfb9b,_0x148532);}_0x15894c((_0x57cceb=_0x57cceb['apply'](_0x1a962a,_0x474c36||[]))['next']());});};class SearchServersService{constructor(_0x4b6b53){this['fetch']=_0x4b6b53,this['path']='search-services';}['create'](_0x182c00,_0x377be7,_0x369639,_0x3a218c,_0x49e340,_0x3f51de,_0x2c5588,_0x4d5a0a){return __awaiter$1(this,void 0,void 0,function*(){const _0x11fe33={'account_name':_0x182c00,'search_service_name':_0x377be7,'endpoint':_0x369639,'key':_0x3a218c,'country':_0x49e340,'provider':_0x3f51de,'index_name':_0x2c5588};try{const _0x1202d6=yield this['fetch']['post'](this['path'],_0x4d5a0a,_0x11fe33);if(_0x1202d6['status']>0xc7&&_0x1202d6['status']<0x12c){const _0x37fa61=yield _0x1202d6['json']();return new SuccessfulSearchServiceResponse(_0x37fa61);}const _0xb63bf8=yield _0x1202d6['json']();return new FailedSearchServiceResponse(_0xb63bf8);}catch(_0x481151){if(_0x481151 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x481151['message'],'title':_0x481151['name'],'status':0x1f4,'instance':'','type':''});throw _0x481151;}});}['delete'](_0x4a0d71,_0xd6a43c,_0x15ea8d){return __awaiter$1(this,void 0,void 0,function*(){const _0x1d6f56=this['path']+'/'+_0x4a0d71+'/'+_0xd6a43c;try{const _0x1ae4e3=yield this['fetch']['delete'](_0x1d6f56,_0x15ea8d);if(_0x1ae4e3['status']>0xc7&&_0x1ae4e3['status']<0x12c)return new SuccessfulResponse({});const _0x5781cf=yield _0x1ae4e3['json']();return new FailedResponse(_0x5781cf);}catch(_0x2ce485){if(_0x2ce485 instanceof Error)return new FailedResponse({'detail':_0x2ce485['message'],'title':_0x2ce485['name'],'status':0x1f4,'instance':'','type':''});throw _0x2ce485;}});}['view'](_0x699e4d,_0x95a3a0,_0x4fc591){return __awaiter$1(this,void 0,void 0,function*(){const _0x3c957e=this['path']+'/'+_0x699e4d+'/'+_0x95a3a0;try{const _0x16d1d9=yield this['fetch']['get'](_0x3c957e,_0x4fc591);if(_0x16d1d9['status']>0xc7&&_0x16d1d9['status']<0x12c){const _0x1711df=yield _0x16d1d9['json']();return new SuccessfulViewSearchServiceResponse(_0x1711df);}const _0x570dc3=yield _0x16d1d9['json']();return new FailedViewSearchServiceResponse(_0x570dc3);}catch(_0x1dec00){if(_0x1dec00 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x1dec00['message'],'title':_0x1dec00['name'],'status':0x1f4,'instance':'','type':''});throw _0x1dec00;}});}['edit'](_0x5e2e04,_0x21e88d,_0x58827f,_0x20c8eb,_0x444ec1,_0x475492){return __awaiter$1(this,void 0,void 0,function*(){const _0x41a179={'account_name':_0x5e2e04,'search_service_name':_0x21e88d,'new_search_service_name':_0x58827f,'key':_0x20c8eb,'country':_0x444ec1};try{const _0xf223b4=yield this['fetch']['put'](this['path'],_0x475492,_0x41a179);if(_0xf223b4['status']>0xc7&&_0xf223b4['status']<0x12c){const _0x429013=yield _0xf223b4['json']();return new SuccessfulSearchServiceResponse(_0x429013);}const _0x2b0185=yield _0xf223b4['json']();return new FailedSearchServiceResponse(_0x2b0185);}catch(_0x1f520b){if(_0x1f520b instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1f520b['message'],'title':_0x1f520b['name'],'status':0x1f4,'instance':'','type':''});throw _0x1f520b;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x110c51,_0x5dfe15,_0x43bd9d,_0x31a5cc){function _0x17d3de(_0x6d78ae){return _0x6d78ae instanceof _0x43bd9d?_0x6d78ae:new _0x43bd9d(function(_0x5a98a3){_0x5a98a3(_0x6d78ae);});}return new(_0x43bd9d||(_0x43bd9d=Promise))(function(_0x95cc7e,_0x36db03){function _0xf2aabd(_0x1f52e8){try{_0x5b4aa7(_0x31a5cc['next'](_0x1f52e8));}catch(_0x52ee4f){_0x36db03(_0x52ee4f);}}function _0x2b365e(_0x31dec7){try{_0x5b4aa7(_0x31a5cc['throw'](_0x31dec7));}catch(_0x4d08ed){_0x36db03(_0x4d08ed);}}function _0x5b4aa7(_0x190fb2){_0x190fb2['done']?_0x95cc7e(_0x190fb2['value']):_0x17d3de(_0x190fb2['value'])['then'](_0xf2aabd,_0x2b365e);}_0x5b4aa7((_0x31a5cc=_0x31a5cc['apply'](_0x110c51,_0x5dfe15||[]))['next']());});};class AdminClient{constructor(_0x2b9592='https://admin.searchability.dev/'){var _0x279405=new Fetch(_0x2b9592);this['Accounts']=new AccountService(_0x279405),this['Lists']=new ListService(_0x279405),this['ApiKeys']=new ApiKeyService(_0x279405),this['SearchServices']=new SearchServersService(_0x279405);}}class AuthClient{constructor(_0x495e8a='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x495e8a);}['login'](_0x104289){return __awaiter(this,void 0,void 0,function*(){const _0x2b9178='login/'+_0x104289;try{const _0x3b8120=yield yield fetch(_0x2b9178);if(_0x3b8120['status']>0xc7&&_0x3b8120['status']<0x12c){const _0x54ac91=yield _0x3b8120['json']();return new SuccessfulAuthResponse(_0x54ac91);}const _0x54ef5d=yield _0x3b8120['json']();return new FailedAuthResponse(_0x54ef5d);}catch(_0x1711c2){if(_0x1711c2 instanceof Error)return new FailedAuthResponse({'detail':_0x1711c2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1711c2;}});}['refresh'](_0x58497c){return __awaiter(this,void 0,void 0,function*(){const _0x2ee047='refresh',_0x305589={'refresh_token':_0x58497c};try{const _0x594a7b=yield this['fetch']['PostNoAuth'](_0x2ee047,_0x305589);if(_0x594a7b['status']>0xc7&&_0x594a7b['status']<0x12c){const _0x2b8d11=yield _0x594a7b['json']();return new SuccessfulAuthResponse(_0x2b8d11);}const _0x21a972=yield _0x594a7b['json']();return new FailedAuthResponse(_0x21a972);}catch(_0x3ef3be){if(_0x3ef3be instanceof Error)return new FailedAuthResponse({'detail':_0x3ef3be['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3ef3be;}});}['getTokenStatus'](_0x6e27a0){if(Date['now']()<_0x6e27a0['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x6e27a0['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(_0x4bf030){_0x4bf030[_0x4bf030['Ok']=0x0]='Ok',_0x4bf030[_0x4bf030['Refresh']=0x1]='Refresh',_0x4bf030[_0x4bf030['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(_0x3fbf65){this['isSuccess']=_0x3fbf65;}}class SuccessfulAccountResponse extends Response{constructor(_0x4e38aa){super(!![]),this['account']=_0x4e38aa;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x1165ed){super(![]),this['problem']=_0x1165ed;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x3b7aa0){super(!![]),this['tokens']=_0x3b7aa0;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x8734d4){super(![]),this['problem']=_0x8734d4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x535374){super(!![]),this['apiKey']=_0x535374;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x26da03){super(![]),this['problem']=_0x26da03;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x5cfd09){super(!![]),this['searchService']=_0x5cfd09;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x402f74){super(![]),this['problem']=_0x402f74;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x3d3db2){super(!![]),this['searchService']=_0x3d3db2;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x424c80){super(![]),this['problem']=_0x424c80;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x314fd3){super(!![]),this['apiKeyValue']=_0x314fd3;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x34bac3){super(!![]),this['obj']=_0x34bac3;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x85bf88){super(![]),this['problem']=_0x85bf88;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x54158a){super(![]),this['problem']=_0x54158a;}['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(_0x418c94,_0x2c45f7,_0x4e1766,_0x17aabc){function _0x41d6b6(_0x5cfcdd){return _0x5cfcdd instanceof _0x4e1766?_0x5cfcdd:new _0x4e1766(function(_0x323f52){_0x323f52(_0x5cfcdd);});}return new(_0x4e1766||(_0x4e1766=Promise))(function(_0x305d1e,_0x2aebc4){function _0x202373(_0x2f0ee6){try{_0x4df82(_0x17aabc['next'](_0x2f0ee6));}catch(_0x637445){_0x2aebc4(_0x637445);}}function _0x30fb8b(_0x5ee5f0){try{_0x4df82(_0x17aabc['throw'](_0x5ee5f0));}catch(_0x2c4c07){_0x2aebc4(_0x2c4c07);}}function _0x4df82(_0x491475){_0x491475['done']?_0x305d1e(_0x491475['value']):_0x41d6b6(_0x491475['value'])['then'](_0x202373,_0x30fb8b);}_0x4df82((_0x17aabc=_0x17aabc['apply'](_0x418c94,_0x2c45f7||[]))['next']());});};class AccountService{constructor(_0x2ab13b){this['fetch']=_0x2ab13b;}['get'](_0x314dcb,_0x35c64b){return __awaiter$5(this,void 0,void 0,function*(){const _0x122a20='Account/'+_0x314dcb+'/',_0x11e799=yield this['fetch']['get'](_0x122a20,_0x35c64b);try{if(_0x11e799['status']>0xc7&&_0x11e799['status']<0x12c){const _0x4a8eac=yield _0x11e799['json']();return new SuccessfulAccountResponse(_0x4a8eac);}const _0x439925=yield _0x11e799['json']();return new FailedAccountResponse(_0x439925);}catch(_0x1c7fa8){if(_0x1c7fa8 instanceof Error)return new FailedAccountResponse({'detail':_0x1c7fa8['message'],'title':_0x1c7fa8['name'],'status':0x1f4,'instance':'','type':''});throw _0x1c7fa8;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5eba7c,_0x58c1d4,_0x44e4d8,_0x5df17a){function _0xf67cbd(_0x28e216){return _0x28e216 instanceof _0x44e4d8?_0x28e216:new _0x44e4d8(function(_0x5c584a){_0x5c584a(_0x28e216);});}return new(_0x44e4d8||(_0x44e4d8=Promise))(function(_0x5d3af1,_0x321d97){function _0xd26e36(_0x55946a){try{_0x5e116c(_0x5df17a['next'](_0x55946a));}catch(_0x43a5ea){_0x321d97(_0x43a5ea);}}function _0x1c8433(_0x1a847a){try{_0x5e116c(_0x5df17a['throw'](_0x1a847a));}catch(_0x414ef4){_0x321d97(_0x414ef4);}}function _0x5e116c(_0x579771){_0x579771['done']?_0x5d3af1(_0x579771['value']):_0xf67cbd(_0x579771['value'])['then'](_0xd26e36,_0x1c8433);}_0x5e116c((_0x5df17a=_0x5df17a['apply'](_0x5eba7c,_0x58c1d4||[]))['next']());});};class ApiKeyService{constructor(_0x93d4bc){this['fetch']=_0x93d4bc,this['path']='api-key';}['create'](_0x3b6235,_0x357fa9,_0x10c4c8){return __awaiter$4(this,void 0,void 0,function*(){const _0x1419aa={'account_name':_0x3b6235,'api_key_name':_0x357fa9};try{const _0x4b7d5b=yield this['fetch']['post'](this['path'],_0x10c4c8,_0x1419aa);if(_0x4b7d5b['status']>0xc7&&_0x4b7d5b['status']<0x12c){const _0x5cea2b=yield _0x4b7d5b['json']();return new SuccessfulApiKeyResponse(_0x5cea2b);}const _0x3e6815=yield _0x4b7d5b['json']();return new FailedApiKeyResponse(_0x3e6815);}catch(_0x34a8d2){if(_0x34a8d2 instanceof Error)return new FailedApiKeyResponse({'detail':_0x34a8d2['message'],'title':_0x34a8d2['name'],'status':0x1f4,'instance':'','type':''});throw _0x34a8d2;}});}['view'](_0x1ebfd3,_0x49dd10,_0x4e5204){return __awaiter$4(this,void 0,void 0,function*(){const _0x44eb5d=this['path']+'/'+_0x1ebfd3+'/'+_0x49dd10;try{const _0x4ad156=yield this['fetch']['get'](_0x44eb5d,_0x4e5204);if(_0x4ad156['status']>0xc7&&_0x4ad156['status']<0x12c){const _0x3a7444=yield _0x4ad156['json']();return new SuccessfulApiKeyValueResponse(_0x3a7444);}const _0x31b625=yield _0x4ad156['json']();return new FailedApiKeyValueResponse(_0x31b625);}catch(_0x5cd360){if(_0x5cd360 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x5cd360['message'],'title':_0x5cd360['name'],'status':0x1f4,'instance':'','type':''});throw _0x5cd360;}});}['delete'](_0x5c299a,_0x4c63a2,_0x18859f){return __awaiter$4(this,void 0,void 0,function*(){const _0x47a01a=this['path']+'/'+_0x5c299a+'/'+_0x4c63a2;try{const _0x4e182c=yield this['fetch']['delete'](_0x47a01a,_0x18859f);if(_0x4e182c['status']>0xc7&&_0x4e182c['status']<0x12c)return new SuccessfulResponse({});const _0x499fed=yield _0x4e182c['json']();return new FailedResponse(_0x499fed);}catch(_0x593ecf){if(_0x593ecf instanceof Error)return new FailedResponse({'detail':_0x593ecf['message'],'title':_0x593ecf['name'],'status':0x1f4,'instance':'','type':''});throw _0x593ecf;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x44bdf3,_0x1a1b38,_0x3276c8,_0x141bab){function _0xb6f0fa(_0x251c22){return _0x251c22 instanceof _0x3276c8?_0x251c22:new _0x3276c8(function(_0x35dc66){_0x35dc66(_0x251c22);});}return new(_0x3276c8||(_0x3276c8=Promise))(function(_0x2fd667,_0x3fccc8){function _0x2ece06(_0x4ab2cd){try{_0x5f0fd8(_0x141bab['next'](_0x4ab2cd));}catch(_0x4c3ef4){_0x3fccc8(_0x4c3ef4);}}function _0x3b729b(_0x2a47cc){try{_0x5f0fd8(_0x141bab['throw'](_0x2a47cc));}catch(_0x2d3621){_0x3fccc8(_0x2d3621);}}function _0x5f0fd8(_0xb17e1d){_0xb17e1d['done']?_0x2fd667(_0xb17e1d['value']):_0xb6f0fa(_0xb17e1d['value'])['then'](_0x2ece06,_0x3b729b);}_0x5f0fd8((_0x141bab=_0x141bab['apply'](_0x44bdf3,_0x1a1b38||[]))['next']());});};class ListService{constructor(_0x1096b7){this['fetch']=_0x1096b7;}['add'](_0x2e6405,_0x1f6ac4,_0x3eec4f){return __awaiter$3(this,void 0,void 0,function*(){const _0x20accf='List',_0x1ceeb3={'account_name':_0x2e6405,'list_name':_0x1f6ac4};try{const _0x15a286=yield this['fetch']['post'](_0x20accf,_0x3eec4f,_0x1ceeb3);if(_0x15a286['status']>0xc7&&_0x15a286['status']<0x12c){const _0x4379ad=yield _0x15a286['json']();return new SuccessfulAccountResponse(_0x4379ad);}const _0x1ab6ee=yield _0x15a286['json']();return new FailedAccountResponse(_0x1ab6ee);}catch(_0x589816){if(_0x589816 instanceof Error)return new FailedAccountResponse({'detail':_0x589816['message'],'title':_0x589816['name'],'status':0x1f4,'instance':'','type':''});throw _0x589816;}});}['remove'](_0x30de5c,_0x2f3d5b,_0xab790e){return __awaiter$3(this,void 0,void 0,function*(){const _0x5d53b8='List/'+_0x30de5c+'/'+_0x2f3d5b,_0x441fb9=yield this['fetch']['delete'](_0x5d53b8,_0xab790e);try{if(_0x441fb9['status']>0xc7&&_0x441fb9['status']<0x12c){const _0x573901=yield _0x441fb9['json']();return new SuccessfulAccountResponse(_0x573901);}const _0xc8555f=yield _0x441fb9['json']();return new FailedAccountResponse(_0xc8555f);}catch(_0x229452){if(_0x229452 instanceof Error)return new FailedAccountResponse({'detail':_0x229452['message'],'title':_0x229452['name'],'status':0x1f4,'instance':'','type':''});throw _0x229452;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x46b4f9,_0x442f29,_0x4449d1,_0x506bed){function _0x10c818(_0x291b68){return _0x291b68 instanceof _0x4449d1?_0x291b68:new _0x4449d1(function(_0x231738){_0x231738(_0x291b68);});}return new(_0x4449d1||(_0x4449d1=Promise))(function(_0x22d5f1,_0x1b9018){function _0x56090b(_0x26ab85){try{_0x4ec8b7(_0x506bed['next'](_0x26ab85));}catch(_0x3195bb){_0x1b9018(_0x3195bb);}}function _0x1b94c5(_0xbe1b53){try{_0x4ec8b7(_0x506bed['throw'](_0xbe1b53));}catch(_0x286269){_0x1b9018(_0x286269);}}function _0x4ec8b7(_0x136a39){_0x136a39['done']?_0x22d5f1(_0x136a39['value']):_0x10c818(_0x136a39['value'])['then'](_0x56090b,_0x1b94c5);}_0x4ec8b7((_0x506bed=_0x506bed['apply'](_0x46b4f9,_0x442f29||[]))['next']());});};class Fetch{constructor(_0x3f5841){this['baseUri']=_0x3f5841,this['getUrl']=_0x397e1f=>{return _0x397e1f['startsWith']('/')&&(_0x397e1f=_0x397e1f['replace']('/','')),''+this['baseUri']+_0x397e1f;},!_0x3f5841['endsWith']('/')&&(_0x3f5841=_0x3f5841+'/');}['get'](_0x4d8b6c,_0x2798c0){return __awaiter$2(this,void 0,void 0,function*(){const _0x5e1089=this['getUrl'](_0x4d8b6c);return yield fetch(_0x5e1089,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2798c0}});});}['post'](_0x38a209,_0x1898ef,_0x1626e6){return __awaiter$2(this,void 0,void 0,function*(){const _0x2b2ec9=this['getUrl'](_0x38a209);return yield fetch(_0x2b2ec9,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1898ef},'body':_0x1626e6?JSON['stringify'](_0x1626e6):null});});}['PostNoAuth'](_0x2338ea,_0x5259d7){return __awaiter$2(this,void 0,void 0,function*(){const _0x530eb4=this['getUrl'](_0x2338ea);return yield fetch(_0x530eb4,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5259d7?JSON['stringify'](_0x5259d7):null});});}['put'](_0x5aa518,_0xe3a816,_0x35ce0c){return __awaiter$2(this,void 0,void 0,function*(){const _0x121404=this['getUrl'](_0x5aa518);return yield fetch(_0x121404,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe3a816},'body':_0x35ce0c?JSON['stringify'](_0x35ce0c):null});});}['delete'](_0x3769e1,_0x5ab117){return __awaiter$2(this,void 0,void 0,function*(){const _0x12c585=this['getUrl'](_0x3769e1);return yield fetch(_0x12c585,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5ab117}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3ad26e,_0x139bd4,_0x3cf704,_0x246127){function _0x24b55e(_0x2cc156){return _0x2cc156 instanceof _0x3cf704?_0x2cc156:new _0x3cf704(function(_0x40715b){_0x40715b(_0x2cc156);});}return new(_0x3cf704||(_0x3cf704=Promise))(function(_0x46cbbb,_0x21fed5){function _0xeec6f(_0xe627e9){try{_0x4e1439(_0x246127['next'](_0xe627e9));}catch(_0x3cd434){_0x21fed5(_0x3cd434);}}function _0x2b8c27(_0x23f824){try{_0x4e1439(_0x246127['throw'](_0x23f824));}catch(_0x4b5f47){_0x21fed5(_0x4b5f47);}}function _0x4e1439(_0x157f78){_0x157f78['done']?_0x46cbbb(_0x157f78['value']):_0x24b55e(_0x157f78['value'])['then'](_0xeec6f,_0x2b8c27);}_0x4e1439((_0x246127=_0x246127['apply'](_0x3ad26e,_0x139bd4||[]))['next']());});};class SearchServersService{constructor(_0x5c5926){this['fetch']=_0x5c5926,this['path']='search-services';}['create'](_0x39a275,_0x244270,_0x1d7f1a,_0x5090b1,_0x35c7d5,_0x2996e8,_0x472e12,_0xdbe87b){return __awaiter$1(this,void 0,void 0,function*(){const _0x40dad1={'account_name':_0x39a275,'search_service_name':_0x244270,'endpoint':_0x1d7f1a,'key':_0x5090b1,'country':_0x35c7d5,'provider':_0x2996e8,'index_name':_0x472e12};try{const _0x22be12=yield this['fetch']['post'](this['path'],_0xdbe87b,_0x40dad1);if(_0x22be12['status']>0xc7&&_0x22be12['status']<0x12c){const _0x256d8e=yield _0x22be12['json']();return new SuccessfulSearchServiceResponse(_0x256d8e);}const _0x59ee1a=yield _0x22be12['json']();return new FailedSearchServiceResponse(_0x59ee1a);}catch(_0x401f7d){if(_0x401f7d instanceof Error)return new FailedSearchServiceResponse({'detail':_0x401f7d['message'],'title':_0x401f7d['name'],'status':0x1f4,'instance':'','type':''});throw _0x401f7d;}});}['delete'](_0x1a6907,_0x3600a4,_0x4d36af){return __awaiter$1(this,void 0,void 0,function*(){const _0x1f71ac=this['path']+'/'+_0x1a6907+'/'+_0x3600a4;try{const _0x494b45=yield this['fetch']['delete'](_0x1f71ac,_0x4d36af);if(_0x494b45['status']>0xc7&&_0x494b45['status']<0x12c)return new SuccessfulResponse({});const _0x29d296=yield _0x494b45['json']();return new FailedResponse(_0x29d296);}catch(_0x4669cf){if(_0x4669cf instanceof Error)return new FailedResponse({'detail':_0x4669cf['message'],'title':_0x4669cf['name'],'status':0x1f4,'instance':'','type':''});throw _0x4669cf;}});}['view'](_0x463ce4,_0x591340,_0x5668bf){return __awaiter$1(this,void 0,void 0,function*(){const _0x1e7800=this['path']+'/'+_0x463ce4+'/'+_0x591340;try{const _0x48ee74=yield this['fetch']['get'](_0x1e7800,_0x5668bf);if(_0x48ee74['status']>0xc7&&_0x48ee74['status']<0x12c){const _0x1dc781=yield _0x48ee74['json']();return new SuccessfulViewSearchServiceResponse(_0x1dc781);}const _0x4fbe83=yield _0x48ee74['json']();return new FailedViewSearchServiceResponse(_0x4fbe83);}catch(_0x3ca1b9){if(_0x3ca1b9 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x3ca1b9['message'],'title':_0x3ca1b9['name'],'status':0x1f4,'instance':'','type':''});throw _0x3ca1b9;}});}['edit'](_0x2c2c7d,_0xe58007,_0x283b25,_0x45cd77,_0x202c40,_0x28d87d){return __awaiter$1(this,void 0,void 0,function*(){const _0x142f8c={'account_name':_0x2c2c7d,'search_service_name':_0xe58007,'new_search_service_name':_0x283b25,'key':_0x45cd77,'country':_0x202c40};try{const _0x5bc4c9=yield this['fetch']['put'](this['path'],_0x28d87d,_0x142f8c);if(_0x5bc4c9['status']>0xc7&&_0x5bc4c9['status']<0x12c){const _0x57090f=yield _0x5bc4c9['json']();return new SuccessfulSearchServiceResponse(_0x57090f);}const _0x1fce5d=yield _0x5bc4c9['json']();return new FailedSearchServiceResponse(_0x1fce5d);}catch(_0xcc0e2f){if(_0xcc0e2f instanceof Error)return new FailedSearchServiceResponse({'detail':_0xcc0e2f['message'],'title':_0xcc0e2f['name'],'status':0x1f4,'instance':'','type':''});throw _0xcc0e2f;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x290239,_0x4cac74,_0x18792d,_0x29ff06){function _0x3979b5(_0x5b4adf){return _0x5b4adf instanceof _0x18792d?_0x5b4adf:new _0x18792d(function(_0x1ba535){_0x1ba535(_0x5b4adf);});}return new(_0x18792d||(_0x18792d=Promise))(function(_0x2d37fc,_0x5567ee){function _0x59c1d3(_0x26caa3){try{_0x32b87a(_0x29ff06['next'](_0x26caa3));}catch(_0x355e46){_0x5567ee(_0x355e46);}}function _0x42032f(_0x21ded0){try{_0x32b87a(_0x29ff06['throw'](_0x21ded0));}catch(_0x548d34){_0x5567ee(_0x548d34);}}function _0x32b87a(_0x15dc37){_0x15dc37['done']?_0x2d37fc(_0x15dc37['value']):_0x3979b5(_0x15dc37['value'])['then'](_0x59c1d3,_0x42032f);}_0x32b87a((_0x29ff06=_0x29ff06['apply'](_0x290239,_0x4cac74||[]))['next']());});};class AdminClient{constructor(_0x26f5ce='https://admin.searchability.dev/'){var _0x38c272=new Fetch(_0x26f5ce);this['Accounts']=new AccountService(_0x38c272),this['Lists']=new ListService(_0x38c272),this['ApiKeys']=new ApiKeyService(_0x38c272),this['SearchServices']=new SearchServersService(_0x38c272);}}class AuthClient{constructor(_0x15d46b='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x15d46b);}['login'](_0x2600ab){return __awaiter(this,void 0,void 0,function*(){const _0x2cb41a='login/'+_0x2600ab;try{const _0x466826=yield yield fetch(_0x2cb41a);if(_0x466826['status']>0xc7&&_0x466826['status']<0x12c){const _0x319d31=yield _0x466826['json']();return new SuccessfulAuthResponse(_0x319d31);}const _0x499610=yield _0x466826['json']();return new FailedAuthResponse(_0x499610);}catch(_0x13cd5e){if(_0x13cd5e instanceof Error)return new FailedAuthResponse({'detail':_0x13cd5e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x13cd5e;}});}['refresh'](_0x21e98f){return __awaiter(this,void 0,void 0,function*(){const _0x3ed01c='refresh',_0x1ea57a={'refresh_token':_0x21e98f};try{const _0x3afbaf=yield this['fetch']['PostNoAuth'](_0x3ed01c,_0x1ea57a);if(_0x3afbaf['status']>0xc7&&_0x3afbaf['status']<0x12c){const _0x4b866a=yield _0x3afbaf['json']();return new SuccessfulAuthResponse(_0x4b866a);}const _0x5e8748=yield _0x3afbaf['json']();return new FailedAuthResponse(_0x5e8748);}catch(_0x24cad5){if(_0x24cad5 instanceof Error)return new FailedAuthResponse({'detail':_0x24cad5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x24cad5;}});}['getTokenStatus'](_0x39ac79){if(Date['now']()<_0x39ac79['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x39ac79['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(_0xe26518){_0xe26518[_0xe26518['Ok']=0x0]='Ok',_0xe26518[_0xe26518['Refresh']=0x1]='Refresh',_0xe26518[_0xe26518['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(_0x2b9f7d){this['isSuccess']=_0x2b9f7d;}}class SuccessfulAccountResponse extends Response{constructor(_0x222725){super(!![]),this['account']=_0x222725;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x20bbfc){super(![]),this['problem']=_0x20bbfc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x288ed5){super(!![]),this['tokens']=_0x288ed5;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x31035a){super(![]),this['problem']=_0x31035a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x461f92){super(!![]),this['apiKey']=_0x461f92;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x6b571a){super(![]),this['problem']=_0x6b571a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x47f50a){super(!![]),this['searchService']=_0x47f50a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x6dad8c){super(![]),this['problem']=_0x6dad8c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x3464a1){super(!![]),this['searchService']=_0x3464a1;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x31621c){super(![]),this['problem']=_0x31621c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x56f229){super(!![]),this['apiKeyValue']=_0x56f229;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x59fbf5){super(!![]),this['obj']=_0x59fbf5;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x51e305){super(![]),this['problem']=_0x51e305;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x1b3ec7){super(![]),this['problem']=_0x1b3ec7;}['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(_0x5a867c,_0x6ebe64,_0x39144d,_0x51129d){function _0x18f919(_0x525014){return _0x525014 instanceof _0x39144d?_0x525014:new _0x39144d(function(_0x10f336){_0x10f336(_0x525014);});}return new(_0x39144d||(_0x39144d=Promise))(function(_0x390084,_0x3986be){function _0x47d665(_0x6dfdcb){try{_0x179850(_0x51129d['next'](_0x6dfdcb));}catch(_0x4cefc8){_0x3986be(_0x4cefc8);}}function _0x3041a8(_0x40c112){try{_0x179850(_0x51129d['throw'](_0x40c112));}catch(_0x5a94ed){_0x3986be(_0x5a94ed);}}function _0x179850(_0xbcb6c6){_0xbcb6c6['done']?_0x390084(_0xbcb6c6['value']):_0x18f919(_0xbcb6c6['value'])['then'](_0x47d665,_0x3041a8);}_0x179850((_0x51129d=_0x51129d['apply'](_0x5a867c,_0x6ebe64||[]))['next']());});};class AccountService{constructor(_0x589004){this['fetch']=_0x589004;}['get'](_0x315f80,_0x587597){return __awaiter$5(this,void 0,void 0,function*(){const _0x26628d='Account/'+_0x315f80+'/',_0x3f0880=yield this['fetch']['get'](_0x26628d,_0x587597);try{if(_0x3f0880['status']>0xc7&&_0x3f0880['status']<0x12c){const _0x55c3c4=yield _0x3f0880['json']();return new SuccessfulAccountResponse(_0x55c3c4);}const _0x12e6e3=yield _0x3f0880['json']();return new FailedAccountResponse(_0x12e6e3);}catch(_0x407128){if(_0x407128 instanceof Error)return new FailedAccountResponse({'detail':_0x407128['message'],'title':_0x407128['name'],'status':0x1f4,'instance':'','type':''});throw _0x407128;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5a66f9,_0x5e5d1c,_0x9f5ada,_0x381109){function _0x45786f(_0x2fa5bc){return _0x2fa5bc instanceof _0x9f5ada?_0x2fa5bc:new _0x9f5ada(function(_0x5b6433){_0x5b6433(_0x2fa5bc);});}return new(_0x9f5ada||(_0x9f5ada=Promise))(function(_0x336903,_0x2fa082){function _0x1a5795(_0x4d0945){try{_0x5575b4(_0x381109['next'](_0x4d0945));}catch(_0x1b362e){_0x2fa082(_0x1b362e);}}function _0x241207(_0x11d5f9){try{_0x5575b4(_0x381109['throw'](_0x11d5f9));}catch(_0xaa8c51){_0x2fa082(_0xaa8c51);}}function _0x5575b4(_0x43e6c6){_0x43e6c6['done']?_0x336903(_0x43e6c6['value']):_0x45786f(_0x43e6c6['value'])['then'](_0x1a5795,_0x241207);}_0x5575b4((_0x381109=_0x381109['apply'](_0x5a66f9,_0x5e5d1c||[]))['next']());});};class ApiKeyService{constructor(_0x4d1b18){this['fetch']=_0x4d1b18,this['path']='api-key';}['create'](_0x228e30,_0x286025,_0x569fc7){return __awaiter$4(this,void 0,void 0,function*(){const _0x80a29={'account_name':_0x228e30,'api_key_name':_0x286025};try{const _0x3cd9b3=yield this['fetch']['post'](this['path'],_0x569fc7,_0x80a29);if(_0x3cd9b3['status']>0xc7&&_0x3cd9b3['status']<0x12c){const _0x54a325=yield _0x3cd9b3['json']();return new SuccessfulApiKeyResponse(_0x54a325);}const _0x404d7b=yield _0x3cd9b3['json']();return new FailedApiKeyResponse(_0x404d7b);}catch(_0x2acbd3){if(_0x2acbd3 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2acbd3['message'],'title':_0x2acbd3['name'],'status':0x1f4,'instance':'','type':''});throw _0x2acbd3;}});}['view'](_0xf7b80,_0x47b4c4,_0x3c3180){return __awaiter$4(this,void 0,void 0,function*(){const _0x176d07=this['path']+'/'+_0xf7b80+'/'+_0x47b4c4;try{const _0x2ae575=yield this['fetch']['get'](_0x176d07,_0x3c3180);if(_0x2ae575['status']>0xc7&&_0x2ae575['status']<0x12c){const _0xb10d01=yield _0x2ae575['json']();return new SuccessfulApiKeyValueResponse(_0xb10d01);}const _0x58caab=yield _0x2ae575['json']();return new FailedApiKeyValueResponse(_0x58caab);}catch(_0x124c65){if(_0x124c65 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x124c65['message'],'title':_0x124c65['name'],'status':0x1f4,'instance':'','type':''});throw _0x124c65;}});}['delete'](_0x445b15,_0x32f61e,_0x1b96f5){return __awaiter$4(this,void 0,void 0,function*(){const _0x45d684=this['path']+'/'+_0x445b15+'/'+_0x32f61e;try{const _0x3d63d9=yield this['fetch']['delete'](_0x45d684,_0x1b96f5);if(_0x3d63d9['status']>0xc7&&_0x3d63d9['status']<0x12c)return new SuccessfulResponse({});const _0x2f4b50=yield _0x3d63d9['json']();return new FailedResponse(_0x2f4b50);}catch(_0xb1b651){if(_0xb1b651 instanceof Error)return new FailedResponse({'detail':_0xb1b651['message'],'title':_0xb1b651['name'],'status':0x1f4,'instance':'','type':''});throw _0xb1b651;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x38c1c1,_0xd42dd5,_0x6cb06d,_0x5f2c13){function _0x21c133(_0x2b9a23){return _0x2b9a23 instanceof _0x6cb06d?_0x2b9a23:new _0x6cb06d(function(_0x415fc9){_0x415fc9(_0x2b9a23);});}return new(_0x6cb06d||(_0x6cb06d=Promise))(function(_0xe101d0,_0x2ed484){function _0x322275(_0x219ec6){try{_0x53ad2a(_0x5f2c13['next'](_0x219ec6));}catch(_0x3e3383){_0x2ed484(_0x3e3383);}}function _0x5b1a24(_0xbea8f9){try{_0x53ad2a(_0x5f2c13['throw'](_0xbea8f9));}catch(_0x4edde1){_0x2ed484(_0x4edde1);}}function _0x53ad2a(_0x2da2d0){_0x2da2d0['done']?_0xe101d0(_0x2da2d0['value']):_0x21c133(_0x2da2d0['value'])['then'](_0x322275,_0x5b1a24);}_0x53ad2a((_0x5f2c13=_0x5f2c13['apply'](_0x38c1c1,_0xd42dd5||[]))['next']());});};class ListService{constructor(_0x2f0b32){this['fetch']=_0x2f0b32;}['add'](_0x5e76e4,_0x3357de,_0x13805c){return __awaiter$3(this,void 0,void 0,function*(){const _0x5f4580='List',_0x363531={'account_name':_0x5e76e4,'list_name':_0x3357de};try{const _0x8b075=yield this['fetch']['post'](_0x5f4580,_0x13805c,_0x363531);if(_0x8b075['status']>0xc7&&_0x8b075['status']<0x12c){const _0x433fc6=yield _0x8b075['json']();return new SuccessfulAccountResponse(_0x433fc6);}const _0x50d74b=yield _0x8b075['json']();return new FailedAccountResponse(_0x50d74b);}catch(_0x583e50){if(_0x583e50 instanceof Error)return new FailedAccountResponse({'detail':_0x583e50['message'],'title':_0x583e50['name'],'status':0x1f4,'instance':'','type':''});throw _0x583e50;}});}['remove'](_0x3c5b83,_0x2cfaa2,_0x419a6e){return __awaiter$3(this,void 0,void 0,function*(){const _0x13c74f='List/'+_0x3c5b83+'/'+_0x2cfaa2,_0x2cb172=yield this['fetch']['delete'](_0x13c74f,_0x419a6e);try{if(_0x2cb172['status']>0xc7&&_0x2cb172['status']<0x12c){const _0xcf52cb=yield _0x2cb172['json']();return new SuccessfulAccountResponse(_0xcf52cb);}const _0x1eb799=yield _0x2cb172['json']();return new FailedAccountResponse(_0x1eb799);}catch(_0x454eb2){if(_0x454eb2 instanceof Error)return new FailedAccountResponse({'detail':_0x454eb2['message'],'title':_0x454eb2['name'],'status':0x1f4,'instance':'','type':''});throw _0x454eb2;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x43a0c3,_0x2b6143,_0x433161,_0x51bfa0){function _0x8a0425(_0x16a894){return _0x16a894 instanceof _0x433161?_0x16a894:new _0x433161(function(_0x3480f7){_0x3480f7(_0x16a894);});}return new(_0x433161||(_0x433161=Promise))(function(_0x3a834b,_0x3c874e){function _0x480085(_0x5a60d5){try{_0x28f3d9(_0x51bfa0['next'](_0x5a60d5));}catch(_0x2dffc8){_0x3c874e(_0x2dffc8);}}function _0x5824c2(_0x50f80c){try{_0x28f3d9(_0x51bfa0['throw'](_0x50f80c));}catch(_0x50fa7a){_0x3c874e(_0x50fa7a);}}function _0x28f3d9(_0x311453){_0x311453['done']?_0x3a834b(_0x311453['value']):_0x8a0425(_0x311453['value'])['then'](_0x480085,_0x5824c2);}_0x28f3d9((_0x51bfa0=_0x51bfa0['apply'](_0x43a0c3,_0x2b6143||[]))['next']());});};class Fetch{constructor(_0x2eea82){this['baseUri']=_0x2eea82,this['getUrl']=_0x4c19b1=>{return _0x4c19b1['startsWith']('/')&&(_0x4c19b1=_0x4c19b1['replace']('/','')),''+this['baseUri']+_0x4c19b1;},!_0x2eea82['endsWith']('/')&&(_0x2eea82=_0x2eea82+'/');}['get'](_0x4b450f,_0x57a003){return __awaiter$2(this,void 0,void 0,function*(){const _0x1e05a8=this['getUrl'](_0x4b450f);return yield fetch(_0x1e05a8,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x57a003}});});}['post'](_0x417967,_0x3632a3,_0x1fb4dc){return __awaiter$2(this,void 0,void 0,function*(){const _0x451400=this['getUrl'](_0x417967);return yield fetch(_0x451400,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3632a3},'body':_0x1fb4dc?JSON['stringify'](_0x1fb4dc):null});});}['PostNoAuth'](_0x4d136c,_0x199990){return __awaiter$2(this,void 0,void 0,function*(){const _0x2ece97=this['getUrl'](_0x4d136c);return yield fetch(_0x2ece97,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x199990?JSON['stringify'](_0x199990):null});});}['put'](_0x2571ae,_0x504583,_0x3c372d){return __awaiter$2(this,void 0,void 0,function*(){const _0x1b8153=this['getUrl'](_0x2571ae);return yield fetch(_0x1b8153,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x504583},'body':_0x3c372d?JSON['stringify'](_0x3c372d):null});});}['delete'](_0x3c281a,_0x210dfd){return __awaiter$2(this,void 0,void 0,function*(){const _0x5c91c4=this['getUrl'](_0x3c281a);return yield fetch(_0x5c91c4,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x210dfd}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x31afc4,_0x54eb3f,_0x643ef7,_0x1d9e18){function _0x4176c9(_0x25b13e){return _0x25b13e instanceof _0x643ef7?_0x25b13e:new _0x643ef7(function(_0x282edc){_0x282edc(_0x25b13e);});}return new(_0x643ef7||(_0x643ef7=Promise))(function(_0x4eb245,_0x348b08){function _0xe5a06f(_0x433f0c){try{_0x75f799(_0x1d9e18['next'](_0x433f0c));}catch(_0x300287){_0x348b08(_0x300287);}}function _0x2c54ce(_0x372419){try{_0x75f799(_0x1d9e18['throw'](_0x372419));}catch(_0x4cc310){_0x348b08(_0x4cc310);}}function _0x75f799(_0x54913c){_0x54913c['done']?_0x4eb245(_0x54913c['value']):_0x4176c9(_0x54913c['value'])['then'](_0xe5a06f,_0x2c54ce);}_0x75f799((_0x1d9e18=_0x1d9e18['apply'](_0x31afc4,_0x54eb3f||[]))['next']());});};class SearchServersService{constructor(_0xe85b19){this['fetch']=_0xe85b19,this['path']='search-services';}['create'](_0x57438e,_0xae077c,_0x3f59f7,_0x11ff4a,_0xa74bb6,_0x5ec02e,_0xd49d0f,_0x39acfe){return __awaiter$1(this,void 0,void 0,function*(){const _0x5c9f47={'account_name':_0x57438e,'search_service_name':_0xae077c,'endpoint':_0x3f59f7,'key':_0x11ff4a,'country':_0xa74bb6,'provider':_0x5ec02e,'index_name':_0xd49d0f};try{const _0x49c11b=yield this['fetch']['post'](this['path'],_0x39acfe,_0x5c9f47);if(_0x49c11b['status']>0xc7&&_0x49c11b['status']<0x12c){const _0x574a73=yield _0x49c11b['json']();return new SuccessfulSearchServiceResponse(_0x574a73);}const _0x5d85cd=yield _0x49c11b['json']();return new FailedSearchServiceResponse(_0x5d85cd);}catch(_0x963b0){if(_0x963b0 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x963b0['message'],'title':_0x963b0['name'],'status':0x1f4,'instance':'','type':''});throw _0x963b0;}});}['delete'](_0x43c62f,_0x30976a,_0x217369){return __awaiter$1(this,void 0,void 0,function*(){const _0x27c8e5=this['path']+'/'+_0x43c62f+'/'+_0x30976a;try{const _0x2cb878=yield this['fetch']['delete'](_0x27c8e5,_0x217369);if(_0x2cb878['status']>0xc7&&_0x2cb878['status']<0x12c)return new SuccessfulResponse({});const _0x1f71c4=yield _0x2cb878['json']();return new FailedResponse(_0x1f71c4);}catch(_0x4c5a2b){if(_0x4c5a2b instanceof Error)return new FailedResponse({'detail':_0x4c5a2b['message'],'title':_0x4c5a2b['name'],'status':0x1f4,'instance':'','type':''});throw _0x4c5a2b;}});}['view'](_0x11255e,_0x19d562,_0x551a7a){return __awaiter$1(this,void 0,void 0,function*(){const _0x10fd25=this['path']+'/'+_0x11255e+'/'+_0x19d562;try{const _0x75064e=yield this['fetch']['get'](_0x10fd25,_0x551a7a);if(_0x75064e['status']>0xc7&&_0x75064e['status']<0x12c){const _0x47619c=yield _0x75064e['json']();return new SuccessfulViewSearchServiceResponse(_0x47619c);}const _0x426eeb=yield _0x75064e['json']();return new FailedViewSearchServiceResponse(_0x426eeb);}catch(_0x2adefc){if(_0x2adefc instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x2adefc['message'],'title':_0x2adefc['name'],'status':0x1f4,'instance':'','type':''});throw _0x2adefc;}});}['edit'](_0x333a7f,_0x36585f,_0x413faa,_0x1fc0da,_0x472679,_0x5847ec){return __awaiter$1(this,void 0,void 0,function*(){const _0x33e6e4={'account_name':_0x333a7f,'search_service_name':_0x36585f,'new_search_service_name':_0x413faa,'key':_0x1fc0da,'country':_0x472679};try{const _0x1c18b7=yield this['fetch']['put'](this['path'],_0x5847ec,_0x33e6e4);if(_0x1c18b7['status']>0xc7&&_0x1c18b7['status']<0x12c){const _0x5cc9f2=yield _0x1c18b7['json']();return new SuccessfulSearchServiceResponse(_0x5cc9f2);}const _0xc09109=yield _0x1c18b7['json']();return new FailedSearchServiceResponse(_0xc09109);}catch(_0x1a200b){if(_0x1a200b instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1a200b['message'],'title':_0x1a200b['name'],'status':0x1f4,'instance':'','type':''});throw _0x1a200b;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1cda97,_0x1af37a,_0x134a82,_0x2ca084){function _0x463f49(_0xb954d4){return _0xb954d4 instanceof _0x134a82?_0xb954d4:new _0x134a82(function(_0x598182){_0x598182(_0xb954d4);});}return new(_0x134a82||(_0x134a82=Promise))(function(_0x37446b,_0x7361b7){function _0x316572(_0x21221f){try{_0x4f65fb(_0x2ca084['next'](_0x21221f));}catch(_0x5476eb){_0x7361b7(_0x5476eb);}}function _0x5d8318(_0x47b4ee){try{_0x4f65fb(_0x2ca084['throw'](_0x47b4ee));}catch(_0x34f870){_0x7361b7(_0x34f870);}}function _0x4f65fb(_0x488db6){_0x488db6['done']?_0x37446b(_0x488db6['value']):_0x463f49(_0x488db6['value'])['then'](_0x316572,_0x5d8318);}_0x4f65fb((_0x2ca084=_0x2ca084['apply'](_0x1cda97,_0x1af37a||[]))['next']());});};class AdminClient{constructor(_0x2de1e9='https://admin.searchability.dev/'){var _0x3628ec=new Fetch(_0x2de1e9);this['Accounts']=new AccountService(_0x3628ec),this['Lists']=new ListService(_0x3628ec),this['ApiKeys']=new ApiKeyService(_0x3628ec),this['SearchServices']=new SearchServersService(_0x3628ec);}}class AuthClient{constructor(_0x248a46='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x248a46);}['login'](_0x15b7fc){return __awaiter(this,void 0,void 0,function*(){const _0x28625f='login/'+_0x15b7fc;try{const _0x2a6d5d=yield yield fetch(_0x28625f);if(_0x2a6d5d['status']>0xc7&&_0x2a6d5d['status']<0x12c){const _0x5a3d86=yield _0x2a6d5d['json']();return new SuccessfulAuthResponse(_0x5a3d86);}const _0x4e9cc6=yield _0x2a6d5d['json']();return new FailedAuthResponse(_0x4e9cc6);}catch(_0x597ba4){if(_0x597ba4 instanceof Error)return new FailedAuthResponse({'detail':_0x597ba4['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x597ba4;}});}['refresh'](_0x3dc1e5){return __awaiter(this,void 0,void 0,function*(){const _0x5a38c1='refresh',_0x1a8310={'refresh_token':_0x3dc1e5};try{const _0x92d333=yield this['fetch']['PostNoAuth'](_0x5a38c1,_0x1a8310);if(_0x92d333['status']>0xc7&&_0x92d333['status']<0x12c){const _0x2ea849=yield _0x92d333['json']();return new SuccessfulAuthResponse(_0x2ea849);}const _0x59ba39=yield _0x92d333['json']();return new FailedAuthResponse(_0x59ba39);}catch(_0x3158f5){if(_0x3158f5 instanceof Error)return new FailedAuthResponse({'detail':_0x3158f5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3158f5;}});}['getTokenStatus'](_0xdfd039){if(Date['now']()<_0xdfd039['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0xdfd039['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 {
|
|
@@ -99,6 +100,8 @@ type SearchService = {
|
|
|
99
100
|
type SearchServiceDetails = {
|
|
100
101
|
endpoint: string;
|
|
101
102
|
key: number;
|
|
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.43",
|
|
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 };
|