@searchability/admin-client 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x22b0dc,_0x15a21f,_0x3815e9,_0x5162bb){function _0x122c0f(_0x3016a0){return _0x3016a0 instanceof _0x3815e9?_0x3016a0:new _0x3815e9(function(_0x36a031){_0x36a031(_0x3016a0);});}return new(_0x3815e9||(_0x3815e9=Promise))(function(_0xdc914b,_0x27f9f1){function _0x4de182(_0x466639){try{_0x2d44da(_0x5162bb['next'](_0x466639));}catch(_0x513151){_0x27f9f1(_0x513151);}}function _0x5359b2(_0x3d06d5){try{_0x2d44da(_0x5162bb['throw'](_0x3d06d5));}catch(_0x5c777b){_0x27f9f1(_0x5c777b);}}function _0x2d44da(_0x229fd4){_0x229fd4['done']?_0xdc914b(_0x229fd4['value']):_0x122c0f(_0x229fd4['value'])['then'](_0x4de182,_0x5359b2);}_0x2d44da((_0x5162bb=_0x5162bb['apply'](_0x22b0dc,_0x15a21f||[]))['next']());});};class Fetch{static['get'](_0x47a65d,_0x153fb0){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x47a65d,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x153fb0}});});}static['post'](_0x1e5e17,_0x2c85b9,_0x281891){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x1e5e17,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2c85b9},'body':_0x281891?JSON['stringify'](_0x281891):null});});}static['put'](_0x474ca6,_0x35a23c,_0x6d0dcc){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x474ca6,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x35a23c},'body':_0x6d0dcc?JSON['stringify'](_0x6d0dcc):null});});}static['delete'](_0x3b1d88,_0x861282){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x3b1d88,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x861282}});});}}
2
+
3
+ var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x20ff07,_0xb6283b,_0x1879ef,_0x3e6d96){function _0x1121ef(_0x4049f8){return _0x4049f8 instanceof _0x1879ef?_0x4049f8:new _0x1879ef(function(_0x3d294d){_0x3d294d(_0x4049f8);});}return new(_0x1879ef||(_0x1879ef=Promise))(function(_0x23b194,_0x17d1f8){function _0x25da45(_0x231329){try{_0x381188(_0x3e6d96['next'](_0x231329));}catch(_0x33a66b){_0x17d1f8(_0x33a66b);}}function _0x4fa7b6(_0xe33269){try{_0x381188(_0x3e6d96['throw'](_0xe33269));}catch(_0x1bfdca){_0x17d1f8(_0x1bfdca);}}function _0x381188(_0x2808fc){_0x2808fc['done']?_0x23b194(_0x2808fc['value']):_0x1121ef(_0x2808fc['value'])['then'](_0x25da45,_0x4fa7b6);}_0x381188((_0x3e6d96=_0x3e6d96['apply'](_0x20ff07,_0xb6283b||[]))['next']());});};class ListService{constructor(_0x42ae8c){this['baseUri']=_0x42ae8c;}['add'](_0x3b5268,_0x32ee5f,_0x46ce86){return __awaiter$3(this,arguments,void 0,function*(_0x19e76e,_0x588bc2,_0x5fc274,_0x402aa7={}){var _0x12ce8a;let _0x3c9a30=(_0x12ce8a=_0x402aa7['baseUri'])!==null&&_0x12ce8a!==void 0?_0x12ce8a:this['baseUri'];!_0x3c9a30['endsWith']('/')&&(_0x3c9a30=_0x3c9a30+'/');_0x3c9a30=_0x3c9a30+'List';const _0x2814a1={'account_name':_0x588bc2,'list_name':_0x5fc274},_0x48e17e=yield Fetch['post'](_0x3c9a30,_0x19e76e,_0x2814a1);if(_0x48e17e['status']>0xc7&&_0x48e17e['status']<0x12c){const _0x4b6bf6=yield _0x48e17e['json']();return new SuccessfulAccountResponse(_0x4b6bf6);}if(_0x48e17e['bodyUsed']){const _0x182f98=yield _0x48e17e['json']();return new FailedAccountResponse(_0x182f98);}const _0x2eab11={'type':'','status':_0x48e17e['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x2eab11);});}['remove'](_0x315206,_0x50f029,_0x55c0cb){return __awaiter$3(this,arguments,void 0,function*(_0x4091b1,_0x40d4ba,_0x233e3e,_0xf22e10={}){var _0x223b9a;let _0x299f26=(_0x223b9a=_0xf22e10['baseUri'])!==null&&_0x223b9a!==void 0?_0x223b9a:this['baseUri'];_0x299f26=_0x299f26+'/List/'+_0x40d4ba+'/'+_0x233e3e;const _0x10b202=yield Fetch['delete'](_0x299f26,_0x4091b1);if(_0x10b202['status']>0xc7&&_0x10b202['status']<0x12c){const _0x6d39eb=yield _0x10b202['json']();return new SuccessfulAccountResponse(_0x6d39eb);}if(_0x10b202['bodyUsed']){const _0x51b6d8=yield _0x10b202['json']();return new FailedAccountResponse(_0x51b6d8);}const _0x29f228={'type':'','status':_0x10b202['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x29f228);});}}
4
+
5
+ class Response{constructor(_0x133e47){this['isSuccess']=_0x133e47;}}class SuccessfulAccountResponse extends Response{constructor(_0x27d2e8){super(!![]),this['account']=_0x27d2e8;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x32f2f9){super(![]),this['problem']=_0x32f2f9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x2460f1){super(!![]),this['tokens']=_0x2460f1;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x2f2be6){super(![]),this['problem']=_0x2f2be6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
6
+
7
+ var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x3355da,_0x436357,_0x2e9e98,_0x218c90){function _0x416807(_0x4b96f0){return _0x4b96f0 instanceof _0x2e9e98?_0x4b96f0:new _0x2e9e98(function(_0x1c9abd){_0x1c9abd(_0x4b96f0);});}return new(_0x2e9e98||(_0x2e9e98=Promise))(function(_0x35ee5c,_0x462aeb){function _0x3dc267(_0x4ea50e){try{_0xa1de2e(_0x218c90['next'](_0x4ea50e));}catch(_0x380b3b){_0x462aeb(_0x380b3b);}}function _0x39f5b7(_0x52f629){try{_0xa1de2e(_0x218c90['throw'](_0x52f629));}catch(_0x1543b6){_0x462aeb(_0x1543b6);}}function _0xa1de2e(_0x4c0ea8){_0x4c0ea8['done']?_0x35ee5c(_0x4c0ea8['value']):_0x416807(_0x4c0ea8['value'])['then'](_0x3dc267,_0x39f5b7);}_0xa1de2e((_0x218c90=_0x218c90['apply'](_0x3355da,_0x436357||[]))['next']());});};class AccountService{constructor(_0x4c03d4){this['baseUri']=_0x4c03d4;}['get'](_0x2cd554,_0x32bb9){return __awaiter$2(this,arguments,void 0,function*(_0x528add,_0x279872,_0x294b81={}){var _0x8eca0b;let _0x121c1b=(_0x8eca0b=_0x294b81['baseUri'])!==null&&_0x8eca0b!==void 0?_0x8eca0b:this['baseUri'];!_0x121c1b['endsWith']('/')&&(_0x121c1b=_0x121c1b+'/');_0x121c1b=_0x121c1b+'Account/'+_0x279872+'/';const _0x14e6a8=yield Fetch['get'](_0x121c1b,_0x528add);if(_0x14e6a8['status']>0xc7&&_0x14e6a8['status']<0x12c){const _0xb09ca4=yield _0x14e6a8['json']();return new SuccessfulAccountResponse(_0xb09ca4);}if(_0x14e6a8['bodyUsed']){const _0x87284b=yield _0x14e6a8['json']();return new FailedAccountResponse(_0x87284b);}const _0x9e48c9={'type':'','status':_0x14e6a8['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x9e48c9);});}}
8
+
9
+ var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x53ab04,_0xe5ec75,_0x21937b,_0x226926){function _0x258cd2(_0x633c02){return _0x633c02 instanceof _0x21937b?_0x633c02:new _0x21937b(function(_0x50eb27){_0x50eb27(_0x633c02);});}return new(_0x21937b||(_0x21937b=Promise))(function(_0x129920,_0x2810c6){function _0x8a8e60(_0x4de5f9){try{_0x422057(_0x226926['next'](_0x4de5f9));}catch(_0x1fdef7){_0x2810c6(_0x1fdef7);}}function _0xba6b32(_0x56028c){try{_0x422057(_0x226926['throw'](_0x56028c));}catch(_0x48e0aa){_0x2810c6(_0x48e0aa);}}function _0x422057(_0x567dfc){_0x567dfc['done']?_0x129920(_0x567dfc['value']):_0x258cd2(_0x567dfc['value'])['then'](_0x8a8e60,_0xba6b32);}_0x422057((_0x226926=_0x226926['apply'](_0x53ab04,_0xe5ec75||[]))['next']());});};class TokenManager{constructor(_0x404272){this['securityService']=_0x404272;}['RefreshTokens'](_0x5591de){return __awaiter$1(this,void 0,void 0,function*(){if(Date['now']()<_0x5591de['access_expires'])return new SuccessfulRefreshResponse(_0x5591de);if(Date['now']()>_0x5591de['refresh_expires']){const _0x26e588={'type':'','status':0x193,'title':'Forbidden','instance':'','errors':{}};return new FailedRefreshResponse(_0x26e588);}const _0x283b50=yield this['securityService']['refresh'](_0x5591de['refresh_token']);if(!_0x283b50['isSuccess'])return new FailedRefreshResponse(_0x283b50['toProblem']());return new SuccessfulRefreshResponse(_0x283b50['toSuccess']());});}}
10
+
11
+ var __awaiter=undefined&&undefined['__awaiter']||function(_0x552c69,_0x51f5bb,_0x280868,_0xc280f6){function _0x76c13d(_0x3389e8){return _0x3389e8 instanceof _0x280868?_0x3389e8:new _0x280868(function(_0x3bd60b){_0x3bd60b(_0x3389e8);});}return new(_0x280868||(_0x280868=Promise))(function(_0xe93b9d,_0x3626f7){function _0x17ffbf(_0x866605){try{_0x2191e5(_0xc280f6['next'](_0x866605));}catch(_0x37b84c){_0x3626f7(_0x37b84c);}}function _0x293675(_0x284036){try{_0x2191e5(_0xc280f6['throw'](_0x284036));}catch(_0x47bdb9){_0x3626f7(_0x47bdb9);}}function _0x2191e5(_0x22c695){_0x22c695['done']?_0xe93b9d(_0x22c695['value']):_0x76c13d(_0x22c695['value'])['then'](_0x17ffbf,_0x293675);}_0x2191e5((_0xc280f6=_0xc280f6['apply'](_0x552c69,_0x51f5bb||[]))['next']());});};class SecurityService{constructor(_0x15df19){this['baseUri']=_0x15df19,this['tokenManager']=new TokenManager(this);}['refresh'](_0x50cf56){return __awaiter(this,arguments,void 0,function*(_0x366ad3,_0x1fcd71={}){var _0x210760;let _0x3ddef4=(_0x210760=_0x1fcd71['baseUri'])!==null&&_0x210760!==void 0?_0x210760:this['baseUri'];!_0x3ddef4['endsWith']('/')&&(_0x3ddef4=_0x3ddef4+'/');_0x3ddef4=_0x3ddef4+'Security/Refresh';const _0x5b11de=yield Fetch['post'](_0x3ddef4,_0x366ad3,null);if(_0x5b11de['status']>0xc7&&_0x5b11de['status']<0x12c){const _0x4203de=yield _0x5b11de['json']();return new SuccessfulRefreshResponse(_0x4203de);}if(_0x5b11de['bodyUsed']){const _0x4e3a8c=yield _0x5b11de['json']();return new FailedRefreshResponse(_0x4e3a8c);}const _0x384aa8={'type':'','status':_0x5b11de['status'],'title':'','instance':'','errors':{}};return new FailedRefreshResponse(_0x384aa8);});}}
12
+
13
+ var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev/',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']),AdminClient['Security']=new SecurityService(_a['baseUri']);
14
+
15
+ export { AdminClient };
@@ -1,13 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x42e2e9,_0x403889,_0x130588,_0x578018){function _0x4076d1(_0x501c1f){return _0x501c1f instanceof _0x130588?_0x501c1f:new _0x130588(function(_0x520ecb){_0x520ecb(_0x501c1f);});}return new(_0x130588||(_0x130588=Promise))(function(_0x1c8390,_0x34946f){function _0x343286(_0x3201d4){try{_0x4c4465(_0x578018['next'](_0x3201d4));}catch(_0x38bb3a){_0x34946f(_0x38bb3a);}}function _0x440db1(_0xb3e0b8){try{_0x4c4465(_0x578018['throw'](_0xb3e0b8));}catch(_0x1f4a1c){_0x34946f(_0x1f4a1c);}}function _0x4c4465(_0x2ffbfd){_0x2ffbfd['done']?_0x1c8390(_0x2ffbfd['value']):_0x4076d1(_0x2ffbfd['value'])['then'](_0x343286,_0x440db1);}_0x4c4465((_0x578018=_0x578018['apply'](_0x42e2e9,_0x403889||[]))['next']());});};class Fetch{static['get'](_0xa35740,_0x1a41e0){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0xa35740,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1a41e0}});});}static['post'](_0x24b26d,_0x250dee,_0x4a4fea){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x24b26d,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x250dee},'body':JSON['stringify'](_0x4a4fea)});});}static['put'](_0x49c3b4,_0x2f34ea,_0x2407b8){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x49c3b4,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2f34ea},'body':JSON['stringify'](_0x2407b8)});});}static['delete'](_0x1e7637,_0x3c51cf){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x1e7637,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3c51cf}});});}}
3
+ var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x26b976,_0x577e97,_0x35d480,_0x5af5cd){function _0x5d30ee(_0x1a4d8c){return _0x1a4d8c instanceof _0x35d480?_0x1a4d8c:new _0x35d480(function(_0x263ebb){_0x263ebb(_0x1a4d8c);});}return new(_0x35d480||(_0x35d480=Promise))(function(_0x19162b,_0x1cba5f){function _0x5c231b(_0x3d9ac8){try{_0x33cfd6(_0x5af5cd['next'](_0x3d9ac8));}catch(_0x431267){_0x1cba5f(_0x431267);}}function _0x168fa4(_0x16ee42){try{_0x33cfd6(_0x5af5cd['throw'](_0x16ee42));}catch(_0x3a13d5){_0x1cba5f(_0x3a13d5);}}function _0x33cfd6(_0x2c237d){_0x2c237d['done']?_0x19162b(_0x2c237d['value']):_0x5d30ee(_0x2c237d['value'])['then'](_0x5c231b,_0x168fa4);}_0x33cfd6((_0x5af5cd=_0x5af5cd['apply'](_0x26b976,_0x577e97||[]))['next']());});};class Fetch{static['get'](_0x3d8e75,_0x659a29){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x3d8e75,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x659a29}});});}static['post'](_0x3b4764,_0x3a7c9f,_0x2aa780){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x3b4764,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3a7c9f},'body':_0x2aa780?JSON['stringify'](_0x2aa780):null});});}static['put'](_0x2087d5,_0x245dd2,_0x5f0a3c){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x2087d5,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x245dd2},'body':_0x5f0a3c?JSON['stringify'](_0x5f0a3c):null});});}static['delete'](_0x2a4803,_0x5015c9){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x2a4803,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5015c9}});});}}
4
4
 
