@searchability/admin-client 0.0.46 → 0.0.47
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(_0x4d3ec3){_0x4d3ec3[_0x4d3ec3['Ok']=0x0]='Ok',_0x4d3ec3[_0x4d3ec3['Refresh']=0x1]='Refresh',_0x4d3ec3[_0x4d3ec3['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(_0x5a8bf9){this['isSuccess']=_0x5a8bf9;}}class SuccessfulAccountResponse extends Response{constructor(_0xc5b5d6){super(!![]),this['account']=_0xc5b5d6;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x34e2e5){super(!![]),this['list']=_0x34e2e5;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x3d4d06){super(![]),this['problem']=_0x3d4d06;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x4d8bc8){super(![]),this['problem']=_0x4d8bc8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4dcd68){super(!![]),this['tokens']=_0x4dcd68;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x57b323){super(![]),this['problem']=_0x57b323;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x58d5d4){super(!![]),this['apiKey']=_0x58d5d4;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x343c8c){super(![]),this['problem']=_0x343c8c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x2c331a){super(!![]),this['searchService']=_0x2c331a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x408c11){super(![]),this['problem']=_0x408c11;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x144831){super(!![]),this['searchService']=_0x144831;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x2a4a0a){super(!![]),this['searchServices']=_0x2a4a0a;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x8ad58f){super(![]),this['problem']=_0x8ad58f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x34bcd5){super(![]),this['problem']=_0x34bcd5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x28f7bd){super(!![]),this['apiKeyValue']=_0x28f7bd;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x2be9de){super(!![]),this['obj']=_0x2be9de;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x3a625c){super(![]),this['problem']=_0x3a625c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x3b12bc){super(![]),this['problem']=_0x3b12bc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x411806,_0x2872c9,_0x3916ab,_0x6c2387){function _0x5b2571(_0x66a044){return _0x66a044 instanceof _0x3916ab?_0x66a044:new _0x3916ab(function(_0xd58f13){_0xd58f13(_0x66a044);});}return new(_0x3916ab||(_0x3916ab=Promise))(function(_0x326def,_0x5c9dd4){function _0x4042a0(_0x1f3c5b){try{_0x2cec99(_0x6c2387['next'](_0x1f3c5b));}catch(_0xd0f44){_0x5c9dd4(_0xd0f44);}}function _0x12820d(_0x5ec64c){try{_0x2cec99(_0x6c2387['throw'](_0x5ec64c));}catch(_0x2278f3){_0x5c9dd4(_0x2278f3);}}function _0x2cec99(_0x3aa1a6){_0x3aa1a6['done']?_0x326def(_0x3aa1a6['value']):_0x5b2571(_0x3aa1a6['value'])['then'](_0x4042a0,_0x12820d);}_0x2cec99((_0x6c2387=_0x6c2387['apply'](_0x411806,_0x2872c9||[]))['next']());});};class AccountService{constructor(_0x2a155f){this['fetch']=_0x2a155f;}['get'](_0xdd2fe1,_0x4ec5da){return __awaiter$5(this,void 0,void 0,function*(){const _0x2215c0='Account/'+_0xdd2fe1+'/',_0x11b54c=yield this['fetch']['get'](_0x2215c0,_0x4ec5da);try{if(_0x11b54c['status']>0xc7&&_0x11b54c['status']<0x12c){const _0x509dd7=yield _0x11b54c['json']();return new SuccessfulAccountResponse(_0x509dd7);}const _0xf66bfc=yield _0x11b54c['json']();return new FailedAccountResponse(_0xf66bfc);}catch(_0x4a19f4){if(_0x4a19f4 instanceof Error)return new FailedAccountResponse({'detail':_0x4a19f4['message'],'title':_0x4a19f4['name'],'status':0x1f4,'instance':'','type':''});throw _0x4a19f4;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x1d1dff,_0x337777,_0x271aa1,_0x3d4ed8){function _0x2b53d0(_0x48c9c3){return _0x48c9c3 instanceof _0x271aa1?_0x48c9c3:new _0x271aa1(function(_0x1bd10f){_0x1bd10f(_0x48c9c3);});}return new(_0x271aa1||(_0x271aa1=Promise))(function(_0x5f1a85,_0x13d464){function _0x552692(_0x119763){try{_0x3c992e(_0x3d4ed8['next'](_0x119763));}catch(_0x26bf4e){_0x13d464(_0x26bf4e);}}function _0x34d525(_0x20e2b1){try{_0x3c992e(_0x3d4ed8['throw'](_0x20e2b1));}catch(_0x24709c){_0x13d464(_0x24709c);}}function _0x3c992e(_0x53be9b){_0x53be9b['done']?_0x5f1a85(_0x53be9b['value']):_0x2b53d0(_0x53be9b['value'])['then'](_0x552692,_0x34d525);}_0x3c992e((_0x3d4ed8=_0x3d4ed8['apply'](_0x1d1dff,_0x337777||[]))['next']());});};class ApiKeyService{constructor(_0x16dea8){this['fetch']=_0x16dea8,this['path']='api-key';}['create'](_0xd49a2d,_0x5bd8e0,_0x5ac2cf){return __awaiter$4(this,void 0,void 0,function*(){const _0x144524={'account_name':_0xd49a2d,'api_key_name':_0x5bd8e0};try{const _0x37afb6=yield this['fetch']['post'](this['path'],_0x5ac2cf,_0x144524);if(_0x37afb6['status']>0xc7&&_0x37afb6['status']<0x12c){const _0x2e82c1=yield _0x37afb6['json']();return new SuccessfulApiKeyResponse(_0x2e82c1);}const _0x5ee1c0=yield _0x37afb6['json']();return new FailedApiKeyResponse(_0x5ee1c0);}catch(_0x379419){if(_0x379419 instanceof Error)return new FailedApiKeyResponse({'detail':_0x379419['message'],'title':_0x379419['name'],'status':0x1f4,'instance':'','type':''});throw _0x379419;}});}['view'](_0x19f96e,_0x38996e,_0x464da0){return __awaiter$4(this,void 0,void 0,function*(){const _0x179fc6=this['path']+'/'+_0x19f96e+'/'+_0x38996e;try{const _0x328d99=yield this['fetch']['get'](_0x179fc6,_0x464da0);if(_0x328d99['status']>0xc7&&_0x328d99['status']<0x12c){const _0x58f415=yield _0x328d99['json']();return new SuccessfulApiKeyValueResponse(_0x58f415);}const _0x344524=yield _0x328d99['json']();return new FailedApiKeyValueResponse(_0x344524);}catch(_0x4ba695){if(_0x4ba695 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4ba695['message'],'title':_0x4ba695['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ba695;}});}['delete'](_0x4d12f7,_0x50d829,_0x385460){return __awaiter$4(this,void 0,void 0,function*(){const _0x4e3029=this['path']+'/'+_0x4d12f7+'/'+_0x50d829;try{const _0x7e504b=yield this['fetch']['delete'](_0x4e3029,_0x385460);if(_0x7e504b['status']>0xc7&&_0x7e504b['status']<0x12c)return new SuccessfulResponse({});const _0x37bdcc=yield _0x7e504b['json']();return new FailedResponse(_0x37bdcc);}catch(_0x37b304){if(_0x37b304 instanceof Error)return new FailedResponse({'detail':_0x37b304['message'],'title':_0x37b304['name'],'status':0x1f4,'instance':'','type':''});throw _0x37b304;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x1783f9,_0x3c8d7b,_0x2776dd,_0x5f0542){function _0x608a38(_0x175b8c){return _0x175b8c instanceof _0x2776dd?_0x175b8c:new _0x2776dd(function(_0x1e6c03){_0x1e6c03(_0x175b8c);});}return new(_0x2776dd||(_0x2776dd=Promise))(function(_0x40b758,_0x374f36){function _0x403eaf(_0x59114c){try{_0x195d49(_0x5f0542['next'](_0x59114c));}catch(_0x222bc6){_0x374f36(_0x222bc6);}}function _0x103c89(_0x5f1b25){try{_0x195d49(_0x5f0542['throw'](_0x5f1b25));}catch(_0x222310){_0x374f36(_0x222310);}}function _0x195d49(_0x56324d){_0x56324d['done']?_0x40b758(_0x56324d['value']):_0x608a38(_0x56324d['value'])['then'](_0x403eaf,_0x103c89);}_0x195d49((_0x5f0542=_0x5f0542['apply'](_0x1783f9,_0x3c8d7b||[]))['next']());});};class ListService{constructor(_0x4a5920){this['fetch']=_0x4a5920;}['add'](_0x442cea,_0x3ba5f7,_0x5ce268,_0x2bf7df){return __awaiter$3(this,void 0,void 0,function*(){const _0x44931e='List',_0x38f912={'account_name':_0x442cea,'list_name':_0x3ba5f7,'search_service_name':_0x5ce268};try{const _0x44b413=yield this['fetch']['post'](_0x44931e,_0x2bf7df,_0x38f912);if(_0x44b413['status']>0xc7&&_0x44b413['status']<0x12c){const _0x34d6c7=yield _0x44b413['json']();return new SuccessfulListIdentityResponse(_0x34d6c7);}const _0x39cef4=yield _0x44b413['json']();return new FailedListIdentityResponse(_0x39cef4);}catch(_0x5cf705){if(_0x5cf705 instanceof Error)return new FailedListIdentityResponse({'detail':_0x5cf705['message'],'title':_0x5cf705['name'],'status':0x1f4,'instance':'','type':''});throw _0x5cf705;}});}['remove'](_0x12e964,_0x55b6c1,_0x5680ba){return __awaiter$3(this,void 0,void 0,function*(){const _0x1b47ea='List/'+_0x12e964+'/'+_0x55b6c1,_0x2bffe8=yield this['fetch']['delete'](_0x1b47ea,_0x5680ba);try{if(_0x2bffe8['status']>0xc7&&_0x2bffe8['status']<0x12c){const _0x45007c=yield _0x2bffe8['json']();return new SuccessfulAccountResponse(_0x45007c);}const _0x5e764b=yield _0x2bffe8['json']();return new FailedAccountResponse(_0x5e764b);}catch(_0x565dd4){if(_0x565dd4 instanceof Error)return new FailedAccountResponse({'detail':_0x565dd4['message'],'title':_0x565dd4['name'],'status':0x1f4,'instance':'','type':''});throw _0x565dd4;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xabea66,_0x909f21,_0x1c41c2,_0x1e682b){function _0x254a3d(_0x7e86de){return _0x7e86de instanceof _0x1c41c2?_0x7e86de:new _0x1c41c2(function(_0x139eae){_0x139eae(_0x7e86de);});}return new(_0x1c41c2||(_0x1c41c2=Promise))(function(_0x336c04,_0x13caf6){function _0xd2d033(_0xe1a284){try{_0x81b5c8(_0x1e682b['next'](_0xe1a284));}catch(_0x46f922){_0x13caf6(_0x46f922);}}function _0x5d1d68(_0x24398e){try{_0x81b5c8(_0x1e682b['throw'](_0x24398e));}catch(_0x2979aa){_0x13caf6(_0x2979aa);}}function _0x81b5c8(_0x5edd09){_0x5edd09['done']?_0x336c04(_0x5edd09['value']):_0x254a3d(_0x5edd09['value'])['then'](_0xd2d033,_0x5d1d68);}_0x81b5c8((_0x1e682b=_0x1e682b['apply'](_0xabea66,_0x909f21||[]))['next']());});};class Fetch{constructor(_0xcd44b6){this['baseUri']=_0xcd44b6,this['getUrl']=_0x31e9b6=>{return _0x31e9b6['startsWith']('/')&&(_0x31e9b6=_0x31e9b6['replace']('/','')),''+this['baseUri']+_0x31e9b6;},!_0xcd44b6['endsWith']('/')&&(_0xcd44b6=_0xcd44b6+'/');}['get'](_0x199d77,_0x341eec){return __awaiter$2(this,void 0,void 0,function*(){const _0x22a90f=this['getUrl'](_0x199d77);return yield fetch(_0x22a90f,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x341eec}});});}['post'](_0x5869c8,_0x464bca,_0x1b9ed4){return __awaiter$2(this,void 0,void 0,function*(){const _0x1fbb74=this['getUrl'](_0x5869c8);return yield fetch(_0x1fbb74,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x464bca},'body':_0x1b9ed4?JSON['stringify'](_0x1b9ed4):null});});}['PostNoAuth'](_0x396694,_0x1d03eb){return __awaiter$2(this,void 0,void 0,function*(){const _0x3a6236=this['getUrl'](_0x396694);return yield fetch(_0x3a6236,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x1d03eb?JSON['stringify'](_0x1d03eb):null});});}['put'](_0x27ef33,_0x26174a,_0x35e016){return __awaiter$2(this,void 0,void 0,function*(){const _0xd0afa1=this['getUrl'](_0x27ef33);return yield fetch(_0xd0afa1,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x26174a},'body':_0x35e016?JSON['stringify'](_0x35e016):null});});}['delete'](_0x4e0e9b,_0x47d06c){return __awaiter$2(this,void 0,void 0,function*(){const _0x250f10=this['getUrl'](_0x4e0e9b);return yield fetch(_0x250f10,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x47d06c}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x44c595,_0x23f7d6,_0xa613ff,_0x394aad){function _0x21a7ba(_0x408bb8){return _0x408bb8 instanceof _0xa613ff?_0x408bb8:new _0xa613ff(function(_0x3d16c7){_0x3d16c7(_0x408bb8);});}return new(_0xa613ff||(_0xa613ff=Promise))(function(_0x49fc0b,_0x1d963d){function _0x19bb26(_0x348154){try{_0x54f75e(_0x394aad['next'](_0x348154));}catch(_0x25a96a){_0x1d963d(_0x25a96a);}}function _0x121350(_0x32994e){try{_0x54f75e(_0x394aad['throw'](_0x32994e));}catch(_0x3df7d4){_0x1d963d(_0x3df7d4);}}function _0x54f75e(_0x1a2c2b){_0x1a2c2b['done']?_0x49fc0b(_0x1a2c2b['value']):_0x21a7ba(_0x1a2c2b['value'])['then'](_0x19bb26,_0x121350);}_0x54f75e((_0x394aad=_0x394aad['apply'](_0x44c595,_0x23f7d6||[]))['next']());});};class SearchServersService{constructor(_0xed024b){this['fetch']=_0xed024b,this['path']='search-services';}['create'](_0x3880d0,_0x51c979,_0x249b92,_0x3828e0,_0x1793ae,_0xb8bf2,_0x4d29db,_0x1a1c6f){return __awaiter$1(this,void 0,void 0,function*(){const _0x2ee976={'account_name':_0x3880d0,'search_service_name':_0x51c979,'endpoint':_0x249b92,'key':_0x3828e0,'country':_0x1793ae,'provider':_0xb8bf2,'index_name':_0x4d29db};try{const _0x4c95a6=yield this['fetch']['post'](this['path'],_0x1a1c6f,_0x2ee976);if(_0x4c95a6['status']>0xc7&&_0x4c95a6['status']<0x12c){const _0x36c761=yield _0x4c95a6['json']();return new SuccessfulSearchServiceResponse(_0x36c761);}const _0x4dc779=yield _0x4c95a6['json']();return new FailedSearchServiceResponse(_0x4dc779);}catch(_0x5a48ac){if(_0x5a48ac instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5a48ac['message'],'title':_0x5a48ac['name'],'status':0x1f4,'instance':'','type':''});throw _0x5a48ac;}});}['delete'](_0x23ad40,_0x428d3e,_0x6cf2dd){return __awaiter$1(this,void 0,void 0,function*(){const _0xc26049=this['path']+'/'+_0x23ad40+'/'+_0x428d3e;try{const _0x32b3ba=yield this['fetch']['delete'](_0xc26049,_0x6cf2dd);if(_0x32b3ba['status']>0xc7&&_0x32b3ba['status']<0x12c)return new SuccessfulResponse({});const _0x452da8=yield _0x32b3ba['json']();return new FailedResponse(_0x452da8);}catch(_0x3865ff){if(_0x3865ff instanceof Error)return new FailedResponse({'detail':_0x3865ff['message'],'title':_0x3865ff['name'],'status':0x1f4,'instance':'','type':''});throw _0x3865ff;}});}['view'](_0x3d8ea4,_0x4d108a,_0x3ed146){return __awaiter$1(this,void 0,void 0,function*(){const _0x1c785c=this['path']+'/'+_0x3d8ea4+'/'+_0x4d108a;try{const _0x1c4767=yield this['fetch']['get'](_0x1c785c,_0x3ed146);if(_0x1c4767['status']>0xc7&&_0x1c4767['status']<0x12c){const _0x1b078c=yield _0x1c4767['json']();return new SuccessfulViewSearchServiceResponse(_0x1b078c);}const _0x370987=yield _0x1c4767['json']();return new FailedViewSearchServiceResponse(_0x370987);}catch(_0x341e4f){if(_0x341e4f instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x341e4f['message'],'title':_0x341e4f['name'],'status':0x1f4,'instance':'','type':''});throw _0x341e4f;}});}['edit'](_0x433c67,_0x54f4c5,_0x251116,_0x7f197c,_0x260a3c,_0x9ea46){return __awaiter$1(this,void 0,void 0,function*(){const _0x41b931={'account_name':_0x433c67,'search_service_name':_0x54f4c5,'new_search_service_name':_0x251116,'key':_0x7f197c,'country':_0x260a3c};try{const _0x36fd22=yield this['fetch']['put'](this['path'],_0x9ea46,_0x41b931);if(_0x36fd22['status']>0xc7&&_0x36fd22['status']<0x12c){const _0x46bb01=yield _0x36fd22['json']();return new SuccessfulSearchServiceResponse(_0x46bb01);}const _0x4a7b1a=yield _0x36fd22['json']();return new FailedSearchServiceResponse(_0x4a7b1a);}catch(_0x30a596){if(_0x30a596 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x30a596['message'],'title':_0x30a596['name'],'status':0x1f4,'instance':'','type':''});throw _0x30a596;}});}['list'](_0x1adfa8,_0x2f5d86){return __awaiter$1(this,void 0,void 0,function*(){const _0x3ea079=this['path']+'/'+_0x1adfa8;try{const _0x57edd2=yield this['fetch']['get'](_0x3ea079,_0x2f5d86);if(_0x57edd2['status']>0xc7&&_0x57edd2['status']<0x12c){const _0x2ef86c=yield _0x57edd2['json']();return new SuccessfulListSearchServiceResponse(_0x2ef86c);}const _0x30de70=yield _0x57edd2['json']();return new FailedViewSearchServicesResponse(_0x30de70);}catch(_0x502510){if(_0x502510 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x502510['message'],'title':_0x502510['name'],'status':0x1f4,'instance':'','type':''});throw _0x502510;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4feefb,_0x4aed65,_0x44a9fc,_0x46d97c){function _0x15971f(_0x17b6d5){return _0x17b6d5 instanceof _0x44a9fc?_0x17b6d5:new _0x44a9fc(function(_0x44400b){_0x44400b(_0x17b6d5);});}return new(_0x44a9fc||(_0x44a9fc=Promise))(function(_0x1cbf8e,_0x3ef8c9){function _0x10cc42(_0x23bdfe){try{_0x428371(_0x46d97c['next'](_0x23bdfe));}catch(_0x32e0dc){_0x3ef8c9(_0x32e0dc);}}function _0x581850(_0x515d14){try{_0x428371(_0x46d97c['throw'](_0x515d14));}catch(_0x1312e1){_0x3ef8c9(_0x1312e1);}}function _0x428371(_0x5825bb){_0x5825bb['done']?_0x1cbf8e(_0x5825bb['value']):_0x15971f(_0x5825bb['value'])['then'](_0x10cc42,_0x581850);}_0x428371((_0x46d97c=_0x46d97c['apply'](_0x4feefb,_0x4aed65||[]))['next']());});};class AdminClient{constructor(_0x2ae085='https://admin.searchability.dev/'){var _0x37181c=new Fetch(_0x2ae085);this['Accounts']=new AccountService(_0x37181c),this['Lists']=new ListService(_0x37181c),this['ApiKeys']=new ApiKeyService(_0x37181c),this['SearchServices']=new SearchServersService(_0x37181c);}}class AuthClient{constructor(_0x323247='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x323247);}['login'](_0x49bffe){return __awaiter(this,void 0,void 0,function*(){const _0x3b7a81='login/'+_0x49bffe;try{const _0x25c129=yield yield fetch(_0x3b7a81);if(_0x25c129['status']>0xc7&&_0x25c129['status']<0x12c){const _0x2df627=yield _0x25c129['json']();return new SuccessfulAuthResponse(_0x2df627);}const _0x82ab11=yield _0x25c129['json']();return new FailedAuthResponse(_0x82ab11);}catch(_0x4ce351){if(_0x4ce351 instanceof Error)return new FailedAuthResponse({'detail':_0x4ce351['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ce351;}});}['refresh'](_0x212e19){return __awaiter(this,void 0,void 0,function*(){const _0x5b75fd='refresh',_0xe157a6={'refresh_token':_0x212e19};try{const _0x14470c=yield this['fetch']['PostNoAuth'](_0x5b75fd,_0xe157a6);if(_0x14470c['status']>0xc7&&_0x14470c['status']<0x12c){const _0x5881b1=yield _0x14470c['json']();return new SuccessfulAuthResponse(_0x5881b1);}const _0x44e60d=yield _0x14470c['json']();return new FailedAuthResponse(_0x44e60d);}catch(_0x322595){if(_0x322595 instanceof Error)return new FailedAuthResponse({'detail':_0x322595['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x322595;}});}['getTokenStatus'](_0x3b3aa7){if(Date['now']()<_0x3b3aa7['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3b3aa7['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(_0x5d3f32){_0x5d3f32[_0x5d3f32['Ok']=0x0]='Ok',_0x5d3f32[_0x5d3f32['Refresh']=0x1]='Refresh',_0x5d3f32[_0x5d3f32['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(_0x48ea3a){this['isSuccess']=_0x48ea3a;}}class SuccessfulAccountResponse extends Response{constructor(_0x2f455b){super(!![]),this['account']=_0x2f455b;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x55a35c){super(!![]),this['list']=_0x55a35c;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2ac396){super(![]),this['problem']=_0x2ac396;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x4906c2){super(![]),this['problem']=_0x4906c2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x22e22c){super(!![]),this['tokens']=_0x22e22c;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x50482d){super(![]),this['problem']=_0x50482d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x28f1b6){super(!![]),this['apiKey']=_0x28f1b6;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x431bf3){super(![]),this['problem']=_0x431bf3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x12d491){super(!![]),this['searchService']=_0x12d491;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x52fcca){super(![]),this['problem']=_0x52fcca;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0xe8a267){super(!![]),this['searchService']=_0xe8a267;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x18c353){super(!![]),this['searchServices']=_0x18c353;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x28cd78){super(![]),this['problem']=_0x28cd78;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x3fc727){super(![]),this['problem']=_0x3fc727;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x94594f){super(!![]),this['apiKeyValue']=_0x94594f;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x20cb2a){super(!![]),this['obj']=_0x20cb2a;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x57cf61){super(![]),this['problem']=_0x57cf61;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x126e63){super(![]),this['problem']=_0x126e63;}['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(_0x3594ff,_0x1fbd21,_0x1b7a76,_0x2d2e0e){function _0x615a2c(_0x39830f){return _0x39830f instanceof _0x1b7a76?_0x39830f:new _0x1b7a76(function(_0x227c32){_0x227c32(_0x39830f);});}return new(_0x1b7a76||(_0x1b7a76=Promise))(function(_0x2425ec,_0x14ef4e){function _0x298f12(_0x279112){try{_0x1a78be(_0x2d2e0e['next'](_0x279112));}catch(_0x4e3b31){_0x14ef4e(_0x4e3b31);}}function _0x3df680(_0x58b979){try{_0x1a78be(_0x2d2e0e['throw'](_0x58b979));}catch(_0xeaef6b){_0x14ef4e(_0xeaef6b);}}function _0x1a78be(_0x1af852){_0x1af852['done']?_0x2425ec(_0x1af852['value']):_0x615a2c(_0x1af852['value'])['then'](_0x298f12,_0x3df680);}_0x1a78be((_0x2d2e0e=_0x2d2e0e['apply'](_0x3594ff,_0x1fbd21||[]))['next']());});};class AccountService{constructor(_0x3cc17c){this['fetch']=_0x3cc17c;}['get'](_0x2cf4be,_0x2ade14){return __awaiter$5(this,void 0,void 0,function*(){const _0x4a561f='Account/'+_0x2cf4be+'/',_0x5ab74c=yield this['fetch']['get'](_0x4a561f,_0x2ade14);try{if(_0x5ab74c['status']>0xc7&&_0x5ab74c['status']<0x12c){const _0x190dde=yield _0x5ab74c['json']();return new SuccessfulAccountResponse(_0x190dde);}const _0x5c3105=yield _0x5ab74c['json']();return new FailedAccountResponse(_0x5c3105);}catch(_0x20a2f3){if(_0x20a2f3 instanceof Error)return new FailedAccountResponse({'detail':_0x20a2f3['message'],'title':_0x20a2f3['name'],'status':0x1f4,'instance':'','type':''});throw _0x20a2f3;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x3a8dbc,_0x20ec5d,_0x1ac646,_0x4f5667){function _0x5e85cf(_0x1e459a){return _0x1e459a instanceof _0x1ac646?_0x1e459a:new _0x1ac646(function(_0x33cca4){_0x33cca4(_0x1e459a);});}return new(_0x1ac646||(_0x1ac646=Promise))(function(_0x50e6c3,_0x168fc4){function _0x62c7a1(_0x43ab75){try{_0x221a65(_0x4f5667['next'](_0x43ab75));}catch(_0x5bc65b){_0x168fc4(_0x5bc65b);}}function _0x2fbab4(_0x5c25bc){try{_0x221a65(_0x4f5667['throw'](_0x5c25bc));}catch(_0x5b3316){_0x168fc4(_0x5b3316);}}function _0x221a65(_0x2c0724){_0x2c0724['done']?_0x50e6c3(_0x2c0724['value']):_0x5e85cf(_0x2c0724['value'])['then'](_0x62c7a1,_0x2fbab4);}_0x221a65((_0x4f5667=_0x4f5667['apply'](_0x3a8dbc,_0x20ec5d||[]))['next']());});};class ApiKeyService{constructor(_0x39a1aa){this['fetch']=_0x39a1aa,this['path']='api-key';}['create'](_0x178417,_0x3fb462,_0x3ef63e){return __awaiter$4(this,void 0,void 0,function*(){const _0x17e7f1={'account_name':_0x178417,'api_key_name':_0x3fb462};try{const _0xabadfa=yield this['fetch']['post'](this['path'],_0x3ef63e,_0x17e7f1);if(_0xabadfa['status']>0xc7&&_0xabadfa['status']<0x12c){const _0x4c4988=yield _0xabadfa['json']();return new SuccessfulApiKeyResponse(_0x4c4988);}const _0x172367=yield _0xabadfa['json']();return new FailedApiKeyResponse(_0x172367);}catch(_0x335a2c){if(_0x335a2c instanceof Error)return new FailedApiKeyResponse({'detail':_0x335a2c['message'],'title':_0x335a2c['name'],'status':0x1f4,'instance':'','type':''});throw _0x335a2c;}});}['view'](_0x153ebc,_0x3b570c,_0x309855){return __awaiter$4(this,void 0,void 0,function*(){const _0x341b18=this['path']+'/'+_0x153ebc+'/'+_0x3b570c;try{const _0x281a4e=yield this['fetch']['get'](_0x341b18,_0x309855);if(_0x281a4e['status']>0xc7&&_0x281a4e['status']<0x12c){const _0x1b7371=yield _0x281a4e['json']();return new SuccessfulApiKeyValueResponse(_0x1b7371);}const _0x27307b=yield _0x281a4e['json']();return new FailedApiKeyValueResponse(_0x27307b);}catch(_0x1214ef){if(_0x1214ef instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x1214ef['message'],'title':_0x1214ef['name'],'status':0x1f4,'instance':'','type':''});throw _0x1214ef;}});}['delete'](_0x2a84c5,_0x34af8c,_0x5a259b){return __awaiter$4(this,void 0,void 0,function*(){const _0x19738a=this['path']+'/'+_0x2a84c5+'/'+_0x34af8c;try{const _0x5e7155=yield this['fetch']['delete'](_0x19738a,_0x5a259b);if(_0x5e7155['status']>0xc7&&_0x5e7155['status']<0x12c)return new SuccessfulResponse({});const _0x1a9a06=yield _0x5e7155['json']();return new FailedResponse(_0x1a9a06);}catch(_0x14c027){if(_0x14c027 instanceof Error)return new FailedResponse({'detail':_0x14c027['message'],'title':_0x14c027['name'],'status':0x1f4,'instance':'','type':''});throw _0x14c027;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5d4f2b,_0x75304d,_0x44dc0a,_0x4621f4){function _0x5384d9(_0x4172b9){return _0x4172b9 instanceof _0x44dc0a?_0x4172b9:new _0x44dc0a(function(_0x533c2c){_0x533c2c(_0x4172b9);});}return new(_0x44dc0a||(_0x44dc0a=Promise))(function(_0x19d582,_0x4323b8){function _0x2c393a(_0x3cdbac){try{_0x2aa77f(_0x4621f4['next'](_0x3cdbac));}catch(_0x540856){_0x4323b8(_0x540856);}}function _0x1f910e(_0x1301e8){try{_0x2aa77f(_0x4621f4['throw'](_0x1301e8));}catch(_0x41e691){_0x4323b8(_0x41e691);}}function _0x2aa77f(_0x37d74d){_0x37d74d['done']?_0x19d582(_0x37d74d['value']):_0x5384d9(_0x37d74d['value'])['then'](_0x2c393a,_0x1f910e);}_0x2aa77f((_0x4621f4=_0x4621f4['apply'](_0x5d4f2b,_0x75304d||[]))['next']());});};class ListService{constructor(_0x4a1695){this['fetch']=_0x4a1695;}['add'](_0xa521ef,_0x543a9e,_0x551d65,_0x5400b1){return __awaiter$3(this,void 0,void 0,function*(){const _0x1b628c='List',_0x54c6d5={'account_name':_0xa521ef,'list_name':_0x543a9e,'search_service_name':_0x551d65};try{const _0x2c2597=yield this['fetch']['post'](_0x1b628c,_0x5400b1,_0x54c6d5);if(_0x2c2597['status']>0xc7&&_0x2c2597['status']<0x12c){const _0x57ace5=yield _0x2c2597['json']();return new SuccessfulListIdentityResponse(_0x57ace5);}const _0x24491d=yield _0x2c2597['json']();return new FailedListIdentityResponse(_0x24491d);}catch(_0x485c67){if(_0x485c67 instanceof Error)return new FailedListIdentityResponse({'detail':_0x485c67['message'],'title':_0x485c67['name'],'status':0x1f4,'instance':'','type':''});throw _0x485c67;}});}['remove'](_0x597997,_0x3f593c,_0xd3ffa8){return __awaiter$3(this,void 0,void 0,function*(){const _0x1b737f='List/'+_0x597997+'/'+_0x3f593c,_0x14009b=yield this['fetch']['delete'](_0x1b737f,_0xd3ffa8);try{if(_0x14009b['status']>0xc7&&_0x14009b['status']<0x12c){const _0x2d0fe3=yield _0x14009b['json']();return new SuccessfulAccountResponse(_0x2d0fe3);}const _0x1f09fa=yield _0x14009b['json']();return new FailedAccountResponse(_0x1f09fa);}catch(_0x2a0962){if(_0x2a0962 instanceof Error)return new FailedAccountResponse({'detail':_0x2a0962['message'],'title':_0x2a0962['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a0962;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x44bcf3,_0x5073ee,_0x329deb,_0x2c1a12){function _0x26c1ce(_0x406a28){return _0x406a28 instanceof _0x329deb?_0x406a28:new _0x329deb(function(_0x4eee6e){_0x4eee6e(_0x406a28);});}return new(_0x329deb||(_0x329deb=Promise))(function(_0x2f5ec4,_0x16d1f2){function _0x166f4c(_0x28f81a){try{_0xdfc1bc(_0x2c1a12['next'](_0x28f81a));}catch(_0x1d9d92){_0x16d1f2(_0x1d9d92);}}function _0x179583(_0x5a3dca){try{_0xdfc1bc(_0x2c1a12['throw'](_0x5a3dca));}catch(_0x907ce1){_0x16d1f2(_0x907ce1);}}function _0xdfc1bc(_0x5a5374){_0x5a5374['done']?_0x2f5ec4(_0x5a5374['value']):_0x26c1ce(_0x5a5374['value'])['then'](_0x166f4c,_0x179583);}_0xdfc1bc((_0x2c1a12=_0x2c1a12['apply'](_0x44bcf3,_0x5073ee||[]))['next']());});};class Fetch{constructor(_0x4eebb3){this['baseUri']=_0x4eebb3,this['getUrl']=_0x2b1904=>{return _0x2b1904['startsWith']('/')&&(_0x2b1904=_0x2b1904['replace']('/','')),''+this['baseUri']+_0x2b1904;},!_0x4eebb3['endsWith']('/')&&(_0x4eebb3=_0x4eebb3+'/');}['get'](_0x5a64b2,_0x5e408d){return __awaiter$2(this,void 0,void 0,function*(){const _0x5ec64c=this['getUrl'](_0x5a64b2);return yield fetch(_0x5ec64c,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5e408d}});});}['post'](_0x53ac72,_0x598bba,_0x2d1492){return __awaiter$2(this,void 0,void 0,function*(){const _0x13606c=this['getUrl'](_0x53ac72);return yield fetch(_0x13606c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x598bba},'body':_0x2d1492?JSON['stringify'](_0x2d1492):null});});}['PostNoAuth'](_0x436c5c,_0x108b7c){return __awaiter$2(this,void 0,void 0,function*(){const _0xf2e91b=this['getUrl'](_0x436c5c);return yield fetch(_0xf2e91b,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x108b7c?JSON['stringify'](_0x108b7c):null});});}['put'](_0x1649f7,_0x3f8028,_0x59b4e7){return __awaiter$2(this,void 0,void 0,function*(){const _0x39e655=this['getUrl'](_0x1649f7);return yield fetch(_0x39e655,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3f8028},'body':_0x59b4e7?JSON['stringify'](_0x59b4e7):null});});}['delete'](_0x2197e1,_0x2a2bc1){return __awaiter$2(this,void 0,void 0,function*(){const _0x46e067=this['getUrl'](_0x2197e1);return yield fetch(_0x46e067,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2a2bc1}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1f7167,_0xfbc47e,_0x306b2f,_0x5d637d){function _0x2e3b3a(_0x2681e7){return _0x2681e7 instanceof _0x306b2f?_0x2681e7:new _0x306b2f(function(_0x1ac378){_0x1ac378(_0x2681e7);});}return new(_0x306b2f||(_0x306b2f=Promise))(function(_0x19b18f,_0x35a70f){function _0x31e725(_0x22a48f){try{_0x316643(_0x5d637d['next'](_0x22a48f));}catch(_0xeb1c69){_0x35a70f(_0xeb1c69);}}function _0x5b4d9d(_0x24e316){try{_0x316643(_0x5d637d['throw'](_0x24e316));}catch(_0x10b8b1){_0x35a70f(_0x10b8b1);}}function _0x316643(_0x43470a){_0x43470a['done']?_0x19b18f(_0x43470a['value']):_0x2e3b3a(_0x43470a['value'])['then'](_0x31e725,_0x5b4d9d);}_0x316643((_0x5d637d=_0x5d637d['apply'](_0x1f7167,_0xfbc47e||[]))['next']());});};class SearchServersService{constructor(_0x8dc0f){this['fetch']=_0x8dc0f,this['path']='search-services';}['create'](_0x403f90,_0x4ac49b,_0x1cdf42,_0x475f8f,_0x27441e,_0x27c142,_0x3c93b9,_0x5367de){return __awaiter$1(this,void 0,void 0,function*(){const _0x65e831={'account_name':_0x403f90,'search_service_name':_0x4ac49b,'endpoint':_0x1cdf42,'key':_0x475f8f,'country':_0x27441e,'provider':_0x27c142,'index_name':_0x3c93b9};try{const _0x351de6=yield this['fetch']['post'](this['path'],_0x5367de,_0x65e831);if(_0x351de6['status']>0xc7&&_0x351de6['status']<0x12c){const _0x5d3c48=yield _0x351de6['json']();return new SuccessfulSearchServiceResponse(_0x5d3c48);}const _0x5b3325=yield _0x351de6['json']();return new FailedSearchServiceResponse(_0x5b3325);}catch(_0x2518eb){if(_0x2518eb instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2518eb['message'],'title':_0x2518eb['name'],'status':0x1f4,'instance':'','type':''});throw _0x2518eb;}});}['delete'](_0x44d4d5,_0x4135c8,_0xf4efad){return __awaiter$1(this,void 0,void 0,function*(){const _0x3dc1a0=this['path']+'/'+_0x44d4d5+'/'+_0x4135c8;try{const _0x293f0a=yield this['fetch']['delete'](_0x3dc1a0,_0xf4efad);if(_0x293f0a['status']>0xc7&&_0x293f0a['status']<0x12c)return new SuccessfulResponse({});const _0x24f703=yield _0x293f0a['json']();return new FailedResponse(_0x24f703);}catch(_0x48464b){if(_0x48464b instanceof Error)return new FailedResponse({'detail':_0x48464b['message'],'title':_0x48464b['name'],'status':0x1f4,'instance':'','type':''});throw _0x48464b;}});}['view'](_0x48dd57,_0xecc892,_0x47340a){return __awaiter$1(this,void 0,void 0,function*(){const _0x256e1a=this['path']+'/'+_0x48dd57+'/'+_0xecc892;try{const _0xe82e22=yield this['fetch']['get'](_0x256e1a,_0x47340a);if(_0xe82e22['status']>0xc7&&_0xe82e22['status']<0x12c){const _0xcf2d4a=yield _0xe82e22['json']();return new SuccessfulViewSearchServiceResponse(_0xcf2d4a);}const _0x5670b8=yield _0xe82e22['json']();return new FailedViewSearchServiceResponse(_0x5670b8);}catch(_0x165044){if(_0x165044 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x165044['message'],'title':_0x165044['name'],'status':0x1f4,'instance':'','type':''});throw _0x165044;}});}['edit'](_0x6e75e9,_0x2b8469,_0x1e3418,_0x60b95f,_0x416491,_0x17a5d9){return __awaiter$1(this,void 0,void 0,function*(){const _0x555413={'account_name':_0x6e75e9,'search_service_name':_0x2b8469,'new_search_service_name':_0x1e3418,'key':_0x60b95f,'country':_0x416491};try{const _0x4819fc=yield this['fetch']['put'](this['path'],_0x17a5d9,_0x555413);if(_0x4819fc['status']>0xc7&&_0x4819fc['status']<0x12c){const _0x8634bb=yield _0x4819fc['json']();return new SuccessfulSearchServiceResponse(_0x8634bb);}const _0x1109ec=yield _0x4819fc['json']();return new FailedSearchServiceResponse(_0x1109ec);}catch(_0x29b89d){if(_0x29b89d instanceof Error)return new FailedSearchServiceResponse({'detail':_0x29b89d['message'],'title':_0x29b89d['name'],'status':0x1f4,'instance':'','type':''});throw _0x29b89d;}});}['list'](_0x3d70e8,_0x2ac91b){return __awaiter$1(this,void 0,void 0,function*(){const _0x46d23a=this['path']+'/'+_0x3d70e8;try{const _0xc5d71f=yield this['fetch']['get'](_0x46d23a,_0x2ac91b);if(_0xc5d71f['status']>0xc7&&_0xc5d71f['status']<0x12c){const _0x5b9bb0=yield _0xc5d71f['json']();return new SuccessfulListSearchServiceResponse(_0x5b9bb0);}const _0x4a04bc=yield _0xc5d71f['json']();return new FailedViewSearchServicesResponse(_0x4a04bc);}catch(_0x54b45a){if(_0x54b45a instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x54b45a['message'],'title':_0x54b45a['name'],'status':0x1f4,'instance':'','type':''});throw _0x54b45a;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x275b62,_0xf937f6,_0x329b0f,_0x19cb46){function _0x19856d(_0x1c5318){return _0x1c5318 instanceof _0x329b0f?_0x1c5318:new _0x329b0f(function(_0x2db118){_0x2db118(_0x1c5318);});}return new(_0x329b0f||(_0x329b0f=Promise))(function(_0x22ec8e,_0x504527){function _0x4881af(_0x442ef1){try{_0x56a52b(_0x19cb46['next'](_0x442ef1));}catch(_0x387cbd){_0x504527(_0x387cbd);}}function _0x59b45f(_0x1fa868){try{_0x56a52b(_0x19cb46['throw'](_0x1fa868));}catch(_0x240e9e){_0x504527(_0x240e9e);}}function _0x56a52b(_0x363e03){_0x363e03['done']?_0x22ec8e(_0x363e03['value']):_0x19856d(_0x363e03['value'])['then'](_0x4881af,_0x59b45f);}_0x56a52b((_0x19cb46=_0x19cb46['apply'](_0x275b62,_0xf937f6||[]))['next']());});};class AdminClient{constructor(_0x420a8a='https://admin.searchability.dev/'){var _0x150259=new Fetch(_0x420a8a);this['Accounts']=new AccountService(_0x150259),this['Lists']=new ListService(_0x150259),this['ApiKeys']=new ApiKeyService(_0x150259),this['SearchServices']=new SearchServersService(_0x150259);}}class AuthClient{constructor(_0x25165b='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x25165b);}['login'](_0x348cd7){return __awaiter(this,void 0,void 0,function*(){const _0x2cd218='login/'+_0x348cd7;try{const _0x543f2f=yield yield fetch(_0x2cd218);if(_0x543f2f['status']>0xc7&&_0x543f2f['status']<0x12c){const _0x212e04=yield _0x543f2f['json']();return new SuccessfulAuthResponse(_0x212e04);}const _0x24c523=yield _0x543f2f['json']();return new FailedAuthResponse(_0x24c523);}catch(_0x300088){if(_0x300088 instanceof Error)return new FailedAuthResponse({'detail':_0x300088['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x300088;}});}['refresh'](_0x5010f7){return __awaiter(this,void 0,void 0,function*(){const _0x420e88='refresh',_0x35e6e6={'refresh_token':_0x5010f7};try{const _0x4bf1b5=yield this['fetch']['PostNoAuth'](_0x420e88,_0x35e6e6);if(_0x4bf1b5['status']>0xc7&&_0x4bf1b5['status']<0x12c){const _0x48adcb=yield _0x4bf1b5['json']();return new SuccessfulAuthResponse(_0x48adcb);}const _0x494324=yield _0x4bf1b5['json']();return new FailedAuthResponse(_0x494324);}catch(_0xab9d0f){if(_0xab9d0f instanceof Error)return new FailedAuthResponse({'detail':_0xab9d0f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xab9d0f;}});}['getTokenStatus'](_0x57b0e2){if(Date['now']()<_0x57b0e2['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x57b0e2['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(_0x362ad4){_0x362ad4[_0x362ad4['Ok']=0x0]='Ok',_0x362ad4[_0x362ad4['Refresh']=0x1]='Refresh',_0x362ad4[_0x362ad4['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(_0x55dac9){this['isSuccess']=_0x55dac9;}}class SuccessfulAccountResponse extends Response{constructor(_0xaab4c2){super(!![]),this['account']=_0xaab4c2;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0xf67a2f){super(!![]),this['list']=_0xf67a2f;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x5ac3f3){super(![]),this['problem']=_0x5ac3f3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x5f1750){super(![]),this['problem']=_0x5f1750;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x5575ab){super(!![]),this['tokens']=_0x5575ab;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x570778){super(![]),this['problem']=_0x570778;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x11db11){super(!![]),this['apiKey']=_0x11db11;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x85b141){super(![]),this['problem']=_0x85b141;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x3178dd){super(!![]),this['searchService']=_0x3178dd;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x3e7d98){super(![]),this['problem']=_0x3e7d98;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x1bf5d){super(!![]),this['searchService']=_0x1bf5d;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x210219){super(!![]),this['searchServices']=_0x210219;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x4acce5){super(![]),this['problem']=_0x4acce5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x19125e){super(![]),this['problem']=_0x19125e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0xc82f03){super(!![]),this['apiKeyValue']=_0xc82f03;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x4368e6){super(!![]),this['obj']=_0x4368e6;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x3ffac7){super(![]),this['problem']=_0x3ffac7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x52415c){super(![]),this['problem']=_0x52415c;}['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(_0x45f13f,_0x1e099e,_0x4082b1,_0x1a7b50){function _0x26a409(_0x18f0bc){return _0x18f0bc instanceof _0x4082b1?_0x18f0bc:new _0x4082b1(function(_0x12e27b){_0x12e27b(_0x18f0bc);});}return new(_0x4082b1||(_0x4082b1=Promise))(function(_0x730b9b,_0x564395){function _0x2d0eb9(_0x1ce7db){try{_0x2c79ba(_0x1a7b50['next'](_0x1ce7db));}catch(_0xcc6fee){_0x564395(_0xcc6fee);}}function _0x34847d(_0x1fa77d){try{_0x2c79ba(_0x1a7b50['throw'](_0x1fa77d));}catch(_0x2500b2){_0x564395(_0x2500b2);}}function _0x2c79ba(_0x2babd9){_0x2babd9['done']?_0x730b9b(_0x2babd9['value']):_0x26a409(_0x2babd9['value'])['then'](_0x2d0eb9,_0x34847d);}_0x2c79ba((_0x1a7b50=_0x1a7b50['apply'](_0x45f13f,_0x1e099e||[]))['next']());});};class AccountService{constructor(_0x2dd512){this['fetch']=_0x2dd512;}['get'](_0x53e5f8,_0x44f1ce){return __awaiter$5(this,void 0,void 0,function*(){const _0x1004ac='Account/'+_0x53e5f8+'/',_0x18a407=yield this['fetch']['get'](_0x1004ac,_0x44f1ce);try{if(_0x18a407['status']>0xc7&&_0x18a407['status']<0x12c){const _0x50942a=yield _0x18a407['json']();return new SuccessfulAccountResponse(_0x50942a);}const _0x4664d1=yield _0x18a407['json']();return new FailedAccountResponse(_0x4664d1);}catch(_0x331542){if(_0x331542 instanceof Error)return new FailedAccountResponse({'detail':_0x331542['message'],'title':_0x331542['name'],'status':0x1f4,'instance':'','type':''});throw _0x331542;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0xfdffb7,_0x645879,_0x4deaea,_0x1d3cec){function _0x1de5ee(_0x1af610){return _0x1af610 instanceof _0x4deaea?_0x1af610:new _0x4deaea(function(_0xf6339a){_0xf6339a(_0x1af610);});}return new(_0x4deaea||(_0x4deaea=Promise))(function(_0x301f81,_0x154940){function _0x36dc48(_0x2ae771){try{_0x417319(_0x1d3cec['next'](_0x2ae771));}catch(_0x108719){_0x154940(_0x108719);}}function _0x55ca97(_0x338d62){try{_0x417319(_0x1d3cec['throw'](_0x338d62));}catch(_0x4a5c15){_0x154940(_0x4a5c15);}}function _0x417319(_0x540eb1){_0x540eb1['done']?_0x301f81(_0x540eb1['value']):_0x1de5ee(_0x540eb1['value'])['then'](_0x36dc48,_0x55ca97);}_0x417319((_0x1d3cec=_0x1d3cec['apply'](_0xfdffb7,_0x645879||[]))['next']());});};class ApiKeyService{constructor(_0x59b109){this['fetch']=_0x59b109,this['path']='api-key';}['create'](_0x3eb035,_0x12269e,_0xd7c3bf){return __awaiter$4(this,void 0,void 0,function*(){const _0xa84528={'account_name':_0x3eb035,'api_key_name':_0x12269e};try{const _0x221816=yield this['fetch']['post'](this['path'],_0xd7c3bf,_0xa84528);if(_0x221816['status']>0xc7&&_0x221816['status']<0x12c){const _0x213c28=yield _0x221816['json']();return new SuccessfulApiKeyResponse(_0x213c28);}const _0x1faed1=yield _0x221816['json']();return new FailedApiKeyResponse(_0x1faed1);}catch(_0x122e3f){if(_0x122e3f instanceof Error)return new FailedApiKeyResponse({'detail':_0x122e3f['message'],'title':_0x122e3f['name'],'status':0x1f4,'instance':'','type':''});throw _0x122e3f;}});}['view'](_0x25794c,_0x22e251,_0x1f8d90){return __awaiter$4(this,void 0,void 0,function*(){const _0xf4404e=this['path']+'/'+_0x25794c+'/'+_0x22e251;try{const _0x1096f5=yield this['fetch']['get'](_0xf4404e,_0x1f8d90);if(_0x1096f5['status']>0xc7&&_0x1096f5['status']<0x12c){const _0x3490bd=yield _0x1096f5['json']();return new SuccessfulApiKeyValueResponse(_0x3490bd);}const _0x20e7ec=yield _0x1096f5['json']();return new FailedApiKeyValueResponse(_0x20e7ec);}catch(_0x534669){if(_0x534669 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x534669['message'],'title':_0x534669['name'],'status':0x1f4,'instance':'','type':''});throw _0x534669;}});}['delete'](_0x408974,_0x27ec67,_0x253ca9){return __awaiter$4(this,void 0,void 0,function*(){const _0x69e73a=this['path']+'/'+_0x408974+'/'+_0x27ec67;try{const _0x399282=yield this['fetch']['delete'](_0x69e73a,_0x253ca9);if(_0x399282['status']>0xc7&&_0x399282['status']<0x12c)return new SuccessfulResponse({});const _0xe8abdc=yield _0x399282['json']();return new FailedResponse(_0xe8abdc);}catch(_0xf8eb2){if(_0xf8eb2 instanceof Error)return new FailedResponse({'detail':_0xf8eb2['message'],'title':_0xf8eb2['name'],'status':0x1f4,'instance':'','type':''});throw _0xf8eb2;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x200ca3,_0x49d978,_0x3c3b3e,_0x364a4a){function _0x58b376(_0x9bbbb0){return _0x9bbbb0 instanceof _0x3c3b3e?_0x9bbbb0:new _0x3c3b3e(function(_0x3e68be){_0x3e68be(_0x9bbbb0);});}return new(_0x3c3b3e||(_0x3c3b3e=Promise))(function(_0x2198be,_0x3a6f37){function _0x1b91da(_0x140514){try{_0x254cd1(_0x364a4a['next'](_0x140514));}catch(_0x583aef){_0x3a6f37(_0x583aef);}}function _0x3cf3e(_0x253c32){try{_0x254cd1(_0x364a4a['throw'](_0x253c32));}catch(_0x25ddac){_0x3a6f37(_0x25ddac);}}function _0x254cd1(_0x3573ed){_0x3573ed['done']?_0x2198be(_0x3573ed['value']):_0x58b376(_0x3573ed['value'])['then'](_0x1b91da,_0x3cf3e);}_0x254cd1((_0x364a4a=_0x364a4a['apply'](_0x200ca3,_0x49d978||[]))['next']());});};class ListService{constructor(_0x2e3a7b){this['fetch']=_0x2e3a7b;}['add'](_0x14223a,_0x3dcb24,_0x425078,_0x5e5b3d){return __awaiter$3(this,void 0,void 0,function*(){const _0x4b01e5='List',_0xa13368={'account_name':_0x14223a,'list_name':_0x3dcb24,'search_service_name':_0x425078};try{const _0x1084cd=yield this['fetch']['post'](_0x4b01e5,_0x5e5b3d,_0xa13368);if(_0x1084cd['status']>0xc7&&_0x1084cd['status']<0x12c){const _0x7bdd66=yield _0x1084cd['json']();return new SuccessfulListIdentityResponse(_0x7bdd66);}const _0x50a751=yield _0x1084cd['json']();return new FailedListIdentityResponse(_0x50a751);}catch(_0x5a3870){if(_0x5a3870 instanceof Error)return new FailedListIdentityResponse({'detail':_0x5a3870['message'],'title':_0x5a3870['name'],'status':0x1f4,'instance':'','type':''});throw _0x5a3870;}});}['remove'](_0x15fc5e,_0x2ec653,_0x385d36){return __awaiter$3(this,void 0,void 0,function*(){const _0x25ea60='List/'+_0x15fc5e+'/'+_0x2ec653,_0x47d069=yield this['fetch']['delete'](_0x25ea60,_0x385d36);try{if(_0x47d069['status']>0xc7&&_0x47d069['status']<0x12c){const _0x2d4921=yield _0x47d069['json']();return new SuccessfulAccountResponse(_0x2d4921);}const _0x137474=yield _0x47d069['json']();return new FailedAccountResponse(_0x137474);}catch(_0x5b94db){if(_0x5b94db instanceof Error)return new FailedAccountResponse({'detail':_0x5b94db['message'],'title':_0x5b94db['name'],'status':0x1f4,'instance':'','type':''});throw _0x5b94db;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xc21d61,_0x5dfdda,_0x515c0a,_0x33e4c7){function _0x43f729(_0x26d730){return _0x26d730 instanceof _0x515c0a?_0x26d730:new _0x515c0a(function(_0x53d4b4){_0x53d4b4(_0x26d730);});}return new(_0x515c0a||(_0x515c0a=Promise))(function(_0x3a148e,_0x3bdb9c){function _0x2e83ed(_0xdbb064){try{_0x53c40f(_0x33e4c7['next'](_0xdbb064));}catch(_0x512030){_0x3bdb9c(_0x512030);}}function _0x95af10(_0x6787ce){try{_0x53c40f(_0x33e4c7['throw'](_0x6787ce));}catch(_0x3e445f){_0x3bdb9c(_0x3e445f);}}function _0x53c40f(_0x1d1f96){_0x1d1f96['done']?_0x3a148e(_0x1d1f96['value']):_0x43f729(_0x1d1f96['value'])['then'](_0x2e83ed,_0x95af10);}_0x53c40f((_0x33e4c7=_0x33e4c7['apply'](_0xc21d61,_0x5dfdda||[]))['next']());});};class Fetch{constructor(_0x570b83){this['baseUri']=_0x570b83,this['getUrl']=_0x4bc282=>{return _0x4bc282['startsWith']('/')&&(_0x4bc282=_0x4bc282['replace']('/','')),''+this['baseUri']+_0x4bc282;},!_0x570b83['endsWith']('/')&&(_0x570b83=_0x570b83+'/');}['get'](_0x577389,_0x1cab75){return __awaiter$2(this,void 0,void 0,function*(){const _0x50531e=this['getUrl'](_0x577389);return yield fetch(_0x50531e,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1cab75}});});}['post'](_0x511117,_0x5f0f54,_0xc0dfba){return __awaiter$2(this,void 0,void 0,function*(){const _0x1b6997=this['getUrl'](_0x511117);return yield fetch(_0x1b6997,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5f0f54},'body':_0xc0dfba?JSON['stringify'](_0xc0dfba):null});});}['PostNoAuth'](_0xda76cf,_0x1169aa){return __awaiter$2(this,void 0,void 0,function*(){const _0x2c9ab9=this['getUrl'](_0xda76cf);return yield fetch(_0x2c9ab9,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x1169aa?JSON['stringify'](_0x1169aa):null});});}['put'](_0x386d50,_0x33d1cd,_0x3f353b){return __awaiter$2(this,void 0,void 0,function*(){const _0x3bcac5=this['getUrl'](_0x386d50);return yield fetch(_0x3bcac5,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x33d1cd},'body':_0x3f353b?JSON['stringify'](_0x3f353b):null});});}['delete'](_0x2d58f8,_0x303a67){return __awaiter$2(this,void 0,void 0,function*(){const _0x1a22a3=this['getUrl'](_0x2d58f8);return yield fetch(_0x1a22a3,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x303a67}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x5f3960,_0x40e0f0,_0x12c96a,_0x2da8a0){function _0x3f916c(_0x2305a2){return _0x2305a2 instanceof _0x12c96a?_0x2305a2:new _0x12c96a(function(_0x4102de){_0x4102de(_0x2305a2);});}return new(_0x12c96a||(_0x12c96a=Promise))(function(_0x5a220c,_0x4b3828){function _0x556d9e(_0x5cf524){try{_0x43d1c0(_0x2da8a0['next'](_0x5cf524));}catch(_0x11907b){_0x4b3828(_0x11907b);}}function _0x51d907(_0xf90bf3){try{_0x43d1c0(_0x2da8a0['throw'](_0xf90bf3));}catch(_0x5a2036){_0x4b3828(_0x5a2036);}}function _0x43d1c0(_0x3a2e0e){_0x3a2e0e['done']?_0x5a220c(_0x3a2e0e['value']):_0x3f916c(_0x3a2e0e['value'])['then'](_0x556d9e,_0x51d907);}_0x43d1c0((_0x2da8a0=_0x2da8a0['apply'](_0x5f3960,_0x40e0f0||[]))['next']());});};class SearchServersService{constructor(_0x5cee61){this['fetch']=_0x5cee61,this['path']='search-services';}['create'](_0xdc98b2,_0x591ec4,_0x3f448f,_0x62eb7c,_0x2bb1f0,_0x1dad16,_0x3f2e10,_0x128954){return __awaiter$1(this,void 0,void 0,function*(){const _0x2a4f0a={'account_name':_0xdc98b2,'search_service_name':_0x591ec4,'endpoint':_0x3f448f,'key':_0x62eb7c,'country':_0x2bb1f0,'provider':_0x1dad16,'index_name':_0x3f2e10};try{const _0x3a6a8a=yield this['fetch']['post'](this['path'],_0x128954,_0x2a4f0a);if(_0x3a6a8a['status']>0xc7&&_0x3a6a8a['status']<0x12c){const _0x16377b=yield _0x3a6a8a['json']();return new SuccessfulSearchServiceResponse(_0x16377b);}const _0xa5d8b6=yield _0x3a6a8a['json']();return new FailedSearchServiceResponse(_0xa5d8b6);}catch(_0x3c8325){if(_0x3c8325 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x3c8325['message'],'title':_0x3c8325['name'],'status':0x1f4,'instance':'','type':''});throw _0x3c8325;}});}['delete'](_0x5897ad,_0x5d3935,_0x371218){return __awaiter$1(this,void 0,void 0,function*(){const _0x34f40a=this['path']+'/'+_0x5897ad+'/'+_0x5d3935;try{const _0x334dbd=yield this['fetch']['delete'](_0x34f40a,_0x371218);if(_0x334dbd['status']>0xc7&&_0x334dbd['status']<0x12c)return new SuccessfulResponse({});const _0x474251=yield _0x334dbd['json']();return new FailedResponse(_0x474251);}catch(_0x506d2f){if(_0x506d2f instanceof Error)return new FailedResponse({'detail':_0x506d2f['message'],'title':_0x506d2f['name'],'status':0x1f4,'instance':'','type':''});throw _0x506d2f;}});}['view'](_0x52a799,_0x42339b,_0x16e34c){return __awaiter$1(this,void 0,void 0,function*(){const _0x436905=this['path']+'/'+_0x52a799+'/'+_0x42339b;try{const _0x35c6b2=yield this['fetch']['get'](_0x436905,_0x16e34c);if(_0x35c6b2['status']>0xc7&&_0x35c6b2['status']<0x12c){const _0x2d9457=yield _0x35c6b2['json']();return new SuccessfulViewSearchServiceResponse(_0x2d9457);}const _0x565d22=yield _0x35c6b2['json']();return new FailedViewSearchServiceResponse(_0x565d22);}catch(_0x7deba8){if(_0x7deba8 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x7deba8['message'],'title':_0x7deba8['name'],'status':0x1f4,'instance':'','type':''});throw _0x7deba8;}});}['edit'](_0x34654f,_0x38c682,_0x10d23b,_0x4e7631,_0x308435,_0x2c81f5){return __awaiter$1(this,void 0,void 0,function*(){const _0x1dcf2b={'account_name':_0x34654f,'search_service_name':_0x38c682,'new_search_service_name':_0x10d23b,'key':_0x4e7631,'country':_0x308435};try{const _0x184f36=yield this['fetch']['put'](this['path'],_0x2c81f5,_0x1dcf2b);if(_0x184f36['status']>0xc7&&_0x184f36['status']<0x12c){const _0x346a2d=yield _0x184f36['json']();return new SuccessfulSearchServiceResponse(_0x346a2d);}const _0x245796=yield _0x184f36['json']();return new FailedSearchServiceResponse(_0x245796);}catch(_0x3cc973){if(_0x3cc973 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x3cc973['message'],'title':_0x3cc973['name'],'status':0x1f4,'instance':'','type':''});throw _0x3cc973;}});}['list'](_0x201ee4,_0x494def){return __awaiter$1(this,void 0,void 0,function*(){const _0x3a01b5=this['path']+'/'+_0x201ee4;try{const _0xf51eaa=yield this['fetch']['get'](_0x3a01b5,_0x494def);if(_0xf51eaa['status']>0xc7&&_0xf51eaa['status']<0x12c){const _0x180f43=yield _0xf51eaa['json']();return new SuccessfulListSearchServiceResponse(_0x180f43);}const _0x5282bf=yield _0xf51eaa['json']();return new FailedViewSearchServicesResponse(_0x5282bf);}catch(_0x4ab1bc){if(_0x4ab1bc instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x4ab1bc['message'],'title':_0x4ab1bc['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ab1bc;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x2b9156,_0x1c35a9,_0x1ac0c5,_0x610922){function _0x3b912b(_0xbcb2cb){return _0xbcb2cb instanceof _0x1ac0c5?_0xbcb2cb:new _0x1ac0c5(function(_0x18b026){_0x18b026(_0xbcb2cb);});}return new(_0x1ac0c5||(_0x1ac0c5=Promise))(function(_0x9a7da2,_0x505705){function _0x4e07cd(_0x31690c){try{_0x18eff4(_0x610922['next'](_0x31690c));}catch(_0x4921d7){_0x505705(_0x4921d7);}}function _0x3b7645(_0x4cdca0){try{_0x18eff4(_0x610922['throw'](_0x4cdca0));}catch(_0x10fda6){_0x505705(_0x10fda6);}}function _0x18eff4(_0x4ba114){_0x4ba114['done']?_0x9a7da2(_0x4ba114['value']):_0x3b912b(_0x4ba114['value'])['then'](_0x4e07cd,_0x3b7645);}_0x18eff4((_0x610922=_0x610922['apply'](_0x2b9156,_0x1c35a9||[]))['next']());});};class AdminClient{constructor(_0x45974d='https://admin.searchability.dev/'){var _0x2ed24=new Fetch(_0x45974d);this['Accounts']=new AccountService(_0x2ed24),this['Lists']=new ListService(_0x2ed24),this['ApiKeys']=new ApiKeyService(_0x2ed24),this['SearchServices']=new SearchServersService(_0x2ed24);}}class AuthClient{constructor(_0x410a07='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x410a07);}['login'](_0x4174cf){return __awaiter(this,void 0,void 0,function*(){const _0x5cbc26='login/'+_0x4174cf;try{const _0x59242e=yield yield fetch(_0x5cbc26);if(_0x59242e['status']>0xc7&&_0x59242e['status']<0x12c){const _0x4be758=yield _0x59242e['json']();return new SuccessfulAuthResponse(_0x4be758);}const _0x5da723=yield _0x59242e['json']();return new FailedAuthResponse(_0x5da723);}catch(_0x85a98c){if(_0x85a98c instanceof Error)return new FailedAuthResponse({'detail':_0x85a98c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x85a98c;}});}['refresh'](_0x22bedf){return __awaiter(this,void 0,void 0,function*(){const _0x3981d7='refresh',_0x4cd245={'refresh_token':_0x22bedf};try{const _0x437906=yield this['fetch']['PostNoAuth'](_0x3981d7,_0x4cd245);if(_0x437906['status']>0xc7&&_0x437906['status']<0x12c){const _0x112697=yield _0x437906['json']();return new SuccessfulAuthResponse(_0x112697);}const _0x2e46a5=yield _0x437906['json']();return new FailedAuthResponse(_0x2e46a5);}catch(_0x3cc1f5){if(_0x3cc1f5 instanceof Error)return new FailedAuthResponse({'detail':_0x3cc1f5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3cc1f5;}});}['getTokenStatus'](_0x37ed28){if(Date['now']()<_0x37ed28['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x37ed28['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare class ApiKeyService {
|
|
|
27
27
|
declare class ListService {
|
|
28
28
|
private readonly fetch;
|
|
29
29
|
constructor(fetch: Fetch);
|
|
30
|
-
add(
|
|
30
|
+
add(account_name: string, list_name: string, search_service_name: string, access_token: string): Promise<Response<ListIdentity, Problem>>;
|
|
31
31
|
remove(accountName: string, listName: string, access_token: string): Promise<Response<Account, Problem>>;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -135,12 +135,24 @@ declare class SuccessfulAccountResponse extends Response<Account, Problem> {
|
|
|
135
135
|
toSuccess(): Account;
|
|
136
136
|
toProblem(): Problem;
|
|
137
137
|
}
|
|
138
|
+
declare class SuccessfulListIdentityResponse extends Response<ListIdentity, Problem> {
|
|
139
|
+
readonly list: ListIdentity;
|
|
140
|
+
constructor(list: ListIdentity);
|
|
141
|
+
toSuccess(): ListIdentity;
|
|
142
|
+
toProblem(): Problem;
|
|
143
|
+
}
|
|
138
144
|
declare class FailedAccountResponse extends Response<Account, Problem> {
|
|
139
145
|
readonly problem: Problem;
|
|
140
146
|
constructor(problem: Problem);
|
|
141
147
|
toSuccess(): Account;
|
|
142
148
|
toProblem(): Problem;
|
|
143
149
|
}
|
|
150
|
+
declare class FailedListIdentityResponse extends Response<ListIdentity, Problem> {
|
|
151
|
+
readonly problem: Problem;
|
|
152
|
+
constructor(problem: Problem);
|
|
153
|
+
toSuccess(): ListIdentity;
|
|
154
|
+
toProblem(): Problem;
|
|
155
|
+
}
|
|
144
156
|
declare class SuccessfulAuthResponse extends Response<Tokens, Problem> {
|
|
145
157
|
readonly tokens: Tokens;
|
|
146
158
|
constructor(tokens: Tokens);
|
|
@@ -226,4 +238,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
226
238
|
toProblem(): Problem;
|
|
227
239
|
}
|
|
228
240
|
|
|
229
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, FailedViewSearchServicesResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulListSearchServiceResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
|
241
|
+
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedListIdentityResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, FailedViewSearchServicesResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulListIdentityResponse, SuccessfulListSearchServiceResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x405825){_0x405825[_0x405825['Ok']=0x0]='Ok',_0x405825[_0x405825['Refresh']=0x1]='Refresh',_0x405825[_0x405825['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(_0x2d5b24){this['isSuccess']=_0x2d5b24;}}class SuccessfulAccountResponse extends Response{constructor(_0x130dd1){super(!![]),this['account']=_0x130dd1;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x30aafc){super(![]),this['problem']=_0x30aafc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4aa2f2){super(!![]),this['tokens']=_0x4aa2f2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x419e7d){super(![]),this['problem']=_0x419e7d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0xf12771){super(!![]),this['apiKey']=_0xf12771;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0xe4f89b){super(![]),this['problem']=_0xe4f89b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x449bf3){super(!![]),this['searchService']=_0x449bf3;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0xea6ba9){super(![]),this['problem']=_0xea6ba9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x5b4413){super(!![]),this['searchService']=_0x5b4413;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x12b76f){super(!![]),this['searchServices']=_0x12b76f;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x136b0c){super(![]),this['problem']=_0x136b0c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1eee7a){super(![]),this['problem']=_0x1eee7a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x598570){super(!![]),this['apiKeyValue']=_0x598570;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x3d4eae){super(!![]),this['obj']=_0x3d4eae;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x151c37){super(![]),this['problem']=_0x151c37;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x379ad3){super(![]),this['problem']=_0x379ad3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x5f10e2,_0x5616e6,_0x59375a,_0x38ce2a){function _0x43120f(_0x2d3a56){return _0x2d3a56 instanceof _0x59375a?_0x2d3a56:new _0x59375a(function(_0x18900b){_0x18900b(_0x2d3a56);});}return new(_0x59375a||(_0x59375a=Promise))(function(_0x4bb38c,_0x1827fa){function _0x3b5107(_0x2d346e){try{_0x198dbb(_0x38ce2a['next'](_0x2d346e));}catch(_0xfec8cf){_0x1827fa(_0xfec8cf);}}function _0x2c3086(_0x4b2f52){try{_0x198dbb(_0x38ce2a['throw'](_0x4b2f52));}catch(_0x52f675){_0x1827fa(_0x52f675);}}function _0x198dbb(_0x5e7d53){_0x5e7d53['done']?_0x4bb38c(_0x5e7d53['value']):_0x43120f(_0x5e7d53['value'])['then'](_0x3b5107,_0x2c3086);}_0x198dbb((_0x38ce2a=_0x38ce2a['apply'](_0x5f10e2,_0x5616e6||[]))['next']());});};class AccountService{constructor(_0x428417){this['fetch']=_0x428417;}['get'](_0x4d95b5,_0x2e8cda){return __awaiter$5(this,void 0,void 0,function*(){const _0x383708='Account/'+_0x4d95b5+'/',_0x247353=yield this['fetch']['get'](_0x383708,_0x2e8cda);try{if(_0x247353['status']>0xc7&&_0x247353['status']<0x12c){const _0x580b1e=yield _0x247353['json']();return new SuccessfulAccountResponse(_0x580b1e);}const _0x4a9746=yield _0x247353['json']();return new FailedAccountResponse(_0x4a9746);}catch(_0x44d45c){if(_0x44d45c instanceof Error)return new FailedAccountResponse({'detail':_0x44d45c['message'],'title':_0x44d45c['name'],'status':0x1f4,'instance':'','type':''});throw _0x44d45c;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x195ca5,_0x19f345,_0x3dadae,_0x1db88f){function _0x444a99(_0x5b9285){return _0x5b9285 instanceof _0x3dadae?_0x5b9285:new _0x3dadae(function(_0x35fc4a){_0x35fc4a(_0x5b9285);});}return new(_0x3dadae||(_0x3dadae=Promise))(function(_0x408082,_0x462ee8){function _0x5ba137(_0xcb1d13){try{_0x1413c9(_0x1db88f['next'](_0xcb1d13));}catch(_0x7447a9){_0x462ee8(_0x7447a9);}}function _0x3293a1(_0x521fc1){try{_0x1413c9(_0x1db88f['throw'](_0x521fc1));}catch(_0x4e9964){_0x462ee8(_0x4e9964);}}function _0x1413c9(_0x6591c7){_0x6591c7['done']?_0x408082(_0x6591c7['value']):_0x444a99(_0x6591c7['value'])['then'](_0x5ba137,_0x3293a1);}_0x1413c9((_0x1db88f=_0x1db88f['apply'](_0x195ca5,_0x19f345||[]))['next']());});};class ApiKeyService{constructor(_0xd43b33){this['fetch']=_0xd43b33,this['path']='api-key';}['create'](_0x2016dd,_0x23a5a3,_0x2efaa1){return __awaiter$4(this,void 0,void 0,function*(){const _0x496eac={'account_name':_0x2016dd,'api_key_name':_0x23a5a3};try{const _0x5208af=yield this['fetch']['post'](this['path'],_0x2efaa1,_0x496eac);if(_0x5208af['status']>0xc7&&_0x5208af['status']<0x12c){const _0x13a4c1=yield _0x5208af['json']();return new SuccessfulApiKeyResponse(_0x13a4c1);}const _0x273f67=yield _0x5208af['json']();return new FailedApiKeyResponse(_0x273f67);}catch(_0x660c4){if(_0x660c4 instanceof Error)return new FailedApiKeyResponse({'detail':_0x660c4['message'],'title':_0x660c4['name'],'status':0x1f4,'instance':'','type':''});throw _0x660c4;}});}['view'](_0x4ada30,_0x117b33,_0x40399b){return __awaiter$4(this,void 0,void 0,function*(){const _0x68dde9=this['path']+'/'+_0x4ada30+'/'+_0x117b33;try{const _0x7ac3ee=yield this['fetch']['get'](_0x68dde9,_0x40399b);if(_0x7ac3ee['status']>0xc7&&_0x7ac3ee['status']<0x12c){const _0x3d7c5a=yield _0x7ac3ee['json']();return new SuccessfulApiKeyValueResponse(_0x3d7c5a);}const _0x5cd93e=yield _0x7ac3ee['json']();return new FailedApiKeyValueResponse(_0x5cd93e);}catch(_0x60f92){if(_0x60f92 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x60f92['message'],'title':_0x60f92['name'],'status':0x1f4,'instance':'','type':''});throw _0x60f92;}});}['delete'](_0x4d29a9,_0x399afc,_0x420453){return __awaiter$4(this,void 0,void 0,function*(){const _0x38239c=this['path']+'/'+_0x4d29a9+'/'+_0x399afc;try{const _0x3a99ba=yield this['fetch']['delete'](_0x38239c,_0x420453);if(_0x3a99ba['status']>0xc7&&_0x3a99ba['status']<0x12c)return new SuccessfulResponse({});const _0x5498fc=yield _0x3a99ba['json']();return new FailedResponse(_0x5498fc);}catch(_0x148ea0){if(_0x148ea0 instanceof Error)return new FailedResponse({'detail':_0x148ea0['message'],'title':_0x148ea0['name'],'status':0x1f4,'instance':'','type':''});throw _0x148ea0;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5a3044,_0x4e7fe6,_0x492edb,_0x4fdff4){function _0xb2556(_0x32ae61){return _0x32ae61 instanceof _0x492edb?_0x32ae61:new _0x492edb(function(_0x33579e){_0x33579e(_0x32ae61);});}return new(_0x492edb||(_0x492edb=Promise))(function(_0x32dbc6,_0x2b243a){function _0x2b97a8(_0x12d690){try{_0x457100(_0x4fdff4['next'](_0x12d690));}catch(_0x56c899){_0x2b243a(_0x56c899);}}function _0x1fd9c4(_0x643d13){try{_0x457100(_0x4fdff4['throw'](_0x643d13));}catch(_0x2741d7){_0x2b243a(_0x2741d7);}}function _0x457100(_0x3d6789){_0x3d6789['done']?_0x32dbc6(_0x3d6789['value']):_0xb2556(_0x3d6789['value'])['then'](_0x2b97a8,_0x1fd9c4);}_0x457100((_0x4fdff4=_0x4fdff4['apply'](_0x5a3044,_0x4e7fe6||[]))['next']());});};class ListService{constructor(_0x4e82a8){this['fetch']=_0x4e82a8;}['add'](_0x33793e,_0xb86175,_0x1cbef2){return __awaiter$3(this,void 0,void 0,function*(){const _0x1ca9e7='List',_0x5d1f5a={'account_name':_0x33793e,'list_name':_0xb86175};try{const _0x42766d=yield this['fetch']['post'](_0x1ca9e7,_0x1cbef2,_0x5d1f5a);if(_0x42766d['status']>0xc7&&_0x42766d['status']<0x12c){const _0x302eca=yield _0x42766d['json']();return new SuccessfulAccountResponse(_0x302eca);}const _0xd16586=yield _0x42766d['json']();return new FailedAccountResponse(_0xd16586);}catch(_0x1b1ab7){if(_0x1b1ab7 instanceof Error)return new FailedAccountResponse({'detail':_0x1b1ab7['message'],'title':_0x1b1ab7['name'],'status':0x1f4,'instance':'','type':''});throw _0x1b1ab7;}});}['remove'](_0x69a688,_0x2b3ac3,_0x2d7792){return __awaiter$3(this,void 0,void 0,function*(){const _0x233ce4='List/'+_0x69a688+'/'+_0x2b3ac3,_0x5d72ca=yield this['fetch']['delete'](_0x233ce4,_0x2d7792);try{if(_0x5d72ca['status']>0xc7&&_0x5d72ca['status']<0x12c){const _0x76797d=yield _0x5d72ca['json']();return new SuccessfulAccountResponse(_0x76797d);}const _0x5ed919=yield _0x5d72ca['json']();return new FailedAccountResponse(_0x5ed919);}catch(_0x5c6bf4){if(_0x5c6bf4 instanceof Error)return new FailedAccountResponse({'detail':_0x5c6bf4['message'],'title':_0x5c6bf4['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c6bf4;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x58cb04,_0x2bcfe6,_0x46b3c0,_0x29232e){function _0x485a7a(_0x39f2c7){return _0x39f2c7 instanceof _0x46b3c0?_0x39f2c7:new _0x46b3c0(function(_0x374b80){_0x374b80(_0x39f2c7);});}return new(_0x46b3c0||(_0x46b3c0=Promise))(function(_0x440c7f,_0x3986a6){function _0x55b26(_0xcced1b){try{_0x44fcd0(_0x29232e['next'](_0xcced1b));}catch(_0x3c98e3){_0x3986a6(_0x3c98e3);}}function _0x1bf77b(_0x4911f0){try{_0x44fcd0(_0x29232e['throw'](_0x4911f0));}catch(_0x1bf27d){_0x3986a6(_0x1bf27d);}}function _0x44fcd0(_0x45f089){_0x45f089['done']?_0x440c7f(_0x45f089['value']):_0x485a7a(_0x45f089['value'])['then'](_0x55b26,_0x1bf77b);}_0x44fcd0((_0x29232e=_0x29232e['apply'](_0x58cb04,_0x2bcfe6||[]))['next']());});};class Fetch{constructor(_0x4b830d){this['baseUri']=_0x4b830d,this['getUrl']=_0x456125=>{return _0x456125['startsWith']('/')&&(_0x456125=_0x456125['replace']('/','')),''+this['baseUri']+_0x456125;},!_0x4b830d['endsWith']('/')&&(_0x4b830d=_0x4b830d+'/');}['get'](_0x1eaf91,_0x492559){return __awaiter$2(this,void 0,void 0,function*(){const _0xe2f3ab=this['getUrl'](_0x1eaf91);return yield fetch(_0xe2f3ab,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x492559}});});}['post'](_0x12050c,_0x28cd3d,_0x50188e){return __awaiter$2(this,void 0,void 0,function*(){const _0x44cb3c=this['getUrl'](_0x12050c);return yield fetch(_0x44cb3c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x28cd3d},'body':_0x50188e?JSON['stringify'](_0x50188e):null});});}['PostNoAuth'](_0xcc6f26,_0x2f2236){return __awaiter$2(this,void 0,void 0,function*(){const _0x253ce6=this['getUrl'](_0xcc6f26);return yield fetch(_0x253ce6,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x2f2236?JSON['stringify'](_0x2f2236):null});});}['put'](_0x569a1e,_0x1c0402,_0x591d2c){return __awaiter$2(this,void 0,void 0,function*(){const _0x446c53=this['getUrl'](_0x569a1e);return yield fetch(_0x446c53,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1c0402},'body':_0x591d2c?JSON['stringify'](_0x591d2c):null});});}['delete'](_0x5e7f12,_0x578ce2){return __awaiter$2(this,void 0,void 0,function*(){const _0x4941ea=this['getUrl'](_0x5e7f12);return yield fetch(_0x4941ea,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x578ce2}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x549bd1,_0x5467e1,_0x4758b6,_0x54484a){function _0x3e2396(_0x176f71){return _0x176f71 instanceof _0x4758b6?_0x176f71:new _0x4758b6(function(_0x4a2349){_0x4a2349(_0x176f71);});}return new(_0x4758b6||(_0x4758b6=Promise))(function(_0x192751,_0x23d31f){function _0x320b21(_0x53c39c){try{_0x139dff(_0x54484a['next'](_0x53c39c));}catch(_0x4d3e7b){_0x23d31f(_0x4d3e7b);}}function _0x402250(_0x15e77a){try{_0x139dff(_0x54484a['throw'](_0x15e77a));}catch(_0x1d5fca){_0x23d31f(_0x1d5fca);}}function _0x139dff(_0x55b17c){_0x55b17c['done']?_0x192751(_0x55b17c['value']):_0x3e2396(_0x55b17c['value'])['then'](_0x320b21,_0x402250);}_0x139dff((_0x54484a=_0x54484a['apply'](_0x549bd1,_0x5467e1||[]))['next']());});};class SearchServersService{constructor(_0x57bec4){this['fetch']=_0x57bec4,this['path']='search-services';}['create'](_0x55d18e,_0x2445ae,_0x31abea,_0x42e30c,_0x3a57f7,_0x204cce,_0x5be6ec,_0x2de986){return __awaiter$1(this,void 0,void 0,function*(){const _0x2a6931={'account_name':_0x55d18e,'search_service_name':_0x2445ae,'endpoint':_0x31abea,'key':_0x42e30c,'country':_0x3a57f7,'provider':_0x204cce,'index_name':_0x5be6ec};try{const _0xb2c02f=yield this['fetch']['post'](this['path'],_0x2de986,_0x2a6931);if(_0xb2c02f['status']>0xc7&&_0xb2c02f['status']<0x12c){const _0x4ee6b5=yield _0xb2c02f['json']();return new SuccessfulSearchServiceResponse(_0x4ee6b5);}const _0x174c53=yield _0xb2c02f['json']();return new FailedSearchServiceResponse(_0x174c53);}catch(_0x9ba5cb){if(_0x9ba5cb instanceof Error)return new FailedSearchServiceResponse({'detail':_0x9ba5cb['message'],'title':_0x9ba5cb['name'],'status':0x1f4,'instance':'','type':''});throw _0x9ba5cb;}});}['delete'](_0x52beb4,_0x61bdfb,_0x389f0c){return __awaiter$1(this,void 0,void 0,function*(){const _0x3fbee1=this['path']+'/'+_0x52beb4+'/'+_0x61bdfb;try{const _0x27e294=yield this['fetch']['delete'](_0x3fbee1,_0x389f0c);if(_0x27e294['status']>0xc7&&_0x27e294['status']<0x12c)return new SuccessfulResponse({});const _0x8b43b0=yield _0x27e294['json']();return new FailedResponse(_0x8b43b0);}catch(_0x3eb38b){if(_0x3eb38b instanceof Error)return new FailedResponse({'detail':_0x3eb38b['message'],'title':_0x3eb38b['name'],'status':0x1f4,'instance':'','type':''});throw _0x3eb38b;}});}['view'](_0x4b80ff,_0x331df7,_0xc57edf){return __awaiter$1(this,void 0,void 0,function*(){const _0x41dee6=this['path']+'/'+_0x4b80ff+'/'+_0x331df7;try{const _0x5c3556=yield this['fetch']['get'](_0x41dee6,_0xc57edf);if(_0x5c3556['status']>0xc7&&_0x5c3556['status']<0x12c){const _0x4f7efd=yield _0x5c3556['json']();return new SuccessfulViewSearchServiceResponse(_0x4f7efd);}const _0xb320af=yield _0x5c3556['json']();return new FailedViewSearchServiceResponse(_0xb320af);}catch(_0x2a1790){if(_0x2a1790 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x2a1790['message'],'title':_0x2a1790['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a1790;}});}['edit'](_0x506d96,_0x3e8520,_0x568416,_0x4a6530,_0x588e01,_0x259d27){return __awaiter$1(this,void 0,void 0,function*(){const _0x1432ab={'account_name':_0x506d96,'search_service_name':_0x3e8520,'new_search_service_name':_0x568416,'key':_0x4a6530,'country':_0x588e01};try{const _0x158eb2=yield this['fetch']['put'](this['path'],_0x259d27,_0x1432ab);if(_0x158eb2['status']>0xc7&&_0x158eb2['status']<0x12c){const _0x53d7fd=yield _0x158eb2['json']();return new SuccessfulSearchServiceResponse(_0x53d7fd);}const _0xc03c44=yield _0x158eb2['json']();return new FailedSearchServiceResponse(_0xc03c44);}catch(_0x5e6e96){if(_0x5e6e96 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5e6e96['message'],'title':_0x5e6e96['name'],'status':0x1f4,'instance':'','type':''});throw _0x5e6e96;}});}['list'](_0x42bdce,_0x352874){return __awaiter$1(this,void 0,void 0,function*(){const _0x472d6f=this['path']+'/'+_0x42bdce;try{const _0x1038bc=yield this['fetch']['get'](_0x472d6f,_0x352874);if(_0x1038bc['status']>0xc7&&_0x1038bc['status']<0x12c){const _0x2643c1=yield _0x1038bc['json']();return new SuccessfulListSearchServiceResponse(_0x2643c1);}const _0x4cdd25=yield _0x1038bc['json']();return new FailedViewSearchServicesResponse(_0x4cdd25);}catch(_0x856e45){if(_0x856e45 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x856e45['message'],'title':_0x856e45['name'],'status':0x1f4,'instance':'','type':''});throw _0x856e45;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x589005,_0xdef6ab,_0xe6ef17,_0x4f290a){function _0x22c870(_0x476d1c){return _0x476d1c instanceof _0xe6ef17?_0x476d1c:new _0xe6ef17(function(_0x1e89f6){_0x1e89f6(_0x476d1c);});}return new(_0xe6ef17||(_0xe6ef17=Promise))(function(_0x31fac4,_0x2f7ca2){function _0x59d61e(_0x208379){try{_0x5e66ab(_0x4f290a['next'](_0x208379));}catch(_0x225961){_0x2f7ca2(_0x225961);}}function _0x62c6e7(_0x5554ac){try{_0x5e66ab(_0x4f290a['throw'](_0x5554ac));}catch(_0x482fe1){_0x2f7ca2(_0x482fe1);}}function _0x5e66ab(_0x1a11ca){_0x1a11ca['done']?_0x31fac4(_0x1a11ca['value']):_0x22c870(_0x1a11ca['value'])['then'](_0x59d61e,_0x62c6e7);}_0x5e66ab((_0x4f290a=_0x4f290a['apply'](_0x589005,_0xdef6ab||[]))['next']());});};class AdminClient{constructor(_0x57e0d4='https://admin.searchability.dev/'){var _0x2cb9be=new Fetch(_0x57e0d4);this['Accounts']=new AccountService(_0x2cb9be),this['Lists']=new ListService(_0x2cb9be),this['ApiKeys']=new ApiKeyService(_0x2cb9be),this['SearchServices']=new SearchServersService(_0x2cb9be);}}class AuthClient{constructor(_0x40934e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x40934e);}['login'](_0x363a61){return __awaiter(this,void 0,void 0,function*(){const _0x37e011='login/'+_0x363a61;try{const _0x20555c=yield yield fetch(_0x37e011);if(_0x20555c['status']>0xc7&&_0x20555c['status']<0x12c){const _0x386b74=yield _0x20555c['json']();return new SuccessfulAuthResponse(_0x386b74);}const _0x27edba=yield _0x20555c['json']();return new FailedAuthResponse(_0x27edba);}catch(_0x4ac9f2){if(_0x4ac9f2 instanceof Error)return new FailedAuthResponse({'detail':_0x4ac9f2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ac9f2;}});}['refresh'](_0x28c36d){return __awaiter(this,void 0,void 0,function*(){const _0x5cda0f='refresh',_0x10377f={'refresh_token':_0x28c36d};try{const _0x3d2168=yield this['fetch']['PostNoAuth'](_0x5cda0f,_0x10377f);if(_0x3d2168['status']>0xc7&&_0x3d2168['status']<0x12c){const _0x2bab85=yield _0x3d2168['json']();return new SuccessfulAuthResponse(_0x2bab85);}const _0x3fd88e=yield _0x3d2168['json']();return new FailedAuthResponse(_0x3fd88e);}catch(_0x4ea930){if(_0x4ea930 instanceof Error)return new FailedAuthResponse({'detail':_0x4ea930['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ea930;}});}['getTokenStatus'](_0x4ab781){if(Date['now']()<_0x4ab781['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4ab781['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|