@searchability/admin-client 0.0.21 → 0.0.23
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 __awaiter$5=undefined&&undefined['__awaiter']||function(_0x44f477,_0x1b83e7,_0x48ce9b,_0x52d587){function _0x1626b7(_0x3fe531){return _0x3fe531 instanceof _0x48ce9b?_0x3fe531:new _0x48ce9b(function(_0x58b07c){_0x58b07c(_0x3fe531);});}return new(_0x48ce9b||(_0x48ce9b=Promise))(function(_0x51be5b,_0x34634e){function _0x3fddd0(_0xb5ba75){try{_0x581be7(_0x52d587['next'](_0xb5ba75));}catch(_0x47e9fd){_0x34634e(_0x47e9fd);}}function _0x573b25(_0x418dc8){try{_0x581be7(_0x52d587['throw'](_0x418dc8));}catch(_0x2e02dc){_0x34634e(_0x2e02dc);}}function _0x581be7(_0x1d5f74){_0x1d5f74['done']?_0x51be5b(_0x1d5f74['value']):_0x1626b7(_0x1d5f74['value'])['then'](_0x3fddd0,_0x573b25);}_0x581be7((_0x52d587=_0x52d587['apply'](_0x44f477,_0x1b83e7||[]))['next']());});};class TokenManager{constructor(_0x20bb08){this['authClient']=_0x20bb08;}['getOrRefreshTokens'](_0x315b43){return __awaiter$5(this,void 0,void 0,function*(){if(Date['now']()<_0x315b43['access_expires'])return new SuccessfulAuthResponse(_0x315b43);if(Date['now']()<_0x315b43['refresh_expires'])return yield this['authClient']['refresh'](_0x315b43['refresh_token']);return new FailedAuthResponse({'detail':'Refresh\x20token\x20expired','title':'','status':0x194,'instance':'','type':''});});}}
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x45cf60){this['isSuccess']=_0x45cf60;}}class SuccessfulAccountResponse extends Response{constructor(_0x2a15f1){super(!![]),this['account']=_0x2a15f1;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x20e39b){super(![]),this['problem']=_0x20e39b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x83b875){super(!![]),this['tokens']=_0x83b875;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x182dd7){super(![]),this['problem']=_0x182dd7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x205bf){super(!![]),this['apiKey']=_0x205bf;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x557be8){super(![]),this['problem']=_0x557be8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x441ea5,_0x11aa17,_0x48d4c5,_0x40dff4){function _0x3de208(_0x2adc82){return _0x2adc82 instanceof _0x48d4c5?_0x2adc82:new _0x48d4c5(function(_0x53d671){_0x53d671(_0x2adc82);});}return new(_0x48d4c5||(_0x48d4c5=Promise))(function(_0x11bf6e,_0x5b0155){function _0xd48b4d(_0x5f5494){try{_0xaf3a66(_0x40dff4['next'](_0x5f5494));}catch(_0x4e20c5){_0x5b0155(_0x4e20c5);}}function _0x37bd99(_0x3f90b6){try{_0xaf3a66(_0x40dff4['throw'](_0x3f90b6));}catch(_0x254340){_0x5b0155(_0x254340);}}function _0xaf3a66(_0x306f23){_0x306f23['done']?_0x11bf6e(_0x306f23['value']):_0x3de208(_0x306f23['value'])['then'](_0xd48b4d,_0x37bd99);}_0xaf3a66((_0x40dff4=_0x40dff4['apply'](_0x441ea5,_0x11aa17||[]))['next']());});};class AccountService{constructor(_0x2703c2){this['fetch']=_0x2703c2;}['get'](_0x228b93,_0x1ea745){return __awaiter$4(this,void 0,void 0,function*(){const _0x1b548a='Account/'+_0x228b93+'/',_0x4453d2=yield this['fetch']['get'](_0x1b548a,_0x1ea745);try{if(_0x4453d2['status']>0xc7&&_0x4453d2['status']<0x12c){const _0x3b93c9=yield _0x4453d2['json']();return new SuccessfulAccountResponse(_0x3b93c9);}const _0x45735e=yield _0x4453d2['json']();return new FailedAccountResponse(_0x45735e);}catch(_0x11dc98){if(_0x11dc98 instanceof Error)return new FailedAccountResponse({'detail':_0x11dc98['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x11dc98;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5cdf06,_0x2ff28a,_0x379669,_0x2930da){function _0x3fd433(_0x1acd7b){return _0x1acd7b instanceof _0x379669?_0x1acd7b:new _0x379669(function(_0x2063ba){_0x2063ba(_0x1acd7b);});}return new(_0x379669||(_0x379669=Promise))(function(_0x349c2e,_0x85aa75){function _0x5e84dc(_0xfe89a8){try{_0x504fee(_0x2930da['next'](_0xfe89a8));}catch(_0x5c8dd5){_0x85aa75(_0x5c8dd5);}}function _0x523367(_0xe0ce95){try{_0x504fee(_0x2930da['throw'](_0xe0ce95));}catch(_0x2ca475){_0x85aa75(_0x2ca475);}}function _0x504fee(_0x43758b){_0x43758b['done']?_0x349c2e(_0x43758b['value']):_0x3fd433(_0x43758b['value'])['then'](_0x5e84dc,_0x523367);}_0x504fee((_0x2930da=_0x2930da['apply'](_0x5cdf06,_0x2ff28a||[]))['next']());});};class ApiKeyService{constructor(_0x3d36b8){this['fetch']=_0x3d36b8;}['create'](_0x4c5180,_0x1f4a0d,_0x5a382d){return __awaiter$3(this,void 0,void 0,function*(){const _0x11a57d='api-key/create',_0x1b6c34={'account_name':_0x4c5180,'name':_0x1f4a0d};try{const _0x56428c=yield this['fetch']['post'](_0x11a57d,_0x5a382d,_0x1b6c34);if(_0x56428c['status']>0xc7&&_0x56428c['status']<0x12c){const _0x6d04bb=yield _0x56428c['json']();return new SuccessfulApiKeyResponse(_0x6d04bb);}const _0x231940=yield _0x56428c['json']();return new FailedApiKeyResponse(_0x231940);}catch(_0x199053){if(_0x199053 instanceof Error)return new FailedApiKeyResponse({'detail':_0x199053['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x199053;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x25a745,_0x2ec3fb,_0x175d2f,_0x33af9a){function _0x1aade1(_0x1c926c){return _0x1c926c instanceof _0x175d2f?_0x1c926c:new _0x175d2f(function(_0xa22aee){_0xa22aee(_0x1c926c);});}return new(_0x175d2f||(_0x175d2f=Promise))(function(_0xa03cd3,_0x546585){function _0x15894f(_0x4663dc){try{_0x32f129(_0x33af9a['next'](_0x4663dc));}catch(_0x29eac7){_0x546585(_0x29eac7);}}function _0x1097f5(_0x3779a9){try{_0x32f129(_0x33af9a['throw'](_0x3779a9));}catch(_0x472a92){_0x546585(_0x472a92);}}function _0x32f129(_0x2e5c78){_0x2e5c78['done']?_0xa03cd3(_0x2e5c78['value']):_0x1aade1(_0x2e5c78['value'])['then'](_0x15894f,_0x1097f5);}_0x32f129((_0x33af9a=_0x33af9a['apply'](_0x25a745,_0x2ec3fb||[]))['next']());});};class ListService{constructor(_0x4f6463){this['fetch']=_0x4f6463;}['add'](_0x440a98,_0x20bb78,_0xe914c){return __awaiter$2(this,void 0,void 0,function*(){const _0x11fd6e='List',_0x48e319={'account_name':_0x440a98,'list_name':_0x20bb78};try{const _0x25368b=yield this['fetch']['post'](_0x11fd6e,_0xe914c,_0x48e319);if(_0x25368b['status']>0xc7&&_0x25368b['status']<0x12c){const _0x171062=yield _0x25368b['json']();return new SuccessfulAccountResponse(_0x171062);}const _0x10f8c0=yield _0x25368b['json']();return new FailedAccountResponse(_0x10f8c0);}catch(_0x16cd79){if(_0x16cd79 instanceof Error)return new FailedAccountResponse({'detail':_0x16cd79['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x16cd79;}});}['remove'](_0x389fdf,_0x1ea6f2,_0x496aa9){return __awaiter$2(this,void 0,void 0,function*(){const _0x573ec4='List/'+_0x389fdf+'/'+_0x1ea6f2,_0x4cbfb0=yield this['fetch']['delete'](_0x573ec4,_0x496aa9);try{if(_0x4cbfb0['status']>0xc7&&_0x4cbfb0['status']<0x12c){const _0x3c42f9=yield _0x4cbfb0['json']();return new SuccessfulAccountResponse(_0x3c42f9);}const _0x5a96b8=yield _0x4cbfb0['json']();return new FailedAccountResponse(_0x5a96b8);}catch(_0x9c8282){if(_0x9c8282 instanceof Error)return new FailedAccountResponse({'detail':_0x9c8282['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x9c8282;}});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2882c4,_0x4b4fec,_0x1288d2,_0x1fce2b){function _0x535a14(_0x196362){return _0x196362 instanceof _0x1288d2?_0x196362:new _0x1288d2(function(_0x51eadc){_0x51eadc(_0x196362);});}return new(_0x1288d2||(_0x1288d2=Promise))(function(_0x1aca60,_0x416953){function _0x4f19f6(_0x16b88d){try{_0x5627ce(_0x1fce2b['next'](_0x16b88d));}catch(_0x3066db){_0x416953(_0x3066db);}}function _0x4b52d3(_0x307f9b){try{_0x5627ce(_0x1fce2b['throw'](_0x307f9b));}catch(_0x13421a){_0x416953(_0x13421a);}}function _0x5627ce(_0x556378){_0x556378['done']?_0x1aca60(_0x556378['value']):_0x535a14(_0x556378['value'])['then'](_0x4f19f6,_0x4b52d3);}_0x5627ce((_0x1fce2b=_0x1fce2b['apply'](_0x2882c4,_0x4b4fec||[]))['next']());});};class Fetch{constructor(_0x3dcfce){this['baseUri']=_0x3dcfce,this['getUrl']=_0x458b61=>{return _0x458b61['startsWith']('/')&&(_0x458b61=_0x458b61['replace']('/','')),''+this['baseUri']+_0x458b61;},!_0x3dcfce['endsWith']('/')&&(_0x3dcfce=_0x3dcfce+'/');}['get'](_0x37afad,_0x4f6e6d){return __awaiter$1(this,void 0,void 0,function*(){const _0x17a626=this['getUrl'](_0x37afad);return yield fetch(_0x17a626,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4f6e6d}});});}['post'](_0x520208,_0x300dee,_0x2d2fc3){return __awaiter$1(this,void 0,void 0,function*(){const _0x55a618=this['getUrl'](_0x520208);return yield fetch(_0x55a618,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x300dee},'body':_0x2d2fc3?JSON['stringify'](_0x2d2fc3):null});});}['put'](_0x446bb5,_0x1578a9,_0x41f8ac){return __awaiter$1(this,void 0,void 0,function*(){const _0x1cf7f0=this['getUrl'](_0x446bb5);return yield fetch(_0x1cf7f0,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1578a9},'body':_0x41f8ac?JSON['stringify'](_0x41f8ac):null});});}['delete'](_0xf9151,_0x5de882){return __awaiter$1(this,void 0,void 0,function*(){const _0x4e0003=this['getUrl'](_0xf9151);return yield fetch(_0x4e0003,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5de882}});});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3403e8,_0x13b235,_0x178983,_0x4fe9c9){function _0x40247e(_0x4a8c73){return _0x4a8c73 instanceof _0x178983?_0x4a8c73:new _0x178983(function(_0x3bd9ec){_0x3bd9ec(_0x4a8c73);});}return new(_0x178983||(_0x178983=Promise))(function(_0xb71dca,_0x218214){function _0x26d7a2(_0x340a9f){try{_0x1dfa00(_0x4fe9c9['next'](_0x340a9f));}catch(_0x4a23a1){_0x218214(_0x4a23a1);}}function _0xc9b51e(_0x4fcd44){try{_0x1dfa00(_0x4fe9c9['throw'](_0x4fcd44));}catch(_0x3bad0c){_0x218214(_0x3bad0c);}}function _0x1dfa00(_0x2c5af9){_0x2c5af9['done']?_0xb71dca(_0x2c5af9['value']):_0x40247e(_0x2c5af9['value'])['then'](_0x26d7a2,_0xc9b51e);}_0x1dfa00((_0x4fe9c9=_0x4fe9c9['apply'](_0x3403e8,_0x13b235||[]))['next']());});};class AdminClient{constructor(_0xa3d5fd='https://admin.searchability.dev/'){var _0x27f0cc=new Fetch(_0xa3d5fd);this['Accounts']=new AccountService(_0x27f0cc),this['Lists']=new ListService(_0x27f0cc),this['ApiKeys']=new ApiKeyService(_0x27f0cc);}}class AuthClient{constructor(_0x3e1e80='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x3e1e80);}['login'](_0x883ae){return __awaiter(this,void 0,void 0,function*(){var _0x2ead09='login/'+_0x883ae;try{const _0x5d1151=yield yield fetch(_0x2ead09);if(_0x5d1151['status']>0xc7&&_0x5d1151['status']<0x12c){const _0x29bb0b=yield _0x5d1151['json']();return new SuccessfulAuthResponse(_0x29bb0b);}const _0x5d7616=yield _0x5d1151['json']();return new FailedAuthResponse(_0x5d7616);}catch(_0x23308d){if(_0x23308d instanceof Error)return new FailedAuthResponse({'detail':_0x23308d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x23308d;}});}['refresh'](_0x54f035){return __awaiter(this,void 0,void 0,function*(){var _0x2fe84e='refresh';try{const _0x4d758b=yield this['fetch']['post'](_0x2fe84e,_0x54f035,null);if(_0x4d758b['status']>0xc7&&_0x4d758b['status']<0x12c){const _0x4fe23b=yield _0x4d758b['json']();return new SuccessfulAuthResponse(_0x4fe23b);}const _0xcd3ada=yield _0x4d758b['json']();return new FailedAuthResponse(_0xcd3ada);}catch(_0x481aba){if(_0x481aba instanceof Error)return new FailedAuthResponse({'detail':_0x481aba['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x481aba;}});}}
|
|
14
|
+
|
|
15
|
+
export { AdminClient, AuthClient, TokenManager };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x30daa8,_0x46d1ad,_0x2ebcd2,_0x4077a9){function _0x2707c6(_0x2d4e29){return _0x2d4e29 instanceof _0x2ebcd2?_0x2d4e29:new _0x2ebcd2(function(_0x29e307){_0x29e307(_0x2d4e29);});}return new(_0x2ebcd2||(_0x2ebcd2=Promise))(function(_0x1372a0,_0x402bca){function _0x498abb(_0x303e29){try{_0x152a11(_0x4077a9['next'](_0x303e29));}catch(_0x3b6aa3){_0x402bca(_0x3b6aa3);}}function _0x4dbb09(_0x20fca1){try{_0x152a11(_0x4077a9['throw'](_0x20fca1));}catch(_0x2fc374){_0x402bca(_0x2fc374);}}function _0x152a11(_0x5183d4){_0x5183d4['done']?_0x1372a0(_0x5183d4['value']):_0x2707c6(_0x5183d4['value'])['then'](_0x498abb,_0x4dbb09);}_0x152a11((_0x4077a9=_0x4077a9['apply'](_0x30daa8,_0x46d1ad||[]))['next']());});};class TokenManager{constructor(_0x7543f7){this['authClient']=_0x7543f7;}['getOrRefreshTokens'](_0x11998e){return __awaiter$5(this,void 0,void 0,function*(){if(Date['now']()<_0x11998e['access_expires'])return new SuccessfulAuthResponse(_0x11998e);if(Date['now']()<_0x11998e['refresh_expires'])return yield this['authClient']['refresh'](_0x11998e['refresh_token']);return new FailedAuthResponse({'detail':'Refresh\x20token\x20expired','title':'','status':0x194,'instance':'','type':''});});}}
|
|
4
4
|
|
|
5
|
-
class Response{constructor(
|
|
5
|
+
class Response{constructor(_0x416de7){this['isSuccess']=_0x416de7;}}class SuccessfulAccountResponse extends Response{constructor(_0x3db019){super(!![]),this['account']=_0x3db019;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2d1de4){super(![]),this['problem']=_0x2d1de4;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x5765a2){super(!![]),this['tokens']=_0x5765a2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x34db6c){super(![]),this['problem']=_0x34db6c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1ba737){super(!![]),this['apiKey']=_0x1ba737;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x59ba96){super(![]),this['problem']=_0x59ba96;}['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(_0x4fcf35,_0x5c0b51,_0x1c9547,_0x9aaa65){function _0x454fa3(_0x3c6510){return _0x3c6510 instanceof _0x1c9547?_0x3c6510:new _0x1c9547(function(_0x107765){_0x107765(_0x3c6510);});}return new(_0x1c9547||(_0x1c9547=Promise))(function(_0x5037c6,_0x31ef0a){function _0x173fd8(_0x5a04cb){try{_0x36dc84(_0x9aaa65['next'](_0x5a04cb));}catch(_0x100bf4){_0x31ef0a(_0x100bf4);}}function _0x12adbc(_0xe8ed03){try{_0x36dc84(_0x9aaa65['throw'](_0xe8ed03));}catch(_0x8a0fb){_0x31ef0a(_0x8a0fb);}}function _0x36dc84(_0x4ffa1a){_0x4ffa1a['done']?_0x5037c6(_0x4ffa1a['value']):_0x454fa3(_0x4ffa1a['value'])['then'](_0x173fd8,_0x12adbc);}_0x36dc84((_0x9aaa65=_0x9aaa65['apply'](_0x4fcf35,_0x5c0b51||[]))['next']());});};class AccountService{constructor(_0xccd093){this['fetch']=_0xccd093;}['get'](_0x56f8a5,_0x15c01d){return __awaiter$4(this,void 0,void 0,function*(){const _0x1de3a3='Account/'+_0x56f8a5+'/',_0x3141f7=yield this['fetch']['get'](_0x1de3a3,_0x15c01d);try{if(_0x3141f7['status']>0xc7&&_0x3141f7['status']<0x12c){const _0x261f58=yield _0x3141f7['json']();return new SuccessfulAccountResponse(_0x261f58);}const _0x304335=yield _0x3141f7['json']();return new FailedAccountResponse(_0x304335);}catch(_0x2c9fdb){if(_0x2c9fdb instanceof Error)return new FailedAccountResponse({'detail':_0x2c9fdb['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2c9fdb;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x3cf3a3,_0x140cd7,_0x5f50e2,_0x19a3c5){function _0xdd6acc(_0x538b87){return _0x538b87 instanceof _0x5f50e2?_0x538b87:new _0x5f50e2(function(_0x2cdc3c){_0x2cdc3c(_0x538b87);});}return new(_0x5f50e2||(_0x5f50e2=Promise))(function(_0x443f1e,_0x5de789){function _0xe2841e(_0x527e20){try{_0x29bf8b(_0x19a3c5['next'](_0x527e20));}catch(_0x35f4b7){_0x5de789(_0x35f4b7);}}function _0x4449da(_0x1d841e){try{_0x29bf8b(_0x19a3c5['throw'](_0x1d841e));}catch(_0x52fece){_0x5de789(_0x52fece);}}function _0x29bf8b(_0x1da191){_0x1da191['done']?_0x443f1e(_0x1da191['value']):_0xdd6acc(_0x1da191['value'])['then'](_0xe2841e,_0x4449da);}_0x29bf8b((_0x19a3c5=_0x19a3c5['apply'](_0x3cf3a3,_0x140cd7||[]))['next']());});};class ApiKeyService{constructor(_0x326415){this['fetch']=_0x326415;}['create'](_0x436589,_0x41bc05,_0x527759){return __awaiter$3(this,void 0,void 0,function*(){const _0x1e0ba4='api-key/create',_0x4c9829={'account_name':_0x436589,'name':_0x41bc05};try{const _0x29f0ae=yield this['fetch']['post'](_0x1e0ba4,_0x527759,_0x4c9829);if(_0x29f0ae['status']>0xc7&&_0x29f0ae['status']<0x12c){const _0x377bcf=yield _0x29f0ae['json']();return new SuccessfulApiKeyResponse(_0x377bcf);}const _0x4a772c=yield _0x29f0ae['json']();return new FailedApiKeyResponse(_0x4a772c);}catch(_0xcfffc3){if(_0xcfffc3 instanceof Error)return new FailedApiKeyResponse({'detail':_0xcfffc3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xcfffc3;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x3e3e1e,_0xae332f,_0x41d5cc,_0x400401){function _0x285e66(_0x809834){return _0x809834 instanceof _0x41d5cc?_0x809834:new _0x41d5cc(function(_0x4ad534){_0x4ad534(_0x809834);});}return new(_0x41d5cc||(_0x41d5cc=Promise))(function(_0x1f4f6a,_0x5aa650){function _0x20e626(_0xa16206){try{_0x6731b9(_0x400401['next'](_0xa16206));}catch(_0x416673){_0x5aa650(_0x416673);}}function _0x4e2f05(_0x521ebc){try{_0x6731b9(_0x400401['throw'](_0x521ebc));}catch(_0x38c25f){_0x5aa650(_0x38c25f);}}function _0x6731b9(_0x45b093){_0x45b093['done']?_0x1f4f6a(_0x45b093['value']):_0x285e66(_0x45b093['value'])['then'](_0x20e626,_0x4e2f05);}_0x6731b9((_0x400401=_0x400401['apply'](_0x3e3e1e,_0xae332f||[]))['next']());});};class ListService{constructor(_0x34f7ab){this['fetch']=_0x34f7ab;}['add'](_0x22025c,_0x90be9c,_0x443081){return __awaiter$2(this,void 0,void 0,function*(){const _0x149c65='List',_0x83cd21={'account_name':_0x22025c,'list_name':_0x90be9c};try{const _0xb03c59=yield this['fetch']['post'](_0x149c65,_0x443081,_0x83cd21);if(_0xb03c59['status']>0xc7&&_0xb03c59['status']<0x12c){const _0x4bfca3=yield _0xb03c59['json']();return new SuccessfulAccountResponse(_0x4bfca3);}const _0x4711f9=yield _0xb03c59['json']();return new FailedAccountResponse(_0x4711f9);}catch(_0x23c94d){if(_0x23c94d instanceof Error)return new FailedAccountResponse({'detail':_0x23c94d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x23c94d;}});}['remove'](_0x585cb5,_0x406591,_0x28ef3b){return __awaiter$2(this,void 0,void 0,function*(){const _0x56ebb2='List/'+_0x585cb5+'/'+_0x406591,_0x566865=yield this['fetch']['delete'](_0x56ebb2,_0x28ef3b);try{if(_0x566865['status']>0xc7&&_0x566865['status']<0x12c){const _0x3ba098=yield _0x566865['json']();return new SuccessfulAccountResponse(_0x3ba098);}const _0x46c42f=yield _0x566865['json']();return new FailedAccountResponse(_0x46c42f);}catch(_0x5a937a){if(_0x5a937a instanceof Error)return new FailedAccountResponse({'detail':_0x5a937a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5a937a;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x30e969,_0xb8331,_0x2d6554,_0x11fc95){function _0x108094(_0x46914e){return _0x46914e instanceof _0x2d6554?_0x46914e:new _0x2d6554(function(_0x1cfb8e){_0x1cfb8e(_0x46914e);});}return new(_0x2d6554||(_0x2d6554=Promise))(function(_0x134846,_0x27da27){function _0x4099b2(_0x1fa98d){try{_0x3fa855(_0x11fc95['next'](_0x1fa98d));}catch(_0x17e4b2){_0x27da27(_0x17e4b2);}}function _0x30555d(_0x3c4282){try{_0x3fa855(_0x11fc95['throw'](_0x3c4282));}catch(_0x5e7262){_0x27da27(_0x5e7262);}}function _0x3fa855(_0xc73347){_0xc73347['done']?_0x134846(_0xc73347['value']):_0x108094(_0xc73347['value'])['then'](_0x4099b2,_0x30555d);}_0x3fa855((_0x11fc95=_0x11fc95['apply'](_0x30e969,_0xb8331||[]))['next']());});};class Fetch{constructor(_0x403f0d){this['baseUri']=_0x403f0d,this['getUrl']=_0x217f38=>{return _0x217f38['startsWith']('/')&&(_0x217f38=_0x217f38['replace']('/','')),''+this['baseUri']+_0x217f38;},!_0x403f0d['endsWith']('/')&&(_0x403f0d=_0x403f0d+'/');}['get'](_0x13f400,_0x519512){return __awaiter$1(this,void 0,void 0,function*(){const _0x234385=this['getUrl'](_0x13f400);return yield fetch(_0x234385,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x519512}});});}['post'](_0x41fdbf,_0x2098ac,_0x378a77){return __awaiter$1(this,void 0,void 0,function*(){const _0x359041=this['getUrl'](_0x41fdbf);return yield fetch(_0x359041,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2098ac},'body':_0x378a77?JSON['stringify'](_0x378a77):null});});}['put'](_0x39543b,_0x3e18b9,_0x575b61){return __awaiter$1(this,void 0,void 0,function*(){const _0x385021=this['getUrl'](_0x39543b);return yield fetch(_0x385021,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3e18b9},'body':_0x575b61?JSON['stringify'](_0x575b61):null});});}['delete'](_0x2c6035,_0x5127b7){return __awaiter$1(this,void 0,void 0,function*(){const _0x283d78=this['getUrl'](_0x2c6035);return yield fetch(_0x283d78,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5127b7}});});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3256d5,_0x5c4a27,_0x3cc980,_0x12cd7c){function _0x215077(_0x175098){return _0x175098 instanceof _0x3cc980?_0x175098:new _0x3cc980(function(_0x4fb161){_0x4fb161(_0x175098);});}return new(_0x3cc980||(_0x3cc980=Promise))(function(_0x315db0,_0x339bb5){function _0x364f21(_0x5b3ab1){try{_0x1f3842(_0x12cd7c['next'](_0x5b3ab1));}catch(_0x55361d){_0x339bb5(_0x55361d);}}function _0x41e441(_0x27a65d){try{_0x1f3842(_0x12cd7c['throw'](_0x27a65d));}catch(_0x102cf3){_0x339bb5(_0x102cf3);}}function _0x1f3842(_0x214cd2){_0x214cd2['done']?_0x315db0(_0x214cd2['value']):_0x215077(_0x214cd2['value'])['then'](_0x364f21,_0x41e441);}_0x1f3842((_0x12cd7c=_0x12cd7c['apply'](_0x3256d5,_0x5c4a27||[]))['next']());});};class AdminClient{constructor(_0x5141bf='https://admin.searchability.dev/'){var _0x31a385=new Fetch(_0x5141bf);this['Accounts']=new AccountService(_0x31a385),this['Lists']=new ListService(_0x31a385),this['ApiKeys']=new ApiKeyService(_0x31a385);}}class AuthClient{constructor(_0x2cce21='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x2cce21);}['login'](_0x2a073f){return __awaiter(this,void 0,void 0,function*(){var _0x1c1280='login/'+_0x2a073f;try{const _0x498ddc=yield yield fetch(_0x1c1280);if(_0x498ddc['status']>0xc7&&_0x498ddc['status']<0x12c){const _0x5c5809=yield _0x498ddc['json']();return new SuccessfulAuthResponse(_0x5c5809);}const _0x2f5bc2=yield _0x498ddc['json']();return new FailedAuthResponse(_0x2f5bc2);}catch(_0x7769a3){if(_0x7769a3 instanceof Error)return new FailedAuthResponse({'detail':_0x7769a3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x7769a3;}});}['refresh'](_0x416526){return __awaiter(this,void 0,void 0,function*(){var _0x5b3b81='refresh';try{const _0x506930=yield this['fetch']['post'](_0x5b3b81,_0x416526,null);if(_0x506930['status']>0xc7&&_0x506930['status']<0x12c){const _0x4f9d0a=yield _0x506930['json']();return new SuccessfulAuthResponse(_0x4f9d0a);}const _0x489cce=yield _0x506930['json']();return new FailedAuthResponse(_0x489cce);}catch(_0x3e68a9){if(_0x3e68a9 instanceof Error)return new FailedAuthResponse({'detail':_0x3e68a9['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3e68a9;}});}}
|
|
16
16
|
|
|
17
17
|
exports.AdminClient = AdminClient;
|
|
18
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
1
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x31f1ca,_0x1f5c6a,_0x12d055,_0x3a4e2a){function _0x4d6770(_0x181ea3){return _0x181ea3 instanceof _0x12d055?_0x181ea3:new _0x12d055(function(_0x2f496c){_0x2f496c(_0x181ea3);});}return new(_0x12d055||(_0x12d055=Promise))(function(_0x36a472,_0x2a0da6){function _0x4c9600(_0x172bdc){try{_0xc8c02d(_0x3a4e2a['next'](_0x172bdc));}catch(_0x56740b){_0x2a0da6(_0x56740b);}}function _0x343d51(_0x32b650){try{_0xc8c02d(_0x3a4e2a['throw'](_0x32b650));}catch(_0x4fb1c7){_0x2a0da6(_0x4fb1c7);}}function _0xc8c02d(_0x56c547){_0x56c547['done']?_0x36a472(_0x56c547['value']):_0x4d6770(_0x56c547['value'])['then'](_0x4c9600,_0x343d51);}_0xc8c02d((_0x3a4e2a=_0x3a4e2a['apply'](_0x31f1ca,_0x1f5c6a||[]))['next']());});};class TokenManager{constructor(_0x10f951){this['authClient']=_0x10f951;}['getOrRefreshTokens'](_0x1f3ae5){return __awaiter$5(this,void 0,void 0,function*(){if(Date['now']()<_0x1f3ae5['access_expires'])return new SuccessfulAuthResponse(_0x1f3ae5);if(Date['now']()<_0x1f3ae5['refresh_expires'])return yield this['authClient']['refresh'](_0x1f3ae5['refresh_token']);return new FailedAuthResponse({'detail':'Refresh\x20token\x20expired','title':'','status':0x194,'instance':'','type':''});});}}
|
|
2
2
|
|
|
3
|
-
class Response{constructor(
|
|
3
|
+
class Response{constructor(_0x4b6280){this['isSuccess']=_0x4b6280;}}class SuccessfulAccountResponse extends Response{constructor(_0x15746a){super(!![]),this['account']=_0x15746a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4babc5){super(![]),this['problem']=_0x4babc5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x2705ce){super(!![]),this['tokens']=_0x2705ce;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x19c586){super(![]),this['problem']=_0x19c586;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x15e5bd){super(!![]),this['apiKey']=_0x15e5bd;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x488313){super(![]),this['problem']=_0x488313;}['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(_0x17657f,_0x18e79d,_0x313d83,_0x5e6ae3){function _0x179342(_0x4b809a){return _0x4b809a instanceof _0x313d83?_0x4b809a:new _0x313d83(function(_0x3e6ae9){_0x3e6ae9(_0x4b809a);});}return new(_0x313d83||(_0x313d83=Promise))(function(_0x4283c3,_0x4e5217){function _0x3f448e(_0x547e0c){try{_0xb504cf(_0x5e6ae3['next'](_0x547e0c));}catch(_0x576886){_0x4e5217(_0x576886);}}function _0x4b3d35(_0x1fe4f2){try{_0xb504cf(_0x5e6ae3['throw'](_0x1fe4f2));}catch(_0x424b22){_0x4e5217(_0x424b22);}}function _0xb504cf(_0x25bef6){_0x25bef6['done']?_0x4283c3(_0x25bef6['value']):_0x179342(_0x25bef6['value'])['then'](_0x3f448e,_0x4b3d35);}_0xb504cf((_0x5e6ae3=_0x5e6ae3['apply'](_0x17657f,_0x18e79d||[]))['next']());});};class AccountService{constructor(_0x5247a2){this['fetch']=_0x5247a2;}['get'](_0x75505d,_0x5ac1cd){return __awaiter$4(this,void 0,void 0,function*(){const _0x49c6f2='Account/'+_0x75505d+'/',_0x35f2af=yield this['fetch']['get'](_0x49c6f2,_0x5ac1cd);try{if(_0x35f2af['status']>0xc7&&_0x35f2af['status']<0x12c){const _0x30e19e=yield _0x35f2af['json']();return new SuccessfulAccountResponse(_0x30e19e);}const _0x27ced0=yield _0x35f2af['json']();return new FailedAccountResponse(_0x27ced0);}catch(_0x434eda){if(_0x434eda instanceof Error)return new FailedAccountResponse({'detail':_0x434eda['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x434eda;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x23b06c,_0x50a8ce,_0x21847c,_0x471ed3){function _0x2534cb(_0x3bd958){return _0x3bd958 instanceof _0x21847c?_0x3bd958:new _0x21847c(function(_0x14f9a7){_0x14f9a7(_0x3bd958);});}return new(_0x21847c||(_0x21847c=Promise))(function(_0x19524b,_0x56de72){function _0x5b9ccc(_0x5cb518){try{_0x1c4aea(_0x471ed3['next'](_0x5cb518));}catch(_0x5e403f){_0x56de72(_0x5e403f);}}function _0x4af8cc(_0x414b4a){try{_0x1c4aea(_0x471ed3['throw'](_0x414b4a));}catch(_0x4fd2cb){_0x56de72(_0x4fd2cb);}}function _0x1c4aea(_0x3e66e6){_0x3e66e6['done']?_0x19524b(_0x3e66e6['value']):_0x2534cb(_0x3e66e6['value'])['then'](_0x5b9ccc,_0x4af8cc);}_0x1c4aea((_0x471ed3=_0x471ed3['apply'](_0x23b06c,_0x50a8ce||[]))['next']());});};class ApiKeyService{constructor(_0x5239ae){this['fetch']=_0x5239ae;}['create'](_0x5a3a51,_0x23fece,_0x101229){return __awaiter$3(this,void 0,void 0,function*(){const _0x58478c='api-key/create',_0x1ad7ed={'account_name':_0x5a3a51,'name':_0x23fece};try{const _0x180e5e=yield this['fetch']['post'](_0x58478c,_0x101229,_0x1ad7ed);if(_0x180e5e['status']>0xc7&&_0x180e5e['status']<0x12c){const _0x5c06b9=yield _0x180e5e['json']();return new SuccessfulApiKeyResponse(_0x5c06b9);}const _0x4f1f0c=yield _0x180e5e['json']();return new FailedApiKeyResponse(_0x4f1f0c);}catch(_0x38ed3d){if(_0x38ed3d instanceof Error)return new FailedApiKeyResponse({'detail':_0x38ed3d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x38ed3d;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xdc163b,_0x39b9cf,_0x5ef981,_0x4f18b8){function _0x5f009a(_0x4d62c8){return _0x4d62c8 instanceof _0x5ef981?_0x4d62c8:new _0x5ef981(function(_0x57d094){_0x57d094(_0x4d62c8);});}return new(_0x5ef981||(_0x5ef981=Promise))(function(_0xd7ae0d,_0x1b0fba){function _0x3c2023(_0x26719d){try{_0x2006bc(_0x4f18b8['next'](_0x26719d));}catch(_0x21fd2c){_0x1b0fba(_0x21fd2c);}}function _0x1f2a98(_0x339f22){try{_0x2006bc(_0x4f18b8['throw'](_0x339f22));}catch(_0x42a39a){_0x1b0fba(_0x42a39a);}}function _0x2006bc(_0x2870be){_0x2870be['done']?_0xd7ae0d(_0x2870be['value']):_0x5f009a(_0x2870be['value'])['then'](_0x3c2023,_0x1f2a98);}_0x2006bc((_0x4f18b8=_0x4f18b8['apply'](_0xdc163b,_0x39b9cf||[]))['next']());});};class ListService{constructor(_0x1d8010){this['fetch']=_0x1d8010;}['add'](_0x227172,_0x49dc25,_0x494544){return __awaiter$2(this,void 0,void 0,function*(){const _0x41183f='List',_0x1ba37a={'account_name':_0x227172,'list_name':_0x49dc25};try{const _0xf52e84=yield this['fetch']['post'](_0x41183f,_0x494544,_0x1ba37a);if(_0xf52e84['status']>0xc7&&_0xf52e84['status']<0x12c){const _0x5baf5d=yield _0xf52e84['json']();return new SuccessfulAccountResponse(_0x5baf5d);}const _0x497607=yield _0xf52e84['json']();return new FailedAccountResponse(_0x497607);}catch(_0x2535ed){if(_0x2535ed instanceof Error)return new FailedAccountResponse({'detail':_0x2535ed['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2535ed;}});}['remove'](_0x5a594b,_0x928b1d,_0x3fa4d5){return __awaiter$2(this,void 0,void 0,function*(){const _0x32df2d='List/'+_0x5a594b+'/'+_0x928b1d,_0x1a712e=yield this['fetch']['delete'](_0x32df2d,_0x3fa4d5);try{if(_0x1a712e['status']>0xc7&&_0x1a712e['status']<0x12c){const _0x587b01=yield _0x1a712e['json']();return new SuccessfulAccountResponse(_0x587b01);}const _0x2b60b5=yield _0x1a712e['json']();return new FailedAccountResponse(_0x2b60b5);}catch(_0x4f1f8e){if(_0x4f1f8e instanceof Error)return new FailedAccountResponse({'detail':_0x4f1f8e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4f1f8e;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2a13c7,_0x3f035b,_0x5b2117,_0x2b04bd){function _0x1c03f9(_0x104ad6){return _0x104ad6 instanceof _0x5b2117?_0x104ad6:new _0x5b2117(function(_0x2a0a2c){_0x2a0a2c(_0x104ad6);});}return new(_0x5b2117||(_0x5b2117=Promise))(function(_0x1eac07,_0x3aa0bc){function _0x34f332(_0x46ebf3){try{_0x3ca2ff(_0x2b04bd['next'](_0x46ebf3));}catch(_0x59ff93){_0x3aa0bc(_0x59ff93);}}function _0x57c4ed(_0x49a7fc){try{_0x3ca2ff(_0x2b04bd['throw'](_0x49a7fc));}catch(_0x58d04d){_0x3aa0bc(_0x58d04d);}}function _0x3ca2ff(_0x9d5d09){_0x9d5d09['done']?_0x1eac07(_0x9d5d09['value']):_0x1c03f9(_0x9d5d09['value'])['then'](_0x34f332,_0x57c4ed);}_0x3ca2ff((_0x2b04bd=_0x2b04bd['apply'](_0x2a13c7,_0x3f035b||[]))['next']());});};class Fetch{constructor(_0x1d6de1){this['baseUri']=_0x1d6de1,this['getUrl']=_0x46648c=>{return _0x46648c['startsWith']('/')&&(_0x46648c=_0x46648c['replace']('/','')),''+this['baseUri']+_0x46648c;},!_0x1d6de1['endsWith']('/')&&(_0x1d6de1=_0x1d6de1+'/');}['get'](_0x7ea006,_0x5bd59d){return __awaiter$1(this,void 0,void 0,function*(){const _0x318b00=this['getUrl'](_0x7ea006);return yield fetch(_0x318b00,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5bd59d}});});}['post'](_0x424e23,_0x3dea13,_0x1cc1c0){return __awaiter$1(this,void 0,void 0,function*(){const _0x2be1ec=this['getUrl'](_0x424e23);return yield fetch(_0x2be1ec,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3dea13},'body':_0x1cc1c0?JSON['stringify'](_0x1cc1c0):null});});}['put'](_0x1bee68,_0x2076d4,_0x210900){return __awaiter$1(this,void 0,void 0,function*(){const _0x593186=this['getUrl'](_0x1bee68);return yield fetch(_0x593186,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2076d4},'body':_0x210900?JSON['stringify'](_0x210900):null});});}['delete'](_0x39acaa,_0x38186b){return __awaiter$1(this,void 0,void 0,function*(){const _0x462699=this['getUrl'](_0x39acaa);return yield fetch(_0x462699,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x38186b}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x34d8bb,_0x279ae0,_0x503ac5,_0x417fec){function _0x48964a(_0x429a24){return _0x429a24 instanceof _0x503ac5?_0x429a24:new _0x503ac5(function(_0x25b07e){_0x25b07e(_0x429a24);});}return new(_0x503ac5||(_0x503ac5=Promise))(function(_0x17932e,_0x5421ff){function _0x5216a1(_0x510321){try{_0xdbfd8a(_0x417fec['next'](_0x510321));}catch(_0x156b69){_0x5421ff(_0x156b69);}}function _0x111065(_0x3a5ca8){try{_0xdbfd8a(_0x417fec['throw'](_0x3a5ca8));}catch(_0x18101e){_0x5421ff(_0x18101e);}}function _0xdbfd8a(_0xa43d57){_0xa43d57['done']?_0x17932e(_0xa43d57['value']):_0x48964a(_0xa43d57['value'])['then'](_0x5216a1,_0x111065);}_0xdbfd8a((_0x417fec=_0x417fec['apply'](_0x34d8bb,_0x279ae0||[]))['next']());});};class AdminClient{constructor(_0x1ad5a7='https://admin.searchability.dev/'){var _0x92e6a=new Fetch(_0x1ad5a7);this['Accounts']=new AccountService(_0x92e6a),this['Lists']=new ListService(_0x92e6a),this['ApiKeys']=new ApiKeyService(_0x92e6a);}}class AuthClient{constructor(_0x5ae042='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5ae042);}['login'](_0x15056b){return __awaiter(this,void 0,void 0,function*(){var _0xaa5f70='login/'+_0x15056b;try{const _0x52eed3=yield yield fetch(_0xaa5f70);if(_0x52eed3['status']>0xc7&&_0x52eed3['status']<0x12c){const _0x328584=yield _0x52eed3['json']();return new SuccessfulAuthResponse(_0x328584);}const _0x46ec56=yield _0x52eed3['json']();return new FailedAuthResponse(_0x46ec56);}catch(_0x802033){if(_0x802033 instanceof Error)return new FailedAuthResponse({'detail':_0x802033['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x802033;}});}['refresh'](_0xeaf9cd){return __awaiter(this,void 0,void 0,function*(){var _0x5493b5='refresh';try{const _0x41ad32=yield this['fetch']['post'](_0x5493b5,_0xeaf9cd,null);if(_0x41ad32['status']>0xc7&&_0x41ad32['status']<0x12c){const _0xdcf927=yield _0x41ad32['json']();return new SuccessfulAuthResponse(_0xdcf927);}const _0x3ac3d0=yield _0x41ad32['json']();return new FailedAuthResponse(_0x3ac3d0);}catch(_0x50e501){if(_0x50e501 instanceof Error)return new FailedAuthResponse({'detail':_0x50e501['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x50e501;}});}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenManager };
|
package/dist/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare class AccountService {
|
|
|
17
17
|
declare class ApiKeyService {
|
|
18
18
|
readonly fetch: Fetch;
|
|
19
19
|
constructor(fetch: Fetch);
|
|
20
|
-
create(accountName: string, apiKeyName: string, access_token: string): Promise<Response<ApiKey
|
|
20
|
+
create(accountName: string, apiKeyName: string, access_token: string): Promise<Response<ApiKey, Problem>>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
declare class ListService {
|
|
@@ -115,16 +115,16 @@ declare class FailedAuthResponse extends Response<Tokens, Problem> {
|
|
|
115
115
|
toSuccess(): Tokens;
|
|
116
116
|
toProblem(): Problem;
|
|
117
117
|
}
|
|
118
|
-
declare class SuccessfulApiKeyResponse extends Response<ApiKey
|
|
119
|
-
readonly
|
|
120
|
-
constructor(
|
|
121
|
-
toSuccess(): ApiKey
|
|
118
|
+
declare class SuccessfulApiKeyResponse extends Response<ApiKey, Problem> {
|
|
119
|
+
readonly apiKey: ApiKey;
|
|
120
|
+
constructor(apiKey: ApiKey);
|
|
121
|
+
toSuccess(): ApiKey;
|
|
122
122
|
toProblem(): Problem;
|
|
123
123
|
}
|
|
124
|
-
declare class FailedApiKeyResponse extends Response<ApiKey
|
|
124
|
+
declare class FailedApiKeyResponse extends Response<ApiKey, Problem> {
|
|
125
125
|
readonly problem: Problem;
|
|
126
126
|
constructor(problem: Problem);
|
|
127
|
-
toSuccess(): ApiKey
|
|
127
|
+
toSuccess(): ApiKey;
|
|
128
128
|
toProblem(): Problem;
|
|
129
129
|
}
|
|
130
130
|
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x54b690,_0x478e2b,_0x49ade5,_0x538a23){function _0x10e540(_0x2413bd){return _0x2413bd instanceof _0x49ade5?_0x2413bd:new _0x49ade5(function(_0x90f4fc){_0x90f4fc(_0x2413bd);});}return new(_0x49ade5||(_0x49ade5=Promise))(function(_0x223395,_0x3da0d8){function _0x50b448(_0xea70c9){try{_0x4dbe62(_0x538a23['next'](_0xea70c9));}catch(_0x69fafa){_0x3da0d8(_0x69fafa);}}function _0x4dd4b2(_0x1b95b5){try{_0x4dbe62(_0x538a23['throw'](_0x1b95b5));}catch(_0x112eab){_0x3da0d8(_0x112eab);}}function _0x4dbe62(_0x4ea396){_0x4ea396['done']?_0x223395(_0x4ea396['value']):_0x10e540(_0x4ea396['value'])['then'](_0x50b448,_0x4dd4b2);}_0x4dbe62((_0x538a23=_0x538a23['apply'](_0x54b690,_0x478e2b||[]))['next']());});};class TokenManager{constructor(_0x5d0b29){this['authClient']=_0x5d0b29;}['getOrRefreshTokens'](_0xa73c87){return __awaiter$5(this,void 0,void 0,function*(){if(Date['now']()<_0xa73c87['access_expires'])return new SuccessfulAuthResponse(_0xa73c87);if(Date['now']()>_0xa73c87['refresh_expires'])return yield this['authClient']['refresh'](_0xa73c87['refresh_token']);return new FailedAuthResponse({'detail':'Refresh\x20token\x20expired','title':'','status':0x194,'instance':'','type':''});});}}
|
|
2
|
-
|
|
3
|
-
class Response{constructor(_0x37fa23){this['isSuccess']=_0x37fa23;}}class SuccessfulAccountResponse extends Response{constructor(_0x13089d){super(!![]),this['account']=_0x13089d;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x13e768){super(![]),this['problem']=_0x13e768;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x5adb03){super(!![]),this['tokens']=_0x5adb03;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0xd82e62){super(![]),this['problem']=_0xd82e62;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x227613){super(!![]),this['apiKeys']=_0x227613;}['toSuccess'](){return this['apiKeys'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x3a490d){super(![]),this['problem']=_0x3a490d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x54c679,_0x42cbe8,_0x2d7567,_0xba6753){function _0x35055f(_0x4fb648){return _0x4fb648 instanceof _0x2d7567?_0x4fb648:new _0x2d7567(function(_0x3bdc42){_0x3bdc42(_0x4fb648);});}return new(_0x2d7567||(_0x2d7567=Promise))(function(_0x540c5a,_0x2cfe7f){function _0x2e909d(_0x2b0aae){try{_0x41532e(_0xba6753['next'](_0x2b0aae));}catch(_0x11dec1){_0x2cfe7f(_0x11dec1);}}function _0x2260cb(_0x149d37){try{_0x41532e(_0xba6753['throw'](_0x149d37));}catch(_0x27a354){_0x2cfe7f(_0x27a354);}}function _0x41532e(_0x11f78f){_0x11f78f['done']?_0x540c5a(_0x11f78f['value']):_0x35055f(_0x11f78f['value'])['then'](_0x2e909d,_0x2260cb);}_0x41532e((_0xba6753=_0xba6753['apply'](_0x54c679,_0x42cbe8||[]))['next']());});};class AccountService{constructor(_0x2944b3){this['fetch']=_0x2944b3;}['get'](_0x2f08b6,_0x54f4ef){return __awaiter$4(this,void 0,void 0,function*(){const _0x252331='Account/'+_0x2f08b6+'/',_0x13fa0a=yield this['fetch']['get'](_0x252331,_0x54f4ef);try{if(_0x13fa0a['status']>0xc7&&_0x13fa0a['status']<0x12c){const _0x45565a=yield _0x13fa0a['json']();return new SuccessfulAccountResponse(_0x45565a);}const _0x1b88f2=yield _0x13fa0a['json']();return new FailedAccountResponse(_0x1b88f2);}catch(_0x81e3a5){if(_0x81e3a5 instanceof Error)return new FailedAccountResponse({'detail':_0x81e3a5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x81e3a5;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0xfc9f78,_0x521589,_0x26fc23,_0x3ab864){function _0x56cabb(_0x1c5146){return _0x1c5146 instanceof _0x26fc23?_0x1c5146:new _0x26fc23(function(_0x3b16ab){_0x3b16ab(_0x1c5146);});}return new(_0x26fc23||(_0x26fc23=Promise))(function(_0x454522,_0x4d47dd){function _0x3b50bc(_0x242a60){try{_0xe5d335(_0x3ab864['next'](_0x242a60));}catch(_0x10dbc2){_0x4d47dd(_0x10dbc2);}}function _0x462cb9(_0x3c6a24){try{_0xe5d335(_0x3ab864['throw'](_0x3c6a24));}catch(_0x49f683){_0x4d47dd(_0x49f683);}}function _0xe5d335(_0x986196){_0x986196['done']?_0x454522(_0x986196['value']):_0x56cabb(_0x986196['value'])['then'](_0x3b50bc,_0x462cb9);}_0xe5d335((_0x3ab864=_0x3ab864['apply'](_0xfc9f78,_0x521589||[]))['next']());});};class ApiKeyService{constructor(_0x1b95b3){this['fetch']=_0x1b95b3;}['create'](_0x31f678,_0x88cd5f,_0xa660a9){return __awaiter$3(this,void 0,void 0,function*(){const _0x3d17d4='ApiKey/Create',_0x33c43d={'account_name':_0x31f678,'name':_0x88cd5f};try{const _0x5d64f7=yield this['fetch']['post'](_0x3d17d4,_0xa660a9,_0x33c43d);if(_0x5d64f7['status']>0xc7&&_0x5d64f7['status']<0x12c){const _0x49cc85=yield _0x5d64f7['json']();return new SuccessfulApiKeyResponse(_0x49cc85);}const _0x1035f3=yield _0x5d64f7['json']();return new FailedApiKeyResponse(_0x1035f3);}catch(_0x2ecd65){if(_0x2ecd65 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2ecd65['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2ecd65;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1541e8,_0x36758e,_0x30129e,_0x299512){function _0x2d4f4f(_0x41de95){return _0x41de95 instanceof _0x30129e?_0x41de95:new _0x30129e(function(_0x4c2914){_0x4c2914(_0x41de95);});}return new(_0x30129e||(_0x30129e=Promise))(function(_0x4e0625,_0x2d2671){function _0x48e593(_0x292180){try{_0x3a2d43(_0x299512['next'](_0x292180));}catch(_0x513643){_0x2d2671(_0x513643);}}function _0x2514ea(_0x410408){try{_0x3a2d43(_0x299512['throw'](_0x410408));}catch(_0x4e4a2d){_0x2d2671(_0x4e4a2d);}}function _0x3a2d43(_0x1201c6){_0x1201c6['done']?_0x4e0625(_0x1201c6['value']):_0x2d4f4f(_0x1201c6['value'])['then'](_0x48e593,_0x2514ea);}_0x3a2d43((_0x299512=_0x299512['apply'](_0x1541e8,_0x36758e||[]))['next']());});};class ListService{constructor(_0x568209){this['fetch']=_0x568209;}['add'](_0xabfbd5,_0x3b520d,_0x703b66){return __awaiter$2(this,void 0,void 0,function*(){const _0x16bb99='List',_0x3b048f={'account_name':_0xabfbd5,'list_name':_0x3b520d};try{const _0x15e271=yield this['fetch']['post'](_0x16bb99,_0x703b66,_0x3b048f);if(_0x15e271['status']>0xc7&&_0x15e271['status']<0x12c){const _0x1a5abd=yield _0x15e271['json']();return new SuccessfulAccountResponse(_0x1a5abd);}const _0x556a15=yield _0x15e271['json']();return new FailedAccountResponse(_0x556a15);}catch(_0x5c91f8){if(_0x5c91f8 instanceof Error)return new FailedAccountResponse({'detail':_0x5c91f8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5c91f8;}});}['remove'](_0x281107,_0x17843b,_0x31d24a){return __awaiter$2(this,void 0,void 0,function*(){const _0x47e058='List/'+_0x281107+'/'+_0x17843b,_0x3bacd8=yield this['fetch']['delete'](_0x47e058,_0x31d24a);try{if(_0x3bacd8['status']>0xc7&&_0x3bacd8['status']<0x12c){const _0x5c4482=yield _0x3bacd8['json']();return new SuccessfulAccountResponse(_0x5c4482);}const _0x3463a4=yield _0x3bacd8['json']();return new FailedAccountResponse(_0x3463a4);}catch(_0x751fc9){if(_0x751fc9 instanceof Error)return new FailedAccountResponse({'detail':_0x751fc9['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x751fc9;}});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x256c5d,_0x380ff2,_0x3f2c9c,_0x52444f){function _0x157255(_0x488e1a){return _0x488e1a instanceof _0x3f2c9c?_0x488e1a:new _0x3f2c9c(function(_0x1accdf){_0x1accdf(_0x488e1a);});}return new(_0x3f2c9c||(_0x3f2c9c=Promise))(function(_0x403b63,_0x1b065c){function _0x58115b(_0x4da783){try{_0x8d3f21(_0x52444f['next'](_0x4da783));}catch(_0x3c6030){_0x1b065c(_0x3c6030);}}function _0x17b709(_0x1d8554){try{_0x8d3f21(_0x52444f['throw'](_0x1d8554));}catch(_0x1640ae){_0x1b065c(_0x1640ae);}}function _0x8d3f21(_0x2f26c1){_0x2f26c1['done']?_0x403b63(_0x2f26c1['value']):_0x157255(_0x2f26c1['value'])['then'](_0x58115b,_0x17b709);}_0x8d3f21((_0x52444f=_0x52444f['apply'](_0x256c5d,_0x380ff2||[]))['next']());});};class Fetch{constructor(_0x296f93){this['baseUri']=_0x296f93,this['getUrl']=_0x52dad9=>{return _0x52dad9['startsWith']('/')&&(_0x52dad9=_0x52dad9['replace']('/','')),''+this['baseUri']+_0x52dad9;},!_0x296f93['endsWith']('/')&&(_0x296f93=_0x296f93+'/');}['get'](_0x495adc,_0xe5f488){return __awaiter$1(this,void 0,void 0,function*(){const _0x262199=this['getUrl'](_0x495adc);return yield fetch(_0x262199,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe5f488}});});}['post'](_0x3b9a36,_0x5326e7,_0x9e9ab6){return __awaiter$1(this,void 0,void 0,function*(){const _0xff10ab=this['getUrl'](_0x3b9a36);return yield fetch(_0xff10ab,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5326e7},'body':_0x9e9ab6?JSON['stringify'](_0x9e9ab6):null});});}['put'](_0x8d7257,_0x987873,_0x218ebf){return __awaiter$1(this,void 0,void 0,function*(){const _0x2fe704=this['getUrl'](_0x8d7257);return yield fetch(_0x2fe704,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x987873},'body':_0x218ebf?JSON['stringify'](_0x218ebf):null});});}['delete'](_0x1149b7,_0x3210f2){return __awaiter$1(this,void 0,void 0,function*(){const _0x4087d8=this['getUrl'](_0x1149b7);return yield fetch(_0x4087d8,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3210f2}});});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x446d4c,_0x2a827b,_0x119f1e,_0x377e96){function _0x863bad(_0x428c19){return _0x428c19 instanceof _0x119f1e?_0x428c19:new _0x119f1e(function(_0x2c6dc2){_0x2c6dc2(_0x428c19);});}return new(_0x119f1e||(_0x119f1e=Promise))(function(_0x21181b,_0x2643e3){function _0x30bc71(_0x3f0c02){try{_0x5fdef5(_0x377e96['next'](_0x3f0c02));}catch(_0x24c155){_0x2643e3(_0x24c155);}}function _0x2cdfe9(_0x8cd318){try{_0x5fdef5(_0x377e96['throw'](_0x8cd318));}catch(_0x38dac1){_0x2643e3(_0x38dac1);}}function _0x5fdef5(_0x4c5a38){_0x4c5a38['done']?_0x21181b(_0x4c5a38['value']):_0x863bad(_0x4c5a38['value'])['then'](_0x30bc71,_0x2cdfe9);}_0x5fdef5((_0x377e96=_0x377e96['apply'](_0x446d4c,_0x2a827b||[]))['next']());});};class AdminClient{constructor(_0x23adc2='https://admin.searchability.dev/'){var _0x39845b=new Fetch(_0x23adc2);this['Accounts']=new AccountService(_0x39845b),this['Lists']=new ListService(_0x39845b),this['ApiKeys']=new ApiKeyService(_0x39845b);}}class AuthClient{constructor(_0x3477b2='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x3477b2);}['login'](_0x2a8000){return __awaiter(this,void 0,void 0,function*(){var _0x383ad9='login/'+_0x2a8000;try{const _0x585892=yield yield fetch(_0x383ad9);if(_0x585892['status']>0xc7&&_0x585892['status']<0x12c){const _0x40c18a=yield _0x585892['json']();return new SuccessfulAuthResponse(_0x40c18a);}const _0x52450f=yield _0x585892['json']();return new FailedAuthResponse(_0x52450f);}catch(_0x5b8686){if(_0x5b8686 instanceof Error)return new FailedAuthResponse({'detail':_0x5b8686['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5b8686;}});}['refresh'](_0x231c38){return __awaiter(this,void 0,void 0,function*(){var _0x3f1dba='refresh';try{const _0x11754b=yield this['fetch']['post'](_0x3f1dba,_0x231c38,null);if(_0x11754b['status']>0xc7&&_0x11754b['status']<0x12c){const _0x59e235=yield _0x11754b['json']();return new SuccessfulAuthResponse(_0x59e235);}const _0x56f3bd=yield _0x11754b['json']();return new FailedAuthResponse(_0x56f3bd);}catch(_0xda903e){if(_0xda903e instanceof Error)return new FailedAuthResponse({'detail':_0xda903e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xda903e;}});}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenManager };
|