@searchability/admin-client 0.0.49 → 0.0.50
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(_0x2572fc){_0x2572fc[_0x2572fc['Ok']=0x0]='Ok',_0x2572fc[_0x2572fc['Refresh']=0x1]='Refresh',_0x2572fc[_0x2572fc['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(_0x2d696d){this['isSuccess']=_0x2d696d;}}class SuccessfulAccountResponse extends Response{constructor(_0x5303c2){super(!![]),this['account']=_0x5303c2;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x3b352a){super(!![]),this['list']=_0x3b352a;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x26d555){super(![]),this['problem']=_0x26d555;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x3e32af){super(![]),this['problem']=_0x3e32af;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x29489e){super(!![]),this['tokens']=_0x29489e;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x588eb4){super(![]),this['problem']=_0x588eb4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x104009){super(!![]),this['apiKey']=_0x104009;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x1f8431){super(![]),this['problem']=_0x1f8431;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x247dfc){super(!![]),this['searchService']=_0x247dfc;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x45565a){super(![]),this['problem']=_0x45565a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x114b12){super(!![]),this['searchService']=_0x114b12;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x2a7f20){super(!![]),this['searchServices']=_0x2a7f20;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x5f4189){super(![]),this['problem']=_0x5f4189;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1f1ae1){super(![]),this['problem']=_0x1f1ae1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x515941){super(!![]),this['apiKeyValue']=_0x515941;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x99ddb1){super(!![]),this['obj']=_0x99ddb1;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x9d3a7f){super(![]),this['problem']=_0x9d3a7f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x864247){super(![]),this['problem']=_0x864247;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x5dc25c,_0x558621,_0x14fea1,_0x34672e){function _0x5a4fd6(_0x36d198){return _0x36d198 instanceof _0x14fea1?_0x36d198:new _0x14fea1(function(_0x9a99c7){_0x9a99c7(_0x36d198);});}return new(_0x14fea1||(_0x14fea1=Promise))(function(_0xe32fe4,_0x319541){function _0x47799a(_0x1be21c){try{_0x27e0b9(_0x34672e['next'](_0x1be21c));}catch(_0xac2ef8){_0x319541(_0xac2ef8);}}function _0x320ae2(_0x4d0f81){try{_0x27e0b9(_0x34672e['throw'](_0x4d0f81));}catch(_0x397ff6){_0x319541(_0x397ff6);}}function _0x27e0b9(_0x332518){_0x332518['done']?_0xe32fe4(_0x332518['value']):_0x5a4fd6(_0x332518['value'])['then'](_0x47799a,_0x320ae2);}_0x27e0b9((_0x34672e=_0x34672e['apply'](_0x5dc25c,_0x558621||[]))['next']());});};class AccountService{constructor(_0x2e60cf){this['fetch']=_0x2e60cf;}['get'](_0x2262ef,_0x1607ac){return __awaiter$5(this,void 0,void 0,function*(){const _0xb39ba4='Account/'+_0x2262ef+'/',_0x438b6f=yield this['fetch']['get'](_0xb39ba4,_0x1607ac);try{if(_0x438b6f['status']>0xc7&&_0x438b6f['status']<0x12c){const _0x4aa140=yield _0x438b6f['json']();return new SuccessfulAccountResponse(_0x4aa140);}const _0x2d0de7=yield _0x438b6f['json']();return new FailedAccountResponse(_0x2d0de7);}catch(_0x2be3b){if(_0x2be3b instanceof Error)return new FailedAccountResponse({'detail':_0x2be3b['message'],'title':_0x2be3b['name'],'status':0x1f4,'instance':'','type':''});throw _0x2be3b;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x1072db,_0x180026,_0xb1736c,_0x24f697){function _0x18c5d7(_0x33e196){return _0x33e196 instanceof _0xb1736c?_0x33e196:new _0xb1736c(function(_0x28c474){_0x28c474(_0x33e196);});}return new(_0xb1736c||(_0xb1736c=Promise))(function(_0x4d4c,_0x15a194){function _0x37855b(_0x121eba){try{_0x1b12b7(_0x24f697['next'](_0x121eba));}catch(_0x4b6282){_0x15a194(_0x4b6282);}}function _0x340e58(_0x5cd7a3){try{_0x1b12b7(_0x24f697['throw'](_0x5cd7a3));}catch(_0x3d403a){_0x15a194(_0x3d403a);}}function _0x1b12b7(_0x2125f0){_0x2125f0['done']?_0x4d4c(_0x2125f0['value']):_0x18c5d7(_0x2125f0['value'])['then'](_0x37855b,_0x340e58);}_0x1b12b7((_0x24f697=_0x24f697['apply'](_0x1072db,_0x180026||[]))['next']());});};class ApiKeyService{constructor(_0x8d7856){this['fetch']=_0x8d7856,this['path']='api-key';}['create'](_0x191e7e,_0xb974ab,_0x32bf2f){return __awaiter$4(this,void 0,void 0,function*(){const _0x37a143={'account_name':_0x191e7e,'api_key_name':_0xb974ab};try{const _0x7b252a=yield this['fetch']['post'](this['path'],_0x32bf2f,_0x37a143);if(_0x7b252a['status']>0xc7&&_0x7b252a['status']<0x12c){const _0x323e63=yield _0x7b252a['json']();return new SuccessfulApiKeyResponse(_0x323e63);}const _0x29f759=yield _0x7b252a['json']();return new FailedApiKeyResponse(_0x29f759);}catch(_0x3004b7){if(_0x3004b7 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3004b7['message'],'title':_0x3004b7['name'],'status':0x1f4,'instance':'','type':''});throw _0x3004b7;}});}['view'](_0x444317,_0x772a5d,_0x4d6d95){return __awaiter$4(this,void 0,void 0,function*(){const _0x494904=this['path']+'/'+_0x444317+'/'+_0x772a5d;try{const _0x388115=yield this['fetch']['get'](_0x494904,_0x4d6d95);if(_0x388115['status']>0xc7&&_0x388115['status']<0x12c){const _0x5ee9b2=yield _0x388115['json']();return new SuccessfulApiKeyValueResponse(_0x5ee9b2);}const _0x21026a=yield _0x388115['json']();return new FailedApiKeyValueResponse(_0x21026a);}catch(_0x410d8c){if(_0x410d8c instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x410d8c['message'],'title':_0x410d8c['name'],'status':0x1f4,'instance':'','type':''});throw _0x410d8c;}});}['delete'](_0x36ab2b,_0x4b03d2,_0x945383){return __awaiter$4(this,void 0,void 0,function*(){const _0x1b98e8=this['path']+'/'+_0x36ab2b+'/'+_0x4b03d2;try{const _0x2d12b1=yield this['fetch']['delete'](_0x1b98e8,_0x945383);if(_0x2d12b1['status']>0xc7&&_0x2d12b1['status']<0x12c)return new SuccessfulResponse({});const _0x29881c=yield _0x2d12b1['json']();return new FailedResponse(_0x29881c);}catch(_0x28f4c4){if(_0x28f4c4 instanceof Error)return new FailedResponse({'detail':_0x28f4c4['message'],'title':_0x28f4c4['name'],'status':0x1f4,'instance':'','type':''});throw _0x28f4c4;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x11a703,_0xd918b5,_0xe0ec9c,_0x15c1b8){function _0x1f864c(_0x5bc137){return _0x5bc137 instanceof _0xe0ec9c?_0x5bc137:new _0xe0ec9c(function(_0x168bca){_0x168bca(_0x5bc137);});}return new(_0xe0ec9c||(_0xe0ec9c=Promise))(function(_0x5941c8,_0x5044a6){function _0x334458(_0x39c946){try{_0x519df3(_0x15c1b8['next'](_0x39c946));}catch(_0x5bd0b5){_0x5044a6(_0x5bd0b5);}}function _0x3c4f28(_0x41d9be){try{_0x519df3(_0x15c1b8['throw'](_0x41d9be));}catch(_0x1efe8f){_0x5044a6(_0x1efe8f);}}function _0x519df3(_0x372d3f){_0x372d3f['done']?_0x5941c8(_0x372d3f['value']):_0x1f864c(_0x372d3f['value'])['then'](_0x334458,_0x3c4f28);}_0x519df3((_0x15c1b8=_0x15c1b8['apply'](_0x11a703,_0xd918b5||[]))['next']());});};class ListService{constructor(_0xecc096){this['fetch']=_0xecc096;}['add'](_0x2db3be,_0x59e227,_0x5a17e0,_0x34ead9){return __awaiter$3(this,void 0,void 0,function*(){const _0x2a777c='List',_0x2889a6={'account_name':_0x2db3be,'list_name':_0x59e227,'search_service_name':_0x5a17e0};try{const _0xded512=yield this['fetch']['post'](_0x2a777c,_0x34ead9,_0x2889a6);if(_0xded512['status']>0xc7&&_0xded512['status']<0x12c){const _0xfcf411=yield _0xded512['json']();return new SuccessfulListIdentityResponse(_0xfcf411);}const _0x327136=yield _0xded512['json']();return new FailedListIdentityResponse(_0x327136);}catch(_0x5ee5ea){if(_0x5ee5ea instanceof Error)return new FailedListIdentityResponse({'detail':_0x5ee5ea['message'],'title':_0x5ee5ea['name'],'status':0x1f4,'instance':'','type':''});throw _0x5ee5ea;}});}['delete'](_0x514cbb,_0xf84ee8,_0x268ec6){return __awaiter$3(this,void 0,void 0,function*(){const _0x135602='List/'+_0x514cbb+'/'+_0xf84ee8,_0x52e9cf=yield this['fetch']['delete'](_0x135602,_0x268ec6);try{if(_0x52e9cf['status']>0xc7&&_0x52e9cf['status']<0x12c)return new SuccessfulResponse({});const _0xa4a88d=yield _0x52e9cf['json']();return new FailedResponse(_0xa4a88d);}catch(_0x25a462){if(_0x25a462 instanceof Error)return new FailedResponse({'detail':_0x25a462['message'],'title':_0x25a462['name'],'status':0x1f4,'instance':'','type':''});throw _0x25a462;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1950d4,_0x115c3e,_0x1bd874,_0x595906){function _0x33f831(_0x5db6b5){return _0x5db6b5 instanceof _0x1bd874?_0x5db6b5:new _0x1bd874(function(_0xdcb173){_0xdcb173(_0x5db6b5);});}return new(_0x1bd874||(_0x1bd874=Promise))(function(_0x11d972,_0x181f2e){function _0x323656(_0x3a7eca){try{_0x15f75d(_0x595906['next'](_0x3a7eca));}catch(_0x10bcca){_0x181f2e(_0x10bcca);}}function _0x225d2e(_0x599696){try{_0x15f75d(_0x595906['throw'](_0x599696));}catch(_0x46ca07){_0x181f2e(_0x46ca07);}}function _0x15f75d(_0x17903a){_0x17903a['done']?_0x11d972(_0x17903a['value']):_0x33f831(_0x17903a['value'])['then'](_0x323656,_0x225d2e);}_0x15f75d((_0x595906=_0x595906['apply'](_0x1950d4,_0x115c3e||[]))['next']());});};class Fetch{constructor(_0x4ecfb8){this['baseUri']=_0x4ecfb8,this['getUrl']=_0x437bd9=>{return _0x437bd9['startsWith']('/')&&(_0x437bd9=_0x437bd9['replace']('/','')),''+this['baseUri']+_0x437bd9;},!_0x4ecfb8['endsWith']('/')&&(_0x4ecfb8=_0x4ecfb8+'/');}['get'](_0xddc773,_0x27a809){return __awaiter$2(this,void 0,void 0,function*(){const _0xc071c6=this['getUrl'](_0xddc773);return yield fetch(_0xc071c6,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x27a809}});});}['post'](_0xbbc82f,_0x5b085c,_0x2d45de){return __awaiter$2(this,void 0,void 0,function*(){const _0x4fddfe=this['getUrl'](_0xbbc82f);return yield fetch(_0x4fddfe,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5b085c},'body':_0x2d45de?JSON['stringify'](_0x2d45de):null});});}['PostNoAuth'](_0x2d3528,_0x2c01e1){return __awaiter$2(this,void 0,void 0,function*(){const _0x1e7910=this['getUrl'](_0x2d3528);return yield fetch(_0x1e7910,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x2c01e1?JSON['stringify'](_0x2c01e1):null});});}['put'](_0x25cd07,_0x18cb5d,_0x28b70d){return __awaiter$2(this,void 0,void 0,function*(){const _0x9aacde=this['getUrl'](_0x25cd07);return yield fetch(_0x9aacde,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x18cb5d},'body':_0x28b70d?JSON['stringify'](_0x28b70d):null});});}['delete'](_0x5e6515,_0x57f1d8){return __awaiter$2(this,void 0,void 0,function*(){const _0x2114cc=this['getUrl'](_0x5e6515);return yield fetch(_0x2114cc,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x57f1d8}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2616cb,_0x512df2,_0xf679c1,_0x930653){function _0x469b71(_0x378b85){return _0x378b85 instanceof _0xf679c1?_0x378b85:new _0xf679c1(function(_0xc73ec3){_0xc73ec3(_0x378b85);});}return new(_0xf679c1||(_0xf679c1=Promise))(function(_0x42a295,_0x4e2df4){function _0x462c8e(_0x53c834){try{_0x5b11b2(_0x930653['next'](_0x53c834));}catch(_0x4dac94){_0x4e2df4(_0x4dac94);}}function _0x2c28aa(_0x113741){try{_0x5b11b2(_0x930653['throw'](_0x113741));}catch(_0x29258d){_0x4e2df4(_0x29258d);}}function _0x5b11b2(_0x355d59){_0x355d59['done']?_0x42a295(_0x355d59['value']):_0x469b71(_0x355d59['value'])['then'](_0x462c8e,_0x2c28aa);}_0x5b11b2((_0x930653=_0x930653['apply'](_0x2616cb,_0x512df2||[]))['next']());});};class SearchServersService{constructor(_0x31a2aa){this['fetch']=_0x31a2aa,this['path']='search-services';}['create'](_0x38d142,_0x24e2b1,_0x159b49,_0x2a3b8e,_0xf5f9b5,_0x2d841a,_0x2f294a,_0x59e7be){return __awaiter$1(this,void 0,void 0,function*(){const _0x30e25c={'account_name':_0x38d142,'search_service_name':_0x24e2b1,'endpoint':_0x159b49,'key':_0x2a3b8e,'country':_0xf5f9b5,'provider':_0x2d841a,'index_name':_0x2f294a};try{const _0x5b659d=yield this['fetch']['post'](this['path'],_0x59e7be,_0x30e25c);if(_0x5b659d['status']>0xc7&&_0x5b659d['status']<0x12c){const _0x39540d=yield _0x5b659d['json']();return new SuccessfulSearchServiceResponse(_0x39540d);}const _0x43efc5=yield _0x5b659d['json']();return new FailedSearchServiceResponse(_0x43efc5);}catch(_0x44646a){if(_0x44646a instanceof Error)return new FailedSearchServiceResponse({'detail':_0x44646a['message'],'title':_0x44646a['name'],'status':0x1f4,'instance':'','type':''});throw _0x44646a;}});}['delete'](_0x8d44e3,_0xf0b5cd,_0x291e64){return __awaiter$1(this,void 0,void 0,function*(){const _0x3c7b47=this['path']+'/'+_0x8d44e3+'/'+_0xf0b5cd;try{const _0x36f641=yield this['fetch']['delete'](_0x3c7b47,_0x291e64);if(_0x36f641['status']>0xc7&&_0x36f641['status']<0x12c)return new SuccessfulResponse({});const _0x4587c4=yield _0x36f641['json']();return new FailedResponse(_0x4587c4);}catch(_0x1f70e7){if(_0x1f70e7 instanceof Error)return new FailedResponse({'detail':_0x1f70e7['message'],'title':_0x1f70e7['name'],'status':0x1f4,'instance':'','type':''});throw _0x1f70e7;}});}['view'](_0x5479a6,_0x28caa1,_0x45c618){return __awaiter$1(this,void 0,void 0,function*(){const _0x58fc63=this['path']+'/'+_0x5479a6+'/'+_0x28caa1;try{const _0x460a4a=yield this['fetch']['get'](_0x58fc63,_0x45c618);if(_0x460a4a['status']>0xc7&&_0x460a4a['status']<0x12c){const _0x380a35=yield _0x460a4a['json']();return new SuccessfulViewSearchServiceResponse(_0x380a35);}const _0x21a29b=yield _0x460a4a['json']();return new FailedViewSearchServiceResponse(_0x21a29b);}catch(_0x5e9ac4){if(_0x5e9ac4 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x5e9ac4['message'],'title':_0x5e9ac4['name'],'status':0x1f4,'instance':'','type':''});throw _0x5e9ac4;}});}['edit'](_0x48e433,_0x5b2a7f,_0x278a27,_0x56361d,_0x362c42,_0x3093f0){return __awaiter$1(this,void 0,void 0,function*(){const _0x3062a0={'account_name':_0x48e433,'search_service_name':_0x5b2a7f,'new_search_service_name':_0x278a27,'key':_0x56361d,'country':_0x362c42};try{const _0x21e322=yield this['fetch']['put'](this['path'],_0x3093f0,_0x3062a0);if(_0x21e322['status']>0xc7&&_0x21e322['status']<0x12c){const _0x50a417=yield _0x21e322['json']();return new SuccessfulSearchServiceResponse(_0x50a417);}const _0x2bf822=yield _0x21e322['json']();return new FailedSearchServiceResponse(_0x2bf822);}catch(_0x9ed6ff){if(_0x9ed6ff instanceof Error)return new FailedSearchServiceResponse({'detail':_0x9ed6ff['message'],'title':_0x9ed6ff['name'],'status':0x1f4,'instance':'','type':''});throw _0x9ed6ff;}});}['list'](_0x337d40,_0x1081da){return __awaiter$1(this,void 0,void 0,function*(){const _0x110b19=this['path']+'/'+_0x337d40;try{const _0x37dbf9=yield this['fetch']['get'](_0x110b19,_0x1081da);if(_0x37dbf9['status']>0xc7&&_0x37dbf9['status']<0x12c){const _0x12ff4a=yield _0x37dbf9['json']();return new SuccessfulListSearchServiceResponse(_0x12ff4a);}const _0x1c500c=yield _0x37dbf9['json']();return new FailedViewSearchServicesResponse(_0x1c500c);}catch(_0x2438d6){if(_0x2438d6 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x2438d6['message'],'title':_0x2438d6['name'],'status':0x1f4,'instance':'','type':''});throw _0x2438d6;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0xf3f2b7,_0x1b26f7,_0x188a9a,_0x41d92a){function _0x44c6b0(_0x3cfd64){return _0x3cfd64 instanceof _0x188a9a?_0x3cfd64:new _0x188a9a(function(_0x187d7c){_0x187d7c(_0x3cfd64);});}return new(_0x188a9a||(_0x188a9a=Promise))(function(_0x354f39,_0x596c5f){function _0x296a48(_0x5bb362){try{_0x532961(_0x41d92a['next'](_0x5bb362));}catch(_0x21fe18){_0x596c5f(_0x21fe18);}}function _0x3b6b9e(_0x8552ab){try{_0x532961(_0x41d92a['throw'](_0x8552ab));}catch(_0x4ae7e9){_0x596c5f(_0x4ae7e9);}}function _0x532961(_0x2b4a75){_0x2b4a75['done']?_0x354f39(_0x2b4a75['value']):_0x44c6b0(_0x2b4a75['value'])['then'](_0x296a48,_0x3b6b9e);}_0x532961((_0x41d92a=_0x41d92a['apply'](_0xf3f2b7,_0x1b26f7||[]))['next']());});};class AdminClient{constructor(_0x1c5bda='https://admin.searchability.dev/'){var _0x31a9c6=new Fetch(_0x1c5bda);this['Accounts']=new AccountService(_0x31a9c6),this['Lists']=new ListService(_0x31a9c6),this['ApiKeys']=new ApiKeyService(_0x31a9c6),this['SearchServices']=new SearchServersService(_0x31a9c6);}}class AuthClient{constructor(_0x490d4e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x490d4e);}['login'](_0x389127){return __awaiter(this,void 0,void 0,function*(){const _0x5d0cea='login/'+_0x389127;try{const _0x37d9fd=yield yield fetch(_0x5d0cea);if(_0x37d9fd['status']>0xc7&&_0x37d9fd['status']<0x12c){const _0x4a4548=yield _0x37d9fd['json']();return new SuccessfulAuthResponse(_0x4a4548);}const _0x431465=yield _0x37d9fd['json']();return new FailedAuthResponse(_0x431465);}catch(_0x3377a7){if(_0x3377a7 instanceof Error)return new FailedAuthResponse({'detail':_0x3377a7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3377a7;}});}['refresh'](_0xc4f97d){return __awaiter(this,void 0,void 0,function*(){const _0x45ef5f='refresh',_0x55c4e6={'refresh_token':_0xc4f97d};try{const _0x564290=yield this['fetch']['PostNoAuth'](_0x45ef5f,_0x55c4e6);if(_0x564290['status']>0xc7&&_0x564290['status']<0x12c){const _0x37df4a=yield _0x564290['json']();return new SuccessfulAuthResponse(_0x37df4a);}const _0x58fe51=yield _0x564290['json']();return new FailedAuthResponse(_0x58fe51);}catch(_0x32685d){if(_0x32685d instanceof Error)return new FailedAuthResponse({'detail':_0x32685d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x32685d;}});}['getTokenStatus'](_0x2cbe6e){if(Date['now']()<_0x2cbe6e['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x2cbe6e['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(_0x42351a){_0x42351a[_0x42351a['Ok']=0x0]='Ok',_0x42351a[_0x42351a['Refresh']=0x1]='Refresh',_0x42351a[_0x42351a['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(_0x5299c7){this['isSuccess']=_0x5299c7;}}class SuccessfulAccountResponse extends Response{constructor(_0x374324){super(!![]),this['account']=_0x374324;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x406481){super(!![]),this['list']=_0x406481;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2333fd){super(![]),this['problem']=_0x2333fd;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x2996e8){super(![]),this['problem']=_0x2996e8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x2a4e3f){super(!![]),this['tokens']=_0x2a4e3f;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x2d678e){super(![]),this['problem']=_0x2d678e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x571fde){super(!![]),this['apiKey']=_0x571fde;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x4b42aa){super(![]),this['problem']=_0x4b42aa;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x235f22){super(!![]),this['searchService']=_0x235f22;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x39b1b4){super(![]),this['problem']=_0x39b1b4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x2480e5){super(!![]),this['searchService']=_0x2480e5;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x50a1f8){super(!![]),this['searchServices']=_0x50a1f8;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x13ec3d){super(![]),this['problem']=_0x13ec3d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x426f14){super(![]),this['problem']=_0x426f14;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x3f3069){super(!![]),this['apiKeyValue']=_0x3f3069;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x53c17c){super(!![]),this['obj']=_0x53c17c;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x200ae4){super(![]),this['problem']=_0x200ae4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x466669){super(![]),this['problem']=_0x466669;}['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(_0x1eab9a,_0x4f8518,_0x1c1d71,_0x3d86dc){function _0x5c7738(_0x12b189){return _0x12b189 instanceof _0x1c1d71?_0x12b189:new _0x1c1d71(function(_0x4b8d98){_0x4b8d98(_0x12b189);});}return new(_0x1c1d71||(_0x1c1d71=Promise))(function(_0x17a630,_0x4ed6ac){function _0x1e020d(_0x272d3a){try{_0x3334f2(_0x3d86dc['next'](_0x272d3a));}catch(_0x3f4516){_0x4ed6ac(_0x3f4516);}}function _0x2958f9(_0x4bc183){try{_0x3334f2(_0x3d86dc['throw'](_0x4bc183));}catch(_0x5cea19){_0x4ed6ac(_0x5cea19);}}function _0x3334f2(_0x398718){_0x398718['done']?_0x17a630(_0x398718['value']):_0x5c7738(_0x398718['value'])['then'](_0x1e020d,_0x2958f9);}_0x3334f2((_0x3d86dc=_0x3d86dc['apply'](_0x1eab9a,_0x4f8518||[]))['next']());});};class AccountService{constructor(_0x36e39d){this['fetch']=_0x36e39d;}['get'](_0x71ff90,_0x3ac812){return __awaiter$5(this,void 0,void 0,function*(){const _0x2a9785='Account/'+_0x71ff90+'/',_0x4cd903=yield this['fetch']['get'](_0x2a9785,_0x3ac812);try{if(_0x4cd903['status']>0xc7&&_0x4cd903['status']<0x12c){const _0x21fc63=yield _0x4cd903['json']();return new SuccessfulAccountResponse(_0x21fc63);}const _0x2c7891=yield _0x4cd903['json']();return new FailedAccountResponse(_0x2c7891);}catch(_0x464f8d){if(_0x464f8d instanceof Error)return new FailedAccountResponse({'detail':_0x464f8d['message'],'title':_0x464f8d['name'],'status':0x1f4,'instance':'','type':''});throw _0x464f8d;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x220c99,_0xc50d51,_0x51a21e,_0x48b1bf){function _0xf83330(_0x556724){return _0x556724 instanceof _0x51a21e?_0x556724:new _0x51a21e(function(_0x22a056){_0x22a056(_0x556724);});}return new(_0x51a21e||(_0x51a21e=Promise))(function(_0x38193a,_0x2fdf2e){function _0x1e7dc7(_0xfb953d){try{_0x5596de(_0x48b1bf['next'](_0xfb953d));}catch(_0x2f33a5){_0x2fdf2e(_0x2f33a5);}}function _0x1cd5a6(_0x5854d9){try{_0x5596de(_0x48b1bf['throw'](_0x5854d9));}catch(_0x495af7){_0x2fdf2e(_0x495af7);}}function _0x5596de(_0x306b5c){_0x306b5c['done']?_0x38193a(_0x306b5c['value']):_0xf83330(_0x306b5c['value'])['then'](_0x1e7dc7,_0x1cd5a6);}_0x5596de((_0x48b1bf=_0x48b1bf['apply'](_0x220c99,_0xc50d51||[]))['next']());});};class ApiKeyService{constructor(_0x281150){this['fetch']=_0x281150,this['path']='api-key';}['create'](_0x32bd2b,_0x45bde7,_0x209fee){return __awaiter$4(this,void 0,void 0,function*(){const _0x5df6ec={'account_name':_0x32bd2b,'api_key_name':_0x45bde7};try{const _0x53095a=yield this['fetch']['post'](this['path'],_0x209fee,_0x5df6ec);if(_0x53095a['status']>0xc7&&_0x53095a['status']<0x12c){const _0x2c3fad=yield _0x53095a['json']();return new SuccessfulApiKeyResponse(_0x2c3fad);}const _0x444d27=yield _0x53095a['json']();return new FailedApiKeyResponse(_0x444d27);}catch(_0x3ec24b){if(_0x3ec24b instanceof Error)return new FailedApiKeyResponse({'detail':_0x3ec24b['message'],'title':_0x3ec24b['name'],'status':0x1f4,'instance':'','type':''});throw _0x3ec24b;}});}['view'](_0x566cfd,_0x41cf6d,_0x3a56ab){return __awaiter$4(this,void 0,void 0,function*(){const _0x34083c=this['path']+'/'+_0x566cfd+'/'+_0x41cf6d;try{const _0xe6432e=yield this['fetch']['get'](_0x34083c,_0x3a56ab);if(_0xe6432e['status']>0xc7&&_0xe6432e['status']<0x12c){const _0x3a3132=yield _0xe6432e['json']();return new SuccessfulApiKeyValueResponse(_0x3a3132);}const _0x4bfdb3=yield _0xe6432e['json']();return new FailedApiKeyValueResponse(_0x4bfdb3);}catch(_0x335021){if(_0x335021 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x335021['message'],'title':_0x335021['name'],'status':0x1f4,'instance':'','type':''});throw _0x335021;}});}['delete'](_0x4f8e06,_0x3a297b,_0x2cb9a0){return __awaiter$4(this,void 0,void 0,function*(){const _0x5c27a7=this['path']+'/'+_0x4f8e06+'/'+_0x3a297b;try{const _0xa1ccc3=yield this['fetch']['delete'](_0x5c27a7,_0x2cb9a0);if(_0xa1ccc3['status']>0xc7&&_0xa1ccc3['status']<0x12c)return new SuccessfulResponse({});const _0xb4bfa3=yield _0xa1ccc3['json']();return new FailedResponse(_0xb4bfa3);}catch(_0x5ebc2a){if(_0x5ebc2a instanceof Error)return new FailedResponse({'detail':_0x5ebc2a['message'],'title':_0x5ebc2a['name'],'status':0x1f4,'instance':'','type':''});throw _0x5ebc2a;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x545c39,_0x3a3bc1,_0x382677,_0x1017a4){function _0x27a1e0(_0x3b50ca){return _0x3b50ca instanceof _0x382677?_0x3b50ca:new _0x382677(function(_0x56df69){_0x56df69(_0x3b50ca);});}return new(_0x382677||(_0x382677=Promise))(function(_0x3b2a6b,_0x3d8b5c){function _0x48d3cc(_0x43d4aa){try{_0x1ee421(_0x1017a4['next'](_0x43d4aa));}catch(_0x3181e3){_0x3d8b5c(_0x3181e3);}}function _0x45baba(_0x3f38e4){try{_0x1ee421(_0x1017a4['throw'](_0x3f38e4));}catch(_0x554d02){_0x3d8b5c(_0x554d02);}}function _0x1ee421(_0x2d994e){_0x2d994e['done']?_0x3b2a6b(_0x2d994e['value']):_0x27a1e0(_0x2d994e['value'])['then'](_0x48d3cc,_0x45baba);}_0x1ee421((_0x1017a4=_0x1017a4['apply'](_0x545c39,_0x3a3bc1||[]))['next']());});};class ListService{constructor(_0x1b1e0b){this['fetch']=_0x1b1e0b;}['add'](_0xc4458f,_0x32adcf,_0x1540fe,_0x313177){return __awaiter$3(this,void 0,void 0,function*(){const _0x1a1efa='List',_0x49a952={'account_name':_0xc4458f,'list_name':_0x32adcf,'search_service_name':_0x1540fe};try{const _0x326518=yield this['fetch']['post'](_0x1a1efa,_0x313177,_0x49a952);if(_0x326518['status']>0xc7&&_0x326518['status']<0x12c){const _0x81fdaf=yield _0x326518['json']();return new SuccessfulListIdentityResponse(_0x81fdaf);}const _0x25c15f=yield _0x326518['json']();return new FailedListIdentityResponse(_0x25c15f);}catch(_0x4e91f5){if(_0x4e91f5 instanceof Error)return new FailedListIdentityResponse({'detail':_0x4e91f5['message'],'title':_0x4e91f5['name'],'status':0x1f4,'instance':'','type':''});throw _0x4e91f5;}});}['delete'](_0x5a63bd,_0x1c2bc9,_0x55d26a){return __awaiter$3(this,void 0,void 0,function*(){const _0x168df8='List/'+_0x5a63bd+'/'+_0x1c2bc9,_0xea2bbd=yield this['fetch']['delete'](_0x168df8,_0x55d26a);try{if(_0xea2bbd['status']>0xc7&&_0xea2bbd['status']<0x12c)return new SuccessfulResponse({});const _0x43eb44=yield _0xea2bbd['json']();return new FailedResponse(_0x43eb44);}catch(_0x4816d8){if(_0x4816d8 instanceof Error)return new FailedResponse({'detail':_0x4816d8['message'],'title':_0x4816d8['name'],'status':0x1f4,'instance':'','type':''});throw _0x4816d8;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x952f47,_0x41240e,_0x49508c,_0x33d5ef){function _0x175c65(_0x1481a9){return _0x1481a9 instanceof _0x49508c?_0x1481a9:new _0x49508c(function(_0x921366){_0x921366(_0x1481a9);});}return new(_0x49508c||(_0x49508c=Promise))(function(_0x3c0a03,_0x54ce64){function _0x1953f4(_0x4a8441){try{_0x5ab7f0(_0x33d5ef['next'](_0x4a8441));}catch(_0x58cba5){_0x54ce64(_0x58cba5);}}function _0x9ed3aa(_0x3cb1dd){try{_0x5ab7f0(_0x33d5ef['throw'](_0x3cb1dd));}catch(_0x2ecbcc){_0x54ce64(_0x2ecbcc);}}function _0x5ab7f0(_0xbfa907){_0xbfa907['done']?_0x3c0a03(_0xbfa907['value']):_0x175c65(_0xbfa907['value'])['then'](_0x1953f4,_0x9ed3aa);}_0x5ab7f0((_0x33d5ef=_0x33d5ef['apply'](_0x952f47,_0x41240e||[]))['next']());});};class Fetch{constructor(_0x1e2130){this['baseUri']=_0x1e2130,this['getUrl']=_0x2bf6fe=>{return _0x2bf6fe['startsWith']('/')&&(_0x2bf6fe=_0x2bf6fe['replace']('/','')),''+this['baseUri']+_0x2bf6fe;},!_0x1e2130['endsWith']('/')&&(_0x1e2130=_0x1e2130+'/');}['get'](_0x327c10,_0xa089bc){return __awaiter$2(this,void 0,void 0,function*(){const _0x58a76d=this['getUrl'](_0x327c10);return yield fetch(_0x58a76d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xa089bc}});});}['post'](_0x330852,_0x2ab831,_0x14b652){return __awaiter$2(this,void 0,void 0,function*(){const _0x3d1462=this['getUrl'](_0x330852);return yield fetch(_0x3d1462,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2ab831},'body':_0x14b652?JSON['stringify'](_0x14b652):null});});}['PostNoAuth'](_0x1c9d3a,_0x3bb23b){return __awaiter$2(this,void 0,void 0,function*(){const _0xc4df0b=this['getUrl'](_0x1c9d3a);return yield fetch(_0xc4df0b,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x3bb23b?JSON['stringify'](_0x3bb23b):null});});}['put'](_0x5091bd,_0x3de2e0,_0x59163d){return __awaiter$2(this,void 0,void 0,function*(){const _0x5d8f5e=this['getUrl'](_0x5091bd);return yield fetch(_0x5d8f5e,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3de2e0},'body':_0x59163d?JSON['stringify'](_0x59163d):null});});}['delete'](_0x109fec,_0x149c51){return __awaiter$2(this,void 0,void 0,function*(){const _0x29e64e=this['getUrl'](_0x109fec);return yield fetch(_0x29e64e,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x149c51}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3b1c05,_0x5ea840,_0x5629a4,_0xf61ba3){function _0x502838(_0x2c979d){return _0x2c979d instanceof _0x5629a4?_0x2c979d:new _0x5629a4(function(_0x5544ae){_0x5544ae(_0x2c979d);});}return new(_0x5629a4||(_0x5629a4=Promise))(function(_0x6ab3a9,_0x2a14f2){function _0x3ba0e2(_0x2b4194){try{_0x19250a(_0xf61ba3['next'](_0x2b4194));}catch(_0x419237){_0x2a14f2(_0x419237);}}function _0x446d76(_0x2a8221){try{_0x19250a(_0xf61ba3['throw'](_0x2a8221));}catch(_0x5e0f69){_0x2a14f2(_0x5e0f69);}}function _0x19250a(_0x360d17){_0x360d17['done']?_0x6ab3a9(_0x360d17['value']):_0x502838(_0x360d17['value'])['then'](_0x3ba0e2,_0x446d76);}_0x19250a((_0xf61ba3=_0xf61ba3['apply'](_0x3b1c05,_0x5ea840||[]))['next']());});};class SearchServersService{constructor(_0x66c33f){this['fetch']=_0x66c33f,this['path']='search-services';}['create'](_0x31b480,_0x1c380b,_0x147ab7,_0x2e2967,_0x3cf953,_0x55652c,_0x30664a,_0x69c1e){return __awaiter$1(this,void 0,void 0,function*(){const _0x53b9b1={'account_name':_0x31b480,'search_service_name':_0x1c380b,'endpoint':_0x147ab7,'key':_0x2e2967,'country':_0x3cf953,'provider':_0x55652c,'index_name':_0x30664a};try{const _0x4f4295=yield this['fetch']['post'](this['path'],_0x69c1e,_0x53b9b1);if(_0x4f4295['status']>0xc7&&_0x4f4295['status']<0x12c){const _0x27702a=yield _0x4f4295['json']();return new SuccessfulSearchServiceResponse(_0x27702a);}const _0xe1c117=yield _0x4f4295['json']();return new FailedSearchServiceResponse(_0xe1c117);}catch(_0x31f14d){if(_0x31f14d instanceof Error)return new FailedSearchServiceResponse({'detail':_0x31f14d['message'],'title':_0x31f14d['name'],'status':0x1f4,'instance':'','type':''});throw _0x31f14d;}});}['delete'](_0x2ea6de,_0x34acd0,_0x5cb2cc){return __awaiter$1(this,void 0,void 0,function*(){const _0x3d635c=this['path']+'/'+_0x2ea6de+'/'+_0x34acd0;try{const _0x3a27a5=yield this['fetch']['delete'](_0x3d635c,_0x5cb2cc);if(_0x3a27a5['status']>0xc7&&_0x3a27a5['status']<0x12c)return new SuccessfulResponse({});const _0x4b8ea7=yield _0x3a27a5['json']();return new FailedResponse(_0x4b8ea7);}catch(_0x59891e){if(_0x59891e instanceof Error)return new FailedResponse({'detail':_0x59891e['message'],'title':_0x59891e['name'],'status':0x1f4,'instance':'','type':''});throw _0x59891e;}});}['view'](_0x17ad27,_0x172f3a,_0x36dc42){return __awaiter$1(this,void 0,void 0,function*(){const _0x29fa9d=this['path']+'/'+_0x17ad27+'/'+_0x172f3a;try{const _0x267ed8=yield this['fetch']['get'](_0x29fa9d,_0x36dc42);if(_0x267ed8['status']>0xc7&&_0x267ed8['status']<0x12c){const _0x4b9aba=yield _0x267ed8['json']();return new SuccessfulViewSearchServiceResponse(_0x4b9aba);}const _0x4a9deb=yield _0x267ed8['json']();return new FailedViewSearchServiceResponse(_0x4a9deb);}catch(_0x48d6a5){if(_0x48d6a5 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x48d6a5['message'],'title':_0x48d6a5['name'],'status':0x1f4,'instance':'','type':''});throw _0x48d6a5;}});}['edit'](_0x93d12c,_0x15b527,_0x3c0425,_0x37b638,_0x5d677f,_0x3d815e){return __awaiter$1(this,void 0,void 0,function*(){const _0x4c7a90={'account_name':_0x93d12c,'search_service_name':_0x15b527,'new_search_service_name':_0x3c0425,'key':_0x37b638,'country':_0x5d677f};try{const _0x189181=yield this['fetch']['put'](this['path'],_0x3d815e,_0x4c7a90);if(_0x189181['status']>0xc7&&_0x189181['status']<0x12c){const _0x1736eb=yield _0x189181['json']();return new SuccessfulSearchServiceResponse(_0x1736eb);}const _0x174e15=yield _0x189181['json']();return new FailedSearchServiceResponse(_0x174e15);}catch(_0x49ba28){if(_0x49ba28 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x49ba28['message'],'title':_0x49ba28['name'],'status':0x1f4,'instance':'','type':''});throw _0x49ba28;}});}['list'](_0x3da9bf,_0x59546f){return __awaiter$1(this,void 0,void 0,function*(){const _0x2277d4=this['path']+'/'+_0x3da9bf;try{const _0x1fbdfe=yield this['fetch']['get'](_0x2277d4,_0x59546f);if(_0x1fbdfe['status']>0xc7&&_0x1fbdfe['status']<0x12c){const _0x4e76e5=yield _0x1fbdfe['json']();return new SuccessfulListSearchServiceResponse(_0x4e76e5);}const _0x23f82e=yield _0x1fbdfe['json']();return new FailedViewSearchServicesResponse(_0x23f82e);}catch(_0xb58f51){if(_0xb58f51 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0xb58f51['message'],'title':_0xb58f51['name'],'status':0x1f4,'instance':'','type':''});throw _0xb58f51;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1f292d,_0x507403,_0x596783,_0x252803){function _0x3420ba(_0x54daca){return _0x54daca instanceof _0x596783?_0x54daca:new _0x596783(function(_0x6b74f3){_0x6b74f3(_0x54daca);});}return new(_0x596783||(_0x596783=Promise))(function(_0x4b343b,_0x27c19f){function _0x5a8ff3(_0x453cb7){try{_0xbcc52f(_0x252803['next'](_0x453cb7));}catch(_0x5f2730){_0x27c19f(_0x5f2730);}}function _0x348f42(_0x1b4a30){try{_0xbcc52f(_0x252803['throw'](_0x1b4a30));}catch(_0x48d2c0){_0x27c19f(_0x48d2c0);}}function _0xbcc52f(_0x3f389a){_0x3f389a['done']?_0x4b343b(_0x3f389a['value']):_0x3420ba(_0x3f389a['value'])['then'](_0x5a8ff3,_0x348f42);}_0xbcc52f((_0x252803=_0x252803['apply'](_0x1f292d,_0x507403||[]))['next']());});};class AdminClient{constructor(_0x4f4dbc='https://admin.searchability.dev/'){var _0x29460c=new Fetch(_0x4f4dbc);this['Accounts']=new AccountService(_0x29460c),this['Lists']=new ListService(_0x29460c),this['ApiKeys']=new ApiKeyService(_0x29460c),this['SearchServices']=new SearchServersService(_0x29460c);}}class AuthClient{constructor(_0x1e7586='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x1e7586);}['login'](_0x171a05){return __awaiter(this,void 0,void 0,function*(){const _0x2211b7='login/'+_0x171a05;try{const _0x4edb2b=yield yield fetch(_0x2211b7);if(_0x4edb2b['status']>0xc7&&_0x4edb2b['status']<0x12c){const _0x4370b6=yield _0x4edb2b['json']();return new SuccessfulAuthResponse(_0x4370b6);}const _0x3051a3=yield _0x4edb2b['json']();return new FailedAuthResponse(_0x3051a3);}catch(_0x2fc8a1){if(_0x2fc8a1 instanceof Error)return new FailedAuthResponse({'detail':_0x2fc8a1['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2fc8a1;}});}['refresh'](_0x433cbc){return __awaiter(this,void 0,void 0,function*(){const _0x1846f9='refresh',_0x44e338={'refresh_token':_0x433cbc};try{const _0x5edddd=yield this['fetch']['PostNoAuth'](_0x1846f9,_0x44e338);if(_0x5edddd['status']>0xc7&&_0x5edddd['status']<0x12c){const _0x562d54=yield _0x5edddd['json']();return new SuccessfulAuthResponse(_0x562d54);}const _0x2252a8=yield _0x5edddd['json']();return new FailedAuthResponse(_0x2252a8);}catch(_0x2b0404){if(_0x2b0404 instanceof Error)return new FailedAuthResponse({'detail':_0x2b0404['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2b0404;}});}['getTokenStatus'](_0x3a9cec){if(Date['now']()<_0x3a9cec['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x3a9cec['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(_0x555e90){_0x555e90[_0x555e90['Ok']=0x0]='Ok',_0x555e90[_0x555e90['Refresh']=0x1]='Refresh',_0x555e90[_0x555e90['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(_0x589bb8){this['isSuccess']=_0x589bb8;}}class SuccessfulAccountResponse extends Response{constructor(_0x12cf26){super(!![]),this['account']=_0x12cf26;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x337f7f){super(!![]),this['list']=_0x337f7f;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x54739e){super(![]),this['problem']=_0x54739e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0xfce474){super(![]),this['problem']=_0xfce474;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x6820f3){super(!![]),this['tokens']=_0x6820f3;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0xfea91){super(![]),this['problem']=_0xfea91;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x526533){super(!![]),this['apiKey']=_0x526533;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x498a19){super(![]),this['problem']=_0x498a19;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x4661af){super(!![]),this['searchService']=_0x4661af;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x28a996){super(![]),this['problem']=_0x28a996;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x1b39c1){super(!![]),this['searchService']=_0x1b39c1;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x48333e){super(!![]),this['searchServices']=_0x48333e;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x3d20ef){super(![]),this['problem']=_0x3d20ef;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x352169){super(![]),this['problem']=_0x352169;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x19c35c){super(!![]),this['apiKeyValue']=_0x19c35c;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x547d84){super(!![]),this['obj']=_0x547d84;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x4ee5ef){super(![]),this['problem']=_0x4ee5ef;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x43eace){super(![]),this['problem']=_0x43eace;}['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(_0x2a05b1,_0x4c762f,_0xf95329,_0x32edbd){function _0x17f574(_0x219640){return _0x219640 instanceof _0xf95329?_0x219640:new _0xf95329(function(_0x2629b3){_0x2629b3(_0x219640);});}return new(_0xf95329||(_0xf95329=Promise))(function(_0x1d1067,_0x504440){function _0x3b8b49(_0x3dc1c3){try{_0x473375(_0x32edbd['next'](_0x3dc1c3));}catch(_0x590f84){_0x504440(_0x590f84);}}function _0x368a9b(_0x5a0520){try{_0x473375(_0x32edbd['throw'](_0x5a0520));}catch(_0x467aed){_0x504440(_0x467aed);}}function _0x473375(_0x146cc1){_0x146cc1['done']?_0x1d1067(_0x146cc1['value']):_0x17f574(_0x146cc1['value'])['then'](_0x3b8b49,_0x368a9b);}_0x473375((_0x32edbd=_0x32edbd['apply'](_0x2a05b1,_0x4c762f||[]))['next']());});};class AccountService{constructor(_0x752749){this['fetch']=_0x752749;}['get'](_0x4f9a59,_0x1ef069){return __awaiter$5(this,void 0,void 0,function*(){const _0x4a249e='Account/'+_0x4f9a59+'/',_0x2d409a=yield this['fetch']['get'](_0x4a249e,_0x1ef069);try{if(_0x2d409a['status']>0xc7&&_0x2d409a['status']<0x12c){const _0x1dac3e=yield _0x2d409a['json']();return new SuccessfulAccountResponse(_0x1dac3e);}const _0x974e81=yield _0x2d409a['json']();return new FailedAccountResponse(_0x974e81);}catch(_0x2cf5fe){if(_0x2cf5fe instanceof Error)return new FailedAccountResponse({'detail':_0x2cf5fe['message'],'title':_0x2cf5fe['name'],'status':0x1f4,'instance':'','type':''});throw _0x2cf5fe;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0xfeb29d,_0x48be09,_0x5b8aa2,_0x384ee0){function _0x222072(_0x2b7af4){return _0x2b7af4 instanceof _0x5b8aa2?_0x2b7af4:new _0x5b8aa2(function(_0x215376){_0x215376(_0x2b7af4);});}return new(_0x5b8aa2||(_0x5b8aa2=Promise))(function(_0xc454b0,_0x1c83d0){function _0x5ddc97(_0x2509b1){try{_0x36aabd(_0x384ee0['next'](_0x2509b1));}catch(_0x529ed4){_0x1c83d0(_0x529ed4);}}function _0xda9521(_0x5875bd){try{_0x36aabd(_0x384ee0['throw'](_0x5875bd));}catch(_0x428e4c){_0x1c83d0(_0x428e4c);}}function _0x36aabd(_0x4ba395){_0x4ba395['done']?_0xc454b0(_0x4ba395['value']):_0x222072(_0x4ba395['value'])['then'](_0x5ddc97,_0xda9521);}_0x36aabd((_0x384ee0=_0x384ee0['apply'](_0xfeb29d,_0x48be09||[]))['next']());});};class ApiKeyService{constructor(_0x5473f7){this['fetch']=_0x5473f7,this['path']='api-key';}['create'](_0xafa8b3,_0x5878e7,_0x44cbb0){return __awaiter$4(this,void 0,void 0,function*(){const _0x4a9f5c={'account_name':_0xafa8b3,'api_key_name':_0x5878e7};try{const _0x5567c8=yield this['fetch']['post'](this['path'],_0x44cbb0,_0x4a9f5c);if(_0x5567c8['status']>0xc7&&_0x5567c8['status']<0x12c){const _0x12a62a=yield _0x5567c8['json']();return new SuccessfulApiKeyResponse(_0x12a62a);}const _0x43a490=yield _0x5567c8['json']();return new FailedApiKeyResponse(_0x43a490);}catch(_0x17dfaf){if(_0x17dfaf instanceof Error)return new FailedApiKeyResponse({'detail':_0x17dfaf['message'],'title':_0x17dfaf['name'],'status':0x1f4,'instance':'','type':''});throw _0x17dfaf;}});}['view'](_0x4a530c,_0x195abb,_0x9240e){return __awaiter$4(this,void 0,void 0,function*(){const _0x31c519=this['path']+'/'+_0x4a530c+'/'+_0x195abb;try{const _0x183824=yield this['fetch']['get'](_0x31c519,_0x9240e);if(_0x183824['status']>0xc7&&_0x183824['status']<0x12c){const _0x4d5209=yield _0x183824['json']();return new SuccessfulApiKeyValueResponse(_0x4d5209);}const _0x500e88=yield _0x183824['json']();return new FailedApiKeyValueResponse(_0x500e88);}catch(_0x4392ee){if(_0x4392ee instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4392ee['message'],'title':_0x4392ee['name'],'status':0x1f4,'instance':'','type':''});throw _0x4392ee;}});}['delete'](_0xb52d88,_0x442b90,_0x4c2aa5){return __awaiter$4(this,void 0,void 0,function*(){const _0x79baf4=this['path']+'/'+_0xb52d88+'/'+_0x442b90;try{const _0x2e74d3=yield this['fetch']['delete'](_0x79baf4,_0x4c2aa5);if(_0x2e74d3['status']>0xc7&&_0x2e74d3['status']<0x12c)return new SuccessfulResponse({});const _0x22a5b4=yield _0x2e74d3['json']();return new FailedResponse(_0x22a5b4);}catch(_0x3c9fc2){if(_0x3c9fc2 instanceof Error)return new FailedResponse({'detail':_0x3c9fc2['message'],'title':_0x3c9fc2['name'],'status':0x1f4,'instance':'','type':''});throw _0x3c9fc2;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x1838f1,_0x5819d6,_0x43e904,_0x3ddecc){function _0x4513bd(_0xf82162){return _0xf82162 instanceof _0x43e904?_0xf82162:new _0x43e904(function(_0x5a626a){_0x5a626a(_0xf82162);});}return new(_0x43e904||(_0x43e904=Promise))(function(_0x501575,_0x4b5d8b){function _0x376516(_0x51fd74){try{_0x18c221(_0x3ddecc['next'](_0x51fd74));}catch(_0x493c5a){_0x4b5d8b(_0x493c5a);}}function _0x47c6fb(_0x41a135){try{_0x18c221(_0x3ddecc['throw'](_0x41a135));}catch(_0x5bc499){_0x4b5d8b(_0x5bc499);}}function _0x18c221(_0x5e1853){_0x5e1853['done']?_0x501575(_0x5e1853['value']):_0x4513bd(_0x5e1853['value'])['then'](_0x376516,_0x47c6fb);}_0x18c221((_0x3ddecc=_0x3ddecc['apply'](_0x1838f1,_0x5819d6||[]))['next']());});};class ListService{constructor(_0x238516){this['fetch']=_0x238516;}['add'](_0xd6a7de,_0x25c151,_0x302e6b,_0xb8cf9){return __awaiter$3(this,void 0,void 0,function*(){const _0x53613b='List',_0x45f41f={'account_name':_0xd6a7de,'list_name':_0x25c151,'search_service_name':_0x302e6b};try{const _0x1d2766=yield this['fetch']['post'](_0x53613b,_0xb8cf9,_0x45f41f);if(_0x1d2766['status']>0xc7&&_0x1d2766['status']<0x12c){const _0x1e4936=yield _0x1d2766['json']();return new SuccessfulListIdentityResponse(_0x1e4936);}const _0x39ed28=yield _0x1d2766['json']();return new FailedListIdentityResponse(_0x39ed28);}catch(_0x3cc0f1){if(_0x3cc0f1 instanceof Error)return new FailedListIdentityResponse({'detail':_0x3cc0f1['message'],'title':_0x3cc0f1['name'],'status':0x1f4,'instance':'','type':''});throw _0x3cc0f1;}});}['delete'](_0x2bd52a,_0x3dd9b4,_0x5e9538){return __awaiter$3(this,void 0,void 0,function*(){const _0x540ca='List/'+_0x2bd52a+'/'+_0x3dd9b4,_0x187558=yield this['fetch']['delete'](_0x540ca,_0x5e9538);try{if(_0x187558['status']>0xc7&&_0x187558['status']<0x12c)return new SuccessfulResponse({});const _0x5a864a=yield _0x187558['json']();return new FailedResponse(_0x5a864a);}catch(_0x2408c6){if(_0x2408c6 instanceof Error)return new FailedResponse({'detail':_0x2408c6['message'],'title':_0x2408c6['name'],'status':0x1f4,'instance':'','type':''});throw _0x2408c6;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xbe4d84,_0x4bcce8,_0x505326,_0x225f15){function _0x1c95ce(_0x542a7d){return _0x542a7d instanceof _0x505326?_0x542a7d:new _0x505326(function(_0x41f423){_0x41f423(_0x542a7d);});}return new(_0x505326||(_0x505326=Promise))(function(_0x439ab9,_0x8f84a3){function _0x1a7f3e(_0x54df4d){try{_0x266286(_0x225f15['next'](_0x54df4d));}catch(_0x39b84d){_0x8f84a3(_0x39b84d);}}function _0x4445e2(_0x435c6d){try{_0x266286(_0x225f15['throw'](_0x435c6d));}catch(_0x3bddc1){_0x8f84a3(_0x3bddc1);}}function _0x266286(_0x1bb28a){_0x1bb28a['done']?_0x439ab9(_0x1bb28a['value']):_0x1c95ce(_0x1bb28a['value'])['then'](_0x1a7f3e,_0x4445e2);}_0x266286((_0x225f15=_0x225f15['apply'](_0xbe4d84,_0x4bcce8||[]))['next']());});};class Fetch{constructor(_0x323f65){this['baseUri']=_0x323f65,this['getUrl']=_0x3879fe=>{return _0x3879fe['startsWith']('/')&&(_0x3879fe=_0x3879fe['replace']('/','')),''+this['baseUri']+_0x3879fe;},!_0x323f65['endsWith']('/')&&(_0x323f65=_0x323f65+'/');}['get'](_0x39a1f2,_0x454431){return __awaiter$2(this,void 0,void 0,function*(){const _0x19f3d3=this['getUrl'](_0x39a1f2);return yield fetch(_0x19f3d3,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x454431}});});}['post'](_0x2b904a,_0x5833dd,_0x368f05){return __awaiter$2(this,void 0,void 0,function*(){const _0x2679c0=this['getUrl'](_0x2b904a);return yield fetch(_0x2679c0,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5833dd},'body':_0x368f05?JSON['stringify'](_0x368f05):null});});}['PostNoAuth'](_0x1f862f,_0x337d1b){return __awaiter$2(this,void 0,void 0,function*(){const _0x521e34=this['getUrl'](_0x1f862f);return yield fetch(_0x521e34,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x337d1b?JSON['stringify'](_0x337d1b):null});});}['put'](_0x11e230,_0xacdd83,_0x1aa708){return __awaiter$2(this,void 0,void 0,function*(){const _0x10fb51=this['getUrl'](_0x11e230);return yield fetch(_0x10fb51,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xacdd83},'body':_0x1aa708?JSON['stringify'](_0x1aa708):null});});}['delete'](_0x4ddd4f,_0x9be57e){return __awaiter$2(this,void 0,void 0,function*(){const _0x287a33=this['getUrl'](_0x4ddd4f);return yield fetch(_0x287a33,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x9be57e}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xd28365,_0x46d8af,_0x16d274,_0x1cf27b){function _0x1d1c9d(_0x2eb5f8){return _0x2eb5f8 instanceof _0x16d274?_0x2eb5f8:new _0x16d274(function(_0x24ca8c){_0x24ca8c(_0x2eb5f8);});}return new(_0x16d274||(_0x16d274=Promise))(function(_0x1e3507,_0x3b35df){function _0x3d56b6(_0x57986b){try{_0x4dff30(_0x1cf27b['next'](_0x57986b));}catch(_0x445967){_0x3b35df(_0x445967);}}function _0x4e1eb1(_0x371fda){try{_0x4dff30(_0x1cf27b['throw'](_0x371fda));}catch(_0x4acfcc){_0x3b35df(_0x4acfcc);}}function _0x4dff30(_0x3e736e){_0x3e736e['done']?_0x1e3507(_0x3e736e['value']):_0x1d1c9d(_0x3e736e['value'])['then'](_0x3d56b6,_0x4e1eb1);}_0x4dff30((_0x1cf27b=_0x1cf27b['apply'](_0xd28365,_0x46d8af||[]))['next']());});};class SearchServersService{constructor(_0xfb75fc){this['fetch']=_0xfb75fc,this['path']='search-services';}['create'](_0x415143,_0x3fc3c8,_0x2de9b0,_0x33779b,_0x31e24f,_0x19e818,_0x37a32f,_0x1b8a55){return __awaiter$1(this,void 0,void 0,function*(){const _0x2f1455={'account_name':_0x415143,'search_service_name':_0x3fc3c8,'endpoint':_0x2de9b0,'key':_0x33779b,'country':_0x31e24f,'provider':_0x19e818,'index_name':_0x37a32f};try{const _0x5a0a98=yield this['fetch']['post'](this['path'],_0x1b8a55,_0x2f1455);if(_0x5a0a98['status']>0xc7&&_0x5a0a98['status']<0x12c){const _0x3d12b3=yield _0x5a0a98['json']();return new SuccessfulSearchServiceResponse(_0x3d12b3);}const _0x1638f0=yield _0x5a0a98['json']();return new FailedSearchServiceResponse(_0x1638f0);}catch(_0x2057b6){if(_0x2057b6 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2057b6['message'],'title':_0x2057b6['name'],'status':0x1f4,'instance':'','type':''});throw _0x2057b6;}});}['delete'](_0x5549af,_0x35079b,_0x1ced64){return __awaiter$1(this,void 0,void 0,function*(){const _0x6a5f6e=this['path']+'/'+_0x5549af+'/'+_0x35079b;try{const _0x2caf61=yield this['fetch']['delete'](_0x6a5f6e,_0x1ced64);if(_0x2caf61['status']>0xc7&&_0x2caf61['status']<0x12c)return new SuccessfulResponse({});const _0x469eaa=yield _0x2caf61['json']();return new FailedResponse(_0x469eaa);}catch(_0x14c895){if(_0x14c895 instanceof Error)return new FailedResponse({'detail':_0x14c895['message'],'title':_0x14c895['name'],'status':0x1f4,'instance':'','type':''});throw _0x14c895;}});}['view'](_0x4a4ee8,_0x9c3ab5,_0x421cc9){return __awaiter$1(this,void 0,void 0,function*(){const _0x352364=this['path']+'/'+_0x4a4ee8+'/'+_0x9c3ab5;try{const _0x557e39=yield this['fetch']['get'](_0x352364,_0x421cc9);if(_0x557e39['status']>0xc7&&_0x557e39['status']<0x12c){const _0x409f45=yield _0x557e39['json']();return new SuccessfulViewSearchServiceResponse(_0x409f45);}const _0x14a27a=yield _0x557e39['json']();return new FailedViewSearchServiceResponse(_0x14a27a);}catch(_0x13a041){if(_0x13a041 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x13a041['message'],'title':_0x13a041['name'],'status':0x1f4,'instance':'','type':''});throw _0x13a041;}});}['edit'](_0x1aa7bd,_0x4496d0,_0x482c9f,_0x3ded2f,_0x4a06e6,_0x332f83){return __awaiter$1(this,void 0,void 0,function*(){const _0x23e650={'account_name':_0x1aa7bd,'search_service_name':_0x4496d0,'new_search_service_name':_0x482c9f,'key':_0x3ded2f,'country':_0x4a06e6};try{const _0x26d9d3=yield this['fetch']['put'](this['path'],_0x332f83,_0x23e650);if(_0x26d9d3['status']>0xc7&&_0x26d9d3['status']<0x12c){const _0xf5cecc=yield _0x26d9d3['json']();return new SuccessfulSearchServiceResponse(_0xf5cecc);}const _0x33e20c=yield _0x26d9d3['json']();return new FailedSearchServiceResponse(_0x33e20c);}catch(_0x2d148f){if(_0x2d148f instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2d148f['message'],'title':_0x2d148f['name'],'status':0x1f4,'instance':'','type':''});throw _0x2d148f;}});}['list'](_0x29f883,_0x5f2567){return __awaiter$1(this,void 0,void 0,function*(){const _0x27de72=this['path']+'/'+_0x29f883;try{const _0x309531=yield this['fetch']['get'](_0x27de72,_0x5f2567);if(_0x309531['status']>0xc7&&_0x309531['status']<0x12c){const _0x3ed655=yield _0x309531['json']();return new SuccessfulListSearchServiceResponse(_0x3ed655);}const _0x3096f4=yield _0x309531['json']();return new FailedViewSearchServicesResponse(_0x3096f4);}catch(_0x486c3d){if(_0x486c3d instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x486c3d['message'],'title':_0x486c3d['name'],'status':0x1f4,'instance':'','type':''});throw _0x486c3d;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x33f109,_0x320004,_0x1de34a,_0x5af53b){function _0x4058aa(_0x4fc652){return _0x4fc652 instanceof _0x1de34a?_0x4fc652:new _0x1de34a(function(_0x25e3bb){_0x25e3bb(_0x4fc652);});}return new(_0x1de34a||(_0x1de34a=Promise))(function(_0xb45fde,_0x21b07b){function _0x15dd82(_0x313c41){try{_0x52c8c9(_0x5af53b['next'](_0x313c41));}catch(_0x52e114){_0x21b07b(_0x52e114);}}function _0x212e9d(_0x46d4ce){try{_0x52c8c9(_0x5af53b['throw'](_0x46d4ce));}catch(_0x4d4dad){_0x21b07b(_0x4d4dad);}}function _0x52c8c9(_0x51810c){_0x51810c['done']?_0xb45fde(_0x51810c['value']):_0x4058aa(_0x51810c['value'])['then'](_0x15dd82,_0x212e9d);}_0x52c8c9((_0x5af53b=_0x5af53b['apply'](_0x33f109,_0x320004||[]))['next']());});};class AdminClient{constructor(_0x2092dc='https://admin.searchability.dev/'){var _0x436d55=new Fetch(_0x2092dc);this['Accounts']=new AccountService(_0x436d55),this['Lists']=new ListService(_0x436d55),this['ApiKeys']=new ApiKeyService(_0x436d55),this['SearchServices']=new SearchServersService(_0x436d55);}}class AuthClient{constructor(_0x57fc74='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x57fc74);}['login'](_0x3f0da6){return __awaiter(this,void 0,void 0,function*(){const _0x33b375='login/'+_0x3f0da6;try{const _0x455a9d=yield yield fetch(_0x33b375);if(_0x455a9d['status']>0xc7&&_0x455a9d['status']<0x12c){const _0x3d69b6=yield _0x455a9d['json']();return new SuccessfulAuthResponse(_0x3d69b6);}const _0x89b6f8=yield _0x455a9d['json']();return new FailedAuthResponse(_0x89b6f8);}catch(_0x3d7efe){if(_0x3d7efe instanceof Error)return new FailedAuthResponse({'detail':_0x3d7efe['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3d7efe;}});}['refresh'](_0x5882b6){return __awaiter(this,void 0,void 0,function*(){const _0x4b3c1d='refresh',_0x4367f0={'refresh_token':_0x5882b6};try{const _0x343902=yield this['fetch']['PostNoAuth'](_0x4b3c1d,_0x4367f0);if(_0x343902['status']>0xc7&&_0x343902['status']<0x12c){const _0x2438fd=yield _0x343902['json']();return new SuccessfulAuthResponse(_0x2438fd);}const _0xf5cc44=yield _0x343902['json']();return new FailedAuthResponse(_0xf5cc44);}catch(_0x288d21){if(_0x288d21 instanceof Error)return new FailedAuthResponse({'detail':_0x288d21['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x288d21;}});}['getTokenStatus'](_0x474292){if(Date['now']()<_0x474292['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x474292['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x5bf23a){_0x5bf23a[_0x5bf23a['Ok']=0x0]='Ok',_0x5bf23a[_0x5bf23a['Refresh']=0x1]='Refresh',_0x5bf23a[_0x5bf23a['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(_0x403bf3){this['isSuccess']=_0x403bf3;}}class SuccessfulAccountResponse extends Response{constructor(_0x30fe18){super(!![]),this['account']=_0x30fe18;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x19a385){super(!![]),this['list']=_0x19a385;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x5c7ba1){super(![]),this['problem']=_0x5c7ba1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x6f5502){super(![]),this['problem']=_0x6f5502;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x31b91b){super(!![]),this['tokens']=_0x31b91b;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x22a145){super(![]),this['problem']=_0x22a145;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x547246){super(!![]),this['apiKey']=_0x547246;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x20e443){super(![]),this['problem']=_0x20e443;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x614eeb){super(!![]),this['searchService']=_0x614eeb;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x5653fb){super(![]),this['problem']=_0x5653fb;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x557d70){super(!![]),this['searchService']=_0x557d70;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x2917e7){super(!![]),this['searchServices']=_0x2917e7;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x49b613){super(![]),this['problem']=_0x49b613;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x3da34a){super(![]),this['problem']=_0x3da34a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x54fb70){super(!![]),this['apiKeyValue']=_0x54fb70;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x4dbdd5){super(!![]),this['obj']=_0x4dbdd5;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x4f9a49){super(![]),this['problem']=_0x4f9a49;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x21608c){super(![]),this['problem']=_0x21608c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x426fdd,_0x18024e,_0x5acbce,_0x46860b){function _0x4d3a0b(_0x542b22){return _0x542b22 instanceof _0x5acbce?_0x542b22:new _0x5acbce(function(_0x579edd){_0x579edd(_0x542b22);});}return new(_0x5acbce||(_0x5acbce=Promise))(function(_0x1cb9a1,_0x1d3941){function _0x8ac3ca(_0x5a554d){try{_0x2361b0(_0x46860b['next'](_0x5a554d));}catch(_0x1283d4){_0x1d3941(_0x1283d4);}}function _0x10d235(_0x469216){try{_0x2361b0(_0x46860b['throw'](_0x469216));}catch(_0x4b578c){_0x1d3941(_0x4b578c);}}function _0x2361b0(_0x161464){_0x161464['done']?_0x1cb9a1(_0x161464['value']):_0x4d3a0b(_0x161464['value'])['then'](_0x8ac3ca,_0x10d235);}_0x2361b0((_0x46860b=_0x46860b['apply'](_0x426fdd,_0x18024e||[]))['next']());});};class AccountService{constructor(_0x4ff6f9){this['fetch']=_0x4ff6f9;}['get'](_0x37a154,_0x2c9f7a){return __awaiter$5(this,void 0,void 0,function*(){const _0x30a9fc='Account/'+_0x37a154+'/',_0x26a662=yield this['fetch']['get'](_0x30a9fc,_0x2c9f7a);try{if(_0x26a662['status']>0xc7&&_0x26a662['status']<0x12c){const _0x3e0d20=yield _0x26a662['json']();return new SuccessfulAccountResponse(_0x3e0d20);}const _0x933404=yield _0x26a662['json']();return new FailedAccountResponse(_0x933404);}catch(_0x21694b){if(_0x21694b instanceof Error)return new FailedAccountResponse({'detail':_0x21694b['message'],'title':_0x21694b['name'],'status':0x1f4,'instance':'','type':''});throw _0x21694b;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2628a7,_0x4a39f9,_0x33e16a,_0x516753){function _0x5ae7e5(_0x152f37){return _0x152f37 instanceof _0x33e16a?_0x152f37:new _0x33e16a(function(_0x3b7d44){_0x3b7d44(_0x152f37);});}return new(_0x33e16a||(_0x33e16a=Promise))(function(_0x59c9be,_0x1dc615){function _0x465fb9(_0x5db7b1){try{_0x1ef6c9(_0x516753['next'](_0x5db7b1));}catch(_0x4de645){_0x1dc615(_0x4de645);}}function _0x4126a1(_0x53912e){try{_0x1ef6c9(_0x516753['throw'](_0x53912e));}catch(_0x34a12f){_0x1dc615(_0x34a12f);}}function _0x1ef6c9(_0x3f8ba8){_0x3f8ba8['done']?_0x59c9be(_0x3f8ba8['value']):_0x5ae7e5(_0x3f8ba8['value'])['then'](_0x465fb9,_0x4126a1);}_0x1ef6c9((_0x516753=_0x516753['apply'](_0x2628a7,_0x4a39f9||[]))['next']());});};class ApiKeyService{constructor(_0x51c981){this['fetch']=_0x51c981,this['path']='api-key';}['create'](_0x1e7d87,_0x1d6b0c,_0xd7d218){return __awaiter$4(this,void 0,void 0,function*(){const _0x513692={'account_name':_0x1e7d87,'api_key_name':_0x1d6b0c};try{const _0x441418=yield this['fetch']['post'](this['path'],_0xd7d218,_0x513692);if(_0x441418['status']>0xc7&&_0x441418['status']<0x12c){const _0x3ede90=yield _0x441418['json']();return new SuccessfulApiKeyResponse(_0x3ede90);}const _0x4437f6=yield _0x441418['json']();return new FailedApiKeyResponse(_0x4437f6);}catch(_0x19ed73){if(_0x19ed73 instanceof Error)return new FailedApiKeyResponse({'detail':_0x19ed73['message'],'title':_0x19ed73['name'],'status':0x1f4,'instance':'','type':''});throw _0x19ed73;}});}['view'](_0x2de4ff,_0x40b3d0,_0x558c63){return __awaiter$4(this,void 0,void 0,function*(){const _0x23acf6=this['path']+'/'+_0x2de4ff+'/'+_0x40b3d0;try{const _0xb3dcd9=yield this['fetch']['get'](_0x23acf6,_0x558c63);if(_0xb3dcd9['status']>0xc7&&_0xb3dcd9['status']<0x12c){const _0xe192df=yield _0xb3dcd9['json']();return new SuccessfulApiKeyValueResponse(_0xe192df);}const _0x2c43b4=yield _0xb3dcd9['json']();return new FailedApiKeyValueResponse(_0x2c43b4);}catch(_0x567b46){if(_0x567b46 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x567b46['message'],'title':_0x567b46['name'],'status':0x1f4,'instance':'','type':''});throw _0x567b46;}});}['delete'](_0x19576e,_0x572edb,_0x4e58af){return __awaiter$4(this,void 0,void 0,function*(){const _0x3c90f5=this['path']+'/'+_0x19576e+'/'+_0x572edb;try{const _0x26f56c=yield this['fetch']['delete'](_0x3c90f5,_0x4e58af);if(_0x26f56c['status']>0xc7&&_0x26f56c['status']<0x12c)return new SuccessfulResponse({});const _0x2c3bc5=yield _0x26f56c['json']();return new FailedResponse(_0x2c3bc5);}catch(_0x2a3845){if(_0x2a3845 instanceof Error)return new FailedResponse({'detail':_0x2a3845['message'],'title':_0x2a3845['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a3845;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x46d336,_0x19b172,_0x6deb43,_0x2da2d1){function _0x3893d1(_0x41a6a5){return _0x41a6a5 instanceof _0x6deb43?_0x41a6a5:new _0x6deb43(function(_0x3a49c6){_0x3a49c6(_0x41a6a5);});}return new(_0x6deb43||(_0x6deb43=Promise))(function(_0x3f6a30,_0xbf5778){function _0x4362fa(_0x2a21c6){try{_0x13f970(_0x2da2d1['next'](_0x2a21c6));}catch(_0x37e6e4){_0xbf5778(_0x37e6e4);}}function _0x3510b4(_0x475111){try{_0x13f970(_0x2da2d1['throw'](_0x475111));}catch(_0xed24d7){_0xbf5778(_0xed24d7);}}function _0x13f970(_0x3a21ae){_0x3a21ae['done']?_0x3f6a30(_0x3a21ae['value']):_0x3893d1(_0x3a21ae['value'])['then'](_0x4362fa,_0x3510b4);}_0x13f970((_0x2da2d1=_0x2da2d1['apply'](_0x46d336,_0x19b172||[]))['next']());});};class ListService{constructor(_0x19bff6){this['fetch']=_0x19bff6;}['add'](_0x59cf08,_0x3b576d,_0x4e3be3,_0x112481){return __awaiter$3(this,void 0,void 0,function*(){const _0x536b5d='List',_0xe83b67={'account_name':_0x59cf08,'list_name':_0x3b576d,'search_service_name':_0x4e3be3};try{const _0x2a38a8=yield this['fetch']['post'](_0x536b5d,_0x112481,_0xe83b67);if(_0x2a38a8['status']>0xc7&&_0x2a38a8['status']<0x12c){const _0x19998b=yield _0x2a38a8['json']();return new SuccessfulListIdentityResponse(_0x19998b);}const _0x4848ea=yield _0x2a38a8['json']();return new FailedListIdentityResponse(_0x4848ea);}catch(_0x3c3762){if(_0x3c3762 instanceof Error)return new FailedListIdentityResponse({'detail':_0x3c3762['message'],'title':_0x3c3762['name'],'status':0x1f4,'instance':'','type':''});throw _0x3c3762;}});}['delete'](_0x4de0f8,_0x462076,_0x55909b){return __awaiter$3(this,void 0,void 0,function*(){const _0x49a659='List/'+_0x4de0f8+'/'+_0x462076,_0x529777=yield this['fetch']['delete'](_0x49a659,_0x55909b);try{if(_0x529777['status']>0xc7&&_0x529777['status']<0x12c)return new SuccessfulResponse({});const _0x14a8e5=yield _0x529777['json']();return new FailedResponse(_0x14a8e5);}catch(_0x5cc288){if(_0x5cc288 instanceof Error)return new FailedResponse({'detail':_0x5cc288['message'],'title':_0x5cc288['name'],'status':0x1f4,'instance':'','type':''});throw _0x5cc288;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5958c7,_0x11cbbc,_0x551125,_0x28a7ea){function _0x15fda8(_0x464047){return _0x464047 instanceof _0x551125?_0x464047:new _0x551125(function(_0x38902e){_0x38902e(_0x464047);});}return new(_0x551125||(_0x551125=Promise))(function(_0x6088e5,_0x55fd0c){function _0x1fea6f(_0x32a268){try{_0x3f54bb(_0x28a7ea['next'](_0x32a268));}catch(_0x2710ef){_0x55fd0c(_0x2710ef);}}function _0x5daaa3(_0x1bdcce){try{_0x3f54bb(_0x28a7ea['throw'](_0x1bdcce));}catch(_0x55e6ba){_0x55fd0c(_0x55e6ba);}}function _0x3f54bb(_0x333cf4){_0x333cf4['done']?_0x6088e5(_0x333cf4['value']):_0x15fda8(_0x333cf4['value'])['then'](_0x1fea6f,_0x5daaa3);}_0x3f54bb((_0x28a7ea=_0x28a7ea['apply'](_0x5958c7,_0x11cbbc||[]))['next']());});};class Fetch{constructor(_0x26653f){this['baseUri']=_0x26653f,this['getUrl']=_0x255924=>{return _0x255924['startsWith']('/')&&(_0x255924=_0x255924['replace']('/','')),''+this['baseUri']+_0x255924;},!_0x26653f['endsWith']('/')&&(_0x26653f=_0x26653f+'/');}['get'](_0x121c6a,_0x26b474){return __awaiter$2(this,void 0,void 0,function*(){const _0x458461=this['getUrl'](_0x121c6a);return yield fetch(_0x458461,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x26b474}});});}['post'](_0x374aa8,_0x362d66,_0x64df8a){return __awaiter$2(this,void 0,void 0,function*(){const _0x49da01=this['getUrl'](_0x374aa8);return yield fetch(_0x49da01,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x362d66},'body':_0x64df8a?JSON['stringify'](_0x64df8a):null});});}['PostNoAuth'](_0x425883,_0x5e06bd){return __awaiter$2(this,void 0,void 0,function*(){const _0x406a6=this['getUrl'](_0x425883);return yield fetch(_0x406a6,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5e06bd?JSON['stringify'](_0x5e06bd):null});});}['put'](_0x410621,_0x5203e8,_0x39a0bc){return __awaiter$2(this,void 0,void 0,function*(){const _0x4e5aac=this['getUrl'](_0x410621);return yield fetch(_0x4e5aac,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5203e8},'body':_0x39a0bc?JSON['stringify'](_0x39a0bc):null});});}['delete'](_0x32c963,_0x5eb421){return __awaiter$2(this,void 0,void 0,function*(){const _0x449bf6=this['getUrl'](_0x32c963);return yield fetch(_0x449bf6,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5eb421}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3be3cb,_0x54f128,_0x4184c3,_0x521697){function _0x2034d4(_0x5073dd){return _0x5073dd instanceof _0x4184c3?_0x5073dd:new _0x4184c3(function(_0x1e3e2f){_0x1e3e2f(_0x5073dd);});}return new(_0x4184c3||(_0x4184c3=Promise))(function(_0xdf24c6,_0x2d178a){function _0x2348c5(_0x1a0f26){try{_0x37d1dc(_0x521697['next'](_0x1a0f26));}catch(_0x3bf3cc){_0x2d178a(_0x3bf3cc);}}function _0x27c804(_0x580ebb){try{_0x37d1dc(_0x521697['throw'](_0x580ebb));}catch(_0xae94){_0x2d178a(_0xae94);}}function _0x37d1dc(_0x1f00f2){_0x1f00f2['done']?_0xdf24c6(_0x1f00f2['value']):_0x2034d4(_0x1f00f2['value'])['then'](_0x2348c5,_0x27c804);}_0x37d1dc((_0x521697=_0x521697['apply'](_0x3be3cb,_0x54f128||[]))['next']());});};class SearchServersService{constructor(_0x4326f5){this['fetch']=_0x4326f5,this['path']='search-services';}['create'](_0x38690d,_0x3a5162,_0x2f1f73,_0x2266b7,_0x33c1f3,_0x2945b1,_0x584f9f,_0xbb8dc0){return __awaiter$1(this,void 0,void 0,function*(){const _0xe4d01a={'account_name':_0x38690d,'search_service_name':_0x3a5162,'endpoint':_0x2f1f73,'key':_0x2266b7,'country':_0x33c1f3,'provider':_0x2945b1,'index_name':_0x584f9f};try{const _0x299256=yield this['fetch']['post'](this['path'],_0xbb8dc0,_0xe4d01a);if(_0x299256['status']>0xc7&&_0x299256['status']<0x12c){const _0x1dc298=yield _0x299256['json']();return new SuccessfulSearchServiceResponse(_0x1dc298);}const _0x607c7f=yield _0x299256['json']();return new FailedSearchServiceResponse(_0x607c7f);}catch(_0x3f7ac5){if(_0x3f7ac5 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x3f7ac5['message'],'title':_0x3f7ac5['name'],'status':0x1f4,'instance':'','type':''});throw _0x3f7ac5;}});}['delete'](_0x3a38b6,_0x2b47af,_0x48a8c6){return __awaiter$1(this,void 0,void 0,function*(){const _0x170020=this['path']+'/'+_0x3a38b6+'/'+_0x2b47af;try{const _0x22d081=yield this['fetch']['delete'](_0x170020,_0x48a8c6);if(_0x22d081['status']>0xc7&&_0x22d081['status']<0x12c)return new SuccessfulResponse({});const _0x191c7b=yield _0x22d081['json']();return new FailedResponse(_0x191c7b);}catch(_0x2e204a){if(_0x2e204a instanceof Error)return new FailedResponse({'detail':_0x2e204a['message'],'title':_0x2e204a['name'],'status':0x1f4,'instance':'','type':''});throw _0x2e204a;}});}['view'](_0x31e0da,_0x10dba5,_0x336226){return __awaiter$1(this,void 0,void 0,function*(){const _0x11182b=this['path']+'/'+_0x31e0da+'/'+_0x10dba5;try{const _0x40e951=yield this['fetch']['get'](_0x11182b,_0x336226);if(_0x40e951['status']>0xc7&&_0x40e951['status']<0x12c){const _0x3ea21f=yield _0x40e951['json']();return new SuccessfulViewSearchServiceResponse(_0x3ea21f);}const _0x13963d=yield _0x40e951['json']();return new FailedViewSearchServiceResponse(_0x13963d);}catch(_0x22d38b){if(_0x22d38b instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x22d38b['message'],'title':_0x22d38b['name'],'status':0x1f4,'instance':'','type':''});throw _0x22d38b;}});}['edit'](_0x2438a2,_0x5d7fc7,_0x18d25c,_0x480085,_0x16e29f,_0x17280e){return __awaiter$1(this,void 0,void 0,function*(){const _0x490874={'account_name':_0x2438a2,'search_service_name':_0x5d7fc7,'new_search_service_name':_0x18d25c,'key':_0x480085,'country':_0x16e29f};try{const _0x2f09ee=yield this['fetch']['put'](this['path'],_0x17280e,_0x490874);if(_0x2f09ee['status']>0xc7&&_0x2f09ee['status']<0x12c){const _0x4209da=yield _0x2f09ee['json']();return new SuccessfulSearchServiceResponse(_0x4209da);}const _0x12a0be=yield _0x2f09ee['json']();return new FailedSearchServiceResponse(_0x12a0be);}catch(_0x1550b9){if(_0x1550b9 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1550b9['message'],'title':_0x1550b9['name'],'status':0x1f4,'instance':'','type':''});throw _0x1550b9;}});}['list'](_0x34fae9,_0x32c252){return __awaiter$1(this,void 0,void 0,function*(){const _0x2e2829=this['path']+'/'+_0x34fae9;try{const _0x10193d=yield this['fetch']['get'](_0x2e2829,_0x32c252);if(_0x10193d['status']>0xc7&&_0x10193d['status']<0x12c){const _0x101251=yield _0x10193d['json']();return new SuccessfulListSearchServiceResponse(_0x101251);}const _0x58145a=yield _0x10193d['json']();return new FailedViewSearchServicesResponse(_0x58145a);}catch(_0x64f3d3){if(_0x64f3d3 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x64f3d3['message'],'title':_0x64f3d3['name'],'status':0x1f4,'instance':'','type':''});throw _0x64f3d3;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0xa7788f,_0x664f5f,_0x55e5d3,_0xf04eac){function _0x734ca8(_0x3f1099){return _0x3f1099 instanceof _0x55e5d3?_0x3f1099:new _0x55e5d3(function(_0x115397){_0x115397(_0x3f1099);});}return new(_0x55e5d3||(_0x55e5d3=Promise))(function(_0x46ebaa,_0x57e051){function _0x5b3946(_0x327f40){try{_0x133251(_0xf04eac['next'](_0x327f40));}catch(_0x399e9e){_0x57e051(_0x399e9e);}}function _0x50cd68(_0x206365){try{_0x133251(_0xf04eac['throw'](_0x206365));}catch(_0x2fdbcb){_0x57e051(_0x2fdbcb);}}function _0x133251(_0x340a07){_0x340a07['done']?_0x46ebaa(_0x340a07['value']):_0x734ca8(_0x340a07['value'])['then'](_0x5b3946,_0x50cd68);}_0x133251((_0xf04eac=_0xf04eac['apply'](_0xa7788f,_0x664f5f||[]))['next']());});};class AdminClient{constructor(_0xdf0045='https://admin.searchability.dev/'){var _0x299dbc=new Fetch(_0xdf0045);this['Accounts']=new AccountService(_0x299dbc),this['Lists']=new ListService(_0x299dbc),this['ApiKeys']=new ApiKeyService(_0x299dbc),this['SearchServices']=new SearchServersService(_0x299dbc);}}class AuthClient{constructor(_0x55b6b8='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x55b6b8);}['login'](_0x2f647a){return __awaiter(this,void 0,void 0,function*(){const _0x360020='login/'+_0x2f647a;try{const _0x4c0293=yield yield fetch(_0x360020);if(_0x4c0293['status']>0xc7&&_0x4c0293['status']<0x12c){const _0x109b06=yield _0x4c0293['json']();return new SuccessfulAuthResponse(_0x109b06);}const _0x130aa3=yield _0x4c0293['json']();return new FailedAuthResponse(_0x130aa3);}catch(_0x56d12f){if(_0x56d12f instanceof Error)return new FailedAuthResponse({'detail':_0x56d12f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x56d12f;}});}['refresh'](_0x3c16ea){return __awaiter(this,void 0,void 0,function*(){const _0x41d0db='refresh',_0x5a2ee1={'refresh_token':_0x3c16ea};try{const _0xf125d3=yield this['fetch']['PostNoAuth'](_0x41d0db,_0x5a2ee1);if(_0xf125d3['status']>0xc7&&_0xf125d3['status']<0x12c){const _0xeb09aa=yield _0xf125d3['json']();return new SuccessfulAuthResponse(_0xeb09aa);}const _0x756833=yield _0xf125d3['json']();return new FailedAuthResponse(_0x756833);}catch(_0x4ab1f8){if(_0x4ab1f8 instanceof Error)return new FailedAuthResponse({'detail':_0x4ab1f8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ab1f8;}});}['getTokenStatus'](_0x1d9f21){if(Date['now']()<_0x1d9f21['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x1d9f21['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|