@searchability/admin-client 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var TokenStatus;(function(_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 };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x45a749){_0x45a749[_0x45a749['Ok']=0x0]='Ok',_0x45a749[_0x45a749['Refresh']=0x1]='Refresh',_0x45a749[_0x45a749['Expired']=0x2]='Expired';}(exports.TokenStatus||(exports.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 exports.TokenStatus['Ok'];if(Date['now']()<this['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
4
4
|
|
|
5
|
-
class Response{constructor(
|
|
5
|
+
class Response{constructor(_0xc99447){this['isSuccess']=_0xc99447;}}class SuccessfulAccountResponse extends Response{constructor(_0x4478ce){super(!![]),this['account']=_0x4478ce;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x394a65){super(![]),this['problem']=_0x394a65;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x2c1923){super(!![]),this['tokens']=_0x2c1923;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x2f8ee3){super(![]),this['problem']=_0x2f8ee3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x36b972){super(!![]),this['apiKey']=_0x36b972;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x55e8c8){super(![]),this['problem']=_0x55e8c8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x14131f){super(!![]),this['apiKeyValue']=_0x14131f;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x165dda){super(![]),this['problem']=_0x165dda;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x531762,_0x175bf5,_0x2964bb,_0xe43f8f){function _0x18a546(_0x2550a4){return _0x2550a4 instanceof _0x2964bb?_0x2550a4:new _0x2964bb(function(_0x2723f3){_0x2723f3(_0x2550a4);});}return new(_0x2964bb||(_0x2964bb=Promise))(function(_0x4eff43,_0x2157ab){function _0x497bd3(_0x4f8bd0){try{_0x21073b(_0xe43f8f['next'](_0x4f8bd0));}catch(_0x2d835a){_0x2157ab(_0x2d835a);}}function _0x4c3e92(_0x1a1fc3){try{_0x21073b(_0xe43f8f['throw'](_0x1a1fc3));}catch(_0x4db35e){_0x2157ab(_0x4db35e);}}function _0x21073b(_0x575dfe){_0x575dfe['done']?_0x4eff43(_0x575dfe['value']):_0x18a546(_0x575dfe['value'])['then'](_0x497bd3,_0x4c3e92);}_0x21073b((_0xe43f8f=_0xe43f8f['apply'](_0x531762,_0x175bf5||[]))['next']());});};class AccountService{constructor(_0x390ff8){this['fetch']=_0x390ff8;}['get'](_0x4893a8,_0x2414d0){return __awaiter$4(this,void 0,void 0,function*(){const _0x3cf12a='Account/'+_0x4893a8+'/',_0x51d61=yield this['fetch']['get'](_0x3cf12a,_0x2414d0);try{if(_0x51d61['status']>0xc7&&_0x51d61['status']<0x12c){const _0x2894da=yield _0x51d61['json']();return new SuccessfulAccountResponse(_0x2894da);}const _0x420179=yield _0x51d61['json']();return new FailedAccountResponse(_0x420179);}catch(_0x4008c3){if(_0x4008c3 instanceof Error)return new FailedAccountResponse({'detail':_0x4008c3['message'],'title':_0x4008c3['name'],'status':0x1f4,'instance':'','type':''});throw _0x4008c3;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x207e83,_0x1dbc3c,_0x387f76,_0x3121fe){function _0x304c76(_0x384f39){return _0x384f39 instanceof _0x387f76?_0x384f39:new _0x387f76(function(_0x587761){_0x587761(_0x384f39);});}return new(_0x387f76||(_0x387f76=Promise))(function(_0x126fcb,_0x1b24a9){function _0x4fe45c(_0x3800eb){try{_0x426517(_0x3121fe['next'](_0x3800eb));}catch(_0x226c11){_0x1b24a9(_0x226c11);}}function _0x4cb852(_0x11ba92){try{_0x426517(_0x3121fe['throw'](_0x11ba92));}catch(_0x398f20){_0x1b24a9(_0x398f20);}}function _0x426517(_0x353178){_0x353178['done']?_0x126fcb(_0x353178['value']):_0x304c76(_0x353178['value'])['then'](_0x4fe45c,_0x4cb852);}_0x426517((_0x3121fe=_0x3121fe['apply'](_0x207e83,_0x1dbc3c||[]))['next']());});};class ApiKeyService{constructor(_0x386c95){this['fetch']=_0x386c95;}['create'](_0x3387cc,_0x4003b0,_0x358fa8){return __awaiter$3(this,void 0,void 0,function*(){const _0x134125='api-key/create',_0x364c26={'account_name':_0x3387cc,'api_key_name':_0x4003b0};try{const _0x574fd9=yield this['fetch']['post'](_0x134125,_0x358fa8,_0x364c26);if(_0x574fd9['status']>0xc7&&_0x574fd9['status']<0x12c){const _0x509ffa=yield _0x574fd9['json']();return new SuccessfulApiKeyResponse(_0x509ffa);}const _0x4971b0=yield _0x574fd9['json']();return new FailedApiKeyResponse(_0x4971b0);}catch(_0xc4c25b){if(_0xc4c25b instanceof Error)return new FailedApiKeyResponse({'detail':_0xc4c25b['message'],'title':_0xc4c25b['name'],'status':0x1f4,'instance':'','type':''});throw _0xc4c25b;}});}['view'](_0x544f61,_0x5d87b1,_0x34007e){return __awaiter$3(this,void 0,void 0,function*(){const _0x3e171d='api-key/'+_0x544f61+'/'+_0x5d87b1;try{const _0x488480=yield this['fetch']['get'](_0x3e171d,_0x34007e);if(_0x488480['status']>0xc7&&_0x488480['status']<0x12c){const _0x42fb01=yield _0x488480['json']();return new SuccessfulApiKeyValueResponse(_0x42fb01);}const _0x551b70=yield _0x488480['json']();return new FailedApiKeyValueResponse(_0x551b70);}catch(_0x52ab9b){if(_0x52ab9b instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x52ab9b['message'],'title':_0x52ab9b['name'],'status':0x1f4,'instance':'','type':''});throw _0x52ab9b;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x491130,_0x2825c7,_0x2ec2db,_0x43e9f4){function _0x28ffd9(_0x401156){return _0x401156 instanceof _0x2ec2db?_0x401156:new _0x2ec2db(function(_0x1d145c){_0x1d145c(_0x401156);});}return new(_0x2ec2db||(_0x2ec2db=Promise))(function(_0x19c23a,_0x3a7e04){function _0x1d5a54(_0xc222d1){try{_0x1f7415(_0x43e9f4['next'](_0xc222d1));}catch(_0x1bc98a){_0x3a7e04(_0x1bc98a);}}function _0x2d7d92(_0x30b4ff){try{_0x1f7415(_0x43e9f4['throw'](_0x30b4ff));}catch(_0x58acfb){_0x3a7e04(_0x58acfb);}}function _0x1f7415(_0x2eaac7){_0x2eaac7['done']?_0x19c23a(_0x2eaac7['value']):_0x28ffd9(_0x2eaac7['value'])['then'](_0x1d5a54,_0x2d7d92);}_0x1f7415((_0x43e9f4=_0x43e9f4['apply'](_0x491130,_0x2825c7||[]))['next']());});};class ListService{constructor(_0x35bcb0){this['fetch']=_0x35bcb0;}['add'](_0x1fc80c,_0x7cf528,_0x51c213){return __awaiter$2(this,void 0,void 0,function*(){const _0xad2969='List',_0x5a9679={'account_name':_0x1fc80c,'list_name':_0x7cf528};try{const _0x2f3075=yield this['fetch']['post'](_0xad2969,_0x51c213,_0x5a9679);if(_0x2f3075['status']>0xc7&&_0x2f3075['status']<0x12c){const _0x58eacd=yield _0x2f3075['json']();return new SuccessfulAccountResponse(_0x58eacd);}const _0x239567=yield _0x2f3075['json']();return new FailedAccountResponse(_0x239567);}catch(_0x36b399){if(_0x36b399 instanceof Error)return new FailedAccountResponse({'detail':_0x36b399['message'],'title':_0x36b399['name'],'status':0x1f4,'instance':'','type':''});throw _0x36b399;}});}['remove'](_0x4faa08,_0x16896b,_0x291314){return __awaiter$2(this,void 0,void 0,function*(){const _0x2b066b='List/'+_0x4faa08+'/'+_0x16896b,_0x2f29a6=yield this['fetch']['delete'](_0x2b066b,_0x291314);try{if(_0x2f29a6['status']>0xc7&&_0x2f29a6['status']<0x12c){const _0x2b6158=yield _0x2f29a6['json']();return new SuccessfulAccountResponse(_0x2b6158);}const _0x4b1bee=yield _0x2f29a6['json']();return new FailedAccountResponse(_0x4b1bee);}catch(_0x405500){if(_0x405500 instanceof Error)return new FailedAccountResponse({'detail':_0x405500['message'],'title':_0x405500['name'],'status':0x1f4,'instance':'','type':''});throw _0x405500;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2e8ab7,_0x176730,_0x89b6e6,_0x58d652){function _0x36e8af(_0x24b51e){return _0x24b51e instanceof _0x89b6e6?_0x24b51e:new _0x89b6e6(function(_0x31ec17){_0x31ec17(_0x24b51e);});}return new(_0x89b6e6||(_0x89b6e6=Promise))(function(_0x1b1675,_0x5e986f){function _0x38f1ce(_0x41fc1f){try{_0xcd75c5(_0x58d652['next'](_0x41fc1f));}catch(_0x5783f9){_0x5e986f(_0x5783f9);}}function _0x413a16(_0x2adbaf){try{_0xcd75c5(_0x58d652['throw'](_0x2adbaf));}catch(_0xe0a7af){_0x5e986f(_0xe0a7af);}}function _0xcd75c5(_0x4d180b){_0x4d180b['done']?_0x1b1675(_0x4d180b['value']):_0x36e8af(_0x4d180b['value'])['then'](_0x38f1ce,_0x413a16);}_0xcd75c5((_0x58d652=_0x58d652['apply'](_0x2e8ab7,_0x176730||[]))['next']());});};class Fetch{constructor(_0x1db8f0){this['baseUri']=_0x1db8f0,this['getUrl']=_0x2a4574=>{return _0x2a4574['startsWith']('/')&&(_0x2a4574=_0x2a4574['replace']('/','')),''+this['baseUri']+_0x2a4574;},!_0x1db8f0['endsWith']('/')&&(_0x1db8f0=_0x1db8f0+'/');}['get'](_0x4441a3,_0x4fe5e8){return __awaiter$1(this,void 0,void 0,function*(){const _0x5cdc09=this['getUrl'](_0x4441a3);return yield fetch(_0x5cdc09,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4fe5e8}});});}['post'](_0x3d19e3,_0x37d78c,_0x4571f6){return __awaiter$1(this,void 0,void 0,function*(){const _0x3a2aad=this['getUrl'](_0x3d19e3);return yield fetch(_0x3a2aad,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x37d78c},'body':_0x4571f6?JSON['stringify'](_0x4571f6):null});});}['put'](_0x4d9569,_0x2787ea,_0x33e690){return __awaiter$1(this,void 0,void 0,function*(){const _0x168969=this['getUrl'](_0x4d9569);return yield fetch(_0x168969,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2787ea},'body':_0x33e690?JSON['stringify'](_0x33e690):null});});}['delete'](_0x347355,_0x157c74){return __awaiter$1(this,void 0,void 0,function*(){const _0x1c8270=this['getUrl'](_0x347355);return yield fetch(_0x1c8270,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x157c74}});});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
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;}});}}
|
|
16
16
|
|
|
17
17
|
exports.AdminClient = AdminClient;
|
|
18
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x5d703e){_0x5d703e[_0x5d703e['Ok']=0x0]='Ok',_0x5d703e[_0x5d703e['Refresh']=0x1]='Refresh',_0x5d703e[_0x5d703e['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
2
|
|
|
3
|
-
class Response{constructor(
|
|
3
|
+
class Response{constructor(_0x387506){this['isSuccess']=_0x387506;}}class SuccessfulAccountResponse extends Response{constructor(_0x89a323){super(!![]),this['account']=_0x89a323;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x665556){super(![]),this['problem']=_0x665556;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x582e53){super(!![]),this['tokens']=_0x582e53;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x3be4ee){super(![]),this['problem']=_0x3be4ee;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x4d20a1){super(!![]),this['apiKey']=_0x4d20a1;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5017b8){super(![]),this['problem']=_0x5017b8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x55b0f6){super(!![]),this['apiKeyValue']=_0x55b0f6;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x1b6139){super(![]),this['problem']=_0x1b6139;}['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(_0x849e64,_0x136380,_0x42f3b7,_0x139eef){function _0xaf93b7(_0x423099){return _0x423099 instanceof _0x42f3b7?_0x423099:new _0x42f3b7(function(_0x19ce50){_0x19ce50(_0x423099);});}return new(_0x42f3b7||(_0x42f3b7=Promise))(function(_0x3f173a,_0xdb9568){function _0x37d019(_0x473b62){try{_0x54f127(_0x139eef['next'](_0x473b62));}catch(_0x497059){_0xdb9568(_0x497059);}}function _0x11eea1(_0x107b10){try{_0x54f127(_0x139eef['throw'](_0x107b10));}catch(_0x944ff4){_0xdb9568(_0x944ff4);}}function _0x54f127(_0x33fc91){_0x33fc91['done']?_0x3f173a(_0x33fc91['value']):_0xaf93b7(_0x33fc91['value'])['then'](_0x37d019,_0x11eea1);}_0x54f127((_0x139eef=_0x139eef['apply'](_0x849e64,_0x136380||[]))['next']());});};class AccountService{constructor(_0x3a87f4){this['fetch']=_0x3a87f4;}['get'](_0x516520,_0x1a6a94){return __awaiter$4(this,void 0,void 0,function*(){const _0x370013='Account/'+_0x516520+'/',_0x196ce4=yield this['fetch']['get'](_0x370013,_0x1a6a94);try{if(_0x196ce4['status']>0xc7&&_0x196ce4['status']<0x12c){const _0x2e48db=yield _0x196ce4['json']();return new SuccessfulAccountResponse(_0x2e48db);}const _0x87563d=yield _0x196ce4['json']();return new FailedAccountResponse(_0x87563d);}catch(_0x3d4b98){if(_0x3d4b98 instanceof Error)return new FailedAccountResponse({'detail':_0x3d4b98['message'],'title':_0x3d4b98['name'],'status':0x1f4,'instance':'','type':''});throw _0x3d4b98;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3414dc,_0x33026e,_0x470d3d,_0x36cbf4){function _0xf3e318(_0x31676e){return _0x31676e instanceof _0x470d3d?_0x31676e:new _0x470d3d(function(_0x596415){_0x596415(_0x31676e);});}return new(_0x470d3d||(_0x470d3d=Promise))(function(_0x189c25,_0x289e26){function _0xce37dc(_0x31958b){try{_0x43f530(_0x36cbf4['next'](_0x31958b));}catch(_0xc9fdf){_0x289e26(_0xc9fdf);}}function _0x1a399c(_0x4814a3){try{_0x43f530(_0x36cbf4['throw'](_0x4814a3));}catch(_0x410ffd){_0x289e26(_0x410ffd);}}function _0x43f530(_0x519dbe){_0x519dbe['done']?_0x189c25(_0x519dbe['value']):_0xf3e318(_0x519dbe['value'])['then'](_0xce37dc,_0x1a399c);}_0x43f530((_0x36cbf4=_0x36cbf4['apply'](_0x3414dc,_0x33026e||[]))['next']());});};class ApiKeyService{constructor(_0x2a4caf){this['fetch']=_0x2a4caf;}['create'](_0x3e3b81,_0x2077a0,_0x2be6b4){return __awaiter$3(this,void 0,void 0,function*(){const _0x520534='api-key/create',_0x4b5376={'account_name':_0x3e3b81,'api_key_name':_0x2077a0};try{const _0x471e65=yield this['fetch']['post'](_0x520534,_0x2be6b4,_0x4b5376);if(_0x471e65['status']>0xc7&&_0x471e65['status']<0x12c){const _0x19f965=yield _0x471e65['json']();return new SuccessfulApiKeyResponse(_0x19f965);}const _0x19e753=yield _0x471e65['json']();return new FailedApiKeyResponse(_0x19e753);}catch(_0x264e68){if(_0x264e68 instanceof Error)return new FailedApiKeyResponse({'detail':_0x264e68['message'],'title':_0x264e68['name'],'status':0x1f4,'instance':'','type':''});throw _0x264e68;}});}['view'](_0x2adfbf,_0x136cfc,_0x41a4c6){return __awaiter$3(this,void 0,void 0,function*(){const _0x29fa26='api-key/'+_0x2adfbf+'/'+_0x136cfc;try{const _0x20a73e=yield this['fetch']['get'](_0x29fa26,_0x41a4c6);if(_0x20a73e['status']>0xc7&&_0x20a73e['status']<0x12c){const _0x2c9cc7=yield _0x20a73e['json']();return new SuccessfulApiKeyValueResponse(_0x2c9cc7);}const _0x4d726a=yield _0x20a73e['json']();return new FailedApiKeyValueResponse(_0x4d726a);}catch(_0x1ad116){if(_0x1ad116 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x1ad116['message'],'title':_0x1ad116['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ad116;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x2b14fb,_0x3084fd,_0x416fb5,_0x31ee6a){function _0x174c12(_0x51bffe){return _0x51bffe instanceof _0x416fb5?_0x51bffe:new _0x416fb5(function(_0xd953c9){_0xd953c9(_0x51bffe);});}return new(_0x416fb5||(_0x416fb5=Promise))(function(_0x46cc68,_0x228743){function _0x22fe77(_0x3f8826){try{_0x3a5fe7(_0x31ee6a['next'](_0x3f8826));}catch(_0x47d7fe){_0x228743(_0x47d7fe);}}function _0x5cdac9(_0x50e044){try{_0x3a5fe7(_0x31ee6a['throw'](_0x50e044));}catch(_0x307dd4){_0x228743(_0x307dd4);}}function _0x3a5fe7(_0x5b6de5){_0x5b6de5['done']?_0x46cc68(_0x5b6de5['value']):_0x174c12(_0x5b6de5['value'])['then'](_0x22fe77,_0x5cdac9);}_0x3a5fe7((_0x31ee6a=_0x31ee6a['apply'](_0x2b14fb,_0x3084fd||[]))['next']());});};class ListService{constructor(_0x17bb65){this['fetch']=_0x17bb65;}['add'](_0x19dfd3,_0x194128,_0x4eb165){return __awaiter$2(this,void 0,void 0,function*(){const _0x394da7='List',_0x52d6ee={'account_name':_0x19dfd3,'list_name':_0x194128};try{const _0x3d17b0=yield this['fetch']['post'](_0x394da7,_0x4eb165,_0x52d6ee);if(_0x3d17b0['status']>0xc7&&_0x3d17b0['status']<0x12c){const _0x4e73dc=yield _0x3d17b0['json']();return new SuccessfulAccountResponse(_0x4e73dc);}const _0xa136fd=yield _0x3d17b0['json']();return new FailedAccountResponse(_0xa136fd);}catch(_0x291b49){if(_0x291b49 instanceof Error)return new FailedAccountResponse({'detail':_0x291b49['message'],'title':_0x291b49['name'],'status':0x1f4,'instance':'','type':''});throw _0x291b49;}});}['remove'](_0x412580,_0x543ae8,_0x9873d7){return __awaiter$2(this,void 0,void 0,function*(){const _0x235c53='List/'+_0x412580+'/'+_0x543ae8,_0x20c05b=yield this['fetch']['delete'](_0x235c53,_0x9873d7);try{if(_0x20c05b['status']>0xc7&&_0x20c05b['status']<0x12c){const _0xdcd8dd=yield _0x20c05b['json']();return new SuccessfulAccountResponse(_0xdcd8dd);}const _0x1cadf0=yield _0x20c05b['json']();return new FailedAccountResponse(_0x1cadf0);}catch(_0x14463d){if(_0x14463d instanceof Error)return new FailedAccountResponse({'detail':_0x14463d['message'],'title':_0x14463d['name'],'status':0x1f4,'instance':'','type':''});throw _0x14463d;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x121dfa,_0xac0ade,_0x5c0fe6,_0x3f036c){function _0x24aeed(_0x444201){return _0x444201 instanceof _0x5c0fe6?_0x444201:new _0x5c0fe6(function(_0x37dd5a){_0x37dd5a(_0x444201);});}return new(_0x5c0fe6||(_0x5c0fe6=Promise))(function(_0x36d6b0,_0xdca99b){function _0x3b43ce(_0x59bec1){try{_0x3afbcd(_0x3f036c['next'](_0x59bec1));}catch(_0x1967e3){_0xdca99b(_0x1967e3);}}function _0x201714(_0x3ba3a5){try{_0x3afbcd(_0x3f036c['throw'](_0x3ba3a5));}catch(_0x29fc9a){_0xdca99b(_0x29fc9a);}}function _0x3afbcd(_0x4032c4){_0x4032c4['done']?_0x36d6b0(_0x4032c4['value']):_0x24aeed(_0x4032c4['value'])['then'](_0x3b43ce,_0x201714);}_0x3afbcd((_0x3f036c=_0x3f036c['apply'](_0x121dfa,_0xac0ade||[]))['next']());});};class Fetch{constructor(_0x4ab113){this['baseUri']=_0x4ab113,this['getUrl']=_0x19c4a1=>{return _0x19c4a1['startsWith']('/')&&(_0x19c4a1=_0x19c4a1['replace']('/','')),''+this['baseUri']+_0x19c4a1;},!_0x4ab113['endsWith']('/')&&(_0x4ab113=_0x4ab113+'/');}['get'](_0x199cef,_0x293b89){return __awaiter$1(this,void 0,void 0,function*(){const _0x4fa28c=this['getUrl'](_0x199cef);return yield fetch(_0x4fa28c,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x293b89}});});}['post'](_0x5e0185,_0x32a104,_0x5efa0f){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f54bc=this['getUrl'](_0x5e0185);return yield fetch(_0x3f54bc,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x32a104},'body':_0x5efa0f?JSON['stringify'](_0x5efa0f):null});});}['put'](_0x1fbba0,_0x3c0b1f,_0x2b7189){return __awaiter$1(this,void 0,void 0,function*(){const _0x4e0205=this['getUrl'](_0x1fbba0);return yield fetch(_0x4e0205,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3c0b1f},'body':_0x2b7189?JSON['stringify'](_0x2b7189):null});});}['delete'](_0x4d3509,_0x49b084){return __awaiter$1(this,void 0,void 0,function*(){const _0x334c1b=this['getUrl'](_0x4d3509);return yield fetch(_0x334c1b,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x49b084}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
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;}});}}
|
|
14
14
|
|
|
15
|
-
export { AdminClient, AuthClient, Tokens };
|
|
15
|
+
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x1c24e7){_0x1c24e7[_0x1c24e7['Ok']=0x0]='Ok',_0x1c24e7[_0x1c24e7['Refresh']=0x1]='Refresh',_0x1c24e7[_0x1c24e7['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(_0x466916){this['isSuccess']=_0x466916;}}class SuccessfulAccountResponse extends Response{constructor(_0x5cd85){super(!![]),this['account']=_0x5cd85;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0xf8db75){super(![]),this['problem']=_0xf8db75;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x153196){super(!![]),this['tokens']=_0x153196;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x246ce6){super(![]),this['problem']=_0x246ce6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1adb57){super(!![]),this['apiKey']=_0x1adb57;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5473d3){super(![]),this['problem']=_0x5473d3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x4c040e){super(!![]),this['apiKeyValue']=_0x4c040e;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x14addb){super(![]),this['problem']=_0x14addb;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x3e7003,_0x405af2,_0x23925f,_0x46a238){function _0x58d464(_0x10b50a){return _0x10b50a instanceof _0x23925f?_0x10b50a:new _0x23925f(function(_0x26fc21){_0x26fc21(_0x10b50a);});}return new(_0x23925f||(_0x23925f=Promise))(function(_0xb62bfb,_0x4ad71c){function _0x9568e1(_0x321563){try{_0x25fbf0(_0x46a238['next'](_0x321563));}catch(_0x46b800){_0x4ad71c(_0x46b800);}}function _0x16667c(_0x546efd){try{_0x25fbf0(_0x46a238['throw'](_0x546efd));}catch(_0x4864b){_0x4ad71c(_0x4864b);}}function _0x25fbf0(_0x5cbea3){_0x5cbea3['done']?_0xb62bfb(_0x5cbea3['value']):_0x58d464(_0x5cbea3['value'])['then'](_0x9568e1,_0x16667c);}_0x25fbf0((_0x46a238=_0x46a238['apply'](_0x3e7003,_0x405af2||[]))['next']());});};class AccountService{constructor(_0x56520c){this['fetch']=_0x56520c;}['get'](_0x61fa1a,_0x1bc643){return __awaiter$4(this,void 0,void 0,function*(){const _0x222dd4='Account/'+_0x61fa1a+'/',_0x163ff3=yield this['fetch']['get'](_0x222dd4,_0x1bc643);try{if(_0x163ff3['status']>0xc7&&_0x163ff3['status']<0x12c){const _0xf1ce00=yield _0x163ff3['json']();return new SuccessfulAccountResponse(_0xf1ce00);}const _0x1e35b8=yield _0x163ff3['json']();return new FailedAccountResponse(_0x1e35b8);}catch(_0x45410e){if(_0x45410e instanceof Error)return new FailedAccountResponse({'detail':_0x45410e['message'],'title':_0x45410e['name'],'status':0x1f4,'instance':'','type':''});throw _0x45410e;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3458cf,_0x2c5821,_0x777c4,_0x4dce3f){function _0x2b0df1(_0x134d8c){return _0x134d8c instanceof _0x777c4?_0x134d8c:new _0x777c4(function(_0x244a40){_0x244a40(_0x134d8c);});}return new(_0x777c4||(_0x777c4=Promise))(function(_0x501788,_0x303b35){function _0x282b89(_0x100484){try{_0x2ec946(_0x4dce3f['next'](_0x100484));}catch(_0x1cc0b1){_0x303b35(_0x1cc0b1);}}function _0x3d0962(_0x165ab0){try{_0x2ec946(_0x4dce3f['throw'](_0x165ab0));}catch(_0x47ccbe){_0x303b35(_0x47ccbe);}}function _0x2ec946(_0x2308c5){_0x2308c5['done']?_0x501788(_0x2308c5['value']):_0x2b0df1(_0x2308c5['value'])['then'](_0x282b89,_0x3d0962);}_0x2ec946((_0x4dce3f=_0x4dce3f['apply'](_0x3458cf,_0x2c5821||[]))['next']());});};class ApiKeyService{constructor(_0x549a9f){this['fetch']=_0x549a9f;}['create'](_0x32d15d,_0x15e73b,_0x409fcf){return __awaiter$3(this,void 0,void 0,function*(){const _0x2b4e18='api-key/create',_0x292642={'account_name':_0x32d15d,'api_key_name':_0x15e73b};try{const _0x5bff52=yield this['fetch']['post'](_0x2b4e18,_0x409fcf,_0x292642);if(_0x5bff52['status']>0xc7&&_0x5bff52['status']<0x12c){const _0x5929a0=yield _0x5bff52['json']();return new SuccessfulApiKeyResponse(_0x5929a0);}const _0x3dcf20=yield _0x5bff52['json']();return new FailedApiKeyResponse(_0x3dcf20);}catch(_0x3155b5){if(_0x3155b5 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3155b5['message'],'title':_0x3155b5['name'],'status':0x1f4,'instance':'','type':''});throw _0x3155b5;}});}['view'](_0x1e891c,_0x14be47,_0x363848){return __awaiter$3(this,void 0,void 0,function*(){const _0x235204='api-key/'+_0x1e891c+'/'+_0x14be47;try{const _0x95d194=yield this['fetch']['get'](_0x235204,_0x363848);if(_0x95d194['status']>0xc7&&_0x95d194['status']<0x12c){const _0x13d8e6=yield _0x95d194['json']();return new SuccessfulApiKeyValueResponse(_0x13d8e6);}const _0x59da4c=yield _0x95d194['json']();return new FailedApiKeyValueResponse(_0x59da4c);}catch(_0x2005ce){if(_0x2005ce instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x2005ce['message'],'title':_0x2005ce['name'],'status':0x1f4,'instance':'','type':''});throw _0x2005ce;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xa61049,_0x1425d6,_0x433b0e,_0x1ad337){function _0x1b17d1(_0x1e3701){return _0x1e3701 instanceof _0x433b0e?_0x1e3701:new _0x433b0e(function(_0x13795c){_0x13795c(_0x1e3701);});}return new(_0x433b0e||(_0x433b0e=Promise))(function(_0x341b60,_0x3499a3){function _0x2f4a85(_0x5ccfd1){try{_0x2b8834(_0x1ad337['next'](_0x5ccfd1));}catch(_0x35b402){_0x3499a3(_0x35b402);}}function _0x412c29(_0x5c9f6d){try{_0x2b8834(_0x1ad337['throw'](_0x5c9f6d));}catch(_0xebba1e){_0x3499a3(_0xebba1e);}}function _0x2b8834(_0x4dfd97){_0x4dfd97['done']?_0x341b60(_0x4dfd97['value']):_0x1b17d1(_0x4dfd97['value'])['then'](_0x2f4a85,_0x412c29);}_0x2b8834((_0x1ad337=_0x1ad337['apply'](_0xa61049,_0x1425d6||[]))['next']());});};class ListService{constructor(_0x378e82){this['fetch']=_0x378e82;}['add'](_0x35f29f,_0x3e5900,_0x16d306){return __awaiter$2(this,void 0,void 0,function*(){const _0x23a81a='List',_0x23318d={'account_name':_0x35f29f,'list_name':_0x3e5900};try{const _0x25952e=yield this['fetch']['post'](_0x23a81a,_0x16d306,_0x23318d);if(_0x25952e['status']>0xc7&&_0x25952e['status']<0x12c){const _0xcdeddb=yield _0x25952e['json']();return new SuccessfulAccountResponse(_0xcdeddb);}const _0x1c401d=yield _0x25952e['json']();return new FailedAccountResponse(_0x1c401d);}catch(_0x1e3d6c){if(_0x1e3d6c instanceof Error)return new FailedAccountResponse({'detail':_0x1e3d6c['message'],'title':_0x1e3d6c['name'],'status':0x1f4,'instance':'','type':''});throw _0x1e3d6c;}});}['remove'](_0xeb093f,_0x5d3635,_0x30eb7e){return __awaiter$2(this,void 0,void 0,function*(){const _0x4850ec='List/'+_0xeb093f+'/'+_0x5d3635,_0x506e56=yield this['fetch']['delete'](_0x4850ec,_0x30eb7e);try{if(_0x506e56['status']>0xc7&&_0x506e56['status']<0x12c){const _0x673c5=yield _0x506e56['json']();return new SuccessfulAccountResponse(_0x673c5);}const _0x551adc=yield _0x506e56['json']();return new FailedAccountResponse(_0x551adc);}catch(_0x5c6aff){if(_0x5c6aff instanceof Error)return new FailedAccountResponse({'detail':_0x5c6aff['message'],'title':_0x5c6aff['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c6aff;}});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x38ba30,_0x2a88da,_0x204618,_0x347ba5){function _0x589648(_0x1c9a95){return _0x1c9a95 instanceof _0x204618?_0x1c9a95:new _0x204618(function(_0xd78867){_0xd78867(_0x1c9a95);});}return new(_0x204618||(_0x204618=Promise))(function(_0x418a68,_0x975baa){function _0x4e33b7(_0x5e1325){try{_0x2d8f43(_0x347ba5['next'](_0x5e1325));}catch(_0x1fa427){_0x975baa(_0x1fa427);}}function _0x3d4675(_0x355872){try{_0x2d8f43(_0x347ba5['throw'](_0x355872));}catch(_0x46e765){_0x975baa(_0x46e765);}}function _0x2d8f43(_0x20ea79){_0x20ea79['done']?_0x418a68(_0x20ea79['value']):_0x589648(_0x20ea79['value'])['then'](_0x4e33b7,_0x3d4675);}_0x2d8f43((_0x347ba5=_0x347ba5['apply'](_0x38ba30,_0x2a88da||[]))['next']());});};class Fetch{constructor(_0x23208c){this['baseUri']=_0x23208c,this['getUrl']=_0x529d17=>{return _0x529d17['startsWith']('/')&&(_0x529d17=_0x529d17['replace']('/','')),''+this['baseUri']+_0x529d17;},!_0x23208c['endsWith']('/')&&(_0x23208c=_0x23208c+'/');}['get'](_0x3563ba,_0x59d133){return __awaiter$1(this,void 0,void 0,function*(){const _0x493972=this['getUrl'](_0x3563ba);return yield fetch(_0x493972,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x59d133}});});}['post'](_0x479894,_0x53e044,_0x306ff5){return __awaiter$1(this,void 0,void 0,function*(){const _0x4dda7d=this['getUrl'](_0x479894);return yield fetch(_0x4dda7d,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x53e044},'body':_0x306ff5?JSON['stringify'](_0x306ff5):null});});}['put'](_0x1beb5a,_0x1b8658,_0x1e29a2){return __awaiter$1(this,void 0,void 0,function*(){const _0x18e583=this['getUrl'](_0x1beb5a);return yield fetch(_0x18e583,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1b8658},'body':_0x1e29a2?JSON['stringify'](_0x1e29a2):null});});}['delete'](_0x49a827,_0x270593){return __awaiter$1(this,void 0,void 0,function*(){const _0x1fdce8=this['getUrl'](_0x49a827);return yield fetch(_0x1fdce8,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x270593}});});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x71ccfc,_0x4d099e,_0xd0085b,_0x2c51a6){function _0x445a5b(_0x22174e){return _0x22174e instanceof _0xd0085b?_0x22174e:new _0xd0085b(function(_0xfed01b){_0xfed01b(_0x22174e);});}return new(_0xd0085b||(_0xd0085b=Promise))(function(_0x21b500,_0x54be2e){function _0xf6c3c4(_0x38f151){try{_0x86b62a(_0x2c51a6['next'](_0x38f151));}catch(_0x138322){_0x54be2e(_0x138322);}}function _0x584a66(_0x2657f4){try{_0x86b62a(_0x2c51a6['throw'](_0x2657f4));}catch(_0x157ea4){_0x54be2e(_0x157ea4);}}function _0x86b62a(_0x2c0e8f){_0x2c0e8f['done']?_0x21b500(_0x2c0e8f['value']):_0x445a5b(_0x2c0e8f['value'])['then'](_0xf6c3c4,_0x584a66);}_0x86b62a((_0x2c51a6=_0x2c51a6['apply'](_0x71ccfc,_0x4d099e||[]))['next']());});};class AdminClient{constructor(_0xe23e38='https://admin.searchability.dev/'){var _0x550b93=new Fetch(_0xe23e38);this['Accounts']=new AccountService(_0x550b93),this['Lists']=new ListService(_0x550b93),this['ApiKeys']=new ApiKeyService(_0x550b93);}}class AuthClient{constructor(_0x56a394='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x56a394);}['login'](_0x594dc3){return __awaiter(this,void 0,void 0,function*(){var _0x5205aa='login/'+_0x594dc3;try{const _0x49be9c=yield yield fetch(_0x5205aa);if(_0x49be9c['status']>0xc7&&_0x49be9c['status']<0x12c){const _0x130817=yield _0x49be9c['json']();return new SuccessfulAuthResponse(_0x130817);}const _0x234576=yield _0x49be9c['json']();return new FailedAuthResponse(_0x234576);}catch(_0x5b555d){if(_0x5b555d instanceof Error)return new FailedAuthResponse({'detail':_0x5b555d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5b555d;}});}['refresh'](_0xc94d66){return __awaiter(this,void 0,void 0,function*(){var _0x23778b='refresh';try{const _0xc57c75=yield this['fetch']['post'](_0x23778b,_0xc94d66,null);if(_0xc57c75['status']>0xc7&&_0xc57c75['status']<0x12c){const _0x2d55c2=yield _0xc57c75['json']();return new SuccessfulAuthResponse(_0x2d55c2);}const _0x4abad2=yield _0xc57c75['json']();return new FailedAuthResponse(_0x4abad2);}catch(_0x4ebbe2){if(_0x4ebbe2 instanceof Error)return new FailedAuthResponse({'detail':_0x4ebbe2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ebbe2;}});}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, Tokens };
|