@searchability/admin-client 0.0.31 → 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,18 +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
|
-
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
14
|
-
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x848a6d,_0x1dc36e,_0x1aff4f,_0x280c26){function _0x27e531(_0x266fdb){return _0x266fdb instanceof _0x1aff4f?_0x266fdb:new _0x1aff4f(function(_0x371537){_0x371537(_0x266fdb);});}return new(_0x1aff4f||(_0x1aff4f=Promise))(function(_0x483fb6,_0x37def1){function _0x24fcf2(_0x28b4b0){try{_0x1304d8(_0x280c26['next'](_0x28b4b0));}catch(_0x497713){_0x37def1(_0x497713);}}function _0x275543(_0x1a35ce){try{_0x1304d8(_0x280c26['throw'](_0x1a35ce));}catch(_0x112286){_0x37def1(_0x112286);}}function _0x1304d8(_0x31e3eb){_0x31e3eb['done']?_0x483fb6(_0x31e3eb['value']):_0x27e531(_0x31e3eb['value'])['then'](_0x24fcf2,_0x275543);}_0x1304d8((_0x280c26=_0x280c26['apply'](_0x848a6d,_0x1dc36e||[]))['next']());});};class AdminClient{constructor(_0x9519ae='https://admin.searchability.dev/'){var _0x2e09fd=new Fetch(_0x9519ae);this['Accounts']=new AccountService(_0x2e09fd),this['Lists']=new ListService(_0x2e09fd),this['ApiKeys']=new ApiKeyService(_0x2e09fd);}}class AuthClient{constructor(_0x5d9b36='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5d9b36);}['login'](_0x4a3c12){return __awaiter(this,void 0,void 0,function*(){var _0x28e03e='login/'+_0x4a3c12;try{const _0x1b0554=yield yield fetch(_0x28e03e);if(_0x1b0554['status']>0xc7&&_0x1b0554['status']<0x12c){const _0x44c716=yield _0x1b0554['json']();return new SuccessfulAuthResponse(_0x44c716);}const _0x197cfd=yield _0x1b0554['json']();return new FailedAuthResponse(_0x197cfd);}catch(_0x28e374){if(_0x28e374 instanceof Error)return new FailedAuthResponse({'detail':_0x28e374['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x28e374;}});}['refresh'](_0x13b06f){return __awaiter(this,void 0,void 0,function*(){var _0x1fbfdd='refresh';try{const _0x384c23=yield this['fetch']['post'](_0x1fbfdd,_0x13b06f,null);if(_0x384c23['status']>0xc7&&_0x384c23['status']<0x12c){const _0x394572=yield _0x384c23['json']();return new SuccessfulAuthResponse(_0x394572);}const _0x21a334=yield _0x384c23['json']();return new FailedAuthResponse(_0x21a334);}catch(_0x387e98){if(_0x387e98 instanceof Error)return new FailedAuthResponse({'detail':_0x387e98['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x387e98;}});}}
|
|
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'];}}
|
|
16
14
|
|
|
17
15
|
exports.AdminClient = AdminClient;
|
|
18
16
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +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
|
-
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4b1918,_0x485782,_0x233c49,_0x4aa62c){function _0x1ecf15(_0x2d5581){return _0x2d5581 instanceof _0x233c49?_0x2d5581:new _0x233c49(function(_0x5415c1){_0x5415c1(_0x2d5581);});}return new(_0x233c49||(_0x233c49=Promise))(function(_0x4f6f76,_0x1afa2e){function _0x23d772(_0x2ca96b){try{_0x2e1861(_0x4aa62c['next'](_0x2ca96b));}catch(_0x6989ef){_0x1afa2e(_0x6989ef);}}function _0x45c3a7(_0xebacdd){try{_0x2e1861(_0x4aa62c['throw'](_0xebacdd));}catch(_0x2ed3fd){_0x1afa2e(_0x2ed3fd);}}function _0x2e1861(_0x3e17e2){_0x3e17e2['done']?_0x4f6f76(_0x3e17e2['value']):_0x1ecf15(_0x3e17e2['value'])['then'](_0x23d772,_0x45c3a7);}_0x2e1861((_0x4aa62c=_0x4aa62c['apply'](_0x4b1918,_0x485782||[]))['next']());});};class AdminClient{constructor(_0x2d0f5b='https://admin.searchability.dev/'){var _0x454a30=new Fetch(_0x2d0f5b);this['Accounts']=new AccountService(_0x454a30),this['Lists']=new ListService(_0x454a30),this['ApiKeys']=new ApiKeyService(_0x454a30);}}class AuthClient{constructor(_0x5c8248='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5c8248);}['login'](_0x34b02b){return __awaiter(this,void 0,void 0,function*(){var _0x9dedcd='login/'+_0x34b02b;try{const _0x2c3c38=yield yield fetch(_0x9dedcd);if(_0x2c3c38['status']>0xc7&&_0x2c3c38['status']<0x12c){const _0x2e37b=yield _0x2c3c38['json']();return new SuccessfulAuthResponse(_0x2e37b);}const _0x5c1d8f=yield _0x2c3c38['json']();return new FailedAuthResponse(_0x5c1d8f);}catch(_0xa8311){if(_0xa8311 instanceof Error)return new FailedAuthResponse({'detail':_0xa8311['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xa8311;}});}['refresh'](_0x1c999f){return __awaiter(this,void 0,void 0,function*(){var _0x22ccb7='refresh';try{const _0x28c19d=yield this['fetch']['post'](_0x22ccb7,_0x1c999f,null);if(_0x28c19d['status']>0xc7&&_0x28c19d['status']<0x12c){const _0x2d23ce=yield _0x28c19d['json']();return new SuccessfulAuthResponse(_0x2d23ce);}const _0x24fe67=yield _0x28c19d['json']();return new FailedAuthResponse(_0x24fe67);}catch(_0x3a7b70){if(_0x3a7b70 instanceof Error)return new FailedAuthResponse({'detail':_0x3a7b70['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3a7b70;}});}}
|
|
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'];}}
|
|
14
12
|
|
|
15
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 {
|
|
@@ -28,19 +30,6 @@ declare class ListService {
|
|
|
28
30
|
remove(accountName: string, listName: string, access_token: string): Promise<Response<Account, Problem>>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
declare enum TokenStatus {
|
|
32
|
-
Ok = 0,
|
|
33
|
-
Refresh = 1,
|
|
34
|
-
Expired = 2
|
|
35
|
-
}
|
|
36
|
-
declare class Tokens {
|
|
37
|
-
access_token: string;
|
|
38
|
-
access_expires: number;
|
|
39
|
-
refresh_token: string;
|
|
40
|
-
refresh_expires: number;
|
|
41
|
-
getStatus(): TokenStatus;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
33
|
declare class AdminClient {
|
|
45
34
|
constructor(baseUri?: string);
|
|
46
35
|
readonly Accounts: AccountService;
|
|
@@ -52,8 +41,20 @@ declare class AuthClient {
|
|
|
52
41
|
constructor(baseUri?: string);
|
|
53
42
|
login(apiKey: string): Promise<Response<Tokens, Problem>>;
|
|
54
43
|
refresh(refreshToken: string): Promise<Response<Tokens, Problem>>;
|
|
44
|
+
getTokenStatus(tokens: Tokens): TokenStatus;
|
|
55
45
|
}
|
|
56
46
|
|
|
47
|
+
declare enum TokenStatus {
|
|
48
|
+
Ok = 0,
|
|
49
|
+
Refresh = 1,
|
|
50
|
+
Expired = 2
|
|
51
|
+
}
|
|
52
|
+
declare class Tokens {
|
|
53
|
+
access_token: string;
|
|
54
|
+
access_expires: number;
|
|
55
|
+
refresh_token: string;
|
|
56
|
+
refresh_expires: number;
|
|
57
|
+
}
|
|
57
58
|
declare abstract class Response<S, F> {
|
|
58
59
|
readonly isSuccess: boolean;
|
|
59
60
|
constructor(isSuccess: boolean);
|
|
@@ -139,6 +140,18 @@ declare class SuccessfulApiKeyValueResponse extends Response<ApiKeyValue, Proble
|
|
|
139
140
|
toSuccess(): ApiKeyValue;
|
|
140
141
|
toProblem(): Problem;
|
|
141
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
|
+
}
|
|
142
155
|
declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
143
156
|
readonly problem: Problem;
|
|
144
157
|
constructor(problem: Problem);
|
|
@@ -146,4 +159,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
146
159
|
toProblem(): Problem;
|
|
147
160
|
}
|
|
148
161
|
|
|
149
|
-
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,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0xbff044){_0xbff044[_0xbff044['Ok']=0x0]='Ok',_0xbff044[_0xbff044['Refresh']=0x1]='Refresh',_0xbff044[_0xbff044['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}['getStatus'](){if(Date['now']()<this['access_expires'])return TokenStatus['Ok'];if(Date['now']()<this['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
2
|
-
|
|
3
|
-
class Response{constructor(_0x385844){this['isSuccess']=_0x385844;}}class SuccessfulAccountResponse extends Response{constructor(_0x27de5d){super(!![]),this['account']=_0x27de5d;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x9b9ed8){super(![]),this['problem']=_0x9b9ed8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x424888){super(!![]),this['tokens']=_0x424888;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x14adc8){super(![]),this['problem']=_0x14adc8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x31a59c){super(!![]),this['apiKey']=_0x31a59c;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5bef8d){super(![]),this['problem']=_0x5bef8d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x10788f){super(!![]),this['apiKeyValue']=_0x10788f;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x3ab8a8){super(![]),this['problem']=_0x3ab8a8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4fd89d,_0x10ba5a,_0x534a59,_0x183e42){function _0x23aad4(_0x46cdb8){return _0x46cdb8 instanceof _0x534a59?_0x46cdb8:new _0x534a59(function(_0x65904b){_0x65904b(_0x46cdb8);});}return new(_0x534a59||(_0x534a59=Promise))(function(_0x53aa90,_0x25cb33){function _0x451f96(_0x4009e5){try{_0x16d1e4(_0x183e42['next'](_0x4009e5));}catch(_0x1f80c7){_0x25cb33(_0x1f80c7);}}function _0x3ffde2(_0x10557a){try{_0x16d1e4(_0x183e42['throw'](_0x10557a));}catch(_0x40ac04){_0x25cb33(_0x40ac04);}}function _0x16d1e4(_0x481330){_0x481330['done']?_0x53aa90(_0x481330['value']):_0x23aad4(_0x481330['value'])['then'](_0x451f96,_0x3ffde2);}_0x16d1e4((_0x183e42=_0x183e42['apply'](_0x4fd89d,_0x10ba5a||[]))['next']());});};class AccountService{constructor(_0xcd91bf){this['fetch']=_0xcd91bf;}['get'](_0x27f48a,_0x1c7f5c){return __awaiter$4(this,void 0,void 0,function*(){const _0x1fd0ff='Account/'+_0x27f48a+'/',_0x37b434=yield this['fetch']['get'](_0x1fd0ff,_0x1c7f5c);try{if(_0x37b434['status']>0xc7&&_0x37b434['status']<0x12c){const _0x16d248=yield _0x37b434['json']();return new SuccessfulAccountResponse(_0x16d248);}const _0x324ded=yield _0x37b434['json']();return new FailedAccountResponse(_0x324ded);}catch(_0x22fff6){if(_0x22fff6 instanceof Error)return new FailedAccountResponse({'detail':_0x22fff6['message'],'title':_0x22fff6['name'],'status':0x1f4,'instance':'','type':''});throw _0x22fff6;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x266242,_0x1c9161,_0xa2295d,_0x407113){function _0x13e319(_0x24cd2a){return _0x24cd2a instanceof _0xa2295d?_0x24cd2a:new _0xa2295d(function(_0x21a0df){_0x21a0df(_0x24cd2a);});}return new(_0xa2295d||(_0xa2295d=Promise))(function(_0x5e00c3,_0x59ba2a){function _0x289539(_0x685ab2){try{_0x4334a1(_0x407113['next'](_0x685ab2));}catch(_0x522c6d){_0x59ba2a(_0x522c6d);}}function _0x164d7a(_0x594f54){try{_0x4334a1(_0x407113['throw'](_0x594f54));}catch(_0x943a95){_0x59ba2a(_0x943a95);}}function _0x4334a1(_0x2c4664){_0x2c4664['done']?_0x5e00c3(_0x2c4664['value']):_0x13e319(_0x2c4664['value'])['then'](_0x289539,_0x164d7a);}_0x4334a1((_0x407113=_0x407113['apply'](_0x266242,_0x1c9161||[]))['next']());});};class ApiKeyService{constructor(_0x5dd4ea){this['fetch']=_0x5dd4ea;}['create'](_0x408a6e,_0x355d7f,_0x4b6a19){return __awaiter$3(this,void 0,void 0,function*(){const _0x9cf359='api-key/create',_0x4ca5f3={'account_name':_0x408a6e,'api_key_name':_0x355d7f};try{const _0x58257c=yield this['fetch']['post'](_0x9cf359,_0x4b6a19,_0x4ca5f3);if(_0x58257c['status']>0xc7&&_0x58257c['status']<0x12c){const _0x5ae4c3=yield _0x58257c['json']();return new SuccessfulApiKeyResponse(_0x5ae4c3);}const _0xa94729=yield _0x58257c['json']();return new FailedApiKeyResponse(_0xa94729);}catch(_0xadcf1c){if(_0xadcf1c instanceof Error)return new FailedApiKeyResponse({'detail':_0xadcf1c['message'],'title':_0xadcf1c['name'],'status':0x1f4,'instance':'','type':''});throw _0xadcf1c;}});}['view'](_0x222218,_0x2d19d2,_0x14ca0e){return __awaiter$3(this,void 0,void 0,function*(){const _0x5536bd='api-key/'+_0x222218+'/'+_0x2d19d2;try{const _0x3e2a35=yield this['fetch']['get'](_0x5536bd,_0x14ca0e);if(_0x3e2a35['status']>0xc7&&_0x3e2a35['status']<0x12c){const _0x197c5a=yield _0x3e2a35['json']();return new SuccessfulApiKeyValueResponse(_0x197c5a);}const _0x4a6f55=yield _0x3e2a35['json']();return new FailedApiKeyValueResponse(_0x4a6f55);}catch(_0x11d612){if(_0x11d612 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x11d612['message'],'title':_0x11d612['name'],'status':0x1f4,'instance':'','type':''});throw _0x11d612;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x4031a3,_0x67f9af,_0x544047,_0x1746be){function _0x201160(_0x338948){return _0x338948 instanceof _0x544047?_0x338948:new _0x544047(function(_0x2dbdec){_0x2dbdec(_0x338948);});}return new(_0x544047||(_0x544047=Promise))(function(_0x51a38b,_0x16fc9f){function _0x2a40ff(_0x55fe66){try{_0x24ae65(_0x1746be['next'](_0x55fe66));}catch(_0xc60243){_0x16fc9f(_0xc60243);}}function _0xf6b40f(_0x218f38){try{_0x24ae65(_0x1746be['throw'](_0x218f38));}catch(_0x4dd058){_0x16fc9f(_0x4dd058);}}function _0x24ae65(_0x1e55dd){_0x1e55dd['done']?_0x51a38b(_0x1e55dd['value']):_0x201160(_0x1e55dd['value'])['then'](_0x2a40ff,_0xf6b40f);}_0x24ae65((_0x1746be=_0x1746be['apply'](_0x4031a3,_0x67f9af||[]))['next']());});};class ListService{constructor(_0x380f68){this['fetch']=_0x380f68;}['add'](_0x574ad9,_0x36687d,_0x1a0479){return __awaiter$2(this,void 0,void 0,function*(){const _0x3ffd1c='List',_0x12196e={'account_name':_0x574ad9,'list_name':_0x36687d};try{const _0x10779e=yield this['fetch']['post'](_0x3ffd1c,_0x1a0479,_0x12196e);if(_0x10779e['status']>0xc7&&_0x10779e['status']<0x12c){const _0x28d64b=yield _0x10779e['json']();return new SuccessfulAccountResponse(_0x28d64b);}const _0x5efd37=yield _0x10779e['json']();return new FailedAccountResponse(_0x5efd37);}catch(_0x510737){if(_0x510737 instanceof Error)return new FailedAccountResponse({'detail':_0x510737['message'],'title':_0x510737['name'],'status':0x1f4,'instance':'','type':''});throw _0x510737;}});}['remove'](_0x115a90,_0x48e2be,_0x2990a4){return __awaiter$2(this,void 0,void 0,function*(){const _0xeebf5b='List/'+_0x115a90+'/'+_0x48e2be,_0x38ea83=yield this['fetch']['delete'](_0xeebf5b,_0x2990a4);try{if(_0x38ea83['status']>0xc7&&_0x38ea83['status']<0x12c){const _0x2610cd=yield _0x38ea83['json']();return new SuccessfulAccountResponse(_0x2610cd);}const _0x2232eb=yield _0x38ea83['json']();return new FailedAccountResponse(_0x2232eb);}catch(_0x573d61){if(_0x573d61 instanceof Error)return new FailedAccountResponse({'detail':_0x573d61['message'],'title':_0x573d61['name'],'status':0x1f4,'instance':'','type':''});throw _0x573d61;}});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x32016c,_0x3497d3,_0x2fc238,_0x4956d4){function _0x3e8224(_0x2c8f2a){return _0x2c8f2a instanceof _0x2fc238?_0x2c8f2a:new _0x2fc238(function(_0x1bb2f9){_0x1bb2f9(_0x2c8f2a);});}return new(_0x2fc238||(_0x2fc238=Promise))(function(_0x2f2967,_0x3e7b03){function _0x833a4b(_0x2d7fd5){try{_0x2fe72c(_0x4956d4['next'](_0x2d7fd5));}catch(_0x436a68){_0x3e7b03(_0x436a68);}}function _0x314056(_0x34e8e3){try{_0x2fe72c(_0x4956d4['throw'](_0x34e8e3));}catch(_0x4f4251){_0x3e7b03(_0x4f4251);}}function _0x2fe72c(_0x1c2750){_0x1c2750['done']?_0x2f2967(_0x1c2750['value']):_0x3e8224(_0x1c2750['value'])['then'](_0x833a4b,_0x314056);}_0x2fe72c((_0x4956d4=_0x4956d4['apply'](_0x32016c,_0x3497d3||[]))['next']());});};class Fetch{constructor(_0x44e77e){this['baseUri']=_0x44e77e,this['getUrl']=_0x592618=>{return _0x592618['startsWith']('/')&&(_0x592618=_0x592618['replace']('/','')),''+this['baseUri']+_0x592618;},!_0x44e77e['endsWith']('/')&&(_0x44e77e=_0x44e77e+'/');}['get'](_0x4c846e,_0x2b1ab7){return __awaiter$1(this,void 0,void 0,function*(){const _0xc59ab4=this['getUrl'](_0x4c846e);return yield fetch(_0xc59ab4,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b1ab7}});});}['post'](_0x3e719a,_0x29d0b7,_0x4f96dc){return __awaiter$1(this,void 0,void 0,function*(){const _0xdab63e=this['getUrl'](_0x3e719a);return yield fetch(_0xdab63e,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x29d0b7},'body':_0x4f96dc?JSON['stringify'](_0x4f96dc):null});});}['put'](_0x1b24a7,_0x369667,_0x2072bd){return __awaiter$1(this,void 0,void 0,function*(){const _0xd036b0=this['getUrl'](_0x1b24a7);return yield fetch(_0xd036b0,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x369667},'body':_0x2072bd?JSON['stringify'](_0x2072bd):null});});}['delete'](_0x1bb753,_0x36c8a7){return __awaiter$1(this,void 0,void 0,function*(){const _0x3a8244=this['getUrl'](_0x1bb753);return yield fetch(_0x3a8244,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x36c8a7}});});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x242d7c,_0x3c8956,_0x3930ce,_0x39188b){function _0x44dce8(_0x5c399c){return _0x5c399c instanceof _0x3930ce?_0x5c399c:new _0x3930ce(function(_0x278c1a){_0x278c1a(_0x5c399c);});}return new(_0x3930ce||(_0x3930ce=Promise))(function(_0x1e0911,_0x2fc8bc){function _0x2436a8(_0x20db00){try{_0x53b5fc(_0x39188b['next'](_0x20db00));}catch(_0x3831bb){_0x2fc8bc(_0x3831bb);}}function _0x4bab73(_0x3b1c6f){try{_0x53b5fc(_0x39188b['throw'](_0x3b1c6f));}catch(_0x59d596){_0x2fc8bc(_0x59d596);}}function _0x53b5fc(_0x5e3724){_0x5e3724['done']?_0x1e0911(_0x5e3724['value']):_0x44dce8(_0x5e3724['value'])['then'](_0x2436a8,_0x4bab73);}_0x53b5fc((_0x39188b=_0x39188b['apply'](_0x242d7c,_0x3c8956||[]))['next']());});};class AdminClient{constructor(_0x3141fe='https://admin.searchability.dev/'){var _0x5b89ee=new Fetch(_0x3141fe);this['Accounts']=new AccountService(_0x5b89ee),this['Lists']=new ListService(_0x5b89ee),this['ApiKeys']=new ApiKeyService(_0x5b89ee);}}class AuthClient{constructor(_0x26c2ef='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x26c2ef);}['login'](_0x3876b0){return __awaiter(this,void 0,void 0,function*(){var _0x58aeda='login/'+_0x3876b0;try{const _0x5a0f22=yield yield fetch(_0x58aeda);if(_0x5a0f22['status']>0xc7&&_0x5a0f22['status']<0x12c){const _0x5dfc38=yield _0x5a0f22['json']();return new SuccessfulAuthResponse(_0x5dfc38);}const _0x5466a6=yield _0x5a0f22['json']();return new FailedAuthResponse(_0x5466a6);}catch(_0x3b5851){if(_0x3b5851 instanceof Error)return new FailedAuthResponse({'detail':_0x3b5851['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3b5851;}});}['refresh'](_0x166d5c){return __awaiter(this,void 0,void 0,function*(){var _0x5a7b2f='refresh';try{const _0x1d462f=yield this['fetch']['post'](_0x5a7b2f,_0x166d5c,null);if(_0x1d462f['status']>0xc7&&_0x1d462f['status']<0x12c){const _0x204a93=yield _0x1d462f['json']();return new SuccessfulAuthResponse(_0x204a93);}const _0x5e8431=yield _0x1d462f['json']();return new FailedAuthResponse(_0x5e8431);}catch(_0x2625fa){if(_0x2625fa instanceof Error)return new FailedAuthResponse({'detail':_0x2625fa['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2625fa;}});}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|