@searchability/admin-client 0.0.33 → 0.0.35
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(_0x5dd0f4){_0x5dd0f4[_0x5dd0f4['Ok']=0x0]='Ok',_0x5dd0f4[_0x5dd0f4['Refresh']=0x1]='Refresh',_0x5dd0f4[_0x5dd0f4['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(_0x54204d){this['isSuccess']=_0x54204d;}}class SuccessfulAccountResponse extends Response{constructor(_0x39b63b){super(!![]),this['account']=_0x39b63b;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x3f3726){super(![]),this['problem']=_0x3f3726;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x393a1a){super(!![]),this['tokens']=_0x393a1a;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x5cfb44){super(![]),this['problem']=_0x5cfb44;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x19f2f8){super(!![]),this['apiKey']=_0x19f2f8;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x8c10dc){super(![]),this['problem']=_0x8c10dc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0xaeef37){super(!![]),this['searchService']=_0xaeef37;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x649f59){super(![]),this['problem']=_0x649f59;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x44054a){super(!![]),this['apiKeyValue']=_0x44054a;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x386ef8){super(!![]),this['obj']=_0x386ef8;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x8479b7){super(![]),this['problem']=_0x8479b7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x400175){super(![]),this['problem']=_0x400175;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x246a2b,_0x5e33ed,_0x346e0b,_0xd7516c){function _0x1a3217(_0x2415e7){return _0x2415e7 instanceof _0x346e0b?_0x2415e7:new _0x346e0b(function(_0x53bfed){_0x53bfed(_0x2415e7);});}return new(_0x346e0b||(_0x346e0b=Promise))(function(_0x17fcb1,_0x5ed5e0){function _0x5c63c5(_0x21f5f0){try{_0x34266e(_0xd7516c['next'](_0x21f5f0));}catch(_0xd1c3db){_0x5ed5e0(_0xd1c3db);}}function _0x290262(_0x191692){try{_0x34266e(_0xd7516c['throw'](_0x191692));}catch(_0x5e372e){_0x5ed5e0(_0x5e372e);}}function _0x34266e(_0x4a6ede){_0x4a6ede['done']?_0x17fcb1(_0x4a6ede['value']):_0x1a3217(_0x4a6ede['value'])['then'](_0x5c63c5,_0x290262);}_0x34266e((_0xd7516c=_0xd7516c['apply'](_0x246a2b,_0x5e33ed||[]))['next']());});};class AccountService{constructor(_0x278c47){this['fetch']=_0x278c47;}['get'](_0x52a98f,_0x54ed8a){return __awaiter$5(this,void 0,void 0,function*(){const _0xa3a5ca='Account/'+_0x52a98f+'/',_0x4995a4=yield this['fetch']['get'](_0xa3a5ca,_0x54ed8a);try{if(_0x4995a4['status']>0xc7&&_0x4995a4['status']<0x12c){const _0x519d6f=yield _0x4995a4['json']();return new SuccessfulAccountResponse(_0x519d6f);}const _0xeb224f=yield _0x4995a4['json']();return new FailedAccountResponse(_0xeb224f);}catch(_0x12bcff){if(_0x12bcff instanceof Error)return new FailedAccountResponse({'detail':_0x12bcff['message'],'title':_0x12bcff['name'],'status':0x1f4,'instance':'','type':''});throw _0x12bcff;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5687e6,_0x4852b5,_0x39f416,_0x19230e){function _0x3b4f04(_0x4cab18){return _0x4cab18 instanceof _0x39f416?_0x4cab18:new _0x39f416(function(_0x3c6c91){_0x3c6c91(_0x4cab18);});}return new(_0x39f416||(_0x39f416=Promise))(function(_0x9d7cdf,_0x25f3be){function _0x5c23b6(_0x34e246){try{_0x4d83c6(_0x19230e['next'](_0x34e246));}catch(_0x27df85){_0x25f3be(_0x27df85);}}function _0x499a08(_0xaaebd7){try{_0x4d83c6(_0x19230e['throw'](_0xaaebd7));}catch(_0xafa395){_0x25f3be(_0xafa395);}}function _0x4d83c6(_0x250b6c){_0x250b6c['done']?_0x9d7cdf(_0x250b6c['value']):_0x3b4f04(_0x250b6c['value'])['then'](_0x5c23b6,_0x499a08);}_0x4d83c6((_0x19230e=_0x19230e['apply'](_0x5687e6,_0x4852b5||[]))['next']());});};class ApiKeyService{constructor(_0x1b0c41){this['fetch']=_0x1b0c41,this['path']='api-key';}['create'](_0x3c62dd,_0x58591a,_0x24fdf8){return __awaiter$4(this,void 0,void 0,function*(){const _0x3a61c2={'account_name':_0x3c62dd,'api_key_name':_0x58591a};try{const _0xd6cf5=yield this['fetch']['post'](this['path'],_0x24fdf8,_0x3a61c2);if(_0xd6cf5['status']>0xc7&&_0xd6cf5['status']<0x12c){const _0x3d4507=yield _0xd6cf5['json']();return new SuccessfulApiKeyResponse(_0x3d4507);}const _0x534188=yield _0xd6cf5['json']();return new FailedApiKeyResponse(_0x534188);}catch(_0x3a35c3){if(_0x3a35c3 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3a35c3['message'],'title':_0x3a35c3['name'],'status':0x1f4,'instance':'','type':''});throw _0x3a35c3;}});}['view'](_0x2c7c36,_0x5bf043,_0x22f0b9){return __awaiter$4(this,void 0,void 0,function*(){const _0x3ea522=this['path']+'/'+_0x2c7c36+'/'+_0x5bf043;try{const _0x12dac2=yield this['fetch']['get'](_0x3ea522,_0x22f0b9);if(_0x12dac2['status']>0xc7&&_0x12dac2['status']<0x12c){const _0x5345e8=yield _0x12dac2['json']();return new SuccessfulApiKeyValueResponse(_0x5345e8);}const _0x28b6c3=yield _0x12dac2['json']();return new FailedApiKeyValueResponse(_0x28b6c3);}catch(_0x5c4a29){if(_0x5c4a29 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x5c4a29['message'],'title':_0x5c4a29['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c4a29;}});}['delete'](_0x55d3ef,_0x208bad,_0x5a5438){return __awaiter$4(this,void 0,void 0,function*(){const _0x4cd53d=this['path']+'/'+_0x55d3ef+'/'+_0x208bad;try{const _0x524daa=yield this['fetch']['delete'](_0x4cd53d,_0x5a5438);if(_0x524daa['status']>0xc7&&_0x524daa['status']<0x12c)return new SuccessfulResponse({});const _0x175a77=yield _0x524daa['json']();return new FailedResponse(_0x175a77);}catch(_0x484bbc){if(_0x484bbc instanceof Error)return new FailedResponse({'detail':_0x484bbc['message'],'title':_0x484bbc['name'],'status':0x1f4,'instance':'','type':''});throw _0x484bbc;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x2f5906,_0x35d35a,_0x1cbd58,_0xea0d2f){function _0x55abb6(_0xa9b0da){return _0xa9b0da instanceof _0x1cbd58?_0xa9b0da:new _0x1cbd58(function(_0x31202a){_0x31202a(_0xa9b0da);});}return new(_0x1cbd58||(_0x1cbd58=Promise))(function(_0x2fac67,_0x2ef2c0){function _0x381a60(_0x1772d1){try{_0x4ea363(_0xea0d2f['next'](_0x1772d1));}catch(_0x5c16d9){_0x2ef2c0(_0x5c16d9);}}function _0x5a601a(_0x1ad4e2){try{_0x4ea363(_0xea0d2f['throw'](_0x1ad4e2));}catch(_0x34512e){_0x2ef2c0(_0x34512e);}}function _0x4ea363(_0x57154d){_0x57154d['done']?_0x2fac67(_0x57154d['value']):_0x55abb6(_0x57154d['value'])['then'](_0x381a60,_0x5a601a);}_0x4ea363((_0xea0d2f=_0xea0d2f['apply'](_0x2f5906,_0x35d35a||[]))['next']());});};class ListService{constructor(_0x422b34){this['fetch']=_0x422b34;}['add'](_0x125ac0,_0x3a5638,_0x12ce71){return __awaiter$3(this,void 0,void 0,function*(){const _0x495b52='List',_0x419652={'account_name':_0x125ac0,'list_name':_0x3a5638};try{const _0x32722f=yield this['fetch']['post'](_0x495b52,_0x12ce71,_0x419652);if(_0x32722f['status']>0xc7&&_0x32722f['status']<0x12c){const _0x1e63ea=yield _0x32722f['json']();return new SuccessfulAccountResponse(_0x1e63ea);}const _0x7fa05=yield _0x32722f['json']();return new FailedAccountResponse(_0x7fa05);}catch(_0x581914){if(_0x581914 instanceof Error)return new FailedAccountResponse({'detail':_0x581914['message'],'title':_0x581914['name'],'status':0x1f4,'instance':'','type':''});throw _0x581914;}});}['remove'](_0x328fdb,_0x2c0173,_0x291995){return __awaiter$3(this,void 0,void 0,function*(){const _0x480433='List/'+_0x328fdb+'/'+_0x2c0173,_0x3ac051=yield this['fetch']['delete'](_0x480433,_0x291995);try{if(_0x3ac051['status']>0xc7&&_0x3ac051['status']<0x12c){const _0x7e9713=yield _0x3ac051['json']();return new SuccessfulAccountResponse(_0x7e9713);}const _0x34280f=yield _0x3ac051['json']();return new FailedAccountResponse(_0x34280f);}catch(_0xd28de3){if(_0xd28de3 instanceof Error)return new FailedAccountResponse({'detail':_0xd28de3['message'],'title':_0xd28de3['name'],'status':0x1f4,'instance':'','type':''});throw _0xd28de3;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x2254b7,_0x1f4f82,_0x538b9c,_0xaa40e7){function _0x5b186e(_0x1bed6d){return _0x1bed6d instanceof _0x538b9c?_0x1bed6d:new _0x538b9c(function(_0x12baf5){_0x12baf5(_0x1bed6d);});}return new(_0x538b9c||(_0x538b9c=Promise))(function(_0x25e623,_0x33c3be){function _0x8bef3e(_0x3fb0c9){try{_0x116aff(_0xaa40e7['next'](_0x3fb0c9));}catch(_0x3faa52){_0x33c3be(_0x3faa52);}}function _0x350f04(_0x1ac0e0){try{_0x116aff(_0xaa40e7['throw'](_0x1ac0e0));}catch(_0x380eb2){_0x33c3be(_0x380eb2);}}function _0x116aff(_0x5cedc1){_0x5cedc1['done']?_0x25e623(_0x5cedc1['value']):_0x5b186e(_0x5cedc1['value'])['then'](_0x8bef3e,_0x350f04);}_0x116aff((_0xaa40e7=_0xaa40e7['apply'](_0x2254b7,_0x1f4f82||[]))['next']());});};class Fetch{constructor(_0x16988c){this['baseUri']=_0x16988c,this['getUrl']=_0x3360f3=>{return _0x3360f3['startsWith']('/')&&(_0x3360f3=_0x3360f3['replace']('/','')),''+this['baseUri']+_0x3360f3;},!_0x16988c['endsWith']('/')&&(_0x16988c=_0x16988c+'/');}['get'](_0x2279bf,_0x4c303e){return __awaiter$2(this,void 0,void 0,function*(){const _0x24bb3d=this['getUrl'](_0x2279bf);return yield fetch(_0x24bb3d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4c303e}});});}['post'](_0x21cce3,_0x30096f,_0xedb0a9){return __awaiter$2(this,void 0,void 0,function*(){const _0x8cfa35=this['getUrl'](_0x21cce3);return yield fetch(_0x8cfa35,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x30096f},'body':_0xedb0a9?JSON['stringify'](_0xedb0a9):null});});}['put'](_0x166919,_0x2db9f5,_0x5b8532){return __awaiter$2(this,void 0,void 0,function*(){const _0x13cffa=this['getUrl'](_0x166919);return yield fetch(_0x13cffa,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2db9f5},'body':_0x5b8532?JSON['stringify'](_0x5b8532):null});});}['delete'](_0x5ae1e6,_0x1e4936){return __awaiter$2(this,void 0,void 0,function*(){const _0x3f700b=this['getUrl'](_0x5ae1e6);return yield fetch(_0x3f700b,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1e4936}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4e813d,_0x4e4bba,_0xf4e987,_0x24baf6){function _0x5239b7(_0x1cfc7d){return _0x1cfc7d instanceof _0xf4e987?_0x1cfc7d:new _0xf4e987(function(_0x60bb5f){_0x60bb5f(_0x1cfc7d);});}return new(_0xf4e987||(_0xf4e987=Promise))(function(_0x2f544b,_0x1a411e){function _0x197a91(_0x3261aa){try{_0x4dcc93(_0x24baf6['next'](_0x3261aa));}catch(_0x4e6ea0){_0x1a411e(_0x4e6ea0);}}function _0x1795e1(_0x20636d){try{_0x4dcc93(_0x24baf6['throw'](_0x20636d));}catch(_0x12e79c){_0x1a411e(_0x12e79c);}}function _0x4dcc93(_0x114713){_0x114713['done']?_0x2f544b(_0x114713['value']):_0x5239b7(_0x114713['value'])['then'](_0x197a91,_0x1795e1);}_0x4dcc93((_0x24baf6=_0x24baf6['apply'](_0x4e813d,_0x4e4bba||[]))['next']());});};class SearchServersService{constructor(_0x43a0b8){this['fetch']=_0x43a0b8,this['path']='search-services';}['create'](_0x37e4dd,_0x148897,_0x55a73c,_0x3f330a,_0x38b66,_0xda499d){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f4952={'account_name':_0x37e4dd,'search_service_name':_0x148897,'endpoint':_0x55a73c,'key':_0x3f330a,'county':_0x38b66};try{const _0x5ae6c0=yield this['fetch']['post'](this['path'],_0xda499d,_0x3f4952);if(_0x5ae6c0['status']>0xc7&&_0x5ae6c0['status']<0x12c){const _0x393dc5=yield _0x5ae6c0['json']();return new SuccessfulSearchServiceResponse(_0x393dc5);}const _0x3002e6=yield _0x5ae6c0['json']();return new FailedSearchServiceResponse(_0x3002e6);}catch(_0x5eefb3){if(_0x5eefb3 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5eefb3['message'],'title':_0x5eefb3['name'],'status':0x1f4,'instance':'','type':''});throw _0x5eefb3;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x491d89,_0x53ebc9,_0x5b0b59,_0x58b740){function _0x326b09(_0x2bbb50){return _0x2bbb50 instanceof _0x5b0b59?_0x2bbb50:new _0x5b0b59(function(_0x54e0db){_0x54e0db(_0x2bbb50);});}return new(_0x5b0b59||(_0x5b0b59=Promise))(function(_0xb225f,_0x2a2bf4){function _0x4cf5a7(_0x1af182){try{_0x231ca9(_0x58b740['next'](_0x1af182));}catch(_0x17650b){_0x2a2bf4(_0x17650b);}}function _0x5792f8(_0x257d9c){try{_0x231ca9(_0x58b740['throw'](_0x257d9c));}catch(_0xde0916){_0x2a2bf4(_0xde0916);}}function _0x231ca9(_0x4ad2b4){_0x4ad2b4['done']?_0xb225f(_0x4ad2b4['value']):_0x326b09(_0x4ad2b4['value'])['then'](_0x4cf5a7,_0x5792f8);}_0x231ca9((_0x58b740=_0x58b740['apply'](_0x491d89,_0x53ebc9||[]))['next']());});};class AdminClient{constructor(_0x100f97='https://admin.searchability.dev/'){var _0x360ba6=new Fetch(_0x100f97);this['Accounts']=new AccountService(_0x360ba6),this['Lists']=new ListService(_0x360ba6),this['ApiKeys']=new ApiKeyService(_0x360ba6),this['SearchServices']=new SearchServersService(_0x360ba6);}}class AuthClient{constructor(_0x36ade5='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x36ade5);}['login'](_0x273730){return __awaiter(this,void 0,void 0,function*(){var _0x82094f='login/'+_0x273730;try{const _0x26abac=yield yield fetch(_0x82094f);if(_0x26abac['status']>0xc7&&_0x26abac['status']<0x12c){const _0x49be4c=yield _0x26abac['json']();return new SuccessfulAuthResponse(_0x49be4c);}const _0x5a4991=yield _0x26abac['json']();return new FailedAuthResponse(_0x5a4991);}catch(_0xa2113a){if(_0xa2113a instanceof Error)return new FailedAuthResponse({'detail':_0xa2113a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xa2113a;}});}['refresh'](_0x31b7a8){return __awaiter(this,void 0,void 0,function*(){var _0x425935='refresh';try{const _0x3f1ebb=yield this['fetch']['post'](_0x425935,_0x31b7a8,null);if(_0x3f1ebb['status']>0xc7&&_0x3f1ebb['status']<0x12c){const _0x5d1522=yield _0x3f1ebb['json']();return new SuccessfulAuthResponse(_0x5d1522);}const _0x3cd4be=yield _0x3f1ebb['json']();return new FailedAuthResponse(_0x3cd4be);}catch(_0x319d23){if(_0x319d23 instanceof Error)return new FailedAuthResponse({'detail':_0x319d23['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x319d23;}});}['getTokenStatus'](_0x2be925){if(Date['now']()<_0x2be925['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x2be925['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
+
|
|
15
|
+
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x3cb67a){_0x3cb67a[_0x3cb67a['Ok']=0x0]='Ok',_0x3cb67a[_0x3cb67a['Refresh']=0x1]='Refresh',_0x3cb67a[_0x3cb67a['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(_0x8286dd){this['isSuccess']=_0x8286dd;}}class SuccessfulAccountResponse extends Response{constructor(_0x113c62){super(!![]),this['account']=_0x113c62;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x3a2f0c){super(![]),this['problem']=_0x3a2f0c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x31c269){super(!![]),this['tokens']=_0x31c269;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x30008d){super(![]),this['problem']=_0x30008d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x553a7a){super(!![]),this['apiKey']=_0x553a7a;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x22e941){super(![]),this['problem']=_0x22e941;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x3f6fa9){super(!![]),this['searchService']=_0x3f6fa9;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x4bb8db){super(![]),this['problem']=_0x4bb8db;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x1459b7){super(!![]),this['apiKeyValue']=_0x1459b7;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x4d3583){super(!![]),this['obj']=_0x4d3583;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x4278a6){super(![]),this['problem']=_0x4278a6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x137894){super(![]),this['problem']=_0x137894;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$
|
|
5
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x4eb93b,_0x45421a,_0x7c1061,_0x33fca9){function _0x1e5af9(_0x4a2e0f){return _0x4a2e0f instanceof _0x7c1061?_0x4a2e0f:new _0x7c1061(function(_0x1acd0e){_0x1acd0e(_0x4a2e0f);});}return new(_0x7c1061||(_0x7c1061=Promise))(function(_0x44db4e,_0x13ea18){function _0x327c12(_0x1a921f){try{_0x273f44(_0x33fca9['next'](_0x1a921f));}catch(_0x1076b1){_0x13ea18(_0x1076b1);}}function _0x8f8323(_0x4e1c04){try{_0x273f44(_0x33fca9['throw'](_0x4e1c04));}catch(_0x4dc031){_0x13ea18(_0x4dc031);}}function _0x273f44(_0x5202ec){_0x5202ec['done']?_0x44db4e(_0x5202ec['value']):_0x1e5af9(_0x5202ec['value'])['then'](_0x327c12,_0x8f8323);}_0x273f44((_0x33fca9=_0x33fca9['apply'](_0x4eb93b,_0x45421a||[]))['next']());});};class AccountService{constructor(_0x3ddcc4){this['fetch']=_0x3ddcc4;}['get'](_0x343c96,_0x2d5d73){return __awaiter$5(this,void 0,void 0,function*(){const _0x329115='Account/'+_0x343c96+'/',_0x2460b7=yield this['fetch']['get'](_0x329115,_0x2d5d73);try{if(_0x2460b7['status']>0xc7&&_0x2460b7['status']<0x12c){const _0x485900=yield _0x2460b7['json']();return new SuccessfulAccountResponse(_0x485900);}const _0x50f0a6=yield _0x2460b7['json']();return new FailedAccountResponse(_0x50f0a6);}catch(_0x4519db){if(_0x4519db instanceof Error)return new FailedAccountResponse({'detail':_0x4519db['message'],'title':_0x4519db['name'],'status':0x1f4,'instance':'','type':''});throw _0x4519db;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2b062d,_0x2bf958,_0x5ebd3b,_0x5cc15c){function _0x44e1fd(_0x3c9b6e){return _0x3c9b6e instanceof _0x5ebd3b?_0x3c9b6e:new _0x5ebd3b(function(_0x2fdfa9){_0x2fdfa9(_0x3c9b6e);});}return new(_0x5ebd3b||(_0x5ebd3b=Promise))(function(_0x257eff,_0xfede0e){function _0x3d38d5(_0x4782c8){try{_0x5f3c2e(_0x5cc15c['next'](_0x4782c8));}catch(_0x1d58f2){_0xfede0e(_0x1d58f2);}}function _0x3c402f(_0x5772e1){try{_0x5f3c2e(_0x5cc15c['throw'](_0x5772e1));}catch(_0x463c81){_0xfede0e(_0x463c81);}}function _0x5f3c2e(_0x501397){_0x501397['done']?_0x257eff(_0x501397['value']):_0x44e1fd(_0x501397['value'])['then'](_0x3d38d5,_0x3c402f);}_0x5f3c2e((_0x5cc15c=_0x5cc15c['apply'](_0x2b062d,_0x2bf958||[]))['next']());});};class ApiKeyService{constructor(_0x16ea49){this['fetch']=_0x16ea49,this['path']='api-key';}['create'](_0x447d3e,_0x531afd,_0x2c51fc){return __awaiter$4(this,void 0,void 0,function*(){const _0x46479b={'account_name':_0x447d3e,'api_key_name':_0x531afd};try{const _0x3aa50=yield this['fetch']['post'](this['path'],_0x2c51fc,_0x46479b);if(_0x3aa50['status']>0xc7&&_0x3aa50['status']<0x12c){const _0x1558ff=yield _0x3aa50['json']();return new SuccessfulApiKeyResponse(_0x1558ff);}const _0x56b733=yield _0x3aa50['json']();return new FailedApiKeyResponse(_0x56b733);}catch(_0x2a7126){if(_0x2a7126 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2a7126['message'],'title':_0x2a7126['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a7126;}});}['view'](_0x2e14af,_0x345cef,_0x1ade1b){return __awaiter$4(this,void 0,void 0,function*(){const _0x4c854b=this['path']+'/'+_0x2e14af+'/'+_0x345cef;try{const _0x31988f=yield this['fetch']['get'](_0x4c854b,_0x1ade1b);if(_0x31988f['status']>0xc7&&_0x31988f['status']<0x12c){const _0x4c78b6=yield _0x31988f['json']();return new SuccessfulApiKeyValueResponse(_0x4c78b6);}const _0x100976=yield _0x31988f['json']();return new FailedApiKeyValueResponse(_0x100976);}catch(_0x19e5bf){if(_0x19e5bf instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x19e5bf['message'],'title':_0x19e5bf['name'],'status':0x1f4,'instance':'','type':''});throw _0x19e5bf;}});}['delete'](_0x38bba8,_0x4e5566,_0x1a3a13){return __awaiter$4(this,void 0,void 0,function*(){const _0x489da6=this['path']+'/'+_0x38bba8+'/'+_0x4e5566;try{const _0x4dfeb5=yield this['fetch']['delete'](_0x489da6,_0x1a3a13);if(_0x4dfeb5['status']>0xc7&&_0x4dfeb5['status']<0x12c)return new SuccessfulResponse({});const _0x5b348a=yield _0x4dfeb5['json']();return new FailedResponse(_0x5b348a);}catch(_0x75815f){if(_0x75815f instanceof Error)return new FailedResponse({'detail':_0x75815f['message'],'title':_0x75815f['name'],'status':0x1f4,'instance':'','type':''});throw _0x75815f;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x2142f4,_0x2c559e,_0x39c70d,_0x531375){function _0x3baf2f(_0x516f0f){return _0x516f0f instanceof _0x39c70d?_0x516f0f:new _0x39c70d(function(_0x4b2546){_0x4b2546(_0x516f0f);});}return new(_0x39c70d||(_0x39c70d=Promise))(function(_0x200133,_0x165aaf){function _0x318820(_0xdf372d){try{_0x5e9b02(_0x531375['next'](_0xdf372d));}catch(_0x3de044){_0x165aaf(_0x3de044);}}function _0x4701e6(_0xcc8b24){try{_0x5e9b02(_0x531375['throw'](_0xcc8b24));}catch(_0xe87646){_0x165aaf(_0xe87646);}}function _0x5e9b02(_0x26a775){_0x26a775['done']?_0x200133(_0x26a775['value']):_0x3baf2f(_0x26a775['value'])['then'](_0x318820,_0x4701e6);}_0x5e9b02((_0x531375=_0x531375['apply'](_0x2142f4,_0x2c559e||[]))['next']());});};class ListService{constructor(_0x6799c0){this['fetch']=_0x6799c0;}['add'](_0x51cdd9,_0x3a73e8,_0x4e2c84){return __awaiter$3(this,void 0,void 0,function*(){const _0x27ea8a='List',_0x51a404={'account_name':_0x51cdd9,'list_name':_0x3a73e8};try{const _0x36a093=yield this['fetch']['post'](_0x27ea8a,_0x4e2c84,_0x51a404);if(_0x36a093['status']>0xc7&&_0x36a093['status']<0x12c){const _0x36b788=yield _0x36a093['json']();return new SuccessfulAccountResponse(_0x36b788);}const _0x9ef191=yield _0x36a093['json']();return new FailedAccountResponse(_0x9ef191);}catch(_0x49ed21){if(_0x49ed21 instanceof Error)return new FailedAccountResponse({'detail':_0x49ed21['message'],'title':_0x49ed21['name'],'status':0x1f4,'instance':'','type':''});throw _0x49ed21;}});}['remove'](_0x277e37,_0x4b5d7a,_0x565909){return __awaiter$3(this,void 0,void 0,function*(){const _0x8ba123='List/'+_0x277e37+'/'+_0x4b5d7a,_0x175243=yield this['fetch']['delete'](_0x8ba123,_0x565909);try{if(_0x175243['status']>0xc7&&_0x175243['status']<0x12c){const _0x4bca1e=yield _0x175243['json']();return new SuccessfulAccountResponse(_0x4bca1e);}const _0x27be19=yield _0x175243['json']();return new FailedAccountResponse(_0x27be19);}catch(_0x1ee076){if(_0x1ee076 instanceof Error)return new FailedAccountResponse({'detail':_0x1ee076['message'],'title':_0x1ee076['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ee076;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5d19de,_0xd4ea55,_0x517657,_0x399ee3){function _0x50e76d(_0xe8384c){return _0xe8384c instanceof _0x517657?_0xe8384c:new _0x517657(function(_0x49eb93){_0x49eb93(_0xe8384c);});}return new(_0x517657||(_0x517657=Promise))(function(_0x29cc9f,_0x4df9b6){function _0x1f1818(_0x512767){try{_0x445d00(_0x399ee3['next'](_0x512767));}catch(_0x3aa36a){_0x4df9b6(_0x3aa36a);}}function _0x1b7fa7(_0x581c86){try{_0x445d00(_0x399ee3['throw'](_0x581c86));}catch(_0x5357e9){_0x4df9b6(_0x5357e9);}}function _0x445d00(_0x417517){_0x417517['done']?_0x29cc9f(_0x417517['value']):_0x50e76d(_0x417517['value'])['then'](_0x1f1818,_0x1b7fa7);}_0x445d00((_0x399ee3=_0x399ee3['apply'](_0x5d19de,_0xd4ea55||[]))['next']());});};class Fetch{constructor(_0x4da7e3){this['baseUri']=_0x4da7e3,this['getUrl']=_0x5075bf=>{return _0x5075bf['startsWith']('/')&&(_0x5075bf=_0x5075bf['replace']('/','')),''+this['baseUri']+_0x5075bf;},!_0x4da7e3['endsWith']('/')&&(_0x4da7e3=_0x4da7e3+'/');}['get'](_0x21af8d,_0x231f67){return __awaiter$2(this,void 0,void 0,function*(){const _0x65f8fd=this['getUrl'](_0x21af8d);return yield fetch(_0x65f8fd,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x231f67}});});}['post'](_0x2f3d81,_0x3812a1,_0x1bc4ec){return __awaiter$2(this,void 0,void 0,function*(){const _0x50aa7b=this['getUrl'](_0x2f3d81);return yield fetch(_0x50aa7b,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3812a1},'body':_0x1bc4ec?JSON['stringify'](_0x1bc4ec):null});});}['put'](_0x59a6a4,_0x56668c,_0x36a777){return __awaiter$2(this,void 0,void 0,function*(){const _0x585358=this['getUrl'](_0x59a6a4);return yield fetch(_0x585358,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x56668c},'body':_0x36a777?JSON['stringify'](_0x36a777):null});});}['delete'](_0x33562a,_0x29364a){return __awaiter$2(this,void 0,void 0,function*(){const _0x167d8e=this['getUrl'](_0x33562a);return yield fetch(_0x167d8e,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x29364a}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1aeade,_0x1bf14d,_0x1c3b16,_0x3837d9){function _0x2971b6(_0x296dbf){return _0x296dbf instanceof _0x1c3b16?_0x296dbf:new _0x1c3b16(function(_0x5488e6){_0x5488e6(_0x296dbf);});}return new(_0x1c3b16||(_0x1c3b16=Promise))(function(_0x3361b5,_0x5111c4){function _0x2c1101(_0x2f9985){try{_0x22308f(_0x3837d9['next'](_0x2f9985));}catch(_0x16966d){_0x5111c4(_0x16966d);}}function _0x1d1986(_0x1741ef){try{_0x22308f(_0x3837d9['throw'](_0x1741ef));}catch(_0x29bb77){_0x5111c4(_0x29bb77);}}function _0x22308f(_0xe64b75){_0xe64b75['done']?_0x3361b5(_0xe64b75['value']):_0x2971b6(_0xe64b75['value'])['then'](_0x2c1101,_0x1d1986);}_0x22308f((_0x3837d9=_0x3837d9['apply'](_0x1aeade,_0x1bf14d||[]))['next']());});};class SearchServersService{constructor(_0x217fb2){this['fetch']=_0x217fb2,this['path']='search-services';}['create'](_0x48a0a4,_0x542a9a,_0xb230f3,_0x180b31,_0x3d5453,_0x4e1b68){return __awaiter$1(this,void 0,void 0,function*(){const _0x305631={'account_name':_0x48a0a4,'search_service_name':_0x542a9a,'endpoint':_0xb230f3,'key':_0x180b31,'county':_0x3d5453};try{const _0x4902a1=yield this['fetch']['post'](this['path'],_0x4e1b68,_0x305631);if(_0x4902a1['status']>0xc7&&_0x4902a1['status']<0x12c){const _0x4f4034=yield _0x4902a1['json']();return new SuccessfulSearchServiceResponse(_0x4f4034);}const _0xc028c5=yield _0x4902a1['json']();return new FailedSearchServiceResponse(_0xc028c5);}catch(_0x1c35e5){if(_0x1c35e5 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1c35e5['message'],'title':_0x1c35e5['name'],'status':0x1f4,'instance':'','type':''});throw _0x1c35e5;}});}}
|
|
14
|
+
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0xb229d0,_0x2f19f2,_0x110b78,_0x2e61c8){function _0x4011da(_0x24ea8f){return _0x24ea8f instanceof _0x110b78?_0x24ea8f:new _0x110b78(function(_0x2948b9){_0x2948b9(_0x24ea8f);});}return new(_0x110b78||(_0x110b78=Promise))(function(_0xc23b84,_0x443b0e){function _0x303c37(_0x5e1b2c){try{_0x7b5cb7(_0x2e61c8['next'](_0x5e1b2c));}catch(_0x3502eb){_0x443b0e(_0x3502eb);}}function _0x3ea633(_0x1cb695){try{_0x7b5cb7(_0x2e61c8['throw'](_0x1cb695));}catch(_0x29fc73){_0x443b0e(_0x29fc73);}}function _0x7b5cb7(_0x3c26d7){_0x3c26d7['done']?_0xc23b84(_0x3c26d7['value']):_0x4011da(_0x3c26d7['value'])['then'](_0x303c37,_0x3ea633);}_0x7b5cb7((_0x2e61c8=_0x2e61c8['apply'](_0xb229d0,_0x2f19f2||[]))['next']());});};class AdminClient{constructor(_0x99cf3c='https://admin.searchability.dev/'){var _0x36582c=new Fetch(_0x99cf3c);this['Accounts']=new AccountService(_0x36582c),this['Lists']=new ListService(_0x36582c),this['ApiKeys']=new ApiKeyService(_0x36582c),this['SearchServices']=new SearchServersService(_0x36582c);}}class AuthClient{constructor(_0x11cbf4='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x11cbf4);}['login'](_0x370cf0){return __awaiter(this,void 0,void 0,function*(){var _0x3313db='login/'+_0x370cf0;try{const _0x1db4ec=yield yield fetch(_0x3313db);if(_0x1db4ec['status']>0xc7&&_0x1db4ec['status']<0x12c){const _0x1201a9=yield _0x1db4ec['json']();return new SuccessfulAuthResponse(_0x1201a9);}const _0x1e7cb8=yield _0x1db4ec['json']();return new FailedAuthResponse(_0x1e7cb8);}catch(_0x176aa9){if(_0x176aa9 instanceof Error)return new FailedAuthResponse({'detail':_0x176aa9['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x176aa9;}});}['refresh'](_0x44749b){return __awaiter(this,void 0,void 0,function*(){var _0x47abf9='refresh';try{const _0x53017d=yield this['fetch']['post'](_0x47abf9,_0x44749b,null);if(_0x53017d['status']>0xc7&&_0x53017d['status']<0x12c){const _0x2c4dfe=yield _0x53017d['json']();return new SuccessfulAuthResponse(_0x2c4dfe);}const _0x370ddb=yield _0x53017d['json']();return new FailedAuthResponse(_0x370ddb);}catch(_0x212a5e){if(_0x212a5e instanceof Error)return new FailedAuthResponse({'detail':_0x212a5e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x212a5e;}});}['getTokenStatus'](_0x2c5e8b){if(Date['now']()<_0x2c5e8b['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x2c5e8b['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
14
16
|
|
|
15
17
|
exports.AdminClient = AdminClient;
|
|
16
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x1d8e35){_0x1d8e35[_0x1d8e35['Ok']=0x0]='Ok',_0x1d8e35[_0x1d8e35['Refresh']=0x1]='Refresh',_0x1d8e35[_0x1d8e35['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(_0x4da05a){this['isSuccess']=_0x4da05a;}}class SuccessfulAccountResponse extends Response{constructor(_0x4c1904){super(!![]),this['account']=_0x4c1904;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0xf82dff){super(![]),this['problem']=_0xf82dff;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x51bd71){super(!![]),this['tokens']=_0x51bd71;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x236518){super(![]),this['problem']=_0x236518;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x391833){super(!![]),this['apiKey']=_0x391833;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x2fd4e9){super(![]),this['problem']=_0x2fd4e9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x1d56a3){super(!![]),this['searchService']=_0x1d56a3;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x427e9a){super(![]),this['problem']=_0x427e9a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x14a2eb){super(!![]),this['apiKeyValue']=_0x14a2eb;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x3a22a7){super(!![]),this['obj']=_0x3a22a7;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x49139f){super(![]),this['problem']=_0x49139f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0xf89b21){super(![]),this['problem']=_0xf89b21;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
2
|
|
|
3
|
-
var __awaiter$
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x126f9e,_0x2eada6,_0x2475b5,_0x2c0997){function _0x3d61f7(_0x11bc72){return _0x11bc72 instanceof _0x2475b5?_0x11bc72:new _0x2475b5(function(_0x5a1643){_0x5a1643(_0x11bc72);});}return new(_0x2475b5||(_0x2475b5=Promise))(function(_0x591fbc,_0x3360d1){function _0x394672(_0x369955){try{_0x1580ae(_0x2c0997['next'](_0x369955));}catch(_0x4757ef){_0x3360d1(_0x4757ef);}}function _0x319fb6(_0x100071){try{_0x1580ae(_0x2c0997['throw'](_0x100071));}catch(_0x44cb7d){_0x3360d1(_0x44cb7d);}}function _0x1580ae(_0x23d3d4){_0x23d3d4['done']?_0x591fbc(_0x23d3d4['value']):_0x3d61f7(_0x23d3d4['value'])['then'](_0x394672,_0x319fb6);}_0x1580ae((_0x2c0997=_0x2c0997['apply'](_0x126f9e,_0x2eada6||[]))['next']());});};class AccountService{constructor(_0x33eb37){this['fetch']=_0x33eb37;}['get'](_0x2593f2,_0x2c8708){return __awaiter$5(this,void 0,void 0,function*(){const _0x43fb46='Account/'+_0x2593f2+'/',_0x5874da=yield this['fetch']['get'](_0x43fb46,_0x2c8708);try{if(_0x5874da['status']>0xc7&&_0x5874da['status']<0x12c){const _0x80317b=yield _0x5874da['json']();return new SuccessfulAccountResponse(_0x80317b);}const _0x45c700=yield _0x5874da['json']();return new FailedAccountResponse(_0x45c700);}catch(_0x304c57){if(_0x304c57 instanceof Error)return new FailedAccountResponse({'detail':_0x304c57['message'],'title':_0x304c57['name'],'status':0x1f4,'instance':'','type':''});throw _0x304c57;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x24bdf3,_0x10e55f,_0x395259,_0x577e26){function _0x556f20(_0x4fe585){return _0x4fe585 instanceof _0x395259?_0x4fe585:new _0x395259(function(_0x45b853){_0x45b853(_0x4fe585);});}return new(_0x395259||(_0x395259=Promise))(function(_0x12a87c,_0x4c90b7){function _0x140710(_0x3d5d4a){try{_0x26d937(_0x577e26['next'](_0x3d5d4a));}catch(_0x5f5d55){_0x4c90b7(_0x5f5d55);}}function _0x230bff(_0x5983af){try{_0x26d937(_0x577e26['throw'](_0x5983af));}catch(_0x359807){_0x4c90b7(_0x359807);}}function _0x26d937(_0x14377b){_0x14377b['done']?_0x12a87c(_0x14377b['value']):_0x556f20(_0x14377b['value'])['then'](_0x140710,_0x230bff);}_0x26d937((_0x577e26=_0x577e26['apply'](_0x24bdf3,_0x10e55f||[]))['next']());});};class ApiKeyService{constructor(_0x3b8af7){this['fetch']=_0x3b8af7,this['path']='api-key';}['create'](_0x28a31a,_0x5672be,_0x314dd7){return __awaiter$4(this,void 0,void 0,function*(){const _0x45019b={'account_name':_0x28a31a,'api_key_name':_0x5672be};try{const _0x2dfbb0=yield this['fetch']['post'](this['path'],_0x314dd7,_0x45019b);if(_0x2dfbb0['status']>0xc7&&_0x2dfbb0['status']<0x12c){const _0x4d0b66=yield _0x2dfbb0['json']();return new SuccessfulApiKeyResponse(_0x4d0b66);}const _0xce7a9d=yield _0x2dfbb0['json']();return new FailedApiKeyResponse(_0xce7a9d);}catch(_0x42d5ad){if(_0x42d5ad instanceof Error)return new FailedApiKeyResponse({'detail':_0x42d5ad['message'],'title':_0x42d5ad['name'],'status':0x1f4,'instance':'','type':''});throw _0x42d5ad;}});}['view'](_0x14d722,_0x2f93d0,_0x1c89d6){return __awaiter$4(this,void 0,void 0,function*(){const _0x5dcbe0=this['path']+'/'+_0x14d722+'/'+_0x2f93d0;try{const _0x287d78=yield this['fetch']['get'](_0x5dcbe0,_0x1c89d6);if(_0x287d78['status']>0xc7&&_0x287d78['status']<0x12c){const _0x3321fb=yield _0x287d78['json']();return new SuccessfulApiKeyValueResponse(_0x3321fb);}const _0x16d94e=yield _0x287d78['json']();return new FailedApiKeyValueResponse(_0x16d94e);}catch(_0x4b4d94){if(_0x4b4d94 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4b4d94['message'],'title':_0x4b4d94['name'],'status':0x1f4,'instance':'','type':''});throw _0x4b4d94;}});}['delete'](_0x5f1ebf,_0xc045eb,_0x32fdcc){return __awaiter$4(this,void 0,void 0,function*(){const _0x102afe=this['path']+'/'+_0x5f1ebf+'/'+_0xc045eb;try{const _0x583fb1=yield this['fetch']['delete'](_0x102afe,_0x32fdcc);if(_0x583fb1['status']>0xc7&&_0x583fb1['status']<0x12c)return new SuccessfulResponse({});const _0x4eee7b=yield _0x583fb1['json']();return new FailedResponse(_0x4eee7b);}catch(_0x242e9e){if(_0x242e9e instanceof Error)return new FailedResponse({'detail':_0x242e9e['message'],'title':_0x242e9e['name'],'status':0x1f4,'instance':'','type':''});throw _0x242e9e;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x12e74c,_0x252f5e,_0x5969a8,_0x13a2ab){function _0x4ac3f8(_0x483f71){return _0x483f71 instanceof _0x5969a8?_0x483f71:new _0x5969a8(function(_0x396bbb){_0x396bbb(_0x483f71);});}return new(_0x5969a8||(_0x5969a8=Promise))(function(_0x2361b9,_0x57e4cf){function _0x21a318(_0x23f071){try{_0x4a934b(_0x13a2ab['next'](_0x23f071));}catch(_0x2de3fb){_0x57e4cf(_0x2de3fb);}}function _0x52af1e(_0x536310){try{_0x4a934b(_0x13a2ab['throw'](_0x536310));}catch(_0x2821d9){_0x57e4cf(_0x2821d9);}}function _0x4a934b(_0x4fabd8){_0x4fabd8['done']?_0x2361b9(_0x4fabd8['value']):_0x4ac3f8(_0x4fabd8['value'])['then'](_0x21a318,_0x52af1e);}_0x4a934b((_0x13a2ab=_0x13a2ab['apply'](_0x12e74c,_0x252f5e||[]))['next']());});};class ListService{constructor(_0x226a20){this['fetch']=_0x226a20;}['add'](_0x16f1c4,_0x160c7d,_0x354943){return __awaiter$3(this,void 0,void 0,function*(){const _0x22a9af='List',_0x19f36f={'account_name':_0x16f1c4,'list_name':_0x160c7d};try{const _0x36d901=yield this['fetch']['post'](_0x22a9af,_0x354943,_0x19f36f);if(_0x36d901['status']>0xc7&&_0x36d901['status']<0x12c){const _0x102749=yield _0x36d901['json']();return new SuccessfulAccountResponse(_0x102749);}const _0x39b348=yield _0x36d901['json']();return new FailedAccountResponse(_0x39b348);}catch(_0x3d1d56){if(_0x3d1d56 instanceof Error)return new FailedAccountResponse({'detail':_0x3d1d56['message'],'title':_0x3d1d56['name'],'status':0x1f4,'instance':'','type':''});throw _0x3d1d56;}});}['remove'](_0x3491ea,_0x5b5853,_0x2ec697){return __awaiter$3(this,void 0,void 0,function*(){const _0x35cc93='List/'+_0x3491ea+'/'+_0x5b5853,_0x1a814a=yield this['fetch']['delete'](_0x35cc93,_0x2ec697);try{if(_0x1a814a['status']>0xc7&&_0x1a814a['status']<0x12c){const _0x2b468a=yield _0x1a814a['json']();return new SuccessfulAccountResponse(_0x2b468a);}const _0xdf4852=yield _0x1a814a['json']();return new FailedAccountResponse(_0xdf4852);}catch(_0x55b912){if(_0x55b912 instanceof Error)return new FailedAccountResponse({'detail':_0x55b912['message'],'title':_0x55b912['name'],'status':0x1f4,'instance':'','type':''});throw _0x55b912;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x2b1569,_0x40bafc,_0x1ad1b0,_0x25805e){function _0x2c7569(_0x57cfa7){return _0x57cfa7 instanceof _0x1ad1b0?_0x57cfa7:new _0x1ad1b0(function(_0x4a9b20){_0x4a9b20(_0x57cfa7);});}return new(_0x1ad1b0||(_0x1ad1b0=Promise))(function(_0x44ab3b,_0x242a94){function _0x38054b(_0x3e6286){try{_0x4dd208(_0x25805e['next'](_0x3e6286));}catch(_0x5dd922){_0x242a94(_0x5dd922);}}function _0x7717de(_0x2dd4c3){try{_0x4dd208(_0x25805e['throw'](_0x2dd4c3));}catch(_0xc3a8ef){_0x242a94(_0xc3a8ef);}}function _0x4dd208(_0x113f79){_0x113f79['done']?_0x44ab3b(_0x113f79['value']):_0x2c7569(_0x113f79['value'])['then'](_0x38054b,_0x7717de);}_0x4dd208((_0x25805e=_0x25805e['apply'](_0x2b1569,_0x40bafc||[]))['next']());});};class Fetch{constructor(_0x5bab0c){this['baseUri']=_0x5bab0c,this['getUrl']=_0x1cfbc9=>{return _0x1cfbc9['startsWith']('/')&&(_0x1cfbc9=_0x1cfbc9['replace']('/','')),''+this['baseUri']+_0x1cfbc9;},!_0x5bab0c['endsWith']('/')&&(_0x5bab0c=_0x5bab0c+'/');}['get'](_0xb207f7,_0x2b15fd){return __awaiter$2(this,void 0,void 0,function*(){const _0x3c082d=this['getUrl'](_0xb207f7);return yield fetch(_0x3c082d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b15fd}});});}['post'](_0x1929a3,_0x536625,_0x2424df){return __awaiter$2(this,void 0,void 0,function*(){const _0xf11d59=this['getUrl'](_0x1929a3);return yield fetch(_0xf11d59,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x536625},'body':_0x2424df?JSON['stringify'](_0x2424df):null});});}['put'](_0x254d37,_0x2b87fb,_0x340508){return __awaiter$2(this,void 0,void 0,function*(){const _0x2b8544=this['getUrl'](_0x254d37);return yield fetch(_0x2b8544,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b87fb},'body':_0x340508?JSON['stringify'](_0x340508):null});});}['delete'](_0x4f5d5e,_0x1cae00){return __awaiter$2(this,void 0,void 0,function*(){const _0x32dccd=this['getUrl'](_0x4f5d5e);return yield fetch(_0x32dccd,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1cae00}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3f5402,_0x44550b,_0x13e77a,_0x2743a4){function _0x2c4a65(_0x4baf0c){return _0x4baf0c instanceof _0x13e77a?_0x4baf0c:new _0x13e77a(function(_0x10574c){_0x10574c(_0x4baf0c);});}return new(_0x13e77a||(_0x13e77a=Promise))(function(_0x46630b,_0x4b5f64){function _0x36a4ab(_0x4bf764){try{_0x181a59(_0x2743a4['next'](_0x4bf764));}catch(_0x30dee7){_0x4b5f64(_0x30dee7);}}function _0x345846(_0x1f1387){try{_0x181a59(_0x2743a4['throw'](_0x1f1387));}catch(_0x375c4a){_0x4b5f64(_0x375c4a);}}function _0x181a59(_0x30d7ce){_0x30d7ce['done']?_0x46630b(_0x30d7ce['value']):_0x2c4a65(_0x30d7ce['value'])['then'](_0x36a4ab,_0x345846);}_0x181a59((_0x2743a4=_0x2743a4['apply'](_0x3f5402,_0x44550b||[]))['next']());});};class SearchServersService{constructor(_0x29190b){this['fetch']=_0x29190b,this['path']='search-services';}['create'](_0x6bcb78,_0x2c03a6,_0x3bbd98,_0x3ba38d,_0x23909b,_0x29dc16){return __awaiter$1(this,void 0,void 0,function*(){const _0x3bbc8={'account_name':_0x6bcb78,'search_service_name':_0x2c03a6,'endpoint':_0x3bbd98,'key':_0x3ba38d,'county':_0x23909b};try{const _0x4c6d07=yield this['fetch']['post'](this['path'],_0x29dc16,_0x3bbc8);if(_0x4c6d07['status']>0xc7&&_0x4c6d07['status']<0x12c){const _0x8353db=yield _0x4c6d07['json']();return new SuccessfulSearchServiceResponse(_0x8353db);}const _0xb6235=yield _0x4c6d07['json']();return new FailedSearchServiceResponse(_0xb6235);}catch(_0x1d5671){if(_0x1d5671 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1d5671['message'],'title':_0x1d5671['name'],'status':0x1f4,'instance':'','type':''});throw _0x1d5671;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1bf1f2,_0x496929,_0x1de0b2,_0x1b83c0){function _0x1c33fe(_0x22dbdc){return _0x22dbdc instanceof _0x1de0b2?_0x22dbdc:new _0x1de0b2(function(_0x358ffb){_0x358ffb(_0x22dbdc);});}return new(_0x1de0b2||(_0x1de0b2=Promise))(function(_0x2315de,_0x12c95d){function _0x59e0ca(_0x1e667b){try{_0xe56e0f(_0x1b83c0['next'](_0x1e667b));}catch(_0x354ff1){_0x12c95d(_0x354ff1);}}function _0x361da6(_0x315cd6){try{_0xe56e0f(_0x1b83c0['throw'](_0x315cd6));}catch(_0x2f8818){_0x12c95d(_0x2f8818);}}function _0xe56e0f(_0x3d4206){_0x3d4206['done']?_0x2315de(_0x3d4206['value']):_0x1c33fe(_0x3d4206['value'])['then'](_0x59e0ca,_0x361da6);}_0xe56e0f((_0x1b83c0=_0x1b83c0['apply'](_0x1bf1f2,_0x496929||[]))['next']());});};class AdminClient{constructor(_0x152b38='https://admin.searchability.dev/'){var _0x14574c=new Fetch(_0x152b38);this['Accounts']=new AccountService(_0x14574c),this['Lists']=new ListService(_0x14574c),this['ApiKeys']=new ApiKeyService(_0x14574c),this['SearchServices']=new SearchServersService(_0x14574c);}}class AuthClient{constructor(_0x5bdd5e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5bdd5e);}['login'](_0x19c76a){return __awaiter(this,void 0,void 0,function*(){var _0x565b3d='login/'+_0x19c76a;try{const _0x49dbbb=yield yield fetch(_0x565b3d);if(_0x49dbbb['status']>0xc7&&_0x49dbbb['status']<0x12c){const _0x575ea4=yield _0x49dbbb['json']();return new SuccessfulAuthResponse(_0x575ea4);}const _0x4724df=yield _0x49dbbb['json']();return new FailedAuthResponse(_0x4724df);}catch(_0x3a1a7e){if(_0x3a1a7e instanceof Error)return new FailedAuthResponse({'detail':_0x3a1a7e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3a1a7e;}});}['refresh'](_0x3d9807){return __awaiter(this,void 0,void 0,function*(){var _0x122d5c='refresh';try{const _0x2e4072=yield this['fetch']['post'](_0x122d5c,_0x3d9807,null);if(_0x2e4072['status']>0xc7&&_0x2e4072['status']<0x12c){const _0x449ec6=yield _0x2e4072['json']();return new SuccessfulAuthResponse(_0x449ec6);}const _0x6c275=yield _0x2e4072['json']();return new FailedAuthResponse(_0x6c275);}catch(_0x57105c){if(_0x57105c instanceof Error)return new FailedAuthResponse({'detail':_0x57105c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x57105c;}});}['getTokenStatus'](_0x5e4b75){if(Date['now']()<_0x5e4b75['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x5e4b75['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
12
14
|
|
|
13
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare class ApiKeyService {
|
|
|
18
18
|
readonly fetch: Fetch;
|
|
19
19
|
readonly path = "api-key";
|
|
20
20
|
constructor(fetch: Fetch);
|
|
21
|
-
create(account_name: string,
|
|
21
|
+
create(account_name: string, api_key_name: string, access_token: string): Promise<Response<ApiKey, Problem>>;
|
|
22
22
|
view(account_name: string, api_key_name: string, access_token: string): Promise<Response<ApiKeyValue, Problem>>;
|
|
23
23
|
delete(account_name: string, api_key_name: string, access_token: string): Promise<Response<any, Problem>>;
|
|
24
24
|
}
|
|
@@ -30,11 +30,19 @@ declare class ListService {
|
|
|
30
30
|
remove(accountName: string, listName: string, access_token: string): Promise<Response<Account, Problem>>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
declare class SearchServersService {
|
|
34
|
+
readonly fetch: Fetch;
|
|
35
|
+
readonly path = "search-services";
|
|
36
|
+
constructor(fetch: Fetch);
|
|
37
|
+
create(account_name: string, search_service_name: string, endpoint: string, key: string, county: string, access_token: string): Promise<Response<SearchService, Problem>>;
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
declare class AdminClient {
|
|
34
41
|
constructor(baseUri?: string);
|
|
35
42
|
readonly Accounts: AccountService;
|
|
36
43
|
readonly Lists: ListService;
|
|
37
44
|
readonly ApiKeys: ApiKeyService;
|
|
45
|
+
readonly SearchServices: SearchServersService;
|
|
38
46
|
}
|
|
39
47
|
declare class AuthClient {
|
|
40
48
|
private readonly fetch;
|
|
@@ -76,6 +84,11 @@ type ApiKey = {
|
|
|
76
84
|
name: string;
|
|
77
85
|
created: number;
|
|
78
86
|
};
|
|
87
|
+
type SearchService = {
|
|
88
|
+
search_service_name: string;
|
|
89
|
+
created: number;
|
|
90
|
+
country: string;
|
|
91
|
+
};
|
|
79
92
|
type ApiKeyValue = {
|
|
80
93
|
value: string;
|
|
81
94
|
version: number;
|
|
@@ -134,6 +147,18 @@ declare class FailedApiKeyResponse extends Response<ApiKey, Problem> {
|
|
|
134
147
|
toSuccess(): ApiKey;
|
|
135
148
|
toProblem(): Problem;
|
|
136
149
|
}
|
|
150
|
+
declare class SuccessfulSearchServiceResponse extends Response<SearchService, Problem> {
|
|
151
|
+
readonly searchService: SearchService;
|
|
152
|
+
constructor(searchService: SearchService);
|
|
153
|
+
toSuccess(): SearchService;
|
|
154
|
+
toProblem(): Problem;
|
|
155
|
+
}
|
|
156
|
+
declare class FailedSearchServiceResponse extends Response<SearchService, Problem> {
|
|
157
|
+
readonly problem: Problem;
|
|
158
|
+
constructor(problem: Problem);
|
|
159
|
+
toSuccess(): SearchService;
|
|
160
|
+
toProblem(): Problem;
|
|
161
|
+
}
|
|
137
162
|
declare class SuccessfulApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
138
163
|
readonly apiKeyValue: ApiKeyValue;
|
|
139
164
|
constructor(apiKeyValue: ApiKeyValue);
|
|
@@ -159,4 +184,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
159
184
|
toProblem(): Problem;
|
|
160
185
|
}
|
|
161
186
|
|
|
162
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, type List, type ListIdentity, type Problem, Response, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulResponse, TokenStatus, Tokens };
|
|
187
|
+
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, type List, type ListIdentity, type Problem, Response, type SearchService, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, TokenStatus, Tokens };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x2a308b){_0x2a308b[_0x2a308b['Ok']=0x0]='Ok',_0x2a308b[_0x2a308b['Refresh']=0x1]='Refresh',_0x2a308b[_0x2a308b['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(_0xf8d7e3){this['isSuccess']=_0xf8d7e3;}}class SuccessfulAccountResponse extends Response{constructor(_0x775645){super(!![]),this['account']=_0x775645;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x122d4f){super(![]),this['problem']=_0x122d4f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x38849d){super(!![]),this['tokens']=_0x38849d;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x355c1a){super(![]),this['problem']=_0x355c1a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x143438){super(!![]),this['apiKey']=_0x143438;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x7b9756){super(![]),this['problem']=_0x7b9756;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x4bf273){super(!![]),this['apiKeyValue']=_0x4bf273;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x3cf6d5){super(!![]),this['obj']=_0x3cf6d5;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x35001c){super(![]),this['problem']=_0x35001c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x2b7e91){super(![]),this['problem']=_0x2b7e91;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5a86b6,_0x27a414,_0x3dced5,_0x54213f){function _0xaf965b(_0x56a2ae){return _0x56a2ae instanceof _0x3dced5?_0x56a2ae:new _0x3dced5(function(_0x822439){_0x822439(_0x56a2ae);});}return new(_0x3dced5||(_0x3dced5=Promise))(function(_0x1c96ed,_0x1bd900){function _0x30b491(_0x434cd9){try{_0x339cce(_0x54213f['next'](_0x434cd9));}catch(_0xfb1c9a){_0x1bd900(_0xfb1c9a);}}function _0x5c9d85(_0x3903dc){try{_0x339cce(_0x54213f['throw'](_0x3903dc));}catch(_0x512063){_0x1bd900(_0x512063);}}function _0x339cce(_0x41e149){_0x41e149['done']?_0x1c96ed(_0x41e149['value']):_0xaf965b(_0x41e149['value'])['then'](_0x30b491,_0x5c9d85);}_0x339cce((_0x54213f=_0x54213f['apply'](_0x5a86b6,_0x27a414||[]))['next']());});};class AccountService{constructor(_0x3a5d10){this['fetch']=_0x3a5d10;}['get'](_0xb7fd5d,_0x395fad){return __awaiter$4(this,void 0,void 0,function*(){const _0x9f7e1a='Account/'+_0xb7fd5d+'/',_0x267e05=yield this['fetch']['get'](_0x9f7e1a,_0x395fad);try{if(_0x267e05['status']>0xc7&&_0x267e05['status']<0x12c){const _0x8065aa=yield _0x267e05['json']();return new SuccessfulAccountResponse(_0x8065aa);}const _0x4b5c83=yield _0x267e05['json']();return new FailedAccountResponse(_0x4b5c83);}catch(_0xe673ea){if(_0xe673ea instanceof Error)return new FailedAccountResponse({'detail':_0xe673ea['message'],'title':_0xe673ea['name'],'status':0x1f4,'instance':'','type':''});throw _0xe673ea;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x27f55f,_0xecb314,_0x5c02db,_0x102800){function _0x3d5fcf(_0x1a8824){return _0x1a8824 instanceof _0x5c02db?_0x1a8824:new _0x5c02db(function(_0x2b1b92){_0x2b1b92(_0x1a8824);});}return new(_0x5c02db||(_0x5c02db=Promise))(function(_0x424cc1,_0x51f70f){function _0x4a0a22(_0x2dad9a){try{_0x52ff19(_0x102800['next'](_0x2dad9a));}catch(_0xcba181){_0x51f70f(_0xcba181);}}function _0x1828b9(_0x59bc94){try{_0x52ff19(_0x102800['throw'](_0x59bc94));}catch(_0x2feda8){_0x51f70f(_0x2feda8);}}function _0x52ff19(_0x2a62f9){_0x2a62f9['done']?_0x424cc1(_0x2a62f9['value']):_0x3d5fcf(_0x2a62f9['value'])['then'](_0x4a0a22,_0x1828b9);}_0x52ff19((_0x102800=_0x102800['apply'](_0x27f55f,_0xecb314||[]))['next']());});};class ApiKeyService{constructor(_0x32c022){this['fetch']=_0x32c022,this['path']='api-key';}['create'](_0x3d4b1a,_0x2febf2,_0x1f7ae4){return __awaiter$3(this,void 0,void 0,function*(){const _0xe76f9b={'account_name':_0x3d4b1a,'api_key_name':_0x2febf2};try{const _0x2e32dc=yield this['fetch']['post'](this['path'],_0x1f7ae4,_0xe76f9b);if(_0x2e32dc['status']>0xc7&&_0x2e32dc['status']<0x12c){const _0x8eaa8c=yield _0x2e32dc['json']();return new SuccessfulApiKeyResponse(_0x8eaa8c);}const _0xcd822e=yield _0x2e32dc['json']();return new FailedApiKeyResponse(_0xcd822e);}catch(_0x5ae12d){if(_0x5ae12d instanceof Error)return new FailedApiKeyResponse({'detail':_0x5ae12d['message'],'title':_0x5ae12d['name'],'status':0x1f4,'instance':'','type':''});throw _0x5ae12d;}});}['view'](_0x518ded,_0x254109,_0x5636db){return __awaiter$3(this,void 0,void 0,function*(){const _0x1d36a5=this['path']+'/'+_0x518ded+'/'+_0x254109;try{const _0x2c0872=yield this['fetch']['get'](_0x1d36a5,_0x5636db);if(_0x2c0872['status']>0xc7&&_0x2c0872['status']<0x12c){const _0x345218=yield _0x2c0872['json']();return new SuccessfulApiKeyValueResponse(_0x345218);}const _0x5354d0=yield _0x2c0872['json']();return new FailedApiKeyValueResponse(_0x5354d0);}catch(_0x341830){if(_0x341830 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x341830['message'],'title':_0x341830['name'],'status':0x1f4,'instance':'','type':''});throw _0x341830;}});}['delete'](_0x2df9b0,_0x56f089,_0x2bfdc4){return __awaiter$3(this,void 0,void 0,function*(){const _0x2d81d3=this['path']+'/'+_0x2df9b0+'/'+_0x56f089;try{const _0x412b0f=yield this['fetch']['delete'](_0x2d81d3,_0x2bfdc4);if(_0x412b0f['status']>0xc7&&_0x412b0f['status']<0x12c){const _0x49a576=yield _0x412b0f['json']();return new SuccessfulResponse(_0x49a576);}const _0x5658e1=yield _0x412b0f['json']();return new FailedResponse(_0x5658e1);}catch(_0x2a1724){if(_0x2a1724 instanceof Error)return new FailedResponse({'detail':_0x2a1724['message'],'title':_0x2a1724['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a1724;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x4031b0,_0x1f1ffa,_0x5498b6,_0x39e1e5){function _0x20caae(_0x50b61b){return _0x50b61b instanceof _0x5498b6?_0x50b61b:new _0x5498b6(function(_0x223384){_0x223384(_0x50b61b);});}return new(_0x5498b6||(_0x5498b6=Promise))(function(_0x2330f,_0x5a4626){function _0x29c9b5(_0x21c3cc){try{_0x47fb65(_0x39e1e5['next'](_0x21c3cc));}catch(_0x4f7bae){_0x5a4626(_0x4f7bae);}}function _0x2ab76d(_0x2b826c){try{_0x47fb65(_0x39e1e5['throw'](_0x2b826c));}catch(_0x105b19){_0x5a4626(_0x105b19);}}function _0x47fb65(_0x3a14e0){_0x3a14e0['done']?_0x2330f(_0x3a14e0['value']):_0x20caae(_0x3a14e0['value'])['then'](_0x29c9b5,_0x2ab76d);}_0x47fb65((_0x39e1e5=_0x39e1e5['apply'](_0x4031b0,_0x1f1ffa||[]))['next']());});};class ListService{constructor(_0x113331){this['fetch']=_0x113331;}['add'](_0x3e7a64,_0x53f646,_0xc25477){return __awaiter$2(this,void 0,void 0,function*(){const _0x224b83='List',_0x38ad16={'account_name':_0x3e7a64,'list_name':_0x53f646};try{const _0x9e9ec3=yield this['fetch']['post'](_0x224b83,_0xc25477,_0x38ad16);if(_0x9e9ec3['status']>0xc7&&_0x9e9ec3['status']<0x12c){const _0x3cea10=yield _0x9e9ec3['json']();return new SuccessfulAccountResponse(_0x3cea10);}const _0x238925=yield _0x9e9ec3['json']();return new FailedAccountResponse(_0x238925);}catch(_0x348124){if(_0x348124 instanceof Error)return new FailedAccountResponse({'detail':_0x348124['message'],'title':_0x348124['name'],'status':0x1f4,'instance':'','type':''});throw _0x348124;}});}['remove'](_0x2fd63f,_0x34c869,_0x24084f){return __awaiter$2(this,void 0,void 0,function*(){const _0x4403ef='List/'+_0x2fd63f+'/'+_0x34c869,_0x1b18d7=yield this['fetch']['delete'](_0x4403ef,_0x24084f);try{if(_0x1b18d7['status']>0xc7&&_0x1b18d7['status']<0x12c){const _0x7a2824=yield _0x1b18d7['json']();return new SuccessfulAccountResponse(_0x7a2824);}const _0x25dd34=yield _0x1b18d7['json']();return new FailedAccountResponse(_0x25dd34);}catch(_0x8e46d7){if(_0x8e46d7 instanceof Error)return new FailedAccountResponse({'detail':_0x8e46d7['message'],'title':_0x8e46d7['name'],'status':0x1f4,'instance':'','type':''});throw _0x8e46d7;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3f6100,_0x1fedd3,_0xdfe76,_0xff7d93){function _0x38fa72(_0x2a045d){return _0x2a045d instanceof _0xdfe76?_0x2a045d:new _0xdfe76(function(_0x43234a){_0x43234a(_0x2a045d);});}return new(_0xdfe76||(_0xdfe76=Promise))(function(_0x42f46d,_0x650c87){function _0x2e8d16(_0x21ae29){try{_0x5a63b9(_0xff7d93['next'](_0x21ae29));}catch(_0x4850b3){_0x650c87(_0x4850b3);}}function _0x3d0034(_0x24fc94){try{_0x5a63b9(_0xff7d93['throw'](_0x24fc94));}catch(_0x6511){_0x650c87(_0x6511);}}function _0x5a63b9(_0x5deb12){_0x5deb12['done']?_0x42f46d(_0x5deb12['value']):_0x38fa72(_0x5deb12['value'])['then'](_0x2e8d16,_0x3d0034);}_0x5a63b9((_0xff7d93=_0xff7d93['apply'](_0x3f6100,_0x1fedd3||[]))['next']());});};class Fetch{constructor(_0x74f72f){this['baseUri']=_0x74f72f,this['getUrl']=_0x35f00a=>{return _0x35f00a['startsWith']('/')&&(_0x35f00a=_0x35f00a['replace']('/','')),''+this['baseUri']+_0x35f00a;},!_0x74f72f['endsWith']('/')&&(_0x74f72f=_0x74f72f+'/');}['get'](_0x2bf6f6,_0x36df34){return __awaiter$1(this,void 0,void 0,function*(){const _0x18eed9=this['getUrl'](_0x2bf6f6);return yield fetch(_0x18eed9,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x36df34}});});}['post'](_0x1ab288,_0x50ef7e,_0x4727b0){return __awaiter$1(this,void 0,void 0,function*(){const _0x48bfd6=this['getUrl'](_0x1ab288);return yield fetch(_0x48bfd6,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x50ef7e},'body':_0x4727b0?JSON['stringify'](_0x4727b0):null});});}['put'](_0x323e74,_0x45ac6c,_0x55f087){return __awaiter$1(this,void 0,void 0,function*(){const _0x58c6da=this['getUrl'](_0x323e74);return yield fetch(_0x58c6da,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x45ac6c},'body':_0x55f087?JSON['stringify'](_0x55f087):null});});}['delete'](_0x15a715,_0x13b25b){return __awaiter$1(this,void 0,void 0,function*(){const _0x1ce9b4=this['getUrl'](_0x15a715);return yield fetch(_0x1ce9b4,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x13b25b}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x25a31a,_0x18450e,_0xc4cf7b,_0x12908f){function _0x3a116a(_0x3aa515){return _0x3aa515 instanceof _0xc4cf7b?_0x3aa515:new _0xc4cf7b(function(_0x9a9b97){_0x9a9b97(_0x3aa515);});}return new(_0xc4cf7b||(_0xc4cf7b=Promise))(function(_0x24808d,_0x269922){function _0x128627(_0xa3abe9){try{_0x10eb42(_0x12908f['next'](_0xa3abe9));}catch(_0x1149c9){_0x269922(_0x1149c9);}}function _0x17967a(_0x3e61e3){try{_0x10eb42(_0x12908f['throw'](_0x3e61e3));}catch(_0x3bba12){_0x269922(_0x3bba12);}}function _0x10eb42(_0x21775b){_0x21775b['done']?_0x24808d(_0x21775b['value']):_0x3a116a(_0x21775b['value'])['then'](_0x128627,_0x17967a);}_0x10eb42((_0x12908f=_0x12908f['apply'](_0x25a31a,_0x18450e||[]))['next']());});};class AdminClient{constructor(_0x2ea3e8='https://admin.searchability.dev/'){var _0x4f6485=new Fetch(_0x2ea3e8);this['Accounts']=new AccountService(_0x4f6485),this['Lists']=new ListService(_0x4f6485),this['ApiKeys']=new ApiKeyService(_0x4f6485);}}class AuthClient{constructor(_0x5a4b3f='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5a4b3f);}['login'](_0x55ccd9){return __awaiter(this,void 0,void 0,function*(){var _0x325657='login/'+_0x55ccd9;try{const _0x4a263e=yield yield fetch(_0x325657);if(_0x4a263e['status']>0xc7&&_0x4a263e['status']<0x12c){const _0x4548c6=yield _0x4a263e['json']();return new SuccessfulAuthResponse(_0x4548c6);}const _0x5460ac=yield _0x4a263e['json']();return new FailedAuthResponse(_0x5460ac);}catch(_0x52a367){if(_0x52a367 instanceof Error)return new FailedAuthResponse({'detail':_0x52a367['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x52a367;}});}['refresh'](_0x1950e9){return __awaiter(this,void 0,void 0,function*(){var _0x269ff7='refresh';try{const _0x51e0be=yield this['fetch']['post'](_0x269ff7,_0x1950e9,null);if(_0x51e0be['status']>0xc7&&_0x51e0be['status']<0x12c){const _0x293cca=yield _0x51e0be['json']();return new SuccessfulAuthResponse(_0x293cca);}const _0x13a40f=yield _0x51e0be['json']();return new FailedAuthResponse(_0x13a40f);}catch(_0x244f38){if(_0x244f38 instanceof Error)return new FailedAuthResponse({'detail':_0x244f38['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x244f38;}});}['getTokenStatus'](_0x4ee299){if(Date['now']()<_0x4ee299['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4ee299['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
12
|
-
|
|
13
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|