5
- var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2e51f5,_0x42dabe,_0x32d0eb,_0x226f52){function _0x1826d2(_0x27a638){return _0x27a638 instanceof _0x32d0eb?_0x27a638:new _0x32d0eb(function(_0x356174){_0x356174(_0x27a638);});}return new(_0x32d0eb||(_0x32d0eb=Promise))(function(_0x85b794,_0x2f77dd){function _0x2f362b(_0x186765){try{_0x2f3778(_0x226f52['next'](_0x186765));}catch(_0x5fdee7){_0x2f77dd(_0x5fdee7);}}function _0x1631de(_0x3064b2){try{_0x2f3778(_0x226f52['throw'](_0x3064b2));}catch(_0x5d5f3b){_0x2f77dd(_0x5d5f3b);}}function _0x2f3778(_0x303e25){_0x303e25['done']?_0x85b794(_0x303e25['value']):_0x1826d2(_0x303e25['value'])['then'](_0x2f362b,_0x1631de);}_0x2f3778((_0x226f52=_0x226f52['apply'](_0x2e51f5,_0x42dabe||[]))['next']());});};class ListService{constructor(_0x184d8b){this['baseUri']=_0x184d8b;}['add'](_0x3ee7c0,_0x17477c,_0x25f9b2){return __awaiter$1(this,arguments,void 0,function*(_0x20aa95,_0x2b49b0,_0x33e4da,_0x4728e8={}){var _0x3fa35a;let _0x37ed56=(_0x3fa35a=_0x4728e8['baseUri'])!==null&&_0x3fa35a!==void 0?_0x3fa35a:this['baseUri'];_0x37ed56=_0x37ed56+'/List';const _0x19f3ae={'account_name':_0x2b49b0,'list_name':_0x33e4da},_0x449fa1=yield Fetch['post'](_0x37ed56,_0x20aa95,_0x19f3ae);if(_0x449fa1['status']>0xc7&&_0x449fa1['status']<0x12c){const _0xa498de=yield _0x449fa1['json']();return new SuccessfulAccountResponse(_0xa498de);}if(_0x449fa1['bodyUsed']){const _0x1ea9e8=yield _0x449fa1['json']();return new FailedAccountResponse(_0x1ea9e8);}const _0x1a7272={'type':'','status':_0x449fa1['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x1a7272);});}['remove'](_0x3d037b,_0x2aa1f5,_0x595d66){return __awaiter$1(this,arguments,void 0,function*(_0x521ee6,_0x209e3b,_0x2fc9ae,_0x4aa2f5={}){var _0x16247b;let _0x3289db=(_0x16247b=_0x4aa2f5['baseUri'])!==null&&_0x16247b!==void 0?_0x16247b:this['baseUri'];_0x3289db=_0x3289db+'/List/'+_0x209e3b+'/'+_0x2fc9ae;const _0x1357f7=yield Fetch['delete'](_0x3289db,_0x521ee6);if(_0x1357f7['status']>0xc7&&_0x1357f7['status']<0x12c){const _0x33bc74=yield _0x1357f7['json']();return new SuccessfulAccountResponse(_0x33bc74);}if(_0x1357f7['bodyUsed']){const _0x31ff77=yield _0x1357f7['json']();return new FailedAccountResponse(_0x31ff77);}const _0x3cf923={'type':'','status':_0x1357f7['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x3cf923);});}}
5
+ var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5eaedc,_0x56235f,_0x265705,_0x4c3a90){function _0x2c131d(_0x3a91dc){return _0x3a91dc instanceof _0x265705?_0x3a91dc:new _0x265705(function(_0x1f6310){_0x1f6310(_0x3a91dc);});}return new(_0x265705||(_0x265705=Promise))(function(_0x446579,_0x167736){function _0x5ec3d7(_0x31bbb3){try{_0x32e177(_0x4c3a90['next'](_0x31bbb3));}catch(_0xf7d576){_0x167736(_0xf7d576);}}function _0x37e5f9(_0x17544c){try{_0x32e177(_0x4c3a90['throw'](_0x17544c));}catch(_0x51bc2b){_0x167736(_0x51bc2b);}}function _0x32e177(_0x1a0096){_0x1a0096['done']?_0x446579(_0x1a0096['value']):_0x2c131d(_0x1a0096['value'])['then'](_0x5ec3d7,_0x37e5f9);}_0x32e177((_0x4c3a90=_0x4c3a90['apply'](_0x5eaedc,_0x56235f||[]))['next']());});};class ListService{constructor(_0x4d5fdb){this['baseUri']=_0x4d5fdb;}['add'](_0x26063d,_0xccb08a,_0x232908){return __awaiter$3(this,arguments,void 0,function*(_0x2073fb,_0x56180a,_0x518613,_0xc01af4={}){var _0x1cbba6;let _0x4ba248=(_0x1cbba6=_0xc01af4['baseUri'])!==null&&_0x1cbba6!==void 0?_0x1cbba6:this['baseUri'];!_0x4ba248['endsWith']('/')&&(_0x4ba248=_0x4ba248+'/');_0x4ba248=_0x4ba248+'List';const _0x1db539={'account_name':_0x56180a,'list_name':_0x518613},_0x1ea6e9=yield Fetch['post'](_0x4ba248,_0x2073fb,_0x1db539);if(_0x1ea6e9['status']>0xc7&&_0x1ea6e9['status']<0x12c){const _0x40e074=yield _0x1ea6e9['json']();return new SuccessfulAccountResponse(_0x40e074);}if(_0x1ea6e9['bodyUsed']){const _0x4978e1=yield _0x1ea6e9['json']();return new FailedAccountResponse(_0x4978e1);}const _0x5d17be={'type':'','status':_0x1ea6e9['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x5d17be);});}['remove'](_0x17d7a9,_0x150710,_0x36c60e){return __awaiter$3(this,arguments,void 0,function*(_0x212e05,_0x18c537,_0x5b682c,_0x556be9={}){var _0x5e349a;let _0x5a433c=(_0x5e349a=_0x556be9['baseUri'])!==null&&_0x5e349a!==void 0?_0x5e349a:this['baseUri'];_0x5a433c=_0x5a433c+'/List/'+_0x18c537+'/'+_0x5b682c;const _0x3e6770=yield Fetch['delete'](_0x5a433c,_0x212e05);if(_0x3e6770['status']>0xc7&&_0x3e6770['status']<0x12c){const _0x5022f9=yield _0x3e6770['json']();return new SuccessfulAccountResponse(_0x5022f9);}if(_0x3e6770['bodyUsed']){const _0x2b44f7=yield _0x3e6770['json']();return new FailedAccountResponse(_0x2b44f7);}const _0x107bef={'type':'','status':_0x3e6770['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x107bef);});}}
6
6
 
7
- class Response{constructor(_0x596722){this['isSuccess']=_0x596722;}}class SuccessfulAccountResponse extends Response{constructor(_0x5a140e){super(!![]),this['account']=_0x5a140e;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x55e289){super(![]),this['problem']=_0x55e289;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
7
+ class Response{constructor(_0x1432e5){this['isSuccess']=_0x1432e5;}}class SuccessfulAccountResponse extends Response{constructor(_0x449d65){super(!![]),this['account']=_0x449d65;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x2b5065){super(![]),this['problem']=_0x2b5065;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x3286c2){super(!![]),this['tokens']=_0x3286c2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x341ae3){super(![]),this['problem']=_0x341ae3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
8
8
 
9
- var __awaiter=undefined&&undefined['__awaiter']||function(_0x4aaa3a,_0x4dfee5,_0x55e236,_0x517770){function _0x53b140(_0x5aac72){return _0x5aac72 instanceof _0x55e236?_0x5aac72:new _0x55e236(function(_0x3e095c){_0x3e095c(_0x5aac72);});}return new(_0x55e236||(_0x55e236=Promise))(function(_0x424713,_0x25540c){function _0x3cb464(_0x26fc30){try{_0x3f39b9(_0x517770['next'](_0x26fc30));}catch(_0xb83374){_0x25540c(_0xb83374);}}function _0x1b67e7(_0xbe867f){try{_0x3f39b9(_0x517770['throw'](_0xbe867f));}catch(_0x1468b8){_0x25540c(_0x1468b8);}}function _0x3f39b9(_0x9fe10f){_0x9fe10f['done']?_0x424713(_0x9fe10f['value']):_0x53b140(_0x9fe10f['value'])['then'](_0x3cb464,_0x1b67e7);}_0x3f39b9((_0x517770=_0x517770['apply'](_0x4aaa3a,_0x4dfee5||[]))['next']());});};class AccountService{constructor(_0x1965ea){this['baseUri']=_0x1965ea;}['get'](_0x44db63,_0x43b467){return __awaiter(this,arguments,void 0,function*(_0x16950f,_0x3a28f2,_0x6b2b38={}){var _0x46dffe;let _0x33c862=(_0x46dffe=_0x6b2b38['baseUri'])!==null&&_0x46dffe!==void 0?_0x46dffe:this['baseUri'];_0x33c862=_0x33c862+'/Account/'+_0x3a28f2+'/';const _0x52ec1d=yield Fetch['get'](_0x33c862,_0x16950f);if(_0x52ec1d['status']>0xc7&&_0x52ec1d['status']<0x12c){const _0x4a107c=yield _0x52ec1d['json']();return new SuccessfulAccountResponse(_0x4a107c);}if(_0x52ec1d['bodyUsed']){const _0x4f95b8=yield _0x52ec1d['json']();return new FailedAccountResponse(_0x4f95b8);}const _0xede3be={'type':'','status':_0x52ec1d['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0xede3be);});}}
9
+ var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1c0d47,_0x4b366c,_0x33ca5,_0x8f3279){function _0x5396a9(_0x3c7be7){return _0x3c7be7 instanceof _0x33ca5?_0x3c7be7:new _0x33ca5(function(_0x3782e0){_0x3782e0(_0x3c7be7);});}return new(_0x33ca5||(_0x33ca5=Promise))(function(_0x24ed25,_0x489e7e){function _0x214b93(_0x14db67){try{_0x47bb4f(_0x8f3279['next'](_0x14db67));}catch(_0x4e8447){_0x489e7e(_0x4e8447);}}function _0x3c0936(_0x313a40){try{_0x47bb4f(_0x8f3279['throw'](_0x313a40));}catch(_0x4accdd){_0x489e7e(_0x4accdd);}}function _0x47bb4f(_0x2e1bf8){_0x2e1bf8['done']?_0x24ed25(_0x2e1bf8['value']):_0x5396a9(_0x2e1bf8['value'])['then'](_0x214b93,_0x3c0936);}_0x47bb4f((_0x8f3279=_0x8f3279['apply'](_0x1c0d47,_0x4b366c||[]))['next']());});};class AccountService{constructor(_0x1295e6){this['baseUri']=_0x1295e6;}['get'](_0x1369b1,_0x58fb1c){return __awaiter$2(this,arguments,void 0,function*(_0x21ee7d,_0x1d6219,_0x186115={}){var _0x5ea899;let _0xc9fc59=(_0x5ea899=_0x186115['baseUri'])!==null&&_0x5ea899!==void 0?_0x5ea899:this['baseUri'];!_0xc9fc59['endsWith']('/')&&(_0xc9fc59=_0xc9fc59+'/');_0xc9fc59=_0xc9fc59+'Account/'+_0x1d6219+'/';const _0x2cc8ac=yield Fetch['get'](_0xc9fc59,_0x21ee7d);if(_0x2cc8ac['status']>0xc7&&_0x2cc8ac['status']<0x12c){const _0x11e72c=yield _0x2cc8ac['json']();return new SuccessfulAccountResponse(_0x11e72c);}if(_0x2cc8ac['bodyUsed']){const _0x31aa40=yield _0x2cc8ac['json']();return new FailedAccountResponse(_0x31aa40);}const _0x1e0800={'type':'','status':_0x2cc8ac['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x1e0800);});}}
10
10
 
11
- var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']);
11
+ var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xbe58b2,_0x49d0fe,_0x5e20d2,_0x261379){function _0x562931(_0x39889e){return _0x39889e instanceof _0x5e20d2?_0x39889e:new _0x5e20d2(function(_0x2892aa){_0x2892aa(_0x39889e);});}return new(_0x5e20d2||(_0x5e20d2=Promise))(function(_0x4d2471,_0x85ae8a){function _0x4edb75(_0x5a543b){try{_0x3db309(_0x261379['next'](_0x5a543b));}catch(_0x5e297b){_0x85ae8a(_0x5e297b);}}function _0x39f81f(_0x237de){try{_0x3db309(_0x261379['throw'](_0x237de));}catch(_0x3450a5){_0x85ae8a(_0x3450a5);}}function _0x3db309(_0x253c4d){_0x253c4d['done']?_0x4d2471(_0x253c4d['value']):_0x562931(_0x253c4d['value'])['then'](_0x4edb75,_0x39f81f);}_0x3db309((_0x261379=_0x261379['apply'](_0xbe58b2,_0x49d0fe||[]))['next']());});};class TokenManager{constructor(_0x210695){this['securityService']=_0x210695;}['RefreshTokens'](_0x41f744){return __awaiter$1(this,void 0,void 0,function*(){if(Date['now']()<_0x41f744['access_expires'])return new SuccessfulRefreshResponse(_0x41f744);if(Date['now']()>_0x41f744['refresh_expires']){const _0x336cf8={'type':'','status':0x193,'title':'Forbidden','instance':'','errors':{}};return new FailedRefreshResponse(_0x336cf8);}const _0x39eab1=yield this['securityService']['refresh'](_0x41f744['refresh_token']);if(!_0x39eab1['isSuccess'])return new FailedRefreshResponse(_0x39eab1['toProblem']());return new SuccessfulRefreshResponse(_0x39eab1['toSuccess']());});}}
12
+
13
+ var __awaiter=undefined&&undefined['__awaiter']||function(_0x3ad69e,_0x5cace8,_0x430397,_0x48dab6){function _0x5ab103(_0x3ff3ec){return _0x3ff3ec instanceof _0x430397?_0x3ff3ec:new _0x430397(function(_0x296d1c){_0x296d1c(_0x3ff3ec);});}return new(_0x430397||(_0x430397=Promise))(function(_0x4db515,_0x5b8b5a){function _0x13ba04(_0x4bb6c5){try{_0x18c6ec(_0x48dab6['next'](_0x4bb6c5));}catch(_0x5b732b){_0x5b8b5a(_0x5b732b);}}function _0x11d155(_0x3a6fc1){try{_0x18c6ec(_0x48dab6['throw'](_0x3a6fc1));}catch(_0x452599){_0x5b8b5a(_0x452599);}}function _0x18c6ec(_0x800cda){_0x800cda['done']?_0x4db515(_0x800cda['value']):_0x5ab103(_0x800cda['value'])['then'](_0x13ba04,_0x11d155);}_0x18c6ec((_0x48dab6=_0x48dab6['apply'](_0x3ad69e,_0x5cace8||[]))['next']());});};class SecurityService{constructor(_0x497d82){this['baseUri']=_0x497d82,this['tokenManager']=new TokenManager(this);}['refresh'](_0x473d40){return __awaiter(this,arguments,void 0,function*(_0x4a7b46,_0x4c6ca8={}){var _0x40cebb;let _0x50b01=(_0x40cebb=_0x4c6ca8['baseUri'])!==null&&_0x40cebb!==void 0?_0x40cebb:this['baseUri'];!_0x50b01['endsWith']('/')&&(_0x50b01=_0x50b01+'/');_0x50b01=_0x50b01+'Security/Refresh';const _0x3bd25a=yield Fetch['post'](_0x50b01,_0x4a7b46,null);if(_0x3bd25a['status']>0xc7&&_0x3bd25a['status']<0x12c){const _0x46c97c=yield _0x3bd25a['json']();return new SuccessfulRefreshResponse(_0x46c97c);}if(_0x3bd25a['bodyUsed']){const _0x45bf05=yield _0x3bd25a['json']();return new FailedRefreshResponse(_0x45bf05);}const _0x4eff38={'type':'','status':_0x3bd25a['status'],'title':'','instance':'','errors':{}};return new FailedRefreshResponse(_0x4eff38);});}}
14
+
15
+ var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev/',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']),AdminClient['Security']=new SecurityService(_a['baseUri']);
12
16
 
13
17
  exports.AdminClient = AdminClient;
@@ -1,11 +1,15 @@
1
- var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1468d7,_0x3012f1,_0x1d063a,_0x7ec5c0){function _0x330f18(_0x268a78){return _0x268a78 instanceof _0x1d063a?_0x268a78:new _0x1d063a(function(_0x418d46){_0x418d46(_0x268a78);});}return new(_0x1d063a||(_0x1d063a=Promise))(function(_0x340c8f,_0xd558ef){function _0x382a51(_0x55b9c9){try{_0x36e8c5(_0x7ec5c0['next'](_0x55b9c9));}catch(_0x145ab2){_0xd558ef(_0x145ab2);}}function _0x3bb0c1(_0x1c196c){try{_0x36e8c5(_0x7ec5c0['throw'](_0x1c196c));}catch(_0x594538){_0xd558ef(_0x594538);}}function _0x36e8c5(_0x3e634a){_0x3e634a['done']?_0x340c8f(_0x3e634a['value']):_0x330f18(_0x3e634a['value'])['then'](_0x382a51,_0x3bb0c1);}_0x36e8c5((_0x7ec5c0=_0x7ec5c0['apply'](_0x1468d7,_0x3012f1||[]))['next']());});};class Fetch{static['get'](_0x4f5e41,_0x4faf65){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x4f5e41,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4faf65}});});}static['post'](_0x45a3d6,_0x5d663c,_0x52d1ba){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x45a3d6,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5d663c},'body':JSON['stringify'](_0x52d1ba)});});}static['put'](_0x57d5d1,_0xa64f41,_0x32460a){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x57d5d1,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xa64f41},'body':JSON['stringify'](_0x32460a)});});}static['delete'](_0x3f9b29,_0x3cd2b3){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x3f9b29,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3cd2b3}});});}}
1
+ var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x57eabd,_0x36ba67,_0x41ee23,_0x2acf31){function _0x22bd23(_0xbbe5ca){return _0xbbe5ca instanceof _0x41ee23?_0xbbe5ca:new _0x41ee23(function(_0x2a690e){_0x2a690e(_0xbbe5ca);});}return new(_0x41ee23||(_0x41ee23=Promise))(function(_0x16c429,_0x574c9b){function _0x5b91f8(_0x54ee9f){try{_0x199569(_0x2acf31['next'](_0x54ee9f));}catch(_0x439de0){_0x574c9b(_0x439de0);}}function _0x275cd1(_0x3e88b8){try{_0x199569(_0x2acf31['throw'](_0x3e88b8));}catch(_0x86aab6){_0x574c9b(_0x86aab6);}}function _0x199569(_0x1682e4){_0x1682e4['done']?_0x16c429(_0x1682e4['value']):_0x22bd23(_0x1682e4['value'])['then'](_0x5b91f8,_0x275cd1);}_0x199569((_0x2acf31=_0x2acf31['apply'](_0x57eabd,_0x36ba67||[]))['next']());});};class Fetch{static['get'](_0x18a213,_0xe9c6e5){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x18a213,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xe9c6e5}});});}static['post'](_0x129b94,_0x4a2ae7,_0x46f6d2){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x129b94,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4a2ae7},'body':_0x46f6d2?JSON['stringify'](_0x46f6d2):null});});}static['put'](_0x143fe9,_0x32fa31,_0x3c0102){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x143fe9,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x32fa31},'body':_0x3c0102?JSON['stringify'](_0x3c0102):null});});}static['delete'](_0x4475a4,_0x4e478c){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x4475a4,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4e478c}});});}}
2
2
 
