@searchability/admin-client 0.0.32 → 0.0.33
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,13 @@
|
|
|
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 };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x3b8b6f){_0x3b8b6f[_0x3b8b6f['Ok']=0x0]='Ok',_0x3b8b6f[_0x3b8b6f['Refresh']=0x1]='Refresh',_0x3b8b6f[_0x3b8b6f['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(_0x1a095c){this['isSuccess']=_0x1a095c;}}class SuccessfulAccountResponse extends Response{constructor(_0x3fc29b){super(!![]),this['account']=_0x3fc29b;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x54c2c7){super(![]),this['problem']=_0x54c2c7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x5f5522){super(!![]),this['tokens']=_0x5f5522;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x558a7b){super(![]),this['problem']=_0x558a7b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x391296){super(!![]),this['apiKey']=_0x391296;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x3dc2a3){super(![]),this['problem']=_0x3dc2a3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x419fd9){super(!![]),this['apiKeyValue']=_0x419fd9;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x176cad){super(!![]),this['obj']=_0x176cad;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x26e0f9){super(![]),this['problem']=_0x26e0f9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x24bb3a){super(![]),this['problem']=_0x24bb3a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x1b5497,_0x54c12f,_0x24d6f7,_0x47f4fc){function _0x554ea7(_0x328597){return _0x328597 instanceof _0x24d6f7?_0x328597:new _0x24d6f7(function(_0x5dfb56){_0x5dfb56(_0x328597);});}return new(_0x24d6f7||(_0x24d6f7=Promise))(function(_0x12b1b3,_0x4f4444){function _0x21a879(_0x153d07){try{_0x301a0e(_0x47f4fc['next'](_0x153d07));}catch(_0x344aac){_0x4f4444(_0x344aac);}}function _0x50cd49(_0x48227e){try{_0x301a0e(_0x47f4fc['throw'](_0x48227e));}catch(_0x6fe054){_0x4f4444(_0x6fe054);}}function _0x301a0e(_0x41038e){_0x41038e['done']?_0x12b1b3(_0x41038e['value']):_0x554ea7(_0x41038e['value'])['then'](_0x21a879,_0x50cd49);}_0x301a0e((_0x47f4fc=_0x47f4fc['apply'](_0x1b5497,_0x54c12f||[]))['next']());});};class AccountService{constructor(_0x52d634){this['fetch']=_0x52d634;}['get'](_0x384388,_0x503745){return __awaiter$4(this,void 0,void 0,function*(){const _0x272124='Account/'+_0x384388+'/',_0x1a09dd=yield this['fetch']['get'](_0x272124,_0x503745);try{if(_0x1a09dd['status']>0xc7&&_0x1a09dd['status']<0x12c){const _0x1076c6=yield _0x1a09dd['json']();return new SuccessfulAccountResponse(_0x1076c6);}const _0x533638=yield _0x1a09dd['json']();return new FailedAccountResponse(_0x533638);}catch(_0x42cd83){if(_0x42cd83 instanceof Error)return new FailedAccountResponse({'detail':_0x42cd83['message'],'title':_0x42cd83['name'],'status':0x1f4,'instance':'','type':''});throw _0x42cd83;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x359d8c,_0x174a1b,_0x168eeb,_0x3f6f86){function _0x4597dd(_0x8c243b){return _0x8c243b instanceof _0x168eeb?_0x8c243b:new _0x168eeb(function(_0x2549f8){_0x2549f8(_0x8c243b);});}return new(_0x168eeb||(_0x168eeb=Promise))(function(_0x2cff64,_0x392732){function _0x4e5c9e(_0x2b0daf){try{_0x502d1a(_0x3f6f86['next'](_0x2b0daf));}catch(_0x10057e){_0x392732(_0x10057e);}}function _0x30c721(_0x573fc4){try{_0x502d1a(_0x3f6f86['throw'](_0x573fc4));}catch(_0x49c683){_0x392732(_0x49c683);}}function _0x502d1a(_0x566642){_0x566642['done']?_0x2cff64(_0x566642['value']):_0x4597dd(_0x566642['value'])['then'](_0x4e5c9e,_0x30c721);}_0x502d1a((_0x3f6f86=_0x3f6f86['apply'](_0x359d8c,_0x174a1b||[]))['next']());});};class ApiKeyService{constructor(_0x418b39){this['fetch']=_0x418b39,this['path']='api-key';}['create'](_0x17dc23,_0x46a2a7,_0x4c5798){return __awaiter$3(this,void 0,void 0,function*(){const _0x257d4a={'account_name':_0x17dc23,'api_key_name':_0x46a2a7};try{const _0x45ddad=yield this['fetch']['post'](this['path'],_0x4c5798,_0x257d4a);if(_0x45ddad['status']>0xc7&&_0x45ddad['status']<0x12c){const _0x178794=yield _0x45ddad['json']();return new SuccessfulApiKeyResponse(_0x178794);}const _0x1e02fa=yield _0x45ddad['json']();return new FailedApiKeyResponse(_0x1e02fa);}catch(_0x388588){if(_0x388588 instanceof Error)return new FailedApiKeyResponse({'detail':_0x388588['message'],'title':_0x388588['name'],'status':0x1f4,'instance':'','type':''});throw _0x388588;}});}['view'](_0x2b4110,_0x17faa7,_0x70377d){return __awaiter$3(this,void 0,void 0,function*(){const _0x159083=this['path']+'/'+_0x2b4110+'/'+_0x17faa7;try{const _0x489c7e=yield this['fetch']['get'](_0x159083,_0x70377d);if(_0x489c7e['status']>0xc7&&_0x489c7e['status']<0x12c){const _0x1beb8c=yield _0x489c7e['json']();return new SuccessfulApiKeyValueResponse(_0x1beb8c);}const _0x5e7418=yield _0x489c7e['json']();return new FailedApiKeyValueResponse(_0x5e7418);}catch(_0x2a7f03){if(_0x2a7f03 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x2a7f03['message'],'title':_0x2a7f03['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a7f03;}});}['delete'](_0x3a2964,_0x65691,_0x2c94a9){return __awaiter$3(this,void 0,void 0,function*(){const _0x21e042=this['path']+'/'+_0x3a2964+'/'+_0x65691;try{const _0x1cfa1d=yield this['fetch']['delete'](_0x21e042,_0x2c94a9);if(_0x1cfa1d['status']>0xc7&&_0x1cfa1d['status']<0x12c){const _0x24d305=yield _0x1cfa1d['json']();return new SuccessfulResponse(_0x24d305);}const _0x2f3108=yield _0x1cfa1d['json']();return new FailedResponse(_0x2f3108);}catch(_0x39e8b2){if(_0x39e8b2 instanceof Error)return new FailedResponse({'detail':_0x39e8b2['message'],'title':_0x39e8b2['name'],'status':0x1f4,'instance':'','type':''});throw _0x39e8b2;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x78792b,_0x3486bc,_0x1d1bfe,_0x5ef047){function _0x337d5f(_0x5e915b){return _0x5e915b instanceof _0x1d1bfe?_0x5e915b:new _0x1d1bfe(function(_0x4c93aa){_0x4c93aa(_0x5e915b);});}return new(_0x1d1bfe||(_0x1d1bfe=Promise))(function(_0x45e02d,_0x28faf5){function _0x5b934b(_0x769c74){try{_0x5efef4(_0x5ef047['next'](_0x769c74));}catch(_0x16ed32){_0x28faf5(_0x16ed32);}}function _0x4fb10f(_0x2b9f2b){try{_0x5efef4(_0x5ef047['throw'](_0x2b9f2b));}catch(_0x5da09a){_0x28faf5(_0x5da09a);}}function _0x5efef4(_0xaf0201){_0xaf0201['done']?_0x45e02d(_0xaf0201['value']):_0x337d5f(_0xaf0201['value'])['then'](_0x5b934b,_0x4fb10f);}_0x5efef4((_0x5ef047=_0x5ef047['apply'](_0x78792b,_0x3486bc||[]))['next']());});};class ListService{constructor(_0x5c9054){this['fetch']=_0x5c9054;}['add'](_0x90cfd3,_0x516e64,_0x1c7395){return __awaiter$2(this,void 0,void 0,function*(){const _0x842766='List',_0xc74614={'account_name':_0x90cfd3,'list_name':_0x516e64};try{const _0x22f5a2=yield this['fetch']['post'](_0x842766,_0x1c7395,_0xc74614);if(_0x22f5a2['status']>0xc7&&_0x22f5a2['status']<0x12c){const _0xb45909=yield _0x22f5a2['json']();return new SuccessfulAccountResponse(_0xb45909);}const _0x49d8d8=yield _0x22f5a2['json']();return new FailedAccountResponse(_0x49d8d8);}catch(_0x138e05){if(_0x138e05 instanceof Error)return new FailedAccountResponse({'detail':_0x138e05['message'],'title':_0x138e05['name'],'status':0x1f4,'instance':'','type':''});throw _0x138e05;}});}['remove'](_0x27f10f,_0x2e9391,_0x6a45c1){return __awaiter$2(this,void 0,void 0,function*(){const _0xa5dd23='List/'+_0x27f10f+'/'+_0x2e9391,_0x2e8ff5=yield this['fetch']['delete'](_0xa5dd23,_0x6a45c1);try{if(_0x2e8ff5['status']>0xc7&&_0x2e8ff5['status']<0x12c){const _0x3d9131=yield _0x2e8ff5['json']();return new SuccessfulAccountResponse(_0x3d9131);}const _0x183a25=yield _0x2e8ff5['json']();return new FailedAccountResponse(_0x183a25);}catch(_0x394ac7){if(_0x394ac7 instanceof Error)return new FailedAccountResponse({'detail':_0x394ac7['message'],'title':_0x394ac7['name'],'status':0x1f4,'instance':'','type':''});throw _0x394ac7;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x45d2d7,_0x44b144,_0x484984,_0x5c1fdd){function _0x3400de(_0x5df613){return _0x5df613 instanceof _0x484984?_0x5df613:new _0x484984(function(_0x1f9369){_0x1f9369(_0x5df613);});}return new(_0x484984||(_0x484984=Promise))(function(_0x24f8ac,_0x53d1d5){function _0x378127(_0x1e454c){try{_0x5afb25(_0x5c1fdd['next'](_0x1e454c));}catch(_0x386eec){_0x53d1d5(_0x386eec);}}function _0x3671a5(_0x6c35d3){try{_0x5afb25(_0x5c1fdd['throw'](_0x6c35d3));}catch(_0x33422e){_0x53d1d5(_0x33422e);}}function _0x5afb25(_0x50ea3c){_0x50ea3c['done']?_0x24f8ac(_0x50ea3c['value']):_0x3400de(_0x50ea3c['value'])['then'](_0x378127,_0x3671a5);}_0x5afb25((_0x5c1fdd=_0x5c1fdd['apply'](_0x45d2d7,_0x44b144||[]))['next']());});};class Fetch{constructor(_0x3782be){this['baseUri']=_0x3782be,this['getUrl']=_0x26dd15=>{return _0x26dd15['startsWith']('/')&&(_0x26dd15=_0x26dd15['replace']('/','')),''+this['baseUri']+_0x26dd15;},!_0x3782be['endsWith']('/')&&(_0x3782be=_0x3782be+'/');}['get'](_0x3df1ae,_0x25d7cd){return __awaiter$1(this,void 0,void 0,function*(){const _0xee23c0=this['getUrl'](_0x3df1ae);return yield fetch(_0xee23c0,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x25d7cd}});});}['post'](_0x2123c8,_0x73b396,_0x2e46c1){return __awaiter$1(this,void 0,void 0,function*(){const _0x5c80d2=this['getUrl'](_0x2123c8);return yield fetch(_0x5c80d2,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x73b396},'body':_0x2e46c1?JSON['stringify'](_0x2e46c1):null});});}['put'](_0x1df788,_0x1baa54,_0x1b420b){return __awaiter$1(this,void 0,void 0,function*(){const _0xb0c43=this['getUrl'](_0x1df788);return yield fetch(_0xb0c43,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1baa54},'body':_0x1b420b?JSON['stringify'](_0x1b420b):null});});}['delete'](_0x356cc9,_0x48cdf2){return __awaiter$1(this,void 0,void 0,function*(){const _0x1d64fc=this['getUrl'](_0x356cc9);return yield fetch(_0x1d64fc,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x48cdf2}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x27d725,_0x511118,_0x253308,_0x1a3801){function _0x32fa20(_0x44ab7b){return _0x44ab7b instanceof _0x253308?_0x44ab7b:new _0x253308(function(_0x5b86b0){_0x5b86b0(_0x44ab7b);});}return new(_0x253308||(_0x253308=Promise))(function(_0xcfd942,_0x2cfd40){function _0x1c5e4d(_0x5cea95){try{_0x11504b(_0x1a3801['next'](_0x5cea95));}catch(_0x299634){_0x2cfd40(_0x299634);}}function _0x4febb1(_0x26e8a4){try{_0x11504b(_0x1a3801['throw'](_0x26e8a4));}catch(_0x4ab5e8){_0x2cfd40(_0x4ab5e8);}}function _0x11504b(_0x524946){_0x524946['done']?_0xcfd942(_0x524946['value']):_0x32fa20(_0x524946['value'])['then'](_0x1c5e4d,_0x4febb1);}_0x11504b((_0x1a3801=_0x1a3801['apply'](_0x27d725,_0x511118||[]))['next']());});};class AdminClient{constructor(_0x4bc30a='https://admin.searchability.dev/'){var _0x2af672=new Fetch(_0x4bc30a);this['Accounts']=new AccountService(_0x2af672),this['Lists']=new ListService(_0x2af672),this['ApiKeys']=new ApiKeyService(_0x2af672);}}class AuthClient{constructor(_0x278199='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x278199);}['login'](_0x395232){return __awaiter(this,void 0,void 0,function*(){var _0x39f9e0='login/'+_0x395232;try{const _0x31f661=yield yield fetch(_0x39f9e0);if(_0x31f661['status']>0xc7&&_0x31f661['status']<0x12c){const _0xfc7c52=yield _0x31f661['json']();return new SuccessfulAuthResponse(_0xfc7c52);}const _0x3e43b7=yield _0x31f661['json']();return new FailedAuthResponse(_0x3e43b7);}catch(_0xe5f69b){if(_0xe5f69b instanceof Error)return new FailedAuthResponse({'detail':_0xe5f69b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xe5f69b;}});}['refresh'](_0x3201b3){return __awaiter(this,void 0,void 0,function*(){var _0xc01af2='refresh';try{const _0xf57374=yield this['fetch']['post'](_0xc01af2,_0x3201b3,null);if(_0xf57374['status']>0xc7&&_0xf57374['status']<0x12c){const _0x26407c=yield _0xf57374['json']();return new SuccessfulAuthResponse(_0x26407c);}const _0x38e178=yield _0xf57374['json']();return new FailedAuthResponse(_0x38e178);}catch(_0x5f1ef6){if(_0x5f1ef6 instanceof Error)return new FailedAuthResponse({'detail':_0x5f1ef6['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5f1ef6;}});}['getTokenStatus'](_0x362df4){if(Date['now']()<_0x362df4['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x362df4['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
exports.AdminClient = AdminClient;
|
|
16
16
|
exports.AuthClient = AuthClient;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x1201be){_0x1201be[_0x1201be['Ok']=0x0]='Ok',_0x1201be[_0x1201be['Refresh']=0x1]='Refresh',_0x1201be[_0x1201be['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(_0xce9c17){this['isSuccess']=_0xce9c17;}}class SuccessfulAccountResponse extends Response{constructor(_0x4c2ada){super(!![]),this['account']=_0x4c2ada;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0xe983c2){super(![]),this['problem']=_0xe983c2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x2c3720){super(!![]),this['tokens']=_0x2c3720;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0xf0bcb4){super(![]),this['problem']=_0xf0bcb4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x56adda){super(!![]),this['apiKey']=_0x56adda;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x35a6cc){super(![]),this['problem']=_0x35a6cc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x5d72f4){super(!![]),this['apiKeyValue']=_0x5d72f4;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x149f21){super(!![]),this['obj']=_0x149f21;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x2ab644){super(![]),this['problem']=_0x2ab644;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x111b0e){super(![]),this['problem']=_0x111b0e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
2
|
|
|
3
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
3
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4aa612,_0x324a77,_0x5a3abc,_0x32ea3f){function _0x36a9fe(_0x4c0e8a){return _0x4c0e8a instanceof _0x5a3abc?_0x4c0e8a:new _0x5a3abc(function(_0x19a494){_0x19a494(_0x4c0e8a);});}return new(_0x5a3abc||(_0x5a3abc=Promise))(function(_0x53a123,_0x2489c5){function _0x325d45(_0x42ae3a){try{_0x1e40af(_0x32ea3f['next'](_0x42ae3a));}catch(_0x565249){_0x2489c5(_0x565249);}}function _0x1a3469(_0xe3ec3f){try{_0x1e40af(_0x32ea3f['throw'](_0xe3ec3f));}catch(_0x5a05f4){_0x2489c5(_0x5a05f4);}}function _0x1e40af(_0x19bcb6){_0x19bcb6['done']?_0x53a123(_0x19bcb6['value']):_0x36a9fe(_0x19bcb6['value'])['then'](_0x325d45,_0x1a3469);}_0x1e40af((_0x32ea3f=_0x32ea3f['apply'](_0x4aa612,_0x324a77||[]))['next']());});};class AccountService{constructor(_0x1c92c1){this['fetch']=_0x1c92c1;}['get'](_0x3ae18f,_0x12258b){return __awaiter$4(this,void 0,void 0,function*(){const _0x1fa705='Account/'+_0x3ae18f+'/',_0x4f3067=yield this['fetch']['get'](_0x1fa705,_0x12258b);try{if(_0x4f3067['status']>0xc7&&_0x4f3067['status']<0x12c){const _0x54f0cf=yield _0x4f3067['json']();return new SuccessfulAccountResponse(_0x54f0cf);}const _0x14ca4f=yield _0x4f3067['json']();return new FailedAccountResponse(_0x14ca4f);}catch(_0x12a979){if(_0x12a979 instanceof Error)return new FailedAccountResponse({'detail':_0x12a979['message'],'title':_0x12a979['name'],'status':0x1f4,'instance':'','type':''});throw _0x12a979;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3d4194,_0x243713,_0x543e9f,_0x59452e){function _0xd87569(_0xe3f0f5){return _0xe3f0f5 instanceof _0x543e9f?_0xe3f0f5:new _0x543e9f(function(_0x3e2347){_0x3e2347(_0xe3f0f5);});}return new(_0x543e9f||(_0x543e9f=Promise))(function(_0x4f0895,_0x4cd726){function _0x5caf88(_0x14d770){try{_0x3b3bcb(_0x59452e['next'](_0x14d770));}catch(_0x56e73a){_0x4cd726(_0x56e73a);}}function _0x59beea(_0x394cb3){try{_0x3b3bcb(_0x59452e['throw'](_0x394cb3));}catch(_0x435608){_0x4cd726(_0x435608);}}function _0x3b3bcb(_0xa7ecfb){_0xa7ecfb['done']?_0x4f0895(_0xa7ecfb['value']):_0xd87569(_0xa7ecfb['value'])['then'](_0x5caf88,_0x59beea);}_0x3b3bcb((_0x59452e=_0x59452e['apply'](_0x3d4194,_0x243713||[]))['next']());});};class ApiKeyService{constructor(_0x57b5eb){this['fetch']=_0x57b5eb,this['path']='api-key';}['create'](_0x28a331,_0x22e55b,_0x6ae8cd){return __awaiter$3(this,void 0,void 0,function*(){const _0xd88ad7={'account_name':_0x28a331,'api_key_name':_0x22e55b};try{const _0x2f43b1=yield this['fetch']['post'](this['path'],_0x6ae8cd,_0xd88ad7);if(_0x2f43b1['status']>0xc7&&_0x2f43b1['status']<0x12c){const _0x554423=yield _0x2f43b1['json']();return new SuccessfulApiKeyResponse(_0x554423);}const _0x43d65d=yield _0x2f43b1['json']();return new FailedApiKeyResponse(_0x43d65d);}catch(_0x3f0836){if(_0x3f0836 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3f0836['message'],'title':_0x3f0836['name'],'status':0x1f4,'instance':'','type':''});throw _0x3f0836;}});}['view'](_0x1ed568,_0x2d2693,_0x534849){return __awaiter$3(this,void 0,void 0,function*(){const _0x3fa080=this['path']+'/'+_0x1ed568+'/'+_0x2d2693;try{const _0x5b52af=yield this['fetch']['get'](_0x3fa080,_0x534849);if(_0x5b52af['status']>0xc7&&_0x5b52af['status']<0x12c){const _0x120836=yield _0x5b52af['json']();return new SuccessfulApiKeyValueResponse(_0x120836);}const _0x2ebc57=yield _0x5b52af['json']();return new FailedApiKeyValueResponse(_0x2ebc57);}catch(_0x3987d9){if(_0x3987d9 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x3987d9['message'],'title':_0x3987d9['name'],'status':0x1f4,'instance':'','type':''});throw _0x3987d9;}});}['delete'](_0xaa2fa1,_0x3e9cb0,_0x2cb03f){return __awaiter$3(this,void 0,void 0,function*(){const _0x4c0a2a=this['path']+'/'+_0xaa2fa1+'/'+_0x3e9cb0;try{const _0x11c4d8=yield this['fetch']['delete'](_0x4c0a2a,_0x2cb03f);if(_0x11c4d8['status']>0xc7&&_0x11c4d8['status']<0x12c){const _0x314582=yield _0x11c4d8['json']();return new SuccessfulResponse(_0x314582);}const _0x5de6ec=yield _0x11c4d8['json']();return new FailedResponse(_0x5de6ec);}catch(_0xb76352){if(_0xb76352 instanceof Error)return new FailedResponse({'detail':_0xb76352['message'],'title':_0xb76352['name'],'status':0x1f4,'instance':'','type':''});throw _0xb76352;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x20cc4b,_0x503e07,_0x548a1a,_0x4462ab){function _0xde6b54(_0x367ba5){return _0x367ba5 instanceof _0x548a1a?_0x367ba5:new _0x548a1a(function(_0x21dd60){_0x21dd60(_0x367ba5);});}return new(_0x548a1a||(_0x548a1a=Promise))(function(_0x4f8b94,_0x23a348){function _0x34e3fa(_0x564225){try{_0x4906bb(_0x4462ab['next'](_0x564225));}catch(_0x360ddd){_0x23a348(_0x360ddd);}}function _0x5cf949(_0x128586){try{_0x4906bb(_0x4462ab['throw'](_0x128586));}catch(_0x1eaed0){_0x23a348(_0x1eaed0);}}function _0x4906bb(_0x296af5){_0x296af5['done']?_0x4f8b94(_0x296af5['value']):_0xde6b54(_0x296af5['value'])['then'](_0x34e3fa,_0x5cf949);}_0x4906bb((_0x4462ab=_0x4462ab['apply'](_0x20cc4b,_0x503e07||[]))['next']());});};class ListService{constructor(_0x2f6d28){this['fetch']=_0x2f6d28;}['add'](_0x39e8af,_0x31c2dd,_0x2a2800){return __awaiter$2(this,void 0,void 0,function*(){const _0x2e368a='List',_0x176c48={'account_name':_0x39e8af,'list_name':_0x31c2dd};try{const _0x38e01f=yield this['fetch']['post'](_0x2e368a,_0x2a2800,_0x176c48);if(_0x38e01f['status']>0xc7&&_0x38e01f['status']<0x12c){const _0x192bac=yield _0x38e01f['json']();return new SuccessfulAccountResponse(_0x192bac);}const _0x131bd8=yield _0x38e01f['json']();return new FailedAccountResponse(_0x131bd8);}catch(_0x394381){if(_0x394381 instanceof Error)return new FailedAccountResponse({'detail':_0x394381['message'],'title':_0x394381['name'],'status':0x1f4,'instance':'','type':''});throw _0x394381;}});}['remove'](_0x5c12c3,_0x17d93e,_0x2dd7eb){return __awaiter$2(this,void 0,void 0,function*(){const _0x4e31b4='List/'+_0x5c12c3+'/'+_0x17d93e,_0x278a7c=yield this['fetch']['delete'](_0x4e31b4,_0x2dd7eb);try{if(_0x278a7c['status']>0xc7&&_0x278a7c['status']<0x12c){const _0x7b1081=yield _0x278a7c['json']();return new SuccessfulAccountResponse(_0x7b1081);}const _0x943014=yield _0x278a7c['json']();return new FailedAccountResponse(_0x943014);}catch(_0x32e0d3){if(_0x32e0d3 instanceof Error)return new FailedAccountResponse({'detail':_0x32e0d3['message'],'title':_0x32e0d3['name'],'status':0x1f4,'instance':'','type':''});throw _0x32e0d3;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x106fcb,_0x3a940f,_0x3150ed,_0x42e0fe){function _0x28a1f6(_0x3011e9){return _0x3011e9 instanceof _0x3150ed?_0x3011e9:new _0x3150ed(function(_0x31195e){_0x31195e(_0x3011e9);});}return new(_0x3150ed||(_0x3150ed=Promise))(function(_0x414d1c,_0x19b64e){function _0x2deb2c(_0x28d17b){try{_0x44c106(_0x42e0fe['next'](_0x28d17b));}catch(_0x3bad9d){_0x19b64e(_0x3bad9d);}}function _0xcf4c90(_0x3ee820){try{_0x44c106(_0x42e0fe['throw'](_0x3ee820));}catch(_0xd165e8){_0x19b64e(_0xd165e8);}}function _0x44c106(_0x39f5ad){_0x39f5ad['done']?_0x414d1c(_0x39f5ad['value']):_0x28a1f6(_0x39f5ad['value'])['then'](_0x2deb2c,_0xcf4c90);}_0x44c106((_0x42e0fe=_0x42e0fe['apply'](_0x106fcb,_0x3a940f||[]))['next']());});};class Fetch{constructor(_0x24280c){this['baseUri']=_0x24280c,this['getUrl']=_0x44f598=>{return _0x44f598['startsWith']('/')&&(_0x44f598=_0x44f598['replace']('/','')),''+this['baseUri']+_0x44f598;},!_0x24280c['endsWith']('/')&&(_0x24280c=_0x24280c+'/');}['get'](_0x50a44e,_0x1cdcaa){return __awaiter$1(this,void 0,void 0,function*(){const _0x2d9f1d=this['getUrl'](_0x50a44e);return yield fetch(_0x2d9f1d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1cdcaa}});});}['post'](_0x2013ff,_0x4771a4,_0x30a398){return __awaiter$1(this,void 0,void 0,function*(){const _0x4a67a4=this['getUrl'](_0x2013ff);return yield fetch(_0x4a67a4,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4771a4},'body':_0x30a398?JSON['stringify'](_0x30a398):null});});}['put'](_0x22efb1,_0x364b74,_0x2808a7){return __awaiter$1(this,void 0,void 0,function*(){const _0x161987=this['getUrl'](_0x22efb1);return yield fetch(_0x161987,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x364b74},'body':_0x2808a7?JSON['stringify'](_0x2808a7):null});});}['delete'](_0x332906,_0x50f13c){return __awaiter$1(this,void 0,void 0,function*(){const _0xdca07e=this['getUrl'](_0x332906);return yield fetch(_0xdca07e,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x50f13c}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x5304a3,_0x474a1a,_0x33d29c,_0x1c1e12){function _0x186b6a(_0x2263d1){return _0x2263d1 instanceof _0x33d29c?_0x2263d1:new _0x33d29c(function(_0x51e934){_0x51e934(_0x2263d1);});}return new(_0x33d29c||(_0x33d29c=Promise))(function(_0x39527f,_0x354c3e){function _0x360ae3(_0x277cfe){try{_0x4d6066(_0x1c1e12['next'](_0x277cfe));}catch(_0x1e84d5){_0x354c3e(_0x1e84d5);}}function _0x1ebb56(_0x3099d6){try{_0x4d6066(_0x1c1e12['throw'](_0x3099d6));}catch(_0x2dc0f4){_0x354c3e(_0x2dc0f4);}}function _0x4d6066(_0x28a7dd){_0x28a7dd['done']?_0x39527f(_0x28a7dd['value']):_0x186b6a(_0x28a7dd['value'])['then'](_0x360ae3,_0x1ebb56);}_0x4d6066((_0x1c1e12=_0x1c1e12['apply'](_0x5304a3,_0x474a1a||[]))['next']());});};class AdminClient{constructor(_0x196dd1='https://admin.searchability.dev/'){var _0x58368b=new Fetch(_0x196dd1);this['Accounts']=new AccountService(_0x58368b),this['Lists']=new ListService(_0x58368b),this['ApiKeys']=new ApiKeyService(_0x58368b);}}class AuthClient{constructor(_0x5d79a6='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5d79a6);}['login'](_0x37bdd5){return __awaiter(this,void 0,void 0,function*(){var _0x38b4cc='login/'+_0x37bdd5;try{const _0x68ef9a=yield yield fetch(_0x38b4cc);if(_0x68ef9a['status']>0xc7&&_0x68ef9a['status']<0x12c){const _0x154b57=yield _0x68ef9a['json']();return new SuccessfulAuthResponse(_0x154b57);}const _0x4ff48c=yield _0x68ef9a['json']();return new FailedAuthResponse(_0x4ff48c);}catch(_0x2562c7){if(_0x2562c7 instanceof Error)return new FailedAuthResponse({'detail':_0x2562c7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2562c7;}});}['refresh'](_0x23986a){return __awaiter(this,void 0,void 0,function*(){var _0x2179c8='refresh';try{const _0x5caf22=yield this['fetch']['post'](_0x2179c8,_0x23986a,null);if(_0x5caf22['status']>0xc7&&_0x5caf22['status']<0x12c){const _0x7083da=yield _0x5caf22['json']();return new SuccessfulAuthResponse(_0x7083da);}const _0x2dab13=yield _0x5caf22['json']();return new FailedAuthResponse(_0x2dab13);}catch(_0x2deb05){if(_0x2deb05 instanceof Error)return new FailedAuthResponse({'detail':_0x2deb05['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2deb05;}});}['getTokenStatus'](_0x131755){if(Date['now']()<_0x131755['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x131755['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
12
12
|
|
|
13
13
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -16,9 +16,11 @@ declare class AccountService {
|
|
|
16
16
|
|
|
17
17
|
declare class ApiKeyService {
|
|
18
18
|
readonly fetch: Fetch;
|
|
19
|
+
readonly path = "api-key";
|
|
19
20
|
constructor(fetch: Fetch);
|
|
20
21
|
create(account_name: string, api_key_Name: string, access_token: string): Promise<Response<ApiKey, Problem>>;
|
|
21
22
|
view(account_name: string, api_key_name: string, access_token: string): Promise<Response<ApiKeyValue, Problem>>;
|
|
23
|
+
delete(account_name: string, api_key_name: string, access_token: string): Promise<Response<any, Problem>>;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
declare class ListService {
|
|
@@ -138,6 +140,18 @@ declare class SuccessfulApiKeyValueResponse extends Response<ApiKeyValue, Proble
|
|
|
138
140
|
toSuccess(): ApiKeyValue;
|
|
139
141
|
toProblem(): Problem;
|
|
140
142
|
}
|
|
143
|
+
declare class SuccessfulResponse extends Response<any, Problem> {
|
|
144
|
+
readonly obj: any;
|
|
145
|
+
constructor(obj: any);
|
|
146
|
+
toSuccess(): any;
|
|
147
|
+
toProblem(): Problem;
|
|
148
|
+
}
|
|
149
|
+
declare class FailedResponse extends Response<any, Problem> {
|
|
150
|
+
readonly problem: Problem;
|
|
151
|
+
constructor(problem: Problem);
|
|
152
|
+
toSuccess(): any;
|
|
153
|
+
toProblem(): Problem;
|
|
154
|
+
}
|
|
141
155
|
declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
142
156
|
readonly problem: Problem;
|
|
143
157
|
constructor(problem: Problem);
|
|
@@ -145,4 +159,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
145
159
|
toProblem(): Problem;
|
|
146
160
|
}
|
|
147
161
|
|
|
148
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, type List, type ListIdentity, type Problem, Response, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, TokenStatus, Tokens };
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x4f58b5){_0x4f58b5[_0x4f58b5['Ok']=0x0]='Ok',_0x4f58b5[_0x4f58b5['Refresh']=0x1]='Refresh',_0x4f58b5[_0x4f58b5['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(_0x114535){this['isSuccess']=_0x114535;}}class SuccessfulAccountResponse extends Response{constructor(_0x580886){super(!![]),this['account']=_0x580886;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x7a06fe){super(![]),this['problem']=_0x7a06fe;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x582d93){super(!![]),this['tokens']=_0x582d93;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x470b3d){super(![]),this['problem']=_0x470b3d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x28ccf9){super(!![]),this['apiKey']=_0x28ccf9;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x123715){super(![]),this['problem']=_0x123715;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x288cd4){super(!![]),this['apiKeyValue']=_0x288cd4;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x5c9896){super(![]),this['problem']=_0x5c9896;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2eceab,_0x52c012,_0x3ae064,_0x2c9afd){function _0x2cc892(_0x37b707){return _0x37b707 instanceof _0x3ae064?_0x37b707:new _0x3ae064(function(_0x403138){_0x403138(_0x37b707);});}return new(_0x3ae064||(_0x3ae064=Promise))(function(_0x1fe38d,_0x2322e9){function _0x2a5c9a(_0x18e00e){try{_0x20b9d1(_0x2c9afd['next'](_0x18e00e));}catch(_0x208dd0){_0x2322e9(_0x208dd0);}}function _0x4b3e8d(_0x45bfd9){try{_0x20b9d1(_0x2c9afd['throw'](_0x45bfd9));}catch(_0x3c5b22){_0x2322e9(_0x3c5b22);}}function _0x20b9d1(_0x4ea42e){_0x4ea42e['done']?_0x1fe38d(_0x4ea42e['value']):_0x2cc892(_0x4ea42e['value'])['then'](_0x2a5c9a,_0x4b3e8d);}_0x20b9d1((_0x2c9afd=_0x2c9afd['apply'](_0x2eceab,_0x52c012||[]))['next']());});};class AccountService{constructor(_0xad7491){this['fetch']=_0xad7491;}['get'](_0xdf26b5,_0x1f1746){return __awaiter$4(this,void 0,void 0,function*(){const _0x9694de='Account/'+_0xdf26b5+'/',_0x1bf25d=yield this['fetch']['get'](_0x9694de,_0x1f1746);try{if(_0x1bf25d['status']>0xc7&&_0x1bf25d['status']<0x12c){const _0x4ab2ad=yield _0x1bf25d['json']();return new SuccessfulAccountResponse(_0x4ab2ad);}const _0x3d376e=yield _0x1bf25d['json']();return new FailedAccountResponse(_0x3d376e);}catch(_0x12eab3){if(_0x12eab3 instanceof Error)return new FailedAccountResponse({'detail':_0x12eab3['message'],'title':_0x12eab3['name'],'status':0x1f4,'instance':'','type':''});throw _0x12eab3;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x310716,_0x41e776,_0x4044f2,_0x305a47){function _0xa6f2a4(_0x5d7377){return _0x5d7377 instanceof _0x4044f2?_0x5d7377:new _0x4044f2(function(_0x583da4){_0x583da4(_0x5d7377);});}return new(_0x4044f2||(_0x4044f2=Promise))(function(_0x442074,_0x507352){function _0xa4c537(_0x3c68a7){try{_0x5b4f31(_0x305a47['next'](_0x3c68a7));}catch(_0x1b7403){_0x507352(_0x1b7403);}}function _0x3cec4c(_0x41b24b){try{_0x5b4f31(_0x305a47['throw'](_0x41b24b));}catch(_0x208225){_0x507352(_0x208225);}}function _0x5b4f31(_0x3a023f){_0x3a023f['done']?_0x442074(_0x3a023f['value']):_0xa6f2a4(_0x3a023f['value'])['then'](_0xa4c537,_0x3cec4c);}_0x5b4f31((_0x305a47=_0x305a47['apply'](_0x310716,_0x41e776||[]))['next']());});};class ApiKeyService{constructor(_0x5bf80b){this['fetch']=_0x5bf80b;}['create'](_0x35a771,_0x66eeb8,_0x3746c3){return __awaiter$3(this,void 0,void 0,function*(){const _0x213f83='api-key/create',_0x7ee802={'account_name':_0x35a771,'api_key_name':_0x66eeb8};try{const _0x35551f=yield this['fetch']['post'](_0x213f83,_0x3746c3,_0x7ee802);if(_0x35551f['status']>0xc7&&_0x35551f['status']<0x12c){const _0x567470=yield _0x35551f['json']();return new SuccessfulApiKeyResponse(_0x567470);}const _0x6221fb=yield _0x35551f['json']();return new FailedApiKeyResponse(_0x6221fb);}catch(_0x4509ea){if(_0x4509ea instanceof Error)return new FailedApiKeyResponse({'detail':_0x4509ea['message'],'title':_0x4509ea['name'],'status':0x1f4,'instance':'','type':''});throw _0x4509ea;}});}['view'](_0x53d5d5,_0x2dd48e,_0x220016){return __awaiter$3(this,void 0,void 0,function*(){const _0x1fb399='api-key/'+_0x53d5d5+'/'+_0x2dd48e;try{const _0x3247aa=yield this['fetch']['get'](_0x1fb399,_0x220016);if(_0x3247aa['status']>0xc7&&_0x3247aa['status']<0x12c){const _0x3d53bb=yield _0x3247aa['json']();return new SuccessfulApiKeyValueResponse(_0x3d53bb);}const _0x2e0000=yield _0x3247aa['json']();return new FailedApiKeyValueResponse(_0x2e0000);}catch(_0xda6790){if(_0xda6790 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0xda6790['message'],'title':_0xda6790['name'],'status':0x1f4,'instance':'','type':''});throw _0xda6790;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x166c19,_0x4f8330,_0xa52885,_0x23ed43){function _0x4b651b(_0x1221fb){return _0x1221fb instanceof _0xa52885?_0x1221fb:new _0xa52885(function(_0x569622){_0x569622(_0x1221fb);});}return new(_0xa52885||(_0xa52885=Promise))(function(_0x2a737c,_0x928801){function _0x35cd24(_0x376811){try{_0x20d91b(_0x23ed43['next'](_0x376811));}catch(_0x39dc0e){_0x928801(_0x39dc0e);}}function _0x1b84e1(_0x21b210){try{_0x20d91b(_0x23ed43['throw'](_0x21b210));}catch(_0x57b97c){_0x928801(_0x57b97c);}}function _0x20d91b(_0x536bd7){_0x536bd7['done']?_0x2a737c(_0x536bd7['value']):_0x4b651b(_0x536bd7['value'])['then'](_0x35cd24,_0x1b84e1);}_0x20d91b((_0x23ed43=_0x23ed43['apply'](_0x166c19,_0x4f8330||[]))['next']());});};class ListService{constructor(_0x1a36b8){this['fetch']=_0x1a36b8;}['add'](_0x44bfc8,_0x3d7cfe,_0x4f0180){return __awaiter$2(this,void 0,void 0,function*(){const _0x17fc7f='List',_0x5a1400={'account_name':_0x44bfc8,'list_name':_0x3d7cfe};try{const _0x5d1b6c=yield this['fetch']['post'](_0x17fc7f,_0x4f0180,_0x5a1400);if(_0x5d1b6c['status']>0xc7&&_0x5d1b6c['status']<0x12c){const _0x2b8931=yield _0x5d1b6c['json']();return new SuccessfulAccountResponse(_0x2b8931);}const _0x382914=yield _0x5d1b6c['json']();return new FailedAccountResponse(_0x382914);}catch(_0x4dd227){if(_0x4dd227 instanceof Error)return new FailedAccountResponse({'detail':_0x4dd227['message'],'title':_0x4dd227['name'],'status':0x1f4,'instance':'','type':''});throw _0x4dd227;}});}['remove'](_0x534eae,_0x4eda17,_0x45d452){return __awaiter$2(this,void 0,void 0,function*(){const _0x25e5e8='List/'+_0x534eae+'/'+_0x4eda17,_0x5656e9=yield this['fetch']['delete'](_0x25e5e8,_0x45d452);try{if(_0x5656e9['status']>0xc7&&_0x5656e9['status']<0x12c){const _0x1bde21=yield _0x5656e9['json']();return new SuccessfulAccountResponse(_0x1bde21);}const _0x12b653=yield _0x5656e9['json']();return new FailedAccountResponse(_0x12b653);}catch(_0x405c88){if(_0x405c88 instanceof Error)return new FailedAccountResponse({'detail':_0x405c88['message'],'title':_0x405c88['name'],'status':0x1f4,'instance':'','type':''});throw _0x405c88;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1994a4,_0x5f2478,_0x249c13,_0x38d0b2){function _0x44c84c(_0x4189e6){return _0x4189e6 instanceof _0x249c13?_0x4189e6:new _0x249c13(function(_0xbb9c2e){_0xbb9c2e(_0x4189e6);});}return new(_0x249c13||(_0x249c13=Promise))(function(_0x3333e2,_0x1b575f){function _0x50f0f0(_0xd8b1e){try{_0x2202a6(_0x38d0b2['next'](_0xd8b1e));}catch(_0x30acc9){_0x1b575f(_0x30acc9);}}function _0x38c42b(_0x5c951e){try{_0x2202a6(_0x38d0b2['throw'](_0x5c951e));}catch(_0x446715){_0x1b575f(_0x446715);}}function _0x2202a6(_0x4185fd){_0x4185fd['done']?_0x3333e2(_0x4185fd['value']):_0x44c84c(_0x4185fd['value'])['then'](_0x50f0f0,_0x38c42b);}_0x2202a6((_0x38d0b2=_0x38d0b2['apply'](_0x1994a4,_0x5f2478||[]))['next']());});};class Fetch{constructor(_0x2574ed){this['baseUri']=_0x2574ed,this['getUrl']=_0x1a4784=>{return _0x1a4784['startsWith']('/')&&(_0x1a4784=_0x1a4784['replace']('/','')),''+this['baseUri']+_0x1a4784;},!_0x2574ed['endsWith']('/')&&(_0x2574ed=_0x2574ed+'/');}['get'](_0x14ebef,_0x5b9513){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f4bde=this['getUrl'](_0x14ebef);return yield fetch(_0x3f4bde,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5b9513}});});}['post'](_0x2bcc5d,_0x19527b,_0x2c7e44){return __awaiter$1(this,void 0,void 0,function*(){const _0x34e458=this['getUrl'](_0x2bcc5d);return yield fetch(_0x34e458,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x19527b},'body':_0x2c7e44?JSON['stringify'](_0x2c7e44):null});});}['put'](_0x2a0b53,_0xe119a,_0x4247a0){return __awaiter$1(this,void 0,void 0,function*(){const _0x182986=this['getUrl'](_0x2a0b53);return yield fetch(_0x182986,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe119a},'body':_0x4247a0?JSON['stringify'](_0x4247a0):null});});}['delete'](_0x3c60c2,_0x35a97a){return __awaiter$1(this,void 0,void 0,function*(){const _0x488e04=this['getUrl'](_0x3c60c2);return yield fetch(_0x488e04,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x35a97a}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1dbb78,_0x573a85,_0x16df99,_0x4ed601){function _0x1fd13f(_0x194b56){return _0x194b56 instanceof _0x16df99?_0x194b56:new _0x16df99(function(_0x83a5b8){_0x83a5b8(_0x194b56);});}return new(_0x16df99||(_0x16df99=Promise))(function(_0x480902,_0xcf82cf){function _0x11e16d(_0x5098f3){try{_0x468f58(_0x4ed601['next'](_0x5098f3));}catch(_0xaef500){_0xcf82cf(_0xaef500);}}function _0x3a728a(_0x184e44){try{_0x468f58(_0x4ed601['throw'](_0x184e44));}catch(_0x34c2f0){_0xcf82cf(_0x34c2f0);}}function _0x468f58(_0x5933ac){_0x5933ac['done']?_0x480902(_0x5933ac['value']):_0x1fd13f(_0x5933ac['value'])['then'](_0x11e16d,_0x3a728a);}_0x468f58((_0x4ed601=_0x4ed601['apply'](_0x1dbb78,_0x573a85||[]))['next']());});};class AdminClient{constructor(_0x4a01a8='https://admin.searchability.dev/'){var _0x296634=new Fetch(_0x4a01a8);this['Accounts']=new AccountService(_0x296634),this['Lists']=new ListService(_0x296634),this['ApiKeys']=new ApiKeyService(_0x296634);}}class AuthClient{constructor(_0x1825fe='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x1825fe);}['login'](_0x54b05f){return __awaiter(this,void 0,void 0,function*(){var _0x5c8292='login/'+_0x54b05f;try{const _0x5276ff=yield yield fetch(_0x5c8292);if(_0x5276ff['status']>0xc7&&_0x5276ff['status']<0x12c){const _0x18284f=yield _0x5276ff['json']();return new SuccessfulAuthResponse(_0x18284f);}const _0x41b7b8=yield _0x5276ff['json']();return new FailedAuthResponse(_0x41b7b8);}catch(_0x1cd60a){if(_0x1cd60a instanceof Error)return new FailedAuthResponse({'detail':_0x1cd60a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1cd60a;}});}['refresh'](_0x1ac50f){return __awaiter(this,void 0,void 0,function*(){var _0x539465='refresh';try{const _0x306955=yield this['fetch']['post'](_0x539465,_0x1ac50f,null);if(_0x306955['status']>0xc7&&_0x306955['status']<0x12c){const _0x4d9f3b=yield _0x306955['json']();return new SuccessfulAuthResponse(_0x4d9f3b);}const _0x945c1=yield _0x306955['json']();return new FailedAuthResponse(_0x945c1);}catch(_0x3c74d7){if(_0x3c74d7 instanceof Error)return new FailedAuthResponse({'detail':_0x3c74d7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3c74d7;}});}['getTokenStatus'](_0x3a821e){if(Date['now']()<_0x3a821e['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3a821e['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
12
|
-
|
|
13
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|