@searchability/admin-client 0.0.8 → 0.0.10
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,17 @@
|
|
|
1
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x2471ff,_0x4fa33,_0x4dd256,_0x1a2821){function _0x308754(_0x2481e0){return _0x2481e0 instanceof _0x4dd256?_0x2481e0:new _0x4dd256(function(_0x21c05c){_0x21c05c(_0x2481e0);});}return new(_0x4dd256||(_0x4dd256=Promise))(function(_0x3cb836,_0x295568){function _0x27a165(_0x222bf8){try{_0x343509(_0x1a2821['next'](_0x222bf8));}catch(_0x29d264){_0x295568(_0x29d264);}}function _0x389ea3(_0x168025){try{_0x343509(_0x1a2821['throw'](_0x168025));}catch(_0x5c571b){_0x295568(_0x5c571b);}}function _0x343509(_0x28a2fa){_0x28a2fa['done']?_0x3cb836(_0x28a2fa['value']):_0x308754(_0x28a2fa['value'])['then'](_0x27a165,_0x389ea3);}_0x343509((_0x1a2821=_0x1a2821['apply'](_0x2471ff,_0x4fa33||[]))['next']());});};class Fetch{static['get'](_0x2fbf8e,_0x39fd5c){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x2fbf8e,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x39fd5c}});});}static['post'](_0x4d36e6,_0x460f2f,_0x4dfc68){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x4d36e6,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x460f2f},'body':_0x4dfc68?JSON['stringify'](_0x4dfc68):null});});}static['put'](_0x2a8840,_0x57cea1,_0x4fe17e){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x2a8840,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x57cea1},'body':_0x4fe17e?JSON['stringify'](_0x4fe17e):null});});}static['delete'](_0x230ffc,_0x15e879){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x230ffc,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x15e879}});});}}
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x46bb27){this['isSuccess']=_0x46bb27;}}class SuccessfulAccountResponse extends Response{constructor(_0x51bfe6){super(!![]),this['account']=_0x51bfe6;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x29eb63){super(![]),this['problem']=_0x29eb63;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x1669b8){super(!![]),this['tokens']=_0x1669b8;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x5131ed){super(![]),this['problem']=_0x5131ed;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x235d93){super(!![]),this['apiKey']=_0x235d93;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x6ac024){super(![]),this['problem']=_0x6ac024;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x9d3631,_0x4491af,_0x22563d,_0x156b68){function _0x5c109c(_0x4983e1){return _0x4983e1 instanceof _0x22563d?_0x4983e1:new _0x22563d(function(_0x59a126){_0x59a126(_0x4983e1);});}return new(_0x22563d||(_0x22563d=Promise))(function(_0x357ad5,_0x402a9d){function _0x29b7eb(_0x2aaf48){try{_0x5e8865(_0x156b68['next'](_0x2aaf48));}catch(_0x597726){_0x402a9d(_0x597726);}}function _0x186e59(_0x1b733f){try{_0x5e8865(_0x156b68['throw'](_0x1b733f));}catch(_0x2a9c9d){_0x402a9d(_0x2a9c9d);}}function _0x5e8865(_0x493603){_0x493603['done']?_0x357ad5(_0x493603['value']):_0x5c109c(_0x493603['value'])['then'](_0x29b7eb,_0x186e59);}_0x5e8865((_0x156b68=_0x156b68['apply'](_0x9d3631,_0x4491af||[]))['next']());});};class AccountService{constructor(_0x3391c8){this['baseUri']=_0x3391c8;}['get'](_0x4d1b1c,_0x11aa91){return __awaiter$4(this,arguments,void 0,function*(_0xf4acb0,_0x46cf17,_0x2d7a79={}){var _0x4bf4df;let _0x2ae644=(_0x4bf4df=_0x2d7a79['baseUri'])!==null&&_0x4bf4df!==void 0?_0x4bf4df:this['baseUri'];!_0x2ae644['endsWith']('/')&&(_0x2ae644=_0x2ae644+'/');_0x2ae644=_0x2ae644+'Account/'+_0x46cf17+'/';const _0x17a064=yield Fetch['get'](_0x2ae644,_0xf4acb0);try{if(_0x17a064['status']>0xc7&&_0x17a064['status']<0x12c){const _0x58c725=yield _0x17a064['json']();return new SuccessfulAccountResponse(_0x58c725);}const _0x53c64e=yield _0x17a064['json']();return new FailedAccountResponse(_0x53c64e);}catch(_0x4067ed){if(_0x4067ed instanceof Error)return new FailedAccountResponse({'detail':_0x4067ed['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4067ed;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x53ded0,_0x3e271a,_0x37c928,_0x2f7a4b){function _0x36f870(_0x1303f9){return _0x1303f9 instanceof _0x37c928?_0x1303f9:new _0x37c928(function(_0xbff479){_0xbff479(_0x1303f9);});}return new(_0x37c928||(_0x37c928=Promise))(function(_0x577796,_0x286353){function _0x2b1e90(_0x4d4410){try{_0xb1e6c6(_0x2f7a4b['next'](_0x4d4410));}catch(_0x1fcb8e){_0x286353(_0x1fcb8e);}}function _0x3eb229(_0x292189){try{_0xb1e6c6(_0x2f7a4b['throw'](_0x292189));}catch(_0x1e12aa){_0x286353(_0x1e12aa);}}function _0xb1e6c6(_0x74d7d){_0x74d7d['done']?_0x577796(_0x74d7d['value']):_0x36f870(_0x74d7d['value'])['then'](_0x2b1e90,_0x3eb229);}_0xb1e6c6((_0x2f7a4b=_0x2f7a4b['apply'](_0x53ded0,_0x3e271a||[]))['next']());});};class ApiKeyService{constructor(_0x3615fe){this['baseUri']=_0x3615fe;}['create'](_0x1149aa,_0x558123,_0x34217d){return __awaiter$3(this,arguments,void 0,function*(_0xc3df64,_0x1f43ff,_0x3fa865,_0xa7223b={}){var _0x30b35f;let _0x55b0ff=(_0x30b35f=_0xa7223b['baseUri'])!==null&&_0x30b35f!==void 0?_0x30b35f:this['baseUri'];!_0x55b0ff['endsWith']('/')&&(_0x55b0ff=_0x55b0ff+'/');_0x55b0ff=_0x55b0ff+'ApiKey/Create';const _0x23825b={'account_name':_0x1f43ff,'name':_0x3fa865};try{const _0x37fa5c=yield Fetch['post'](_0x55b0ff,_0xc3df64,_0x23825b);if(_0x37fa5c['status']>0xc7&&_0x37fa5c['status']<0x12c){const _0x87dcd4=yield _0x37fa5c['json']();return new SuccessfulApiKeyResponse(_0x87dcd4);}const _0x4fc799=yield _0x37fa5c['json']();return new FailedApiKeyResponse(_0x4fc799);}catch(_0xc525bf){if(_0xc525bf instanceof Error)return new FailedApiKeyResponse({'detail':_0xc525bf['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xc525bf;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x516d6c,_0x3b6ce4,_0x4e05f5,_0x2ee41e){function _0x6f627a(_0x1c5abf){return _0x1c5abf instanceof _0x4e05f5?_0x1c5abf:new _0x4e05f5(function(_0x2de2a0){_0x2de2a0(_0x1c5abf);});}return new(_0x4e05f5||(_0x4e05f5=Promise))(function(_0x26a27a,_0x5eef33){function _0x44892e(_0x450d05){try{_0x6c61ac(_0x2ee41e['next'](_0x450d05));}catch(_0x505db4){_0x5eef33(_0x505db4);}}function _0x31b964(_0x1e1792){try{_0x6c61ac(_0x2ee41e['throw'](_0x1e1792));}catch(_0x59b501){_0x5eef33(_0x59b501);}}function _0x6c61ac(_0x288871){_0x288871['done']?_0x26a27a(_0x288871['value']):_0x6f627a(_0x288871['value'])['then'](_0x44892e,_0x31b964);}_0x6c61ac((_0x2ee41e=_0x2ee41e['apply'](_0x516d6c,_0x3b6ce4||[]))['next']());});};class ListService{constructor(_0x411e57){this['baseUri']=_0x411e57;}['add'](_0x3db525,_0x2bc634,_0x315e7e){return __awaiter$2(this,arguments,void 0,function*(_0x4256c9,_0x39246c,_0x3ba4b6,_0x5b9ab0={}){var _0x183888;let _0x415d5e=(_0x183888=_0x5b9ab0['baseUri'])!==null&&_0x183888!==void 0?_0x183888:this['baseUri'];!_0x415d5e['endsWith']('/')&&(_0x415d5e=_0x415d5e+'/');_0x415d5e=_0x415d5e+'List';const _0x1ad124={'account_name':_0x39246c,'list_name':_0x3ba4b6};try{const _0x3fc003=yield Fetch['post'](_0x415d5e,_0x4256c9,_0x1ad124);if(_0x3fc003['status']>0xc7&&_0x3fc003['status']<0x12c){const _0x1a058f=yield _0x3fc003['json']();return new SuccessfulAccountResponse(_0x1a058f);}const _0x3bc077=yield _0x3fc003['json']();return new FailedAccountResponse(_0x3bc077);}catch(_0x3afa3e){if(_0x3afa3e instanceof Error)return new FailedAccountResponse({'detail':_0x3afa3e['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3afa3e;}});}['remove'](_0x57a6e2,_0x16270e,_0x298626){return __awaiter$2(this,arguments,void 0,function*(_0x1f938f,_0xcd1525,_0x2b13a6,_0x46291e={}){var _0x4853ff;let _0x503b38=(_0x4853ff=_0x46291e['baseUri'])!==null&&_0x4853ff!==void 0?_0x4853ff:this['baseUri'];_0x503b38=_0x503b38+'/List/'+_0xcd1525+'/'+_0x2b13a6;const _0x31b0b1=yield Fetch['delete'](_0x503b38,_0x1f938f);try{if(_0x31b0b1['status']>0xc7&&_0x31b0b1['status']<0x12c){const _0x2851ff=yield _0x31b0b1['json']();return new SuccessfulAccountResponse(_0x2851ff);}const _0x28404a=yield _0x31b0b1['json']();return new FailedAccountResponse(_0x28404a);}catch(_0x5219b3){if(_0x5219b3 instanceof Error)return new FailedAccountResponse({'detail':_0x5219b3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5219b3;}});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xdc281d,_0x30e70a,_0x3f7a96,_0x1663b9){function _0x772a33(_0x5e4533){return _0x5e4533 instanceof _0x3f7a96?_0x5e4533:new _0x3f7a96(function(_0x4d6b14){_0x4d6b14(_0x5e4533);});}return new(_0x3f7a96||(_0x3f7a96=Promise))(function(_0x32c13f,_0x1f870d){function _0x59cc53(_0xdaa1a5){try{_0x152e86(_0x1663b9['next'](_0xdaa1a5));}catch(_0x20fd59){_0x1f870d(_0x20fd59);}}function _0x5c2c91(_0x5a9910){try{_0x152e86(_0x1663b9['throw'](_0x5a9910));}catch(_0x1714b8){_0x1f870d(_0x1714b8);}}function _0x152e86(_0x49b6ef){_0x49b6ef['done']?_0x32c13f(_0x49b6ef['value']):_0x772a33(_0x49b6ef['value'])['then'](_0x59cc53,_0x5c2c91);}_0x152e86((_0x1663b9=_0x1663b9['apply'](_0xdc281d,_0x30e70a||[]))['next']());});};class TokenManager{constructor(_0x51ca90){this['securityService']=_0x51ca90;}['RefreshTokens'](_0x553983){return __awaiter$1(this,arguments,void 0,function*(_0x157896,_0x29c4ae={}){if(Date['now']()<_0x157896['access_expires'])return new SuccessfulRefreshResponse(_0x157896);if(Date['now']()>_0x157896['refresh_expires']){const _0x484e93={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x484e93);}const _0x332e67=yield this['securityService']['refresh'](_0x157896['refresh_token'],_0x29c4ae);if(!_0x332e67['isSuccess'])return new FailedRefreshResponse(_0x332e67['toProblem']());return new SuccessfulRefreshResponse(_0x332e67['toSuccess']());});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3b89d4,_0x5fe804,_0x541434,_0x7fbf5a){function _0x27e573(_0x1fbf07){return _0x1fbf07 instanceof _0x541434?_0x1fbf07:new _0x541434(function(_0x25ef48){_0x25ef48(_0x1fbf07);});}return new(_0x541434||(_0x541434=Promise))(function(_0x577c8b,_0x12b0e9){function _0x15ea42(_0x3827a6){try{_0x3087f8(_0x7fbf5a['next'](_0x3827a6));}catch(_0x14e535){_0x12b0e9(_0x14e535);}}function _0x5a9974(_0x2d7873){try{_0x3087f8(_0x7fbf5a['throw'](_0x2d7873));}catch(_0x58bdf7){_0x12b0e9(_0x58bdf7);}}function _0x3087f8(_0x160e25){_0x160e25['done']?_0x577c8b(_0x160e25['value']):_0x27e573(_0x160e25['value'])['then'](_0x15ea42,_0x5a9974);}_0x3087f8((_0x7fbf5a=_0x7fbf5a['apply'](_0x3b89d4,_0x5fe804||[]))['next']());});};class SecurityService{constructor(_0x2b74c5){this['baseUri']=_0x2b74c5,this['tokenManager']=new TokenManager(this);}['refresh'](_0x8b3f20){return __awaiter(this,arguments,void 0,function*(_0x307b45,_0xcd7d7f={}){var _0x4bc085;let _0x52028b=(_0x4bc085=_0xcd7d7f['baseUri'])!==null&&_0x4bc085!==void 0?_0x4bc085:this['baseUri'];!_0x52028b['endsWith']('/')&&(_0x52028b=_0x52028b+'/');_0x52028b=_0x52028b+'Security/Refresh';try{const _0x1a7e26=yield Fetch['post'](_0x52028b,_0x307b45,null);if(_0x1a7e26['status']>0xc7&&_0x1a7e26['status']<0x12c){const _0x1d4a1b=yield _0x1a7e26['json']();return new SuccessfulRefreshResponse(_0x1d4a1b);}const _0x1b4bed=yield _0x1a7e26['json']();return new FailedRefreshResponse(_0x1b4bed);}catch(_0x52f426){if(_0x52f426 instanceof Error)return new FailedRefreshResponse({'detail':_0x52f426['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x52f426;}});}}
|
|
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']),AdminClient['ApiKeys']=new ApiKeyService(_a['baseUri']);
|
|
16
|
+
|
|
17
|
+
export { AdminClient };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var __awaiter$
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x47c887,_0x342d6c,_0x265f8f,_0x478cbd){function _0x11b7d0(_0x21922c){return _0x21922c instanceof _0x265f8f?_0x21922c:new _0x265f8f(function(_0x172ff4){_0x172ff4(_0x21922c);});}return new(_0x265f8f||(_0x265f8f=Promise))(function(_0x120b3e,_0x4cafd2){function _0x52ab00(_0x2bb001){try{_0x3ecb3e(_0x478cbd['next'](_0x2bb001));}catch(_0x15016f){_0x4cafd2(_0x15016f);}}function _0x27d07c(_0x6544f0){try{_0x3ecb3e(_0x478cbd['throw'](_0x6544f0));}catch(_0x1148e4){_0x4cafd2(_0x1148e4);}}function _0x3ecb3e(_0x57c40d){_0x57c40d['done']?_0x120b3e(_0x57c40d['value']):_0x11b7d0(_0x57c40d['value'])['then'](_0x52ab00,_0x27d07c);}_0x3ecb3e((_0x478cbd=_0x478cbd['apply'](_0x47c887,_0x342d6c||[]))['next']());});};class Fetch{static['get'](_0x5782d6,_0x1451e9){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x5782d6,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1451e9}});});}static['post'](_0x43bd4a,_0x356b5e,_0x49b48d){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x43bd4a,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x356b5e},'body':_0x49b48d?JSON['stringify'](_0x49b48d):null});});}static['put'](_0x25247c,_0x3c2782,_0x3414b3){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x25247c,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x3c2782},'body':_0x3414b3?JSON['stringify'](_0x3414b3):null});});}static['delete'](_0x59e1fa,_0x13a6fe){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x59e1fa,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x13a6fe}});});}}
|
|
4
4
|
|
|
5
|
-
class Response{constructor(
|
|
5
|
+
class Response{constructor(_0x17832c){this['isSuccess']=_0x17832c;}}class SuccessfulAccountResponse extends Response{constructor(_0x103f7c){super(!![]),this['account']=_0x103f7c;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x49344e){super(![]),this['problem']=_0x49344e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x286286){super(!![]),this['tokens']=_0x286286;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x5b49d2){super(![]),this['problem']=_0x5b49d2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x4f6f62){super(!![]),this['apiKey']=_0x4f6f62;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x536d2a){super(![]),this['problem']=_0x536d2a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x52a5a4,_0x8af78,_0x2fe67e,_0x2d2d7e){function _0xde91d3(_0x18eb58){return _0x18eb58 instanceof _0x2fe67e?_0x18eb58:new _0x2fe67e(function(_0x8c936d){_0x8c936d(_0x18eb58);});}return new(_0x2fe67e||(_0x2fe67e=Promise))(function(_0x193492,_0x5291d3){function _0x5eeb82(_0x38146f){try{_0x148b66(_0x2d2d7e['next'](_0x38146f));}catch(_0x4fd7ab){_0x5291d3(_0x4fd7ab);}}function _0x5aaef6(_0xcf8775){try{_0x148b66(_0x2d2d7e['throw'](_0xcf8775));}catch(_0x2ab91a){_0x5291d3(_0x2ab91a);}}function _0x148b66(_0x5a8ef3){_0x5a8ef3['done']?_0x193492(_0x5a8ef3['value']):_0xde91d3(_0x5a8ef3['value'])['then'](_0x5eeb82,_0x5aaef6);}_0x148b66((_0x2d2d7e=_0x2d2d7e['apply'](_0x52a5a4,_0x8af78||[]))['next']());});};class AccountService{constructor(_0x5d132e){this['baseUri']=_0x5d132e;}['get'](_0x4adefa,_0x44e2fe){return __awaiter$4(this,arguments,void 0,function*(_0x355645,_0x5086d3,_0x1d4268={}){var _0x1bce76;let _0x114db1=(_0x1bce76=_0x1d4268['baseUri'])!==null&&_0x1bce76!==void 0?_0x1bce76:this['baseUri'];!_0x114db1['endsWith']('/')&&(_0x114db1=_0x114db1+'/');_0x114db1=_0x114db1+'Account/'+_0x5086d3+'/';const _0x14284e=yield Fetch['get'](_0x114db1,_0x355645);try{if(_0x14284e['status']>0xc7&&_0x14284e['status']<0x12c){const _0xceedbb=yield _0x14284e['json']();return new SuccessfulAccountResponse(_0xceedbb);}const _0x1a3616=yield _0x14284e['json']();return new FailedAccountResponse(_0x1a3616);}catch(_0x1593e3){if(_0x1593e3 instanceof Error)return new FailedAccountResponse({'detail':_0x1593e3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1593e3;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x13f54a,_0x41f7dd,_0x37f650,_0x110b32){function _0xfb6973(_0x54ac4){return _0x54ac4 instanceof _0x37f650?_0x54ac4:new _0x37f650(function(_0x4a59c3){_0x4a59c3(_0x54ac4);});}return new(_0x37f650||(_0x37f650=Promise))(function(_0x1a5144,_0x112a82){function _0x50e36a(_0xd3c56a){try{_0x47023d(_0x110b32['next'](_0xd3c56a));}catch(_0x5615cf){_0x112a82(_0x5615cf);}}function _0x28d896(_0x2850c1){try{_0x47023d(_0x110b32['throw'](_0x2850c1));}catch(_0x387821){_0x112a82(_0x387821);}}function _0x47023d(_0x41a101){_0x41a101['done']?_0x1a5144(_0x41a101['value']):_0xfb6973(_0x41a101['value'])['then'](_0x50e36a,_0x28d896);}_0x47023d((_0x110b32=_0x110b32['apply'](_0x13f54a,_0x41f7dd||[]))['next']());});};class ApiKeyService{constructor(_0x316089){this['baseUri']=_0x316089;}['create'](_0x3cc2c8,_0x2ed457,_0x1f81ad){return __awaiter$3(this,arguments,void 0,function*(_0x5511f7,_0x56d357,_0x271a29,_0x468c77={}){var _0x24b455;let _0x19592e=(_0x24b455=_0x468c77['baseUri'])!==null&&_0x24b455!==void 0?_0x24b455:this['baseUri'];!_0x19592e['endsWith']('/')&&(_0x19592e=_0x19592e+'/');_0x19592e=_0x19592e+'ApiKey/Create';const _0xecf371={'account_name':_0x56d357,'name':_0x271a29};try{const _0x531c62=yield Fetch['post'](_0x19592e,_0x5511f7,_0xecf371);if(_0x531c62['status']>0xc7&&_0x531c62['status']<0x12c){const _0x39894e=yield _0x531c62['json']();return new SuccessfulApiKeyResponse(_0x39894e);}const _0x49c7cb=yield _0x531c62['json']();return new FailedApiKeyResponse(_0x49c7cb);}catch(_0x554c8){if(_0x554c8 instanceof Error)return new FailedApiKeyResponse({'detail':_0x554c8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x554c8;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x231556,_0xabb0ff,_0x2be7b0,_0x4b81bc){function _0x223f5c(_0x205eef){return _0x205eef instanceof _0x2be7b0?_0x205eef:new _0x2be7b0(function(_0x5ecc75){_0x5ecc75(_0x205eef);});}return new(_0x2be7b0||(_0x2be7b0=Promise))(function(_0x28ebb7,_0xcef553){function _0x6f620e(_0x150efb){try{_0x2392d3(_0x4b81bc['next'](_0x150efb));}catch(_0x274bfb){_0xcef553(_0x274bfb);}}function _0x2effc5(_0x625765){try{_0x2392d3(_0x4b81bc['throw'](_0x625765));}catch(_0x234197){_0xcef553(_0x234197);}}function _0x2392d3(_0x37757d){_0x37757d['done']?_0x28ebb7(_0x37757d['value']):_0x223f5c(_0x37757d['value'])['then'](_0x6f620e,_0x2effc5);}_0x2392d3((_0x4b81bc=_0x4b81bc['apply'](_0x231556,_0xabb0ff||[]))['next']());});};class ListService{constructor(_0x3c18b5){this['baseUri']=_0x3c18b5;}['add'](_0x56863d,_0x23168a,_0x5beedb){return __awaiter$2(this,arguments,void 0,function*(_0x58ddb0,_0x2a3a75,_0x396514,_0x2313bc={}){var _0x4bbf93;let _0x4389b8=(_0x4bbf93=_0x2313bc['baseUri'])!==null&&_0x4bbf93!==void 0?_0x4bbf93:this['baseUri'];!_0x4389b8['endsWith']('/')&&(_0x4389b8=_0x4389b8+'/');_0x4389b8=_0x4389b8+'List';const _0x3358e1={'account_name':_0x2a3a75,'list_name':_0x396514};try{const _0x2c4912=yield Fetch['post'](_0x4389b8,_0x58ddb0,_0x3358e1);if(_0x2c4912['status']>0xc7&&_0x2c4912['status']<0x12c){const _0x17f8ab=yield _0x2c4912['json']();return new SuccessfulAccountResponse(_0x17f8ab);}const _0x23c1ef=yield _0x2c4912['json']();return new FailedAccountResponse(_0x23c1ef);}catch(_0x2b7972){if(_0x2b7972 instanceof Error)return new FailedAccountResponse({'detail':_0x2b7972['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2b7972;}});}['remove'](_0x2e4004,_0x357c4a,_0x54651f){return __awaiter$2(this,arguments,void 0,function*(_0x4f827d,_0x702c89,_0x410e0e,_0x17ca39={}){var _0x47b938;let _0x362429=(_0x47b938=_0x17ca39['baseUri'])!==null&&_0x47b938!==void 0?_0x47b938:this['baseUri'];_0x362429=_0x362429+'/List/'+_0x702c89+'/'+_0x410e0e;const _0x1237ad=yield Fetch['delete'](_0x362429,_0x4f827d);try{if(_0x1237ad['status']>0xc7&&_0x1237ad['status']<0x12c){const _0x1b8c78=yield _0x1237ad['json']();return new SuccessfulAccountResponse(_0x1b8c78);}const _0x39649f=yield _0x1237ad['json']();return new FailedAccountResponse(_0x39649f);}catch(_0x3ac8c6){if(_0x3ac8c6 instanceof Error)return new FailedAccountResponse({'detail':_0x3ac8c6['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3ac8c6;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x1ab867,_0x51a7d1,_0x1f0bae,_0x4151f3){function _0x2e4e99(_0x445b53){return _0x445b53 instanceof _0x1f0bae?_0x445b53:new _0x1f0bae(function(_0x283d44){_0x283d44(_0x445b53);});}return new(_0x1f0bae||(_0x1f0bae=Promise))(function(_0x5823c0,_0x3e45db){function _0x3cb636(_0x3d82b4){try{_0x33a4d6(_0x4151f3['next'](_0x3d82b4));}catch(_0x1a7c15){_0x3e45db(_0x1a7c15);}}function _0x50b8b9(_0xc406b3){try{_0x33a4d6(_0x4151f3['throw'](_0xc406b3));}catch(_0x31b4a4){_0x3e45db(_0x31b4a4);}}function _0x33a4d6(_0x19815c){_0x19815c['done']?_0x5823c0(_0x19815c['value']):_0x2e4e99(_0x19815c['value'])['then'](_0x3cb636,_0x50b8b9);}_0x33a4d6((_0x4151f3=_0x4151f3['apply'](_0x1ab867,_0x51a7d1||[]))['next']());});};class TokenManager{constructor(_0x4b5473){this['securityService']=_0x4b5473;}['RefreshTokens'](_0x29ab60){return __awaiter$1(this,arguments,void 0,function*(_0x720aec,_0x209336={}){if(Date['now']()<_0x720aec['access_expires'])return new SuccessfulRefreshResponse(_0x720aec);if(Date['now']()>_0x720aec['refresh_expires']){const _0x4a1346={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x4a1346);}const _0x438dc6=yield this['securityService']['refresh'](_0x720aec['refresh_token'],_0x209336);if(!_0x438dc6['isSuccess'])return new FailedRefreshResponse(_0x438dc6['toProblem']());return new SuccessfulRefreshResponse(_0x438dc6['toSuccess']());});}}
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x178075,_0x3aba25,_0x585506,_0x495b1a){function _0x17d1e4(_0x146342){return _0x146342 instanceof _0x585506?_0x146342:new _0x585506(function(_0x21b772){_0x21b772(_0x146342);});}return new(_0x585506||(_0x585506=Promise))(function(_0x39bdef,_0x448bbb){function _0x12e809(_0x16fd0a){try{_0x48f21d(_0x495b1a['next'](_0x16fd0a));}catch(_0x272e6a){_0x448bbb(_0x272e6a);}}function _0x3908af(_0x47221b){try{_0x48f21d(_0x495b1a['throw'](_0x47221b));}catch(_0x4ff83f){_0x448bbb(_0x4ff83f);}}function _0x48f21d(_0x5ca4a5){_0x5ca4a5['done']?_0x39bdef(_0x5ca4a5['value']):_0x17d1e4(_0x5ca4a5['value'])['then'](_0x12e809,_0x3908af);}_0x48f21d((_0x495b1a=_0x495b1a['apply'](_0x178075,_0x3aba25||[]))['next']());});};class SecurityService{constructor(_0x593f1b){this['baseUri']=_0x593f1b,this['tokenManager']=new TokenManager(this);}['refresh'](_0x4a402c){return __awaiter(this,arguments,void 0,function*(_0x340e69,_0x20bf58={}){var _0x443576;let _0x3b5b55=(_0x443576=_0x20bf58['baseUri'])!==null&&_0x443576!==void 0?_0x443576:this['baseUri'];!_0x3b5b55['endsWith']('/')&&(_0x3b5b55=_0x3b5b55+'/');_0x3b5b55=_0x3b5b55+'Security/Refresh';try{const _0x548973=yield Fetch['post'](_0x3b5b55,_0x340e69,null);if(_0x548973['status']>0xc7&&_0x548973['status']<0x12c){const _0x56f8df=yield _0x548973['json']();return new SuccessfulRefreshResponse(_0x56f8df);}const _0x4a334c=yield _0x548973['json']();return new FailedRefreshResponse(_0x4a334c);}catch(_0x574c0a){if(_0x574c0a instanceof Error)return new FailedRefreshResponse({'detail':_0x574c0a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x574c0a;}});}}
|
|
16
|
+
|
|
17
|
+
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']),AdminClient['ApiKeys']=new ApiKeyService(_a['baseUri']);
|
|
16
18
|
|
|
17
19
|
exports.AdminClient = AdminClient;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
var __awaiter$
|
|
1
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x3335f4,_0x132652,_0x3630d6,_0x34000e){function _0x17d55e(_0x514e97){return _0x514e97 instanceof _0x3630d6?_0x514e97:new _0x3630d6(function(_0x590e2c){_0x590e2c(_0x514e97);});}return new(_0x3630d6||(_0x3630d6=Promise))(function(_0x6e86e8,_0x5b3863){function _0x4aad1f(_0x1c60cf){try{_0x40bfde(_0x34000e['next'](_0x1c60cf));}catch(_0x266511){_0x5b3863(_0x266511);}}function _0xd9bece(_0x47fcbd){try{_0x40bfde(_0x34000e['throw'](_0x47fcbd));}catch(_0x1090a8){_0x5b3863(_0x1090a8);}}function _0x40bfde(_0x44f342){_0x44f342['done']?_0x6e86e8(_0x44f342['value']):_0x17d55e(_0x44f342['value'])['then'](_0x4aad1f,_0xd9bece);}_0x40bfde((_0x34000e=_0x34000e['apply'](_0x3335f4,_0x132652||[]))['next']());});};class Fetch{static['get'](_0xe32650,_0x378410){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0xe32650,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x378410}});});}static['post'](_0x5c6fe2,_0x1668be,_0x794ee1){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x5c6fe2,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1668be},'body':_0x794ee1?JSON['stringify'](_0x794ee1):null});});}static['put'](_0x4978d8,_0x1451ce,_0x468361){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x4978d8,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1451ce},'body':_0x468361?JSON['stringify'](_0x468361):null});});}static['delete'](_0x45c03b,_0x36c577){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x45c03b,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x36c577}});});}}
|
|
2
2
|
|
|
3
|
-
class Response{constructor(
|
|
3
|
+
class Response{constructor(_0x3bba84){this['isSuccess']=_0x3bba84;}}class SuccessfulAccountResponse extends Response{constructor(_0x13e61e){super(!![]),this['account']=_0x13e61e;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x16c05f){super(![]),this['problem']=_0x16c05f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x1b7e68){super(!![]),this['tokens']=_0x1b7e68;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x3e838a){super(![]),this['problem']=_0x3e838a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x3dfe61){super(!![]),this['apiKey']=_0x3dfe61;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x43befe){super(![]),this['problem']=_0x43befe;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x42efcd,_0x539611,_0x427c65,_0x634b17){function _0x4b4e80(_0x2ea46a){return _0x2ea46a instanceof _0x427c65?_0x2ea46a:new _0x427c65(function(_0x126616){_0x126616(_0x2ea46a);});}return new(_0x427c65||(_0x427c65=Promise))(function(_0x24e77c,_0x922bd5){function _0x3de3d5(_0xfb1a12){try{_0x2555bd(_0x634b17['next'](_0xfb1a12));}catch(_0x27eee8){_0x922bd5(_0x27eee8);}}function _0x5e1090(_0x1e6c1d){try{_0x2555bd(_0x634b17['throw'](_0x1e6c1d));}catch(_0xc7e708){_0x922bd5(_0xc7e708);}}function _0x2555bd(_0x39313b){_0x39313b['done']?_0x24e77c(_0x39313b['value']):_0x4b4e80(_0x39313b['value'])['then'](_0x3de3d5,_0x5e1090);}_0x2555bd((_0x634b17=_0x634b17['apply'](_0x42efcd,_0x539611||[]))['next']());});};class AccountService{constructor(_0xede79a){this['baseUri']=_0xede79a;}['get'](_0x988fa3,_0x40aaa8){return __awaiter$4(this,arguments,void 0,function*(_0x37ab6b,_0x598c9a,_0x6da117={}){var _0x5cacaa;let _0x46b9b6=(_0x5cacaa=_0x6da117['baseUri'])!==null&&_0x5cacaa!==void 0?_0x5cacaa:this['baseUri'];!_0x46b9b6['endsWith']('/')&&(_0x46b9b6=_0x46b9b6+'/');_0x46b9b6=_0x46b9b6+'Account/'+_0x598c9a+'/';const _0x1eb2cd=yield Fetch['get'](_0x46b9b6,_0x37ab6b);try{if(_0x1eb2cd['status']>0xc7&&_0x1eb2cd['status']<0x12c){const _0x9a135e=yield _0x1eb2cd['json']();return new SuccessfulAccountResponse(_0x9a135e);}const _0x32c6d1=yield _0x1eb2cd['json']();return new FailedAccountResponse(_0x32c6d1);}catch(_0x1b972a){if(_0x1b972a instanceof Error)return new FailedAccountResponse({'detail':_0x1b972a['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1b972a;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x6f1f1,_0x32eee4,_0x5e3dc9,_0x3f35a5){function _0x3a674f(_0x1519c9){return _0x1519c9 instanceof _0x5e3dc9?_0x1519c9:new _0x5e3dc9(function(_0x4eafde){_0x4eafde(_0x1519c9);});}return new(_0x5e3dc9||(_0x5e3dc9=Promise))(function(_0x3ad64f,_0x53f6c8){function _0x3ff5db(_0x4a28e9){try{_0x38a0c6(_0x3f35a5['next'](_0x4a28e9));}catch(_0xf43067){_0x53f6c8(_0xf43067);}}function _0x2c5985(_0x28bae0){try{_0x38a0c6(_0x3f35a5['throw'](_0x28bae0));}catch(_0x2e319c){_0x53f6c8(_0x2e319c);}}function _0x38a0c6(_0x48bebd){_0x48bebd['done']?_0x3ad64f(_0x48bebd['value']):_0x3a674f(_0x48bebd['value'])['then'](_0x3ff5db,_0x2c5985);}_0x38a0c6((_0x3f35a5=_0x3f35a5['apply'](_0x6f1f1,_0x32eee4||[]))['next']());});};class ApiKeyService{constructor(_0x21695b){this['baseUri']=_0x21695b;}['create'](_0x301f21,_0x18ea57,_0xe3427f){return __awaiter$3(this,arguments,void 0,function*(_0x7c47eb,_0x35c8bc,_0x437ff9,_0x55bd8b={}){var _0x9680ae;let _0x348458=(_0x9680ae=_0x55bd8b['baseUri'])!==null&&_0x9680ae!==void 0?_0x9680ae:this['baseUri'];!_0x348458['endsWith']('/')&&(_0x348458=_0x348458+'/');_0x348458=_0x348458+'ApiKey/Create';const _0x3d6d12={'account_name':_0x35c8bc,'name':_0x437ff9};try{const _0x26c092=yield Fetch['post'](_0x348458,_0x7c47eb,_0x3d6d12);if(_0x26c092['status']>0xc7&&_0x26c092['status']<0x12c){const _0xfdf3bf=yield _0x26c092['json']();return new SuccessfulApiKeyResponse(_0xfdf3bf);}const _0x575eb4=yield _0x26c092['json']();return new FailedApiKeyResponse(_0x575eb4);}catch(_0x2853b3){if(_0x2853b3 instanceof Error)return new FailedApiKeyResponse({'detail':_0x2853b3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x2853b3;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x24f100,_0x2a57d7,_0xe468c2,_0x26d7fb){function _0x111a85(_0x44e917){return _0x44e917 instanceof _0xe468c2?_0x44e917:new _0xe468c2(function(_0x4f5003){_0x4f5003(_0x44e917);});}return new(_0xe468c2||(_0xe468c2=Promise))(function(_0x5cab7c,_0x37e99f){function _0x4f880(_0x187fad){try{_0x1338f(_0x26d7fb['next'](_0x187fad));}catch(_0x3f14d7){_0x37e99f(_0x3f14d7);}}function _0x42d1fc(_0x507d6f){try{_0x1338f(_0x26d7fb['throw'](_0x507d6f));}catch(_0x36cca7){_0x37e99f(_0x36cca7);}}function _0x1338f(_0xb6d0dd){_0xb6d0dd['done']?_0x5cab7c(_0xb6d0dd['value']):_0x111a85(_0xb6d0dd['value'])['then'](_0x4f880,_0x42d1fc);}_0x1338f((_0x26d7fb=_0x26d7fb['apply'](_0x24f100,_0x2a57d7||[]))['next']());});};class ListService{constructor(_0x3b95fc){this['baseUri']=_0x3b95fc;}['add'](_0x428a54,_0x4da655,_0x125ecd){return __awaiter$2(this,arguments,void 0,function*(_0x3d6d92,_0xbb88a4,_0x19736d,_0x197b6f={}){var _0x49e3ad;let _0x406337=(_0x49e3ad=_0x197b6f['baseUri'])!==null&&_0x49e3ad!==void 0?_0x49e3ad:this['baseUri'];!_0x406337['endsWith']('/')&&(_0x406337=_0x406337+'/');_0x406337=_0x406337+'List';const _0x518a1d={'account_name':_0xbb88a4,'list_name':_0x19736d};try{const _0x4103c8=yield Fetch['post'](_0x406337,_0x3d6d92,_0x518a1d);if(_0x4103c8['status']>0xc7&&_0x4103c8['status']<0x12c){const _0x3ab7f9=yield _0x4103c8['json']();return new SuccessfulAccountResponse(_0x3ab7f9);}const _0x1e64d8=yield _0x4103c8['json']();return new FailedAccountResponse(_0x1e64d8);}catch(_0x410dcb){if(_0x410dcb instanceof Error)return new FailedAccountResponse({'detail':_0x410dcb['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x410dcb;}});}['remove'](_0x401ec9,_0x38fb25,_0x2b1f28){return __awaiter$2(this,arguments,void 0,function*(_0x3b3c04,_0x2c150d,_0x5dd0b5,_0x1543e0={}){var _0x3fb2df;let _0x14fcaa=(_0x3fb2df=_0x1543e0['baseUri'])!==null&&_0x3fb2df!==void 0?_0x3fb2df:this['baseUri'];_0x14fcaa=_0x14fcaa+'/List/'+_0x2c150d+'/'+_0x5dd0b5;const _0x35111c=yield Fetch['delete'](_0x14fcaa,_0x3b3c04);try{if(_0x35111c['status']>0xc7&&_0x35111c['status']<0x12c){const _0x177c6e=yield _0x35111c['json']();return new SuccessfulAccountResponse(_0x177c6e);}const _0x2b510e=yield _0x35111c['json']();return new FailedAccountResponse(_0x2b510e);}catch(_0x6af92b){if(_0x6af92b instanceof Error)return new FailedAccountResponse({'detail':_0x6af92b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x6af92b;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x13d0b2,_0x1dc69c,_0x5b894f,_0x4481e3){function _0x1bebd9(_0x4a5330){return _0x4a5330 instanceof _0x5b894f?_0x4a5330:new _0x5b894f(function(_0x48d409){_0x48d409(_0x4a5330);});}return new(_0x5b894f||(_0x5b894f=Promise))(function(_0x36e1ea,_0x597573){function _0x511810(_0x2f888a){try{_0x1033fb(_0x4481e3['next'](_0x2f888a));}catch(_0x27d3a4){_0x597573(_0x27d3a4);}}function _0x3d2869(_0x22d36a){try{_0x1033fb(_0x4481e3['throw'](_0x22d36a));}catch(_0x26e25d){_0x597573(_0x26e25d);}}function _0x1033fb(_0x3ba344){_0x3ba344['done']?_0x36e1ea(_0x3ba344['value']):_0x1bebd9(_0x3ba344['value'])['then'](_0x511810,_0x3d2869);}_0x1033fb((_0x4481e3=_0x4481e3['apply'](_0x13d0b2,_0x1dc69c||[]))['next']());});};class TokenManager{constructor(_0x311f94){this['securityService']=_0x311f94;}['RefreshTokens'](_0x147891){return __awaiter$1(this,arguments,void 0,function*(_0x12cb53,_0x54dbdc={}){if(Date['now']()<_0x12cb53['access_expires'])return new SuccessfulRefreshResponse(_0x12cb53);if(Date['now']()>_0x12cb53['refresh_expires']){const _0x2aa281={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x2aa281);}const _0x1bd062=yield this['securityService']['refresh'](_0x12cb53['refresh_token'],_0x54dbdc);if(!_0x1bd062['isSuccess'])return new FailedRefreshResponse(_0x1bd062['toProblem']());return new SuccessfulRefreshResponse(_0x1bd062['toSuccess']());});}}
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1fe604,_0xd30969,_0x53137a,_0x594e93){function _0x581043(_0x2c726d){return _0x2c726d instanceof _0x53137a?_0x2c726d:new _0x53137a(function(_0x2c972a){_0x2c972a(_0x2c726d);});}return new(_0x53137a||(_0x53137a=Promise))(function(_0x193495,_0x4fcdb9){function _0x167eff(_0x465229){try{_0x10dfeb(_0x594e93['next'](_0x465229));}catch(_0x51560a){_0x4fcdb9(_0x51560a);}}function _0x53caa6(_0x32f569){try{_0x10dfeb(_0x594e93['throw'](_0x32f569));}catch(_0x2186c8){_0x4fcdb9(_0x2186c8);}}function _0x10dfeb(_0x5d734a){_0x5d734a['done']?_0x193495(_0x5d734a['value']):_0x581043(_0x5d734a['value'])['then'](_0x167eff,_0x53caa6);}_0x10dfeb((_0x594e93=_0x594e93['apply'](_0x1fe604,_0xd30969||[]))['next']());});};class SecurityService{constructor(_0x83d81e){this['baseUri']=_0x83d81e,this['tokenManager']=new TokenManager(this);}['refresh'](_0x2c3694){return __awaiter(this,arguments,void 0,function*(_0x178481,_0x29e69a={}){var _0x56407f;let _0x4ea5b1=(_0x56407f=_0x29e69a['baseUri'])!==null&&_0x56407f!==void 0?_0x56407f:this['baseUri'];!_0x4ea5b1['endsWith']('/')&&(_0x4ea5b1=_0x4ea5b1+'/');_0x4ea5b1=_0x4ea5b1+'Security/Refresh';try{const _0x3774dd=yield Fetch['post'](_0x4ea5b1,_0x178481,null);if(_0x3774dd['status']>0xc7&&_0x3774dd['status']<0x12c){const _0x47c691=yield _0x3774dd['json']();return new SuccessfulRefreshResponse(_0x47c691);}const _0x274ee3=yield _0x3774dd['json']();return new FailedRefreshResponse(_0x274ee3);}catch(_0x8f60e8){if(_0x8f60e8 instanceof Error)return new FailedRefreshResponse({'detail':_0x8f60e8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x8f60e8;}});}}
|
|
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']),AdminClient['ApiKeys']=new ApiKeyService(_a['baseUri']);
|
|
14
16
|
|
|
15
17
|
export { AdminClient };
|
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ declare class AccountService {
|
|
|
4
4
|
get(accessToken: string, accountName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
declare class ApiKeyService {
|
|
8
|
+
readonly baseUri: string;
|
|
9
|
+
constructor(baseUri: string);
|
|
10
|
+
create(access_token: string, accountName: string, api_key_name: string, options?: Partial<Options>): Promise<Response<ApiKey, Problem>>;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
declare class ListService {
|
|
8
14
|
readonly baseUri: string;
|
|
9
15
|
constructor(baseUri: string);
|
|
@@ -29,6 +35,7 @@ declare class AdminClient {
|
|
|
29
35
|
static Accounts: AccountService;
|
|
30
36
|
static Lists: ListService;
|
|
31
37
|
static Security: SecurityService;
|
|
38
|
+
static ApiKeys: ApiKeyService;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
type Options = {
|
|
@@ -42,6 +49,18 @@ declare abstract class Response<S, F> {
|
|
|
42
49
|
}
|
|
43
50
|
type List = {
|
|
44
51
|
name: string;
|
|
52
|
+
created: number;
|
|
53
|
+
version: number;
|
|
54
|
+
};
|
|
55
|
+
type ListIdentity = {
|
|
56
|
+
name: string;
|
|
57
|
+
created: number;
|
|
58
|
+
account_name: string;
|
|
59
|
+
image_path: string;
|
|
60
|
+
};
|
|
61
|
+
type ApiKey = {
|
|
62
|
+
name: string;
|
|
63
|
+
created: number;
|
|
45
64
|
};
|
|
46
65
|
type Error = {
|
|
47
66
|
[key: string]: string[];
|
|
@@ -56,8 +75,10 @@ type Problem = {
|
|
|
56
75
|
type Account = {
|
|
57
76
|
name: string;
|
|
58
77
|
owner: string;
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
created: number;
|
|
79
|
+
image_path: string;
|
|
80
|
+
lists: ListIdentity[];
|
|
81
|
+
api_keys: ApiKey[];
|
|
61
82
|
};
|
|
62
83
|
type Tokens = {
|
|
63
84
|
access_token: string;
|
|
@@ -89,5 +110,17 @@ declare class FailedRefreshResponse extends Response<Tokens, Problem> {
|
|
|
89
110
|
toSuccess(): Tokens;
|
|
90
111
|
toProblem(): Problem;
|
|
91
112
|
}
|
|
113
|
+
declare class SuccessfulApiKeyResponse extends Response<ApiKey, Problem> {
|
|
114
|
+
readonly apiKey: ApiKey;
|
|
115
|
+
constructor(apiKey: ApiKey);
|
|
116
|
+
toSuccess(): ApiKey;
|
|
117
|
+
toProblem(): Problem;
|
|
118
|
+
}
|
|
119
|
+
declare class FailedApiKeyResponse extends Response<ApiKey, Problem> {
|
|
120
|
+
readonly problem: Problem;
|
|
121
|
+
constructor(problem: Problem);
|
|
122
|
+
toSuccess(): ApiKey;
|
|
123
|
+
toProblem(): Problem;
|
|
124
|
+
}
|
|
92
125
|
|
|
93
|
-
export { type Account, AdminClient, type Error, FailedAccountResponse, FailedRefreshResponse, type List, type Options, type Problem, Response, SuccessfulAccountResponse, SuccessfulRefreshResponse, type Tokens };
|
|
126
|
+
export { type Account, AdminClient, type ApiKey, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedRefreshResponse, type List, type ListIdentity, type Options, type Problem, Response, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulRefreshResponse, type Tokens };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2cff20,_0x5442f5,_0x167e7e,_0x34cb7a){function _0x386c69(_0x4677b4){return _0x4677b4 instanceof _0x167e7e?_0x4677b4:new _0x167e7e(function(_0xdb9814){_0xdb9814(_0x4677b4);});}return new(_0x167e7e||(_0x167e7e=Promise))(function(_0x2bbfb4,_0x399d6b){function _0x1946c5(_0xa3a44e){try{_0x181e0b(_0x34cb7a['next'](_0xa3a44e));}catch(_0x27a199){_0x399d6b(_0x27a199);}}function _0x89c149(_0xa237d8){try{_0x181e0b(_0x34cb7a['throw'](_0xa237d8));}catch(_0x20ad36){_0x399d6b(_0x20ad36);}}function _0x181e0b(_0x1a0a9f){_0x1a0a9f['done']?_0x2bbfb4(_0x1a0a9f['value']):_0x386c69(_0x1a0a9f['value'])['then'](_0x1946c5,_0x89c149);}_0x181e0b((_0x34cb7a=_0x34cb7a['apply'](_0x2cff20,_0x5442f5||[]))['next']());});};class Fetch{static['get'](_0x706446,_0x2ae69c){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x706446,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2ae69c}});});}static['post'](_0x56c368,_0x58b7f2,_0x27a974){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x56c368,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x58b7f2},'body':_0x27a974?JSON['stringify'](_0x27a974):null});});}static['put'](_0x369fde,_0x56ed2e,_0x4c70d6){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x369fde,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x56ed2e},'body':_0x4c70d6?JSON['stringify'](_0x4c70d6):null});});}static['delete'](_0x54eba5,_0x5c09d5){return __awaiter$4(this,void 0,void 0,function*(){return yield fetch(_0x54eba5,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5c09d5}});});}}
|
|
2
|
-
|
|
3
|
-
class Response{constructor(_0x59970d){this['isSuccess']=_0x59970d;}}class SuccessfulAccountResponse extends Response{constructor(_0x18096a){super(!![]),this['account']=_0x18096a;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x217ed1){super(![]),this['problem']=_0x217ed1;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x165c91){super(!![]),this['tokens']=_0x165c91;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x1cff2e){super(![]),this['problem']=_0x1cff2e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x598296,_0x3eb87b,_0x3c2aa8,_0x3a6ab0){function _0x3870b8(_0x20cbe3){return _0x20cbe3 instanceof _0x3c2aa8?_0x20cbe3:new _0x3c2aa8(function(_0x561f68){_0x561f68(_0x20cbe3);});}return new(_0x3c2aa8||(_0x3c2aa8=Promise))(function(_0x329093,_0x12fda3){function _0x569ea6(_0x1352cb){try{_0x115968(_0x3a6ab0['next'](_0x1352cb));}catch(_0x24db1e){_0x12fda3(_0x24db1e);}}function _0x3db789(_0x34e6f0){try{_0x115968(_0x3a6ab0['throw'](_0x34e6f0));}catch(_0x2eb4d8){_0x12fda3(_0x2eb4d8);}}function _0x115968(_0x1ffedf){_0x1ffedf['done']?_0x329093(_0x1ffedf['value']):_0x3870b8(_0x1ffedf['value'])['then'](_0x569ea6,_0x3db789);}_0x115968((_0x3a6ab0=_0x3a6ab0['apply'](_0x598296,_0x3eb87b||[]))['next']());});};class AccountService{constructor(_0x5d4f70){this['baseUri']=_0x5d4f70;}['get'](_0x13c9ef,_0x53fa98){return __awaiter$3(this,arguments,void 0,function*(_0x537cd2,_0x4a1daf,_0x50f71a={}){var _0x22b999;let _0x211bd3=(_0x22b999=_0x50f71a['baseUri'])!==null&&_0x22b999!==void 0?_0x22b999:this['baseUri'];!_0x211bd3['endsWith']('/')&&(_0x211bd3=_0x211bd3+'/');_0x211bd3=_0x211bd3+'Account/'+_0x4a1daf+'/';const _0x198c77=yield Fetch['get'](_0x211bd3,_0x537cd2);try{if(_0x198c77['status']>0xc7&&_0x198c77['status']<0x12c){const _0x342e21=yield _0x198c77['json']();return new SuccessfulAccountResponse(_0x342e21);}const _0x1c8e8d=yield _0x198c77['json']();return new FailedAccountResponse(_0x1c8e8d);}catch(_0xe8bb28){if(_0xe8bb28 instanceof Error)return new FailedAccountResponse({'detail':_0xe8bb28['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xe8bb28;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x194318,_0x5abc0c,_0x2fb170,_0x4b8b7c){function _0x45d9cb(_0x541db){return _0x541db instanceof _0x2fb170?_0x541db:new _0x2fb170(function(_0x466e58){_0x466e58(_0x541db);});}return new(_0x2fb170||(_0x2fb170=Promise))(function(_0x4752e3,_0x557e17){function _0x536b58(_0x5f2db1){try{_0x153f68(_0x4b8b7c['next'](_0x5f2db1));}catch(_0x3e2aeb){_0x557e17(_0x3e2aeb);}}function _0x56d389(_0x4d1fde){try{_0x153f68(_0x4b8b7c['throw'](_0x4d1fde));}catch(_0x4b5188){_0x557e17(_0x4b5188);}}function _0x153f68(_0x36c095){_0x36c095['done']?_0x4752e3(_0x36c095['value']):_0x45d9cb(_0x36c095['value'])['then'](_0x536b58,_0x56d389);}_0x153f68((_0x4b8b7c=_0x4b8b7c['apply'](_0x194318,_0x5abc0c||[]))['next']());});};class ListService{constructor(_0x7a200a){this['baseUri']=_0x7a200a;}['add'](_0x351367,_0x7652a,_0x8858f3){return __awaiter$2(this,arguments,void 0,function*(_0x15df6c,_0x3fb823,_0x18c57d,_0x295dd3={}){var _0x5b02ce;let _0x1744be=(_0x5b02ce=_0x295dd3['baseUri'])!==null&&_0x5b02ce!==void 0?_0x5b02ce:this['baseUri'];!_0x1744be['endsWith']('/')&&(_0x1744be=_0x1744be+'/');_0x1744be=_0x1744be+'List';const _0x100b44={'account_name':_0x3fb823,'list_name':_0x18c57d};try{const _0x3c03fd=yield Fetch['post'](_0x1744be,_0x15df6c,_0x100b44);if(_0x3c03fd['status']>0xc7&&_0x3c03fd['status']<0x12c){const _0x5517af=yield _0x3c03fd['json']();return new SuccessfulAccountResponse(_0x5517af);}const _0xd9d7b5=yield _0x3c03fd['json']();return new FailedAccountResponse(_0xd9d7b5);}catch(_0x53aff3){if(_0x53aff3 instanceof Error)return new FailedAccountResponse({'detail':_0x53aff3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x53aff3;}});}['remove'](_0x3515ab,_0x1ca46c,_0x2b185a){return __awaiter$2(this,arguments,void 0,function*(_0x1fee2b,_0x25f937,_0x221f40,_0x43990a={}){var _0x4bc1e8;let _0x4de987=(_0x4bc1e8=_0x43990a['baseUri'])!==null&&_0x4bc1e8!==void 0?_0x4bc1e8:this['baseUri'];_0x4de987=_0x4de987+'/List/'+_0x25f937+'/'+_0x221f40;const _0x3a217f=yield Fetch['delete'](_0x4de987,_0x1fee2b);try{if(_0x3a217f['status']>0xc7&&_0x3a217f['status']<0x12c){const _0x21aaf3=yield _0x3a217f['json']();return new SuccessfulAccountResponse(_0x21aaf3);}const _0xaad654=yield _0x3a217f['json']();return new FailedAccountResponse(_0xaad654);}catch(_0x14054c){if(_0x14054c instanceof Error)return new FailedAccountResponse({'detail':_0x14054c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x14054c;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4986c2,_0x5b9136,_0x26daf6,_0x291128){function _0x15a75a(_0x3fae56){return _0x3fae56 instanceof _0x26daf6?_0x3fae56:new _0x26daf6(function(_0x11f73b){_0x11f73b(_0x3fae56);});}return new(_0x26daf6||(_0x26daf6=Promise))(function(_0x2f5ad4,_0x3c3003){function _0x5a7630(_0x52756e){try{_0x294dd6(_0x291128['next'](_0x52756e));}catch(_0x584e70){_0x3c3003(_0x584e70);}}function _0x168f06(_0x55d234){try{_0x294dd6(_0x291128['throw'](_0x55d234));}catch(_0x4f9462){_0x3c3003(_0x4f9462);}}function _0x294dd6(_0x1d1a0f){_0x1d1a0f['done']?_0x2f5ad4(_0x1d1a0f['value']):_0x15a75a(_0x1d1a0f['value'])['then'](_0x5a7630,_0x168f06);}_0x294dd6((_0x291128=_0x291128['apply'](_0x4986c2,_0x5b9136||[]))['next']());});};class TokenManager{constructor(_0x1a5694){this['securityService']=_0x1a5694;}['RefreshTokens'](_0x19fb29){return __awaiter$1(this,arguments,void 0,function*(_0x552e1c,_0x4062e0={}){if(Date['now']()<_0x552e1c['access_expires'])return new SuccessfulRefreshResponse(_0x552e1c);if(Date['now']()>_0x552e1c['refresh_expires']){const _0x2775b4={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x2775b4);}const _0x3f71b8=yield this['securityService']['refresh'](_0x552e1c['refresh_token'],_0x4062e0);if(!_0x3f71b8['isSuccess'])return new FailedRefreshResponse(_0x3f71b8['toProblem']());return new SuccessfulRefreshResponse(_0x3f71b8['toSuccess']());});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x343323,_0x4250e9,_0x5c1ab1,_0x195747){function _0x1af5f9(_0x4c6954){return _0x4c6954 instanceof _0x5c1ab1?_0x4c6954:new _0x5c1ab1(function(_0x2f3eca){_0x2f3eca(_0x4c6954);});}return new(_0x5c1ab1||(_0x5c1ab1=Promise))(function(_0x23e370,_0x3d0ddd){function _0x20b4c7(_0x1de192){try{_0x41b2ce(_0x195747['next'](_0x1de192));}catch(_0x5cace7){_0x3d0ddd(_0x5cace7);}}function _0x3dd326(_0x572b32){try{_0x41b2ce(_0x195747['throw'](_0x572b32));}catch(_0x500ae7){_0x3d0ddd(_0x500ae7);}}function _0x41b2ce(_0x56d32a){_0x56d32a['done']?_0x23e370(_0x56d32a['value']):_0x1af5f9(_0x56d32a['value'])['then'](_0x20b4c7,_0x3dd326);}_0x41b2ce((_0x195747=_0x195747['apply'](_0x343323,_0x4250e9||[]))['next']());});};class SecurityService{constructor(_0x3dbc0f){this['baseUri']=_0x3dbc0f,this['tokenManager']=new TokenManager(this);}['refresh'](_0x78c5ef){return __awaiter(this,arguments,void 0,function*(_0x156c27,_0x4dc098={}){var _0x2ec09c;let _0x5680df=(_0x2ec09c=_0x4dc098['baseUri'])!==null&&_0x2ec09c!==void 0?_0x2ec09c:this['baseUri'];!_0x5680df['endsWith']('/')&&(_0x5680df=_0x5680df+'/');_0x5680df=_0x5680df+'Security/Refresh';try{const _0x47337d=yield Fetch['post'](_0x5680df,_0x156c27,null);if(_0x47337d['status']>0xc7&&_0x47337d['status']<0x12c){const _0x5512c6=yield _0x47337d['json']();return new SuccessfulRefreshResponse(_0x5512c6);}const _0x162b2e=yield _0x47337d['json']();return new FailedRefreshResponse(_0x162b2e);}catch(_0x5588be){if(_0x5588be instanceof Error)return new FailedRefreshResponse({'detail':_0x5588be['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5588be;}});}}
|
|
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 };
|