@searchability/admin-client 0.0.44 → 0.0.46
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(_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 };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x3f4a26){_0x3f4a26[_0x3f4a26['Ok']=0x0]='Ok',_0x3f4a26[_0x3f4a26['Refresh']=0x1]='Refresh',_0x3f4a26[_0x3f4a26['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(_0x43e0c3){this['isSuccess']=_0x43e0c3;}}class SuccessfulAccountResponse extends Response{constructor(_0x37b7b9){super(!![]),this['account']=_0x37b7b9;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2dfbaf){super(![]),this['problem']=_0x2dfbaf;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x39f6a0){super(!![]),this['tokens']=_0x39f6a0;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x1f0628){super(![]),this['problem']=_0x1f0628;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x14a559){super(!![]),this['apiKey']=_0x14a559;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0xe0b1fb){super(![]),this['problem']=_0xe0b1fb;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x4147fa){super(!![]),this['searchService']=_0x4147fa;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x5c4fa3){super(![]),this['problem']=_0x5c4fa3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x2de875){super(!![]),this['searchService']=_0x2de875;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x35d965){super(!![]),this['searchServices']=_0x35d965;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x96a0bd){super(![]),this['problem']=_0x96a0bd;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x3276d3){super(![]),this['problem']=_0x3276d3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x78ee49){super(!![]),this['apiKeyValue']=_0x78ee49;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x2046e6){super(!![]),this['obj']=_0x2046e6;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x30221b){super(![]),this['problem']=_0x30221b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x341d53){super(![]),this['problem']=_0x341d53;}['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(_0x2dc902,_0x996d5a,_0x57f1f4,_0x3aacdb){function _0xab79ae(_0x354e40){return _0x354e40 instanceof _0x57f1f4?_0x354e40:new _0x57f1f4(function(_0x2922d4){_0x2922d4(_0x354e40);});}return new(_0x57f1f4||(_0x57f1f4=Promise))(function(_0x2dbe1e,_0x5ea090){function _0x178de3(_0x263b0b){try{_0xb8a906(_0x3aacdb['next'](_0x263b0b));}catch(_0x165fd5){_0x5ea090(_0x165fd5);}}function _0x5e23dc(_0x15926a){try{_0xb8a906(_0x3aacdb['throw'](_0x15926a));}catch(_0xf3dcb7){_0x5ea090(_0xf3dcb7);}}function _0xb8a906(_0x1c70e9){_0x1c70e9['done']?_0x2dbe1e(_0x1c70e9['value']):_0xab79ae(_0x1c70e9['value'])['then'](_0x178de3,_0x5e23dc);}_0xb8a906((_0x3aacdb=_0x3aacdb['apply'](_0x2dc902,_0x996d5a||[]))['next']());});};class AccountService{constructor(_0x399472){this['fetch']=_0x399472;}['get'](_0x234ee9,_0x35be2b){return __awaiter$5(this,void 0,void 0,function*(){const _0x226ad6='Account/'+_0x234ee9+'/',_0xd9cb2f=yield this['fetch']['get'](_0x226ad6,_0x35be2b);try{if(_0xd9cb2f['status']>0xc7&&_0xd9cb2f['status']<0x12c){const _0x3a8359=yield _0xd9cb2f['json']();return new SuccessfulAccountResponse(_0x3a8359);}const _0x3a24cf=yield _0xd9cb2f['json']();return new FailedAccountResponse(_0x3a24cf);}catch(_0x151814){if(_0x151814 instanceof Error)return new FailedAccountResponse({'detail':_0x151814['message'],'title':_0x151814['name'],'status':0x1f4,'instance':'','type':''});throw _0x151814;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x409b83,_0x27f6a4,_0x1b804a,_0x57a44d){function _0x3e7322(_0x30c43b){return _0x30c43b instanceof _0x1b804a?_0x30c43b:new _0x1b804a(function(_0x106120){_0x106120(_0x30c43b);});}return new(_0x1b804a||(_0x1b804a=Promise))(function(_0x491391,_0x27a9ba){function _0x54d423(_0x3f15c0){try{_0xae3bf7(_0x57a44d['next'](_0x3f15c0));}catch(_0x5302bb){_0x27a9ba(_0x5302bb);}}function _0x3cc9cc(_0x157ad){try{_0xae3bf7(_0x57a44d['throw'](_0x157ad));}catch(_0x48914d){_0x27a9ba(_0x48914d);}}function _0xae3bf7(_0x37fe0f){_0x37fe0f['done']?_0x491391(_0x37fe0f['value']):_0x3e7322(_0x37fe0f['value'])['then'](_0x54d423,_0x3cc9cc);}_0xae3bf7((_0x57a44d=_0x57a44d['apply'](_0x409b83,_0x27f6a4||[]))['next']());});};class ApiKeyService{constructor(_0x4ed465){this['fetch']=_0x4ed465,this['path']='api-key';}['create'](_0x20433c,_0x3c2e5f,_0x279bf1){return __awaiter$4(this,void 0,void 0,function*(){const _0x6b1afc={'account_name':_0x20433c,'api_key_name':_0x3c2e5f};try{const _0x3be59e=yield this['fetch']['post'](this['path'],_0x279bf1,_0x6b1afc);if(_0x3be59e['status']>0xc7&&_0x3be59e['status']<0x12c){const _0xd362f2=yield _0x3be59e['json']();return new SuccessfulApiKeyResponse(_0xd362f2);}const _0x47f26f=yield _0x3be59e['json']();return new FailedApiKeyResponse(_0x47f26f);}catch(_0x140657){if(_0x140657 instanceof Error)return new FailedApiKeyResponse({'detail':_0x140657['message'],'title':_0x140657['name'],'status':0x1f4,'instance':'','type':''});throw _0x140657;}});}['view'](_0x15168d,_0x5f42e1,_0x40988c){return __awaiter$4(this,void 0,void 0,function*(){const _0x489b85=this['path']+'/'+_0x15168d+'/'+_0x5f42e1;try{const _0x2e117d=yield this['fetch']['get'](_0x489b85,_0x40988c);if(_0x2e117d['status']>0xc7&&_0x2e117d['status']<0x12c){const _0x1e3c6f=yield _0x2e117d['json']();return new SuccessfulApiKeyValueResponse(_0x1e3c6f);}const _0x31a494=yield _0x2e117d['json']();return new FailedApiKeyValueResponse(_0x31a494);}catch(_0x20d909){if(_0x20d909 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x20d909['message'],'title':_0x20d909['name'],'status':0x1f4,'instance':'','type':''});throw _0x20d909;}});}['delete'](_0x3cb910,_0x200b1a,_0x3b3c7a){return __awaiter$4(this,void 0,void 0,function*(){const _0x5edd3d=this['path']+'/'+_0x3cb910+'/'+_0x200b1a;try{const _0x296993=yield this['fetch']['delete'](_0x5edd3d,_0x3b3c7a);if(_0x296993['status']>0xc7&&_0x296993['status']<0x12c)return new SuccessfulResponse({});const _0x596ec7=yield _0x296993['json']();return new FailedResponse(_0x596ec7);}catch(_0x5a31b6){if(_0x5a31b6 instanceof Error)return new FailedResponse({'detail':_0x5a31b6['message'],'title':_0x5a31b6['name'],'status':0x1f4,'instance':'','type':''});throw _0x5a31b6;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x2608b2,_0x4d1305,_0x4c880d,_0x34daa5){function _0x57dfb0(_0x40e9e5){return _0x40e9e5 instanceof _0x4c880d?_0x40e9e5:new _0x4c880d(function(_0x2c3b17){_0x2c3b17(_0x40e9e5);});}return new(_0x4c880d||(_0x4c880d=Promise))(function(_0x43a40e,_0x1def4b){function _0x192d95(_0x44ac2f){try{_0x4f70e7(_0x34daa5['next'](_0x44ac2f));}catch(_0x34e418){_0x1def4b(_0x34e418);}}function _0x2f87d7(_0x5ddd1a){try{_0x4f70e7(_0x34daa5['throw'](_0x5ddd1a));}catch(_0x39d791){_0x1def4b(_0x39d791);}}function _0x4f70e7(_0xd626c1){_0xd626c1['done']?_0x43a40e(_0xd626c1['value']):_0x57dfb0(_0xd626c1['value'])['then'](_0x192d95,_0x2f87d7);}_0x4f70e7((_0x34daa5=_0x34daa5['apply'](_0x2608b2,_0x4d1305||[]))['next']());});};class ListService{constructor(_0x2299e2){this['fetch']=_0x2299e2;}['add'](_0x2755e1,_0x8ad285,_0x8923ca){return __awaiter$3(this,void 0,void 0,function*(){const _0x196542='List',_0x53af95={'account_name':_0x2755e1,'list_name':_0x8ad285};try{const _0x3bf92b=yield this['fetch']['post'](_0x196542,_0x8923ca,_0x53af95);if(_0x3bf92b['status']>0xc7&&_0x3bf92b['status']<0x12c){const _0x24ff6=yield _0x3bf92b['json']();return new SuccessfulAccountResponse(_0x24ff6);}const _0x2e7ac1=yield _0x3bf92b['json']();return new FailedAccountResponse(_0x2e7ac1);}catch(_0x4bfa96){if(_0x4bfa96 instanceof Error)return new FailedAccountResponse({'detail':_0x4bfa96['message'],'title':_0x4bfa96['name'],'status':0x1f4,'instance':'','type':''});throw _0x4bfa96;}});}['remove'](_0xd334b8,_0x310021,_0xc43532){return __awaiter$3(this,void 0,void 0,function*(){const _0x249274='List/'+_0xd334b8+'/'+_0x310021,_0x4724a6=yield this['fetch']['delete'](_0x249274,_0xc43532);try{if(_0x4724a6['status']>0xc7&&_0x4724a6['status']<0x12c){const _0x297fab=yield _0x4724a6['json']();return new SuccessfulAccountResponse(_0x297fab);}const _0x398085=yield _0x4724a6['json']();return new FailedAccountResponse(_0x398085);}catch(_0x1ecb7e){if(_0x1ecb7e instanceof Error)return new FailedAccountResponse({'detail':_0x1ecb7e['message'],'title':_0x1ecb7e['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ecb7e;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x485e15,_0x4d846f,_0x3cba38,_0x5988c1){function _0x3181fe(_0x3cbf09){return _0x3cbf09 instanceof _0x3cba38?_0x3cbf09:new _0x3cba38(function(_0x3df5a9){_0x3df5a9(_0x3cbf09);});}return new(_0x3cba38||(_0x3cba38=Promise))(function(_0xe0a3d9,_0x440d2d){function _0x47691f(_0x4c7914){try{_0x4265ff(_0x5988c1['next'](_0x4c7914));}catch(_0x499b14){_0x440d2d(_0x499b14);}}function _0x926ab3(_0x380d6d){try{_0x4265ff(_0x5988c1['throw'](_0x380d6d));}catch(_0x4ac3b2){_0x440d2d(_0x4ac3b2);}}function _0x4265ff(_0x2a37a1){_0x2a37a1['done']?_0xe0a3d9(_0x2a37a1['value']):_0x3181fe(_0x2a37a1['value'])['then'](_0x47691f,_0x926ab3);}_0x4265ff((_0x5988c1=_0x5988c1['apply'](_0x485e15,_0x4d846f||[]))['next']());});};class Fetch{constructor(_0x200110){this['baseUri']=_0x200110,this['getUrl']=_0x1657d=>{return _0x1657d['startsWith']('/')&&(_0x1657d=_0x1657d['replace']('/','')),''+this['baseUri']+_0x1657d;},!_0x200110['endsWith']('/')&&(_0x200110=_0x200110+'/');}['get'](_0xd1f7ae,_0x52b6df){return __awaiter$2(this,void 0,void 0,function*(){const _0x3a9653=this['getUrl'](_0xd1f7ae);return yield fetch(_0x3a9653,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x52b6df}});});}['post'](_0x210b2c,_0x27499,_0x495b67){return __awaiter$2(this,void 0,void 0,function*(){const _0x16ce87=this['getUrl'](_0x210b2c);return yield fetch(_0x16ce87,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x27499},'body':_0x495b67?JSON['stringify'](_0x495b67):null});});}['PostNoAuth'](_0x50662f,_0x634c48){return __awaiter$2(this,void 0,void 0,function*(){const _0x26d125=this['getUrl'](_0x50662f);return yield fetch(_0x26d125,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x634c48?JSON['stringify'](_0x634c48):null});});}['put'](_0x289568,_0x432a2c,_0x697b90){return __awaiter$2(this,void 0,void 0,function*(){const _0x391ea0=this['getUrl'](_0x289568);return yield fetch(_0x391ea0,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x432a2c},'body':_0x697b90?JSON['stringify'](_0x697b90):null});});}['delete'](_0x479c9c,_0x4d9ecc){return __awaiter$2(this,void 0,void 0,function*(){const _0x3344f1=this['getUrl'](_0x479c9c);return yield fetch(_0x3344f1,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4d9ecc}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x5eee53,_0x57febb,_0x14bcab,_0x19f527){function _0x2ab506(_0x329259){return _0x329259 instanceof _0x14bcab?_0x329259:new _0x14bcab(function(_0x13bf3b){_0x13bf3b(_0x329259);});}return new(_0x14bcab||(_0x14bcab=Promise))(function(_0x464ad7,_0x1521f7){function _0x411a8a(_0x12d9d6){try{_0x223642(_0x19f527['next'](_0x12d9d6));}catch(_0x5ccfcf){_0x1521f7(_0x5ccfcf);}}function _0x3cd6c4(_0x2234bf){try{_0x223642(_0x19f527['throw'](_0x2234bf));}catch(_0x3256f2){_0x1521f7(_0x3256f2);}}function _0x223642(_0x5e4084){_0x5e4084['done']?_0x464ad7(_0x5e4084['value']):_0x2ab506(_0x5e4084['value'])['then'](_0x411a8a,_0x3cd6c4);}_0x223642((_0x19f527=_0x19f527['apply'](_0x5eee53,_0x57febb||[]))['next']());});};class SearchServersService{constructor(_0x538bf9){this['fetch']=_0x538bf9,this['path']='search-services';}['create'](_0x2ba2bc,_0x280a5d,_0x4c7794,_0x4e73fe,_0x5b773b,_0x20ce6b,_0x3440e1,_0x251d7b){return __awaiter$1(this,void 0,void 0,function*(){const _0x21ccaa={'account_name':_0x2ba2bc,'search_service_name':_0x280a5d,'endpoint':_0x4c7794,'key':_0x4e73fe,'country':_0x5b773b,'provider':_0x20ce6b,'index_name':_0x3440e1};try{const _0x33cea1=yield this['fetch']['post'](this['path'],_0x251d7b,_0x21ccaa);if(_0x33cea1['status']>0xc7&&_0x33cea1['status']<0x12c){const _0x3b7fe6=yield _0x33cea1['json']();return new SuccessfulSearchServiceResponse(_0x3b7fe6);}const _0x2489f4=yield _0x33cea1['json']();return new FailedSearchServiceResponse(_0x2489f4);}catch(_0x296317){if(_0x296317 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x296317['message'],'title':_0x296317['name'],'status':0x1f4,'instance':'','type':''});throw _0x296317;}});}['delete'](_0xccb049,_0x56ef84,_0x13ae1b){return __awaiter$1(this,void 0,void 0,function*(){const _0x1e695d=this['path']+'/'+_0xccb049+'/'+_0x56ef84;try{const _0x3f24f2=yield this['fetch']['delete'](_0x1e695d,_0x13ae1b);if(_0x3f24f2['status']>0xc7&&_0x3f24f2['status']<0x12c)return new SuccessfulResponse({});const _0x12e3fd=yield _0x3f24f2['json']();return new FailedResponse(_0x12e3fd);}catch(_0xa95a58){if(_0xa95a58 instanceof Error)return new FailedResponse({'detail':_0xa95a58['message'],'title':_0xa95a58['name'],'status':0x1f4,'instance':'','type':''});throw _0xa95a58;}});}['view'](_0x205016,_0x797d5e,_0x52f09d){return __awaiter$1(this,void 0,void 0,function*(){const _0x1d0ecd=this['path']+'/'+_0x205016+'/'+_0x797d5e;try{const _0x49fc5e=yield this['fetch']['get'](_0x1d0ecd,_0x52f09d);if(_0x49fc5e['status']>0xc7&&_0x49fc5e['status']<0x12c){const _0x2ddd76=yield _0x49fc5e['json']();return new SuccessfulViewSearchServiceResponse(_0x2ddd76);}const _0x3d1447=yield _0x49fc5e['json']();return new FailedViewSearchServiceResponse(_0x3d1447);}catch(_0x3e6385){if(_0x3e6385 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x3e6385['message'],'title':_0x3e6385['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e6385;}});}['edit'](_0x505c8c,_0x2ec87d,_0x443442,_0x34e8d4,_0x5d0b72,_0x11fe77){return __awaiter$1(this,void 0,void 0,function*(){const _0x5c7d2d={'account_name':_0x505c8c,'search_service_name':_0x2ec87d,'new_search_service_name':_0x443442,'key':_0x34e8d4,'country':_0x5d0b72};try{const _0x546a32=yield this['fetch']['put'](this['path'],_0x11fe77,_0x5c7d2d);if(_0x546a32['status']>0xc7&&_0x546a32['status']<0x12c){const _0x55fbd1=yield _0x546a32['json']();return new SuccessfulSearchServiceResponse(_0x55fbd1);}const _0x6e2fde=yield _0x546a32['json']();return new FailedSearchServiceResponse(_0x6e2fde);}catch(_0x45ea38){if(_0x45ea38 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x45ea38['message'],'title':_0x45ea38['name'],'status':0x1f4,'instance':'','type':''});throw _0x45ea38;}});}['list'](_0xc763c7,_0x284217){return __awaiter$1(this,void 0,void 0,function*(){const _0x35e64b=this['path']+'/'+_0xc763c7;try{const _0xde75d9=yield this['fetch']['get'](_0x35e64b,_0x284217);if(_0xde75d9['status']>0xc7&&_0xde75d9['status']<0x12c){const _0x460e40=yield _0xde75d9['json']();return new SuccessfulListSearchServiceResponse(_0x460e40);}const _0x3a57b6=yield _0xde75d9['json']();return new FailedViewSearchServicesResponse(_0x3a57b6);}catch(_0x24ba36){if(_0x24ba36 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x24ba36['message'],'title':_0x24ba36['name'],'status':0x1f4,'instance':'','type':''});throw _0x24ba36;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3fdf6d,_0x2ffce7,_0x1e77ce,_0x35d240){function _0x24a564(_0x122449){return _0x122449 instanceof _0x1e77ce?_0x122449:new _0x1e77ce(function(_0x5a6b3e){_0x5a6b3e(_0x122449);});}return new(_0x1e77ce||(_0x1e77ce=Promise))(function(_0x48a18c,_0x165b98){function _0x109ecd(_0x311008){try{_0xfaaeef(_0x35d240['next'](_0x311008));}catch(_0x30d2c0){_0x165b98(_0x30d2c0);}}function _0x4345ed(_0x3dcf96){try{_0xfaaeef(_0x35d240['throw'](_0x3dcf96));}catch(_0x110ca1){_0x165b98(_0x110ca1);}}function _0xfaaeef(_0x1a9ebc){_0x1a9ebc['done']?_0x48a18c(_0x1a9ebc['value']):_0x24a564(_0x1a9ebc['value'])['then'](_0x109ecd,_0x4345ed);}_0xfaaeef((_0x35d240=_0x35d240['apply'](_0x3fdf6d,_0x2ffce7||[]))['next']());});};class AdminClient{constructor(_0x1db34c='https://admin.searchability.dev/'){var _0x2c335e=new Fetch(_0x1db34c);this['Accounts']=new AccountService(_0x2c335e),this['Lists']=new ListService(_0x2c335e),this['ApiKeys']=new ApiKeyService(_0x2c335e),this['SearchServices']=new SearchServersService(_0x2c335e);}}class AuthClient{constructor(_0x503a67='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x503a67);}['login'](_0x29126f){return __awaiter(this,void 0,void 0,function*(){const _0xa65bc0='login/'+_0x29126f;try{const _0x55b09f=yield yield fetch(_0xa65bc0);if(_0x55b09f['status']>0xc7&&_0x55b09f['status']<0x12c){const _0x39da80=yield _0x55b09f['json']();return new SuccessfulAuthResponse(_0x39da80);}const _0x2afdea=yield _0x55b09f['json']();return new FailedAuthResponse(_0x2afdea);}catch(_0x247cbf){if(_0x247cbf instanceof Error)return new FailedAuthResponse({'detail':_0x247cbf['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x247cbf;}});}['refresh'](_0x5719d9){return __awaiter(this,void 0,void 0,function*(){const _0xbc53e9='refresh',_0x3a3bb9={'refresh_token':_0x5719d9};try{const _0x2d1afb=yield this['fetch']['PostNoAuth'](_0xbc53e9,_0x3a3bb9);if(_0x2d1afb['status']>0xc7&&_0x2d1afb['status']<0x12c){const _0x3d6353=yield _0x2d1afb['json']();return new SuccessfulAuthResponse(_0x3d6353);}const _0xe9795d=yield _0x2d1afb['json']();return new FailedAuthResponse(_0xe9795d);}catch(_0x22062f){if(_0x22062f instanceof Error)return new FailedAuthResponse({'detail':_0x22062f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x22062f;}});}['getTokenStatus'](_0x1f4b7e){if(Date['now']()<_0x1f4b7e['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x1f4b7e['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(_0x3ca3d8){_0x3ca3d8[_0x3ca3d8['Ok']=0x0]='Ok',_0x3ca3d8[_0x3ca3d8['Refresh']=0x1]='Refresh',_0x3ca3d8[_0x3ca3d8['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(_0x5da09e){this['isSuccess']=_0x5da09e;}}class SuccessfulAccountResponse extends Response{constructor(_0x1faf8a){super(!![]),this['account']=_0x1faf8a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4fad76){super(![]),this['problem']=_0x4fad76;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x300d35){super(!![]),this['tokens']=_0x300d35;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x4df11d){super(![]),this['problem']=_0x4df11d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x49ee5d){super(!![]),this['apiKey']=_0x49ee5d;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1e8cee){super(![]),this['problem']=_0x1e8cee;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x3da5f9){super(!![]),this['searchService']=_0x3da5f9;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x5e0803){super(![]),this['problem']=_0x5e0803;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x3d3a20){super(!![]),this['searchService']=_0x3d3a20;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x28e207){super(!![]),this['searchServices']=_0x28e207;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x2e9e45){super(![]),this['problem']=_0x2e9e45;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x4fca23){super(![]),this['problem']=_0x4fca23;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x456c28){super(!![]),this['apiKeyValue']=_0x456c28;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x142653){super(!![]),this['obj']=_0x142653;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x5c341c){super(![]),this['problem']=_0x5c341c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x25fa93){super(![]),this['problem']=_0x25fa93;}['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(_0x3d2636,_0x3d665e,_0x30a646,_0x1235dc){function _0x3c9e42(_0x14a9b0){return _0x14a9b0 instanceof _0x30a646?_0x14a9b0:new _0x30a646(function(_0x5624a1){_0x5624a1(_0x14a9b0);});}return new(_0x30a646||(_0x30a646=Promise))(function(_0x5767d0,_0x1531f8){function _0x579666(_0x463f87){try{_0x346172(_0x1235dc['next'](_0x463f87));}catch(_0x229b25){_0x1531f8(_0x229b25);}}function _0xff6509(_0x35ff3a){try{_0x346172(_0x1235dc['throw'](_0x35ff3a));}catch(_0x2fe1e8){_0x1531f8(_0x2fe1e8);}}function _0x346172(_0x1515f3){_0x1515f3['done']?_0x5767d0(_0x1515f3['value']):_0x3c9e42(_0x1515f3['value'])['then'](_0x579666,_0xff6509);}_0x346172((_0x1235dc=_0x1235dc['apply'](_0x3d2636,_0x3d665e||[]))['next']());});};class AccountService{constructor(_0x5b9987){this['fetch']=_0x5b9987;}['get'](_0x843b5f,_0x550527){return __awaiter$5(this,void 0,void 0,function*(){const _0x2c29d9='Account/'+_0x843b5f+'/',_0x1b5d96=yield this['fetch']['get'](_0x2c29d9,_0x550527);try{if(_0x1b5d96['status']>0xc7&&_0x1b5d96['status']<0x12c){const _0x2d1af2=yield _0x1b5d96['json']();return new SuccessfulAccountResponse(_0x2d1af2);}const _0x3d5e56=yield _0x1b5d96['json']();return new FailedAccountResponse(_0x3d5e56);}catch(_0x20526a){if(_0x20526a instanceof Error)return new FailedAccountResponse({'detail':_0x20526a['message'],'title':_0x20526a['name'],'status':0x1f4,'instance':'','type':''});throw _0x20526a;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x3588bf,_0x54eab0,_0x5583d1,_0x4b6131){function _0x43094d(_0x4281aa){return _0x4281aa instanceof _0x5583d1?_0x4281aa:new _0x5583d1(function(_0x1d0d38){_0x1d0d38(_0x4281aa);});}return new(_0x5583d1||(_0x5583d1=Promise))(function(_0x12ae3c,_0x3f07fa){function _0x117d1c(_0x4ff60d){try{_0x58b2bf(_0x4b6131['next'](_0x4ff60d));}catch(_0x4d251b){_0x3f07fa(_0x4d251b);}}function _0x40f96d(_0x16e18f){try{_0x58b2bf(_0x4b6131['throw'](_0x16e18f));}catch(_0x4f3cb7){_0x3f07fa(_0x4f3cb7);}}function _0x58b2bf(_0x2dbefe){_0x2dbefe['done']?_0x12ae3c(_0x2dbefe['value']):_0x43094d(_0x2dbefe['value'])['then'](_0x117d1c,_0x40f96d);}_0x58b2bf((_0x4b6131=_0x4b6131['apply'](_0x3588bf,_0x54eab0||[]))['next']());});};class ApiKeyService{constructor(_0x1c21a0){this['fetch']=_0x1c21a0,this['path']='api-key';}['create'](_0x145c77,_0x5c5c8b,_0x44ccfd){return __awaiter$4(this,void 0,void 0,function*(){const _0x3eea59={'account_name':_0x145c77,'api_key_name':_0x5c5c8b};try{const _0x25bc05=yield this['fetch']['post'](this['path'],_0x44ccfd,_0x3eea59);if(_0x25bc05['status']>0xc7&&_0x25bc05['status']<0x12c){const _0xf657ad=yield _0x25bc05['json']();return new SuccessfulApiKeyResponse(_0xf657ad);}const _0xfc576=yield _0x25bc05['json']();return new FailedApiKeyResponse(_0xfc576);}catch(_0xfc8686){if(_0xfc8686 instanceof Error)return new FailedApiKeyResponse({'detail':_0xfc8686['message'],'title':_0xfc8686['name'],'status':0x1f4,'instance':'','type':''});throw _0xfc8686;}});}['view'](_0x16f59b,_0x14dc4d,_0x14df13){return __awaiter$4(this,void 0,void 0,function*(){const _0x40f0ce=this['path']+'/'+_0x16f59b+'/'+_0x14dc4d;try{const _0x458235=yield this['fetch']['get'](_0x40f0ce,_0x14df13);if(_0x458235['status']>0xc7&&_0x458235['status']<0x12c){const _0x25ff4f=yield _0x458235['json']();return new SuccessfulApiKeyValueResponse(_0x25ff4f);}const _0x3830cd=yield _0x458235['json']();return new FailedApiKeyValueResponse(_0x3830cd);}catch(_0x3e1d8f){if(_0x3e1d8f instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x3e1d8f['message'],'title':_0x3e1d8f['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e1d8f;}});}['delete'](_0x8ceb67,_0x14541c,_0xfa65ae){return __awaiter$4(this,void 0,void 0,function*(){const _0x52dbb2=this['path']+'/'+_0x8ceb67+'/'+_0x14541c;try{const _0x153ebf=yield this['fetch']['delete'](_0x52dbb2,_0xfa65ae);if(_0x153ebf['status']>0xc7&&_0x153ebf['status']<0x12c)return new SuccessfulResponse({});const _0x481078=yield _0x153ebf['json']();return new FailedResponse(_0x481078);}catch(_0x404286){if(_0x404286 instanceof Error)return new FailedResponse({'detail':_0x404286['message'],'title':_0x404286['name'],'status':0x1f4,'instance':'','type':''});throw _0x404286;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x15269d,_0x4e0605,_0x518f46,_0x1ab909){function _0xc3dbaf(_0x38ecb9){return _0x38ecb9 instanceof _0x518f46?_0x38ecb9:new _0x518f46(function(_0x1d58a7){_0x1d58a7(_0x38ecb9);});}return new(_0x518f46||(_0x518f46=Promise))(function(_0x8ee975,_0x206007){function _0x5019d8(_0x534d8c){try{_0x186252(_0x1ab909['next'](_0x534d8c));}catch(_0x1012b3){_0x206007(_0x1012b3);}}function _0x5f1b06(_0x38a1de){try{_0x186252(_0x1ab909['throw'](_0x38a1de));}catch(_0x12e4ca){_0x206007(_0x12e4ca);}}function _0x186252(_0x20e4b4){_0x20e4b4['done']?_0x8ee975(_0x20e4b4['value']):_0xc3dbaf(_0x20e4b4['value'])['then'](_0x5019d8,_0x5f1b06);}_0x186252((_0x1ab909=_0x1ab909['apply'](_0x15269d,_0x4e0605||[]))['next']());});};class ListService{constructor(_0x19c1a6){this['fetch']=_0x19c1a6;}['add'](_0x881e23,_0x32ff5c,_0x4c65d1){return __awaiter$3(this,void 0,void 0,function*(){const _0x1a5910='List',_0x31adf1={'account_name':_0x881e23,'list_name':_0x32ff5c};try{const _0x296120=yield this['fetch']['post'](_0x1a5910,_0x4c65d1,_0x31adf1);if(_0x296120['status']>0xc7&&_0x296120['status']<0x12c){const _0x7c3367=yield _0x296120['json']();return new SuccessfulAccountResponse(_0x7c3367);}const _0x13a657=yield _0x296120['json']();return new FailedAccountResponse(_0x13a657);}catch(_0x41801c){if(_0x41801c instanceof Error)return new FailedAccountResponse({'detail':_0x41801c['message'],'title':_0x41801c['name'],'status':0x1f4,'instance':'','type':''});throw _0x41801c;}});}['remove'](_0x1e036f,_0x1e137b,_0x78f8c3){return __awaiter$3(this,void 0,void 0,function*(){const _0x3263e1='List/'+_0x1e036f+'/'+_0x1e137b,_0x5b9571=yield this['fetch']['delete'](_0x3263e1,_0x78f8c3);try{if(_0x5b9571['status']>0xc7&&_0x5b9571['status']<0x12c){const _0x43f540=yield _0x5b9571['json']();return new SuccessfulAccountResponse(_0x43f540);}const _0x954ac4=yield _0x5b9571['json']();return new FailedAccountResponse(_0x954ac4);}catch(_0x8d6fda){if(_0x8d6fda instanceof Error)return new FailedAccountResponse({'detail':_0x8d6fda['message'],'title':_0x8d6fda['name'],'status':0x1f4,'instance':'','type':''});throw _0x8d6fda;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x287ea1,_0x22f4f7,_0x4ab314,_0x20646b){function _0x10b576(_0x15d4f5){return _0x15d4f5 instanceof _0x4ab314?_0x15d4f5:new _0x4ab314(function(_0x5ace29){_0x5ace29(_0x15d4f5);});}return new(_0x4ab314||(_0x4ab314=Promise))(function(_0x27429a,_0x55e190){function _0x34dd82(_0x171ca3){try{_0x4be613(_0x20646b['next'](_0x171ca3));}catch(_0x357c4d){_0x55e190(_0x357c4d);}}function _0x328a6a(_0x3b1c94){try{_0x4be613(_0x20646b['throw'](_0x3b1c94));}catch(_0x2f3aae){_0x55e190(_0x2f3aae);}}function _0x4be613(_0x38cc45){_0x38cc45['done']?_0x27429a(_0x38cc45['value']):_0x10b576(_0x38cc45['value'])['then'](_0x34dd82,_0x328a6a);}_0x4be613((_0x20646b=_0x20646b['apply'](_0x287ea1,_0x22f4f7||[]))['next']());});};class Fetch{constructor(_0x4a3a8b){this['baseUri']=_0x4a3a8b,this['getUrl']=_0x58d82c=>{return _0x58d82c['startsWith']('/')&&(_0x58d82c=_0x58d82c['replace']('/','')),''+this['baseUri']+_0x58d82c;},!_0x4a3a8b['endsWith']('/')&&(_0x4a3a8b=_0x4a3a8b+'/');}['get'](_0x41c556,_0x27cc30){return __awaiter$2(this,void 0,void 0,function*(){const _0x339669=this['getUrl'](_0x41c556);return yield fetch(_0x339669,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x27cc30}});});}['post'](_0x2f7bcb,_0x52cbc3,_0x282ff2){return __awaiter$2(this,void 0,void 0,function*(){const _0x66d57b=this['getUrl'](_0x2f7bcb);return yield fetch(_0x66d57b,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x52cbc3},'body':_0x282ff2?JSON['stringify'](_0x282ff2):null});});}['PostNoAuth'](_0x2c0186,_0x24e212){return __awaiter$2(this,void 0,void 0,function*(){const _0x54c455=this['getUrl'](_0x2c0186);return yield fetch(_0x54c455,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x24e212?JSON['stringify'](_0x24e212):null});});}['put'](_0x499c0d,_0x157869,_0x21bb67){return __awaiter$2(this,void 0,void 0,function*(){const _0x1d22ff=this['getUrl'](_0x499c0d);return yield fetch(_0x1d22ff,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x157869},'body':_0x21bb67?JSON['stringify'](_0x21bb67):null});});}['delete'](_0x5a5ba9,_0x5643e2){return __awaiter$2(this,void 0,void 0,function*(){const _0x23935f=this['getUrl'](_0x5a5ba9);return yield fetch(_0x23935f,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5643e2}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x88a8b3,_0x1ee6f1,_0x201edb,_0xec5cc1){function _0x2d1f49(_0x4f22ea){return _0x4f22ea instanceof _0x201edb?_0x4f22ea:new _0x201edb(function(_0x349955){_0x349955(_0x4f22ea);});}return new(_0x201edb||(_0x201edb=Promise))(function(_0x4c3813,_0x28e9c6){function _0x34cc2e(_0xf574ca){try{_0x524469(_0xec5cc1['next'](_0xf574ca));}catch(_0x54e13){_0x28e9c6(_0x54e13);}}function _0x52e901(_0x877d96){try{_0x524469(_0xec5cc1['throw'](_0x877d96));}catch(_0x3e2268){_0x28e9c6(_0x3e2268);}}function _0x524469(_0x58c601){_0x58c601['done']?_0x4c3813(_0x58c601['value']):_0x2d1f49(_0x58c601['value'])['then'](_0x34cc2e,_0x52e901);}_0x524469((_0xec5cc1=_0xec5cc1['apply'](_0x88a8b3,_0x1ee6f1||[]))['next']());});};class SearchServersService{constructor(_0x150c0a){this['fetch']=_0x150c0a,this['path']='search-services';}['create'](_0xe1ff16,_0x2d1f93,_0x474092,_0x4fcdd1,_0x12c1fd,_0x39fdfa,_0x59fd56,_0x9e1f40){return __awaiter$1(this,void 0,void 0,function*(){const _0x56f197={'account_name':_0xe1ff16,'search_service_name':_0x2d1f93,'endpoint':_0x474092,'key':_0x4fcdd1,'country':_0x12c1fd,'provider':_0x39fdfa,'index_name':_0x59fd56};try{const _0x243a36=yield this['fetch']['post'](this['path'],_0x9e1f40,_0x56f197);if(_0x243a36['status']>0xc7&&_0x243a36['status']<0x12c){const _0x5c9e27=yield _0x243a36['json']();return new SuccessfulSearchServiceResponse(_0x5c9e27);}const _0x5cd2ff=yield _0x243a36['json']();return new FailedSearchServiceResponse(_0x5cd2ff);}catch(_0x502555){if(_0x502555 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x502555['message'],'title':_0x502555['name'],'status':0x1f4,'instance':'','type':''});throw _0x502555;}});}['delete'](_0x313778,_0x409f2b,_0x40c8e9){return __awaiter$1(this,void 0,void 0,function*(){const _0x1a3594=this['path']+'/'+_0x313778+'/'+_0x409f2b;try{const _0x56518b=yield this['fetch']['delete'](_0x1a3594,_0x40c8e9);if(_0x56518b['status']>0xc7&&_0x56518b['status']<0x12c)return new SuccessfulResponse({});const _0x12281e=yield _0x56518b['json']();return new FailedResponse(_0x12281e);}catch(_0x4688f6){if(_0x4688f6 instanceof Error)return new FailedResponse({'detail':_0x4688f6['message'],'title':_0x4688f6['name'],'status':0x1f4,'instance':'','type':''});throw _0x4688f6;}});}['view'](_0x1a4bba,_0x3fa794,_0x4b628f){return __awaiter$1(this,void 0,void 0,function*(){const _0x513cb2=this['path']+'/'+_0x1a4bba+'/'+_0x3fa794;try{const _0x1281ad=yield this['fetch']['get'](_0x513cb2,_0x4b628f);if(_0x1281ad['status']>0xc7&&_0x1281ad['status']<0x12c){const _0x3329fc=yield _0x1281ad['json']();return new SuccessfulViewSearchServiceResponse(_0x3329fc);}const _0x59f0bb=yield _0x1281ad['json']();return new FailedViewSearchServiceResponse(_0x59f0bb);}catch(_0x32f0c1){if(_0x32f0c1 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x32f0c1['message'],'title':_0x32f0c1['name'],'status':0x1f4,'instance':'','type':''});throw _0x32f0c1;}});}['edit'](_0x3d6df0,_0x302c51,_0x388b06,_0x19e047,_0xb01441,_0x25b644){return __awaiter$1(this,void 0,void 0,function*(){const _0x3d0e41={'account_name':_0x3d6df0,'search_service_name':_0x302c51,'new_search_service_name':_0x388b06,'key':_0x19e047,'country':_0xb01441};try{const _0x32979d=yield this['fetch']['put'](this['path'],_0x25b644,_0x3d0e41);if(_0x32979d['status']>0xc7&&_0x32979d['status']<0x12c){const _0xcc45fd=yield _0x32979d['json']();return new SuccessfulSearchServiceResponse(_0xcc45fd);}const _0x2e6e13=yield _0x32979d['json']();return new FailedSearchServiceResponse(_0x2e6e13);}catch(_0x25ab16){if(_0x25ab16 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x25ab16['message'],'title':_0x25ab16['name'],'status':0x1f4,'instance':'','type':''});throw _0x25ab16;}});}['list'](_0x290fcd,_0x3e7794){return __awaiter$1(this,void 0,void 0,function*(){const _0x31b8ee=this['path']+'/'+_0x290fcd;try{const _0x43daa3=yield this['fetch']['get'](_0x31b8ee,_0x3e7794);if(_0x43daa3['status']>0xc7&&_0x43daa3['status']<0x12c){const _0x39db7e=yield _0x43daa3['json']();return new SuccessfulListSearchServiceResponse(_0x39db7e);}const _0x549600=yield _0x43daa3['json']();return new FailedViewSearchServicesResponse(_0x549600);}catch(_0x17c6d7){if(_0x17c6d7 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x17c6d7['message'],'title':_0x17c6d7['name'],'status':0x1f4,'instance':'','type':''});throw _0x17c6d7;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x55bf9b,_0x1eae90,_0x54c82c,_0x475d01){function _0xa08686(_0x368b6b){return _0x368b6b instanceof _0x54c82c?_0x368b6b:new _0x54c82c(function(_0x5edd10){_0x5edd10(_0x368b6b);});}return new(_0x54c82c||(_0x54c82c=Promise))(function(_0x1a67d4,_0x6e3a1a){function _0x4e2d3a(_0x3c112f){try{_0x5d03db(_0x475d01['next'](_0x3c112f));}catch(_0x8982ac){_0x6e3a1a(_0x8982ac);}}function _0x34cd2b(_0x598e27){try{_0x5d03db(_0x475d01['throw'](_0x598e27));}catch(_0x25c2ce){_0x6e3a1a(_0x25c2ce);}}function _0x5d03db(_0x4cf0ca){_0x4cf0ca['done']?_0x1a67d4(_0x4cf0ca['value']):_0xa08686(_0x4cf0ca['value'])['then'](_0x4e2d3a,_0x34cd2b);}_0x5d03db((_0x475d01=_0x475d01['apply'](_0x55bf9b,_0x1eae90||[]))['next']());});};class AdminClient{constructor(_0x4309a3='https://admin.searchability.dev/'){var _0x1883b4=new Fetch(_0x4309a3);this['Accounts']=new AccountService(_0x1883b4),this['Lists']=new ListService(_0x1883b4),this['ApiKeys']=new ApiKeyService(_0x1883b4),this['SearchServices']=new SearchServersService(_0x1883b4);}}class AuthClient{constructor(_0x100df9='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x100df9);}['login'](_0x356a45){return __awaiter(this,void 0,void 0,function*(){const _0x5a9483='login/'+_0x356a45;try{const _0x5c5755=yield yield fetch(_0x5a9483);if(_0x5c5755['status']>0xc7&&_0x5c5755['status']<0x12c){const _0x20bd91=yield _0x5c5755['json']();return new SuccessfulAuthResponse(_0x20bd91);}const _0x1e25b7=yield _0x5c5755['json']();return new FailedAuthResponse(_0x1e25b7);}catch(_0x43b8ba){if(_0x43b8ba instanceof Error)return new FailedAuthResponse({'detail':_0x43b8ba['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x43b8ba;}});}['refresh'](_0x58991c){return __awaiter(this,void 0,void 0,function*(){const _0x543cda='refresh',_0x1c9f1f={'refresh_token':_0x58991c};try{const _0x3d53e5=yield this['fetch']['PostNoAuth'](_0x543cda,_0x1c9f1f);if(_0x3d53e5['status']>0xc7&&_0x3d53e5['status']<0x12c){const _0x3f2a35=yield _0x3d53e5['json']();return new SuccessfulAuthResponse(_0x3f2a35);}const _0x562454=yield _0x3d53e5['json']();return new FailedAuthResponse(_0x562454);}catch(_0x5f3768){if(_0x5f3768 instanceof Error)return new FailedAuthResponse({'detail':_0x5f3768['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5f3768;}});}['getTokenStatus'](_0x3f83fc){if(Date['now']()<_0x3f83fc['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3f83fc['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ declare class SearchServersService {
|
|
|
39
39
|
delete(account_name: string, search_service_name: string, access_token: string): Promise<Response<any, Problem>>;
|
|
40
40
|
view(account_name: string, search_service_name: string, access_token: string): Promise<Response<SearchServiceDetails, Problem>>;
|
|
41
41
|
edit(account_name: string, search_service_name: string, new_search_service_name: string, key: string, country: string, access_token: string): Promise<Response<SearchService, Problem>>;
|
|
42
|
+
list(account_name: string, access_token: string): Promise<Response<SearchService[], Problem>>;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
declare class AdminClient {
|
|
@@ -102,6 +103,7 @@ type SearchServiceDetails = {
|
|
|
102
103
|
key: string;
|
|
103
104
|
search_service_name: string;
|
|
104
105
|
country: string;
|
|
106
|
+
index_name: string;
|
|
105
107
|
};
|
|
106
108
|
type ApiKeyValue = {
|
|
107
109
|
value: string;
|
|
@@ -181,6 +183,18 @@ declare class SuccessfulViewSearchServiceResponse extends Response<SearchService
|
|
|
181
183
|
toSuccess(): SearchServiceDetails;
|
|
182
184
|
toProblem(): Problem;
|
|
183
185
|
}
|
|
186
|
+
declare class SuccessfulListSearchServiceResponse extends Response<SearchService[], Problem> {
|
|
187
|
+
readonly searchServices: SearchService[];
|
|
188
|
+
constructor(searchServices: SearchService[]);
|
|
189
|
+
toSuccess(): SearchService[];
|
|
190
|
+
toProblem(): Problem;
|
|
191
|
+
}
|
|
192
|
+
declare class FailedViewSearchServicesResponse extends Response<SearchService[], Problem> {
|
|
193
|
+
readonly problem: Problem;
|
|
194
|
+
constructor(problem: Problem);
|
|
195
|
+
toSuccess(): SearchService[];
|
|
196
|
+
toProblem(): Problem;
|
|
197
|
+
}
|
|
184
198
|
declare class FailedViewSearchServiceResponse extends Response<SearchServiceDetails, Problem> {
|
|
185
199
|
readonly problem: Problem;
|
|
186
200
|
constructor(problem: Problem);
|
|
@@ -212,4 +226,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
212
226
|
toProblem(): Problem;
|
|
213
227
|
}
|
|
214
228
|
|
|
215
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
|
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 };
|
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 };
|