3
- var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x36ceb9,_0x322bb6,_0x175a0e,_0xf8a365){function _0x5c368a(_0x1d1c84){return _0x1d1c84 instanceof _0x175a0e?_0x1d1c84:new _0x175a0e(function(_0x285495){_0x285495(_0x1d1c84);});}return new(_0x175a0e||(_0x175a0e=Promise))(function(_0x31ba46,_0x187fdf){function _0x1e840a(_0x313f32){try{_0x3d93d2(_0xf8a365['next'](_0x313f32));}catch(_0x2d279f){_0x187fdf(_0x2d279f);}}function _0x14c9b9(_0x4f4a07){try{_0x3d93d2(_0xf8a365['throw'](_0x4f4a07));}catch(_0x5ab919){_0x187fdf(_0x5ab919);}}function _0x3d93d2(_0x48cd9e){_0x48cd9e['done']?_0x31ba46(_0x48cd9e['value']):_0x5c368a(_0x48cd9e['value'])['then'](_0x1e840a,_0x14c9b9);}_0x3d93d2((_0xf8a365=_0xf8a365['apply'](_0x36ceb9,_0x322bb6||[]))['next']());});};class ListService{constructor(_0x5e59d0){this['baseUri']=_0x5e59d0;}['add'](_0x44a38d,_0x299c37,_0x169ce1){return __awaiter$1(this,arguments,void 0,function*(_0xb6bbe2,_0x1f7b0c,_0x3239f9,_0x116024={}){var _0x27a94a;let _0x397ecb=(_0x27a94a=_0x116024['baseUri'])!==null&&_0x27a94a!==void 0?_0x27a94a:this['baseUri'];_0x397ecb=_0x397ecb+'/List';const _0x29ec1e={'account_name':_0x1f7b0c,'list_name':_0x3239f9},_0x343a01=yield Fetch['post'](_0x397ecb,_0xb6bbe2,_0x29ec1e);if(_0x343a01['status']>0xc7&&_0x343a01['status']<0x12c){const _0xf62a4d=yield _0x343a01['json']();return new SuccessfulAccountResponse(_0xf62a4d);}if(_0x343a01['bodyUsed']){const _0x58f4c5=yield _0x343a01['json']();return new FailedAccountResponse(_0x58f4c5);}const _0x309844={'type':'','status':_0x343a01['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x309844);});}['remove'](_0x3a6106,_0x4d76b5,_0x426496){return __awaiter$1(this,arguments,void 0,function*(_0x35f5f8,_0x26097c,_0x150a90,_0x4482bc={}){var _0x5515d0;let _0xe6f210=(_0x5515d0=_0x4482bc['baseUri'])!==null&&_0x5515d0!==void 0?_0x5515d0:this['baseUri'];_0xe6f210=_0xe6f210+'/List/'+_0x26097c+'/'+_0x150a90;const _0x5e4758=yield Fetch['delete'](_0xe6f210,_0x35f5f8);if(_0x5e4758['status']>0xc7&&_0x5e4758['status']<0x12c){const _0x3a3ff3=yield _0x5e4758['json']();return new SuccessfulAccountResponse(_0x3a3ff3);}if(_0x5e4758['bodyUsed']){const _0x30daf5=yield _0x5e4758['json']();return new FailedAccountResponse(_0x30daf5);}const _0x55c879={'type':'','status':_0x5e4758['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x55c879);});}}
3
+ var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x15527d,_0x177f53,_0x4e6cac,_0x392356){function _0x209797(_0x3a9be3){return _0x3a9be3 instanceof _0x4e6cac?_0x3a9be3:new _0x4e6cac(function(_0x1c78f6){_0x1c78f6(_0x3a9be3);});}return new(_0x4e6cac||(_0x4e6cac=Promise))(function(_0x505f6d,_0x1df980){function _0x4e1c7d(_0x476f23){try{_0x197398(_0x392356['next'](_0x476f23));}catch(_0x71d635){_0x1df980(_0x71d635);}}function _0x4d3a9c(_0x5182f5){try{_0x197398(_0x392356['throw'](_0x5182f5));}catch(_0x314167){_0x1df980(_0x314167);}}function _0x197398(_0x5b3c69){_0x5b3c69['done']?_0x505f6d(_0x5b3c69['value']):_0x209797(_0x5b3c69['value'])['then'](_0x4e1c7d,_0x4d3a9c);}_0x197398((_0x392356=_0x392356['apply'](_0x15527d,_0x177f53||[]))['next']());});};class ListService{constructor(_0xd123f8){this['baseUri']=_0xd123f8;}['add'](_0xe66136,_0xc0a37c,_0xd96249){return __awaiter$3(this,arguments,void 0,function*(_0x582bd6,_0x4fd25b,_0x1fdfb3,_0x24942e={}){var _0x271119;let _0x29cb51=(_0x271119=_0x24942e['baseUri'])!==null&&_0x271119!==void 0?_0x271119:this['baseUri'];!_0x29cb51['endsWith']('/')&&(_0x29cb51=_0x29cb51+'/');_0x29cb51=_0x29cb51+'List';const _0x7e52c9={'account_name':_0x4fd25b,'list_name':_0x1fdfb3},_0x633fde=yield Fetch['post'](_0x29cb51,_0x582bd6,_0x7e52c9);if(_0x633fde['status']>0xc7&&_0x633fde['status']<0x12c){const _0x63cb57=yield _0x633fde['json']();return new SuccessfulAccountResponse(_0x63cb57);}if(_0x633fde['bodyUsed']){const _0x4d85a8=yield _0x633fde['json']();return new FailedAccountResponse(_0x4d85a8);}const _0x5b1334={'type':'','status':_0x633fde['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x5b1334);});}['remove'](_0x19ab56,_0x4b1345,_0x4718ea){return __awaiter$3(this,arguments,void 0,function*(_0x5661f7,_0x595086,_0x157c1f,_0x4b1e33={}){var _0x1abad1;let _0x2fb13a=(_0x1abad1=_0x4b1e33['baseUri'])!==null&&_0x1abad1!==void 0?_0x1abad1:this['baseUri'];_0x2fb13a=_0x2fb13a+'/List/'+_0x595086+'/'+_0x157c1f;const _0x3fecb5=yield Fetch['delete'](_0x2fb13a,_0x5661f7);if(_0x3fecb5['status']>0xc7&&_0x3fecb5['status']<0x12c){const _0x278fb0=yield _0x3fecb5['json']();return new SuccessfulAccountResponse(_0x278fb0);}if(_0x3fecb5['bodyUsed']){const _0x1cc9a3=yield _0x3fecb5['json']();return new FailedAccountResponse(_0x1cc9a3);}const _0x5b6ccf={'type':'','status':_0x3fecb5['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x5b6ccf);});}}
4
4
 
5
- class Response{constructor(_0x275c8d){this['isSuccess']=_0x275c8d;}}class SuccessfulAccountResponse extends Response{constructor(_0x4cda14){super(!![]),this['account']=_0x4cda14;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4097e8){super(![]),this['problem']=_0x4097e8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
5
+ class Response{constructor(_0x5db6a5){this['isSuccess']=_0x5db6a5;}}class SuccessfulAccountResponse extends Response{constructor(_0x1f7188){super(!![]),this['account']=_0x1f7188;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x83fd19){super(![]),this['problem']=_0x83fd19;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x231240){super(!![]),this['tokens']=_0x231240;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x47eb45){super(![]),this['problem']=_0x47eb45;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
6
6
 
7
- var __awaiter=undefined&&undefined['__awaiter']||function(_0x43fd33,_0x5bc612,_0x29f078,_0x481bad){function _0x30b509(_0x490344){return _0x490344 instanceof _0x29f078?_0x490344:new _0x29f078(function(_0x3e715f){_0x3e715f(_0x490344);});}return new(_0x29f078||(_0x29f078=Promise))(function(_0x491f78,_0x168c25){function _0x34afd6(_0x53f635){try{_0x3b5dee(_0x481bad['next'](_0x53f635));}catch(_0x5b9e50){_0x168c25(_0x5b9e50);}}function _0x48107f(_0x104206){try{_0x3b5dee(_0x481bad['throw'](_0x104206));}catch(_0x3e473f){_0x168c25(_0x3e473f);}}function _0x3b5dee(_0x3fdae8){_0x3fdae8['done']?_0x491f78(_0x3fdae8['value']):_0x30b509(_0x3fdae8['value'])['then'](_0x34afd6,_0x48107f);}_0x3b5dee((_0x481bad=_0x481bad['apply'](_0x43fd33,_0x5bc612||[]))['next']());});};class AccountService{constructor(_0x417268){this['baseUri']=_0x417268;}['get'](_0x11d5c2,_0x2780a5){return __awaiter(this,arguments,void 0,function*(_0x53e631,_0x14fe51,_0x2394ec={}){var _0x109135;let _0x204710=(_0x109135=_0x2394ec['baseUri'])!==null&&_0x109135!==void 0?_0x109135:this['baseUri'];_0x204710=_0x204710+'/Account/'+_0x14fe51+'/';const _0x41bad9=yield Fetch['get'](_0x204710,_0x53e631);if(_0x41bad9['status']>0xc7&&_0x41bad9['status']<0x12c){const _0x14a80b=yield _0x41bad9['json']();return new SuccessfulAccountResponse(_0x14a80b);}if(_0x41bad9['bodyUsed']){const _0x45b834=yield _0x41bad9['json']();return new FailedAccountResponse(_0x45b834);}const _0x1c22aa={'type':'','status':_0x41bad9['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x1c22aa);});}}
7
+ var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x28694f,_0x1a9e79,_0x317e6c,_0x161a07){function _0x2a3013(_0x128c13){return _0x128c13 instanceof _0x317e6c?_0x128c13:new _0x317e6c(function(_0x751e4c){_0x751e4c(_0x128c13);});}return new(_0x317e6c||(_0x317e6c=Promise))(function(_0x3c1218,_0x4a75f6){function _0x3511ab(_0x324773){try{_0x4cc1f0(_0x161a07['next'](_0x324773));}catch(_0x56542e){_0x4a75f6(_0x56542e);}}function _0x94cd92(_0x339f9c){try{_0x4cc1f0(_0x161a07['throw'](_0x339f9c));}catch(_0x4b8091){_0x4a75f6(_0x4b8091);}}function _0x4cc1f0(_0xf77f88){_0xf77f88['done']?_0x3c1218(_0xf77f88['value']):_0x2a3013(_0xf77f88['value'])['then'](_0x3511ab,_0x94cd92);}_0x4cc1f0((_0x161a07=_0x161a07['apply'](_0x28694f,_0x1a9e79||[]))['next']());});};class AccountService{constructor(_0x563378){this['baseUri']=_0x563378;}['get'](_0x5d6633,_0x3e9c5d){return __awaiter$2(this,arguments,void 0,function*(_0x13b384,_0x4ac820,_0x51d7f2={}){var _0x56b61a;let _0x3aa3bd=(_0x56b61a=_0x51d7f2['baseUri'])!==null&&_0x56b61a!==void 0?_0x56b61a:this['baseUri'];!_0x3aa3bd['endsWith']('/')&&(_0x3aa3bd=_0x3aa3bd+'/');_0x3aa3bd=_0x3aa3bd+'Account/'+_0x4ac820+'/';const _0xdb77e9=yield Fetch['get'](_0x3aa3bd,_0x13b384);if(_0xdb77e9['status']>0xc7&&_0xdb77e9['status']<0x12c){const _0x362940=yield _0xdb77e9['json']();return new SuccessfulAccountResponse(_0x362940);}if(_0xdb77e9['bodyUsed']){const _0x241707=yield _0xdb77e9['json']();return new FailedAccountResponse(_0x241707);}const _0x3d990b={'type':'','status':_0xdb77e9['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x3d990b);});}}
8
8
 
9
- var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']);
9
+ var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x14f533,_0x36061a,_0x4dda07,_0x556141){function _0x518aa6(_0x3feffc){return _0x3feffc instanceof _0x4dda07?_0x3feffc:new _0x4dda07(function(_0x129623){_0x129623(_0x3feffc);});}return new(_0x4dda07||(_0x4dda07=Promise))(function(_0x2102f8,_0x3e8634){function _0x15b2df(_0x40f9d0){try{_0x29497c(_0x556141['next'](_0x40f9d0));}catch(_0x3e0992){_0x3e8634(_0x3e0992);}}function _0x43cce6(_0x40cffc){try{_0x29497c(_0x556141['throw'](_0x40cffc));}catch(_0x4cb5af){_0x3e8634(_0x4cb5af);}}function _0x29497c(_0x5725d9){_0x5725d9['done']?_0x2102f8(_0x5725d9['value']):_0x518aa6(_0x5725d9['value'])['then'](_0x15b2df,_0x43cce6);}_0x29497c((_0x556141=_0x556141['apply'](_0x14f533,_0x36061a||[]))['next']());});};class TokenManager{constructor(_0x3a93d1){this['securityService']=_0x3a93d1;}['RefreshTokens'](_0x20c6a2){return __awaiter$1(this,void 0,void 0,function*(){if(Date['now']()<_0x20c6a2['access_expires'])return new SuccessfulRefreshResponse(_0x20c6a2);if(Date['now']()>_0x20c6a2['refresh_expires']){const _0x230e5c={'type':'','status':0x193,'title':'Forbidden','instance':'','errors':{}};return new FailedRefreshResponse(_0x230e5c);}const _0x421d26=yield this['securityService']['refresh'](_0x20c6a2['refresh_token']);if(!_0x421d26['isSuccess'])return new FailedRefreshResponse(_0x421d26['toProblem']());return new SuccessfulRefreshResponse(_0x421d26['toSuccess']());});}}
10
+
11
+ var __awaiter=undefined&&undefined['__awaiter']||function(_0x4582be,_0x37e07d,_0x155afa,_0x291eec){function _0x506014(_0x147db7){return _0x147db7 instanceof _0x155afa?_0x147db7:new _0x155afa(function(_0x62764){_0x62764(_0x147db7);});}return new(_0x155afa||(_0x155afa=Promise))(function(_0xd26d61,_0x6acf8e){function _0x5d76a4(_0x4da379){try{_0x6cae41(_0x291eec['next'](_0x4da379));}catch(_0x1f185f){_0x6acf8e(_0x1f185f);}}function _0x334790(_0x59b712){try{_0x6cae41(_0x291eec['throw'](_0x59b712));}catch(_0x34e63d){_0x6acf8e(_0x34e63d);}}function _0x6cae41(_0x4f984e){_0x4f984e['done']?_0xd26d61(_0x4f984e['value']):_0x506014(_0x4f984e['value'])['then'](_0x5d76a4,_0x334790);}_0x6cae41((_0x291eec=_0x291eec['apply'](_0x4582be,_0x37e07d||[]))['next']());});};class SecurityService{constructor(_0x213ef5){this['baseUri']=_0x213ef5,this['tokenManager']=new TokenManager(this);}['refresh'](_0x5f1600){return __awaiter(this,arguments,void 0,function*(_0x5de950,_0x5e7ca1={}){var _0x4a8c01;let _0xed0c89=(_0x4a8c01=_0x5e7ca1['baseUri'])!==null&&_0x4a8c01!==void 0?_0x4a8c01:this['baseUri'];!_0xed0c89['endsWith']('/')&&(_0xed0c89=_0xed0c89+'/');_0xed0c89=_0xed0c89+'Security/Refresh';const _0x2fad28=yield Fetch['post'](_0xed0c89,_0x5de950,null);if(_0x2fad28['status']>0xc7&&_0x2fad28['status']<0x12c){const _0x4fc1e0=yield _0x2fad28['json']();return new SuccessfulRefreshResponse(_0x4fc1e0);}if(_0x2fad28['bodyUsed']){const _0x2ed6f8=yield _0x2fad28['json']();return new FailedRefreshResponse(_0x2ed6f8);}const _0x197b2b={'type':'','status':_0x2fad28['status'],'title':'','instance':'','errors':{}};return new FailedRefreshResponse(_0x197b2b);});}}
12
+
13
+ var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev/',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']),AdminClient['Security']=new SecurityService(_a['baseUri']);
10
14
 
11
15
  export { AdminClient };
package/dist/types.d.ts CHANGED
@@ -4,29 +4,39 @@ declare class AccountService {
4
4
  get(accessToken: string, accountName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
5
5
  }
6
6
 
7
- type AccountService_d_AccountService = AccountService;
8
- declare const AccountService_d_AccountService: typeof AccountService;
9
7
  declare namespace AccountService_d {
10
- export { AccountService_d_AccountService as AccountService };
8
+ export { AccountService as default };
11
9
  }
12
10
 
13
11
  declare class ListService {
14
12
  readonly baseUri: string;
15
13
  constructor(baseUri: string);
16
- add(accessToken: string, accountName: string, listName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
14
+ add(access_token: string, accountName: string, listName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
17
15
  remove(accessToken: string, accountName: string, listName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
18
16
  }
19
17
 
20
- type ListService_d_ListService = ListService;
21
- declare const ListService_d_ListService: typeof ListService;
22
18
  declare namespace ListService_d {
23
- export { ListService_d_ListService as ListService };
19
+ export { ListService as default };
20
+ }
21
+
22
+ declare class TokenManager {
23
+ readonly securityService: SecurityService;
24
+ constructor(securityService: SecurityService);
25
+ RefreshTokens(tokens: Tokens): Promise<Response<Tokens, Problem>>;
26
+ }
27
+
28
+ declare class SecurityService {
29
+ readonly baseUri: string;
30
+ constructor(baseUri: string);
31
+ refresh(refreshToken: string, options?: Partial<Options>): Promise<Response<Tokens, Problem>>;
32
+ readonly tokenManager: TokenManager;
24
33
  }
25
34
 
26
35
  declare class AdminClient {
27
36
  static baseUri: string;
28
37
  static Accounts: AccountService;
29
38
  static Lists: ListService;
39
+ static Security: SecurityService;
30
40
  }
31
41
 
32
42
  type Options = {
@@ -57,6 +67,12 @@ type Account = {
57
67
  created_utc: Date;
58
68
  lists: List[];
59
69
  };
70
+ type Tokens = {
71
+ access_token: string;
72
+ access_expires: number;
73
+ refresh_token: string;
74
+ refresh_expires: number;
75
+ };
60
76
  declare class SuccessfulAccountResponse extends Response<Account, Problem> {
61
77
  readonly account: Account;
62
78
  constructor(account: Account);
@@ -69,5 +85,17 @@ declare class FailedAccountResponse extends Response<Account, Problem> {
69
85
  toSuccess(): Account;
70
86
  toProblem(): Problem;
71
87
  }
88
+ declare class SuccessfulRefreshResponse extends Response<Tokens, Problem> {
89
+ readonly tokens: Tokens;
90
+ constructor(tokens: Tokens);
91
+ toSuccess(): Tokens;
92
+ toProblem(): Problem;
93
+ }
94
+ declare class FailedRefreshResponse extends Response<Tokens, Problem> {
95
+ readonly problem: Problem;
96
+ constructor(problem: Problem);
97
+ toSuccess(): Tokens;
98
+ toProblem(): Problem;
99
+ }
72
100
 
73
- export { type Account, AccountService_d as AccountServices, AdminClient, type Error, FailedAccountResponse, type List, ListService_d as ListServices, type Options, type Problem, Response, SuccessfulAccountResponse };
101
+ export { type Account, AccountService_d as AccountServices, AdminClient, type Error, FailedAccountResponse, FailedRefreshResponse, type List, ListService_d as ListServices, type Options, type Problem, Response, SuccessfulAccountResponse, SuccessfulRefreshResponse, type Tokens };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searchability/admin-client",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Searchability admin client.",
5
5
  "type": "module",
6
6
  "types": "./dist/types.d.ts",
@@ -1,11 +0,0 @@
1
- var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x38cb4c,_0x3a2fe2,_0x1d3d1a,_0x280376){function _0xd387e2(_0x327dac){return _0x327dac instanceof _0x1d3d1a?_0x327dac:new _0x1d3d1a(function(_0x2ebe5c){_0x2ebe5c(_0x327dac);});}return new(_0x1d3d1a||(_0x1d3d1a=Promise))(function(_0x5b0cef,_0x17dc57){function _0x507c5b(_0x2e12d9){try{_0x302aab(_0x280376['next'](_0x2e12d9));}catch(_0x1f6ee8){_0x17dc57(_0x1f6ee8);}}function _0x3eb112(_0x556586){try{_0x302aab(_0x280376['throw'](_0x556586));}catch(_0x1b7799){_0x17dc57(_0x1b7799);}}function _0x302aab(_0x142067){_0x142067['done']?_0x5b0cef(_0x142067['value']):_0xd387e2(_0x142067['value'])['then'](_0x507c5b,_0x3eb112);}_0x302aab((_0x280376=_0x280376['apply'](_0x38cb4c,_0x3a2fe2||[]))['next']());});};class Fetch{static['get'](_0x27d5f9,_0x298e59){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x27d5f9,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x298e59}});});}static['post'](_0xb2a114,_0xa962a3,_0x41c5d9){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0xb2a114,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xa962a3},'body':JSON['stringify'](_0x41c5d9)});});}static['put'](_0x3264a7,_0x45feeb,_0x17a883){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x3264a7,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x45feeb},'body':JSON['stringify'](_0x17a883)});});}static['delete'](_0x15dcec,_0x6cab31){return __awaiter$2(this,void 0,void 0,function*(){return yield fetch(_0x15dcec,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x6cab31}});});}}
2
-
3
- var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x75bae0,_0x86f58a,_0x46d37e,_0x103eb1){function _0x4cd213(_0x58bae4){return _0x58bae4 instanceof _0x46d37e?_0x58bae4:new _0x46d37e(function(_0x41e8e0){_0x41e8e0(_0x58bae4);});}return new(_0x46d37e||(_0x46d37e=Promise))(function(_0x447c7d,_0x41a32c){function _0x38b7bd(_0x107105){try{_0x1dcd2c(_0x103eb1['next'](_0x107105));}catch(_0x51b647){_0x41a32c(_0x51b647);}}function _0x13f89c(_0x4544d3){try{_0x1dcd2c(_0x103eb1['throw'](_0x4544d3));}catch(_0x2b11e4){_0x41a32c(_0x2b11e4);}}function _0x1dcd2c(_0x478517){_0x478517['done']?_0x447c7d(_0x478517['value']):_0x4cd213(_0x478517['value'])['then'](_0x38b7bd,_0x13f89c);}_0x1dcd2c((_0x103eb1=_0x103eb1['apply'](_0x75bae0,_0x86f58a||[]))['next']());});};class ListService{constructor(_0x472bc7){this['baseUri']=_0x472bc7;}['add'](_0x4c409d,_0x50765a,_0x359ea8){return __awaiter$1(this,arguments,void 0,function*(_0x40fe6a,_0x10d243,_0x33eada,_0x47e1f3={}){var _0x136db9;let _0x395c15=(_0x136db9=_0x47e1f3['baseUri'])!==null&&_0x136db9!==void 0?_0x136db9:this['baseUri'];_0x395c15=_0x395c15+'/List';const _0xee9121={'account_name':_0x10d243,'list_name':_0x33eada},_0xa6f2e0=yield Fetch['post'](_0x395c15,_0x40fe6a,_0xee9121);if(_0xa6f2e0['status']>0xc7&&_0xa6f2e0['status']<0x12c){const _0x25dabf=yield _0xa6f2e0['json']();return new SuccessfulAccountResponse(_0x25dabf);}if(_0xa6f2e0['bodyUsed']){const _0x30ad80=yield _0xa6f2e0['json']();return new FailedAccountResponse(_0x30ad80);}const _0x11904b={'type':'','status':_0xa6f2e0['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x11904b);});}['remove'](_0x1a35fc,_0x194c5d,_0x5a0a80){return __awaiter$1(this,arguments,void 0,function*(_0x14873c,_0x2501ed,_0x1c6f9d,_0x42d865={}){var _0x4ef74d;let _0x1dd0eb=(_0x4ef74d=_0x42d865['baseUri'])!==null&&_0x4ef74d!==void 0?_0x4ef74d:this['baseUri'];_0x1dd0eb=_0x1dd0eb+'/List/'+_0x2501ed+'/'+_0x1c6f9d;const _0x2d31e5=yield Fetch['delete'](_0x1dd0eb,_0x14873c);if(_0x2d31e5['status']>0xc7&&_0x2d31e5['status']<0x12c){const _0x10c50a=yield _0x2d31e5['json']();return new SuccessfulAccountResponse(_0x10c50a);}if(_0x2d31e5['bodyUsed']){const _0x26131a=yield _0x2d31e5['json']();return new FailedAccountResponse(_0x26131a);}const _0x6a9eb6={'type':'','status':_0x2d31e5['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x6a9eb6);});}}
4
-
5
- class Response{constructor(_0x1cfb16){this['isSuccess']=_0x1cfb16;}}class SuccessfulAccountResponse extends Response{constructor(_0x16ba11){super(!![]),this['account']=_0x16ba11;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x3f58b6){super(![]),this['problem']=_0x3f58b6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
6
-
7
- var __awaiter=undefined&&undefined['__awaiter']||function(_0x4024e0,_0x3bc326,_0x3e7eb7,_0x3a465d){function _0x6a781a(_0xe8ee3){return _0xe8ee3 instanceof _0x3e7eb7?_0xe8ee3:new _0x3e7eb7(function(_0x18d625){_0x18d625(_0xe8ee3);});}return new(_0x3e7eb7||(_0x3e7eb7=Promise))(function(_0x3d7204,_0x2f776e){function _0x91cede(_0x32ceed){try{_0x2c7f4c(_0x3a465d['next'](_0x32ceed));}catch(_0x74691b){_0x2f776e(_0x74691b);}}function _0x54c595(_0x2a5ad2){try{_0x2c7f4c(_0x3a465d['throw'](_0x2a5ad2));}catch(_0x29d587){_0x2f776e(_0x29d587);}}function _0x2c7f4c(_0x5dd149){_0x5dd149['done']?_0x3d7204(_0x5dd149['value']):_0x6a781a(_0x5dd149['value'])['then'](_0x91cede,_0x54c595);}_0x2c7f4c((_0x3a465d=_0x3a465d['apply'](_0x4024e0,_0x3bc326||[]))['next']());});};class AccountService{constructor(_0x3fc3e3){this['baseUri']=_0x3fc3e3;}['get'](_0x3375c9,_0x21cad5){return __awaiter(this,arguments,void 0,function*(_0x6622a6,_0x5be776,_0xae8c49={}){var _0x50a50a;let _0x4b8d13=(_0x50a50a=_0xae8c49['baseUri'])!==null&&_0x50a50a!==void 0?_0x50a50a:this['baseUri'];_0x4b8d13=_0x4b8d13+'/Account/'+_0x5be776+'/';const _0x17ed16=yield Fetch['get'](_0x4b8d13,_0x6622a6);if(_0x17ed16['status']>0xc7&&_0x17ed16['status']<0x12c){const _0x5502ac=yield _0x17ed16['json']();return new SuccessfulAccountResponse(_0x5502ac);}if(_0x17ed16['bodyUsed']){const _0x104819=yield _0x17ed16['json']();return new FailedAccountResponse(_0x104819);}const _0x4da027={'type':'','status':_0x17ed16['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x4da027);});}}
8
-
9
- var _a;class AdminClient{}_a=AdminClient,AdminClient['baseUri']='https://admin.searchability.dev',AdminClient['Accounts']=new AccountService(_a['baseUri']),AdminClient['Lists']=new ListService(_a['baseUri']);
10
-
11
- export { AdminClient };