@searchability/admin-client 0.0.50 → 0.0.51
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(_0x3a3c61){_0x3a3c61[_0x3a3c61['Ok']=0x0]='Ok',_0x3a3c61[_0x3a3c61['Refresh']=0x1]='Refresh',_0x3a3c61[_0x3a3c61['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(_0x4cb7cc){this['isSuccess']=_0x4cb7cc;}}class SuccessfulAccountResponse extends Response{constructor(_0x15df36){super(!![]),this['account']=_0x15df36;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x168c68){super(!![]),this['list']=_0x168c68;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x372633){super(![]),this['problem']=_0x372633;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x52e1b8){super(![]),this['problem']=_0x52e1b8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x24dc79){super(!![]),this['tokens']=_0x24dc79;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x33eaf5){super(![]),this['problem']=_0x33eaf5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x318ac0){super(!![]),this['apiKey']=_0x318ac0;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x28ccd7){super(![]),this['problem']=_0x28ccd7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x9b657d){super(!![]),this['searchService']=_0x9b657d;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x3c9326){super(![]),this['problem']=_0x3c9326;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x1f59b2){super(!![]),this['searchService']=_0x1f59b2;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x136616){super(!![]),this['searchServices']=_0x136616;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x4431bd){super(![]),this['problem']=_0x4431bd;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1d5ba3){super(![]),this['problem']=_0x1d5ba3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x22d012){super(!![]),this['apiKeyValue']=_0x22d012;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x29fe10){super(!![]),this['obj']=_0x29fe10;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x123454){super(![]),this['problem']=_0x123454;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x18a617){super(![]),this['problem']=_0x18a617;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x41dc50,_0x1e6d53,_0x118ca2,_0x8091ff){function _0x12c9c8(_0x59a04){return _0x59a04 instanceof _0x118ca2?_0x59a04:new _0x118ca2(function(_0x539b90){_0x539b90(_0x59a04);});}return new(_0x118ca2||(_0x118ca2=Promise))(function(_0x5b1046,_0x3ccf53){function _0x477aae(_0x50ae3b){try{_0x45cf35(_0x8091ff['next'](_0x50ae3b));}catch(_0x2db49d){_0x3ccf53(_0x2db49d);}}function _0x2f98a9(_0x33420c){try{_0x45cf35(_0x8091ff['throw'](_0x33420c));}catch(_0x27423f){_0x3ccf53(_0x27423f);}}function _0x45cf35(_0x3f43a3){_0x3f43a3['done']?_0x5b1046(_0x3f43a3['value']):_0x12c9c8(_0x3f43a3['value'])['then'](_0x477aae,_0x2f98a9);}_0x45cf35((_0x8091ff=_0x8091ff['apply'](_0x41dc50,_0x1e6d53||[]))['next']());});};class AccountService{constructor(_0x490fff){this['fetch']=_0x490fff;}['get'](_0x33d833,_0xa1708c){return __awaiter$5(this,void 0,void 0,function*(){const _0x5b7ed8='Account/'+_0x33d833+'/',_0x179676=yield this['fetch']['get'](_0x5b7ed8,_0xa1708c);try{if(_0x179676['status']>0xc7&&_0x179676['status']<0x12c){const _0x52b299=yield _0x179676['json']();return new SuccessfulAccountResponse(_0x52b299);}const _0x1cbd50=yield _0x179676['json']();return new FailedAccountResponse(_0x1cbd50);}catch(_0x1bfd2b){if(_0x1bfd2b instanceof Error)return new FailedAccountResponse({'detail':_0x1bfd2b['message'],'title':_0x1bfd2b['name'],'status':0x1f4,'instance':'','type':''});throw _0x1bfd2b;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4240c9,_0x4e13e1,_0xde722a,_0x4ba40c){function _0x11e859(_0x47b648){return _0x47b648 instanceof _0xde722a?_0x47b648:new _0xde722a(function(_0x2fb42a){_0x2fb42a(_0x47b648);});}return new(_0xde722a||(_0xde722a=Promise))(function(_0x6d089a,_0x59fac0){function _0x16c82f(_0x4d2581){try{_0xcf71f(_0x4ba40c['next'](_0x4d2581));}catch(_0x8490ac){_0x59fac0(_0x8490ac);}}function _0x4fb2cb(_0x4a8eed){try{_0xcf71f(_0x4ba40c['throw'](_0x4a8eed));}catch(_0x72fa0d){_0x59fac0(_0x72fa0d);}}function _0xcf71f(_0x3fcc58){_0x3fcc58['done']?_0x6d089a(_0x3fcc58['value']):_0x11e859(_0x3fcc58['value'])['then'](_0x16c82f,_0x4fb2cb);}_0xcf71f((_0x4ba40c=_0x4ba40c['apply'](_0x4240c9,_0x4e13e1||[]))['next']());});};class ApiKeyService{constructor(_0x15857f){this['fetch']=_0x15857f,this['path']='api-key';}['create'](_0x43d1f7,_0x371d1d,_0x2a10c8){return __awaiter$4(this,void 0,void 0,function*(){const _0xa045da={'account_name':_0x43d1f7,'api_key_name':_0x371d1d};try{const _0x25b02a=yield this['fetch']['post'](this['path'],_0x2a10c8,_0xa045da);if(_0x25b02a['status']>0xc7&&_0x25b02a['status']<0x12c){const _0x519910=yield _0x25b02a['json']();return new SuccessfulApiKeyResponse(_0x519910);}const _0x52eaa3=yield _0x25b02a['json']();return new FailedApiKeyResponse(_0x52eaa3);}catch(_0x551823){if(_0x551823 instanceof Error)return new FailedApiKeyResponse({'detail':_0x551823['message'],'title':_0x551823['name'],'status':0x1f4,'instance':'','type':''});throw _0x551823;}});}['view'](_0x1bfecd,_0x3fbc98,_0x1ef69b){return __awaiter$4(this,void 0,void 0,function*(){const _0x29c5cc=this['path']+'/'+_0x1bfecd+'/'+_0x3fbc98;try{const _0xb24d1b=yield this['fetch']['get'](_0x29c5cc,_0x1ef69b);if(_0xb24d1b['status']>0xc7&&_0xb24d1b['status']<0x12c){const _0x1bd15a=yield _0xb24d1b['json']();return new SuccessfulApiKeyValueResponse(_0x1bd15a);}const _0x599031=yield _0xb24d1b['json']();return new FailedApiKeyValueResponse(_0x599031);}catch(_0x1e9aa0){if(_0x1e9aa0 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x1e9aa0['message'],'title':_0x1e9aa0['name'],'status':0x1f4,'instance':'','type':''});throw _0x1e9aa0;}});}['delete'](_0x39dac5,_0x5aa382,_0x53aae2){return __awaiter$4(this,void 0,void 0,function*(){const _0x211648=this['path']+'/'+_0x39dac5+'/'+_0x5aa382;try{const _0x1fbf1c=yield this['fetch']['delete'](_0x211648,_0x53aae2);if(_0x1fbf1c['status']>0xc7&&_0x1fbf1c['status']<0x12c)return new SuccessfulResponse({});const _0x10e2be=yield _0x1fbf1c['json']();return new FailedResponse(_0x10e2be);}catch(_0x3de8b8){if(_0x3de8b8 instanceof Error)return new FailedResponse({'detail':_0x3de8b8['message'],'title':_0x3de8b8['name'],'status':0x1f4,'instance':'','type':''});throw _0x3de8b8;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x43a57b,_0x520d4e,_0x83fa6,_0xfd87ff){function _0x19ab47(_0x381508){return _0x381508 instanceof _0x83fa6?_0x381508:new _0x83fa6(function(_0x480a05){_0x480a05(_0x381508);});}return new(_0x83fa6||(_0x83fa6=Promise))(function(_0x196e9f,_0x558811){function _0x1d8e2d(_0x2bbac3){try{_0x786d43(_0xfd87ff['next'](_0x2bbac3));}catch(_0x4d2bd4){_0x558811(_0x4d2bd4);}}function _0x12c2a9(_0x2cf742){try{_0x786d43(_0xfd87ff['throw'](_0x2cf742));}catch(_0x14080d){_0x558811(_0x14080d);}}function _0x786d43(_0x4c5a75){_0x4c5a75['done']?_0x196e9f(_0x4c5a75['value']):_0x19ab47(_0x4c5a75['value'])['then'](_0x1d8e2d,_0x12c2a9);}_0x786d43((_0xfd87ff=_0xfd87ff['apply'](_0x43a57b,_0x520d4e||[]))['next']());});};class ListService{constructor(_0x96eac8){this['fetch']=_0x96eac8;}['add'](_0x519675,_0x2fc79a,_0x47fb4a,_0x2b49ae){return __awaiter$3(this,void 0,void 0,function*(){const _0x16299f='List',_0x134376={'account_name':_0x519675,'list_name':_0x2fc79a,'search_service_name':_0x47fb4a};try{const _0x445d59=yield this['fetch']['post'](_0x16299f,_0x2b49ae,_0x134376);if(_0x445d59['status']>0xc7&&_0x445d59['status']<0x12c){const _0x40a7c1=yield _0x445d59['json']();return new SuccessfulListIdentityResponse(_0x40a7c1);}const _0x5a7b90=yield _0x445d59['json']();return new FailedListIdentityResponse(_0x5a7b90);}catch(_0x18f069){if(_0x18f069 instanceof Error)return new FailedListIdentityResponse({'detail':_0x18f069['message'],'title':_0x18f069['name'],'status':0x1f4,'instance':'','type':''});throw _0x18f069;}});}['delete'](_0x474951,_0x5ac25f,_0x5053a7){return __awaiter$3(this,void 0,void 0,function*(){const _0x30a91b='List/'+_0x474951+'/'+_0x5ac25f,_0x4b84ff=yield this['fetch']['delete'](_0x30a91b,_0x5053a7);try{if(_0x4b84ff['status']>0xc7&&_0x4b84ff['status']<0x12c)return new SuccessfulResponse({});const _0x125a5f=yield _0x4b84ff['json']();return new FailedResponse(_0x125a5f);}catch(_0x278716){if(_0x278716 instanceof Error)return new FailedResponse({'detail':_0x278716['message'],'title':_0x278716['name'],'status':0x1f4,'instance':'','type':''});throw _0x278716;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5c14c5,_0x56b357,_0x4ba30,_0x34c639){function _0x432e2f(_0x189097){return _0x189097 instanceof _0x4ba30?_0x189097:new _0x4ba30(function(_0x3837e7){_0x3837e7(_0x189097);});}return new(_0x4ba30||(_0x4ba30=Promise))(function(_0x25f663,_0x6e28ac){function _0x2358b2(_0x523571){try{_0x9ec049(_0x34c639['next'](_0x523571));}catch(_0x2ec678){_0x6e28ac(_0x2ec678);}}function _0x59e990(_0x5ae4f7){try{_0x9ec049(_0x34c639['throw'](_0x5ae4f7));}catch(_0x2f7d73){_0x6e28ac(_0x2f7d73);}}function _0x9ec049(_0x3353a7){_0x3353a7['done']?_0x25f663(_0x3353a7['value']):_0x432e2f(_0x3353a7['value'])['then'](_0x2358b2,_0x59e990);}_0x9ec049((_0x34c639=_0x34c639['apply'](_0x5c14c5,_0x56b357||[]))['next']());});};class Fetch{constructor(_0x37ea83){this['baseUri']=_0x37ea83,this['getUrl']=_0x44b482=>{return _0x44b482['startsWith']('/')&&(_0x44b482=_0x44b482['replace']('/','')),''+this['baseUri']+_0x44b482;},!_0x37ea83['endsWith']('/')&&(_0x37ea83=_0x37ea83+'/');}['get'](_0x2eeb26,_0x1d76f7){return __awaiter$2(this,void 0,void 0,function*(){const _0x7bfd15=this['getUrl'](_0x2eeb26);return yield fetch(_0x7bfd15,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1d76f7}});});}['post'](_0xbe425a,_0x133004,_0xe1540b){return __awaiter$2(this,void 0,void 0,function*(){const _0x251414=this['getUrl'](_0xbe425a);return yield fetch(_0x251414,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x133004},'body':_0xe1540b?JSON['stringify'](_0xe1540b):null});});}['PostNoAuth'](_0x4491be,_0x40d9d9){return __awaiter$2(this,void 0,void 0,function*(){const _0xfe7b61=this['getUrl'](_0x4491be);return yield fetch(_0xfe7b61,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x40d9d9?JSON['stringify'](_0x40d9d9):null});});}['put'](_0x49b431,_0x53a195,_0x4dccfd){return __awaiter$2(this,void 0,void 0,function*(){const _0x192d05=this['getUrl'](_0x49b431);return yield fetch(_0x192d05,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x53a195},'body':_0x4dccfd?JSON['stringify'](_0x4dccfd):null});});}['delete'](_0x4b1810,_0xe124c7){return __awaiter$2(this,void 0,void 0,function*(){const _0x2537c1=this['getUrl'](_0x4b1810);return yield fetch(_0x2537c1,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe124c7}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x514e0c,_0x40fc3b,_0x207a93,_0x4b418f){function _0x4d6d76(_0x5b3e50){return _0x5b3e50 instanceof _0x207a93?_0x5b3e50:new _0x207a93(function(_0x296dd){_0x296dd(_0x5b3e50);});}return new(_0x207a93||(_0x207a93=Promise))(function(_0x1f817e,_0x314765){function _0x275fd3(_0x5b9cd7){try{_0x5c30a9(_0x4b418f['next'](_0x5b9cd7));}catch(_0x4a28e1){_0x314765(_0x4a28e1);}}function _0x444d6d(_0x5a3a3c){try{_0x5c30a9(_0x4b418f['throw'](_0x5a3a3c));}catch(_0x366eb5){_0x314765(_0x366eb5);}}function _0x5c30a9(_0x3f2a68){_0x3f2a68['done']?_0x1f817e(_0x3f2a68['value']):_0x4d6d76(_0x3f2a68['value'])['then'](_0x275fd3,_0x444d6d);}_0x5c30a9((_0x4b418f=_0x4b418f['apply'](_0x514e0c,_0x40fc3b||[]))['next']());});};class SearchServersService{constructor(_0x4a1d53){this['fetch']=_0x4a1d53,this['path']='search-services';}['create'](_0x4f15d3,_0x35f9e1,_0x1de1b7,_0x3acc75,_0x434b32,_0x527565,_0x1d899f,_0x53fc04){return __awaiter$1(this,void 0,void 0,function*(){const _0x405272={'account_name':_0x4f15d3,'search_service_name':_0x35f9e1,'endpoint':_0x1de1b7,'key':_0x3acc75,'country':_0x434b32,'provider':_0x527565,'index_name':_0x1d899f};try{const _0x15fe8d=yield this['fetch']['post'](this['path'],_0x53fc04,_0x405272);if(_0x15fe8d['status']>0xc7&&_0x15fe8d['status']<0x12c){const _0x3bea15=yield _0x15fe8d['json']();return new SuccessfulSearchServiceResponse(_0x3bea15);}const _0x2171b4=yield _0x15fe8d['json']();return new FailedSearchServiceResponse(_0x2171b4);}catch(_0x566ab9){if(_0x566ab9 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x566ab9['message'],'title':_0x566ab9['name'],'status':0x1f4,'instance':'','type':''});throw _0x566ab9;}});}['delete'](_0x3ebcf9,_0x5eb38d,_0x474b7d){return __awaiter$1(this,void 0,void 0,function*(){const _0x472cac=this['path']+'/'+_0x3ebcf9+'/'+_0x5eb38d;try{const _0xfd3f60=yield this['fetch']['delete'](_0x472cac,_0x474b7d);if(_0xfd3f60['status']>0xc7&&_0xfd3f60['status']<0x12c)return new SuccessfulResponse({});const _0x4fe1f7=yield _0xfd3f60['json']();return new FailedResponse(_0x4fe1f7);}catch(_0x39ce74){if(_0x39ce74 instanceof Error)return new FailedResponse({'detail':_0x39ce74['message'],'title':_0x39ce74['name'],'status':0x1f4,'instance':'','type':''});throw _0x39ce74;}});}['view'](_0x114635,_0x8983c7,_0x4c181f){return __awaiter$1(this,void 0,void 0,function*(){const _0x51e215=this['path']+'/'+_0x114635+'/'+_0x8983c7;try{const _0x4fc798=yield this['fetch']['get'](_0x51e215,_0x4c181f);if(_0x4fc798['status']>0xc7&&_0x4fc798['status']<0x12c){const _0x192f89=yield _0x4fc798['json']();return new SuccessfulViewSearchServiceResponse(_0x192f89);}const _0x32170c=yield _0x4fc798['json']();return new FailedViewSearchServiceResponse(_0x32170c);}catch(_0x45a2a1){if(_0x45a2a1 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x45a2a1['message'],'title':_0x45a2a1['name'],'status':0x1f4,'instance':'','type':''});throw _0x45a2a1;}});}['edit'](_0x3da1ed,_0x18d41c,_0xfd5b99,_0xa26064,_0x3ddbc3,_0x51e7c7){return __awaiter$1(this,void 0,void 0,function*(){const _0x43648e={'account_name':_0x3da1ed,'search_service_name':_0x18d41c,'new_search_service_name':_0xfd5b99,'key':_0xa26064,'country':_0x3ddbc3};try{const _0x31db25=yield this['fetch']['put'](this['path'],_0x51e7c7,_0x43648e);if(_0x31db25['status']>0xc7&&_0x31db25['status']<0x12c){const _0x3c3361=yield _0x31db25['json']();return new SuccessfulSearchServiceResponse(_0x3c3361);}const _0x50f005=yield _0x31db25['json']();return new FailedSearchServiceResponse(_0x50f005);}catch(_0x2a73d8){if(_0x2a73d8 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x2a73d8['message'],'title':_0x2a73d8['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a73d8;}});}['list'](_0x3bfbc6,_0x2486d8){return __awaiter$1(this,void 0,void 0,function*(){const _0x349c65=this['path']+'/'+_0x3bfbc6;try{const _0x16a15a=yield this['fetch']['get'](_0x349c65,_0x2486d8);if(_0x16a15a['status']>0xc7&&_0x16a15a['status']<0x12c){const _0x107996=yield _0x16a15a['json']();return new SuccessfulListSearchServiceResponse(_0x107996);}const _0x316ec8=yield _0x16a15a['json']();return new FailedViewSearchServicesResponse(_0x316ec8);}catch(_0x373e9a){if(_0x373e9a instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x373e9a['message'],'title':_0x373e9a['name'],'status':0x1f4,'instance':'','type':''});throw _0x373e9a;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x36bb2c,_0x5ed8f2,_0x112abe,_0x3a9465){function _0x5c1100(_0x196e79){return _0x196e79 instanceof _0x112abe?_0x196e79:new _0x112abe(function(_0x4e1494){_0x4e1494(_0x196e79);});}return new(_0x112abe||(_0x112abe=Promise))(function(_0x356577,_0x39303e){function _0x59a786(_0x3e4460){try{_0x294a86(_0x3a9465['next'](_0x3e4460));}catch(_0x5b80b3){_0x39303e(_0x5b80b3);}}function _0x1fea99(_0x276827){try{_0x294a86(_0x3a9465['throw'](_0x276827));}catch(_0x43bc0c){_0x39303e(_0x43bc0c);}}function _0x294a86(_0xed0f4f){_0xed0f4f['done']?_0x356577(_0xed0f4f['value']):_0x5c1100(_0xed0f4f['value'])['then'](_0x59a786,_0x1fea99);}_0x294a86((_0x3a9465=_0x3a9465['apply'](_0x36bb2c,_0x5ed8f2||[]))['next']());});};class AdminClient{constructor(_0x204981='https://admin.searchability.dev/'){var _0x7b9b5a=new Fetch(_0x204981);this['Accounts']=new AccountService(_0x7b9b5a),this['Lists']=new ListService(_0x7b9b5a),this['ApiKeys']=new ApiKeyService(_0x7b9b5a),this['SearchServices']=new SearchServersService(_0x7b9b5a);}}class AuthClient{constructor(_0x80cec1='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x80cec1);}['login'](_0x5d9742){return __awaiter(this,void 0,void 0,function*(){const _0x2d37b3='login/'+_0x5d9742;try{const _0x563d31=yield yield fetch(_0x2d37b3);if(_0x563d31['status']>0xc7&&_0x563d31['status']<0x12c){const _0x16eb94=yield _0x563d31['json']();return new SuccessfulAuthResponse(_0x16eb94);}const _0x1eb7e4=yield _0x563d31['json']();return new FailedAuthResponse(_0x1eb7e4);}catch(_0x462de1){if(_0x462de1 instanceof Error)return new FailedAuthResponse({'detail':_0x462de1['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x462de1;}});}['refresh'](_0xb2d835){return __awaiter(this,void 0,void 0,function*(){const _0x116a02='refresh',_0x3dcd62={'refresh_token':_0xb2d835};try{const _0x47f712=yield this['fetch']['PostNoAuth'](_0x116a02,_0x3dcd62);if(_0x47f712['status']>0xc7&&_0x47f712['status']<0x12c){const _0x5b1025=yield _0x47f712['json']();return new SuccessfulAuthResponse(_0x5b1025);}const _0x142419=yield _0x47f712['json']();return new FailedAuthResponse(_0x142419);}catch(_0x3f095e){if(_0x3f095e instanceof Error)return new FailedAuthResponse({'detail':_0x3f095e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3f095e;}});}['getTokenStatus'](_0xa17523){if(Date['now']()<_0xa17523['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0xa17523['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(_0x29dac7){_0x29dac7[_0x29dac7['Ok']=0x0]='Ok',_0x29dac7[_0x29dac7['Refresh']=0x1]='Refresh',_0x29dac7[_0x29dac7['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(_0x26480f){this['isSuccess']=_0x26480f;}}class SuccessfulAccountResponse extends Response{constructor(_0x2c3121){super(!![]),this['account']=_0x2c3121;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x6a1761){super(!![]),this['list']=_0x6a1761;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4c6aa6){super(![]),this['problem']=_0x4c6aa6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x565eb1){super(![]),this['problem']=_0x565eb1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x51c230){super(!![]),this['tokens']=_0x51c230;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0xbaf373){super(![]),this['problem']=_0xbaf373;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x572fe0){super(!![]),this['apiKey']=_0x572fe0;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x4abdbb){super(![]),this['problem']=_0x4abdbb;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x1c52e9){super(!![]),this['searchService']=_0x1c52e9;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x65975b){super(![]),this['problem']=_0x65975b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x168c94){super(!![]),this['searchService']=_0x168c94;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x46b5d2){super(!![]),this['searchServices']=_0x46b5d2;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x1619ee){super(![]),this['problem']=_0x1619ee;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x28677b){super(![]),this['problem']=_0x28677b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x53d9c7){super(!![]),this['apiKeyValue']=_0x53d9c7;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x113bec){super(!![]),this['obj']=_0x113bec;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x33afc4){super(![]),this['problem']=_0x33afc4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x2e563d){super(![]),this['problem']=_0x2e563d;}['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(_0x2871e5,_0x347d4b,_0x12beb3,_0x26ff61){function _0x24fdea(_0x47be3d){return _0x47be3d instanceof _0x12beb3?_0x47be3d:new _0x12beb3(function(_0xa07927){_0xa07927(_0x47be3d);});}return new(_0x12beb3||(_0x12beb3=Promise))(function(_0x1b96b7,_0xda8b81){function _0x5ec1f9(_0x5dfb79){try{_0x4d2cc9(_0x26ff61['next'](_0x5dfb79));}catch(_0x26214f){_0xda8b81(_0x26214f);}}function _0x17dbac(_0x5139fb){try{_0x4d2cc9(_0x26ff61['throw'](_0x5139fb));}catch(_0x1af6c0){_0xda8b81(_0x1af6c0);}}function _0x4d2cc9(_0x523371){_0x523371['done']?_0x1b96b7(_0x523371['value']):_0x24fdea(_0x523371['value'])['then'](_0x5ec1f9,_0x17dbac);}_0x4d2cc9((_0x26ff61=_0x26ff61['apply'](_0x2871e5,_0x347d4b||[]))['next']());});};class AccountService{constructor(_0x214c49){this['fetch']=_0x214c49;}['get'](_0x52ed50,_0x2c7c13){return __awaiter$5(this,void 0,void 0,function*(){const _0x2cac59='Account/'+_0x52ed50+'/',_0x214202=yield this['fetch']['get'](_0x2cac59,_0x2c7c13);try{if(_0x214202['status']>0xc7&&_0x214202['status']<0x12c){const _0xfc0d9a=yield _0x214202['json']();return new SuccessfulAccountResponse(_0xfc0d9a);}const _0x457619=yield _0x214202['json']();return new FailedAccountResponse(_0x457619);}catch(_0x2adadf){if(_0x2adadf instanceof Error)return new FailedAccountResponse({'detail':_0x2adadf['message'],'title':_0x2adadf['name'],'status':0x1f4,'instance':'','type':''});throw _0x2adadf;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x407abe,_0x300d5d,_0x35f5a1,_0x29db79){function _0x568901(_0x197e2a){return _0x197e2a instanceof _0x35f5a1?_0x197e2a:new _0x35f5a1(function(_0x529207){_0x529207(_0x197e2a);});}return new(_0x35f5a1||(_0x35f5a1=Promise))(function(_0x1e852d,_0x1d6b07){function _0x7f05c2(_0x1b79e5){try{_0x40bf66(_0x29db79['next'](_0x1b79e5));}catch(_0x3af2f5){_0x1d6b07(_0x3af2f5);}}function _0x9a2a28(_0x582e48){try{_0x40bf66(_0x29db79['throw'](_0x582e48));}catch(_0x7f1695){_0x1d6b07(_0x7f1695);}}function _0x40bf66(_0x4c4c32){_0x4c4c32['done']?_0x1e852d(_0x4c4c32['value']):_0x568901(_0x4c4c32['value'])['then'](_0x7f05c2,_0x9a2a28);}_0x40bf66((_0x29db79=_0x29db79['apply'](_0x407abe,_0x300d5d||[]))['next']());});};class ApiKeyService{constructor(_0x1b42fb){this['fetch']=_0x1b42fb,this['path']='api-key';}['create'](_0x4082fc,_0x16f34f,_0x4fc36e){return __awaiter$4(this,void 0,void 0,function*(){const _0x148e89={'account_name':_0x4082fc,'api_key_name':_0x16f34f};try{const _0x1a7ae7=yield this['fetch']['post'](this['path'],_0x4fc36e,_0x148e89);if(_0x1a7ae7['status']>0xc7&&_0x1a7ae7['status']<0x12c){const _0x41cd08=yield _0x1a7ae7['json']();return new SuccessfulApiKeyResponse(_0x41cd08);}const _0x15bbe0=yield _0x1a7ae7['json']();return new FailedApiKeyResponse(_0x15bbe0);}catch(_0x2d0d18){if(_0x2d0d18 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2d0d18['message'],'title':_0x2d0d18['name'],'status':0x1f4,'instance':'','type':''});throw _0x2d0d18;}});}['view'](_0x4d783d,_0x247613,_0x21991){return __awaiter$4(this,void 0,void 0,function*(){const _0x4b7280=this['path']+'/'+_0x4d783d+'/'+_0x247613;try{const _0x4f8d5e=yield this['fetch']['get'](_0x4b7280,_0x21991);if(_0x4f8d5e['status']>0xc7&&_0x4f8d5e['status']<0x12c){const _0x306ab1=yield _0x4f8d5e['json']();return new SuccessfulApiKeyValueResponse(_0x306ab1);}const _0x3ddd8d=yield _0x4f8d5e['json']();return new FailedApiKeyValueResponse(_0x3ddd8d);}catch(_0x35bd5c){if(_0x35bd5c instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x35bd5c['message'],'title':_0x35bd5c['name'],'status':0x1f4,'instance':'','type':''});throw _0x35bd5c;}});}['delete'](_0x9579cc,_0x215b2d,_0x4febf8){return __awaiter$4(this,void 0,void 0,function*(){const _0x5f001e=this['path']+'/'+_0x9579cc+'/'+_0x215b2d;try{const _0x1d030f=yield this['fetch']['delete'](_0x5f001e,_0x4febf8);if(_0x1d030f['status']>0xc7&&_0x1d030f['status']<0x12c)return new SuccessfulResponse({});const _0x2bc008=yield _0x1d030f['json']();return new FailedResponse(_0x2bc008);}catch(_0xd7bfda){if(_0xd7bfda instanceof Error)return new FailedResponse({'detail':_0xd7bfda['message'],'title':_0xd7bfda['name'],'status':0x1f4,'instance':'','type':''});throw _0xd7bfda;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3899c3,_0x2e1f4f,_0x58066b,_0x17aab0){function _0x26d387(_0x4a8626){return _0x4a8626 instanceof _0x58066b?_0x4a8626:new _0x58066b(function(_0x9024bb){_0x9024bb(_0x4a8626);});}return new(_0x58066b||(_0x58066b=Promise))(function(_0x4e428b,_0x9118e2){function _0x5b110c(_0x28842b){try{_0x46b60d(_0x17aab0['next'](_0x28842b));}catch(_0x689ef5){_0x9118e2(_0x689ef5);}}function _0x37a3fb(_0x313af1){try{_0x46b60d(_0x17aab0['throw'](_0x313af1));}catch(_0xe438){_0x9118e2(_0xe438);}}function _0x46b60d(_0x49a961){_0x49a961['done']?_0x4e428b(_0x49a961['value']):_0x26d387(_0x49a961['value'])['then'](_0x5b110c,_0x37a3fb);}_0x46b60d((_0x17aab0=_0x17aab0['apply'](_0x3899c3,_0x2e1f4f||[]))['next']());});};class ListService{constructor(_0x384638){this['fetch']=_0x384638;}['add'](_0x4ed590,_0x1a6dcd,_0x1641d2,_0x524014){return __awaiter$3(this,void 0,void 0,function*(){const _0x49f529='List',_0x3c95e2={'account_name':_0x4ed590,'list_name':_0x1a6dcd,'search_service_name':_0x1641d2};try{const _0x398804=yield this['fetch']['post'](_0x49f529,_0x524014,_0x3c95e2);if(_0x398804['status']>0xc7&&_0x398804['status']<0x12c){const _0x2737c6=yield _0x398804['json']();return new SuccessfulListIdentityResponse(_0x2737c6);}const _0x2fa79c=yield _0x398804['json']();return new FailedListIdentityResponse(_0x2fa79c);}catch(_0x54628f){if(_0x54628f instanceof Error)return new FailedListIdentityResponse({'detail':_0x54628f['message'],'title':_0x54628f['name'],'status':0x1f4,'instance':'','type':''});throw _0x54628f;}});}['delete'](_0x2d030f,_0x3c3533,_0x12bbcb){return __awaiter$3(this,void 0,void 0,function*(){const _0x459da4='List/'+_0x2d030f+'/'+_0x3c3533,_0x144d5f=yield this['fetch']['delete'](_0x459da4,_0x12bbcb);try{if(_0x144d5f['status']>0xc7&&_0x144d5f['status']<0x12c)return new SuccessfulResponse({});const _0x1e3ff6=yield _0x144d5f['json']();return new FailedResponse(_0x1e3ff6);}catch(_0x459eeb){if(_0x459eeb instanceof Error)return new FailedResponse({'detail':_0x459eeb['message'],'title':_0x459eeb['name'],'status':0x1f4,'instance':'','type':''});throw _0x459eeb;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5a1f14,_0x29599b,_0x3b7b65,_0x2e1d62){function _0x4fae3d(_0x2376e6){return _0x2376e6 instanceof _0x3b7b65?_0x2376e6:new _0x3b7b65(function(_0xd22dd6){_0xd22dd6(_0x2376e6);});}return new(_0x3b7b65||(_0x3b7b65=Promise))(function(_0x1a7743,_0x4fd681){function _0x408cf2(_0xbb6357){try{_0x20b3e8(_0x2e1d62['next'](_0xbb6357));}catch(_0x14b0dc){_0x4fd681(_0x14b0dc);}}function _0x3cf698(_0x4f0228){try{_0x20b3e8(_0x2e1d62['throw'](_0x4f0228));}catch(_0x1f82ec){_0x4fd681(_0x1f82ec);}}function _0x20b3e8(_0x30987d){_0x30987d['done']?_0x1a7743(_0x30987d['value']):_0x4fae3d(_0x30987d['value'])['then'](_0x408cf2,_0x3cf698);}_0x20b3e8((_0x2e1d62=_0x2e1d62['apply'](_0x5a1f14,_0x29599b||[]))['next']());});};class Fetch{constructor(_0x5804a4){this['baseUri']=_0x5804a4,this['getUrl']=_0x289a72=>{return _0x289a72['startsWith']('/')&&(_0x289a72=_0x289a72['replace']('/','')),''+this['baseUri']+_0x289a72;},!_0x5804a4['endsWith']('/')&&(_0x5804a4=_0x5804a4+'/');}['get'](_0x30f839,_0x13eaf3){return __awaiter$2(this,void 0,void 0,function*(){const _0x16ce89=this['getUrl'](_0x30f839);return yield fetch(_0x16ce89,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x13eaf3}});});}['post'](_0x36ac3e,_0xf1c163,_0x2a9f31){return __awaiter$2(this,void 0,void 0,function*(){const _0x561c33=this['getUrl'](_0x36ac3e);return yield fetch(_0x561c33,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xf1c163},'body':_0x2a9f31?JSON['stringify'](_0x2a9f31):null});});}['PostNoAuth'](_0x3028a2,_0x437213){return __awaiter$2(this,void 0,void 0,function*(){const _0x4fbcb7=this['getUrl'](_0x3028a2);return yield fetch(_0x4fbcb7,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x437213?JSON['stringify'](_0x437213):null});});}['put'](_0x5944bc,_0x4e7632,_0x4ea562){return __awaiter$2(this,void 0,void 0,function*(){const _0x36a742=this['getUrl'](_0x5944bc);return yield fetch(_0x36a742,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4e7632},'body':_0x4ea562?JSON['stringify'](_0x4ea562):null});});}['delete'](_0x3655f5,_0x2bd898){return __awaiter$2(this,void 0,void 0,function*(){const _0x319eb2=this['getUrl'](_0x3655f5);return yield fetch(_0x319eb2,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2bd898}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x856241,_0x1d6191,_0x593b3e,_0x201c67){function _0x1c49f4(_0x158e71){return _0x158e71 instanceof _0x593b3e?_0x158e71:new _0x593b3e(function(_0x2fb1ea){_0x2fb1ea(_0x158e71);});}return new(_0x593b3e||(_0x593b3e=Promise))(function(_0x225284,_0x14d7de){function _0x155d76(_0x16d257){try{_0x324a77(_0x201c67['next'](_0x16d257));}catch(_0x590ddd){_0x14d7de(_0x590ddd);}}function _0x4dfda9(_0x3d0648){try{_0x324a77(_0x201c67['throw'](_0x3d0648));}catch(_0x30d7d6){_0x14d7de(_0x30d7d6);}}function _0x324a77(_0x30ea4a){_0x30ea4a['done']?_0x225284(_0x30ea4a['value']):_0x1c49f4(_0x30ea4a['value'])['then'](_0x155d76,_0x4dfda9);}_0x324a77((_0x201c67=_0x201c67['apply'](_0x856241,_0x1d6191||[]))['next']());});};class SearchServersService{constructor(_0x26d5da){this['fetch']=_0x26d5da,this['path']='search-services';}['create'](_0x2655ef,_0x19dcc5,_0x18789d,_0x2d254b,_0x57168b,_0x5792c7,_0x3950b9,_0xfc1161){return __awaiter$1(this,void 0,void 0,function*(){const _0x295985={'account_name':_0x2655ef,'search_service_name':_0x19dcc5,'endpoint':_0x18789d,'key':_0x2d254b,'country':_0x57168b,'provider':_0x5792c7,'index_name':_0x3950b9};try{const _0x5d21d6=yield this['fetch']['post'](this['path'],_0xfc1161,_0x295985);if(_0x5d21d6['status']>0xc7&&_0x5d21d6['status']<0x12c){const _0x26eb43=yield _0x5d21d6['json']();return new SuccessfulSearchServiceResponse(_0x26eb43);}const _0x47aa8f=yield _0x5d21d6['json']();return new FailedSearchServiceResponse(_0x47aa8f);}catch(_0x5dd800){if(_0x5dd800 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5dd800['message'],'title':_0x5dd800['name'],'status':0x1f4,'instance':'','type':''});throw _0x5dd800;}});}['delete'](_0x257fb9,_0x19f011,_0x52ca94){return __awaiter$1(this,void 0,void 0,function*(){const _0x12ca21=this['path']+'/'+_0x257fb9+'/'+_0x19f011;try{const _0x2a0242=yield this['fetch']['delete'](_0x12ca21,_0x52ca94);if(_0x2a0242['status']>0xc7&&_0x2a0242['status']<0x12c)return new SuccessfulResponse({});const _0x1e40d4=yield _0x2a0242['json']();return new FailedResponse(_0x1e40d4);}catch(_0x191b13){if(_0x191b13 instanceof Error)return new FailedResponse({'detail':_0x191b13['message'],'title':_0x191b13['name'],'status':0x1f4,'instance':'','type':''});throw _0x191b13;}});}['view'](_0x17bd15,_0x514a27,_0x41fbda){return __awaiter$1(this,void 0,void 0,function*(){const _0x58bde0=this['path']+'/'+_0x17bd15+'/'+_0x514a27;try{const _0x4eb539=yield this['fetch']['get'](_0x58bde0,_0x41fbda);if(_0x4eb539['status']>0xc7&&_0x4eb539['status']<0x12c){const _0x144269=yield _0x4eb539['json']();return new SuccessfulViewSearchServiceResponse(_0x144269);}const _0x4598aa=yield _0x4eb539['json']();return new FailedViewSearchServiceResponse(_0x4598aa);}catch(_0x4f553b){if(_0x4f553b instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x4f553b['message'],'title':_0x4f553b['name'],'status':0x1f4,'instance':'','type':''});throw _0x4f553b;}});}['edit'](_0x22fe52,_0x50de67,_0x38a65a,_0x23686b,_0x3213b0,_0x267910){return __awaiter$1(this,void 0,void 0,function*(){const _0x511ad6={'account_name':_0x22fe52,'search_service_name':_0x50de67,'new_search_service_name':_0x38a65a,'key':_0x23686b,'country':_0x3213b0};try{const _0x175009=yield this['fetch']['put'](this['path'],_0x267910,_0x511ad6);if(_0x175009['status']>0xc7&&_0x175009['status']<0x12c){const _0x59ba3e=yield _0x175009['json']();return new SuccessfulSearchServiceResponse(_0x59ba3e);}const _0x1a01c6=yield _0x175009['json']();return new FailedSearchServiceResponse(_0x1a01c6);}catch(_0x28e5bc){if(_0x28e5bc instanceof Error)return new FailedSearchServiceResponse({'detail':_0x28e5bc['message'],'title':_0x28e5bc['name'],'status':0x1f4,'instance':'','type':''});throw _0x28e5bc;}});}['list'](_0x5ee896,_0x6f8fb8){return __awaiter$1(this,void 0,void 0,function*(){const _0xb0c93d=this['path']+'/'+_0x5ee896;try{const _0x50b0b8=yield this['fetch']['get'](_0xb0c93d,_0x6f8fb8);if(_0x50b0b8['status']>0xc7&&_0x50b0b8['status']<0x12c){const _0x41eeb9=yield _0x50b0b8['json']();return new SuccessfulListSearchServiceResponse(_0x41eeb9);}const _0x3cb226=yield _0x50b0b8['json']();return new FailedViewSearchServicesResponse(_0x3cb226);}catch(_0x22d980){if(_0x22d980 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x22d980['message'],'title':_0x22d980['name'],'status':0x1f4,'instance':'','type':''});throw _0x22d980;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3b447d,_0x4a07c9,_0x2fada3,_0x263ef1){function _0x3bca5f(_0x28889a){return _0x28889a instanceof _0x2fada3?_0x28889a:new _0x2fada3(function(_0x41d457){_0x41d457(_0x28889a);});}return new(_0x2fada3||(_0x2fada3=Promise))(function(_0x22c01c,_0x1844f1){function _0x5e6bdf(_0x4bc9f2){try{_0x4fae2a(_0x263ef1['next'](_0x4bc9f2));}catch(_0x5dbee8){_0x1844f1(_0x5dbee8);}}function _0x2a9685(_0x2e9e10){try{_0x4fae2a(_0x263ef1['throw'](_0x2e9e10));}catch(_0x5a75a4){_0x1844f1(_0x5a75a4);}}function _0x4fae2a(_0x3f1279){_0x3f1279['done']?_0x22c01c(_0x3f1279['value']):_0x3bca5f(_0x3f1279['value'])['then'](_0x5e6bdf,_0x2a9685);}_0x4fae2a((_0x263ef1=_0x263ef1['apply'](_0x3b447d,_0x4a07c9||[]))['next']());});};class AdminClient{constructor(_0x40364d='https://admin.searchability.dev/'){var _0x40e2d2=new Fetch(_0x40364d);this['Accounts']=new AccountService(_0x40e2d2),this['Lists']=new ListService(_0x40e2d2),this['ApiKeys']=new ApiKeyService(_0x40e2d2),this['SearchServices']=new SearchServersService(_0x40e2d2);}}class AuthClient{constructor(_0x36f390='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x36f390);}['login'](_0x501f8a){return __awaiter(this,void 0,void 0,function*(){const _0x49eb1e='login/'+_0x501f8a;try{const _0x575fd4=yield yield fetch(_0x49eb1e);if(_0x575fd4['status']>0xc7&&_0x575fd4['status']<0x12c){const _0x38848c=yield _0x575fd4['json']();return new SuccessfulAuthResponse(_0x38848c);}const _0x547b7a=yield _0x575fd4['json']();return new FailedAuthResponse(_0x547b7a);}catch(_0x5ed2d6){if(_0x5ed2d6 instanceof Error)return new FailedAuthResponse({'detail':_0x5ed2d6['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5ed2d6;}});}['refresh'](_0x37d6e0){return __awaiter(this,void 0,void 0,function*(){const _0x5d5e1a='refresh',_0x1fb9c9={'refresh_token':_0x37d6e0};try{const _0x2d6824=yield this['fetch']['PostNoAuth'](_0x5d5e1a,_0x1fb9c9);if(_0x2d6824['status']>0xc7&&_0x2d6824['status']<0x12c){const _0x3ca147=yield _0x2d6824['json']();return new SuccessfulAuthResponse(_0x3ca147);}const _0x1a059b=yield _0x2d6824['json']();return new FailedAuthResponse(_0x1a059b);}catch(_0x2c6c3e){if(_0x2c6c3e instanceof Error)return new FailedAuthResponse({'detail':_0x2c6c3e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2c6c3e;}});}['getTokenStatus'](_0x13f11b){if(Date['now']()<_0x13f11b['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x13f11b['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(_0x2c44d6){_0x2c44d6[_0x2c44d6['Ok']=0x0]='Ok',_0x2c44d6[_0x2c44d6['Refresh']=0x1]='Refresh',_0x2c44d6[_0x2c44d6['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(_0x174783){this['isSuccess']=_0x174783;}}class SuccessfulAccountResponse extends Response{constructor(_0x491436){super(!![]),this['account']=_0x491436;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x1c3031){super(!![]),this['list']=_0x1c3031;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x41aed2){super(![]),this['problem']=_0x41aed2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x5a660b){super(![]),this['problem']=_0x5a660b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x28c1aa){super(!![]),this['tokens']=_0x28c1aa;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x2b62e4){super(![]),this['problem']=_0x2b62e4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x11b977){super(!![]),this['apiKey']=_0x11b977;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x225fa8){super(![]),this['problem']=_0x225fa8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x37167a){super(!![]),this['searchService']=_0x37167a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x100b23){super(![]),this['problem']=_0x100b23;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0xb014d4){super(!![]),this['searchService']=_0xb014d4;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x49c26d){super(!![]),this['searchServices']=_0x49c26d;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x25be0d){super(![]),this['problem']=_0x25be0d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x367514){super(![]),this['problem']=_0x367514;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x202d49){super(!![]),this['apiKeyValue']=_0x202d49;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x17eb4d){super(!![]),this['obj']=_0x17eb4d;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0xafb6d3){super(![]),this['problem']=_0xafb6d3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x19a53e){super(![]),this['problem']=_0x19a53e;}['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(_0x35f880,_0x2b7ac6,_0x412686,_0x399f62){function _0x398bf7(_0x803bf5){return _0x803bf5 instanceof _0x412686?_0x803bf5:new _0x412686(function(_0x16bd5f){_0x16bd5f(_0x803bf5);});}return new(_0x412686||(_0x412686=Promise))(function(_0x291275,_0x3f0298){function _0x56e2bb(_0x1bf412){try{_0x14e948(_0x399f62['next'](_0x1bf412));}catch(_0x25dc13){_0x3f0298(_0x25dc13);}}function _0x2d402e(_0x3a06e9){try{_0x14e948(_0x399f62['throw'](_0x3a06e9));}catch(_0x121bcb){_0x3f0298(_0x121bcb);}}function _0x14e948(_0x459440){_0x459440['done']?_0x291275(_0x459440['value']):_0x398bf7(_0x459440['value'])['then'](_0x56e2bb,_0x2d402e);}_0x14e948((_0x399f62=_0x399f62['apply'](_0x35f880,_0x2b7ac6||[]))['next']());});};class AccountService{constructor(_0x295a65){this['fetch']=_0x295a65;}['get'](_0x1ee0fb,_0x368afb){return __awaiter$5(this,void 0,void 0,function*(){const _0x4a1dd='Account/'+_0x1ee0fb+'/',_0x5eea39=yield this['fetch']['get'](_0x4a1dd,_0x368afb);try{if(_0x5eea39['status']>0xc7&&_0x5eea39['status']<0x12c){const _0x486839=yield _0x5eea39['json']();return new SuccessfulAccountResponse(_0x486839);}const _0x1923fd=yield _0x5eea39['json']();return new FailedAccountResponse(_0x1923fd);}catch(_0x151bd7){if(_0x151bd7 instanceof Error)return new FailedAccountResponse({'detail':_0x151bd7['message'],'title':_0x151bd7['name'],'status':0x1f4,'instance':'','type':''});throw _0x151bd7;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2625c0,_0x33df41,_0x5f4063,_0x9ce0d5){function _0x121248(_0x114615){return _0x114615 instanceof _0x5f4063?_0x114615:new _0x5f4063(function(_0x418b01){_0x418b01(_0x114615);});}return new(_0x5f4063||(_0x5f4063=Promise))(function(_0x1f5c82,_0x4ea4e5){function _0x5e1d25(_0x233fe0){try{_0x30811d(_0x9ce0d5['next'](_0x233fe0));}catch(_0x80d200){_0x4ea4e5(_0x80d200);}}function _0x4f59c5(_0xd27cb7){try{_0x30811d(_0x9ce0d5['throw'](_0xd27cb7));}catch(_0x2d7e05){_0x4ea4e5(_0x2d7e05);}}function _0x30811d(_0x29cab9){_0x29cab9['done']?_0x1f5c82(_0x29cab9['value']):_0x121248(_0x29cab9['value'])['then'](_0x5e1d25,_0x4f59c5);}_0x30811d((_0x9ce0d5=_0x9ce0d5['apply'](_0x2625c0,_0x33df41||[]))['next']());});};class ApiKeyService{constructor(_0x47f520){this['fetch']=_0x47f520,this['path']='api-key';}['create'](_0x35f0dd,_0xb5a53d,_0xd0c71){return __awaiter$4(this,void 0,void 0,function*(){const _0x5f1083={'account_name':_0x35f0dd,'api_key_name':_0xb5a53d};try{const _0xcc3749=yield this['fetch']['post'](this['path'],_0xd0c71,_0x5f1083);if(_0xcc3749['status']>0xc7&&_0xcc3749['status']<0x12c){const _0x4c4c0e=yield _0xcc3749['json']();return new SuccessfulApiKeyResponse(_0x4c4c0e);}const _0x2aa5de=yield _0xcc3749['json']();return new FailedApiKeyResponse(_0x2aa5de);}catch(_0x88e05a){if(_0x88e05a instanceof Error)return new FailedApiKeyResponse({'detail':_0x88e05a['message'],'title':_0x88e05a['name'],'status':0x1f4,'instance':'','type':''});throw _0x88e05a;}});}['view'](_0x28f632,_0x27ff8a,_0x472399){return __awaiter$4(this,void 0,void 0,function*(){const _0x1c2826=this['path']+'/'+_0x28f632+'/'+_0x27ff8a;try{const _0x4936a5=yield this['fetch']['get'](_0x1c2826,_0x472399);if(_0x4936a5['status']>0xc7&&_0x4936a5['status']<0x12c){const _0x540b8b=yield _0x4936a5['json']();return new SuccessfulApiKeyValueResponse(_0x540b8b);}const _0x21c9c3=yield _0x4936a5['json']();return new FailedApiKeyValueResponse(_0x21c9c3);}catch(_0x40fe91){if(_0x40fe91 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x40fe91['message'],'title':_0x40fe91['name'],'status':0x1f4,'instance':'','type':''});throw _0x40fe91;}});}['delete'](_0x1d3dcd,_0x34157a,_0x314338){return __awaiter$4(this,void 0,void 0,function*(){const _0x50b3e3=this['path']+'/'+_0x1d3dcd+'/'+_0x34157a;try{const _0x3f195e=yield this['fetch']['delete'](_0x50b3e3,_0x314338);if(_0x3f195e['status']>0xc7&&_0x3f195e['status']<0x12c)return new SuccessfulResponse({});const _0x27d726=yield _0x3f195e['json']();return new FailedResponse(_0x27d726);}catch(_0x378450){if(_0x378450 instanceof Error)return new FailedResponse({'detail':_0x378450['message'],'title':_0x378450['name'],'status':0x1f4,'instance':'','type':''});throw _0x378450;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x469d92,_0x561302,_0x45e6d5,_0x430be2){function _0x4d2542(_0x2ccb91){return _0x2ccb91 instanceof _0x45e6d5?_0x2ccb91:new _0x45e6d5(function(_0x52e186){_0x52e186(_0x2ccb91);});}return new(_0x45e6d5||(_0x45e6d5=Promise))(function(_0x5590a4,_0x5207dc){function _0x1955b7(_0x3e3881){try{_0x3bf085(_0x430be2['next'](_0x3e3881));}catch(_0x308edc){_0x5207dc(_0x308edc);}}function _0x37d2aa(_0x3ef31f){try{_0x3bf085(_0x430be2['throw'](_0x3ef31f));}catch(_0x1af0e9){_0x5207dc(_0x1af0e9);}}function _0x3bf085(_0x1ba551){_0x1ba551['done']?_0x5590a4(_0x1ba551['value']):_0x4d2542(_0x1ba551['value'])['then'](_0x1955b7,_0x37d2aa);}_0x3bf085((_0x430be2=_0x430be2['apply'](_0x469d92,_0x561302||[]))['next']());});};class ListService{constructor(_0x351e6a){this['fetch']=_0x351e6a;}['add'](_0x4d0298,_0x53e870,_0x436730,_0x558937){return __awaiter$3(this,void 0,void 0,function*(){const _0x51860e='List',_0x3fb27f={'account_name':_0x4d0298,'list_name':_0x53e870,'search_service_name':_0x436730};try{const _0x49325c=yield this['fetch']['post'](_0x51860e,_0x558937,_0x3fb27f);if(_0x49325c['status']>0xc7&&_0x49325c['status']<0x12c){const _0x427174=yield _0x49325c['json']();return new SuccessfulListIdentityResponse(_0x427174);}const _0x4dff3f=yield _0x49325c['json']();return new FailedListIdentityResponse(_0x4dff3f);}catch(_0x2db80e){if(_0x2db80e instanceof Error)return new FailedListIdentityResponse({'detail':_0x2db80e['message'],'title':_0x2db80e['name'],'status':0x1f4,'instance':'','type':''});throw _0x2db80e;}});}['delete'](_0x1a96d2,_0x3e100e,_0x1e00e3){return __awaiter$3(this,void 0,void 0,function*(){const _0x1169da='List/'+_0x1a96d2+'/'+_0x3e100e,_0x469bc6=yield this['fetch']['delete'](_0x1169da,_0x1e00e3);try{if(_0x469bc6['status']>0xc7&&_0x469bc6['status']<0x12c)return new SuccessfulResponse({});const _0x1057ca=yield _0x469bc6['json']();return new FailedResponse(_0x1057ca);}catch(_0x5b21ed){if(_0x5b21ed instanceof Error)return new FailedResponse({'detail':_0x5b21ed['message'],'title':_0x5b21ed['name'],'status':0x1f4,'instance':'','type':''});throw _0x5b21ed;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x43c404,_0xafe0c5,_0x396b8e,_0x1fbb30){function _0x41e9c8(_0x4a96fa){return _0x4a96fa instanceof _0x396b8e?_0x4a96fa:new _0x396b8e(function(_0x358d6e){_0x358d6e(_0x4a96fa);});}return new(_0x396b8e||(_0x396b8e=Promise))(function(_0x5e9ab8,_0xa4d331){function _0x257f64(_0x36b45a){try{_0x3360b9(_0x1fbb30['next'](_0x36b45a));}catch(_0x2cdf66){_0xa4d331(_0x2cdf66);}}function _0x54a3a1(_0x2e0366){try{_0x3360b9(_0x1fbb30['throw'](_0x2e0366));}catch(_0x1f9923){_0xa4d331(_0x1f9923);}}function _0x3360b9(_0x185576){_0x185576['done']?_0x5e9ab8(_0x185576['value']):_0x41e9c8(_0x185576['value'])['then'](_0x257f64,_0x54a3a1);}_0x3360b9((_0x1fbb30=_0x1fbb30['apply'](_0x43c404,_0xafe0c5||[]))['next']());});};class Fetch{constructor(_0x4b360d){this['baseUri']=_0x4b360d,this['getUrl']=_0x32e19b=>{return _0x32e19b['startsWith']('/')&&(_0x32e19b=_0x32e19b['replace']('/','')),''+this['baseUri']+_0x32e19b;},!_0x4b360d['endsWith']('/')&&(_0x4b360d=_0x4b360d+'/');}['get'](_0x197d40,_0x40a79d){return __awaiter$2(this,void 0,void 0,function*(){const _0x9305ad=this['getUrl'](_0x197d40);return yield fetch(_0x9305ad,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x40a79d}});});}['post'](_0x3d082f,_0x557e3f,_0x10594d){return __awaiter$2(this,void 0,void 0,function*(){const _0x141c97=this['getUrl'](_0x3d082f);return yield fetch(_0x141c97,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x557e3f},'body':_0x10594d?JSON['stringify'](_0x10594d):null});});}['PostNoAuth'](_0x495b2c,_0x2c4dfe){return __awaiter$2(this,void 0,void 0,function*(){const _0x5ad615=this['getUrl'](_0x495b2c);return yield fetch(_0x5ad615,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x2c4dfe?JSON['stringify'](_0x2c4dfe):null});});}['put'](_0x5a205d,_0x4dc9f9,_0x505043){return __awaiter$2(this,void 0,void 0,function*(){const _0x37112c=this['getUrl'](_0x5a205d);return yield fetch(_0x37112c,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4dc9f9},'body':_0x505043?JSON['stringify'](_0x505043):null});});}['delete'](_0x328120,_0x2ce678){return __awaiter$2(this,void 0,void 0,function*(){const _0x4634e5=this['getUrl'](_0x328120);return yield fetch(_0x4634e5,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2ce678}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4de4ed,_0x573e21,_0x1e4644,_0x2e9b01){function _0x290617(_0x41f341){return _0x41f341 instanceof _0x1e4644?_0x41f341:new _0x1e4644(function(_0x3fea12){_0x3fea12(_0x41f341);});}return new(_0x1e4644||(_0x1e4644=Promise))(function(_0x14d606,_0x3976e3){function _0x532c15(_0x1d37da){try{_0x4e0373(_0x2e9b01['next'](_0x1d37da));}catch(_0x1bb841){_0x3976e3(_0x1bb841);}}function _0x41f962(_0x53aa56){try{_0x4e0373(_0x2e9b01['throw'](_0x53aa56));}catch(_0x8be13c){_0x3976e3(_0x8be13c);}}function _0x4e0373(_0xe78425){_0xe78425['done']?_0x14d606(_0xe78425['value']):_0x290617(_0xe78425['value'])['then'](_0x532c15,_0x41f962);}_0x4e0373((_0x2e9b01=_0x2e9b01['apply'](_0x4de4ed,_0x573e21||[]))['next']());});};class SearchServersService{constructor(_0x2d1f8f){this['fetch']=_0x2d1f8f,this['path']='search-services';}['create'](_0x44e24b,_0x5589a6,_0x4707a9,_0x50feef,_0x4679f5,_0x4fae29,_0x2b5d00,_0x3f4b11){return __awaiter$1(this,void 0,void 0,function*(){const _0x21f824={'account_name':_0x44e24b,'search_service_name':_0x5589a6,'endpoint':_0x4707a9,'key':_0x50feef,'country':_0x4679f5,'provider':_0x4fae29,'index_name':_0x2b5d00};try{const _0xc99383=yield this['fetch']['post'](this['path'],_0x3f4b11,_0x21f824);if(_0xc99383['status']>0xc7&&_0xc99383['status']<0x12c){const _0x2774a5=yield _0xc99383['json']();return new SuccessfulSearchServiceResponse(_0x2774a5);}const _0x841743=yield _0xc99383['json']();return new FailedSearchServiceResponse(_0x841743);}catch(_0x514534){if(_0x514534 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x514534['message'],'title':_0x514534['name'],'status':0x1f4,'instance':'','type':''});throw _0x514534;}});}['delete'](_0x15e30b,_0x37a306,_0x338246){return __awaiter$1(this,void 0,void 0,function*(){const _0x1904e1=this['path']+'/'+_0x15e30b+'/'+_0x37a306;try{const _0x1652c0=yield this['fetch']['delete'](_0x1904e1,_0x338246);if(_0x1652c0['status']>0xc7&&_0x1652c0['status']<0x12c)return new SuccessfulResponse({});const _0x5abc33=yield _0x1652c0['json']();return new FailedResponse(_0x5abc33);}catch(_0x68d40c){if(_0x68d40c instanceof Error)return new FailedResponse({'detail':_0x68d40c['message'],'title':_0x68d40c['name'],'status':0x1f4,'instance':'','type':''});throw _0x68d40c;}});}['view'](_0x3b05ae,_0xa03f7f,_0xcb4c07){return __awaiter$1(this,void 0,void 0,function*(){const _0x36e87e=this['path']+'/'+_0x3b05ae+'/'+_0xa03f7f;try{const _0x280cf6=yield this['fetch']['get'](_0x36e87e,_0xcb4c07);if(_0x280cf6['status']>0xc7&&_0x280cf6['status']<0x12c){const _0x57ae57=yield _0x280cf6['json']();return new SuccessfulViewSearchServiceResponse(_0x57ae57);}const _0x49180c=yield _0x280cf6['json']();return new FailedViewSearchServiceResponse(_0x49180c);}catch(_0x505066){if(_0x505066 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x505066['message'],'title':_0x505066['name'],'status':0x1f4,'instance':'','type':''});throw _0x505066;}});}['edit'](_0x2ff7af,_0x303208,_0x46aaeb,_0x3d1967,_0x276990,_0x5e8a9){return __awaiter$1(this,void 0,void 0,function*(){const _0x2ff036={'account_name':_0x2ff7af,'search_service_name':_0x303208,'new_search_service_name':_0x46aaeb,'key':_0x3d1967,'country':_0x276990};try{const _0x4feb12=yield this['fetch']['put'](this['path'],_0x5e8a9,_0x2ff036);if(_0x4feb12['status']>0xc7&&_0x4feb12['status']<0x12c){const _0x32016e=yield _0x4feb12['json']();return new SuccessfulSearchServiceResponse(_0x32016e);}const _0x274485=yield _0x4feb12['json']();return new FailedSearchServiceResponse(_0x274485);}catch(_0x1545fe){if(_0x1545fe instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1545fe['message'],'title':_0x1545fe['name'],'status':0x1f4,'instance':'','type':''});throw _0x1545fe;}});}['list'](_0x1c152b,_0x100164){return __awaiter$1(this,void 0,void 0,function*(){const _0x5ced86=this['path']+'/'+_0x1c152b;try{const _0x497ec8=yield this['fetch']['get'](_0x5ced86,_0x100164);if(_0x497ec8['status']>0xc7&&_0x497ec8['status']<0x12c){const _0x1091e6=yield _0x497ec8['json']();return new SuccessfulListSearchServiceResponse(_0x1091e6);}const _0x148ec1=yield _0x497ec8['json']();return new FailedViewSearchServicesResponse(_0x148ec1);}catch(_0x3e8de3){if(_0x3e8de3 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x3e8de3['message'],'title':_0x3e8de3['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e8de3;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x41d7dd,_0x1147b6,_0x3868db,_0x1fdf01){function _0x2632bd(_0x3036a6){return _0x3036a6 instanceof _0x3868db?_0x3036a6:new _0x3868db(function(_0x2b87fc){_0x2b87fc(_0x3036a6);});}return new(_0x3868db||(_0x3868db=Promise))(function(_0x407546,_0x373209){function _0x28200d(_0x5f63c3){try{_0x1d0d19(_0x1fdf01['next'](_0x5f63c3));}catch(_0x3cee2c){_0x373209(_0x3cee2c);}}function _0x3c2bf2(_0x298dd4){try{_0x1d0d19(_0x1fdf01['throw'](_0x298dd4));}catch(_0x4d3f45){_0x373209(_0x4d3f45);}}function _0x1d0d19(_0x174229){_0x174229['done']?_0x407546(_0x174229['value']):_0x2632bd(_0x174229['value'])['then'](_0x28200d,_0x3c2bf2);}_0x1d0d19((_0x1fdf01=_0x1fdf01['apply'](_0x41d7dd,_0x1147b6||[]))['next']());});};class AdminClient{constructor(_0x4816d9='https://admin.searchability.dev/'){var _0x441149=new Fetch(_0x4816d9);this['Accounts']=new AccountService(_0x441149),this['Lists']=new ListService(_0x441149),this['ApiKeys']=new ApiKeyService(_0x441149),this['SearchServices']=new SearchServersService(_0x441149);}}class AuthClient{constructor(_0x23f554='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x23f554);}['login'](_0x40ebb8){return __awaiter(this,void 0,void 0,function*(){const _0x871af7='login/'+_0x40ebb8;try{const _0x160d7e=yield yield fetch(_0x871af7);if(_0x160d7e['status']>0xc7&&_0x160d7e['status']<0x12c){const _0x57b933=yield _0x160d7e['json']();return new SuccessfulAuthResponse(_0x57b933);}const _0x10736a=yield _0x160d7e['json']();return new FailedAuthResponse(_0x10736a);}catch(_0x4963f7){if(_0x4963f7 instanceof Error)return new FailedAuthResponse({'detail':_0x4963f7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4963f7;}});}['refresh'](_0x5ae000){return __awaiter(this,void 0,void 0,function*(){const _0x3ce96b='refresh',_0x506f04={'refresh_token':_0x5ae000};try{const _0x2a9712=yield this['fetch']['PostNoAuth'](_0x3ce96b,_0x506f04);if(_0x2a9712['status']>0xc7&&_0x2a9712['status']<0x12c){const _0x5e4a3b=yield _0x2a9712['json']();return new SuccessfulAuthResponse(_0x5e4a3b);}const _0x4cbd60=yield _0x2a9712['json']();return new FailedAuthResponse(_0x4cbd60);}catch(_0x317dd1){if(_0x317dd1 instanceof Error)return new FailedAuthResponse({'detail':_0x317dd1['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x317dd1;}});}['getTokenStatus'](_0x5a39bb){if(Date['now']()<_0x5a39bb['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x5a39bb['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(_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 };
|