@searchability/admin-client 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var TokenStatus;(function(_0x4f58b5){_0x4f58b5[_0x4f58b5['Ok']=0x0]='Ok',_0x4f58b5[_0x4f58b5['Refresh']=0x1]='Refresh',_0x4f58b5[_0x4f58b5['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x114535){this['isSuccess']=_0x114535;}}class SuccessfulAccountResponse extends Response{constructor(_0x580886){super(!![]),this['account']=_0x580886;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x7a06fe){super(![]),this['problem']=_0x7a06fe;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x582d93){super(!![]),this['tokens']=_0x582d93;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x470b3d){super(![]),this['problem']=_0x470b3d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x28ccf9){super(!![]),this['apiKey']=_0x28ccf9;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x123715){super(![]),this['problem']=_0x123715;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x288cd4){super(!![]),this['apiKeyValue']=_0x288cd4;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x5c9896){super(![]),this['problem']=_0x5c9896;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2eceab,_0x52c012,_0x3ae064,_0x2c9afd){function _0x2cc892(_0x37b707){return _0x37b707 instanceof _0x3ae064?_0x37b707:new _0x3ae064(function(_0x403138){_0x403138(_0x37b707);});}return new(_0x3ae064||(_0x3ae064=Promise))(function(_0x1fe38d,_0x2322e9){function _0x2a5c9a(_0x18e00e){try{_0x20b9d1(_0x2c9afd['next'](_0x18e00e));}catch(_0x208dd0){_0x2322e9(_0x208dd0);}}function _0x4b3e8d(_0x45bfd9){try{_0x20b9d1(_0x2c9afd['throw'](_0x45bfd9));}catch(_0x3c5b22){_0x2322e9(_0x3c5b22);}}function _0x20b9d1(_0x4ea42e){_0x4ea42e['done']?_0x1fe38d(_0x4ea42e['value']):_0x2cc892(_0x4ea42e['value'])['then'](_0x2a5c9a,_0x4b3e8d);}_0x20b9d1((_0x2c9afd=_0x2c9afd['apply'](_0x2eceab,_0x52c012||[]))['next']());});};class AccountService{constructor(_0xad7491){this['fetch']=_0xad7491;}['get'](_0xdf26b5,_0x1f1746){return __awaiter$4(this,void 0,void 0,function*(){const _0x9694de='Account/'+_0xdf26b5+'/',_0x1bf25d=yield this['fetch']['get'](_0x9694de,_0x1f1746);try{if(_0x1bf25d['status']>0xc7&&_0x1bf25d['status']<0x12c){const _0x4ab2ad=yield _0x1bf25d['json']();return new SuccessfulAccountResponse(_0x4ab2ad);}const _0x3d376e=yield _0x1bf25d['json']();return new FailedAccountResponse(_0x3d376e);}catch(_0x12eab3){if(_0x12eab3 instanceof Error)return new FailedAccountResponse({'detail':_0x12eab3['message'],'title':_0x12eab3['name'],'status':0x1f4,'instance':'','type':''});throw _0x12eab3;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x310716,_0x41e776,_0x4044f2,_0x305a47){function _0xa6f2a4(_0x5d7377){return _0x5d7377 instanceof _0x4044f2?_0x5d7377:new _0x4044f2(function(_0x583da4){_0x583da4(_0x5d7377);});}return new(_0x4044f2||(_0x4044f2=Promise))(function(_0x442074,_0x507352){function _0xa4c537(_0x3c68a7){try{_0x5b4f31(_0x305a47['next'](_0x3c68a7));}catch(_0x1b7403){_0x507352(_0x1b7403);}}function _0x3cec4c(_0x41b24b){try{_0x5b4f31(_0x305a47['throw'](_0x41b24b));}catch(_0x208225){_0x507352(_0x208225);}}function _0x5b4f31(_0x3a023f){_0x3a023f['done']?_0x442074(_0x3a023f['value']):_0xa6f2a4(_0x3a023f['value'])['then'](_0xa4c537,_0x3cec4c);}_0x5b4f31((_0x305a47=_0x305a47['apply'](_0x310716,_0x41e776||[]))['next']());});};class ApiKeyService{constructor(_0x5bf80b){this['fetch']=_0x5bf80b;}['create'](_0x35a771,_0x66eeb8,_0x3746c3){return __awaiter$3(this,void 0,void 0,function*(){const _0x213f83='api-key/create',_0x7ee802={'account_name':_0x35a771,'api_key_name':_0x66eeb8};try{const _0x35551f=yield this['fetch']['post'](_0x213f83,_0x3746c3,_0x7ee802);if(_0x35551f['status']>0xc7&&_0x35551f['status']<0x12c){const _0x567470=yield _0x35551f['json']();return new SuccessfulApiKeyResponse(_0x567470);}const _0x6221fb=yield _0x35551f['json']();return new FailedApiKeyResponse(_0x6221fb);}catch(_0x4509ea){if(_0x4509ea instanceof Error)return new FailedApiKeyResponse({'detail':_0x4509ea['message'],'title':_0x4509ea['name'],'status':0x1f4,'instance':'','type':''});throw _0x4509ea;}});}['view'](_0x53d5d5,_0x2dd48e,_0x220016){return __awaiter$3(this,void 0,void 0,function*(){const _0x1fb399='api-key/'+_0x53d5d5+'/'+_0x2dd48e;try{const _0x3247aa=yield this['fetch']['get'](_0x1fb399,_0x220016);if(_0x3247aa['status']>0xc7&&_0x3247aa['status']<0x12c){const _0x3d53bb=yield _0x3247aa['json']();return new SuccessfulApiKeyValueResponse(_0x3d53bb);}const _0x2e0000=yield _0x3247aa['json']();return new FailedApiKeyValueResponse(_0x2e0000);}catch(_0xda6790){if(_0xda6790 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0xda6790['message'],'title':_0xda6790['name'],'status':0x1f4,'instance':'','type':''});throw _0xda6790;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x166c19,_0x4f8330,_0xa52885,_0x23ed43){function _0x4b651b(_0x1221fb){return _0x1221fb instanceof _0xa52885?_0x1221fb:new _0xa52885(function(_0x569622){_0x569622(_0x1221fb);});}return new(_0xa52885||(_0xa52885=Promise))(function(_0x2a737c,_0x928801){function _0x35cd24(_0x376811){try{_0x20d91b(_0x23ed43['next'](_0x376811));}catch(_0x39dc0e){_0x928801(_0x39dc0e);}}function _0x1b84e1(_0x21b210){try{_0x20d91b(_0x23ed43['throw'](_0x21b210));}catch(_0x57b97c){_0x928801(_0x57b97c);}}function _0x20d91b(_0x536bd7){_0x536bd7['done']?_0x2a737c(_0x536bd7['value']):_0x4b651b(_0x536bd7['value'])['then'](_0x35cd24,_0x1b84e1);}_0x20d91b((_0x23ed43=_0x23ed43['apply'](_0x166c19,_0x4f8330||[]))['next']());});};class ListService{constructor(_0x1a36b8){this['fetch']=_0x1a36b8;}['add'](_0x44bfc8,_0x3d7cfe,_0x4f0180){return __awaiter$2(this,void 0,void 0,function*(){const _0x17fc7f='List',_0x5a1400={'account_name':_0x44bfc8,'list_name':_0x3d7cfe};try{const _0x5d1b6c=yield this['fetch']['post'](_0x17fc7f,_0x4f0180,_0x5a1400);if(_0x5d1b6c['status']>0xc7&&_0x5d1b6c['status']<0x12c){const _0x2b8931=yield _0x5d1b6c['json']();return new SuccessfulAccountResponse(_0x2b8931);}const _0x382914=yield _0x5d1b6c['json']();return new FailedAccountResponse(_0x382914);}catch(_0x4dd227){if(_0x4dd227 instanceof Error)return new FailedAccountResponse({'detail':_0x4dd227['message'],'title':_0x4dd227['name'],'status':0x1f4,'instance':'','type':''});throw _0x4dd227;}});}['remove'](_0x534eae,_0x4eda17,_0x45d452){return __awaiter$2(this,void 0,void 0,function*(){const _0x25e5e8='List/'+_0x534eae+'/'+_0x4eda17,_0x5656e9=yield this['fetch']['delete'](_0x25e5e8,_0x45d452);try{if(_0x5656e9['status']>0xc7&&_0x5656e9['status']<0x12c){const _0x1bde21=yield _0x5656e9['json']();return new SuccessfulAccountResponse(_0x1bde21);}const _0x12b653=yield _0x5656e9['json']();return new FailedAccountResponse(_0x12b653);}catch(_0x405c88){if(_0x405c88 instanceof Error)return new FailedAccountResponse({'detail':_0x405c88['message'],'title':_0x405c88['name'],'status':0x1f4,'instance':'','type':''});throw _0x405c88;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1994a4,_0x5f2478,_0x249c13,_0x38d0b2){function _0x44c84c(_0x4189e6){return _0x4189e6 instanceof _0x249c13?_0x4189e6:new _0x249c13(function(_0xbb9c2e){_0xbb9c2e(_0x4189e6);});}return new(_0x249c13||(_0x249c13=Promise))(function(_0x3333e2,_0x1b575f){function _0x50f0f0(_0xd8b1e){try{_0x2202a6(_0x38d0b2['next'](_0xd8b1e));}catch(_0x30acc9){_0x1b575f(_0x30acc9);}}function _0x38c42b(_0x5c951e){try{_0x2202a6(_0x38d0b2['throw'](_0x5c951e));}catch(_0x446715){_0x1b575f(_0x446715);}}function _0x2202a6(_0x4185fd){_0x4185fd['done']?_0x3333e2(_0x4185fd['value']):_0x44c84c(_0x4185fd['value'])['then'](_0x50f0f0,_0x38c42b);}_0x2202a6((_0x38d0b2=_0x38d0b2['apply'](_0x1994a4,_0x5f2478||[]))['next']());});};class Fetch{constructor(_0x2574ed){this['baseUri']=_0x2574ed,this['getUrl']=_0x1a4784=>{return _0x1a4784['startsWith']('/')&&(_0x1a4784=_0x1a4784['replace']('/','')),''+this['baseUri']+_0x1a4784;},!_0x2574ed['endsWith']('/')&&(_0x2574ed=_0x2574ed+'/');}['get'](_0x14ebef,_0x5b9513){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f4bde=this['getUrl'](_0x14ebef);return yield fetch(_0x3f4bde,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5b9513}});});}['post'](_0x2bcc5d,_0x19527b,_0x2c7e44){return __awaiter$1(this,void 0,void 0,function*(){const _0x34e458=this['getUrl'](_0x2bcc5d);return yield fetch(_0x34e458,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x19527b},'body':_0x2c7e44?JSON['stringify'](_0x2c7e44):null});});}['put'](_0x2a0b53,_0xe119a,_0x4247a0){return __awaiter$1(this,void 0,void 0,function*(){const _0x182986=this['getUrl'](_0x2a0b53);return yield fetch(_0x182986,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe119a},'body':_0x4247a0?JSON['stringify'](_0x4247a0):null});});}['delete'](_0x3c60c2,_0x35a97a){return __awaiter$1(this,void 0,void 0,function*(){const _0x488e04=this['getUrl'](_0x3c60c2);return yield fetch(_0x488e04,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x35a97a}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1dbb78,_0x573a85,_0x16df99,_0x4ed601){function _0x1fd13f(_0x194b56){return _0x194b56 instanceof _0x16df99?_0x194b56:new _0x16df99(function(_0x83a5b8){_0x83a5b8(_0x194b56);});}return new(_0x16df99||(_0x16df99=Promise))(function(_0x480902,_0xcf82cf){function _0x11e16d(_0x5098f3){try{_0x468f58(_0x4ed601['next'](_0x5098f3));}catch(_0xaef500){_0xcf82cf(_0xaef500);}}function _0x3a728a(_0x184e44){try{_0x468f58(_0x4ed601['throw'](_0x184e44));}catch(_0x34c2f0){_0xcf82cf(_0x34c2f0);}}function _0x468f58(_0x5933ac){_0x5933ac['done']?_0x480902(_0x5933ac['value']):_0x1fd13f(_0x5933ac['value'])['then'](_0x11e16d,_0x3a728a);}_0x468f58((_0x4ed601=_0x4ed601['apply'](_0x1dbb78,_0x573a85||[]))['next']());});};class AdminClient{constructor(_0x4a01a8='https://admin.searchability.dev/'){var _0x296634=new Fetch(_0x4a01a8);this['Accounts']=new AccountService(_0x296634),this['Lists']=new ListService(_0x296634),this['ApiKeys']=new ApiKeyService(_0x296634);}}class AuthClient{constructor(_0x1825fe='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x1825fe);}['login'](_0x54b05f){return __awaiter(this,void 0,void 0,function*(){var _0x5c8292='login/'+_0x54b05f;try{const _0x5276ff=yield yield fetch(_0x5c8292);if(_0x5276ff['status']>0xc7&&_0x5276ff['status']<0x12c){const _0x18284f=yield _0x5276ff['json']();return new SuccessfulAuthResponse(_0x18284f);}const _0x41b7b8=yield _0x5276ff['json']();return new FailedAuthResponse(_0x41b7b8);}catch(_0x1cd60a){if(_0x1cd60a instanceof Error)return new FailedAuthResponse({'detail':_0x1cd60a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1cd60a;}});}['refresh'](_0x1ac50f){return __awaiter(this,void 0,void 0,function*(){var _0x539465='refresh';try{const _0x306955=yield this['fetch']['post'](_0x539465,_0x1ac50f,null);if(_0x306955['status']>0xc7&&_0x306955['status']<0x12c){const _0x4d9f3b=yield _0x306955['json']();return new SuccessfulAuthResponse(_0x4d9f3b);}const _0x945c1=yield _0x306955['json']();return new FailedAuthResponse(_0x945c1);}catch(_0x3c74d7){if(_0x3c74d7 instanceof Error)return new FailedAuthResponse({'detail':_0x3c74d7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3c74d7;}});}['getTokenStatus'](_0x3a821e){if(Date['now']()<_0x3a821e['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3a821e['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
12
|
+
|
|
13
|
+
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x5872b0){_0x5872b0[_0x5872b0['Ok']=0x0]='Ok',_0x5872b0[_0x5872b0['Refresh']=0x1]='Refresh',_0x5872b0[_0x5872b0['Expired']=0x2]='Expired';}(exports.TokenStatus||(exports.TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x38e8d0){this['isSuccess']=_0x38e8d0;}}class SuccessfulAccountResponse extends Response{constructor(_0xc6586){super(!![]),this['account']=_0xc6586;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4e8e97){super(![]),this['problem']=_0x4e8e97;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x12c212){super(!![]),this['tokens']=_0x12c212;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x1e7afc){super(![]),this['problem']=_0x1e7afc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0xa2f21a){super(!![]),this['apiKey']=_0xa2f21a;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x388194){super(![]),this['problem']=_0x388194;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x41d625){super(!![]),this['apiKeyValue']=_0x41d625;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x571896){super(![]),this['problem']=_0x571896;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2fa8bf,_0x3ede50,_0x44c363,_0x402615){function _0x36255e(_0x566641){return _0x566641 instanceof _0x44c363?_0x566641:new _0x44c363(function(_0x241080){_0x241080(_0x566641);});}return new(_0x44c363||(_0x44c363=Promise))(function(_0x5345f7,_0x2c45f3){function _0x271709(_0x37915c){try{_0x1289e3(_0x402615['next'](_0x37915c));}catch(_0x506a36){_0x2c45f3(_0x506a36);}}function _0x1cfb67(_0x1910ac){try{_0x1289e3(_0x402615['throw'](_0x1910ac));}catch(_0x4415bf){_0x2c45f3(_0x4415bf);}}function _0x1289e3(_0x52c075){_0x52c075['done']?_0x5345f7(_0x52c075['value']):_0x36255e(_0x52c075['value'])['then'](_0x271709,_0x1cfb67);}_0x1289e3((_0x402615=_0x402615['apply'](_0x2fa8bf,_0x3ede50||[]))['next']());});};class AccountService{constructor(_0x4e25fd){this['fetch']=_0x4e25fd;}['get'](_0x1aa42a,_0x211dc4){return __awaiter$4(this,void 0,void 0,function*(){const _0x982225='Account/'+_0x1aa42a+'/',_0xbbddcb=yield this['fetch']['get'](_0x982225,_0x211dc4);try{if(_0xbbddcb['status']>0xc7&&_0xbbddcb['status']<0x12c){const _0x15e4a7=yield _0xbbddcb['json']();return new SuccessfulAccountResponse(_0x15e4a7);}const _0x3d313c=yield _0xbbddcb['json']();return new FailedAccountResponse(_0x3d313c);}catch(_0x880ddb){if(_0x880ddb instanceof Error)return new FailedAccountResponse({'detail':_0x880ddb['message'],'title':_0x880ddb['name'],'status':0x1f4,'instance':'','type':''});throw _0x880ddb;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x4c1bec,_0x1e8b53,_0x3b0181,_0x41b43c){function _0x3b494f(_0x4da2ba){return _0x4da2ba instanceof _0x3b0181?_0x4da2ba:new _0x3b0181(function(_0x1ac7a5){_0x1ac7a5(_0x4da2ba);});}return new(_0x3b0181||(_0x3b0181=Promise))(function(_0x3826c9,_0x3da1c9){function _0x46b0c8(_0x3942c3){try{_0x506517(_0x41b43c['next'](_0x3942c3));}catch(_0x2e371e){_0x3da1c9(_0x2e371e);}}function _0x3ca535(_0x3d8c92){try{_0x506517(_0x41b43c['throw'](_0x3d8c92));}catch(_0x369164){_0x3da1c9(_0x369164);}}function _0x506517(_0x48b048){_0x48b048['done']?_0x3826c9(_0x48b048['value']):_0x3b494f(_0x48b048['value'])['then'](_0x46b0c8,_0x3ca535);}_0x506517((_0x41b43c=_0x41b43c['apply'](_0x4c1bec,_0x1e8b53||[]))['next']());});};class ApiKeyService{constructor(_0x58b0b2){this['fetch']=_0x58b0b2;}['create'](_0x3ff695,_0x38bbf1,_0x271ea5){return __awaiter$3(this,void 0,void 0,function*(){const _0x518b9c='api-key/create',_0x207bed={'account_name':_0x3ff695,'api_key_name':_0x38bbf1};try{const _0x22205d=yield this['fetch']['post'](_0x518b9c,_0x271ea5,_0x207bed);if(_0x22205d['status']>0xc7&&_0x22205d['status']<0x12c){const _0x365b33=yield _0x22205d['json']();return new SuccessfulApiKeyResponse(_0x365b33);}const _0x2e3eb5=yield _0x22205d['json']();return new FailedApiKeyResponse(_0x2e3eb5);}catch(_0x5c9fca){if(_0x5c9fca instanceof Error)return new FailedApiKeyResponse({'detail':_0x5c9fca['message'],'title':_0x5c9fca['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c9fca;}});}['view'](_0x4fed72,_0x1fdf18,_0x34258c){return __awaiter$3(this,void 0,void 0,function*(){const _0x3a3e7c='api-key/'+_0x4fed72+'/'+_0x1fdf18;try{const _0x29fba7=yield this['fetch']['get'](_0x3a3e7c,_0x34258c);if(_0x29fba7['status']>0xc7&&_0x29fba7['status']<0x12c){const _0x3ed200=yield _0x29fba7['json']();return new SuccessfulApiKeyValueResponse(_0x3ed200);}const _0xcc3d2f=yield _0x29fba7['json']();return new FailedApiKeyValueResponse(_0xcc3d2f);}catch(_0x6b727d){if(_0x6b727d instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x6b727d['message'],'title':_0x6b727d['name'],'status':0x1f4,'instance':'','type':''});throw _0x6b727d;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x46036c,_0x3f67e0,_0x164c98,_0x49b1c9){function _0x24351c(_0x50f637){return _0x50f637 instanceof _0x164c98?_0x50f637:new _0x164c98(function(_0x3be7de){_0x3be7de(_0x50f637);});}return new(_0x164c98||(_0x164c98=Promise))(function(_0x139d6e,_0x75d149){function _0x291a38(_0x174da6){try{_0x44d5dc(_0x49b1c9['next'](_0x174da6));}catch(_0x376b8f){_0x75d149(_0x376b8f);}}function _0x2ab679(_0x43cd08){try{_0x44d5dc(_0x49b1c9['throw'](_0x43cd08));}catch(_0x372f1d){_0x75d149(_0x372f1d);}}function _0x44d5dc(_0x299a58){_0x299a58['done']?_0x139d6e(_0x299a58['value']):_0x24351c(_0x299a58['value'])['then'](_0x291a38,_0x2ab679);}_0x44d5dc((_0x49b1c9=_0x49b1c9['apply'](_0x46036c,_0x3f67e0||[]))['next']());});};class ListService{constructor(_0x1fe3f3){this['fetch']=_0x1fe3f3;}['add'](_0x383190,_0x23a762,_0xd40e38){return __awaiter$2(this,void 0,void 0,function*(){const _0x338d69='List',_0x4911ba={'account_name':_0x383190,'list_name':_0x23a762};try{const _0x4c1c10=yield this['fetch']['post'](_0x338d69,_0xd40e38,_0x4911ba);if(_0x4c1c10['status']>0xc7&&_0x4c1c10['status']<0x12c){const _0xe069a0=yield _0x4c1c10['json']();return new SuccessfulAccountResponse(_0xe069a0);}const _0x107672=yield _0x4c1c10['json']();return new FailedAccountResponse(_0x107672);}catch(_0x417cbb){if(_0x417cbb instanceof Error)return new FailedAccountResponse({'detail':_0x417cbb['message'],'title':_0x417cbb['name'],'status':0x1f4,'instance':'','type':''});throw _0x417cbb;}});}['remove'](_0xd35d3b,_0x41a7d4,_0x5602cd){return __awaiter$2(this,void 0,void 0,function*(){const _0x17d6eb='List/'+_0xd35d3b+'/'+_0x41a7d4,_0x535566=yield this['fetch']['delete'](_0x17d6eb,_0x5602cd);try{if(_0x535566['status']>0xc7&&_0x535566['status']<0x12c){const _0x1f6226=yield _0x535566['json']();return new SuccessfulAccountResponse(_0x1f6226);}const _0x5000af=yield _0x535566['json']();return new FailedAccountResponse(_0x5000af);}catch(_0xb184db){if(_0xb184db instanceof Error)return new FailedAccountResponse({'detail':_0xb184db['message'],'title':_0xb184db['name'],'status':0x1f4,'instance':'','type':''});throw _0xb184db;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x336db4,_0x23d696,_0x659bb,_0x479d48){function _0x1b5222(_0x334a6d){return _0x334a6d instanceof _0x659bb?_0x334a6d:new _0x659bb(function(_0x2a051d){_0x2a051d(_0x334a6d);});}return new(_0x659bb||(_0x659bb=Promise))(function(_0x19444d,_0x4c5ff6){function _0xa45f37(_0x542b5a){try{_0x171759(_0x479d48['next'](_0x542b5a));}catch(_0xf8d04b){_0x4c5ff6(_0xf8d04b);}}function _0x2308f2(_0x2e333c){try{_0x171759(_0x479d48['throw'](_0x2e333c));}catch(_0x4b0792){_0x4c5ff6(_0x4b0792);}}function _0x171759(_0x2406a9){_0x2406a9['done']?_0x19444d(_0x2406a9['value']):_0x1b5222(_0x2406a9['value'])['then'](_0xa45f37,_0x2308f2);}_0x171759((_0x479d48=_0x479d48['apply'](_0x336db4,_0x23d696||[]))['next']());});};class Fetch{constructor(_0x11e235){this['baseUri']=_0x11e235,this['getUrl']=_0x398c08=>{return _0x398c08['startsWith']('/')&&(_0x398c08=_0x398c08['replace']('/','')),''+this['baseUri']+_0x398c08;},!_0x11e235['endsWith']('/')&&(_0x11e235=_0x11e235+'/');}['get'](_0x1197d1,_0x154732){return __awaiter$1(this,void 0,void 0,function*(){const _0x16bdc5=this['getUrl'](_0x1197d1);return yield fetch(_0x16bdc5,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x154732}});});}['post'](_0x57c09c,_0x4a400f,_0x1f42b5){return __awaiter$1(this,void 0,void 0,function*(){const _0x3dd135=this['getUrl'](_0x57c09c);return yield fetch(_0x3dd135,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4a400f},'body':_0x1f42b5?JSON['stringify'](_0x1f42b5):null});});}['put'](_0x547b96,_0x4a748e,_0x5a6e28){return __awaiter$1(this,void 0,void 0,function*(){const _0x2e6435=this['getUrl'](_0x547b96);return yield fetch(_0x2e6435,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4a748e},'body':_0x5a6e28?JSON['stringify'](_0x5a6e28):null});});}['delete'](_0x34131e,_0x53c18b){return __awaiter$1(this,void 0,void 0,function*(){const _0x159bef=this['getUrl'](_0x34131e);return yield fetch(_0x159bef,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x53c18b}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter
|
|
14
|
-
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x848a6d,_0x1dc36e,_0x1aff4f,_0x280c26){function _0x27e531(_0x266fdb){return _0x266fdb instanceof _0x1aff4f?_0x266fdb:new _0x1aff4f(function(_0x371537){_0x371537(_0x266fdb);});}return new(_0x1aff4f||(_0x1aff4f=Promise))(function(_0x483fb6,_0x37def1){function _0x24fcf2(_0x28b4b0){try{_0x1304d8(_0x280c26['next'](_0x28b4b0));}catch(_0x497713){_0x37def1(_0x497713);}}function _0x275543(_0x1a35ce){try{_0x1304d8(_0x280c26['throw'](_0x1a35ce));}catch(_0x112286){_0x37def1(_0x112286);}}function _0x1304d8(_0x31e3eb){_0x31e3eb['done']?_0x483fb6(_0x31e3eb['value']):_0x27e531(_0x31e3eb['value'])['then'](_0x24fcf2,_0x275543);}_0x1304d8((_0x280c26=_0x280c26['apply'](_0x848a6d,_0x1dc36e||[]))['next']());});};class AdminClient{constructor(_0x9519ae='https://admin.searchability.dev/'){var _0x2e09fd=new Fetch(_0x9519ae);this['Accounts']=new AccountService(_0x2e09fd),this['Lists']=new ListService(_0x2e09fd),this['ApiKeys']=new ApiKeyService(_0x2e09fd);}}class AuthClient{constructor(_0x5d9b36='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5d9b36);}['login'](_0x4a3c12){return __awaiter(this,void 0,void 0,function*(){var _0x28e03e='login/'+_0x4a3c12;try{const _0x1b0554=yield yield fetch(_0x28e03e);if(_0x1b0554['status']>0xc7&&_0x1b0554['status']<0x12c){const _0x44c716=yield _0x1b0554['json']();return new SuccessfulAuthResponse(_0x44c716);}const _0x197cfd=yield _0x1b0554['json']();return new FailedAuthResponse(_0x197cfd);}catch(_0x28e374){if(_0x28e374 instanceof Error)return new FailedAuthResponse({'detail':_0x28e374['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x28e374;}});}['refresh'](_0x13b06f){return __awaiter(this,void 0,void 0,function*(){var _0x1fbfdd='refresh';try{const _0x384c23=yield this['fetch']['post'](_0x1fbfdd,_0x13b06f,null);if(_0x384c23['status']>0xc7&&_0x384c23['status']<0x12c){const _0x394572=yield _0x384c23['json']();return new SuccessfulAuthResponse(_0x394572);}const _0x21a334=yield _0x384c23['json']();return new FailedAuthResponse(_0x21a334);}catch(_0x387e98){if(_0x387e98 instanceof Error)return new FailedAuthResponse({'detail':_0x387e98['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x387e98;}});}}
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x2b2c48,_0x14cab9,_0x5c7c72,_0xaff6f6){function _0x4c874f(_0x1e6118){return _0x1e6118 instanceof _0x5c7c72?_0x1e6118:new _0x5c7c72(function(_0x3db553){_0x3db553(_0x1e6118);});}return new(_0x5c7c72||(_0x5c7c72=Promise))(function(_0x16667d,_0x2d6000){function _0x13ea6d(_0x7577){try{_0x2ca7bb(_0xaff6f6['next'](_0x7577));}catch(_0x1eeaea){_0x2d6000(_0x1eeaea);}}function _0x2ab460(_0x4f1a26){try{_0x2ca7bb(_0xaff6f6['throw'](_0x4f1a26));}catch(_0x538067){_0x2d6000(_0x538067);}}function _0x2ca7bb(_0x157d90){_0x157d90['done']?_0x16667d(_0x157d90['value']):_0x4c874f(_0x157d90['value'])['then'](_0x13ea6d,_0x2ab460);}_0x2ca7bb((_0xaff6f6=_0xaff6f6['apply'](_0x2b2c48,_0x14cab9||[]))['next']());});};class AdminClient{constructor(_0x2bfc97='https://admin.searchability.dev/'){var _0x43c062=new Fetch(_0x2bfc97);this['Accounts']=new AccountService(_0x43c062),this['Lists']=new ListService(_0x43c062),this['ApiKeys']=new ApiKeyService(_0x43c062);}}class AuthClient{constructor(_0x4e0b81='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x4e0b81);}['login'](_0x548ace){return __awaiter(this,void 0,void 0,function*(){var _0x1616d5='login/'+_0x548ace;try{const _0x371252=yield yield fetch(_0x1616d5);if(_0x371252['status']>0xc7&&_0x371252['status']<0x12c){const _0x2f1cdb=yield _0x371252['json']();return new SuccessfulAuthResponse(_0x2f1cdb);}const _0x221ad3=yield _0x371252['json']();return new FailedAuthResponse(_0x221ad3);}catch(_0x216519){if(_0x216519 instanceof Error)return new FailedAuthResponse({'detail':_0x216519['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x216519;}});}['refresh'](_0x216a48){return __awaiter(this,void 0,void 0,function*(){var _0xac6c0f='refresh';try{const _0x3671e0=yield this['fetch']['post'](_0xac6c0f,_0x216a48,null);if(_0x3671e0['status']>0xc7&&_0x3671e0['status']<0x12c){const _0x48a5f8=yield _0x3671e0['json']();return new SuccessfulAuthResponse(_0x48a5f8);}const _0x2e1035=yield _0x3671e0['json']();return new FailedAuthResponse(_0x2e1035);}catch(_0x4ee17d){if(_0x4ee17d instanceof Error)return new FailedAuthResponse({'detail':_0x4ee17d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ee17d;}});}['getTokenStatus'](_0x1f6e05){if(Date['now']()<_0x1f6e05['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x1f6e05['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
16
14
|
|
|
17
15
|
exports.AdminClient = AdminClient;
|
|
18
16
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x2869f6){_0x2869f6[_0x2869f6['Ok']=0x0]='Ok',_0x2869f6[_0x2869f6['Refresh']=0x1]='Refresh',_0x2869f6[_0x2869f6['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x7bf789){this['isSuccess']=_0x7bf789;}}class SuccessfulAccountResponse extends Response{constructor(_0x335f9d){super(!![]),this['account']=_0x335f9d;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x146354){super(![]),this['problem']=_0x146354;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x141869){super(!![]),this['tokens']=_0x141869;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x231743){super(![]),this['problem']=_0x231743;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x4f07b1){super(!![]),this['apiKey']=_0x4f07b1;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x17c8f7){super(![]),this['problem']=_0x17c8f7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x4379e6){super(!![]),this['apiKeyValue']=_0x4379e6;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x494fb0){super(![]),this['problem']=_0x494fb0;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x3ca976,_0x49454b,_0x2fdcbe,_0x5aa82c){function _0x422724(_0x3283d5){return _0x3283d5 instanceof _0x2fdcbe?_0x3283d5:new _0x2fdcbe(function(_0x5c019a){_0x5c019a(_0x3283d5);});}return new(_0x2fdcbe||(_0x2fdcbe=Promise))(function(_0x53d3f7,_0x59daab){function _0x43885a(_0x42150e){try{_0x5163db(_0x5aa82c['next'](_0x42150e));}catch(_0x2413f5){_0x59daab(_0x2413f5);}}function _0x37c6fa(_0x130b49){try{_0x5163db(_0x5aa82c['throw'](_0x130b49));}catch(_0x49e598){_0x59daab(_0x49e598);}}function _0x5163db(_0x566c9f){_0x566c9f['done']?_0x53d3f7(_0x566c9f['value']):_0x422724(_0x566c9f['value'])['then'](_0x43885a,_0x37c6fa);}_0x5163db((_0x5aa82c=_0x5aa82c['apply'](_0x3ca976,_0x49454b||[]))['next']());});};class AccountService{constructor(_0x2a8741){this['fetch']=_0x2a8741;}['get'](_0x2e7e72,_0x78cdb9){return __awaiter$4(this,void 0,void 0,function*(){const _0x57d5de='Account/'+_0x2e7e72+'/',_0x2f18c1=yield this['fetch']['get'](_0x57d5de,_0x78cdb9);try{if(_0x2f18c1['status']>0xc7&&_0x2f18c1['status']<0x12c){const _0x1f9de8=yield _0x2f18c1['json']();return new SuccessfulAccountResponse(_0x1f9de8);}const _0x519693=yield _0x2f18c1['json']();return new FailedAccountResponse(_0x519693);}catch(_0x324f47){if(_0x324f47 instanceof Error)return new FailedAccountResponse({'detail':_0x324f47['message'],'title':_0x324f47['name'],'status':0x1f4,'instance':'','type':''});throw _0x324f47;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$
|
|
5
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x4064bd,_0xe70e67,_0x25354c,_0x283f75){function _0x3fa6a2(_0x50e9e6){return _0x50e9e6 instanceof _0x25354c?_0x50e9e6:new _0x25354c(function(_0xbfa97a){_0xbfa97a(_0x50e9e6);});}return new(_0x25354c||(_0x25354c=Promise))(function(_0x3b13a8,_0x59187a){function _0x7203ce(_0x28f540){try{_0x2c4c3b(_0x283f75['next'](_0x28f540));}catch(_0x1f1a7a){_0x59187a(_0x1f1a7a);}}function _0x6bb640(_0x589445){try{_0x2c4c3b(_0x283f75['throw'](_0x589445));}catch(_0x14685e){_0x59187a(_0x14685e);}}function _0x2c4c3b(_0x2f2adc){_0x2f2adc['done']?_0x3b13a8(_0x2f2adc['value']):_0x3fa6a2(_0x2f2adc['value'])['then'](_0x7203ce,_0x6bb640);}_0x2c4c3b((_0x283f75=_0x283f75['apply'](_0x4064bd,_0xe70e67||[]))['next']());});};class ApiKeyService{constructor(_0x6764bd){this['fetch']=_0x6764bd;}['create'](_0xd08c7f,_0x66b6a2,_0x4c26fe){return __awaiter$3(this,void 0,void 0,function*(){const _0x3a136d='api-key/create',_0x3a2c3e={'account_name':_0xd08c7f,'api_key_name':_0x66b6a2};try{const _0x37c899=yield this['fetch']['post'](_0x3a136d,_0x4c26fe,_0x3a2c3e);if(_0x37c899['status']>0xc7&&_0x37c899['status']<0x12c){const _0x1c5fc9=yield _0x37c899['json']();return new SuccessfulApiKeyResponse(_0x1c5fc9);}const _0x437bf0=yield _0x37c899['json']();return new FailedApiKeyResponse(_0x437bf0);}catch(_0x414104){if(_0x414104 instanceof Error)return new FailedApiKeyResponse({'detail':_0x414104['message'],'title':_0x414104['name'],'status':0x1f4,'instance':'','type':''});throw _0x414104;}});}['view'](_0x21e759,_0x3e6de0,_0x31f3f0){return __awaiter$3(this,void 0,void 0,function*(){const _0x565b58='api-key/'+_0x21e759+'/'+_0x3e6de0;try{const _0x3ad80a=yield this['fetch']['get'](_0x565b58,_0x31f3f0);if(_0x3ad80a['status']>0xc7&&_0x3ad80a['status']<0x12c){const _0xb1671d=yield _0x3ad80a['json']();return new SuccessfulApiKeyValueResponse(_0xb1671d);}const _0x1f0166=yield _0x3ad80a['json']();return new FailedApiKeyValueResponse(_0x1f0166);}catch(_0x28521a){if(_0x28521a instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x28521a['message'],'title':_0x28521a['name'],'status':0x1f4,'instance':'','type':''});throw _0x28521a;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x54451d,_0x4bb625,_0x25bb7d,_0x22eb26){function _0x762a2f(_0x512991){return _0x512991 instanceof _0x25bb7d?_0x512991:new _0x25bb7d(function(_0x3f5734){_0x3f5734(_0x512991);});}return new(_0x25bb7d||(_0x25bb7d=Promise))(function(_0x47a383,_0x559df1){function _0x1a3e12(_0x12c5a0){try{_0x484308(_0x22eb26['next'](_0x12c5a0));}catch(_0x59e429){_0x559df1(_0x59e429);}}function _0x35053c(_0x236fb7){try{_0x484308(_0x22eb26['throw'](_0x236fb7));}catch(_0x2898d1){_0x559df1(_0x2898d1);}}function _0x484308(_0x130d65){_0x130d65['done']?_0x47a383(_0x130d65['value']):_0x762a2f(_0x130d65['value'])['then'](_0x1a3e12,_0x35053c);}_0x484308((_0x22eb26=_0x22eb26['apply'](_0x54451d,_0x4bb625||[]))['next']());});};class ListService{constructor(_0x25c8fa){this['fetch']=_0x25c8fa;}['add'](_0x101df0,_0x54f17a,_0x5846ed){return __awaiter$2(this,void 0,void 0,function*(){const _0x90cbff='List',_0x462115={'account_name':_0x101df0,'list_name':_0x54f17a};try{const _0x22f0d7=yield this['fetch']['post'](_0x90cbff,_0x5846ed,_0x462115);if(_0x22f0d7['status']>0xc7&&_0x22f0d7['status']<0x12c){const _0x1b51b1=yield _0x22f0d7['json']();return new SuccessfulAccountResponse(_0x1b51b1);}const _0x2402d0=yield _0x22f0d7['json']();return new FailedAccountResponse(_0x2402d0);}catch(_0x40433f){if(_0x40433f instanceof Error)return new FailedAccountResponse({'detail':_0x40433f['message'],'title':_0x40433f['name'],'status':0x1f4,'instance':'','type':''});throw _0x40433f;}});}['remove'](_0x5e175f,_0x47d64a,_0x1ef493){return __awaiter$2(this,void 0,void 0,function*(){const _0x5aa85c='List/'+_0x5e175f+'/'+_0x47d64a,_0x38e8ab=yield this['fetch']['delete'](_0x5aa85c,_0x1ef493);try{if(_0x38e8ab['status']>0xc7&&_0x38e8ab['status']<0x12c){const _0x4c341b=yield _0x38e8ab['json']();return new SuccessfulAccountResponse(_0x4c341b);}const _0x2d0802=yield _0x38e8ab['json']();return new FailedAccountResponse(_0x2d0802);}catch(_0x5d896c){if(_0x5d896c instanceof Error)return new FailedAccountResponse({'detail':_0x5d896c['message'],'title':_0x5d896c['name'],'status':0x1f4,'instance':'','type':''});throw _0x5d896c;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x313890,_0x125ab4,_0x572a48,_0x887349){function _0x5e51d9(_0xd97e37){return _0xd97e37 instanceof _0x572a48?_0xd97e37:new _0x572a48(function(_0x19eba0){_0x19eba0(_0xd97e37);});}return new(_0x572a48||(_0x572a48=Promise))(function(_0x1f838e,_0x303e52){function _0x578119(_0x19a23e){try{_0x34cfa9(_0x887349['next'](_0x19a23e));}catch(_0x280d82){_0x303e52(_0x280d82);}}function _0xf1b594(_0x4aede9){try{_0x34cfa9(_0x887349['throw'](_0x4aede9));}catch(_0x30a36f){_0x303e52(_0x30a36f);}}function _0x34cfa9(_0x39ce1f){_0x39ce1f['done']?_0x1f838e(_0x39ce1f['value']):_0x5e51d9(_0x39ce1f['value'])['then'](_0x578119,_0xf1b594);}_0x34cfa9((_0x887349=_0x887349['apply'](_0x313890,_0x125ab4||[]))['next']());});};class Fetch{constructor(_0x3c1c79){this['baseUri']=_0x3c1c79,this['getUrl']=_0x7c5d4f=>{return _0x7c5d4f['startsWith']('/')&&(_0x7c5d4f=_0x7c5d4f['replace']('/','')),''+this['baseUri']+_0x7c5d4f;},!_0x3c1c79['endsWith']('/')&&(_0x3c1c79=_0x3c1c79+'/');}['get'](_0x4c3a8e,_0x156299){return __awaiter$1(this,void 0,void 0,function*(){const _0x8721f5=this['getUrl'](_0x4c3a8e);return yield fetch(_0x8721f5,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x156299}});});}['post'](_0x5e91aa,_0x347768,_0x5c68c8){return __awaiter$1(this,void 0,void 0,function*(){const _0x5bb278=this['getUrl'](_0x5e91aa);return yield fetch(_0x5bb278,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x347768},'body':_0x5c68c8?JSON['stringify'](_0x5c68c8):null});});}['put'](_0x505a3a,_0x2a86d6,_0x317474){return __awaiter$1(this,void 0,void 0,function*(){const _0x119421=this['getUrl'](_0x505a3a);return yield fetch(_0x119421,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2a86d6},'body':_0x317474?JSON['stringify'](_0x317474):null});});}['delete'](_0x4ac717,_0x32b3b7){return __awaiter$1(this,void 0,void 0,function*(){const _0x1c1608=this['getUrl'](_0x4ac717);return yield fetch(_0x1c1608,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x32b3b7}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4b1918,_0x485782,_0x233c49,_0x4aa62c){function _0x1ecf15(_0x2d5581){return _0x2d5581 instanceof _0x233c49?_0x2d5581:new _0x233c49(function(_0x5415c1){_0x5415c1(_0x2d5581);});}return new(_0x233c49||(_0x233c49=Promise))(function(_0x4f6f76,_0x1afa2e){function _0x23d772(_0x2ca96b){try{_0x2e1861(_0x4aa62c['next'](_0x2ca96b));}catch(_0x6989ef){_0x1afa2e(_0x6989ef);}}function _0x45c3a7(_0xebacdd){try{_0x2e1861(_0x4aa62c['throw'](_0xebacdd));}catch(_0x2ed3fd){_0x1afa2e(_0x2ed3fd);}}function _0x2e1861(_0x3e17e2){_0x3e17e2['done']?_0x4f6f76(_0x3e17e2['value']):_0x1ecf15(_0x3e17e2['value'])['then'](_0x23d772,_0x45c3a7);}_0x2e1861((_0x4aa62c=_0x4aa62c['apply'](_0x4b1918,_0x485782||[]))['next']());});};class AdminClient{constructor(_0x2d0f5b='https://admin.searchability.dev/'){var _0x454a30=new Fetch(_0x2d0f5b);this['Accounts']=new AccountService(_0x454a30),this['Lists']=new ListService(_0x454a30),this['ApiKeys']=new ApiKeyService(_0x454a30);}}class AuthClient{constructor(_0x5c8248='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x5c8248);}['login'](_0x34b02b){return __awaiter(this,void 0,void 0,function*(){var _0x9dedcd='login/'+_0x34b02b;try{const _0x2c3c38=yield yield fetch(_0x9dedcd);if(_0x2c3c38['status']>0xc7&&_0x2c3c38['status']<0x12c){const _0x2e37b=yield _0x2c3c38['json']();return new SuccessfulAuthResponse(_0x2e37b);}const _0x5c1d8f=yield _0x2c3c38['json']();return new FailedAuthResponse(_0x5c1d8f);}catch(_0xa8311){if(_0xa8311 instanceof Error)return new FailedAuthResponse({'detail':_0xa8311['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xa8311;}});}['refresh'](_0x1c999f){return __awaiter(this,void 0,void 0,function*(){var _0x22ccb7='refresh';try{const _0x28c19d=yield this['fetch']['post'](_0x22ccb7,_0x1c999f,null);if(_0x28c19d['status']>0xc7&&_0x28c19d['status']<0x12c){const _0x2d23ce=yield _0x28c19d['json']();return new SuccessfulAuthResponse(_0x2d23ce);}const _0x24fe67=yield _0x28c19d['json']();return new FailedAuthResponse(_0x24fe67);}catch(_0x3a7b70){if(_0x3a7b70 instanceof Error)return new FailedAuthResponse({'detail':_0x3a7b70['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3a7b70;}});}}
|
|
11
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x5c6b28,_0x3b0a52,_0x5482bf,_0x202d0f){function _0x33733c(_0x5917e7){return _0x5917e7 instanceof _0x5482bf?_0x5917e7:new _0x5482bf(function(_0x29a235){_0x29a235(_0x5917e7);});}return new(_0x5482bf||(_0x5482bf=Promise))(function(_0x58a969,_0x7b130c){function _0x373d0e(_0x4779b6){try{_0x150f18(_0x202d0f['next'](_0x4779b6));}catch(_0x3598e2){_0x7b130c(_0x3598e2);}}function _0x36059d(_0x26de4c){try{_0x150f18(_0x202d0f['throw'](_0x26de4c));}catch(_0x6210a5){_0x7b130c(_0x6210a5);}}function _0x150f18(_0x1fe269){_0x1fe269['done']?_0x58a969(_0x1fe269['value']):_0x33733c(_0x1fe269['value'])['then'](_0x373d0e,_0x36059d);}_0x150f18((_0x202d0f=_0x202d0f['apply'](_0x5c6b28,_0x3b0a52||[]))['next']());});};class AdminClient{constructor(_0x137d3d='https://admin.searchability.dev/'){var _0x13fa25=new Fetch(_0x137d3d);this['Accounts']=new AccountService(_0x13fa25),this['Lists']=new ListService(_0x13fa25),this['ApiKeys']=new ApiKeyService(_0x13fa25);}}class AuthClient{constructor(_0x3ea384='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x3ea384);}['login'](_0xcd5946){return __awaiter(this,void 0,void 0,function*(){var _0x2effb5='login/'+_0xcd5946;try{const _0xf417cc=yield yield fetch(_0x2effb5);if(_0xf417cc['status']>0xc7&&_0xf417cc['status']<0x12c){const _0x3e2e56=yield _0xf417cc['json']();return new SuccessfulAuthResponse(_0x3e2e56);}const _0xf9d867=yield _0xf417cc['json']();return new FailedAuthResponse(_0xf9d867);}catch(_0x2b629b){if(_0x2b629b instanceof Error)return new FailedAuthResponse({'detail':_0x2b629b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2b629b;}});}['refresh'](_0x436d12){return __awaiter(this,void 0,void 0,function*(){var _0x5c199e='refresh';try{const _0x432b7d=yield this['fetch']['post'](_0x5c199e,_0x436d12,null);if(_0x432b7d['status']>0xc7&&_0x432b7d['status']<0x12c){const _0x9df81d=yield _0x432b7d['json']();return new SuccessfulAuthResponse(_0x9df81d);}const _0xf90e20=yield _0x432b7d['json']();return new FailedAuthResponse(_0xf90e20);}catch(_0x5e60a2){if(_0x5e60a2 instanceof Error)return new FailedAuthResponse({'detail':_0x5e60a2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5e60a2;}});}['getTokenStatus'](_0x1f5713){if(Date['now']()<_0x1f5713['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x1f5713['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
12
|
|
|
15
13
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -28,19 +28,6 @@ declare class ListService {
|
|
|
28
28
|
remove(accountName: string, listName: string, access_token: string): Promise<Response<Account, Problem>>;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
declare enum TokenStatus {
|
|
32
|
-
Ok = 0,
|
|
33
|
-
Refresh = 1,
|
|
34
|
-
Expired = 2
|
|
35
|
-
}
|
|
36
|
-
declare class Tokens {
|
|
37
|
-
access_token: string;
|
|
38
|
-
access_expires: number;
|
|
39
|
-
refresh_token: string;
|
|
40
|
-
refresh_expires: number;
|
|
41
|
-
getStatus(): TokenStatus;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
31
|
declare class AdminClient {
|
|
45
32
|
constructor(baseUri?: string);
|
|
46
33
|
readonly Accounts: AccountService;
|
|
@@ -52,8 +39,20 @@ declare class AuthClient {
|
|
|
52
39
|
constructor(baseUri?: string);
|
|
53
40
|
login(apiKey: string): Promise<Response<Tokens, Problem>>;
|
|
54
41
|
refresh(refreshToken: string): Promise<Response<Tokens, Problem>>;
|
|
42
|
+
getTokenStatus(tokens: Tokens): TokenStatus;
|
|
55
43
|
}
|
|
56
44
|
|
|
45
|
+
declare enum TokenStatus {
|
|
46
|
+
Ok = 0,
|
|
47
|
+
Refresh = 1,
|
|
48
|
+
Expired = 2
|
|
49
|
+
}
|
|
50
|
+
declare class Tokens {
|
|
51
|
+
access_token: string;
|
|
52
|
+
access_expires: number;
|
|
53
|
+
refresh_token: string;
|
|
54
|
+
refresh_expires: number;
|
|
55
|
+
}
|
|
57
56
|
declare abstract class Response<S, F> {
|
|
58
57
|
readonly isSuccess: boolean;
|
|
59
58
|
constructor(isSuccess: boolean);
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0xbff044){_0xbff044[_0xbff044['Ok']=0x0]='Ok',_0xbff044[_0xbff044['Refresh']=0x1]='Refresh',_0xbff044[_0xbff044['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}['getStatus'](){if(Date['now']()<this['access_expires'])return TokenStatus['Ok'];if(Date['now']()<this['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
2
|
-
|
|
3
|
-
class Response{constructor(_0x385844){this['isSuccess']=_0x385844;}}class SuccessfulAccountResponse extends Response{constructor(_0x27de5d){super(!![]),this['account']=_0x27de5d;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x9b9ed8){super(![]),this['problem']=_0x9b9ed8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x424888){super(!![]),this['tokens']=_0x424888;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x14adc8){super(![]),this['problem']=_0x14adc8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x31a59c){super(!![]),this['apiKey']=_0x31a59c;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5bef8d){super(![]),this['problem']=_0x5bef8d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x10788f){super(!![]),this['apiKeyValue']=_0x10788f;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyValueResponse extends Response{constructor(_0x3ab8a8){super(![]),this['problem']=_0x3ab8a8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4fd89d,_0x10ba5a,_0x534a59,_0x183e42){function _0x23aad4(_0x46cdb8){return _0x46cdb8 instanceof _0x534a59?_0x46cdb8:new _0x534a59(function(_0x65904b){_0x65904b(_0x46cdb8);});}return new(_0x534a59||(_0x534a59=Promise))(function(_0x53aa90,_0x25cb33){function _0x451f96(_0x4009e5){try{_0x16d1e4(_0x183e42['next'](_0x4009e5));}catch(_0x1f80c7){_0x25cb33(_0x1f80c7);}}function _0x3ffde2(_0x10557a){try{_0x16d1e4(_0x183e42['throw'](_0x10557a));}catch(_0x40ac04){_0x25cb33(_0x40ac04);}}function _0x16d1e4(_0x481330){_0x481330['done']?_0x53aa90(_0x481330['value']):_0x23aad4(_0x481330['value'])['then'](_0x451f96,_0x3ffde2);}_0x16d1e4((_0x183e42=_0x183e42['apply'](_0x4fd89d,_0x10ba5a||[]))['next']());});};class AccountService{constructor(_0xcd91bf){this['fetch']=_0xcd91bf;}['get'](_0x27f48a,_0x1c7f5c){return __awaiter$4(this,void 0,void 0,function*(){const _0x1fd0ff='Account/'+_0x27f48a+'/',_0x37b434=yield this['fetch']['get'](_0x1fd0ff,_0x1c7f5c);try{if(_0x37b434['status']>0xc7&&_0x37b434['status']<0x12c){const _0x16d248=yield _0x37b434['json']();return new SuccessfulAccountResponse(_0x16d248);}const _0x324ded=yield _0x37b434['json']();return new FailedAccountResponse(_0x324ded);}catch(_0x22fff6){if(_0x22fff6 instanceof Error)return new FailedAccountResponse({'detail':_0x22fff6['message'],'title':_0x22fff6['name'],'status':0x1f4,'instance':'','type':''});throw _0x22fff6;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x266242,_0x1c9161,_0xa2295d,_0x407113){function _0x13e319(_0x24cd2a){return _0x24cd2a instanceof _0xa2295d?_0x24cd2a:new _0xa2295d(function(_0x21a0df){_0x21a0df(_0x24cd2a);});}return new(_0xa2295d||(_0xa2295d=Promise))(function(_0x5e00c3,_0x59ba2a){function _0x289539(_0x685ab2){try{_0x4334a1(_0x407113['next'](_0x685ab2));}catch(_0x522c6d){_0x59ba2a(_0x522c6d);}}function _0x164d7a(_0x594f54){try{_0x4334a1(_0x407113['throw'](_0x594f54));}catch(_0x943a95){_0x59ba2a(_0x943a95);}}function _0x4334a1(_0x2c4664){_0x2c4664['done']?_0x5e00c3(_0x2c4664['value']):_0x13e319(_0x2c4664['value'])['then'](_0x289539,_0x164d7a);}_0x4334a1((_0x407113=_0x407113['apply'](_0x266242,_0x1c9161||[]))['next']());});};class ApiKeyService{constructor(_0x5dd4ea){this['fetch']=_0x5dd4ea;}['create'](_0x408a6e,_0x355d7f,_0x4b6a19){return __awaiter$3(this,void 0,void 0,function*(){const _0x9cf359='api-key/create',_0x4ca5f3={'account_name':_0x408a6e,'api_key_name':_0x355d7f};try{const _0x58257c=yield this['fetch']['post'](_0x9cf359,_0x4b6a19,_0x4ca5f3);if(_0x58257c['status']>0xc7&&_0x58257c['status']<0x12c){const _0x5ae4c3=yield _0x58257c['json']();return new SuccessfulApiKeyResponse(_0x5ae4c3);}const _0xa94729=yield _0x58257c['json']();return new FailedApiKeyResponse(_0xa94729);}catch(_0xadcf1c){if(_0xadcf1c instanceof Error)return new FailedApiKeyResponse({'detail':_0xadcf1c['message'],'title':_0xadcf1c['name'],'status':0x1f4,'instance':'','type':''});throw _0xadcf1c;}});}['view'](_0x222218,_0x2d19d2,_0x14ca0e){return __awaiter$3(this,void 0,void 0,function*(){const _0x5536bd='api-key/'+_0x222218+'/'+_0x2d19d2;try{const _0x3e2a35=yield this['fetch']['get'](_0x5536bd,_0x14ca0e);if(_0x3e2a35['status']>0xc7&&_0x3e2a35['status']<0x12c){const _0x197c5a=yield _0x3e2a35['json']();return new SuccessfulApiKeyValueResponse(_0x197c5a);}const _0x4a6f55=yield _0x3e2a35['json']();return new FailedApiKeyValueResponse(_0x4a6f55);}catch(_0x11d612){if(_0x11d612 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x11d612['message'],'title':_0x11d612['name'],'status':0x1f4,'instance':'','type':''});throw _0x11d612;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x4031a3,_0x67f9af,_0x544047,_0x1746be){function _0x201160(_0x338948){return _0x338948 instanceof _0x544047?_0x338948:new _0x544047(function(_0x2dbdec){_0x2dbdec(_0x338948);});}return new(_0x544047||(_0x544047=Promise))(function(_0x51a38b,_0x16fc9f){function _0x2a40ff(_0x55fe66){try{_0x24ae65(_0x1746be['next'](_0x55fe66));}catch(_0xc60243){_0x16fc9f(_0xc60243);}}function _0xf6b40f(_0x218f38){try{_0x24ae65(_0x1746be['throw'](_0x218f38));}catch(_0x4dd058){_0x16fc9f(_0x4dd058);}}function _0x24ae65(_0x1e55dd){_0x1e55dd['done']?_0x51a38b(_0x1e55dd['value']):_0x201160(_0x1e55dd['value'])['then'](_0x2a40ff,_0xf6b40f);}_0x24ae65((_0x1746be=_0x1746be['apply'](_0x4031a3,_0x67f9af||[]))['next']());});};class ListService{constructor(_0x380f68){this['fetch']=_0x380f68;}['add'](_0x574ad9,_0x36687d,_0x1a0479){return __awaiter$2(this,void 0,void 0,function*(){const _0x3ffd1c='List',_0x12196e={'account_name':_0x574ad9,'list_name':_0x36687d};try{const _0x10779e=yield this['fetch']['post'](_0x3ffd1c,_0x1a0479,_0x12196e);if(_0x10779e['status']>0xc7&&_0x10779e['status']<0x12c){const _0x28d64b=yield _0x10779e['json']();return new SuccessfulAccountResponse(_0x28d64b);}const _0x5efd37=yield _0x10779e['json']();return new FailedAccountResponse(_0x5efd37);}catch(_0x510737){if(_0x510737 instanceof Error)return new FailedAccountResponse({'detail':_0x510737['message'],'title':_0x510737['name'],'status':0x1f4,'instance':'','type':''});throw _0x510737;}});}['remove'](_0x115a90,_0x48e2be,_0x2990a4){return __awaiter$2(this,void 0,void 0,function*(){const _0xeebf5b='List/'+_0x115a90+'/'+_0x48e2be,_0x38ea83=yield this['fetch']['delete'](_0xeebf5b,_0x2990a4);try{if(_0x38ea83['status']>0xc7&&_0x38ea83['status']<0x12c){const _0x2610cd=yield _0x38ea83['json']();return new SuccessfulAccountResponse(_0x2610cd);}const _0x2232eb=yield _0x38ea83['json']();return new FailedAccountResponse(_0x2232eb);}catch(_0x573d61){if(_0x573d61 instanceof Error)return new FailedAccountResponse({'detail':_0x573d61['message'],'title':_0x573d61['name'],'status':0x1f4,'instance':'','type':''});throw _0x573d61;}});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x32016c,_0x3497d3,_0x2fc238,_0x4956d4){function _0x3e8224(_0x2c8f2a){return _0x2c8f2a instanceof _0x2fc238?_0x2c8f2a:new _0x2fc238(function(_0x1bb2f9){_0x1bb2f9(_0x2c8f2a);});}return new(_0x2fc238||(_0x2fc238=Promise))(function(_0x2f2967,_0x3e7b03){function _0x833a4b(_0x2d7fd5){try{_0x2fe72c(_0x4956d4['next'](_0x2d7fd5));}catch(_0x436a68){_0x3e7b03(_0x436a68);}}function _0x314056(_0x34e8e3){try{_0x2fe72c(_0x4956d4['throw'](_0x34e8e3));}catch(_0x4f4251){_0x3e7b03(_0x4f4251);}}function _0x2fe72c(_0x1c2750){_0x1c2750['done']?_0x2f2967(_0x1c2750['value']):_0x3e8224(_0x1c2750['value'])['then'](_0x833a4b,_0x314056);}_0x2fe72c((_0x4956d4=_0x4956d4['apply'](_0x32016c,_0x3497d3||[]))['next']());});};class Fetch{constructor(_0x44e77e){this['baseUri']=_0x44e77e,this['getUrl']=_0x592618=>{return _0x592618['startsWith']('/')&&(_0x592618=_0x592618['replace']('/','')),''+this['baseUri']+_0x592618;},!_0x44e77e['endsWith']('/')&&(_0x44e77e=_0x44e77e+'/');}['get'](_0x4c846e,_0x2b1ab7){return __awaiter$1(this,void 0,void 0,function*(){const _0xc59ab4=this['getUrl'](_0x4c846e);return yield fetch(_0xc59ab4,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2b1ab7}});});}['post'](_0x3e719a,_0x29d0b7,_0x4f96dc){return __awaiter$1(this,void 0,void 0,function*(){const _0xdab63e=this['getUrl'](_0x3e719a);return yield fetch(_0xdab63e,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x29d0b7},'body':_0x4f96dc?JSON['stringify'](_0x4f96dc):null});});}['put'](_0x1b24a7,_0x369667,_0x2072bd){return __awaiter$1(this,void 0,void 0,function*(){const _0xd036b0=this['getUrl'](_0x1b24a7);return yield fetch(_0xd036b0,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x369667},'body':_0x2072bd?JSON['stringify'](_0x2072bd):null});});}['delete'](_0x1bb753,_0x36c8a7){return __awaiter$1(this,void 0,void 0,function*(){const _0x3a8244=this['getUrl'](_0x1bb753);return yield fetch(_0x3a8244,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x36c8a7}});});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x242d7c,_0x3c8956,_0x3930ce,_0x39188b){function _0x44dce8(_0x5c399c){return _0x5c399c instanceof _0x3930ce?_0x5c399c:new _0x3930ce(function(_0x278c1a){_0x278c1a(_0x5c399c);});}return new(_0x3930ce||(_0x3930ce=Promise))(function(_0x1e0911,_0x2fc8bc){function _0x2436a8(_0x20db00){try{_0x53b5fc(_0x39188b['next'](_0x20db00));}catch(_0x3831bb){_0x2fc8bc(_0x3831bb);}}function _0x4bab73(_0x3b1c6f){try{_0x53b5fc(_0x39188b['throw'](_0x3b1c6f));}catch(_0x59d596){_0x2fc8bc(_0x59d596);}}function _0x53b5fc(_0x5e3724){_0x5e3724['done']?_0x1e0911(_0x5e3724['value']):_0x44dce8(_0x5e3724['value'])['then'](_0x2436a8,_0x4bab73);}_0x53b5fc((_0x39188b=_0x39188b['apply'](_0x242d7c,_0x3c8956||[]))['next']());});};class AdminClient{constructor(_0x3141fe='https://admin.searchability.dev/'){var _0x5b89ee=new Fetch(_0x3141fe);this['Accounts']=new AccountService(_0x5b89ee),this['Lists']=new ListService(_0x5b89ee),this['ApiKeys']=new ApiKeyService(_0x5b89ee);}}class AuthClient{constructor(_0x26c2ef='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x26c2ef);}['login'](_0x3876b0){return __awaiter(this,void 0,void 0,function*(){var _0x58aeda='login/'+_0x3876b0;try{const _0x5a0f22=yield yield fetch(_0x58aeda);if(_0x5a0f22['status']>0xc7&&_0x5a0f22['status']<0x12c){const _0x5dfc38=yield _0x5a0f22['json']();return new SuccessfulAuthResponse(_0x5dfc38);}const _0x5466a6=yield _0x5a0f22['json']();return new FailedAuthResponse(_0x5466a6);}catch(_0x3b5851){if(_0x3b5851 instanceof Error)return new FailedAuthResponse({'detail':_0x3b5851['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3b5851;}});}['refresh'](_0x166d5c){return __awaiter(this,void 0,void 0,function*(){var _0x5a7b2f='refresh';try{const _0x1d462f=yield this['fetch']['post'](_0x5a7b2f,_0x166d5c,null);if(_0x1d462f['status']>0xc7&&_0x1d462f['status']<0x12c){const _0x204a93=yield _0x1d462f['json']();return new SuccessfulAuthResponse(_0x204a93);}const _0x5e8431=yield _0x1d462f['json']();return new FailedAuthResponse(_0x5e8431);}catch(_0x2625fa){if(_0x2625fa instanceof Error)return new FailedAuthResponse({'detail':_0x2625fa['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2625fa;}});}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|