@searchability/admin-client 0.0.18 → 0.0.20
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
|
+
undefined&&undefined['__awaiter']||function(_0x1e22eb,_0xeced25,_0x42d7ed,_0x5df34c){function _0x10370c(_0x1f96dc){return _0x1f96dc instanceof _0x42d7ed?_0x1f96dc:new _0x42d7ed(function(_0x4af985){_0x4af985(_0x1f96dc);});}return new(_0x42d7ed||(_0x42d7ed=Promise))(function(_0x5f1ee5,_0x3a6b8f){function _0x9a541e(_0xe837ad){try{_0x5daacf(_0x5df34c['next'](_0xe837ad));}catch(_0x23af2e){_0x3a6b8f(_0x23af2e);}}function _0x5120eb(_0x332b01){try{_0x5daacf(_0x5df34c['throw'](_0x332b01));}catch(_0x1fac20){_0x3a6b8f(_0x1fac20);}}function _0x5daacf(_0x10b532){_0x10b532['done']?_0x5f1ee5(_0x10b532['value']):_0x10370c(_0x10b532['value'])['then'](_0x9a541e,_0x5120eb);}_0x5daacf((_0x5df34c=_0x5df34c['apply'](_0x1e22eb,_0xeced25||[]))['next']());});};
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x1ee854){this['isSuccess']=_0x1ee854;}}class SuccessfulAccountResponse extends Response{constructor(_0x36834a){super(!![]),this['account']=_0x36834a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x289130){super(![]),this['problem']=_0x289130;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0xe7a6f0){super(!![]),this['tokens']=_0xe7a6f0;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x76633){super(![]),this['problem']=_0x76633;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x1a7ff9){super(!![]),this['apiKeys']=_0x1a7ff9;}['toSuccess'](){return this['apiKeys'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x277ac3){super(![]),this['problem']=_0x277ac3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4ad6d6,_0x2fa10e,_0x4db4bc,_0x44d2b9){function _0x5a53ba(_0x1b182d){return _0x1b182d instanceof _0x4db4bc?_0x1b182d:new _0x4db4bc(function(_0x5aa025){_0x5aa025(_0x1b182d);});}return new(_0x4db4bc||(_0x4db4bc=Promise))(function(_0x1919d5,_0x57d3ef){function _0x4e1a7b(_0x59d79b){try{_0x348477(_0x44d2b9['next'](_0x59d79b));}catch(_0x543cff){_0x57d3ef(_0x543cff);}}function _0xc6ae39(_0x1225c8){try{_0x348477(_0x44d2b9['throw'](_0x1225c8));}catch(_0x18c148){_0x57d3ef(_0x18c148);}}function _0x348477(_0x531a2a){_0x531a2a['done']?_0x1919d5(_0x531a2a['value']):_0x5a53ba(_0x531a2a['value'])['then'](_0x4e1a7b,_0xc6ae39);}_0x348477((_0x44d2b9=_0x44d2b9['apply'](_0x4ad6d6,_0x2fa10e||[]))['next']());});};class AccountService{constructor(_0x9d8414){this['fetch']=_0x9d8414;}['get'](_0x1bb848,_0x3d0ef1){return __awaiter$4(this,void 0,void 0,function*(){const _0x5a39ae='Account/'+_0x1bb848+'/',_0x2977c3=yield this['fetch']['get'](_0x5a39ae,_0x3d0ef1);try{if(_0x2977c3['status']>0xc7&&_0x2977c3['status']<0x12c){const _0x167aa4=yield _0x2977c3['json']();return new SuccessfulAccountResponse(_0x167aa4);}const _0xb2a59f=yield _0x2977c3['json']();return new FailedAccountResponse(_0xb2a59f);}catch(_0x3fc39b){if(_0x3fc39b instanceof Error)return new FailedAccountResponse({'detail':_0x3fc39b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3fc39b;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x19924e,_0x276b8b,_0x37c97d,_0x42e76b){function _0x174cf2(_0x40f005){return _0x40f005 instanceof _0x37c97d?_0x40f005:new _0x37c97d(function(_0x33560b){_0x33560b(_0x40f005);});}return new(_0x37c97d||(_0x37c97d=Promise))(function(_0x432fc0,_0x544725){function _0x50da0e(_0x5ebbf0){try{_0x1fd4de(_0x42e76b['next'](_0x5ebbf0));}catch(_0x20ea43){_0x544725(_0x20ea43);}}function _0xfb184d(_0x49de2d){try{_0x1fd4de(_0x42e76b['throw'](_0x49de2d));}catch(_0x3c2394){_0x544725(_0x3c2394);}}function _0x1fd4de(_0x11dd49){_0x11dd49['done']?_0x432fc0(_0x11dd49['value']):_0x174cf2(_0x11dd49['value'])['then'](_0x50da0e,_0xfb184d);}_0x1fd4de((_0x42e76b=_0x42e76b['apply'](_0x19924e,_0x276b8b||[]))['next']());});};class ApiKeyService{constructor(_0x58f92a){this['fetch']=_0x58f92a;}['create'](_0x772f3,_0xd2be52,_0xa583fb){return __awaiter$3(this,void 0,void 0,function*(){const _0x6fc91f='ApiKey/Create',_0xca4585={'account_name':_0x772f3,'name':_0xd2be52};try{const _0x1e859f=yield this['fetch']['post'](_0x6fc91f,_0xa583fb,_0xca4585);if(_0x1e859f['status']>0xc7&&_0x1e859f['status']<0x12c){const _0x79a245=yield _0x1e859f['json']();return new SuccessfulApiKeyResponse(_0x79a245);}const _0x15f500=yield _0x1e859f['json']();return new FailedApiKeyResponse(_0x15f500);}catch(_0x1a6b6d){if(_0x1a6b6d instanceof Error)return new FailedApiKeyResponse({'detail':_0x1a6b6d['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1a6b6d;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5314d2,_0x55e2a6,_0xaa086f,_0x23c27e){function _0x1ffbcd(_0x5d2339){return _0x5d2339 instanceof _0xaa086f?_0x5d2339:new _0xaa086f(function(_0x3eddc9){_0x3eddc9(_0x5d2339);});}return new(_0xaa086f||(_0xaa086f=Promise))(function(_0x1bec73,_0x29ba20){function _0x29ab73(_0x8a3eab){try{_0x22e7a3(_0x23c27e['next'](_0x8a3eab));}catch(_0x2ae0f1){_0x29ba20(_0x2ae0f1);}}function _0x44febc(_0x201965){try{_0x22e7a3(_0x23c27e['throw'](_0x201965));}catch(_0x793099){_0x29ba20(_0x793099);}}function _0x22e7a3(_0x55524a){_0x55524a['done']?_0x1bec73(_0x55524a['value']):_0x1ffbcd(_0x55524a['value'])['then'](_0x29ab73,_0x44febc);}_0x22e7a3((_0x23c27e=_0x23c27e['apply'](_0x5314d2,_0x55e2a6||[]))['next']());});};class ListService{constructor(_0x75d93b){this['fetch']=_0x75d93b;}['add'](_0x445e86,_0x2afc9d,_0x43e7c0){return __awaiter$2(this,void 0,void 0,function*(){const _0x1969da='List',_0x45e15b={'account_name':_0x445e86,'list_name':_0x2afc9d};try{const _0x42ec23=yield this['fetch']['post'](_0x1969da,_0x43e7c0,_0x45e15b);if(_0x42ec23['status']>0xc7&&_0x42ec23['status']<0x12c){const _0x4f0baf=yield _0x42ec23['json']();return new SuccessfulAccountResponse(_0x4f0baf);}const _0x3d43d5=yield _0x42ec23['json']();return new FailedAccountResponse(_0x3d43d5);}catch(_0x464b0e){if(_0x464b0e instanceof Error)return new FailedAccountResponse({'detail':_0x464b0e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x464b0e;}});}['remove'](_0x23e7cd,_0x47ffbd,_0x1088e1){return __awaiter$2(this,void 0,void 0,function*(){const _0x5e3404='List/'+_0x23e7cd+'/'+_0x47ffbd,_0x4c70d5=yield this['fetch']['delete'](_0x5e3404,_0x1088e1);try{if(_0x4c70d5['status']>0xc7&&_0x4c70d5['status']<0x12c){const _0x10a01a=yield _0x4c70d5['json']();return new SuccessfulAccountResponse(_0x10a01a);}const _0x2f4f80=yield _0x4c70d5['json']();return new FailedAccountResponse(_0x2f4f80);}catch(_0x11603b){if(_0x11603b instanceof Error)return new FailedAccountResponse({'detail':_0x11603b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x11603b;}});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xcf0452,_0x255c0a,_0x5467ff,_0x1d0cce){function _0x3d3e5c(_0x4bedcf){return _0x4bedcf instanceof _0x5467ff?_0x4bedcf:new _0x5467ff(function(_0x10d891){_0x10d891(_0x4bedcf);});}return new(_0x5467ff||(_0x5467ff=Promise))(function(_0x4b8679,_0x548eb9){function _0x4f86b1(_0x41bfc6){try{_0xde5367(_0x1d0cce['next'](_0x41bfc6));}catch(_0x42c8ab){_0x548eb9(_0x42c8ab);}}function _0x6feb0a(_0x1fb389){try{_0xde5367(_0x1d0cce['throw'](_0x1fb389));}catch(_0x24881e){_0x548eb9(_0x24881e);}}function _0xde5367(_0x3528c3){_0x3528c3['done']?_0x4b8679(_0x3528c3['value']):_0x3d3e5c(_0x3528c3['value'])['then'](_0x4f86b1,_0x6feb0a);}_0xde5367((_0x1d0cce=_0x1d0cce['apply'](_0xcf0452,_0x255c0a||[]))['next']());});};class Fetch{constructor(_0x168c02){this['baseUri']=_0x168c02,this['getUrl']=_0x1df9fc=>{return _0x1df9fc['startsWith']('/')&&(_0x1df9fc=_0x1df9fc['replace']('/','')),''+this['baseUri']+_0x1df9fc;},!_0x168c02['endsWith']('/')&&(_0x168c02=_0x168c02+'/');}['get'](_0x47c117,_0x6ad76){return __awaiter$1(this,void 0,void 0,function*(){const _0x1bc682=this['getUrl'](_0x47c117);return yield fetch(_0x1bc682,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x6ad76}});});}['post'](_0x11346d,_0x228281,_0x4d8f30){return __awaiter$1(this,void 0,void 0,function*(){const _0x138dc5=this['getUrl'](_0x11346d);return yield fetch(_0x138dc5,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x228281},'body':_0x4d8f30?JSON['stringify'](_0x4d8f30):null});});}['put'](_0x1af94e,_0x20a18b,_0x409770){return __awaiter$1(this,void 0,void 0,function*(){const _0x5a85b4=this['getUrl'](_0x1af94e);return yield fetch(_0x5a85b4,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x20a18b},'body':_0x409770?JSON['stringify'](_0x409770):null});});}['delete'](_0x30f8d4,_0x2f63c3){return __awaiter$1(this,void 0,void 0,function*(){const _0x3d943b=this['getUrl'](_0x30f8d4);return yield fetch(_0x3d943b,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2f63c3}});});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4f4f17,_0x5a3e3d,_0x3afe3f,_0x2bf4c4){function _0x268e0e(_0x49efe3){return _0x49efe3 instanceof _0x3afe3f?_0x49efe3:new _0x3afe3f(function(_0x3e1ff7){_0x3e1ff7(_0x49efe3);});}return new(_0x3afe3f||(_0x3afe3f=Promise))(function(_0x4f0430,_0x550417){function _0x51312b(_0x4d5dd2){try{_0xfbcc64(_0x2bf4c4['next'](_0x4d5dd2));}catch(_0x1355bb){_0x550417(_0x1355bb);}}function _0x570c7d(_0x4a0083){try{_0xfbcc64(_0x2bf4c4['throw'](_0x4a0083));}catch(_0x327c1d){_0x550417(_0x327c1d);}}function _0xfbcc64(_0x4ee5f4){_0x4ee5f4['done']?_0x4f0430(_0x4ee5f4['value']):_0x268e0e(_0x4ee5f4['value'])['then'](_0x51312b,_0x570c7d);}_0xfbcc64((_0x2bf4c4=_0x2bf4c4['apply'](_0x4f4f17,_0x5a3e3d||[]))['next']());});};class AdminClient{constructor(_0x377ad8='https://admin.searchability.dev/'){var _0x175705=new Fetch(_0x377ad8);this['Accounts']=new AccountService(_0x175705),this['Lists']=new ListService(_0x175705),this['ApiKeys']=new ApiKeyService(_0x175705);}}class AuthClient{constructor(_0x18e197='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x18e197);}['login'](_0x236d5b){return __awaiter(this,void 0,void 0,function*(){var _0x513980='login/'+_0x236d5b;try{const _0x2f7814=yield yield fetch(_0x513980);if(_0x2f7814['status']>0xc7&&_0x2f7814['status']<0x12c){const _0x4d9660=yield _0x2f7814['json']();return new SuccessfulAuthResponse(_0x4d9660);}const _0x4f4578=yield _0x2f7814['json']();return new FailedAuthResponse(_0x4f4578);}catch(_0x27f053){if(_0x27f053 instanceof Error)return new FailedAuthResponse({'detail':_0x27f053['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x27f053;}});}['refresh'](_0x34e89d){return __awaiter(this,void 0,void 0,function*(){var _0x5dd95d='refresh';try{const _0x2fd895=yield this['fetch']['post'](_0x5dd95d,_0x34e89d,null);if(_0x2fd895['status']>0xc7&&_0x2fd895['status']<0x12c){const _0x48c893=yield _0x2fd895['json']();return new SuccessfulAuthResponse(_0x48c893);}const _0x535376=yield _0x2fd895['json']();return new FailedAuthResponse(_0x535376);}catch(_0x5a6216){if(_0x5a6216 instanceof Error)return new FailedAuthResponse({'detail':_0x5a6216['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5a6216;}});}}
|
|
14
|
+
|
|
15
|
+
export { AdminClient, AuthClient };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
undefined&&undefined['__awaiter']||function(_0x315a9e,_0xe24ed2,_0xbacc9,_0x214989){function _0x59cb70(_0x3e5a52){return _0x3e5a52 instanceof _0xbacc9?_0x3e5a52:new _0xbacc9(function(_0x375fce){_0x375fce(_0x3e5a52);});}return new(_0xbacc9||(_0xbacc9=Promise))(function(_0x135fa0,_0x553a32){function _0x5db6ed(_0x30f8d9){try{_0x25b5aa(_0x214989['next'](_0x30f8d9));}catch(_0x52ab1f){_0x553a32(_0x52ab1f);}}function _0x18f595(_0x58c48f){try{_0x25b5aa(_0x214989['throw'](_0x58c48f));}catch(_0x297239){_0x553a32(_0x297239);}}function _0x25b5aa(_0x119b78){_0x119b78['done']?_0x135fa0(_0x119b78['value']):_0x59cb70(_0x119b78['value'])['then'](_0x5db6ed,_0x18f595);}_0x25b5aa((_0x214989=_0x214989['apply'](_0x315a9e,_0xe24ed2||[]))['next']());});};
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
class Response{constructor(_0x4755bf){this['isSuccess']=_0x4755bf;}}class SuccessfulAccountResponse extends Response{constructor(_0xa205db){super(!![]),this['account']=_0xa205db;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0xcac449){super(![]),this['problem']=_0xcac449;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x1b3d02){super(!![]),this['tokens']=_0x1b3d02;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x1e2db2){super(![]),this['problem']=_0x1e2db2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x5144f4){super(!![]),this['apiKeys']=_0x5144f4;}['toSuccess'](){return this['apiKeys'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x8dd2be){super(![]),this['problem']=_0x8dd2be;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x531c8f,_0x3695b7,_0x5b3c48,_0x3e3b93){function _0x38a47d(_0x34e610){return _0x34e610 instanceof _0x5b3c48?_0x34e610:new _0x5b3c48(function(_0x2306e2){_0x2306e2(_0x34e610);});}return new(_0x5b3c48||(_0x5b3c48=Promise))(function(_0x4950c1,_0x616cc8){function _0x25a27d(_0x3a22de){try{_0x227918(_0x3e3b93['next'](_0x3a22de));}catch(_0x20f1f7){_0x616cc8(_0x20f1f7);}}function _0x47b968(_0x2de341){try{_0x227918(_0x3e3b93['throw'](_0x2de341));}catch(_0x114eae){_0x616cc8(_0x114eae);}}function _0x227918(_0x187c42){_0x187c42['done']?_0x4950c1(_0x187c42['value']):_0x38a47d(_0x187c42['value'])['then'](_0x25a27d,_0x47b968);}_0x227918((_0x3e3b93=_0x3e3b93['apply'](_0x531c8f,_0x3695b7||[]))['next']());});};class AccountService{constructor(_0x280191){this['fetch']=_0x280191;}['get'](_0x5005ca,_0x264537){return __awaiter$4(this,void 0,void 0,function*(){const _0x1b4a8c='Account/'+_0x5005ca+'/',_0x15401f=yield this['fetch']['get'](_0x1b4a8c,_0x264537);try{if(_0x15401f['status']>0xc7&&_0x15401f['status']<0x12c){const _0x539838=yield _0x15401f['json']();return new SuccessfulAccountResponse(_0x539838);}const _0x27c998=yield _0x15401f['json']();return new FailedAccountResponse(_0x27c998);}catch(_0x331ea8){if(_0x331ea8 instanceof Error)return new FailedAccountResponse({'detail':_0x331ea8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x331ea8;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x6ff6e6,_0x2eca36,_0x4d7c3c,_0x4c0fff){function _0x12f909(_0x4e2667){return _0x4e2667 instanceof _0x4d7c3c?_0x4e2667:new _0x4d7c3c(function(_0x54af6a){_0x54af6a(_0x4e2667);});}return new(_0x4d7c3c||(_0x4d7c3c=Promise))(function(_0x44d986,_0x589ed3){function _0xd6088e(_0x1eb9c3){try{_0x47c73b(_0x4c0fff['next'](_0x1eb9c3));}catch(_0x2ac3e9){_0x589ed3(_0x2ac3e9);}}function _0x168b81(_0x416fad){try{_0x47c73b(_0x4c0fff['throw'](_0x416fad));}catch(_0x22ae52){_0x589ed3(_0x22ae52);}}function _0x47c73b(_0x572af1){_0x572af1['done']?_0x44d986(_0x572af1['value']):_0x12f909(_0x572af1['value'])['then'](_0xd6088e,_0x168b81);}_0x47c73b((_0x4c0fff=_0x4c0fff['apply'](_0x6ff6e6,_0x2eca36||[]))['next']());});};class ApiKeyService{constructor(_0xd55e7e){this['fetch']=_0xd55e7e;}['create'](_0x24f7d6,_0x5dcbeb,_0x426c89){return __awaiter$3(this,void 0,void 0,function*(){const _0x701fa4='ApiKey/Create',_0x317325={'account_name':_0x24f7d6,'name':_0x5dcbeb};try{const _0x30ac88=yield this['fetch']['post'](_0x701fa4,_0x426c89,_0x317325);if(_0x30ac88['status']>0xc7&&_0x30ac88['status']<0x12c){const _0x3cafa7=yield _0x30ac88['json']();return new SuccessfulApiKeyResponse(_0x3cafa7);}const _0x9f540b=yield _0x30ac88['json']();return new FailedApiKeyResponse(_0x9f540b);}catch(_0x13fbe5){if(_0x13fbe5 instanceof Error)return new FailedApiKeyResponse({'detail':_0x13fbe5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x13fbe5;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1e890b,_0x2c7cfd,_0x2dcac4,_0x290195){function _0x29f073(_0x4b66ef){return _0x4b66ef instanceof _0x2dcac4?_0x4b66ef:new _0x2dcac4(function(_0xe617db){_0xe617db(_0x4b66ef);});}return new(_0x2dcac4||(_0x2dcac4=Promise))(function(_0x154f8b,_0x2e1ccb){function _0x3d972a(_0x1e3e4a){try{_0x249bd6(_0x290195['next'](_0x1e3e4a));}catch(_0x5bbedd){_0x2e1ccb(_0x5bbedd);}}function _0x1c5c81(_0x15cbc1){try{_0x249bd6(_0x290195['throw'](_0x15cbc1));}catch(_0x32932f){_0x2e1ccb(_0x32932f);}}function _0x249bd6(_0x1ba01f){_0x1ba01f['done']?_0x154f8b(_0x1ba01f['value']):_0x29f073(_0x1ba01f['value'])['then'](_0x3d972a,_0x1c5c81);}_0x249bd6((_0x290195=_0x290195['apply'](_0x1e890b,_0x2c7cfd||[]))['next']());});};class ListService{constructor(_0x203d67){this['fetch']=_0x203d67;}['add'](_0x3fb2c9,_0x1c1de2,_0x3c3708){return __awaiter$2(this,void 0,void 0,function*(){const _0x198887='List',_0x2c3b62={'account_name':_0x3fb2c9,'list_name':_0x1c1de2};try{const _0x407c69=yield this['fetch']['post'](_0x198887,_0x3c3708,_0x2c3b62);if(_0x407c69['status']>0xc7&&_0x407c69['status']<0x12c){const _0x35f49d=yield _0x407c69['json']();return new SuccessfulAccountResponse(_0x35f49d);}const _0xd83fee=yield _0x407c69['json']();return new FailedAccountResponse(_0xd83fee);}catch(_0x9bd929){if(_0x9bd929 instanceof Error)return new FailedAccountResponse({'detail':_0x9bd929['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x9bd929;}});}['remove'](_0x3a3f47,_0x1b534c,_0x52e782){return __awaiter$2(this,void 0,void 0,function*(){const _0x5c7f44='List/'+_0x3a3f47+'/'+_0x1b534c,_0x3ad30b=yield this['fetch']['delete'](_0x5c7f44,_0x52e782);try{if(_0x3ad30b['status']>0xc7&&_0x3ad30b['status']<0x12c){const _0x1875db=yield _0x3ad30b['json']();return new SuccessfulAccountResponse(_0x1875db);}const _0xeb2dda=yield _0x3ad30b['json']();return new FailedAccountResponse(_0xeb2dda);}catch(_0x4b67f5){if(_0x4b67f5 instanceof Error)return new FailedAccountResponse({'detail':_0x4b67f5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4b67f5;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x28e58d,_0x1eaad1,_0x367e6e,_0xeb3f66){function _0x1c89f5(_0x42bb65){return _0x42bb65 instanceof _0x367e6e?_0x42bb65:new _0x367e6e(function(_0xf00699){_0xf00699(_0x42bb65);});}return new(_0x367e6e||(_0x367e6e=Promise))(function(_0x13dd29,_0x408c3e){function _0x58e38f(_0x126bb7){try{_0x2cabad(_0xeb3f66['next'](_0x126bb7));}catch(_0x5b4ada){_0x408c3e(_0x5b4ada);}}function _0x3ec983(_0x34a555){try{_0x2cabad(_0xeb3f66['throw'](_0x34a555));}catch(_0x12ccde){_0x408c3e(_0x12ccde);}}function _0x2cabad(_0x1ba10a){_0x1ba10a['done']?_0x13dd29(_0x1ba10a['value']):_0x1c89f5(_0x1ba10a['value'])['then'](_0x58e38f,_0x3ec983);}_0x2cabad((_0xeb3f66=_0xeb3f66['apply'](_0x28e58d,_0x1eaad1||[]))['next']());});};class Fetch{constructor(_0x44ef85){this['baseUri']=_0x44ef85,this['getUrl']=_0x29ed82=>{return _0x29ed82['startsWith']('/')&&(_0x29ed82=_0x29ed82['replace']('/','')),''+this['baseUri']+_0x29ed82;},!_0x44ef85['endsWith']('/')&&(_0x44ef85=_0x44ef85+'/');}['get'](_0x46745b,_0x2fea04){return __awaiter$1(this,void 0,void 0,function*(){const _0x453328=this['getUrl'](_0x46745b);return yield fetch(_0x453328,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2fea04}});});}['post'](_0x8b1dc9,_0x341676,_0x217a89){return __awaiter$1(this,void 0,void 0,function*(){const _0x49a70b=this['getUrl'](_0x8b1dc9);return yield fetch(_0x49a70b,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x341676},'body':_0x217a89?JSON['stringify'](_0x217a89):null});});}['put'](_0x5ecb04,_0x3b6229,_0x2ceaed){return __awaiter$1(this,void 0,void 0,function*(){const _0x34b741=this['getUrl'](_0x5ecb04);return yield fetch(_0x34b741,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3b6229},'body':_0x2ceaed?JSON['stringify'](_0x2ceaed):null});});}['delete'](_0x59b355,_0x2edcc6){return __awaiter$1(this,void 0,void 0,function*(){const _0x5f041f=this['getUrl'](_0x59b355);return yield fetch(_0x5f041f,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2edcc6}});});}}
|
|
14
|
+
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x56f4d9,_0x54688b,_0x1ba473,_0x15a163){function _0x52d117(_0x209870){return _0x209870 instanceof _0x1ba473?_0x209870:new _0x1ba473(function(_0x471b7c){_0x471b7c(_0x209870);});}return new(_0x1ba473||(_0x1ba473=Promise))(function(_0x429e14,_0x84fcef){function _0x2b0cc3(_0x30593b){try{_0xb793ea(_0x15a163['next'](_0x30593b));}catch(_0xdbee04){_0x84fcef(_0xdbee04);}}function _0x3127bc(_0xb19c86){try{_0xb793ea(_0x15a163['throw'](_0xb19c86));}catch(_0x369fb9){_0x84fcef(_0x369fb9);}}function _0xb793ea(_0xbe6b1f){_0xbe6b1f['done']?_0x429e14(_0xbe6b1f['value']):_0x52d117(_0xbe6b1f['value'])['then'](_0x2b0cc3,_0x3127bc);}_0xb793ea((_0x15a163=_0x15a163['apply'](_0x56f4d9,_0x54688b||[]))['next']());});};class AdminClient{constructor(_0x43503a='https://admin.searchability.dev/'){var _0x4916e5=new Fetch(_0x43503a);this['Accounts']=new AccountService(_0x4916e5),this['Lists']=new ListService(_0x4916e5),this['ApiKeys']=new ApiKeyService(_0x4916e5);}}class AuthClient{constructor(_0x1f84bd='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x1f84bd);}['login'](_0xe598d4){return __awaiter(this,void 0,void 0,function*(){var _0x5396d5='login/'+_0xe598d4;try{const _0x415759=yield yield fetch(_0x5396d5);if(_0x415759['status']>0xc7&&_0x415759['status']<0x12c){const _0x312088=yield _0x415759['json']();return new SuccessfulAuthResponse(_0x312088);}const _0x1f72ae=yield _0x415759['json']();return new FailedAuthResponse(_0x1f72ae);}catch(_0xe9beb1){if(_0xe9beb1 instanceof Error)return new FailedAuthResponse({'detail':_0xe9beb1['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xe9beb1;}});}['refresh'](_0xd7e5de){return __awaiter(this,void 0,void 0,function*(){var _0x16201a='refresh';try{const _0x39edc0=yield this['fetch']['post'](_0x16201a,_0xd7e5de,null);if(_0x39edc0['status']>0xc7&&_0x39edc0['status']<0x12c){const _0x257ea6=yield _0x39edc0['json']();return new SuccessfulAuthResponse(_0x257ea6);}const _0xf1dbd1=yield _0x39edc0['json']();return new FailedAuthResponse(_0xf1dbd1);}catch(_0x2caf9c){if(_0x2caf9c instanceof Error)return new FailedAuthResponse({'detail':_0x2caf9c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2caf9c;}});}}
|
|
14
16
|
|
|
15
17
|
exports.AdminClient = AdminClient;
|
|
16
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
undefined&&undefined['__awaiter']||function(_0x2d2f47,_0x449cb9,_0x5ba582,_0x268e38){function _0xa49de0(_0x532107){return _0x532107 instanceof _0x5ba582?_0x532107:new _0x5ba582(function(_0xa229fe){_0xa229fe(_0x532107);});}return new(_0x5ba582||(_0x5ba582=Promise))(function(_0x3cef02,_0x34701e){function _0x2ef134(_0x93baf7){try{_0x31f1fa(_0x268e38['next'](_0x93baf7));}catch(_0x3b38f7){_0x34701e(_0x3b38f7);}}function _0x4c6580(_0x163e0a){try{_0x31f1fa(_0x268e38['throw'](_0x163e0a));}catch(_0x3ca3f1){_0x34701e(_0x3ca3f1);}}function _0x31f1fa(_0x5da5bf){_0x5da5bf['done']?_0x3cef02(_0x5da5bf['value']):_0xa49de0(_0x5da5bf['value'])['then'](_0x2ef134,_0x4c6580);}_0x31f1fa((_0x268e38=_0x268e38['apply'](_0x2d2f47,_0x449cb9||[]))['next']());});};
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class Response{constructor(_0x1f1ed3){this['isSuccess']=_0x1f1ed3;}}class SuccessfulAccountResponse extends Response{constructor(_0x58b922){super(!![]),this['account']=_0x58b922;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x13dae7){super(![]),this['problem']=_0x13dae7;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4418e3){super(!![]),this['tokens']=_0x4418e3;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x1b0c30){super(![]),this['problem']=_0x1b0c30;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x363a15){super(!![]),this['apiKeys']=_0x363a15;}['toSuccess'](){return this['apiKeys'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x2b90bd){super(![]),this['problem']=_0x2b90bd;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0xba8c58,_0x329163,_0x38c56d,_0x30239f){function _0x3eb280(_0x27c0b7){return _0x27c0b7 instanceof _0x38c56d?_0x27c0b7:new _0x38c56d(function(_0x542748){_0x542748(_0x27c0b7);});}return new(_0x38c56d||(_0x38c56d=Promise))(function(_0x10b0b3,_0x214b11){function _0x104a75(_0x428082){try{_0x266beb(_0x30239f['next'](_0x428082));}catch(_0x3fe783){_0x214b11(_0x3fe783);}}function _0x55c979(_0x2f6179){try{_0x266beb(_0x30239f['throw'](_0x2f6179));}catch(_0x7f30d5){_0x214b11(_0x7f30d5);}}function _0x266beb(_0x160638){_0x160638['done']?_0x10b0b3(_0x160638['value']):_0x3eb280(_0x160638['value'])['then'](_0x104a75,_0x55c979);}_0x266beb((_0x30239f=_0x30239f['apply'](_0xba8c58,_0x329163||[]))['next']());});};class AccountService{constructor(_0x597b2d){this['fetch']=_0x597b2d;}['get'](_0x1cb780,_0x39a285){return __awaiter$4(this,void 0,void 0,function*(){const _0x1b00ab='Account/'+_0x1cb780+'/',_0x498558=yield this['fetch']['get'](_0x1b00ab,_0x39a285);try{if(_0x498558['status']>0xc7&&_0x498558['status']<0x12c){const _0x3416b6=yield _0x498558['json']();return new SuccessfulAccountResponse(_0x3416b6);}const _0x3ebacb=yield _0x498558['json']();return new FailedAccountResponse(_0x3ebacb);}catch(_0x150ee7){if(_0x150ee7 instanceof Error)return new FailedAccountResponse({'detail':_0x150ee7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x150ee7;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0xfac54,_0x634d0,_0x2e2de1,_0x28b250){function _0x48b538(_0x1f6b45){return _0x1f6b45 instanceof _0x2e2de1?_0x1f6b45:new _0x2e2de1(function(_0x2eca98){_0x2eca98(_0x1f6b45);});}return new(_0x2e2de1||(_0x2e2de1=Promise))(function(_0x2e6d7c,_0x37fc65){function _0x4f32b8(_0x18428a){try{_0x661e4b(_0x28b250['next'](_0x18428a));}catch(_0x40a3c4){_0x37fc65(_0x40a3c4);}}function _0x27fe89(_0x26c23c){try{_0x661e4b(_0x28b250['throw'](_0x26c23c));}catch(_0x5c4de1){_0x37fc65(_0x5c4de1);}}function _0x661e4b(_0x5c28b){_0x5c28b['done']?_0x2e6d7c(_0x5c28b['value']):_0x48b538(_0x5c28b['value'])['then'](_0x4f32b8,_0x27fe89);}_0x661e4b((_0x28b250=_0x28b250['apply'](_0xfac54,_0x634d0||[]))['next']());});};class ApiKeyService{constructor(_0x3d8460){this['fetch']=_0x3d8460;}['create'](_0x63dcad,_0x2d4668,_0x5d4955){return __awaiter$3(this,void 0,void 0,function*(){const _0x1fd46c='ApiKey/Create',_0x50d860={'account_name':_0x63dcad,'name':_0x2d4668};try{const _0x259b9b=yield this['fetch']['post'](_0x1fd46c,_0x5d4955,_0x50d860);if(_0x259b9b['status']>0xc7&&_0x259b9b['status']<0x12c){const _0xbf2e62=yield _0x259b9b['json']();return new SuccessfulApiKeyResponse(_0xbf2e62);}const _0xf50cd3=yield _0x259b9b['json']();return new FailedApiKeyResponse(_0xf50cd3);}catch(_0x3a4cc2){if(_0x3a4cc2 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3a4cc2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3a4cc2;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x4961c6,_0x512808,_0x430d07,_0x3f0266){function _0x40a25b(_0x539ecd){return _0x539ecd instanceof _0x430d07?_0x539ecd:new _0x430d07(function(_0x1bcbf4){_0x1bcbf4(_0x539ecd);});}return new(_0x430d07||(_0x430d07=Promise))(function(_0x3d60b7,_0x386fb6){function _0x533d9f(_0x506a95){try{_0x444110(_0x3f0266['next'](_0x506a95));}catch(_0x30681c){_0x386fb6(_0x30681c);}}function _0xd5bbf5(_0x1c3742){try{_0x444110(_0x3f0266['throw'](_0x1c3742));}catch(_0x305391){_0x386fb6(_0x305391);}}function _0x444110(_0xc67b80){_0xc67b80['done']?_0x3d60b7(_0xc67b80['value']):_0x40a25b(_0xc67b80['value'])['then'](_0x533d9f,_0xd5bbf5);}_0x444110((_0x3f0266=_0x3f0266['apply'](_0x4961c6,_0x512808||[]))['next']());});};class ListService{constructor(_0xf18b3){this['fetch']=_0xf18b3;}['add'](_0x2d0644,_0x5c2352,_0x344227){return __awaiter$2(this,void 0,void 0,function*(){const _0x360615='List',_0x371af6={'account_name':_0x2d0644,'list_name':_0x5c2352};try{const _0x172219=yield this['fetch']['post'](_0x360615,_0x344227,_0x371af6);if(_0x172219['status']>0xc7&&_0x172219['status']<0x12c){const _0x19ede9=yield _0x172219['json']();return new SuccessfulAccountResponse(_0x19ede9);}const _0x1770f4=yield _0x172219['json']();return new FailedAccountResponse(_0x1770f4);}catch(_0x42ccc0){if(_0x42ccc0 instanceof Error)return new FailedAccountResponse({'detail':_0x42ccc0['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x42ccc0;}});}['remove'](_0x70e96b,_0x43a1e2,_0x3921e9){return __awaiter$2(this,void 0,void 0,function*(){const _0x224425='List/'+_0x70e96b+'/'+_0x43a1e2,_0x4f6881=yield this['fetch']['delete'](_0x224425,_0x3921e9);try{if(_0x4f6881['status']>0xc7&&_0x4f6881['status']<0x12c){const _0x2998ba=yield _0x4f6881['json']();return new SuccessfulAccountResponse(_0x2998ba);}const _0x2994e8=yield _0x4f6881['json']();return new FailedAccountResponse(_0x2994e8);}catch(_0xccfecf){if(_0xccfecf instanceof Error)return new FailedAccountResponse({'detail':_0xccfecf['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xccfecf;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4a6fe5,_0x2d182d,_0x224e69,_0x5a339e){function _0x46abf7(_0x27498f){return _0x27498f instanceof _0x224e69?_0x27498f:new _0x224e69(function(_0x468ca7){_0x468ca7(_0x27498f);});}return new(_0x224e69||(_0x224e69=Promise))(function(_0x620a16,_0xffe0df){function _0x49703b(_0x3c743e){try{_0x4fd57f(_0x5a339e['next'](_0x3c743e));}catch(_0x1faf5e){_0xffe0df(_0x1faf5e);}}function _0x25bc5a(_0x358d1c){try{_0x4fd57f(_0x5a339e['throw'](_0x358d1c));}catch(_0x16dbc1){_0xffe0df(_0x16dbc1);}}function _0x4fd57f(_0x3b5496){_0x3b5496['done']?_0x620a16(_0x3b5496['value']):_0x46abf7(_0x3b5496['value'])['then'](_0x49703b,_0x25bc5a);}_0x4fd57f((_0x5a339e=_0x5a339e['apply'](_0x4a6fe5,_0x2d182d||[]))['next']());});};class Fetch{constructor(_0x146403){this['baseUri']=_0x146403,this['getUrl']=_0x3d8df4=>{return _0x3d8df4['startsWith']('/')&&(_0x3d8df4=_0x3d8df4['replace']('/','')),''+this['baseUri']+_0x3d8df4;},!_0x146403['endsWith']('/')&&(_0x146403=_0x146403+'/');}['get'](_0x38a34f,_0x4e0087){return __awaiter$1(this,void 0,void 0,function*(){const _0x9f1a9a=this['getUrl'](_0x38a34f);return yield fetch(_0x9f1a9a,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4e0087}});});}['post'](_0x357ee1,_0x397d15,_0x2782cc){return __awaiter$1(this,void 0,void 0,function*(){const _0x7dbd29=this['getUrl'](_0x357ee1);return yield fetch(_0x7dbd29,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x397d15},'body':_0x2782cc?JSON['stringify'](_0x2782cc):null});});}['put'](_0x4eadbb,_0x517773,_0x48272){return __awaiter$1(this,void 0,void 0,function*(){const _0x4ca6df=this['getUrl'](_0x4eadbb);return yield fetch(_0x4ca6df,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x517773},'body':_0x48272?JSON['stringify'](_0x48272):null});});}['delete'](_0x3db2e6,_0x35523a){return __awaiter$1(this,void 0,void 0,function*(){const _0x28e4a6=this['getUrl'](_0x3db2e6);return yield fetch(_0x28e4a6,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x35523a}});});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x99c8e,_0x25af06,_0x2ad405,_0x3243ab){function _0x441787(_0x23b52c){return _0x23b52c instanceof _0x2ad405?_0x23b52c:new _0x2ad405(function(_0x58ad76){_0x58ad76(_0x23b52c);});}return new(_0x2ad405||(_0x2ad405=Promise))(function(_0x34de23,_0x98d354){function _0x3246dc(_0x2e5a46){try{_0x58f4d0(_0x3243ab['next'](_0x2e5a46));}catch(_0x2405e8){_0x98d354(_0x2405e8);}}function _0x3997f3(_0x585014){try{_0x58f4d0(_0x3243ab['throw'](_0x585014));}catch(_0x1e448d){_0x98d354(_0x1e448d);}}function _0x58f4d0(_0x3017b9){_0x3017b9['done']?_0x34de23(_0x3017b9['value']):_0x441787(_0x3017b9['value'])['then'](_0x3246dc,_0x3997f3);}_0x58f4d0((_0x3243ab=_0x3243ab['apply'](_0x99c8e,_0x25af06||[]))['next']());});};class AdminClient{constructor(_0x183679='https://admin.searchability.dev/'){var _0x3dc087=new Fetch(_0x183679);this['Accounts']=new AccountService(_0x3dc087),this['Lists']=new ListService(_0x3dc087),this['ApiKeys']=new ApiKeyService(_0x3dc087);}}class AuthClient{constructor(_0x4ab1e2='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x4ab1e2);}['login'](_0x452586){return __awaiter(this,void 0,void 0,function*(){var _0x5472a8='login/'+_0x452586;try{const _0x21bb8e=yield yield fetch(_0x5472a8);if(_0x21bb8e['status']>0xc7&&_0x21bb8e['status']<0x12c){const _0x516066=yield _0x21bb8e['json']();return new SuccessfulAuthResponse(_0x516066);}const _0x353965=yield _0x21bb8e['json']();return new FailedAuthResponse(_0x353965);}catch(_0x14ddd7){if(_0x14ddd7 instanceof Error)return new FailedAuthResponse({'detail':_0x14ddd7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x14ddd7;}});}['refresh'](_0x4eb4b0){return __awaiter(this,void 0,void 0,function*(){var _0x15eb2a='refresh';try{const _0x912d4b=yield this['fetch']['post'](_0x15eb2a,_0x4eb4b0,null);if(_0x912d4b['status']>0xc7&&_0x912d4b['status']<0x12c){const _0x2af908=yield _0x912d4b['json']();return new SuccessfulAuthResponse(_0x2af908);}const _0x485c44=yield _0x912d4b['json']();return new FailedAuthResponse(_0x485c44);}catch(_0x2bcff2){if(_0x2bcff2 instanceof Error)return new FailedAuthResponse({'detail':_0x2bcff2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2bcff2;}});}}
|
|
12
14
|
|
|
13
15
|
export { AdminClient, AuthClient };
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ declare class AuthClient {
|
|
|
40
40
|
refresh(refreshToken: string): Promise<Response<Tokens, Problem>>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
declare class TokenManager {
|
|
44
|
+
readonly authClient: AuthClient;
|
|
45
|
+
constructor(authClient: AuthClient);
|
|
46
|
+
getOrRefreshTokens(tokens: Tokens): Promise<Response<Tokens, Problem>>;
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
declare abstract class Response<S, F> {
|
|
44
50
|
readonly isSuccess: boolean;
|
|
45
51
|
constructor(isSuccess: boolean);
|
|
@@ -122,4 +128,4 @@ declare class FailedApiKeyResponse extends Response<ApiKey[], Problem> {
|
|
|
122
128
|
toProblem(): Problem;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
|
-
export { type Account, AdminClient, type ApiKey, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedAuthResponse, type List, type ListIdentity, type Problem, Response, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulAuthResponse, type Tokens };
|
|
131
|
+
export { type Account, AdminClient, type ApiKey, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedAuthResponse, type List, type ListIdentity, type Problem, Response, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulAuthResponse, TokenManager, type Tokens };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class Response{constructor(_0x326403){this['isSuccess']=_0x326403;}}class SuccessfulAccountResponse extends Response{constructor(_0x277157){super(!![]),this['account']=_0x277157;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x1e98c1){super(![]),this['problem']=_0x1e98c1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x3078dc){super(!![]),this['tokens']=_0x3078dc;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x60e52e){super(![]),this['problem']=_0x60e52e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x804eb8){super(!![]),this['apiKeys']=_0x804eb8;}['toSuccess'](){return this['apiKeys'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0xf940eb){super(![]),this['problem']=_0xf940eb;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5c789b,_0x521441,_0x2c2fd7,_0x2d358c){function _0x593ce5(_0x37f7a3){return _0x37f7a3 instanceof _0x2c2fd7?_0x37f7a3:new _0x2c2fd7(function(_0x1b12a7){_0x1b12a7(_0x37f7a3);});}return new(_0x2c2fd7||(_0x2c2fd7=Promise))(function(_0x974d2c,_0x20d7d9){function _0x5ea89c(_0x811416){try{_0x3782a0(_0x2d358c['next'](_0x811416));}catch(_0x20030a){_0x20d7d9(_0x20030a);}}function _0x5055e0(_0x1ab45c){try{_0x3782a0(_0x2d358c['throw'](_0x1ab45c));}catch(_0x32d0a8){_0x20d7d9(_0x32d0a8);}}function _0x3782a0(_0x1d5bc6){_0x1d5bc6['done']?_0x974d2c(_0x1d5bc6['value']):_0x593ce5(_0x1d5bc6['value'])['then'](_0x5ea89c,_0x5055e0);}_0x3782a0((_0x2d358c=_0x2d358c['apply'](_0x5c789b,_0x521441||[]))['next']());});};class AccountService{constructor(_0x4a48fb){this['fetch']=_0x4a48fb;}['get'](_0xa49391,_0x5abead){return __awaiter$4(this,void 0,void 0,function*(){const _0xe272c='Account/'+_0xa49391+'/',_0xd612f2=yield this['fetch']['get'](_0xe272c,_0x5abead);try{if(_0xd612f2['status']>0xc7&&_0xd612f2['status']<0x12c){const _0x4539f3=yield _0xd612f2['json']();return new SuccessfulAccountResponse(_0x4539f3);}const _0x5e22a4=yield _0xd612f2['json']();return new FailedAccountResponse(_0x5e22a4);}catch(_0x2c56f7){if(_0x2c56f7 instanceof Error)return new FailedAccountResponse({'detail':_0x2c56f7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2c56f7;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x794f6f,_0x522478,_0x19540d,_0xfaeb7d){function _0x36fad5(_0xe63321){return _0xe63321 instanceof _0x19540d?_0xe63321:new _0x19540d(function(_0x4a35ac){_0x4a35ac(_0xe63321);});}return new(_0x19540d||(_0x19540d=Promise))(function(_0x143013,_0x4f8423){function _0x148a36(_0x3222a5){try{_0x43d53e(_0xfaeb7d['next'](_0x3222a5));}catch(_0x14ad51){_0x4f8423(_0x14ad51);}}function _0x585314(_0x1fc029){try{_0x43d53e(_0xfaeb7d['throw'](_0x1fc029));}catch(_0x3b1e23){_0x4f8423(_0x3b1e23);}}function _0x43d53e(_0x353e28){_0x353e28['done']?_0x143013(_0x353e28['value']):_0x36fad5(_0x353e28['value'])['then'](_0x148a36,_0x585314);}_0x43d53e((_0xfaeb7d=_0xfaeb7d['apply'](_0x794f6f,_0x522478||[]))['next']());});};class ApiKeyService{constructor(_0xd24cf8){this['fetch']=_0xd24cf8;}['create'](_0x3f3ff6,_0x2df8f4,_0x5c1b49){return __awaiter$3(this,void 0,void 0,function*(){const _0x4953b2='ApiKey/Create',_0xc8a302={'account_name':_0x3f3ff6,'name':_0x2df8f4};try{const _0x31a6d9=yield this['fetch']['post'](_0x4953b2,_0x5c1b49,_0xc8a302);if(_0x31a6d9['status']>0xc7&&_0x31a6d9['status']<0x12c){const _0x14396d=yield _0x31a6d9['json']();return new SuccessfulApiKeyResponse(_0x14396d);}const _0x10348a=yield _0x31a6d9['json']();return new FailedApiKeyResponse(_0x10348a);}catch(_0x30a314){if(_0x30a314 instanceof Error)return new FailedApiKeyResponse({'detail':_0x30a314['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x30a314;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x58186c,_0x397b42,_0x53b5cf,_0x5c448b){function _0xa932e4(_0x477a6a){return _0x477a6a instanceof _0x53b5cf?_0x477a6a:new _0x53b5cf(function(_0x2a667b){_0x2a667b(_0x477a6a);});}return new(_0x53b5cf||(_0x53b5cf=Promise))(function(_0x4e1813,_0x53ffde){function _0x2907fe(_0x40888f){try{_0x165a82(_0x5c448b['next'](_0x40888f));}catch(_0x33e8ad){_0x53ffde(_0x33e8ad);}}function _0x1a4d3b(_0x27ed3f){try{_0x165a82(_0x5c448b['throw'](_0x27ed3f));}catch(_0x125013){_0x53ffde(_0x125013);}}function _0x165a82(_0x488824){_0x488824['done']?_0x4e1813(_0x488824['value']):_0xa932e4(_0x488824['value'])['then'](_0x2907fe,_0x1a4d3b);}_0x165a82((_0x5c448b=_0x5c448b['apply'](_0x58186c,_0x397b42||[]))['next']());});};class ListService{constructor(_0x1f0474){this['fetch']=_0x1f0474;}['add'](_0x23daab,_0x294f43,_0x57c16b){return __awaiter$2(this,void 0,void 0,function*(){const _0x25a8df='List',_0x28b411={'account_name':_0x23daab,'list_name':_0x294f43};try{const _0x51cef7=yield this['fetch']['post'](_0x25a8df,_0x57c16b,_0x28b411);if(_0x51cef7['status']>0xc7&&_0x51cef7['status']<0x12c){const _0x34bf9c=yield _0x51cef7['json']();return new SuccessfulAccountResponse(_0x34bf9c);}const _0x5a653b=yield _0x51cef7['json']();return new FailedAccountResponse(_0x5a653b);}catch(_0x544d59){if(_0x544d59 instanceof Error)return new FailedAccountResponse({'detail':_0x544d59['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x544d59;}});}['remove'](_0x558357,_0x2ecbf3,_0x449f0){return __awaiter$2(this,void 0,void 0,function*(){const _0x19d49d='List/'+_0x558357+'/'+_0x2ecbf3,_0x2efdb6=yield this['fetch']['delete'](_0x19d49d,_0x449f0);try{if(_0x2efdb6['status']>0xc7&&_0x2efdb6['status']<0x12c){const _0x218688=yield _0x2efdb6['json']();return new SuccessfulAccountResponse(_0x218688);}const _0x3282c4=yield _0x2efdb6['json']();return new FailedAccountResponse(_0x3282c4);}catch(_0xa6d9c9){if(_0xa6d9c9 instanceof Error)return new FailedAccountResponse({'detail':_0xa6d9c9['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xa6d9c9;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x12911d,_0x5a3f41,_0x2e70e1,_0x3dcf51){function _0x4d6563(_0x3a92f8){return _0x3a92f8 instanceof _0x2e70e1?_0x3a92f8:new _0x2e70e1(function(_0xce7692){_0xce7692(_0x3a92f8);});}return new(_0x2e70e1||(_0x2e70e1=Promise))(function(_0x209e1e,_0x3da527){function _0x168d23(_0x30f111){try{_0x23f8b4(_0x3dcf51['next'](_0x30f111));}catch(_0x4dfb12){_0x3da527(_0x4dfb12);}}function _0x393e7d(_0x163de4){try{_0x23f8b4(_0x3dcf51['throw'](_0x163de4));}catch(_0x188ff0){_0x3da527(_0x188ff0);}}function _0x23f8b4(_0x1da686){_0x1da686['done']?_0x209e1e(_0x1da686['value']):_0x4d6563(_0x1da686['value'])['then'](_0x168d23,_0x393e7d);}_0x23f8b4((_0x3dcf51=_0x3dcf51['apply'](_0x12911d,_0x5a3f41||[]))['next']());});};class Fetch{constructor(_0x46cb0a){this['baseUri']=_0x46cb0a,this['getUrl']=_0x4642d5=>{return _0x4642d5['startsWith']('/')&&(_0x4642d5=_0x4642d5['replace']('/','')),''+this['baseUri']+_0x4642d5;},!_0x46cb0a['endsWith']('/')&&(_0x46cb0a=_0x46cb0a+'/');}['get'](_0x5541a0,_0x9f20b2){return __awaiter$1(this,void 0,void 0,function*(){const _0x3b390d=this['getUrl'](_0x5541a0);return yield fetch(_0x3b390d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x9f20b2}});});}['post'](_0x32f9f1,_0x52a28f,_0x2587ad){return __awaiter$1(this,void 0,void 0,function*(){const _0x30de5f=this['getUrl'](_0x32f9f1);return yield fetch(_0x30de5f,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x52a28f},'body':_0x2587ad?JSON['stringify'](_0x2587ad):null});});}['put'](_0x36a4af,_0x3ebb56,_0x89369d){return __awaiter$1(this,void 0,void 0,function*(){const _0x5d4ca8=this['getUrl'](_0x36a4af);return yield fetch(_0x5d4ca8,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3ebb56},'body':_0x89369d?JSON['stringify'](_0x89369d):null});});}['delete'](_0x2edb54,_0x3e7ba8){return __awaiter$1(this,void 0,void 0,function*(){const _0x267e6d=this['getUrl'](_0x2edb54);return yield fetch(_0x267e6d,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3e7ba8}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x196219,_0x57bab7,_0x15ed3a,_0x405096){function _0x1f26d1(_0xd0d1c9){return _0xd0d1c9 instanceof _0x15ed3a?_0xd0d1c9:new _0x15ed3a(function(_0x3bcb9c){_0x3bcb9c(_0xd0d1c9);});}return new(_0x15ed3a||(_0x15ed3a=Promise))(function(_0x257057,_0x3fc8e9){function _0x258053(_0xa52e7a){try{_0x44cd66(_0x405096['next'](_0xa52e7a));}catch(_0x25cd18){_0x3fc8e9(_0x25cd18);}}function _0x3eb7ab(_0x5e704b){try{_0x44cd66(_0x405096['throw'](_0x5e704b));}catch(_0x791059){_0x3fc8e9(_0x791059);}}function _0x44cd66(_0xae8198){_0xae8198['done']?_0x257057(_0xae8198['value']):_0x1f26d1(_0xae8198['value'])['then'](_0x258053,_0x3eb7ab);}_0x44cd66((_0x405096=_0x405096['apply'](_0x196219,_0x57bab7||[]))['next']());});};class AdminClient{constructor(_0xd22cb3='https://admin.searchability.dev/'){var _0x45fa2e=new Fetch(_0xd22cb3);this['Accounts']=new AccountService(_0x45fa2e),this['Lists']=new ListService(_0x45fa2e),this['ApiKeys']=new ApiKeyService(_0x45fa2e);}}class AuthClient{constructor(_0x55285b='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x55285b);}['login'](_0x38c508){return __awaiter(this,void 0,void 0,function*(){var _0x4e46ca='login/'+_0x38c508;try{const _0x57033c=yield yield fetch(_0x4e46ca);if(_0x57033c['status']>0xc7&&_0x57033c['status']<0x12c){const _0x307970=yield _0x57033c['json']();return new SuccessfulAuthResponse(_0x307970);}const _0xb16326=yield _0x57033c['json']();return new FailedAuthResponse(_0xb16326);}catch(_0x59e2f4){if(_0x59e2f4 instanceof Error)return new FailedAuthResponse({'detail':_0x59e2f4['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x59e2f4;}});}['refresh'](_0x37bbf7){return __awaiter(this,void 0,void 0,function*(){var _0x2c9db0='refresh';try{const _0x5308f3=yield this['fetch']['post'](_0x2c9db0,_0x37bbf7,null);if(_0x5308f3['status']>0xc7&&_0x5308f3['status']<0x12c){const _0x300a36=yield _0x5308f3['json']();return new SuccessfulAuthResponse(_0x300a36);}const _0x3003ef=yield _0x5308f3['json']();return new FailedAuthResponse(_0x3003ef);}catch(_0x446c2f){if(_0x446c2f instanceof Error)return new FailedAuthResponse({'detail':_0x446c2f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x446c2f;}});}}
|
|
12
|
-
|
|
13
|
-
export { AdminClient, AuthClient };
|