@searchability/admin-client 0.0.45 → 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 {
|
|
@@ -182,6 +183,18 @@ declare class SuccessfulViewSearchServiceResponse extends Response<SearchService
|
|
|
182
183
|
toSuccess(): SearchServiceDetails;
|
|
183
184
|
toProblem(): Problem;
|
|
184
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
|
+
}
|
|
185
198
|
declare class FailedViewSearchServiceResponse extends Response<SearchServiceDetails, Problem> {
|
|
186
199
|
readonly problem: Problem;
|
|
187
200
|
constructor(problem: Problem);
|
|
@@ -213,4 +226,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
213
226
|
toProblem(): Problem;
|
|
214
227
|
}
|
|
215
228
|
|
|
216
|
-
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(_0x4ec4ba){_0x4ec4ba[_0x4ec4ba['Ok']=0x0]='Ok',_0x4ec4ba[_0x4ec4ba['Refresh']=0x1]='Refresh',_0x4ec4ba[_0x4ec4ba['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x37dafa){this['isSuccess']=_0x37dafa;}}class SuccessfulAccountResponse extends Response{constructor(_0xbc8947){super(!![]),this['account']=_0xbc8947;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x5eba44){super(![]),this['problem']=_0x5eba44;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x1b8022){super(!![]),this['tokens']=_0x1b8022;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x5a30f6){super(![]),this['problem']=_0x5a30f6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x507e03){super(!![]),this['apiKey']=_0x507e03;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1707f7){super(![]),this['problem']=_0x1707f7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x2c56e7){super(!![]),this['searchService']=_0x2c56e7;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x2b47a1){super(![]),this['problem']=_0x2b47a1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x2995bd){super(!![]),this['searchService']=_0x2995bd;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServiceResponse extends Response{constructor(_0x3fa529){super(![]),this['problem']=_0x3fa529;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x3c1078){super(!![]),this['apiKeyValue']=_0x3c1078;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x12df5f){super(!![]),this['obj']=_0x12df5f;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x534eb8){super(![]),this['problem']=_0x534eb8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x4cbf23){super(![]),this['problem']=_0x4cbf23;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x4e4281,_0x108147,_0x591cb8,_0x1ed4c6){function _0x4435c2(_0x1e97c1){return _0x1e97c1 instanceof _0x591cb8?_0x1e97c1:new _0x591cb8(function(_0x12b835){_0x12b835(_0x1e97c1);});}return new(_0x591cb8||(_0x591cb8=Promise))(function(_0x49c095,_0x55ba6e){function _0x43a82f(_0x768ac8){try{_0x3329dc(_0x1ed4c6['next'](_0x768ac8));}catch(_0x57f3b6){_0x55ba6e(_0x57f3b6);}}function _0x1f5db0(_0x472991){try{_0x3329dc(_0x1ed4c6['throw'](_0x472991));}catch(_0x28c28d){_0x55ba6e(_0x28c28d);}}function _0x3329dc(_0x5f11ac){_0x5f11ac['done']?_0x49c095(_0x5f11ac['value']):_0x4435c2(_0x5f11ac['value'])['then'](_0x43a82f,_0x1f5db0);}_0x3329dc((_0x1ed4c6=_0x1ed4c6['apply'](_0x4e4281,_0x108147||[]))['next']());});};class AccountService{constructor(_0x29aae1){this['fetch']=_0x29aae1;}['get'](_0x591249,_0x32d7f2){return __awaiter$5(this,void 0,void 0,function*(){const _0x5d06ce='Account/'+_0x591249+'/',_0x2d4c71=yield this['fetch']['get'](_0x5d06ce,_0x32d7f2);try{if(_0x2d4c71['status']>0xc7&&_0x2d4c71['status']<0x12c){const _0x1a999a=yield _0x2d4c71['json']();return new SuccessfulAccountResponse(_0x1a999a);}const _0x1dafff=yield _0x2d4c71['json']();return new FailedAccountResponse(_0x1dafff);}catch(_0x4d46dc){if(_0x4d46dc instanceof Error)return new FailedAccountResponse({'detail':_0x4d46dc['message'],'title':_0x4d46dc['name'],'status':0x1f4,'instance':'','type':''});throw _0x4d46dc;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x43f93e,_0xf83647,_0x5bac0a,_0x2935bd){function _0x7f8fa6(_0x20652f){return _0x20652f instanceof _0x5bac0a?_0x20652f:new _0x5bac0a(function(_0x501ed5){_0x501ed5(_0x20652f);});}return new(_0x5bac0a||(_0x5bac0a=Promise))(function(_0xb5e841,_0xb3636d){function _0x8183ea(_0x5ac475){try{_0x1a03db(_0x2935bd['next'](_0x5ac475));}catch(_0x6b6f00){_0xb3636d(_0x6b6f00);}}function _0x3c202d(_0x3292a7){try{_0x1a03db(_0x2935bd['throw'](_0x3292a7));}catch(_0x22ccec){_0xb3636d(_0x22ccec);}}function _0x1a03db(_0x4db600){_0x4db600['done']?_0xb5e841(_0x4db600['value']):_0x7f8fa6(_0x4db600['value'])['then'](_0x8183ea,_0x3c202d);}_0x1a03db((_0x2935bd=_0x2935bd['apply'](_0x43f93e,_0xf83647||[]))['next']());});};class ApiKeyService{constructor(_0x4d0f1c){this['fetch']=_0x4d0f1c,this['path']='api-key';}['create'](_0x4cc35a,_0x4b1171,_0x498cdc){return __awaiter$4(this,void 0,void 0,function*(){const _0x1feec3={'account_name':_0x4cc35a,'api_key_name':_0x4b1171};try{const _0xc44f62=yield this['fetch']['post'](this['path'],_0x498cdc,_0x1feec3);if(_0xc44f62['status']>0xc7&&_0xc44f62['status']<0x12c){const _0x47fb98=yield _0xc44f62['json']();return new SuccessfulApiKeyResponse(_0x47fb98);}const _0x41873b=yield _0xc44f62['json']();return new FailedApiKeyResponse(_0x41873b);}catch(_0x37b0f8){if(_0x37b0f8 instanceof Error)return new FailedApiKeyResponse({'detail':_0x37b0f8['message'],'title':_0x37b0f8['name'],'status':0x1f4,'instance':'','type':''});throw _0x37b0f8;}});}['view'](_0x59d0c0,_0x4a0c85,_0x1464dc){return __awaiter$4(this,void 0,void 0,function*(){const _0x4646f5=this['path']+'/'+_0x59d0c0+'/'+_0x4a0c85;try{const _0x12cf31=yield this['fetch']['get'](_0x4646f5,_0x1464dc);if(_0x12cf31['status']>0xc7&&_0x12cf31['status']<0x12c){const _0x2c967=yield _0x12cf31['json']();return new SuccessfulApiKeyValueResponse(_0x2c967);}const _0x459047=yield _0x12cf31['json']();return new FailedApiKeyValueResponse(_0x459047);}catch(_0x480b66){if(_0x480b66 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x480b66['message'],'title':_0x480b66['name'],'status':0x1f4,'instance':'','type':''});throw _0x480b66;}});}['delete'](_0x543d49,_0x4a40a6,_0x11f030){return __awaiter$4(this,void 0,void 0,function*(){const _0x3c4e29=this['path']+'/'+_0x543d49+'/'+_0x4a40a6;try{const _0x2282ed=yield this['fetch']['delete'](_0x3c4e29,_0x11f030);if(_0x2282ed['status']>0xc7&&_0x2282ed['status']<0x12c)return new SuccessfulResponse({});const _0x587edd=yield _0x2282ed['json']();return new FailedResponse(_0x587edd);}catch(_0x10838d){if(_0x10838d instanceof Error)return new FailedResponse({'detail':_0x10838d['message'],'title':_0x10838d['name'],'status':0x1f4,'instance':'','type':''});throw _0x10838d;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x46a6b1,_0x5ce3ca,_0x4f26d,_0x3b9d12){function _0x50542e(_0x51d2c4){return _0x51d2c4 instanceof _0x4f26d?_0x51d2c4:new _0x4f26d(function(_0x3e7b66){_0x3e7b66(_0x51d2c4);});}return new(_0x4f26d||(_0x4f26d=Promise))(function(_0x38da43,_0x3c3559){function _0x376960(_0x2c0763){try{_0x5a56b2(_0x3b9d12['next'](_0x2c0763));}catch(_0x2f4260){_0x3c3559(_0x2f4260);}}function _0x1762af(_0x511e73){try{_0x5a56b2(_0x3b9d12['throw'](_0x511e73));}catch(_0x57e277){_0x3c3559(_0x57e277);}}function _0x5a56b2(_0x248b83){_0x248b83['done']?_0x38da43(_0x248b83['value']):_0x50542e(_0x248b83['value'])['then'](_0x376960,_0x1762af);}_0x5a56b2((_0x3b9d12=_0x3b9d12['apply'](_0x46a6b1,_0x5ce3ca||[]))['next']());});};class ListService{constructor(_0x1ef6ee){this['fetch']=_0x1ef6ee;}['add'](_0x2f65b3,_0x5d6a2a,_0xa2c250){return __awaiter$3(this,void 0,void 0,function*(){const _0x1d0683='List',_0x53c18e={'account_name':_0x2f65b3,'list_name':_0x5d6a2a};try{const _0x53a275=yield this['fetch']['post'](_0x1d0683,_0xa2c250,_0x53c18e);if(_0x53a275['status']>0xc7&&_0x53a275['status']<0x12c){const _0x105b8e=yield _0x53a275['json']();return new SuccessfulAccountResponse(_0x105b8e);}const _0x3b4776=yield _0x53a275['json']();return new FailedAccountResponse(_0x3b4776);}catch(_0x4a8a8e){if(_0x4a8a8e instanceof Error)return new FailedAccountResponse({'detail':_0x4a8a8e['message'],'title':_0x4a8a8e['name'],'status':0x1f4,'instance':'','type':''});throw _0x4a8a8e;}});}['remove'](_0x36e250,_0x3b7981,_0x14a8d8){return __awaiter$3(this,void 0,void 0,function*(){const _0x867033='List/'+_0x36e250+'/'+_0x3b7981,_0x22ed48=yield this['fetch']['delete'](_0x867033,_0x14a8d8);try{if(_0x22ed48['status']>0xc7&&_0x22ed48['status']<0x12c){const _0x55e8d2=yield _0x22ed48['json']();return new SuccessfulAccountResponse(_0x55e8d2);}const _0x593b23=yield _0x22ed48['json']();return new FailedAccountResponse(_0x593b23);}catch(_0x1b0a89){if(_0x1b0a89 instanceof Error)return new FailedAccountResponse({'detail':_0x1b0a89['message'],'title':_0x1b0a89['name'],'status':0x1f4,'instance':'','type':''});throw _0x1b0a89;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x69456,_0x83ad99,_0x1f81bf,_0x9d5a02){function _0x363b9f(_0x39dae2){return _0x39dae2 instanceof _0x1f81bf?_0x39dae2:new _0x1f81bf(function(_0x39f2cf){_0x39f2cf(_0x39dae2);});}return new(_0x1f81bf||(_0x1f81bf=Promise))(function(_0xdb3924,_0x4034f9){function _0x5a6592(_0x3ee228){try{_0x44ece4(_0x9d5a02['next'](_0x3ee228));}catch(_0x4a1afa){_0x4034f9(_0x4a1afa);}}function _0x133819(_0x20fa9f){try{_0x44ece4(_0x9d5a02['throw'](_0x20fa9f));}catch(_0x280c3e){_0x4034f9(_0x280c3e);}}function _0x44ece4(_0x275dd5){_0x275dd5['done']?_0xdb3924(_0x275dd5['value']):_0x363b9f(_0x275dd5['value'])['then'](_0x5a6592,_0x133819);}_0x44ece4((_0x9d5a02=_0x9d5a02['apply'](_0x69456,_0x83ad99||[]))['next']());});};class Fetch{constructor(_0x8adccc){this['baseUri']=_0x8adccc,this['getUrl']=_0x4a1ed0=>{return _0x4a1ed0['startsWith']('/')&&(_0x4a1ed0=_0x4a1ed0['replace']('/','')),''+this['baseUri']+_0x4a1ed0;},!_0x8adccc['endsWith']('/')&&(_0x8adccc=_0x8adccc+'/');}['get'](_0x3d4d7b,_0x5c05f9){return __awaiter$2(this,void 0,void 0,function*(){const _0xc7000a=this['getUrl'](_0x3d4d7b);return yield fetch(_0xc7000a,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5c05f9}});});}['post'](_0x454256,_0x34c0c4,_0x113a17){return __awaiter$2(this,void 0,void 0,function*(){const _0x54a5a0=this['getUrl'](_0x454256);return yield fetch(_0x54a5a0,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x34c0c4},'body':_0x113a17?JSON['stringify'](_0x113a17):null});});}['PostNoAuth'](_0x57039d,_0x574f96){return __awaiter$2(this,void 0,void 0,function*(){const _0x345449=this['getUrl'](_0x57039d);return yield fetch(_0x345449,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x574f96?JSON['stringify'](_0x574f96):null});});}['put'](_0x5167dd,_0x43fc21,_0x27e361){return __awaiter$2(this,void 0,void 0,function*(){const _0x5e44fd=this['getUrl'](_0x5167dd);return yield fetch(_0x5e44fd,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x43fc21},'body':_0x27e361?JSON['stringify'](_0x27e361):null});});}['delete'](_0x574390,_0x5d95fd){return __awaiter$2(this,void 0,void 0,function*(){const _0x56fca7=this['getUrl'](_0x574390);return yield fetch(_0x56fca7,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5d95fd}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3194d2,_0x3487ec,_0x53d0a2,_0x371051){function _0x5208b2(_0x5c2d4e){return _0x5c2d4e instanceof _0x53d0a2?_0x5c2d4e:new _0x53d0a2(function(_0x483d0b){_0x483d0b(_0x5c2d4e);});}return new(_0x53d0a2||(_0x53d0a2=Promise))(function(_0x253437,_0x330394){function _0xba7eed(_0x4a545e){try{_0x1e9099(_0x371051['next'](_0x4a545e));}catch(_0x3d8831){_0x330394(_0x3d8831);}}function _0x157d43(_0x5363ad){try{_0x1e9099(_0x371051['throw'](_0x5363ad));}catch(_0x1d0b5a){_0x330394(_0x1d0b5a);}}function _0x1e9099(_0x2d072c){_0x2d072c['done']?_0x253437(_0x2d072c['value']):_0x5208b2(_0x2d072c['value'])['then'](_0xba7eed,_0x157d43);}_0x1e9099((_0x371051=_0x371051['apply'](_0x3194d2,_0x3487ec||[]))['next']());});};class SearchServersService{constructor(_0x31364e){this['fetch']=_0x31364e,this['path']='search-services';}['create'](_0x2165e2,_0x12b0e2,_0xb2ec73,_0x18a380,_0x41adb4,_0x277a36,_0x372ded,_0x462266){return __awaiter$1(this,void 0,void 0,function*(){const _0xf1b1df={'account_name':_0x2165e2,'search_service_name':_0x12b0e2,'endpoint':_0xb2ec73,'key':_0x18a380,'country':_0x41adb4,'provider':_0x277a36,'index_name':_0x372ded};try{const _0x2daa0d=yield this['fetch']['post'](this['path'],_0x462266,_0xf1b1df);if(_0x2daa0d['status']>0xc7&&_0x2daa0d['status']<0x12c){const _0x11d9f7=yield _0x2daa0d['json']();return new SuccessfulSearchServiceResponse(_0x11d9f7);}const _0x200336=yield _0x2daa0d['json']();return new FailedSearchServiceResponse(_0x200336);}catch(_0x423390){if(_0x423390 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x423390['message'],'title':_0x423390['name'],'status':0x1f4,'instance':'','type':''});throw _0x423390;}});}['delete'](_0x26275c,_0x47d1eb,_0x3d029b){return __awaiter$1(this,void 0,void 0,function*(){const _0x551628=this['path']+'/'+_0x26275c+'/'+_0x47d1eb;try{const _0x452596=yield this['fetch']['delete'](_0x551628,_0x3d029b);if(_0x452596['status']>0xc7&&_0x452596['status']<0x12c)return new SuccessfulResponse({});const _0x116e7d=yield _0x452596['json']();return new FailedResponse(_0x116e7d);}catch(_0x44542f){if(_0x44542f instanceof Error)return new FailedResponse({'detail':_0x44542f['message'],'title':_0x44542f['name'],'status':0x1f4,'instance':'','type':''});throw _0x44542f;}});}['view'](_0x46830b,_0xaf9e71,_0x1f8bb5){return __awaiter$1(this,void 0,void 0,function*(){const _0x30f488=this['path']+'/'+_0x46830b+'/'+_0xaf9e71;try{const _0x4ad503=yield this['fetch']['get'](_0x30f488,_0x1f8bb5);if(_0x4ad503['status']>0xc7&&_0x4ad503['status']<0x12c){const _0x42b75c=yield _0x4ad503['json']();return new SuccessfulViewSearchServiceResponse(_0x42b75c);}const _0x5db356=yield _0x4ad503['json']();return new FailedViewSearchServiceResponse(_0x5db356);}catch(_0x45c21d){if(_0x45c21d instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x45c21d['message'],'title':_0x45c21d['name'],'status':0x1f4,'instance':'','type':''});throw _0x45c21d;}});}['edit'](_0x2a3c68,_0x46c3bf,_0x4d1a18,_0x3c9575,_0x27ceca,_0x12c495){return __awaiter$1(this,void 0,void 0,function*(){const _0x137e1b={'account_name':_0x2a3c68,'search_service_name':_0x46c3bf,'new_search_service_name':_0x4d1a18,'key':_0x3c9575,'country':_0x27ceca};try{const _0x5a0a67=yield this['fetch']['put'](this['path'],_0x12c495,_0x137e1b);if(_0x5a0a67['status']>0xc7&&_0x5a0a67['status']<0x12c){const _0x1edcdc=yield _0x5a0a67['json']();return new SuccessfulSearchServiceResponse(_0x1edcdc);}const _0x2cf02d=yield _0x5a0a67['json']();return new FailedSearchServiceResponse(_0x2cf02d);}catch(_0x1332c9){if(_0x1332c9 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1332c9['message'],'title':_0x1332c9['name'],'status':0x1f4,'instance':'','type':''});throw _0x1332c9;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x146256,_0x4f0839,_0x40662c,_0x3df86b){function _0x45286f(_0x1ba613){return _0x1ba613 instanceof _0x40662c?_0x1ba613:new _0x40662c(function(_0x15ec80){_0x15ec80(_0x1ba613);});}return new(_0x40662c||(_0x40662c=Promise))(function(_0x4cc142,_0x5b557c){function _0x15c935(_0x552a65){try{_0x458f83(_0x3df86b['next'](_0x552a65));}catch(_0x38f646){_0x5b557c(_0x38f646);}}function _0x29b984(_0x5db3c1){try{_0x458f83(_0x3df86b['throw'](_0x5db3c1));}catch(_0x175f33){_0x5b557c(_0x175f33);}}function _0x458f83(_0x4eec4d){_0x4eec4d['done']?_0x4cc142(_0x4eec4d['value']):_0x45286f(_0x4eec4d['value'])['then'](_0x15c935,_0x29b984);}_0x458f83((_0x3df86b=_0x3df86b['apply'](_0x146256,_0x4f0839||[]))['next']());});};class AdminClient{constructor(_0x31e115='https://admin.searchability.dev/'){var _0x2ef0da=new Fetch(_0x31e115);this['Accounts']=new AccountService(_0x2ef0da),this['Lists']=new ListService(_0x2ef0da),this['ApiKeys']=new ApiKeyService(_0x2ef0da),this['SearchServices']=new SearchServersService(_0x2ef0da);}}class AuthClient{constructor(_0x58c306='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x58c306);}['login'](_0x5afc64){return __awaiter(this,void 0,void 0,function*(){const _0x159b23='login/'+_0x5afc64;try{const _0x1a061b=yield yield fetch(_0x159b23);if(_0x1a061b['status']>0xc7&&_0x1a061b['status']<0x12c){const _0x34006e=yield _0x1a061b['json']();return new SuccessfulAuthResponse(_0x34006e);}const _0x418597=yield _0x1a061b['json']();return new FailedAuthResponse(_0x418597);}catch(_0x5e3014){if(_0x5e3014 instanceof Error)return new FailedAuthResponse({'detail':_0x5e3014['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5e3014;}});}['refresh'](_0x4e5166){return __awaiter(this,void 0,void 0,function*(){const _0x1fd461='refresh',_0x2d6263={'refresh_token':_0x4e5166};try{const _0x338792=yield this['fetch']['PostNoAuth'](_0x1fd461,_0x2d6263);if(_0x338792['status']>0xc7&&_0x338792['status']<0x12c){const _0x91339d=yield _0x338792['json']();return new SuccessfulAuthResponse(_0x91339d);}const _0x449025=yield _0x338792['json']();return new FailedAuthResponse(_0x449025);}catch(_0x4e76f4){if(_0x4e76f4 instanceof Error)return new FailedAuthResponse({'detail':_0x4e76f4['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4e76f4;}});}['getTokenStatus'](_0x4894a9){if(Date['now']()<_0x4894a9['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4894a9['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|