@searchability/admin-client 0.0.41 → 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
|
@@ -4,6 +4,7 @@ declare class Fetch {
|
|
|
4
4
|
private getUrl;
|
|
5
5
|
get(path: string, accessToken: string): Promise<globalThis.Response>;
|
|
6
6
|
post(path: string, accessToken: string, body: any): Promise<globalThis.Response>;
|
|
7
|
+
PostNoAuth(path: string, body: any): Promise<globalThis.Response>;
|
|
7
8
|
put(path: string, accessToken: string, body: any): Promise<globalThis.Response>;
|
|
8
9
|
delete(path: string, accessToken: string): Promise<globalThis.Response>;
|
|
9
10
|
}
|
|
@@ -37,6 +38,7 @@ declare class SearchServersService {
|
|
|
37
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>>;
|
|
38
39
|
delete(account_name: string, search_service_name: string, access_token: string): Promise<Response<any, Problem>>;
|
|
39
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>>;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
declare class AdminClient {
|
|
@@ -59,6 +61,9 @@ declare enum TokenStatus {
|
|
|
59
61
|
Refresh = 1,
|
|
60
62
|
Expired = 2
|
|
61
63
|
}
|
|
64
|
+
type RefreshRequest = {
|
|
65
|
+
refresh_token: string;
|
|
66
|
+
};
|
|
62
67
|
declare class Tokens {
|
|
63
68
|
access_token: string;
|
|
64
69
|
access_expires: number;
|
|
@@ -95,6 +100,8 @@ type SearchService = {
|
|
|
95
100
|
type SearchServiceDetails = {
|
|
96
101
|
endpoint: string;
|
|
97
102
|
key: number;
|
|
103
|
+
search_service_name: string;
|
|
104
|
+
country: string;
|
|
98
105
|
};
|
|
99
106
|
type ApiKeyValue = {
|
|
100
107
|
value: string;
|
|
@@ -205,4 +212,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
205
212
|
toProblem(): Problem;
|
|
206
213
|
}
|
|
207
214
|
|
|
208
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, type List, type ListIdentity, type Problem, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
|
215
|
+
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
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(_0x29474c){_0x29474c[_0x29474c['Ok']=0x0]='Ok',_0x29474c[_0x29474c['Refresh']=0x1]='Refresh',_0x29474c[_0x29474c['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(_0x163727){this['isSuccess']=_0x163727;}}class SuccessfulAccountResponse extends Response{constructor(_0x3f71a6){super(!![]),this['account']=_0x3f71a6;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x202622){super(![]),this['problem']=_0x202622;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x3b3d2c){super(!![]),this['tokens']=_0x3b3d2c;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x984b9e){super(![]),this['problem']=_0x984b9e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x19ff41){super(!![]),this['apiKey']=_0x19ff41;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x343c3a){super(![]),this['problem']=_0x343c3a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x1d4c2e){super(!![]),this['searchService']=_0x1d4c2e;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x933194){super(![]),this['problem']=_0x933194;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x81d952){super(!![]),this['searchService']=_0x81d952;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x5fa441){super(![]),this['problem']=_0x5fa441;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x58ebc0){super(!![]),this['apiKeyValue']=_0x58ebc0;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x47e5d8){super(!![]),this['obj']=_0x47e5d8;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x1418f8){super(![]),this['problem']=_0x1418f8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x553317){super(![]),this['problem']=_0x553317;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x7c26e3,_0x43f59c,_0x251f24,_0x3234da){function _0x3fc1a6(_0x47e672){return _0x47e672 instanceof _0x251f24?_0x47e672:new _0x251f24(function(_0x363d52){_0x363d52(_0x47e672);});}return new(_0x251f24||(_0x251f24=Promise))(function(_0x44cc75,_0x4a4074){function _0x54583c(_0x137c84){try{_0x4c3bf6(_0x3234da['next'](_0x137c84));}catch(_0x3c5959){_0x4a4074(_0x3c5959);}}function _0x211b6d(_0x3c7f60){try{_0x4c3bf6(_0x3234da['throw'](_0x3c7f60));}catch(_0x3180ea){_0x4a4074(_0x3180ea);}}function _0x4c3bf6(_0x3da63e){_0x3da63e['done']?_0x44cc75(_0x3da63e['value']):_0x3fc1a6(_0x3da63e['value'])['then'](_0x54583c,_0x211b6d);}_0x4c3bf6((_0x3234da=_0x3234da['apply'](_0x7c26e3,_0x43f59c||[]))['next']());});};class AccountService{constructor(_0x2362b8){this['fetch']=_0x2362b8;}['get'](_0x2b3bb6,_0x3400bd){return __awaiter$5(this,void 0,void 0,function*(){const _0x28c9d='Account/'+_0x2b3bb6+'/',_0x2a6b0f=yield this['fetch']['get'](_0x28c9d,_0x3400bd);try{if(_0x2a6b0f['status']>0xc7&&_0x2a6b0f['status']<0x12c){const _0x1a3adb=yield _0x2a6b0f['json']();return new SuccessfulAccountResponse(_0x1a3adb);}const _0x2ccba0=yield _0x2a6b0f['json']();return new FailedAccountResponse(_0x2ccba0);}catch(_0x45feda){if(_0x45feda instanceof Error)return new FailedAccountResponse({'detail':_0x45feda['message'],'title':_0x45feda['name'],'status':0x1f4,'instance':'','type':''});throw _0x45feda;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x29a9fa,_0x1bc802,_0x4179d7,_0x3114d8){function _0x348c90(_0x50f813){return _0x50f813 instanceof _0x4179d7?_0x50f813:new _0x4179d7(function(_0x57485b){_0x57485b(_0x50f813);});}return new(_0x4179d7||(_0x4179d7=Promise))(function(_0x205e35,_0x1aef0e){function _0x390692(_0x205e29){try{_0x2294f6(_0x3114d8['next'](_0x205e29));}catch(_0x470e48){_0x1aef0e(_0x470e48);}}function _0x486719(_0x483448){try{_0x2294f6(_0x3114d8['throw'](_0x483448));}catch(_0x376a4b){_0x1aef0e(_0x376a4b);}}function _0x2294f6(_0xc3ecf8){_0xc3ecf8['done']?_0x205e35(_0xc3ecf8['value']):_0x348c90(_0xc3ecf8['value'])['then'](_0x390692,_0x486719);}_0x2294f6((_0x3114d8=_0x3114d8['apply'](_0x29a9fa,_0x1bc802||[]))['next']());});};class ApiKeyService{constructor(_0x4cdaec){this['fetch']=_0x4cdaec,this['path']='api-key';}['create'](_0x257d03,_0x54b051,_0x1b346f){return __awaiter$4(this,void 0,void 0,function*(){const _0x21b5e6={'account_name':_0x257d03,'api_key_name':_0x54b051};try{const _0x85fcd0=yield this['fetch']['post'](this['path'],_0x1b346f,_0x21b5e6);if(_0x85fcd0['status']>0xc7&&_0x85fcd0['status']<0x12c){const _0x4d56aa=yield _0x85fcd0['json']();return new SuccessfulApiKeyResponse(_0x4d56aa);}const _0x123282=yield _0x85fcd0['json']();return new FailedApiKeyResponse(_0x123282);}catch(_0x3c2424){if(_0x3c2424 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3c2424['message'],'title':_0x3c2424['name'],'status':0x1f4,'instance':'','type':''});throw _0x3c2424;}});}['view'](_0x5e0205,_0x26e635,_0x458a5c){return __awaiter$4(this,void 0,void 0,function*(){const _0x47bff8=this['path']+'/'+_0x5e0205+'/'+_0x26e635;try{const _0x6b2087=yield this['fetch']['get'](_0x47bff8,_0x458a5c);if(_0x6b2087['status']>0xc7&&_0x6b2087['status']<0x12c){const _0x308e2b=yield _0x6b2087['json']();return new SuccessfulApiKeyValueResponse(_0x308e2b);}const _0x1283f8=yield _0x6b2087['json']();return new FailedApiKeyValueResponse(_0x1283f8);}catch(_0x314fff){if(_0x314fff instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x314fff['message'],'title':_0x314fff['name'],'status':0x1f4,'instance':'','type':''});throw _0x314fff;}});}['delete'](_0x39cccb,_0x269f15,_0x59c906){return __awaiter$4(this,void 0,void 0,function*(){const _0x432cea=this['path']+'/'+_0x39cccb+'/'+_0x269f15;try{const _0x2f7322=yield this['fetch']['delete'](_0x432cea,_0x59c906);if(_0x2f7322['status']>0xc7&&_0x2f7322['status']<0x12c)return new SuccessfulResponse({});const _0x38941f=yield _0x2f7322['json']();return new FailedResponse(_0x38941f);}catch(_0x17c062){if(_0x17c062 instanceof Error)return new FailedResponse({'detail':_0x17c062['message'],'title':_0x17c062['name'],'status':0x1f4,'instance':'','type':''});throw _0x17c062;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x9782f2,_0x4a65fe,_0x3b4cfb,_0x24621c){function _0x240d3d(_0x1a0ea2){return _0x1a0ea2 instanceof _0x3b4cfb?_0x1a0ea2:new _0x3b4cfb(function(_0x48ab96){_0x48ab96(_0x1a0ea2);});}return new(_0x3b4cfb||(_0x3b4cfb=Promise))(function(_0x392ec7,_0x40d9ae){function _0x5a4e7f(_0x3803c5){try{_0x2a772d(_0x24621c['next'](_0x3803c5));}catch(_0x443559){_0x40d9ae(_0x443559);}}function _0x40d081(_0x2260b5){try{_0x2a772d(_0x24621c['throw'](_0x2260b5));}catch(_0x33f192){_0x40d9ae(_0x33f192);}}function _0x2a772d(_0x40c5a2){_0x40c5a2['done']?_0x392ec7(_0x40c5a2['value']):_0x240d3d(_0x40c5a2['value'])['then'](_0x5a4e7f,_0x40d081);}_0x2a772d((_0x24621c=_0x24621c['apply'](_0x9782f2,_0x4a65fe||[]))['next']());});};class ListService{constructor(_0x2ee11e){this['fetch']=_0x2ee11e;}['add'](_0x12b674,_0x422541,_0x3f897a){return __awaiter$3(this,void 0,void 0,function*(){const _0x2fd1df='List',_0x367b8b={'account_name':_0x12b674,'list_name':_0x422541};try{const _0x3944f5=yield this['fetch']['post'](_0x2fd1df,_0x3f897a,_0x367b8b);if(_0x3944f5['status']>0xc7&&_0x3944f5['status']<0x12c){const _0x5964e3=yield _0x3944f5['json']();return new SuccessfulAccountResponse(_0x5964e3);}const _0x4e4737=yield _0x3944f5['json']();return new FailedAccountResponse(_0x4e4737);}catch(_0x1da67c){if(_0x1da67c instanceof Error)return new FailedAccountResponse({'detail':_0x1da67c['message'],'title':_0x1da67c['name'],'status':0x1f4,'instance':'','type':''});throw _0x1da67c;}});}['remove'](_0xdd935,_0x5949e6,_0x24c09c){return __awaiter$3(this,void 0,void 0,function*(){const _0xbcd122='List/'+_0xdd935+'/'+_0x5949e6,_0xbc32bf=yield this['fetch']['delete'](_0xbcd122,_0x24c09c);try{if(_0xbc32bf['status']>0xc7&&_0xbc32bf['status']<0x12c){const _0x1dcec1=yield _0xbc32bf['json']();return new SuccessfulAccountResponse(_0x1dcec1);}const _0x2038f1=yield _0xbc32bf['json']();return new FailedAccountResponse(_0x2038f1);}catch(_0x2992cd){if(_0x2992cd instanceof Error)return new FailedAccountResponse({'detail':_0x2992cd['message'],'title':_0x2992cd['name'],'status':0x1f4,'instance':'','type':''});throw _0x2992cd;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x436ecc,_0x5ee802,_0x39720f,_0x1f68b0){function _0x309a28(_0x2e3c56){return _0x2e3c56 instanceof _0x39720f?_0x2e3c56:new _0x39720f(function(_0x1cfd2c){_0x1cfd2c(_0x2e3c56);});}return new(_0x39720f||(_0x39720f=Promise))(function(_0x1c17ad,_0x54c994){function _0x3e8c70(_0xa297aa){try{_0x556252(_0x1f68b0['next'](_0xa297aa));}catch(_0x266d7c){_0x54c994(_0x266d7c);}}function _0x2f4abb(_0x103467){try{_0x556252(_0x1f68b0['throw'](_0x103467));}catch(_0x59f493){_0x54c994(_0x59f493);}}function _0x556252(_0x5271bc){_0x5271bc['done']?_0x1c17ad(_0x5271bc['value']):_0x309a28(_0x5271bc['value'])['then'](_0x3e8c70,_0x2f4abb);}_0x556252((_0x1f68b0=_0x1f68b0['apply'](_0x436ecc,_0x5ee802||[]))['next']());});};class Fetch{constructor(_0xe79e96){this['baseUri']=_0xe79e96,this['getUrl']=_0x1a9d02=>{return _0x1a9d02['startsWith']('/')&&(_0x1a9d02=_0x1a9d02['replace']('/','')),''+this['baseUri']+_0x1a9d02;},!_0xe79e96['endsWith']('/')&&(_0xe79e96=_0xe79e96+'/');}['get'](_0x1bd4d9,_0x25101a){return __awaiter$2(this,void 0,void 0,function*(){const _0x43dbdb=this['getUrl'](_0x1bd4d9);return yield fetch(_0x43dbdb,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x25101a}});});}['post'](_0x47f8dc,_0x41bd65,_0x2dcef1){return __awaiter$2(this,void 0,void 0,function*(){const _0x31ce69=this['getUrl'](_0x47f8dc);return yield fetch(_0x31ce69,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x41bd65},'body':_0x2dcef1?JSON['stringify'](_0x2dcef1):null});});}['put'](_0x4664bc,_0x1961e6,_0x529cf7){return __awaiter$2(this,void 0,void 0,function*(){const _0x3e6597=this['getUrl'](_0x4664bc);return yield fetch(_0x3e6597,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1961e6},'body':_0x529cf7?JSON['stringify'](_0x529cf7):null});});}['delete'](_0x21a9e6,_0x2b6398){return __awaiter$2(this,void 0,void 0,function*(){const _0x5dad26=this['getUrl'](_0x21a9e6);return yield fetch(_0x5dad26,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b6398}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4bb500,_0x5c0bbd,_0x546c4b,_0x191509){function _0x3a8bf8(_0x166232){return _0x166232 instanceof _0x546c4b?_0x166232:new _0x546c4b(function(_0x2a0fe6){_0x2a0fe6(_0x166232);});}return new(_0x546c4b||(_0x546c4b=Promise))(function(_0xd3f1a5,_0xebcad6){function _0x62a7db(_0x321a1c){try{_0x461fbf(_0x191509['next'](_0x321a1c));}catch(_0x30d3b1){_0xebcad6(_0x30d3b1);}}function _0x1f044b(_0x51bc23){try{_0x461fbf(_0x191509['throw'](_0x51bc23));}catch(_0x2a4a3a){_0xebcad6(_0x2a4a3a);}}function _0x461fbf(_0x5183fc){_0x5183fc['done']?_0xd3f1a5(_0x5183fc['value']):_0x3a8bf8(_0x5183fc['value'])['then'](_0x62a7db,_0x1f044b);}_0x461fbf((_0x191509=_0x191509['apply'](_0x4bb500,_0x5c0bbd||[]))['next']());});};class SearchServersService{constructor(_0x3e8c95){this['fetch']=_0x3e8c95,this['path']='search-services';}['create'](_0x388f27,_0x31f50e,_0x44872f,_0x2e5a9a,_0x448a0b,_0x26135e,_0xb813e0,_0x558458){return __awaiter$1(this,void 0,void 0,function*(){const _0x3339c5={'account_name':_0x388f27,'search_service_name':_0x31f50e,'endpoint':_0x44872f,'key':_0x2e5a9a,'country':_0x448a0b,'provider':_0x26135e,'index_name':_0xb813e0};try{const _0xa6595b=yield this['fetch']['post'](this['path'],_0x558458,_0x3339c5);if(_0xa6595b['status']>0xc7&&_0xa6595b['status']<0x12c){const _0x2cfeac=yield _0xa6595b['json']();return new SuccessfulSearchServiceResponse(_0x2cfeac);}const _0x2ec447=yield _0xa6595b['json']();return new FailedSearchServiceResponse(_0x2ec447);}catch(_0x2b4ac2){if(_0x2b4ac2 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2b4ac2['message'],'title':_0x2b4ac2['name'],'status':0x1f4,'instance':'','type':''});throw _0x2b4ac2;}});}['delete'](_0x2a1f60,_0x47d332,_0x3c6bed){return __awaiter$1(this,void 0,void 0,function*(){const _0x4a2c2a=this['path']+'/'+_0x2a1f60+'/'+_0x47d332;try{const _0x3bf763=yield this['fetch']['delete'](_0x4a2c2a,_0x3c6bed);if(_0x3bf763['status']>0xc7&&_0x3bf763['status']<0x12c)return new SuccessfulResponse({});const _0x27ba00=yield _0x3bf763['json']();return new FailedResponse(_0x27ba00);}catch(_0x4c7495){if(_0x4c7495 instanceof Error)return new FailedResponse({'detail':_0x4c7495['message'],'title':_0x4c7495['name'],'status':0x1f4,'instance':'','type':''});throw _0x4c7495;}});}['view'](_0x3ea289,_0x57ad7a,_0x5a56df){return __awaiter$1(this,void 0,void 0,function*(){const _0x35079a=this['path']+'/'+_0x3ea289+'/'+_0x57ad7a;try{const _0x182ff6=yield this['fetch']['get'](_0x35079a,_0x5a56df);if(_0x182ff6['status']>0xc7&&_0x182ff6['status']<0x12c){const _0x528479=yield _0x182ff6['json']();return new SuccessfulViewSearchServiceResponse(_0x528479);}const _0x3de575=yield _0x182ff6['json']();return new FailedViewSearchServiceResponse(_0x3de575);}catch(_0x3beb58){if(_0x3beb58 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x3beb58['message'],'title':_0x3beb58['name'],'status':0x1f4,'instance':'','type':''});throw _0x3beb58;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1f4b52,_0x4bc822,_0x1f57f5,_0x3a1e38){function _0x49cf99(_0x32ccce){return _0x32ccce instanceof _0x1f57f5?_0x32ccce:new _0x1f57f5(function(_0x5dbd7a){_0x5dbd7a(_0x32ccce);});}return new(_0x1f57f5||(_0x1f57f5=Promise))(function(_0x4adc17,_0x462789){function _0x4d2859(_0x1d5ae0){try{_0x591986(_0x3a1e38['next'](_0x1d5ae0));}catch(_0x8d5c55){_0x462789(_0x8d5c55);}}function _0x5b1d31(_0x3a1a3e){try{_0x591986(_0x3a1e38['throw'](_0x3a1a3e));}catch(_0x5554aa){_0x462789(_0x5554aa);}}function _0x591986(_0x4a6613){_0x4a6613['done']?_0x4adc17(_0x4a6613['value']):_0x49cf99(_0x4a6613['value'])['then'](_0x4d2859,_0x5b1d31);}_0x591986((_0x3a1e38=_0x3a1e38['apply'](_0x1f4b52,_0x4bc822||[]))['next']());});};class AdminClient{constructor(_0x5c9139='https://admin.searchability.dev/'){var _0x2f1a39=new Fetch(_0x5c9139);this['Accounts']=new AccountService(_0x2f1a39),this['Lists']=new ListService(_0x2f1a39),this['ApiKeys']=new ApiKeyService(_0x2f1a39),this['SearchServices']=new SearchServersService(_0x2f1a39);}}class AuthClient{constructor(_0x4e5fd5='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x4e5fd5);}['login'](_0x1e56df){return __awaiter(this,void 0,void 0,function*(){var _0x5fb48a='login/'+_0x1e56df;try{const _0x9d86e1=yield yield fetch(_0x5fb48a);if(_0x9d86e1['status']>0xc7&&_0x9d86e1['status']<0x12c){const _0x3af293=yield _0x9d86e1['json']();return new SuccessfulAuthResponse(_0x3af293);}const _0x5e13d5=yield _0x9d86e1['json']();return new FailedAuthResponse(_0x5e13d5);}catch(_0x227fb7){if(_0x227fb7 instanceof Error)return new FailedAuthResponse({'detail':_0x227fb7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x227fb7;}});}['refresh'](_0x51ac00){return __awaiter(this,void 0,void 0,function*(){var _0x10b43d='refresh';try{const _0x4ce44d=yield this['fetch']['post'](_0x10b43d,_0x51ac00,null);if(_0x4ce44d['status']>0xc7&&_0x4ce44d['status']<0x12c){const _0x2eb36c=yield _0x4ce44d['json']();return new SuccessfulAuthResponse(_0x2eb36c);}const _0x152751=yield _0x4ce44d['json']();return new FailedAuthResponse(_0x152751);}catch(_0x392f4d){if(_0x392f4d instanceof Error)return new FailedAuthResponse({'detail':_0x392f4d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x392f4d;}});}['getTokenStatus'](_0x3990fb){if(Date['now']()<_0x3990fb['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3990fb['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|