@searchability/admin-client 0.0.44 → 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
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x3538ba){_0x3538ba[_0x3538ba['Ok']=0x0]='Ok',_0x3538ba[_0x3538ba['Refresh']=0x1]='Refresh',_0x3538ba[_0x3538ba['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x16c42d){this['isSuccess']=_0x16c42d;}}class SuccessfulAccountResponse extends Response{constructor(_0x39a57a){super(!![]),this['account']=_0x39a57a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2cfba2){super(![]),this['problem']=_0x2cfba2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4308f2){super(!![]),this['tokens']=_0x4308f2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x59789b){super(![]),this['problem']=_0x59789b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x3062f4){super(!![]),this['apiKey']=_0x3062f4;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1f4a3d){super(![]),this['problem']=_0x1f4a3d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0xcdf71d){super(!![]),this['searchService']=_0xcdf71d;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x145690){super(![]),this['problem']=_0x145690;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x50f15a){super(!![]),this['searchService']=_0x50f15a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x5b41c4){super(![]),this['problem']=_0x5b41c4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x397fc3){super(!![]),this['apiKeyValue']=_0x397fc3;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x1f9897){super(!![]),this['obj']=_0x1f9897;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x110db8){super(![]),this['problem']=_0x110db8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x4cccf1){super(![]),this['problem']=_0x4cccf1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x50a3c9,_0x586433,_0x145ca8,_0x22a5ae){function _0x36b57b(_0xadfd0){return _0xadfd0 instanceof _0x145ca8?_0xadfd0:new _0x145ca8(function(_0x2a24ed){_0x2a24ed(_0xadfd0);});}return new(_0x145ca8||(_0x145ca8=Promise))(function(_0xdf23ef,_0x2b884f){function _0x45faf6(_0x2cf5e6){try{_0x1985bb(_0x22a5ae['next'](_0x2cf5e6));}catch(_0x2a3572){_0x2b884f(_0x2a3572);}}function _0x2bd217(_0x20794d){try{_0x1985bb(_0x22a5ae['throw'](_0x20794d));}catch(_0x592c90){_0x2b884f(_0x592c90);}}function _0x1985bb(_0x3315fc){_0x3315fc['done']?_0xdf23ef(_0x3315fc['value']):_0x36b57b(_0x3315fc['value'])['then'](_0x45faf6,_0x2bd217);}_0x1985bb((_0x22a5ae=_0x22a5ae['apply'](_0x50a3c9,_0x586433||[]))['next']());});};class AccountService{constructor(_0x510641){this['fetch']=_0x510641;}['get'](_0x33ed0c,_0x164838){return __awaiter$5(this,void 0,void 0,function*(){const _0x201bfb='Account/'+_0x33ed0c+'/',_0x5667bd=yield this['fetch']['get'](_0x201bfb,_0x164838);try{if(_0x5667bd['status']>0xc7&&_0x5667bd['status']<0x12c){const _0x2922d7=yield _0x5667bd['json']();return new SuccessfulAccountResponse(_0x2922d7);}const _0x4420cf=yield _0x5667bd['json']();return new FailedAccountResponse(_0x4420cf);}catch(_0x154c13){if(_0x154c13 instanceof Error)return new FailedAccountResponse({'detail':_0x154c13['message'],'title':_0x154c13['name'],'status':0x1f4,'instance':'','type':''});throw _0x154c13;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x495d37,_0x54d20e,_0x13606a,_0x4a9157){function _0x15e583(_0x102b10){return _0x102b10 instanceof _0x13606a?_0x102b10:new _0x13606a(function(_0xb2a19d){_0xb2a19d(_0x102b10);});}return new(_0x13606a||(_0x13606a=Promise))(function(_0x4bc6b4,_0xf8a53f){function _0x2d0dd0(_0x5967ed){try{_0x44f35a(_0x4a9157['next'](_0x5967ed));}catch(_0x2d01f0){_0xf8a53f(_0x2d01f0);}}function _0xaa517d(_0x49aea6){try{_0x44f35a(_0x4a9157['throw'](_0x49aea6));}catch(_0x253ee4){_0xf8a53f(_0x253ee4);}}function _0x44f35a(_0x1a6b78){_0x1a6b78['done']?_0x4bc6b4(_0x1a6b78['value']):_0x15e583(_0x1a6b78['value'])['then'](_0x2d0dd0,_0xaa517d);}_0x44f35a((_0x4a9157=_0x4a9157['apply'](_0x495d37,_0x54d20e||[]))['next']());});};class ApiKeyService{constructor(_0x1775a5){this['fetch']=_0x1775a5,this['path']='api-key';}['create'](_0x3dda47,_0x3954c3,_0x4b5b5f){return __awaiter$4(this,void 0,void 0,function*(){const _0x38c8c1={'account_name':_0x3dda47,'api_key_name':_0x3954c3};try{const _0x49950c=yield this['fetch']['post'](this['path'],_0x4b5b5f,_0x38c8c1);if(_0x49950c['status']>0xc7&&_0x49950c['status']<0x12c){const _0x22fc65=yield _0x49950c['json']();return new SuccessfulApiKeyResponse(_0x22fc65);}const _0x4c3d69=yield _0x49950c['json']();return new FailedApiKeyResponse(_0x4c3d69);}catch(_0x39624d){if(_0x39624d instanceof Error)return new FailedApiKeyResponse({'detail':_0x39624d['message'],'title':_0x39624d['name'],'status':0x1f4,'instance':'','type':''});throw _0x39624d;}});}['view'](_0x104630,_0x3226c9,_0x39f7f8){return __awaiter$4(this,void 0,void 0,function*(){const _0xd999eb=this['path']+'/'+_0x104630+'/'+_0x3226c9;try{const _0x540492=yield this['fetch']['get'](_0xd999eb,_0x39f7f8);if(_0x540492['status']>0xc7&&_0x540492['status']<0x12c){const _0x2a464d=yield _0x540492['json']();return new SuccessfulApiKeyValueResponse(_0x2a464d);}const _0x14c815=yield _0x540492['json']();return new FailedApiKeyValueResponse(_0x14c815);}catch(_0x4725f7){if(_0x4725f7 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4725f7['message'],'title':_0x4725f7['name'],'status':0x1f4,'instance':'','type':''});throw _0x4725f7;}});}['delete'](_0x37f254,_0x35c5f4,_0x3fb721){return __awaiter$4(this,void 0,void 0,function*(){const _0x2198e5=this['path']+'/'+_0x37f254+'/'+_0x35c5f4;try{const _0x2ef813=yield this['fetch']['delete'](_0x2198e5,_0x3fb721);if(_0x2ef813['status']>0xc7&&_0x2ef813['status']<0x12c)return new SuccessfulResponse({});const _0x1f6903=yield _0x2ef813['json']();return new FailedResponse(_0x1f6903);}catch(_0x161bec){if(_0x161bec instanceof Error)return new FailedResponse({'detail':_0x161bec['message'],'title':_0x161bec['name'],'status':0x1f4,'instance':'','type':''});throw _0x161bec;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x4262e7,_0x896abb,_0x3abf5e,_0x1394de){function _0x6c8e48(_0x2ac293){return _0x2ac293 instanceof _0x3abf5e?_0x2ac293:new _0x3abf5e(function(_0xed3f6a){_0xed3f6a(_0x2ac293);});}return new(_0x3abf5e||(_0x3abf5e=Promise))(function(_0x21e9e3,_0x37f372){function _0x4fa78b(_0xfaf999){try{_0x1558fd(_0x1394de['next'](_0xfaf999));}catch(_0x20505d){_0x37f372(_0x20505d);}}function _0x25db80(_0x1fc64e){try{_0x1558fd(_0x1394de['throw'](_0x1fc64e));}catch(_0x498e82){_0x37f372(_0x498e82);}}function _0x1558fd(_0x30d317){_0x30d317['done']?_0x21e9e3(_0x30d317['value']):_0x6c8e48(_0x30d317['value'])['then'](_0x4fa78b,_0x25db80);}_0x1558fd((_0x1394de=_0x1394de['apply'](_0x4262e7,_0x896abb||[]))['next']());});};class ListService{constructor(_0x58fb76){this['fetch']=_0x58fb76;}['add'](_0x553c82,_0x294abc,_0x3eb2c0){return __awaiter$3(this,void 0,void 0,function*(){const _0x53e11a='List',_0x3f193d={'account_name':_0x553c82,'list_name':_0x294abc};try{const _0x155cb4=yield this['fetch']['post'](_0x53e11a,_0x3eb2c0,_0x3f193d);if(_0x155cb4['status']>0xc7&&_0x155cb4['status']<0x12c){const _0x5d18b3=yield _0x155cb4['json']();return new SuccessfulAccountResponse(_0x5d18b3);}const _0x497210=yield _0x155cb4['json']();return new FailedAccountResponse(_0x497210);}catch(_0xe3e3b){if(_0xe3e3b instanceof Error)return new FailedAccountResponse({'detail':_0xe3e3b['message'],'title':_0xe3e3b['name'],'status':0x1f4,'instance':'','type':''});throw _0xe3e3b;}});}['remove'](_0x195da,_0x366cb8,_0x7924d){return __awaiter$3(this,void 0,void 0,function*(){const _0x3045ee='List/'+_0x195da+'/'+_0x366cb8,_0x165220=yield this['fetch']['delete'](_0x3045ee,_0x7924d);try{if(_0x165220['status']>0xc7&&_0x165220['status']<0x12c){const _0x171bd0=yield _0x165220['json']();return new SuccessfulAccountResponse(_0x171bd0);}const _0xf6da3e=yield _0x165220['json']();return new FailedAccountResponse(_0xf6da3e);}catch(_0x1cc5d9){if(_0x1cc5d9 instanceof Error)return new FailedAccountResponse({'detail':_0x1cc5d9['message'],'title':_0x1cc5d9['name'],'status':0x1f4,'instance':'','type':''});throw _0x1cc5d9;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xbf9695,_0x12b2f1,_0x19ab8f,_0x34da1a){function _0x1673d9(_0x18ea3){return _0x18ea3 instanceof _0x19ab8f?_0x18ea3:new _0x19ab8f(function(_0x580534){_0x580534(_0x18ea3);});}return new(_0x19ab8f||(_0x19ab8f=Promise))(function(_0x11a659,_0xfabf82){function _0x320a0e(_0xcb3227){try{_0x5aaf59(_0x34da1a['next'](_0xcb3227));}catch(_0x2f9838){_0xfabf82(_0x2f9838);}}function _0x52ab89(_0x2110d2){try{_0x5aaf59(_0x34da1a['throw'](_0x2110d2));}catch(_0x1a0833){_0xfabf82(_0x1a0833);}}function _0x5aaf59(_0x5d29f9){_0x5d29f9['done']?_0x11a659(_0x5d29f9['value']):_0x1673d9(_0x5d29f9['value'])['then'](_0x320a0e,_0x52ab89);}_0x5aaf59((_0x34da1a=_0x34da1a['apply'](_0xbf9695,_0x12b2f1||[]))['next']());});};class Fetch{constructor(_0xfb9a42){this['baseUri']=_0xfb9a42,this['getUrl']=_0x297a58=>{return _0x297a58['startsWith']('/')&&(_0x297a58=_0x297a58['replace']('/','')),''+this['baseUri']+_0x297a58;},!_0xfb9a42['endsWith']('/')&&(_0xfb9a42=_0xfb9a42+'/');}['get'](_0x2728ac,_0x3673a6){return __awaiter$2(this,void 0,void 0,function*(){const _0xb298e0=this['getUrl'](_0x2728ac);return yield fetch(_0xb298e0,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3673a6}});});}['post'](_0x36fc06,_0x58d8b3,_0x22484d){return __awaiter$2(this,void 0,void 0,function*(){const _0x1a5e8c=this['getUrl'](_0x36fc06);return yield fetch(_0x1a5e8c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x58d8b3},'body':_0x22484d?JSON['stringify'](_0x22484d):null});});}['PostNoAuth'](_0x1cc3a5,_0x5cad82){return __awaiter$2(this,void 0,void 0,function*(){const _0x330faf=this['getUrl'](_0x1cc3a5);return yield fetch(_0x330faf,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5cad82?JSON['stringify'](_0x5cad82):null});});}['put'](_0x211122,_0x594fc4,_0x25adfc){return __awaiter$2(this,void 0,void 0,function*(){const _0x3ea47b=this['getUrl'](_0x211122);return yield fetch(_0x3ea47b,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x594fc4},'body':_0x25adfc?JSON['stringify'](_0x25adfc):null});});}['delete'](_0x1781a2,_0x3969f7){return __awaiter$2(this,void 0,void 0,function*(){const _0x4b2b6a=this['getUrl'](_0x1781a2);return yield fetch(_0x4b2b6a,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3969f7}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x49ad91,_0x14d32b,_0x597176,_0x38cb5e){function _0x4b04f7(_0x32d671){return _0x32d671 instanceof _0x597176?_0x32d671:new _0x597176(function(_0x28e074){_0x28e074(_0x32d671);});}return new(_0x597176||(_0x597176=Promise))(function(_0x4eacf9,_0x31a1d8){function _0xacd5f4(_0x438bd3){try{_0x15bd31(_0x38cb5e['next'](_0x438bd3));}catch(_0x2b8d81){_0x31a1d8(_0x2b8d81);}}function _0x33cdaf(_0x529ccf){try{_0x15bd31(_0x38cb5e['throw'](_0x529ccf));}catch(_0x5525e3){_0x31a1d8(_0x5525e3);}}function _0x15bd31(_0x201dfd){_0x201dfd['done']?_0x4eacf9(_0x201dfd['value']):_0x4b04f7(_0x201dfd['value'])['then'](_0xacd5f4,_0x33cdaf);}_0x15bd31((_0x38cb5e=_0x38cb5e['apply'](_0x49ad91,_0x14d32b||[]))['next']());});};class SearchServersService{constructor(_0x2f4faf){this['fetch']=_0x2f4faf,this['path']='search-services';}['create'](_0x4f6edf,_0x1988ed,_0x129cd4,_0x460690,_0x5b0849,_0x16c5a0,_0x450bb2,_0x5f4114){return __awaiter$1(this,void 0,void 0,function*(){const _0x542281={'account_name':_0x4f6edf,'search_service_name':_0x1988ed,'endpoint':_0x129cd4,'key':_0x460690,'country':_0x5b0849,'provider':_0x16c5a0,'index_name':_0x450bb2};try{const _0x193b40=yield this['fetch']['post'](this['path'],_0x5f4114,_0x542281);if(_0x193b40['status']>0xc7&&_0x193b40['status']<0x12c){const _0x4a04aa=yield _0x193b40['json']();return new SuccessfulSearchServiceResponse(_0x4a04aa);}const _0x420295=yield _0x193b40['json']();return new FailedSearchServiceResponse(_0x420295);}catch(_0x1e10f3){if(_0x1e10f3 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1e10f3['message'],'title':_0x1e10f3['name'],'status':0x1f4,'instance':'','type':''});throw _0x1e10f3;}});}['delete'](_0x1cad5c,_0x280b8f,_0x295d7b){return __awaiter$1(this,void 0,void 0,function*(){const _0x1d550d=this['path']+'/'+_0x1cad5c+'/'+_0x280b8f;try{const _0x525fd2=yield this['fetch']['delete'](_0x1d550d,_0x295d7b);if(_0x525fd2['status']>0xc7&&_0x525fd2['status']<0x12c)return new SuccessfulResponse({});const _0x42d0a6=yield _0x525fd2['json']();return new FailedResponse(_0x42d0a6);}catch(_0x5c8026){if(_0x5c8026 instanceof Error)return new FailedResponse({'detail':_0x5c8026['message'],'title':_0x5c8026['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c8026;}});}['view'](_0x21b61d,_0x2965dc,_0x2adef9){return __awaiter$1(this,void 0,void 0,function*(){const _0x493783=this['path']+'/'+_0x21b61d+'/'+_0x2965dc;try{const _0x5e2a9e=yield this['fetch']['get'](_0x493783,_0x2adef9);if(_0x5e2a9e['status']>0xc7&&_0x5e2a9e['status']<0x12c){const _0x12bd6f=yield _0x5e2a9e['json']();return new SuccessfulViewSearchServiceResponse(_0x12bd6f);}const _0x5401ee=yield _0x5e2a9e['json']();return new FailedViewSearchServiceResponse(_0x5401ee);}catch(_0x360da7){if(_0x360da7 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x360da7['message'],'title':_0x360da7['name'],'status':0x1f4,'instance':'','type':''});throw _0x360da7;}});}['edit'](_0x574c6c,_0x2be1b2,_0x3d0dfc,_0x4550d0,_0x3f40dd,_0x238495){return __awaiter$1(this,void 0,void 0,function*(){const _0x344472={'account_name':_0x574c6c,'search_service_name':_0x2be1b2,'new_search_service_name':_0x3d0dfc,'key':_0x4550d0,'country':_0x3f40dd};try{const _0x2ea75e=yield this['fetch']['put'](this['path'],_0x238495,_0x344472);if(_0x2ea75e['status']>0xc7&&_0x2ea75e['status']<0x12c){const _0x55056d=yield _0x2ea75e['json']();return new SuccessfulSearchServiceResponse(_0x55056d);}const _0x41fa66=yield _0x2ea75e['json']();return new FailedSearchServiceResponse(_0x41fa66);}catch(_0x1ae6be){if(_0x1ae6be instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1ae6be['message'],'title':_0x1ae6be['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ae6be;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x580498,_0x3e739a,_0x31964f,_0x490fab){function _0x1c60b8(_0x4783cb){return _0x4783cb instanceof _0x31964f?_0x4783cb:new _0x31964f(function(_0x1bab0c){_0x1bab0c(_0x4783cb);});}return new(_0x31964f||(_0x31964f=Promise))(function(_0x53a3da,_0xa666f2){function _0x2167a2(_0x53c867){try{_0x4e9ff8(_0x490fab['next'](_0x53c867));}catch(_0x5c9235){_0xa666f2(_0x5c9235);}}function _0x146f80(_0x3cc9f6){try{_0x4e9ff8(_0x490fab['throw'](_0x3cc9f6));}catch(_0x525e60){_0xa666f2(_0x525e60);}}function _0x4e9ff8(_0xd2af22){_0xd2af22['done']?_0x53a3da(_0xd2af22['value']):_0x1c60b8(_0xd2af22['value'])['then'](_0x2167a2,_0x146f80);}_0x4e9ff8((_0x490fab=_0x490fab['apply'](_0x580498,_0x3e739a||[]))['next']());});};class AdminClient{constructor(_0x4bf181='https://admin.searchability.dev/'){var _0x4b3ebf=new Fetch(_0x4bf181);this['Accounts']=new AccountService(_0x4b3ebf),this['Lists']=new ListService(_0x4b3ebf),this['ApiKeys']=new ApiKeyService(_0x4b3ebf),this['SearchServices']=new SearchServersService(_0x4b3ebf);}}class AuthClient{constructor(_0x25ba4e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x25ba4e);}['login'](_0xe1f699){return __awaiter(this,void 0,void 0,function*(){const _0x51e9b4='login/'+_0xe1f699;try{const _0x50a6b5=yield yield fetch(_0x51e9b4);if(_0x50a6b5['status']>0xc7&&_0x50a6b5['status']<0x12c){const _0x199b66=yield _0x50a6b5['json']();return new SuccessfulAuthResponse(_0x199b66);}const _0x187e58=yield _0x50a6b5['json']();return new FailedAuthResponse(_0x187e58);}catch(_0x14f369){if(_0x14f369 instanceof Error)return new FailedAuthResponse({'detail':_0x14f369['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x14f369;}});}['refresh'](_0x289975){return __awaiter(this,void 0,void 0,function*(){const _0x2bebfe='refresh',_0xc99217={'refresh_token':_0x289975};try{const _0x1faa9f=yield this['fetch']['PostNoAuth'](_0x2bebfe,_0xc99217);if(_0x1faa9f['status']>0xc7&&_0x1faa9f['status']<0x12c){const _0x35289d=yield _0x1faa9f['json']();return new SuccessfulAuthResponse(_0x35289d);}const _0x4d8c6f=yield _0x1faa9f['json']();return new FailedAuthResponse(_0x4d8c6f);}catch(_0x273c50){if(_0x273c50 instanceof Error)return new FailedAuthResponse({'detail':_0x273c50['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x273c50;}});}['getTokenStatus'](_0x23c085){if(Date['now']()<_0x23c085['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x23c085['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|