@searchability/admin-client 0.0.43 → 0.0.45
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(_0x4ec4ba){_0x4ec4ba[_0x4ec4ba['Ok']=0x0]='Ok',_0x4ec4ba[_0x4ec4ba['Refresh']=0x1]='Refresh',_0x4ec4ba[_0x4ec4ba['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(_0x37dafa){this['isSuccess']=_0x37dafa;}}class SuccessfulAccountResponse extends Response{constructor(_0xbc8947){super(!![]),this['account']=_0xbc8947;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x5eba44){super(![]),this['problem']=_0x5eba44;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x1b8022){super(!![]),this['tokens']=_0x1b8022;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x5a30f6){super(![]),this['problem']=_0x5a30f6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x507e03){super(!![]),this['apiKey']=_0x507e03;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1707f7){super(![]),this['problem']=_0x1707f7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x2c56e7){super(!![]),this['searchService']=_0x2c56e7;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x2b47a1){super(![]),this['problem']=_0x2b47a1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x2995bd){super(!![]),this['searchService']=_0x2995bd;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x3fa529){super(![]),this['problem']=_0x3fa529;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x3c1078){super(!![]),this['apiKeyValue']=_0x3c1078;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x12df5f){super(!![]),this['obj']=_0x12df5f;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x534eb8){super(![]),this['problem']=_0x534eb8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x4cbf23){super(![]),this['problem']=_0x4cbf23;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x4e4281,_0x108147,_0x591cb8,_0x1ed4c6){function _0x4435c2(_0x1e97c1){return _0x1e97c1 instanceof _0x591cb8?_0x1e97c1:new _0x591cb8(function(_0x12b835){_0x12b835(_0x1e97c1);});}return new(_0x591cb8||(_0x591cb8=Promise))(function(_0x49c095,_0x55ba6e){function _0x43a82f(_0x768ac8){try{_0x3329dc(_0x1ed4c6['next'](_0x768ac8));}catch(_0x57f3b6){_0x55ba6e(_0x57f3b6);}}function _0x1f5db0(_0x472991){try{_0x3329dc(_0x1ed4c6['throw'](_0x472991));}catch(_0x28c28d){_0x55ba6e(_0x28c28d);}}function _0x3329dc(_0x5f11ac){_0x5f11ac['done']?_0x49c095(_0x5f11ac['value']):_0x4435c2(_0x5f11ac['value'])['then'](_0x43a82f,_0x1f5db0);}_0x3329dc((_0x1ed4c6=_0x1ed4c6['apply'](_0x4e4281,_0x108147||[]))['next']());});};class AccountService{constructor(_0x29aae1){this['fetch']=_0x29aae1;}['get'](_0x591249,_0x32d7f2){return __awaiter$5(this,void 0,void 0,function*(){const _0x5d06ce='Account/'+_0x591249+'/',_0x2d4c71=yield this['fetch']['get'](_0x5d06ce,_0x32d7f2);try{if(_0x2d4c71['status']>0xc7&&_0x2d4c71['status']<0x12c){const _0x1a999a=yield _0x2d4c71['json']();return new SuccessfulAccountResponse(_0x1a999a);}const _0x1dafff=yield _0x2d4c71['json']();return new FailedAccountResponse(_0x1dafff);}catch(_0x4d46dc){if(_0x4d46dc instanceof Error)return new FailedAccountResponse({'detail':_0x4d46dc['message'],'title':_0x4d46dc['name'],'status':0x1f4,'instance':'','type':''});throw _0x4d46dc;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x43f93e,_0xf83647,_0x5bac0a,_0x2935bd){function _0x7f8fa6(_0x20652f){return _0x20652f instanceof _0x5bac0a?_0x20652f:new _0x5bac0a(function(_0x501ed5){_0x501ed5(_0x20652f);});}return new(_0x5bac0a||(_0x5bac0a=Promise))(function(_0xb5e841,_0xb3636d){function _0x8183ea(_0x5ac475){try{_0x1a03db(_0x2935bd['next'](_0x5ac475));}catch(_0x6b6f00){_0xb3636d(_0x6b6f00);}}function _0x3c202d(_0x3292a7){try{_0x1a03db(_0x2935bd['throw'](_0x3292a7));}catch(_0x22ccec){_0xb3636d(_0x22ccec);}}function _0x1a03db(_0x4db600){_0x4db600['done']?_0xb5e841(_0x4db600['value']):_0x7f8fa6(_0x4db600['value'])['then'](_0x8183ea,_0x3c202d);}_0x1a03db((_0x2935bd=_0x2935bd['apply'](_0x43f93e,_0xf83647||[]))['next']());});};class ApiKeyService{constructor(_0x4d0f1c){this['fetch']=_0x4d0f1c,this['path']='api-key';}['create'](_0x4cc35a,_0x4b1171,_0x498cdc){return __awaiter$4(this,void 0,void 0,function*(){const _0x1feec3={'account_name':_0x4cc35a,'api_key_name':_0x4b1171};try{const _0xc44f62=yield this['fetch']['post'](this['path'],_0x498cdc,_0x1feec3);if(_0xc44f62['status']>0xc7&&_0xc44f62['status']<0x12c){const _0x47fb98=yield _0xc44f62['json']();return new SuccessfulApiKeyResponse(_0x47fb98);}const _0x41873b=yield _0xc44f62['json']();return new FailedApiKeyResponse(_0x41873b);}catch(_0x37b0f8){if(_0x37b0f8 instanceof Error)return new FailedApiKeyResponse({'detail':_0x37b0f8['message'],'title':_0x37b0f8['name'],'status':0x1f4,'instance':'','type':''});throw _0x37b0f8;}});}['view'](_0x59d0c0,_0x4a0c85,_0x1464dc){return __awaiter$4(this,void 0,void 0,function*(){const _0x4646f5=this['path']+'/'+_0x59d0c0+'/'+_0x4a0c85;try{const _0x12cf31=yield this['fetch']['get'](_0x4646f5,_0x1464dc);if(_0x12cf31['status']>0xc7&&_0x12cf31['status']<0x12c){const _0x2c967=yield _0x12cf31['json']();return new SuccessfulApiKeyValueResponse(_0x2c967);}const _0x459047=yield _0x12cf31['json']();return new FailedApiKeyValueResponse(_0x459047);}catch(_0x480b66){if(_0x480b66 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x480b66['message'],'title':_0x480b66['name'],'status':0x1f4,'instance':'','type':''});throw _0x480b66;}});}['delete'](_0x543d49,_0x4a40a6,_0x11f030){return __awaiter$4(this,void 0,void 0,function*(){const _0x3c4e29=this['path']+'/'+_0x543d49+'/'+_0x4a40a6;try{const _0x2282ed=yield this['fetch']['delete'](_0x3c4e29,_0x11f030);if(_0x2282ed['status']>0xc7&&_0x2282ed['status']<0x12c)return new SuccessfulResponse({});const _0x587edd=yield _0x2282ed['json']();return new FailedResponse(_0x587edd);}catch(_0x10838d){if(_0x10838d instanceof Error)return new FailedResponse({'detail':_0x10838d['message'],'title':_0x10838d['name'],'status':0x1f4,'instance':'','type':''});throw _0x10838d;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x46a6b1,_0x5ce3ca,_0x4f26d,_0x3b9d12){function _0x50542e(_0x51d2c4){return _0x51d2c4 instanceof _0x4f26d?_0x51d2c4:new _0x4f26d(function(_0x3e7b66){_0x3e7b66(_0x51d2c4);});}return new(_0x4f26d||(_0x4f26d=Promise))(function(_0x38da43,_0x3c3559){function _0x376960(_0x2c0763){try{_0x5a56b2(_0x3b9d12['next'](_0x2c0763));}catch(_0x2f4260){_0x3c3559(_0x2f4260);}}function _0x1762af(_0x511e73){try{_0x5a56b2(_0x3b9d12['throw'](_0x511e73));}catch(_0x57e277){_0x3c3559(_0x57e277);}}function _0x5a56b2(_0x248b83){_0x248b83['done']?_0x38da43(_0x248b83['value']):_0x50542e(_0x248b83['value'])['then'](_0x376960,_0x1762af);}_0x5a56b2((_0x3b9d12=_0x3b9d12['apply'](_0x46a6b1,_0x5ce3ca||[]))['next']());});};class ListService{constructor(_0x1ef6ee){this['fetch']=_0x1ef6ee;}['add'](_0x2f65b3,_0x5d6a2a,_0xa2c250){return __awaiter$3(this,void 0,void 0,function*(){const _0x1d0683='List',_0x53c18e={'account_name':_0x2f65b3,'list_name':_0x5d6a2a};try{const _0x53a275=yield this['fetch']['post'](_0x1d0683,_0xa2c250,_0x53c18e);if(_0x53a275['status']>0xc7&&_0x53a275['status']<0x12c){const _0x105b8e=yield _0x53a275['json']();return new SuccessfulAccountResponse(_0x105b8e);}const _0x3b4776=yield _0x53a275['json']();return new FailedAccountResponse(_0x3b4776);}catch(_0x4a8a8e){if(_0x4a8a8e instanceof Error)return new FailedAccountResponse({'detail':_0x4a8a8e['message'],'title':_0x4a8a8e['name'],'status':0x1f4,'instance':'','type':''});throw _0x4a8a8e;}});}['remove'](_0x36e250,_0x3b7981,_0x14a8d8){return __awaiter$3(this,void 0,void 0,function*(){const _0x867033='List/'+_0x36e250+'/'+_0x3b7981,_0x22ed48=yield this['fetch']['delete'](_0x867033,_0x14a8d8);try{if(_0x22ed48['status']>0xc7&&_0x22ed48['status']<0x12c){const _0x55e8d2=yield _0x22ed48['json']();return new SuccessfulAccountResponse(_0x55e8d2);}const _0x593b23=yield _0x22ed48['json']();return new FailedAccountResponse(_0x593b23);}catch(_0x1b0a89){if(_0x1b0a89 instanceof Error)return new FailedAccountResponse({'detail':_0x1b0a89['message'],'title':_0x1b0a89['name'],'status':0x1f4,'instance':'','type':''});throw _0x1b0a89;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x69456,_0x83ad99,_0x1f81bf,_0x9d5a02){function _0x363b9f(_0x39dae2){return _0x39dae2 instanceof _0x1f81bf?_0x39dae2:new _0x1f81bf(function(_0x39f2cf){_0x39f2cf(_0x39dae2);});}return new(_0x1f81bf||(_0x1f81bf=Promise))(function(_0xdb3924,_0x4034f9){function _0x5a6592(_0x3ee228){try{_0x44ece4(_0x9d5a02['next'](_0x3ee228));}catch(_0x4a1afa){_0x4034f9(_0x4a1afa);}}function _0x133819(_0x20fa9f){try{_0x44ece4(_0x9d5a02['throw'](_0x20fa9f));}catch(_0x280c3e){_0x4034f9(_0x280c3e);}}function _0x44ece4(_0x275dd5){_0x275dd5['done']?_0xdb3924(_0x275dd5['value']):_0x363b9f(_0x275dd5['value'])['then'](_0x5a6592,_0x133819);}_0x44ece4((_0x9d5a02=_0x9d5a02['apply'](_0x69456,_0x83ad99||[]))['next']());});};class Fetch{constructor(_0x8adccc){this['baseUri']=_0x8adccc,this['getUrl']=_0x4a1ed0=>{return _0x4a1ed0['startsWith']('/')&&(_0x4a1ed0=_0x4a1ed0['replace']('/','')),''+this['baseUri']+_0x4a1ed0;},!_0x8adccc['endsWith']('/')&&(_0x8adccc=_0x8adccc+'/');}['get'](_0x3d4d7b,_0x5c05f9){return __awaiter$2(this,void 0,void 0,function*(){const _0xc7000a=this['getUrl'](_0x3d4d7b);return yield fetch(_0xc7000a,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5c05f9}});});}['post'](_0x454256,_0x34c0c4,_0x113a17){return __awaiter$2(this,void 0,void 0,function*(){const _0x54a5a0=this['getUrl'](_0x454256);return yield fetch(_0x54a5a0,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x34c0c4},'body':_0x113a17?JSON['stringify'](_0x113a17):null});});}['PostNoAuth'](_0x57039d,_0x574f96){return __awaiter$2(this,void 0,void 0,function*(){const _0x345449=this['getUrl'](_0x57039d);return yield fetch(_0x345449,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x574f96?JSON['stringify'](_0x574f96):null});});}['put'](_0x5167dd,_0x43fc21,_0x27e361){return __awaiter$2(this,void 0,void 0,function*(){const _0x5e44fd=this['getUrl'](_0x5167dd);return yield fetch(_0x5e44fd,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x43fc21},'body':_0x27e361?JSON['stringify'](_0x27e361):null});});}['delete'](_0x574390,_0x5d95fd){return __awaiter$2(this,void 0,void 0,function*(){const _0x56fca7=this['getUrl'](_0x574390);return yield fetch(_0x56fca7,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5d95fd}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3194d2,_0x3487ec,_0x53d0a2,_0x371051){function _0x5208b2(_0x5c2d4e){return _0x5c2d4e instanceof _0x53d0a2?_0x5c2d4e:new _0x53d0a2(function(_0x483d0b){_0x483d0b(_0x5c2d4e);});}return new(_0x53d0a2||(_0x53d0a2=Promise))(function(_0x253437,_0x330394){function _0xba7eed(_0x4a545e){try{_0x1e9099(_0x371051['next'](_0x4a545e));}catch(_0x3d8831){_0x330394(_0x3d8831);}}function _0x157d43(_0x5363ad){try{_0x1e9099(_0x371051['throw'](_0x5363ad));}catch(_0x1d0b5a){_0x330394(_0x1d0b5a);}}function _0x1e9099(_0x2d072c){_0x2d072c['done']?_0x253437(_0x2d072c['value']):_0x5208b2(_0x2d072c['value'])['then'](_0xba7eed,_0x157d43);}_0x1e9099((_0x371051=_0x371051['apply'](_0x3194d2,_0x3487ec||[]))['next']());});};class SearchServersService{constructor(_0x31364e){this['fetch']=_0x31364e,this['path']='search-services';}['create'](_0x2165e2,_0x12b0e2,_0xb2ec73,_0x18a380,_0x41adb4,_0x277a36,_0x372ded,_0x462266){return __awaiter$1(this,void 0,void 0,function*(){const _0xf1b1df={'account_name':_0x2165e2,'search_service_name':_0x12b0e2,'endpoint':_0xb2ec73,'key':_0x18a380,'country':_0x41adb4,'provider':_0x277a36,'index_name':_0x372ded};try{const _0x2daa0d=yield this['fetch']['post'](this['path'],_0x462266,_0xf1b1df);if(_0x2daa0d['status']>0xc7&&_0x2daa0d['status']<0x12c){const _0x11d9f7=yield _0x2daa0d['json']();return new SuccessfulSearchServiceResponse(_0x11d9f7);}const _0x200336=yield _0x2daa0d['json']();return new FailedSearchServiceResponse(_0x200336);}catch(_0x423390){if(_0x423390 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x423390['message'],'title':_0x423390['name'],'status':0x1f4,'instance':'','type':''});throw _0x423390;}});}['delete'](_0x26275c,_0x47d1eb,_0x3d029b){return __awaiter$1(this,void 0,void 0,function*(){const _0x551628=this['path']+'/'+_0x26275c+'/'+_0x47d1eb;try{const _0x452596=yield this['fetch']['delete'](_0x551628,_0x3d029b);if(_0x452596['status']>0xc7&&_0x452596['status']<0x12c)return new SuccessfulResponse({});const _0x116e7d=yield _0x452596['json']();return new FailedResponse(_0x116e7d);}catch(_0x44542f){if(_0x44542f instanceof Error)return new FailedResponse({'detail':_0x44542f['message'],'title':_0x44542f['name'],'status':0x1f4,'instance':'','type':''});throw _0x44542f;}});}['view'](_0x46830b,_0xaf9e71,_0x1f8bb5){return __awaiter$1(this,void 0,void 0,function*(){const _0x30f488=this['path']+'/'+_0x46830b+'/'+_0xaf9e71;try{const _0x4ad503=yield this['fetch']['get'](_0x30f488,_0x1f8bb5);if(_0x4ad503['status']>0xc7&&_0x4ad503['status']<0x12c){const _0x42b75c=yield _0x4ad503['json']();return new SuccessfulViewSearchServiceResponse(_0x42b75c);}const _0x5db356=yield _0x4ad503['json']();return new FailedViewSearchServiceResponse(_0x5db356);}catch(_0x45c21d){if(_0x45c21d instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x45c21d['message'],'title':_0x45c21d['name'],'status':0x1f4,'instance':'','type':''});throw _0x45c21d;}});}['edit'](_0x2a3c68,_0x46c3bf,_0x4d1a18,_0x3c9575,_0x27ceca,_0x12c495){return __awaiter$1(this,void 0,void 0,function*(){const _0x137e1b={'account_name':_0x2a3c68,'search_service_name':_0x46c3bf,'new_search_service_name':_0x4d1a18,'key':_0x3c9575,'country':_0x27ceca};try{const _0x5a0a67=yield this['fetch']['put'](this['path'],_0x12c495,_0x137e1b);if(_0x5a0a67['status']>0xc7&&_0x5a0a67['status']<0x12c){const _0x1edcdc=yield _0x5a0a67['json']();return new SuccessfulSearchServiceResponse(_0x1edcdc);}const _0x2cf02d=yield _0x5a0a67['json']();return new FailedSearchServiceResponse(_0x2cf02d);}catch(_0x1332c9){if(_0x1332c9 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1332c9['message'],'title':_0x1332c9['name'],'status':0x1f4,'instance':'','type':''});throw _0x1332c9;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x146256,_0x4f0839,_0x40662c,_0x3df86b){function _0x45286f(_0x1ba613){return _0x1ba613 instanceof _0x40662c?_0x1ba613:new _0x40662c(function(_0x15ec80){_0x15ec80(_0x1ba613);});}return new(_0x40662c||(_0x40662c=Promise))(function(_0x4cc142,_0x5b557c){function _0x15c935(_0x552a65){try{_0x458f83(_0x3df86b['next'](_0x552a65));}catch(_0x38f646){_0x5b557c(_0x38f646);}}function _0x29b984(_0x5db3c1){try{_0x458f83(_0x3df86b['throw'](_0x5db3c1));}catch(_0x175f33){_0x5b557c(_0x175f33);}}function _0x458f83(_0x4eec4d){_0x4eec4d['done']?_0x4cc142(_0x4eec4d['value']):_0x45286f(_0x4eec4d['value'])['then'](_0x15c935,_0x29b984);}_0x458f83((_0x3df86b=_0x3df86b['apply'](_0x146256,_0x4f0839||[]))['next']());});};class AdminClient{constructor(_0x31e115='https://admin.searchability.dev/'){var _0x2ef0da=new Fetch(_0x31e115);this['Accounts']=new AccountService(_0x2ef0da),this['Lists']=new ListService(_0x2ef0da),this['ApiKeys']=new ApiKeyService(_0x2ef0da),this['SearchServices']=new SearchServersService(_0x2ef0da);}}class AuthClient{constructor(_0x58c306='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x58c306);}['login'](_0x5afc64){return __awaiter(this,void 0,void 0,function*(){const _0x159b23='login/'+_0x5afc64;try{const _0x1a061b=yield yield fetch(_0x159b23);if(_0x1a061b['status']>0xc7&&_0x1a061b['status']<0x12c){const _0x34006e=yield _0x1a061b['json']();return new SuccessfulAuthResponse(_0x34006e);}const _0x418597=yield _0x1a061b['json']();return new FailedAuthResponse(_0x418597);}catch(_0x5e3014){if(_0x5e3014 instanceof Error)return new FailedAuthResponse({'detail':_0x5e3014['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5e3014;}});}['refresh'](_0x4e5166){return __awaiter(this,void 0,void 0,function*(){const _0x1fd461='refresh',_0x2d6263={'refresh_token':_0x4e5166};try{const _0x338792=yield this['fetch']['PostNoAuth'](_0x1fd461,_0x2d6263);if(_0x338792['status']>0xc7&&_0x338792['status']<0x12c){const _0x91339d=yield _0x338792['json']();return new SuccessfulAuthResponse(_0x91339d);}const _0x449025=yield _0x338792['json']();return new FailedAuthResponse(_0x449025);}catch(_0x4e76f4){if(_0x4e76f4 instanceof Error)return new FailedAuthResponse({'detail':_0x4e76f4['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4e76f4;}});}['getTokenStatus'](_0x4894a9){if(Date['now']()<_0x4894a9['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4894a9['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(_0x570ada){_0x570ada[_0x570ada['Ok']=0x0]='Ok',_0x570ada[_0x570ada['Refresh']=0x1]='Refresh',_0x570ada[_0x570ada['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(_0x1fd6c4){this['isSuccess']=_0x1fd6c4;}}class SuccessfulAccountResponse extends Response{constructor(_0x3ca7c0){super(!![]),this['account']=_0x3ca7c0;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x46f045){super(![]),this['problem']=_0x46f045;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x190922){super(!![]),this['tokens']=_0x190922;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x262b61){super(![]),this['problem']=_0x262b61;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x598ad1){super(!![]),this['apiKey']=_0x598ad1;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0xef4999){super(![]),this['problem']=_0xef4999;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x102227){super(!![]),this['searchService']=_0x102227;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0xdad9ff){super(![]),this['problem']=_0xdad9ff;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x5deb2c){super(!![]),this['searchService']=_0x5deb2c;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x4cbff3){super(![]),this['problem']=_0x4cbff3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x5c5cc5){super(!![]),this['apiKeyValue']=_0x5c5cc5;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x15f56d){super(!![]),this['obj']=_0x15f56d;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x12e8d7){super(![]),this['problem']=_0x12e8d7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x32ff9f){super(![]),this['problem']=_0x32ff9f;}['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(_0x41ee69,_0x26ff83,_0x54b3d5,_0x31c6d2){function _0x16cdb3(_0x201f3b){return _0x201f3b instanceof _0x54b3d5?_0x201f3b:new _0x54b3d5(function(_0x1b1f61){_0x1b1f61(_0x201f3b);});}return new(_0x54b3d5||(_0x54b3d5=Promise))(function(_0x4b11af,_0x13032b){function _0x13713e(_0x1870a2){try{_0x34ccdc(_0x31c6d2['next'](_0x1870a2));}catch(_0x201969){_0x13032b(_0x201969);}}function _0x1e1060(_0x3b91c4){try{_0x34ccdc(_0x31c6d2['throw'](_0x3b91c4));}catch(_0x1e6694){_0x13032b(_0x1e6694);}}function _0x34ccdc(_0x3ac4f3){_0x3ac4f3['done']?_0x4b11af(_0x3ac4f3['value']):_0x16cdb3(_0x3ac4f3['value'])['then'](_0x13713e,_0x1e1060);}_0x34ccdc((_0x31c6d2=_0x31c6d2['apply'](_0x41ee69,_0x26ff83||[]))['next']());});};class AccountService{constructor(_0x4ad304){this['fetch']=_0x4ad304;}['get'](_0x1a37f6,_0x556e29){return __awaiter$5(this,void 0,void 0,function*(){const _0x486f79='Account/'+_0x1a37f6+'/',_0x4725d8=yield this['fetch']['get'](_0x486f79,_0x556e29);try{if(_0x4725d8['status']>0xc7&&_0x4725d8['status']<0x12c){const _0x8c257e=yield _0x4725d8['json']();return new SuccessfulAccountResponse(_0x8c257e);}const _0x38cf9c=yield _0x4725d8['json']();return new FailedAccountResponse(_0x38cf9c);}catch(_0xfd7861){if(_0xfd7861 instanceof Error)return new FailedAccountResponse({'detail':_0xfd7861['message'],'title':_0xfd7861['name'],'status':0x1f4,'instance':'','type':''});throw _0xfd7861;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x540baa,_0x504964,_0xe7b23f,_0x24279a){function _0x87b5d0(_0x3930b5){return _0x3930b5 instanceof _0xe7b23f?_0x3930b5:new _0xe7b23f(function(_0x9605a0){_0x9605a0(_0x3930b5);});}return new(_0xe7b23f||(_0xe7b23f=Promise))(function(_0x5d10ea,_0xa623e9){function _0x11287f(_0x501d81){try{_0x448b00(_0x24279a['next'](_0x501d81));}catch(_0x3a2389){_0xa623e9(_0x3a2389);}}function _0x3ac3c8(_0x523db6){try{_0x448b00(_0x24279a['throw'](_0x523db6));}catch(_0x22fc9f){_0xa623e9(_0x22fc9f);}}function _0x448b00(_0x4cf2f9){_0x4cf2f9['done']?_0x5d10ea(_0x4cf2f9['value']):_0x87b5d0(_0x4cf2f9['value'])['then'](_0x11287f,_0x3ac3c8);}_0x448b00((_0x24279a=_0x24279a['apply'](_0x540baa,_0x504964||[]))['next']());});};class ApiKeyService{constructor(_0x4ab3ad){this['fetch']=_0x4ab3ad,this['path']='api-key';}['create'](_0x43a119,_0x515d22,_0x3f5d2f){return __awaiter$4(this,void 0,void 0,function*(){const _0x4043b6={'account_name':_0x43a119,'api_key_name':_0x515d22};try{const _0xe83452=yield this['fetch']['post'](this['path'],_0x3f5d2f,_0x4043b6);if(_0xe83452['status']>0xc7&&_0xe83452['status']<0x12c){const _0x541a70=yield _0xe83452['json']();return new SuccessfulApiKeyResponse(_0x541a70);}const _0x5a8493=yield _0xe83452['json']();return new FailedApiKeyResponse(_0x5a8493);}catch(_0x322b73){if(_0x322b73 instanceof Error)return new FailedApiKeyResponse({'detail':_0x322b73['message'],'title':_0x322b73['name'],'status':0x1f4,'instance':'','type':''});throw _0x322b73;}});}['view'](_0x145f65,_0x59178a,_0x1f66ec){return __awaiter$4(this,void 0,void 0,function*(){const _0x5f55a2=this['path']+'/'+_0x145f65+'/'+_0x59178a;try{const _0x5f4883=yield this['fetch']['get'](_0x5f55a2,_0x1f66ec);if(_0x5f4883['status']>0xc7&&_0x5f4883['status']<0x12c){const _0x595e41=yield _0x5f4883['json']();return new SuccessfulApiKeyValueResponse(_0x595e41);}const _0x2e9fed=yield _0x5f4883['json']();return new FailedApiKeyValueResponse(_0x2e9fed);}catch(_0x50913a){if(_0x50913a instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x50913a['message'],'title':_0x50913a['name'],'status':0x1f4,'instance':'','type':''});throw _0x50913a;}});}['delete'](_0x3e5d3a,_0x42586b,_0x10a36b){return __awaiter$4(this,void 0,void 0,function*(){const _0x26d664=this['path']+'/'+_0x3e5d3a+'/'+_0x42586b;try{const _0x2e42f2=yield this['fetch']['delete'](_0x26d664,_0x10a36b);if(_0x2e42f2['status']>0xc7&&_0x2e42f2['status']<0x12c)return new SuccessfulResponse({});const _0x39aa7b=yield _0x2e42f2['json']();return new FailedResponse(_0x39aa7b);}catch(_0x586471){if(_0x586471 instanceof Error)return new FailedResponse({'detail':_0x586471['message'],'title':_0x586471['name'],'status':0x1f4,'instance':'','type':''});throw _0x586471;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3b1c0e,_0x38bf45,_0x2d58f3,_0x300f92){function _0x58ce49(_0xcdf423){return _0xcdf423 instanceof _0x2d58f3?_0xcdf423:new _0x2d58f3(function(_0x3016c1){_0x3016c1(_0xcdf423);});}return new(_0x2d58f3||(_0x2d58f3=Promise))(function(_0x3bec60,_0x124b13){function _0x508083(_0x2e5bf0){try{_0x384e33(_0x300f92['next'](_0x2e5bf0));}catch(_0x4189d8){_0x124b13(_0x4189d8);}}function _0x5e4fe0(_0x326653){try{_0x384e33(_0x300f92['throw'](_0x326653));}catch(_0x345fdd){_0x124b13(_0x345fdd);}}function _0x384e33(_0x37d1f2){_0x37d1f2['done']?_0x3bec60(_0x37d1f2['value']):_0x58ce49(_0x37d1f2['value'])['then'](_0x508083,_0x5e4fe0);}_0x384e33((_0x300f92=_0x300f92['apply'](_0x3b1c0e,_0x38bf45||[]))['next']());});};class ListService{constructor(_0x128496){this['fetch']=_0x128496;}['add'](_0x522545,_0x200e92,_0x116c8e){return __awaiter$3(this,void 0,void 0,function*(){const _0x56ba8a='List',_0x2ea4e1={'account_name':_0x522545,'list_name':_0x200e92};try{const _0x2d0249=yield this['fetch']['post'](_0x56ba8a,_0x116c8e,_0x2ea4e1);if(_0x2d0249['status']>0xc7&&_0x2d0249['status']<0x12c){const _0x5810fb=yield _0x2d0249['json']();return new SuccessfulAccountResponse(_0x5810fb);}const _0x1edea6=yield _0x2d0249['json']();return new FailedAccountResponse(_0x1edea6);}catch(_0x299408){if(_0x299408 instanceof Error)return new FailedAccountResponse({'detail':_0x299408['message'],'title':_0x299408['name'],'status':0x1f4,'instance':'','type':''});throw _0x299408;}});}['remove'](_0x14071d,_0x4fcd8d,_0x31b16c){return __awaiter$3(this,void 0,void 0,function*(){const _0x821e20='List/'+_0x14071d+'/'+_0x4fcd8d,_0x233099=yield this['fetch']['delete'](_0x821e20,_0x31b16c);try{if(_0x233099['status']>0xc7&&_0x233099['status']<0x12c){const _0x25d4b4=yield _0x233099['json']();return new SuccessfulAccountResponse(_0x25d4b4);}const _0x3dda79=yield _0x233099['json']();return new FailedAccountResponse(_0x3dda79);}catch(_0x3e1cc0){if(_0x3e1cc0 instanceof Error)return new FailedAccountResponse({'detail':_0x3e1cc0['message'],'title':_0x3e1cc0['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e1cc0;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x42371b,_0xa8ae07,_0x4f4d99,_0x23229e){function _0x1cda5f(_0x360057){return _0x360057 instanceof _0x4f4d99?_0x360057:new _0x4f4d99(function(_0x4f228c){_0x4f228c(_0x360057);});}return new(_0x4f4d99||(_0x4f4d99=Promise))(function(_0x24ab4b,_0x2bb97c){function _0x2a045d(_0x4dfddc){try{_0x35a283(_0x23229e['next'](_0x4dfddc));}catch(_0x5b6882){_0x2bb97c(_0x5b6882);}}function _0x181d97(_0x3b4084){try{_0x35a283(_0x23229e['throw'](_0x3b4084));}catch(_0x23987d){_0x2bb97c(_0x23987d);}}function _0x35a283(_0x43c26a){_0x43c26a['done']?_0x24ab4b(_0x43c26a['value']):_0x1cda5f(_0x43c26a['value'])['then'](_0x2a045d,_0x181d97);}_0x35a283((_0x23229e=_0x23229e['apply'](_0x42371b,_0xa8ae07||[]))['next']());});};class Fetch{constructor(_0x40da88){this['baseUri']=_0x40da88,this['getUrl']=_0x51b378=>{return _0x51b378['startsWith']('/')&&(_0x51b378=_0x51b378['replace']('/','')),''+this['baseUri']+_0x51b378;},!_0x40da88['endsWith']('/')&&(_0x40da88=_0x40da88+'/');}['get'](_0x25b367,_0x4fbd30){return __awaiter$2(this,void 0,void 0,function*(){const _0x3562c4=this['getUrl'](_0x25b367);return yield fetch(_0x3562c4,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4fbd30}});});}['post'](_0x31ab41,_0x5e5f9d,_0x4df4c6){return __awaiter$2(this,void 0,void 0,function*(){const _0x249265=this['getUrl'](_0x31ab41);return yield fetch(_0x249265,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5e5f9d},'body':_0x4df4c6?JSON['stringify'](_0x4df4c6):null});});}['PostNoAuth'](_0x4f529a,_0x116040){return __awaiter$2(this,void 0,void 0,function*(){const _0x2ec531=this['getUrl'](_0x4f529a);return yield fetch(_0x2ec531,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x116040?JSON['stringify'](_0x116040):null});});}['put'](_0x239b4c,_0x2b9694,_0x43d062){return __awaiter$2(this,void 0,void 0,function*(){const _0x221573=this['getUrl'](_0x239b4c);return yield fetch(_0x221573,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b9694},'body':_0x43d062?JSON['stringify'](_0x43d062):null});});}['delete'](_0xfe5c19,_0x46176b){return __awaiter$2(this,void 0,void 0,function*(){const _0x10e920=this['getUrl'](_0xfe5c19);return yield fetch(_0x10e920,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x46176b}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x29ddf4,_0x40c168,_0x4daf86,_0x1e661e){function _0x1717aa(_0x4c5599){return _0x4c5599 instanceof _0x4daf86?_0x4c5599:new _0x4daf86(function(_0x301039){_0x301039(_0x4c5599);});}return new(_0x4daf86||(_0x4daf86=Promise))(function(_0x15ceb7,_0x42711f){function _0x602ccd(_0x560b69){try{_0x44b506(_0x1e661e['next'](_0x560b69));}catch(_0xd41b30){_0x42711f(_0xd41b30);}}function _0x355e77(_0x4eb87d){try{_0x44b506(_0x1e661e['throw'](_0x4eb87d));}catch(_0x398018){_0x42711f(_0x398018);}}function _0x44b506(_0x5554c4){_0x5554c4['done']?_0x15ceb7(_0x5554c4['value']):_0x1717aa(_0x5554c4['value'])['then'](_0x602ccd,_0x355e77);}_0x44b506((_0x1e661e=_0x1e661e['apply'](_0x29ddf4,_0x40c168||[]))['next']());});};class SearchServersService{constructor(_0xb6837e){this['fetch']=_0xb6837e,this['path']='search-services';}['create'](_0x4374d1,_0x4f9123,_0x38728f,_0x5916ea,_0x258004,_0x21b6ab,_0x1fa9e1,_0x5a90c0){return __awaiter$1(this,void 0,void 0,function*(){const _0x10b771={'account_name':_0x4374d1,'search_service_name':_0x4f9123,'endpoint':_0x38728f,'key':_0x5916ea,'country':_0x258004,'provider':_0x21b6ab,'index_name':_0x1fa9e1};try{const _0xc09233=yield this['fetch']['post'](this['path'],_0x5a90c0,_0x10b771);if(_0xc09233['status']>0xc7&&_0xc09233['status']<0x12c){const _0x445046=yield _0xc09233['json']();return new SuccessfulSearchServiceResponse(_0x445046);}const _0x3415df=yield _0xc09233['json']();return new FailedSearchServiceResponse(_0x3415df);}catch(_0x2444b2){if(_0x2444b2 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2444b2['message'],'title':_0x2444b2['name'],'status':0x1f4,'instance':'','type':''});throw _0x2444b2;}});}['delete'](_0x440afd,_0x296668,_0x4f0d29){return __awaiter$1(this,void 0,void 0,function*(){const _0xbbb027=this['path']+'/'+_0x440afd+'/'+_0x296668;try{const _0x4db5c9=yield this['fetch']['delete'](_0xbbb027,_0x4f0d29);if(_0x4db5c9['status']>0xc7&&_0x4db5c9['status']<0x12c)return new SuccessfulResponse({});const _0x5cee6f=yield _0x4db5c9['json']();return new FailedResponse(_0x5cee6f);}catch(_0x2a826b){if(_0x2a826b instanceof Error)return new FailedResponse({'detail':_0x2a826b['message'],'title':_0x2a826b['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a826b;}});}['view'](_0x4a315d,_0x2749a0,_0x4f2160){return __awaiter$1(this,void 0,void 0,function*(){const _0x4bd4f4=this['path']+'/'+_0x4a315d+'/'+_0x2749a0;try{const _0x7e855f=yield this['fetch']['get'](_0x4bd4f4,_0x4f2160);if(_0x7e855f['status']>0xc7&&_0x7e855f['status']<0x12c){const _0x28e5e6=yield _0x7e855f['json']();return new SuccessfulViewSearchServiceResponse(_0x28e5e6);}const _0x57bd7e=yield _0x7e855f['json']();return new FailedViewSearchServiceResponse(_0x57bd7e);}catch(_0x26410c){if(_0x26410c instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x26410c['message'],'title':_0x26410c['name'],'status':0x1f4,'instance':'','type':''});throw _0x26410c;}});}['edit'](_0x456182,_0x3d0416,_0x4119d7,_0x4f865c,_0x4edc8c,_0x25e28f){return __awaiter$1(this,void 0,void 0,function*(){const _0x2a002d={'account_name':_0x456182,'search_service_name':_0x3d0416,'new_search_service_name':_0x4119d7,'key':_0x4f865c,'country':_0x4edc8c};try{const _0x1d3d47=yield this['fetch']['put'](this['path'],_0x25e28f,_0x2a002d);if(_0x1d3d47['status']>0xc7&&_0x1d3d47['status']<0x12c){const _0x3dabf6=yield _0x1d3d47['json']();return new SuccessfulSearchServiceResponse(_0x3dabf6);}const _0x3271b8=yield _0x1d3d47['json']();return new FailedSearchServiceResponse(_0x3271b8);}catch(_0x2b7111){if(_0x2b7111 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2b7111['message'],'title':_0x2b7111['name'],'status':0x1f4,'instance':'','type':''});throw _0x2b7111;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3039cb,_0x319388,_0x18245e,_0x4a2bbe){function _0x3e5d9d(_0x5e96b7){return _0x5e96b7 instanceof _0x18245e?_0x5e96b7:new _0x18245e(function(_0xf4399){_0xf4399(_0x5e96b7);});}return new(_0x18245e||(_0x18245e=Promise))(function(_0x26b6b1,_0x571bbb){function _0x445126(_0x2132c8){try{_0x82c599(_0x4a2bbe['next'](_0x2132c8));}catch(_0x5c4ccd){_0x571bbb(_0x5c4ccd);}}function _0x4549f3(_0x3ed7c1){try{_0x82c599(_0x4a2bbe['throw'](_0x3ed7c1));}catch(_0x21f9f7){_0x571bbb(_0x21f9f7);}}function _0x82c599(_0xb37fc6){_0xb37fc6['done']?_0x26b6b1(_0xb37fc6['value']):_0x3e5d9d(_0xb37fc6['value'])['then'](_0x445126,_0x4549f3);}_0x82c599((_0x4a2bbe=_0x4a2bbe['apply'](_0x3039cb,_0x319388||[]))['next']());});};class AdminClient{constructor(_0x45ab9f='https://admin.searchability.dev/'){var _0x67ea45=new Fetch(_0x45ab9f);this['Accounts']=new AccountService(_0x67ea45),this['Lists']=new ListService(_0x67ea45),this['ApiKeys']=new ApiKeyService(_0x67ea45),this['SearchServices']=new SearchServersService(_0x67ea45);}}class AuthClient{constructor(_0x225fcc='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x225fcc);}['login'](_0x320f43){return __awaiter(this,void 0,void 0,function*(){const _0x2ece13='login/'+_0x320f43;try{const _0x43103e=yield yield fetch(_0x2ece13);if(_0x43103e['status']>0xc7&&_0x43103e['status']<0x12c){const _0x5a7e83=yield _0x43103e['json']();return new SuccessfulAuthResponse(_0x5a7e83);}const _0x2a37b3=yield _0x43103e['json']();return new FailedAuthResponse(_0x2a37b3);}catch(_0x1a3d99){if(_0x1a3d99 instanceof Error)return new FailedAuthResponse({'detail':_0x1a3d99['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1a3d99;}});}['refresh'](_0x1a22e7){return __awaiter(this,void 0,void 0,function*(){const _0x1f4c57='refresh',_0x5d3d84={'refresh_token':_0x1a22e7};try{const _0x143281=yield this['fetch']['PostNoAuth'](_0x1f4c57,_0x5d3d84);if(_0x143281['status']>0xc7&&_0x143281['status']<0x12c){const _0x363b43=yield _0x143281['json']();return new SuccessfulAuthResponse(_0x363b43);}const _0x506c74=yield _0x143281['json']();return new FailedAuthResponse(_0x506c74);}catch(_0x281a65){if(_0x281a65 instanceof Error)return new FailedAuthResponse({'detail':_0x281a65['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x281a65;}});}['getTokenStatus'](_0x22a19b){if(Date['now']()<_0x22a19b['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x22a19b['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(_0x12aaa7){_0x12aaa7[_0x12aaa7['Ok']=0x0]='Ok',_0x12aaa7[_0x12aaa7['Refresh']=0x1]='Refresh',_0x12aaa7[_0x12aaa7['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(_0x31f0d3){this['isSuccess']=_0x31f0d3;}}class SuccessfulAccountResponse extends Response{constructor(_0x45655d){super(!![]),this['account']=_0x45655d;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x547484){super(![]),this['problem']=_0x547484;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x38bf61){super(!![]),this['tokens']=_0x38bf61;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0xe1c600){super(![]),this['problem']=_0xe1c600;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1a65c5){super(!![]),this['apiKey']=_0x1a65c5;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5e0c1a){super(![]),this['problem']=_0x5e0c1a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x511b46){super(!![]),this['searchService']=_0x511b46;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x1bd6a3){super(![]),this['problem']=_0x1bd6a3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x1ea6c2){super(!![]),this['searchService']=_0x1ea6c2;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x56b6d2){super(![]),this['problem']=_0x56b6d2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x315fe7){super(!![]),this['apiKeyValue']=_0x315fe7;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x951897){super(!![]),this['obj']=_0x951897;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x4d2f27){super(![]),this['problem']=_0x4d2f27;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x462986){super(![]),this['problem']=_0x462986;}['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(_0x4c6080,_0x8c3e38,_0x4c21b8,_0x42f590){function _0x41ba4b(_0x3c780a){return _0x3c780a instanceof _0x4c21b8?_0x3c780a:new _0x4c21b8(function(_0x2cb276){_0x2cb276(_0x3c780a);});}return new(_0x4c21b8||(_0x4c21b8=Promise))(function(_0x4cbd90,_0x266ace){function _0x2cc352(_0x206df1){try{_0x53c208(_0x42f590['next'](_0x206df1));}catch(_0x10a9aa){_0x266ace(_0x10a9aa);}}function _0x2b3518(_0x200be5){try{_0x53c208(_0x42f590['throw'](_0x200be5));}catch(_0x5a73a8){_0x266ace(_0x5a73a8);}}function _0x53c208(_0x5503a3){_0x5503a3['done']?_0x4cbd90(_0x5503a3['value']):_0x41ba4b(_0x5503a3['value'])['then'](_0x2cc352,_0x2b3518);}_0x53c208((_0x42f590=_0x42f590['apply'](_0x4c6080,_0x8c3e38||[]))['next']());});};class AccountService{constructor(_0xf6f345){this['fetch']=_0xf6f345;}['get'](_0x482c70,_0x389bb8){return __awaiter$5(this,void 0,void 0,function*(){const _0x1e0aa3='Account/'+_0x482c70+'/',_0x5445f3=yield this['fetch']['get'](_0x1e0aa3,_0x389bb8);try{if(_0x5445f3['status']>0xc7&&_0x5445f3['status']<0x12c){const _0x1ba185=yield _0x5445f3['json']();return new SuccessfulAccountResponse(_0x1ba185);}const _0x35713b=yield _0x5445f3['json']();return new FailedAccountResponse(_0x35713b);}catch(_0x3254e1){if(_0x3254e1 instanceof Error)return new FailedAccountResponse({'detail':_0x3254e1['message'],'title':_0x3254e1['name'],'status':0x1f4,'instance':'','type':''});throw _0x3254e1;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2c583b,_0x494b1a,_0x5d0d02,_0x46531f){function _0x33175c(_0x29bc63){return _0x29bc63 instanceof _0x5d0d02?_0x29bc63:new _0x5d0d02(function(_0x1ba4ab){_0x1ba4ab(_0x29bc63);});}return new(_0x5d0d02||(_0x5d0d02=Promise))(function(_0x27c383,_0x590192){function _0x110cdb(_0x54d399){try{_0x2ea6c6(_0x46531f['next'](_0x54d399));}catch(_0x360108){_0x590192(_0x360108);}}function _0x2894ea(_0x2898f8){try{_0x2ea6c6(_0x46531f['throw'](_0x2898f8));}catch(_0x205171){_0x590192(_0x205171);}}function _0x2ea6c6(_0x461c30){_0x461c30['done']?_0x27c383(_0x461c30['value']):_0x33175c(_0x461c30['value'])['then'](_0x110cdb,_0x2894ea);}_0x2ea6c6((_0x46531f=_0x46531f['apply'](_0x2c583b,_0x494b1a||[]))['next']());});};class ApiKeyService{constructor(_0x22b2cc){this['fetch']=_0x22b2cc,this['path']='api-key';}['create'](_0x24ac39,_0x17cf5e,_0x480a3a){return __awaiter$4(this,void 0,void 0,function*(){const _0x458530={'account_name':_0x24ac39,'api_key_name':_0x17cf5e};try{const _0x39b9fd=yield this['fetch']['post'](this['path'],_0x480a3a,_0x458530);if(_0x39b9fd['status']>0xc7&&_0x39b9fd['status']<0x12c){const _0x4f86ea=yield _0x39b9fd['json']();return new SuccessfulApiKeyResponse(_0x4f86ea);}const _0x23222c=yield _0x39b9fd['json']();return new FailedApiKeyResponse(_0x23222c);}catch(_0x51b690){if(_0x51b690 instanceof Error)return new FailedApiKeyResponse({'detail':_0x51b690['message'],'title':_0x51b690['name'],'status':0x1f4,'instance':'','type':''});throw _0x51b690;}});}['view'](_0x546b5e,_0x2e984e,_0x46dabb){return __awaiter$4(this,void 0,void 0,function*(){const _0x148451=this['path']+'/'+_0x546b5e+'/'+_0x2e984e;try{const _0x54b48c=yield this['fetch']['get'](_0x148451,_0x46dabb);if(_0x54b48c['status']>0xc7&&_0x54b48c['status']<0x12c){const _0x35d51f=yield _0x54b48c['json']();return new SuccessfulApiKeyValueResponse(_0x35d51f);}const _0x3cc45e=yield _0x54b48c['json']();return new FailedApiKeyValueResponse(_0x3cc45e);}catch(_0x4736e8){if(_0x4736e8 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4736e8['message'],'title':_0x4736e8['name'],'status':0x1f4,'instance':'','type':''});throw _0x4736e8;}});}['delete'](_0x3b4a0b,_0x173f2d,_0x5b83e7){return __awaiter$4(this,void 0,void 0,function*(){const _0x29bad4=this['path']+'/'+_0x3b4a0b+'/'+_0x173f2d;try{const _0x39b868=yield this['fetch']['delete'](_0x29bad4,_0x5b83e7);if(_0x39b868['status']>0xc7&&_0x39b868['status']<0x12c)return new SuccessfulResponse({});const _0x28ecf4=yield _0x39b868['json']();return new FailedResponse(_0x28ecf4);}catch(_0x2dbdce){if(_0x2dbdce instanceof Error)return new FailedResponse({'detail':_0x2dbdce['message'],'title':_0x2dbdce['name'],'status':0x1f4,'instance':'','type':''});throw _0x2dbdce;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0xdc2bc9,_0x5e69b1,_0x395a2d,_0x2101ad){function _0x188c3f(_0xddf1ec){return _0xddf1ec instanceof _0x395a2d?_0xddf1ec:new _0x395a2d(function(_0x310869){_0x310869(_0xddf1ec);});}return new(_0x395a2d||(_0x395a2d=Promise))(function(_0x1ce746,_0x5f07e0){function _0x1b0cfc(_0x39ec15){try{_0x5b1fb8(_0x2101ad['next'](_0x39ec15));}catch(_0x306069){_0x5f07e0(_0x306069);}}function _0x20fff5(_0x471e61){try{_0x5b1fb8(_0x2101ad['throw'](_0x471e61));}catch(_0x2fdfba){_0x5f07e0(_0x2fdfba);}}function _0x5b1fb8(_0x5272ea){_0x5272ea['done']?_0x1ce746(_0x5272ea['value']):_0x188c3f(_0x5272ea['value'])['then'](_0x1b0cfc,_0x20fff5);}_0x5b1fb8((_0x2101ad=_0x2101ad['apply'](_0xdc2bc9,_0x5e69b1||[]))['next']());});};class ListService{constructor(_0x5bde52){this['fetch']=_0x5bde52;}['add'](_0x1ba693,_0x38688a,_0x16b4fa){return __awaiter$3(this,void 0,void 0,function*(){const _0x1a61ba='List',_0x17889a={'account_name':_0x1ba693,'list_name':_0x38688a};try{const _0x4582e7=yield this['fetch']['post'](_0x1a61ba,_0x16b4fa,_0x17889a);if(_0x4582e7['status']>0xc7&&_0x4582e7['status']<0x12c){const _0x4d813b=yield _0x4582e7['json']();return new SuccessfulAccountResponse(_0x4d813b);}const _0x4de6b3=yield _0x4582e7['json']();return new FailedAccountResponse(_0x4de6b3);}catch(_0x533aa1){if(_0x533aa1 instanceof Error)return new FailedAccountResponse({'detail':_0x533aa1['message'],'title':_0x533aa1['name'],'status':0x1f4,'instance':'','type':''});throw _0x533aa1;}});}['remove'](_0x28f138,_0x5eca2,_0x1e7980){return __awaiter$3(this,void 0,void 0,function*(){const _0x6cbdde='List/'+_0x28f138+'/'+_0x5eca2,_0x503d51=yield this['fetch']['delete'](_0x6cbdde,_0x1e7980);try{if(_0x503d51['status']>0xc7&&_0x503d51['status']<0x12c){const _0x171847=yield _0x503d51['json']();return new SuccessfulAccountResponse(_0x171847);}const _0x1423eb=yield _0x503d51['json']();return new FailedAccountResponse(_0x1423eb);}catch(_0x2a540d){if(_0x2a540d instanceof Error)return new FailedAccountResponse({'detail':_0x2a540d['message'],'title':_0x2a540d['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a540d;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1079eb,_0x3ec0a2,_0x36c2fd,_0x24dbee){function _0x9437d(_0x3c1392){return _0x3c1392 instanceof _0x36c2fd?_0x3c1392:new _0x36c2fd(function(_0x3d3761){_0x3d3761(_0x3c1392);});}return new(_0x36c2fd||(_0x36c2fd=Promise))(function(_0x361e18,_0x352d06){function _0xbf25a1(_0x19d290){try{_0x20bb10(_0x24dbee['next'](_0x19d290));}catch(_0x4ce64c){_0x352d06(_0x4ce64c);}}function _0x4b30b7(_0x1e5d0c){try{_0x20bb10(_0x24dbee['throw'](_0x1e5d0c));}catch(_0xccb00f){_0x352d06(_0xccb00f);}}function _0x20bb10(_0x3088f5){_0x3088f5['done']?_0x361e18(_0x3088f5['value']):_0x9437d(_0x3088f5['value'])['then'](_0xbf25a1,_0x4b30b7);}_0x20bb10((_0x24dbee=_0x24dbee['apply'](_0x1079eb,_0x3ec0a2||[]))['next']());});};class Fetch{constructor(_0x15fe09){this['baseUri']=_0x15fe09,this['getUrl']=_0x21d56d=>{return _0x21d56d['startsWith']('/')&&(_0x21d56d=_0x21d56d['replace']('/','')),''+this['baseUri']+_0x21d56d;},!_0x15fe09['endsWith']('/')&&(_0x15fe09=_0x15fe09+'/');}['get'](_0x2755c6,_0x1bc050){return __awaiter$2(this,void 0,void 0,function*(){const _0x2b3efe=this['getUrl'](_0x2755c6);return yield fetch(_0x2b3efe,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1bc050}});});}['post'](_0x20fd0d,_0x25edc2,_0x186d68){return __awaiter$2(this,void 0,void 0,function*(){const _0xd3280=this['getUrl'](_0x20fd0d);return yield fetch(_0xd3280,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x25edc2},'body':_0x186d68?JSON['stringify'](_0x186d68):null});});}['PostNoAuth'](_0x5e9904,_0x8de797){return __awaiter$2(this,void 0,void 0,function*(){const _0x6cb532=this['getUrl'](_0x5e9904);return yield fetch(_0x6cb532,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x8de797?JSON['stringify'](_0x8de797):null});});}['put'](_0x289d23,_0x3b2161,_0x2f8e67){return __awaiter$2(this,void 0,void 0,function*(){const _0x178beb=this['getUrl'](_0x289d23);return yield fetch(_0x178beb,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3b2161},'body':_0x2f8e67?JSON['stringify'](_0x2f8e67):null});});}['delete'](_0x51b594,_0x2e7910){return __awaiter$2(this,void 0,void 0,function*(){const _0xf32d30=this['getUrl'](_0x51b594);return yield fetch(_0xf32d30,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2e7910}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x553f99,_0x47920c,_0x60ad6,_0x427c3e){function _0x4e0839(_0x28a6bb){return _0x28a6bb instanceof _0x60ad6?_0x28a6bb:new _0x60ad6(function(_0x12e1cd){_0x12e1cd(_0x28a6bb);});}return new(_0x60ad6||(_0x60ad6=Promise))(function(_0xcbb01d,_0xa75e32){function _0x264544(_0x891082){try{_0x42bdb7(_0x427c3e['next'](_0x891082));}catch(_0x3f6acd){_0xa75e32(_0x3f6acd);}}function _0x28a802(_0x56f481){try{_0x42bdb7(_0x427c3e['throw'](_0x56f481));}catch(_0x2d1a2b){_0xa75e32(_0x2d1a2b);}}function _0x42bdb7(_0xa05803){_0xa05803['done']?_0xcbb01d(_0xa05803['value']):_0x4e0839(_0xa05803['value'])['then'](_0x264544,_0x28a802);}_0x42bdb7((_0x427c3e=_0x427c3e['apply'](_0x553f99,_0x47920c||[]))['next']());});};class SearchServersService{constructor(_0x181a9d){this['fetch']=_0x181a9d,this['path']='search-services';}['create'](_0x13bf7b,_0x38a737,_0x4e1b0b,_0x5f2c4a,_0x296c54,_0x52504f,_0x453030,_0x46935c){return __awaiter$1(this,void 0,void 0,function*(){const _0xac9cc2={'account_name':_0x13bf7b,'search_service_name':_0x38a737,'endpoint':_0x4e1b0b,'key':_0x5f2c4a,'country':_0x296c54,'provider':_0x52504f,'index_name':_0x453030};try{const _0x4a5e87=yield this['fetch']['post'](this['path'],_0x46935c,_0xac9cc2);if(_0x4a5e87['status']>0xc7&&_0x4a5e87['status']<0x12c){const _0xa03734=yield _0x4a5e87['json']();return new SuccessfulSearchServiceResponse(_0xa03734);}const _0x483118=yield _0x4a5e87['json']();return new FailedSearchServiceResponse(_0x483118);}catch(_0x4ce94c){if(_0x4ce94c instanceof Error)return new FailedSearchServiceResponse({'detail':_0x4ce94c['message'],'title':_0x4ce94c['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ce94c;}});}['delete'](_0x309f75,_0x8a4116,_0x1375df){return __awaiter$1(this,void 0,void 0,function*(){const _0x210528=this['path']+'/'+_0x309f75+'/'+_0x8a4116;try{const _0x28c17b=yield this['fetch']['delete'](_0x210528,_0x1375df);if(_0x28c17b['status']>0xc7&&_0x28c17b['status']<0x12c)return new SuccessfulResponse({});const _0x31c864=yield _0x28c17b['json']();return new FailedResponse(_0x31c864);}catch(_0x549796){if(_0x549796 instanceof Error)return new FailedResponse({'detail':_0x549796['message'],'title':_0x549796['name'],'status':0x1f4,'instance':'','type':''});throw _0x549796;}});}['view'](_0x1fedbc,_0x3ae421,_0x2cc7f4){return __awaiter$1(this,void 0,void 0,function*(){const _0x47b9cc=this['path']+'/'+_0x1fedbc+'/'+_0x3ae421;try{const _0x390d50=yield this['fetch']['get'](_0x47b9cc,_0x2cc7f4);if(_0x390d50['status']>0xc7&&_0x390d50['status']<0x12c){const _0xd205dc=yield _0x390d50['json']();return new SuccessfulViewSearchServiceResponse(_0xd205dc);}const _0x1ac94a=yield _0x390d50['json']();return new FailedViewSearchServiceResponse(_0x1ac94a);}catch(_0x5a2349){if(_0x5a2349 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x5a2349['message'],'title':_0x5a2349['name'],'status':0x1f4,'instance':'','type':''});throw _0x5a2349;}});}['edit'](_0x2ca097,_0x3bd437,_0x5842e1,_0x2b21db,_0x3f75de,_0x8b8be3){return __awaiter$1(this,void 0,void 0,function*(){const _0x37d390={'account_name':_0x2ca097,'search_service_name':_0x3bd437,'new_search_service_name':_0x5842e1,'key':_0x2b21db,'country':_0x3f75de};try{const _0x4970e4=yield this['fetch']['put'](this['path'],_0x8b8be3,_0x37d390);if(_0x4970e4['status']>0xc7&&_0x4970e4['status']<0x12c){const _0x33806e=yield _0x4970e4['json']();return new SuccessfulSearchServiceResponse(_0x33806e);}const _0x23b330=yield _0x4970e4['json']();return new FailedSearchServiceResponse(_0x23b330);}catch(_0x4aab46){if(_0x4aab46 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x4aab46['message'],'title':_0x4aab46['name'],'status':0x1f4,'instance':'','type':''});throw _0x4aab46;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3c0f52,_0xe4bfaf,_0xed4e0a,_0x4e840a){function _0x3c4213(_0x2d4003){return _0x2d4003 instanceof _0xed4e0a?_0x2d4003:new _0xed4e0a(function(_0x586104){_0x586104(_0x2d4003);});}return new(_0xed4e0a||(_0xed4e0a=Promise))(function(_0x4d1826,_0x2b6859){function _0x5db141(_0x2694ed){try{_0x467655(_0x4e840a['next'](_0x2694ed));}catch(_0x1b05f7){_0x2b6859(_0x1b05f7);}}function _0x124b9b(_0x47b250){try{_0x467655(_0x4e840a['throw'](_0x47b250));}catch(_0x3df502){_0x2b6859(_0x3df502);}}function _0x467655(_0xd8f8f8){_0xd8f8f8['done']?_0x4d1826(_0xd8f8f8['value']):_0x3c4213(_0xd8f8f8['value'])['then'](_0x5db141,_0x124b9b);}_0x467655((_0x4e840a=_0x4e840a['apply'](_0x3c0f52,_0xe4bfaf||[]))['next']());});};class AdminClient{constructor(_0x1a225d='https://admin.searchability.dev/'){var _0x4e19e3=new Fetch(_0x1a225d);this['Accounts']=new AccountService(_0x4e19e3),this['Lists']=new ListService(_0x4e19e3),this['ApiKeys']=new ApiKeyService(_0x4e19e3),this['SearchServices']=new SearchServersService(_0x4e19e3);}}class AuthClient{constructor(_0xe90043='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0xe90043);}['login'](_0xce3969){return __awaiter(this,void 0,void 0,function*(){const _0xec2133='login/'+_0xce3969;try{const _0x2e0955=yield yield fetch(_0xec2133);if(_0x2e0955['status']>0xc7&&_0x2e0955['status']<0x12c){const _0x2b928b=yield _0x2e0955['json']();return new SuccessfulAuthResponse(_0x2b928b);}const _0x53abd4=yield _0x2e0955['json']();return new FailedAuthResponse(_0x53abd4);}catch(_0x458f15){if(_0x458f15 instanceof Error)return new FailedAuthResponse({'detail':_0x458f15['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x458f15;}});}['refresh'](_0x40961e){return __awaiter(this,void 0,void 0,function*(){const _0x206a18='refresh',_0x20a2b6={'refresh_token':_0x40961e};try{const _0x2c6bce=yield this['fetch']['PostNoAuth'](_0x206a18,_0x20a2b6);if(_0x2c6bce['status']>0xc7&&_0x2c6bce['status']<0x12c){const _0x29a0ef=yield _0x2c6bce['json']();return new SuccessfulAuthResponse(_0x29a0ef);}const _0x11bfb3=yield _0x2c6bce['json']();return new FailedAuthResponse(_0x11bfb3);}catch(_0x5886a6){if(_0x5886a6 instanceof Error)return new FailedAuthResponse({'detail':_0x5886a6['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5886a6;}});}['getTokenStatus'](_0x30cf4d){if(Date['now']()<_0x30cf4d['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x30cf4d['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -99,9 +99,10 @@ type SearchService = {
|
|
|
99
99
|
};
|
|
100
100
|
type SearchServiceDetails = {
|
|
101
101
|
endpoint: string;
|
|
102
|
-
key:
|
|
102
|
+
key: string;
|
|
103
103
|
search_service_name: string;
|
|
104
104
|
country: string;
|
|
105
|
+
index_name: string;
|
|
105
106
|
};
|
|
106
107
|
type ApiKeyValue = {
|
|
107
108
|
value: string;
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
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 };
|