@searchability/admin-client 0.0.10 → 0.0.11
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(_0x1d13b0,_0x3d42ae,_0xab9ec7,_0x73414a){function _0x532105(_0x390b2e){return _0x390b2e instanceof _0xab9ec7?_0x390b2e:new _0xab9ec7(function(_0x14b4f8){_0x14b4f8(_0x390b2e);});}return new(_0xab9ec7||(_0xab9ec7=Promise))(function(_0x466613,_0xc71abf){function _0x5cd4c4(_0x4fe3fc){try{_0x4bf9ff(_0x73414a['next'](_0x4fe3fc));}catch(_0x24aca9){_0xc71abf(_0x24aca9);}}function _0x44db0b(_0x5b3d3e){try{_0x4bf9ff(_0x73414a['throw'](_0x5b3d3e));}catch(_0xcf233c){_0xc71abf(_0xcf233c);}}function _0x4bf9ff(_0x5628f5){_0x5628f5['done']?_0x466613(_0x5628f5['value']):_0x532105(_0x5628f5['value'])['then'](_0x5cd4c4,_0x44db0b);}_0x4bf9ff((_0x73414a=_0x73414a['apply'](_0x1d13b0,_0x3d42ae||[]))['next']());});};class Fetch{static['get'](_0x3caf43,_0x51d334){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x3caf43,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x51d334}});});}static['post'](_0x32d54c,_0x1a5b83,_0x3b8dc3){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x32d54c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1a5b83},'body':_0x3b8dc3?JSON['stringify'](_0x3b8dc3):null});});}static['put'](_0x1019f1,_0x44faea,_0x7fd7da){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x1019f1,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x44faea},'body':_0x7fd7da?JSON['stringify'](_0x7fd7da):null});});}static['delete'](_0x129902,_0x5947cc){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x129902,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5947cc}});});}}
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x4fd06a){this['isSuccess']=_0x4fd06a;}}class SuccessfulAccountResponse extends Response{constructor(_0x26533b){super(!![]),this['account']=_0x26533b;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x282b89){super(![]),this['problem']=_0x282b89;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x1eb133){super(!![]),this['tokens']=_0x1eb133;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x48b16b){super(![]),this['problem']=_0x48b16b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x5cf265){super(!![]),this['apiKey']=_0x5cf265;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x2dc79e){super(![]),this['problem']=_0x2dc79e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x4ffa3f,_0xa4cf47,_0x44af39,_0x1fd39d){function _0x5a1266(_0x3d4fad){return _0x3d4fad instanceof _0x44af39?_0x3d4fad:new _0x44af39(function(_0x3f6718){_0x3f6718(_0x3d4fad);});}return new(_0x44af39||(_0x44af39=Promise))(function(_0xa12953,_0x22c6c2){function _0x54c0b3(_0x533fc0){try{_0x29d943(_0x1fd39d['next'](_0x533fc0));}catch(_0x543c97){_0x22c6c2(_0x543c97);}}function _0x5db6ee(_0x3ea0fb){try{_0x29d943(_0x1fd39d['throw'](_0x3ea0fb));}catch(_0x17ba1e){_0x22c6c2(_0x17ba1e);}}function _0x29d943(_0x2d3082){_0x2d3082['done']?_0xa12953(_0x2d3082['value']):_0x5a1266(_0x2d3082['value'])['then'](_0x54c0b3,_0x5db6ee);}_0x29d943((_0x1fd39d=_0x1fd39d['apply'](_0x4ffa3f,_0xa4cf47||[]))['next']());});};class AccountService{constructor(_0x1ec366,_0x266799){this['baseUri']=_0x1ec366,this['tokenManager']=_0x266799;}['get'](_0x3c8fd1,_0x18795c){return __awaiter$4(this,arguments,void 0,function*(_0x379169,_0x299215,_0x4a8bb5={}){var _0x310721;const _0x1f5d82=yield this['tokenManager']['getTokens'](_0x299215,_0x4a8bb5);if(!_0x1f5d82['isSuccess'])return new FailedAccountResponse(_0x1f5d82['toProblem']());_0x299215=_0x1f5d82['toSuccess']();let _0x44f018=(_0x310721=_0x4a8bb5['baseUri'])!==null&&_0x310721!==void 0?_0x310721:this['baseUri'];!_0x44f018['endsWith']('/')&&(_0x44f018=_0x44f018+'/');_0x44f018=_0x44f018+'Account/'+_0x379169+'/';const _0x4744a3=yield Fetch['get'](_0x44f018,_0x299215['access_token']);try{if(_0x4744a3['status']>0xc7&&_0x4744a3['status']<0x12c){const _0x52c2ed=yield _0x4744a3['json']();return new SuccessfulAccountResponse(_0x52c2ed);}const _0x5ee3db=yield _0x4744a3['json']();return new FailedAccountResponse(_0x5ee3db);}catch(_0x32c6c8){if(_0x32c6c8 instanceof Error)return new FailedAccountResponse({'detail':_0x32c6c8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x32c6c8;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x553fe2,_0x91110c,_0x47f4ed,_0xfc017a){function _0x29da9f(_0x3ab0f2){return _0x3ab0f2 instanceof _0x47f4ed?_0x3ab0f2:new _0x47f4ed(function(_0x57aacb){_0x57aacb(_0x3ab0f2);});}return new(_0x47f4ed||(_0x47f4ed=Promise))(function(_0x4d1929,_0x283084){function _0x11896a(_0x2161e2){try{_0x5a1e1a(_0xfc017a['next'](_0x2161e2));}catch(_0x4ed828){_0x283084(_0x4ed828);}}function _0x5aa614(_0x1edd10){try{_0x5a1e1a(_0xfc017a['throw'](_0x1edd10));}catch(_0x23a8df){_0x283084(_0x23a8df);}}function _0x5a1e1a(_0x55632e){_0x55632e['done']?_0x4d1929(_0x55632e['value']):_0x29da9f(_0x55632e['value'])['then'](_0x11896a,_0x5aa614);}_0x5a1e1a((_0xfc017a=_0xfc017a['apply'](_0x553fe2,_0x91110c||[]))['next']());});};class ApiKeyService{constructor(_0x4b0c25,_0xae10b0){this['baseUri']=_0x4b0c25,this['tokenManager']=_0xae10b0;}['create'](_0x1d9c86,_0x2ea307,_0x387b6d){return __awaiter$3(this,arguments,void 0,function*(_0x407244,_0x31d9b3,_0x4bb875,_0x5b7d61={}){var _0x153b0b;const _0x2b9a16=yield this['tokenManager']['getTokens'](_0x4bb875,_0x5b7d61);if(!_0x2b9a16['isSuccess'])return new FailedApiKeyResponse(_0x2b9a16['toProblem']());_0x4bb875=_0x2b9a16['toSuccess']();let _0x5f0442=(_0x153b0b=_0x5b7d61['baseUri'])!==null&&_0x153b0b!==void 0?_0x153b0b:this['baseUri'];!_0x5f0442['endsWith']('/')&&(_0x5f0442=_0x5f0442+'/');_0x5f0442=_0x5f0442+'ApiKey/Create';const _0x273784={'account_name':_0x407244,'name':_0x31d9b3};try{const _0x111c61=yield Fetch['post'](_0x5f0442,_0x4bb875['access_token'],_0x273784);if(_0x111c61['status']>0xc7&&_0x111c61['status']<0x12c){const _0x555697=yield _0x111c61['json']();return new SuccessfulApiKeyResponse(_0x555697);}const _0x5e6616=yield _0x111c61['json']();return new FailedApiKeyResponse(_0x5e6616);}catch(_0xd6defe){if(_0xd6defe instanceof Error)return new FailedApiKeyResponse({'detail':_0xd6defe['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0xd6defe;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x121fc3,_0x54cb5d,_0x3b5ede,_0x4aca4e){function _0x12564e(_0x54290f){return _0x54290f instanceof _0x3b5ede?_0x54290f:new _0x3b5ede(function(_0x4f05c6){_0x4f05c6(_0x54290f);});}return new(_0x3b5ede||(_0x3b5ede=Promise))(function(_0x42018f,_0x695d18){function _0x4ac83d(_0x336810){try{_0x3cac0f(_0x4aca4e['next'](_0x336810));}catch(_0x5c6951){_0x695d18(_0x5c6951);}}function _0x190539(_0x125008){try{_0x3cac0f(_0x4aca4e['throw'](_0x125008));}catch(_0x111049){_0x695d18(_0x111049);}}function _0x3cac0f(_0x1d219e){_0x1d219e['done']?_0x42018f(_0x1d219e['value']):_0x12564e(_0x1d219e['value'])['then'](_0x4ac83d,_0x190539);}_0x3cac0f((_0x4aca4e=_0x4aca4e['apply'](_0x121fc3,_0x54cb5d||[]))['next']());});};class ListService{constructor(_0x5d2027,_0x2a2d59){this['baseUri']=_0x5d2027,this['tokenManager']=_0x2a2d59;}['add'](_0x5e8b56,_0x566b66,_0x3df5cb){return __awaiter$2(this,arguments,void 0,function*(_0x2e2c1c,_0x2445b4,_0x1a5012,_0x475d9c={}){var _0x66dd87;const _0x222bdb=yield this['tokenManager']['getTokens'](_0x1a5012,_0x475d9c);if(!_0x222bdb['isSuccess'])return new FailedAccountResponse(_0x222bdb['toProblem']());_0x1a5012=_0x222bdb['toSuccess']();let _0x240e98=(_0x66dd87=_0x475d9c['baseUri'])!==null&&_0x66dd87!==void 0?_0x66dd87:this['baseUri'];!_0x240e98['endsWith']('/')&&(_0x240e98=_0x240e98+'/');_0x240e98=_0x240e98+'List';const _0x1d871a={'account_name':_0x2e2c1c,'list_name':_0x2445b4};try{const _0x14e817=yield Fetch['post'](_0x240e98,_0x1a5012['access_token'],_0x1d871a);if(_0x14e817['status']>0xc7&&_0x14e817['status']<0x12c){const _0x2ff81b=yield _0x14e817['json']();return new SuccessfulAccountResponse(_0x2ff81b);}const _0x53a8e6=yield _0x14e817['json']();return new FailedAccountResponse(_0x53a8e6);}catch(_0x39105f){if(_0x39105f instanceof Error)return new FailedAccountResponse({'detail':_0x39105f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x39105f;}});}['remove'](_0x22c985,_0x139405,_0x4e6240){return __awaiter$2(this,arguments,void 0,function*(_0x391026,_0x5837b6,_0xffd8f7,_0x18b582={}){var _0xcafa2a;const _0x106068=yield this['tokenManager']['getTokens'](_0xffd8f7,_0x18b582);if(!_0x106068['isSuccess'])return new FailedAccountResponse(_0x106068['toProblem']());_0xffd8f7=_0x106068['toSuccess']();let _0x17826c=(_0xcafa2a=_0x18b582['baseUri'])!==null&&_0xcafa2a!==void 0?_0xcafa2a:this['baseUri'];_0x17826c=_0x17826c+'/List/'+_0x391026+'/'+_0x5837b6;const _0x1e2e26=yield Fetch['delete'](_0x17826c,_0xffd8f7['access_token']);try{if(_0x1e2e26['status']>0xc7&&_0x1e2e26['status']<0x12c){const _0x768e13=yield _0x1e2e26['json']();return new SuccessfulAccountResponse(_0x768e13);}const _0x15b5c4=yield _0x1e2e26['json']();return new FailedAccountResponse(_0x15b5c4);}catch(_0x851003){if(_0x851003 instanceof Error)return new FailedAccountResponse({'detail':_0x851003['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x851003;}});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xc0fe81,_0x320b27,_0x3cb5a2,_0x1d8d0f){function _0x39806c(_0x4b2180){return _0x4b2180 instanceof _0x3cb5a2?_0x4b2180:new _0x3cb5a2(function(_0x804716){_0x804716(_0x4b2180);});}return new(_0x3cb5a2||(_0x3cb5a2=Promise))(function(_0x92e3ad,_0x5e3547){function _0x26506a(_0x437be6){try{_0x16d858(_0x1d8d0f['next'](_0x437be6));}catch(_0x1a5d1a){_0x5e3547(_0x1a5d1a);}}function _0x10faa5(_0x2fb88b){try{_0x16d858(_0x1d8d0f['throw'](_0x2fb88b));}catch(_0x1b3f12){_0x5e3547(_0x1b3f12);}}function _0x16d858(_0x281f2a){_0x281f2a['done']?_0x92e3ad(_0x281f2a['value']):_0x39806c(_0x281f2a['value'])['then'](_0x26506a,_0x10faa5);}_0x16d858((_0x1d8d0f=_0x1d8d0f['apply'](_0xc0fe81,_0x320b27||[]))['next']());});};class TokenManager{constructor(_0x16bca5){this['tokenService']=_0x16bca5,this['getTokens']=(_0x1de18b,..._0xbc9d9b)=>__awaiter$1(this,[_0x1de18b,..._0xbc9d9b],void 0,function*(_0x299c54,_0x304928={}){if(_0x299c54){var _0x1a5db1=yield this['refreshIfExpired'](_0x299c54,_0x304928);if(_0x1a5db1['isSuccess'])return _0x1a5db1;}return yield this['tokenService']['get'](_0x304928);});}['refreshIfExpired'](_0x189c32){return __awaiter$1(this,arguments,void 0,function*(_0x4a75ca,_0x1d3081={}){if(Date['now']()<_0x4a75ca['access_expires'])return new SuccessfulRefreshResponse(_0x4a75ca);if(Date['now']()>_0x4a75ca['refresh_expires']){const _0x5dd648={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x5dd648);}return yield this['tokenService']['refresh'](_0x4a75ca['refresh_token'],_0x1d3081);});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x1e659c,_0x5426aa,_0x9ed6b3,_0x1e8f26){function _0x50fdb3(_0x467902){return _0x467902 instanceof _0x9ed6b3?_0x467902:new _0x9ed6b3(function(_0x430cff){_0x430cff(_0x467902);});}return new(_0x9ed6b3||(_0x9ed6b3=Promise))(function(_0x17b5ed,_0x3a433e){function _0x245631(_0xbe16d4){try{_0x2a1dca(_0x1e8f26['next'](_0xbe16d4));}catch(_0x18b443){_0x3a433e(_0x18b443);}}function _0x51aadd(_0x33650f){try{_0x2a1dca(_0x1e8f26['throw'](_0x33650f));}catch(_0x220efe){_0x3a433e(_0x220efe);}}function _0x2a1dca(_0x518f5e){_0x518f5e['done']?_0x17b5ed(_0x518f5e['value']):_0x50fdb3(_0x518f5e['value'])['then'](_0x245631,_0x51aadd);}_0x2a1dca((_0x1e8f26=_0x1e8f26['apply'](_0x1e659c,_0x5426aa||[]))['next']());});};class TokenService{constructor(_0x5cc337,_0x2fd825){this['apiKey']=_0x5cc337,this['baseUri']=_0x2fd825;}['get'](){return __awaiter(this,arguments,void 0,function*(_0x403c2c={}){var _0x3feb4d;let _0xc08cd0=(_0x3feb4d=_0x403c2c['baseUri'])!==null&&_0x3feb4d!==void 0?_0x3feb4d:this['baseUri'];!_0xc08cd0['endsWith']('/')&&(_0xc08cd0=_0xc08cd0+'/');_0xc08cd0=_0xc08cd0+'tokens/get/'+this['apiKey'];try{const _0x55cc4b=yield yield fetch(_0xc08cd0,{'method':'POST','headers':{'Content-Type':'application/json'}});if(_0x55cc4b['status']>0xc7&&_0x55cc4b['status']<0x12c){const _0x4700f5=yield _0x55cc4b['json']();return new SuccessfulRefreshResponse(_0x4700f5);}const _0x4b74c3=yield _0x55cc4b['json']();return new FailedRefreshResponse(_0x4b74c3);}catch(_0x8c9d9b){if(_0x8c9d9b instanceof Error)return new FailedRefreshResponse({'detail':_0x8c9d9b['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x8c9d9b;}});}['refresh'](_0x16c8e0){return __awaiter(this,arguments,void 0,function*(_0x5a4047,_0x34caaa={}){var _0x2b3a65;let _0x3f3701=(_0x2b3a65=_0x34caaa['baseUri'])!==null&&_0x2b3a65!==void 0?_0x2b3a65:this['baseUri'];!_0x3f3701['endsWith']('/')&&(_0x3f3701=_0x3f3701+'/');_0x3f3701=_0x3f3701+'Tokens/Refresh';try{const _0x213d7d=yield Fetch['post'](_0x3f3701,_0x5a4047,null);if(_0x213d7d['status']>0xc7&&_0x213d7d['status']<0x12c){const _0xcb9421=yield _0x213d7d['json']();return new SuccessfulRefreshResponse(_0xcb9421);}const _0x58376d=yield _0x213d7d['json']();return new FailedRefreshResponse(_0x58376d);}catch(_0x10a756){if(_0x10a756 instanceof Error)return new FailedRefreshResponse({'detail':_0x10a756['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x10a756;}});}}
|
|
14
|
+
|
|
15
|
+
class AdminClient{constructor(_0x2ab150,_0x2a6874='https://admin.searchability.dev/'){this['apiKey']=_0x2ab150,this['baseUri']=_0x2a6874,this['Tokens']=new TokenService(_0x2ab150,this['baseUri']);const _0x46c84d=new TokenManager(this['Tokens']);this['Accounts']=new AccountService(this['baseUri'],_0x46c84d),this['Lists']=new ListService(this['baseUri'],_0x46c84d),this['ApiKeys']=new ApiKeyService(this['baseUri'],_0x46c84d);}}
|
|
16
|
+
|
|
17
|
+
export { AdminClient };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x461b16,_0x5692f7,_0x2d7e11,_0x50b24c){function _0x2ddde0(_0x4f0a79){return _0x4f0a79 instanceof _0x2d7e11?_0x4f0a79:new _0x2d7e11(function(_0x6586fe){_0x6586fe(_0x4f0a79);});}return new(_0x2d7e11||(_0x2d7e11=Promise))(function(_0x4a2b7f,_0x47d372){function _0x4f775d(_0x27b746){try{_0x50e6e7(_0x50b24c['next'](_0x27b746));}catch(_0x587f32){_0x47d372(_0x587f32);}}function _0x3e6cd5(_0x31000b){try{_0x50e6e7(_0x50b24c['throw'](_0x31000b));}catch(_0x4fcd9e){_0x47d372(_0x4fcd9e);}}function _0x50e6e7(_0x45affa){_0x45affa['done']?_0x4a2b7f(_0x45affa['value']):_0x2ddde0(_0x45affa['value'])['then'](_0x4f775d,_0x3e6cd5);}_0x50e6e7((_0x50b24c=_0x50b24c['apply'](_0x461b16,_0x5692f7||[]))['next']());});};class Fetch{static['get'](_0x12f720,_0x166be5){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x12f720,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x166be5}});});}static['post'](_0x1e2a2d,_0x13c36c,_0x4389d5){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x1e2a2d,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x13c36c},'body':_0x4389d5?JSON['stringify'](_0x4389d5):null});});}static['put'](_0x45510e,_0x4e5006,_0xf32ddf){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x45510e,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4e5006},'body':_0xf32ddf?JSON['stringify'](_0xf32ddf):null});});}static['delete'](_0xbdf614,_0x181e42){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0xbdf614,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x181e42}});});}}
|
|
4
4
|
|
|
5
|
-
class Response{constructor(
|
|
5
|
+
class Response{constructor(_0x81f3b3){this['isSuccess']=_0x81f3b3;}}class SuccessfulAccountResponse extends Response{constructor(_0x59fe39){super(!![]),this['account']=_0x59fe39;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x1ad066){super(![]),this['problem']=_0x1ad066;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x128015){super(!![]),this['tokens']=_0x128015;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x10ac26){super(![]),this['problem']=_0x10ac26;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x8958d7){super(!![]),this['apiKey']=_0x8958d7;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x455d0d){super(![]),this['problem']=_0x455d0d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x17e940,_0x16a747,_0x500e13,_0x1bee9f){function _0x29dd84(_0x596904){return _0x596904 instanceof _0x500e13?_0x596904:new _0x500e13(function(_0x2c0100){_0x2c0100(_0x596904);});}return new(_0x500e13||(_0x500e13=Promise))(function(_0x149995,_0x23b534){function _0x1b1edb(_0x9d80b8){try{_0x1008b0(_0x1bee9f['next'](_0x9d80b8));}catch(_0x5df73e){_0x23b534(_0x5df73e);}}function _0x2e0f1a(_0x2b0335){try{_0x1008b0(_0x1bee9f['throw'](_0x2b0335));}catch(_0x4d322e){_0x23b534(_0x4d322e);}}function _0x1008b0(_0xc1669c){_0xc1669c['done']?_0x149995(_0xc1669c['value']):_0x29dd84(_0xc1669c['value'])['then'](_0x1b1edb,_0x2e0f1a);}_0x1008b0((_0x1bee9f=_0x1bee9f['apply'](_0x17e940,_0x16a747||[]))['next']());});};class AccountService{constructor(_0x359860,_0x14d8aa){this['baseUri']=_0x359860,this['tokenManager']=_0x14d8aa;}['get'](_0x25020a,_0x109587){return __awaiter$4(this,arguments,void 0,function*(_0x4fbcd9,_0x19cade,_0x59e862={}){var _0x3b6952;const _0x254bf6=yield this['tokenManager']['getTokens'](_0x19cade,_0x59e862);if(!_0x254bf6['isSuccess'])return new FailedAccountResponse(_0x254bf6['toProblem']());_0x19cade=_0x254bf6['toSuccess']();let _0x4648db=(_0x3b6952=_0x59e862['baseUri'])!==null&&_0x3b6952!==void 0?_0x3b6952:this['baseUri'];!_0x4648db['endsWith']('/')&&(_0x4648db=_0x4648db+'/');_0x4648db=_0x4648db+'Account/'+_0x4fbcd9+'/';const _0x4154ea=yield Fetch['get'](_0x4648db,_0x19cade['access_token']);try{if(_0x4154ea['status']>0xc7&&_0x4154ea['status']<0x12c){const _0x4b2dfd=yield _0x4154ea['json']();return new SuccessfulAccountResponse(_0x4b2dfd);}const _0x6d9746=yield _0x4154ea['json']();return new FailedAccountResponse(_0x6d9746);}catch(_0x42b6a3){if(_0x42b6a3 instanceof Error)return new FailedAccountResponse({'detail':_0x42b6a3['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x42b6a3;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x148651,_0x3ea675,_0x2609a4,_0x425cc6){function _0x3b5e80(_0x30f5bc){return _0x30f5bc instanceof _0x2609a4?_0x30f5bc:new _0x2609a4(function(_0xd6aa5a){_0xd6aa5a(_0x30f5bc);});}return new(_0x2609a4||(_0x2609a4=Promise))(function(_0x39e9bf,_0x102157){function _0x40b71a(_0x2e32a0){try{_0x2201c9(_0x425cc6['next'](_0x2e32a0));}catch(_0xe22daf){_0x102157(_0xe22daf);}}function _0x493226(_0x4d2a36){try{_0x2201c9(_0x425cc6['throw'](_0x4d2a36));}catch(_0x164786){_0x102157(_0x164786);}}function _0x2201c9(_0x9f4c7a){_0x9f4c7a['done']?_0x39e9bf(_0x9f4c7a['value']):_0x3b5e80(_0x9f4c7a['value'])['then'](_0x40b71a,_0x493226);}_0x2201c9((_0x425cc6=_0x425cc6['apply'](_0x148651,_0x3ea675||[]))['next']());});};class ApiKeyService{constructor(_0x387766,_0x23f814){this['baseUri']=_0x387766,this['tokenManager']=_0x23f814;}['create'](_0x305fdb,_0x1ec7c3,_0x1f9b35){return __awaiter$3(this,arguments,void 0,function*(_0x5c2e98,_0x5f01a2,_0x46ffd9,_0x150cc6={}){var _0x5cb163;const _0xfe95b7=yield this['tokenManager']['getTokens'](_0x46ffd9,_0x150cc6);if(!_0xfe95b7['isSuccess'])return new FailedApiKeyResponse(_0xfe95b7['toProblem']());_0x46ffd9=_0xfe95b7['toSuccess']();let _0x3baa41=(_0x5cb163=_0x150cc6['baseUri'])!==null&&_0x5cb163!==void 0?_0x5cb163:this['baseUri'];!_0x3baa41['endsWith']('/')&&(_0x3baa41=_0x3baa41+'/');_0x3baa41=_0x3baa41+'ApiKey/Create';const _0x25e378={'account_name':_0x5c2e98,'name':_0x5f01a2};try{const _0x5297bc=yield Fetch['post'](_0x3baa41,_0x46ffd9['access_token'],_0x25e378);if(_0x5297bc['status']>0xc7&&_0x5297bc['status']<0x12c){const _0x53a7e6=yield _0x5297bc['json']();return new SuccessfulApiKeyResponse(_0x53a7e6);}const _0x336289=yield _0x5297bc['json']();return new FailedApiKeyResponse(_0x336289);}catch(_0x41acfa){if(_0x41acfa instanceof Error)return new FailedApiKeyResponse({'detail':_0x41acfa['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x41acfa;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x15b4a1,_0x3863c7,_0x1fcbda,_0x21cf8c){function _0x23e0bd(_0x2f9e05){return _0x2f9e05 instanceof _0x1fcbda?_0x2f9e05:new _0x1fcbda(function(_0x1fad3e){_0x1fad3e(_0x2f9e05);});}return new(_0x1fcbda||(_0x1fcbda=Promise))(function(_0x587dab,_0x268f56){function _0x555c50(_0x5d6a04){try{_0xc4e886(_0x21cf8c['next'](_0x5d6a04));}catch(_0x5c5776){_0x268f56(_0x5c5776);}}function _0x4e1d88(_0x5a01c0){try{_0xc4e886(_0x21cf8c['throw'](_0x5a01c0));}catch(_0x41ff48){_0x268f56(_0x41ff48);}}function _0xc4e886(_0x3acdbd){_0x3acdbd['done']?_0x587dab(_0x3acdbd['value']):_0x23e0bd(_0x3acdbd['value'])['then'](_0x555c50,_0x4e1d88);}_0xc4e886((_0x21cf8c=_0x21cf8c['apply'](_0x15b4a1,_0x3863c7||[]))['next']());});};class ListService{constructor(_0x271912,_0x41c158){this['baseUri']=_0x271912,this['tokenManager']=_0x41c158;}['add'](_0x482e6f,_0x139e65,_0x424e6f){return __awaiter$2(this,arguments,void 0,function*(_0x93037c,_0x37c32b,_0x339a1a,_0x64d5d1={}){var _0x19cc0f;const _0x3b4458=yield this['tokenManager']['getTokens'](_0x339a1a,_0x64d5d1);if(!_0x3b4458['isSuccess'])return new FailedAccountResponse(_0x3b4458['toProblem']());_0x339a1a=_0x3b4458['toSuccess']();let _0x2fc246=(_0x19cc0f=_0x64d5d1['baseUri'])!==null&&_0x19cc0f!==void 0?_0x19cc0f:this['baseUri'];!_0x2fc246['endsWith']('/')&&(_0x2fc246=_0x2fc246+'/');_0x2fc246=_0x2fc246+'List';const _0xa516bb={'account_name':_0x93037c,'list_name':_0x37c32b};try{const _0x3a9835=yield Fetch['post'](_0x2fc246,_0x339a1a['access_token'],_0xa516bb);if(_0x3a9835['status']>0xc7&&_0x3a9835['status']<0x12c){const _0xbb4cda=yield _0x3a9835['json']();return new SuccessfulAccountResponse(_0xbb4cda);}const _0x3a5468=yield _0x3a9835['json']();return new FailedAccountResponse(_0x3a5468);}catch(_0x4ff878){if(_0x4ff878 instanceof Error)return new FailedAccountResponse({'detail':_0x4ff878['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ff878;}});}['remove'](_0x1d8268,_0x37ffaa,_0x203958){return __awaiter$2(this,arguments,void 0,function*(_0x5bf66a,_0x11d320,_0x1c12e6,_0x29ddf5={}){var _0x232e86;const _0xd6e2d9=yield this['tokenManager']['getTokens'](_0x1c12e6,_0x29ddf5);if(!_0xd6e2d9['isSuccess'])return new FailedAccountResponse(_0xd6e2d9['toProblem']());_0x1c12e6=_0xd6e2d9['toSuccess']();let _0x23b58f=(_0x232e86=_0x29ddf5['baseUri'])!==null&&_0x232e86!==void 0?_0x232e86:this['baseUri'];_0x23b58f=_0x23b58f+'/List/'+_0x5bf66a+'/'+_0x11d320;const _0x596803=yield Fetch['delete'](_0x23b58f,_0x1c12e6['access_token']);try{if(_0x596803['status']>0xc7&&_0x596803['status']<0x12c){const _0x1a1f9a=yield _0x596803['json']();return new SuccessfulAccountResponse(_0x1a1f9a);}const _0x546b49=yield _0x596803['json']();return new FailedAccountResponse(_0x546b49);}catch(_0x43a56f){if(_0x43a56f instanceof Error)return new FailedAccountResponse({'detail':_0x43a56f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x43a56f;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x5443d2,_0x1c1907,_0x1c45b7,_0x590ccc){function _0x28b542(_0xc2410c){return _0xc2410c instanceof _0x1c45b7?_0xc2410c:new _0x1c45b7(function(_0x50fed3){_0x50fed3(_0xc2410c);});}return new(_0x1c45b7||(_0x1c45b7=Promise))(function(_0x47b93d,_0x5c8dbb){function _0x466cd0(_0x499309){try{_0xfdb540(_0x590ccc['next'](_0x499309));}catch(_0x218eef){_0x5c8dbb(_0x218eef);}}function _0x4334ac(_0x545146){try{_0xfdb540(_0x590ccc['throw'](_0x545146));}catch(_0x105040){_0x5c8dbb(_0x105040);}}function _0xfdb540(_0x53074f){_0x53074f['done']?_0x47b93d(_0x53074f['value']):_0x28b542(_0x53074f['value'])['then'](_0x466cd0,_0x4334ac);}_0xfdb540((_0x590ccc=_0x590ccc['apply'](_0x5443d2,_0x1c1907||[]))['next']());});};class TokenManager{constructor(_0x5da6b8){this['tokenService']=_0x5da6b8,this['getTokens']=(_0x42aac3,..._0x57fcf6)=>__awaiter$1(this,[_0x42aac3,..._0x57fcf6],void 0,function*(_0x79e2ab,_0x2403a0={}){if(_0x79e2ab){var _0x4bfc41=yield this['refreshIfExpired'](_0x79e2ab,_0x2403a0);if(_0x4bfc41['isSuccess'])return _0x4bfc41;}return yield this['tokenService']['get'](_0x2403a0);});}['refreshIfExpired'](_0x3944d3){return __awaiter$1(this,arguments,void 0,function*(_0x45b6eb,_0x2fa208={}){if(Date['now']()<_0x45b6eb['access_expires'])return new SuccessfulRefreshResponse(_0x45b6eb);if(Date['now']()>_0x45b6eb['refresh_expires']){const _0x2a6c4a={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x2a6c4a);}return yield this['tokenService']['refresh'](_0x45b6eb['refresh_token'],_0x2fa208);});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x5140b8,_0xc28e8a,_0x171f52,_0x5859c1){function _0x345393(_0x23e825){return _0x23e825 instanceof _0x171f52?_0x23e825:new _0x171f52(function(_0x5d54f5){_0x5d54f5(_0x23e825);});}return new(_0x171f52||(_0x171f52=Promise))(function(_0x901ecc,_0x44e4cb){function _0x3e1fec(_0x334937){try{_0x56764d(_0x5859c1['next'](_0x334937));}catch(_0x3f773b){_0x44e4cb(_0x3f773b);}}function _0x18bc1a(_0x3d37e0){try{_0x56764d(_0x5859c1['throw'](_0x3d37e0));}catch(_0x3a867f){_0x44e4cb(_0x3a867f);}}function _0x56764d(_0x2a9270){_0x2a9270['done']?_0x901ecc(_0x2a9270['value']):_0x345393(_0x2a9270['value'])['then'](_0x3e1fec,_0x18bc1a);}_0x56764d((_0x5859c1=_0x5859c1['apply'](_0x5140b8,_0xc28e8a||[]))['next']());});};class TokenService{constructor(_0x370ae7,_0x1f930b){this['apiKey']=_0x370ae7,this['baseUri']=_0x1f930b;}['get'](){return __awaiter(this,arguments,void 0,function*(_0x3cfbd7={}){var _0x3173d8;let _0x55569d=(_0x3173d8=_0x3cfbd7['baseUri'])!==null&&_0x3173d8!==void 0?_0x3173d8:this['baseUri'];!_0x55569d['endsWith']('/')&&(_0x55569d=_0x55569d+'/');_0x55569d=_0x55569d+'tokens/get/'+this['apiKey'];try{const _0x1baffa=yield yield fetch(_0x55569d,{'method':'POST','headers':{'Content-Type':'application/json'}});if(_0x1baffa['status']>0xc7&&_0x1baffa['status']<0x12c){const _0xf33a60=yield _0x1baffa['json']();return new SuccessfulRefreshResponse(_0xf33a60);}const _0x3f70d1=yield _0x1baffa['json']();return new FailedRefreshResponse(_0x3f70d1);}catch(_0x53e1d7){if(_0x53e1d7 instanceof Error)return new FailedRefreshResponse({'detail':_0x53e1d7['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x53e1d7;}});}['refresh'](_0x587e6b){return __awaiter(this,arguments,void 0,function*(_0xe6f035,_0x40d64b={}){var _0x59fdf5;let _0x582aa2=(_0x59fdf5=_0x40d64b['baseUri'])!==null&&_0x59fdf5!==void 0?_0x59fdf5:this['baseUri'];!_0x582aa2['endsWith']('/')&&(_0x582aa2=_0x582aa2+'/');_0x582aa2=_0x582aa2+'Tokens/Refresh';try{const _0x1cde02=yield Fetch['post'](_0x582aa2,_0xe6f035,null);if(_0x1cde02['status']>0xc7&&_0x1cde02['status']<0x12c){const _0x5c9f5c=yield _0x1cde02['json']();return new SuccessfulRefreshResponse(_0x5c9f5c);}const _0x23a3ec=yield _0x1cde02['json']();return new FailedRefreshResponse(_0x23a3ec);}catch(_0x44be43){if(_0x44be43 instanceof Error)return new FailedRefreshResponse({'detail':_0x44be43['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x44be43;}});}}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
class AdminClient{constructor(_0x4b94b3,_0xf16570='https://admin.searchability.dev/'){this['apiKey']=_0x4b94b3,this['baseUri']=_0xf16570,this['Tokens']=new TokenService(_0x4b94b3,this['baseUri']);const _0xe2d26e=new TokenManager(this['Tokens']);this['Accounts']=new AccountService(this['baseUri'],_0xe2d26e),this['Lists']=new ListService(this['baseUri'],_0xe2d26e),this['ApiKeys']=new ApiKeyService(this['baseUri'],_0xe2d26e);}}
|
|
18
18
|
|
|
19
19
|
exports.AdminClient = AdminClient;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
1
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x535168,_0x28bc32,_0x5d6b8e,_0xb81fbd){function _0x50647d(_0x434fb5){return _0x434fb5 instanceof _0x5d6b8e?_0x434fb5:new _0x5d6b8e(function(_0x11866e){_0x11866e(_0x434fb5);});}return new(_0x5d6b8e||(_0x5d6b8e=Promise))(function(_0x23af66,_0x2970c1){function _0x4c2d13(_0x29b62f){try{_0x40c131(_0xb81fbd['next'](_0x29b62f));}catch(_0x58c9a8){_0x2970c1(_0x58c9a8);}}function _0x240b70(_0x29474f){try{_0x40c131(_0xb81fbd['throw'](_0x29474f));}catch(_0xdc00b){_0x2970c1(_0xdc00b);}}function _0x40c131(_0x100319){_0x100319['done']?_0x23af66(_0x100319['value']):_0x50647d(_0x100319['value'])['then'](_0x4c2d13,_0x240b70);}_0x40c131((_0xb81fbd=_0xb81fbd['apply'](_0x535168,_0x28bc32||[]))['next']());});};class Fetch{static['get'](_0x1b19b9,_0x220f8f){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x1b19b9,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x220f8f}});});}static['post'](_0x250b87,_0x8b9ee8,_0x49db19){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x250b87,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x8b9ee8},'body':_0x49db19?JSON['stringify'](_0x49db19):null});});}static['put'](_0x397bb8,_0x43d2fc,_0x13cbda){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x397bb8,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x43d2fc},'body':_0x13cbda?JSON['stringify'](_0x13cbda):null});});}static['delete'](_0x47c1fe,_0x2c5569){return __awaiter$5(this,void 0,void 0,function*(){return yield fetch(_0x47c1fe,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2c5569}});});}}
|
|
2
2
|
|
|
3
|
-
class Response{constructor(
|
|
3
|
+
class Response{constructor(_0x32698f){this['isSuccess']=_0x32698f;}}class SuccessfulAccountResponse extends Response{constructor(_0x2057fa){super(!![]),this['account']=_0x2057fa;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4b1c3f){super(![]),this['problem']=_0x4b1c3f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulRefreshResponse extends Response{constructor(_0x59db46){super(!![]),this['tokens']=_0x59db46;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedRefreshResponse extends Response{constructor(_0x21b802){super(![]),this['problem']=_0x21b802;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x4cbe87){super(!![]),this['apiKey']=_0x4cbe87;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x48e7b8){super(![]),this['problem']=_0x48e7b8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x5e29a6,_0x5f24c4,_0x370e4b,_0x46e03d){function _0xe839c2(_0x3454d9){return _0x3454d9 instanceof _0x370e4b?_0x3454d9:new _0x370e4b(function(_0x18dd30){_0x18dd30(_0x3454d9);});}return new(_0x370e4b||(_0x370e4b=Promise))(function(_0x2c8a15,_0x3c6e94){function _0x1fd106(_0x11ffc9){try{_0x5a3d52(_0x46e03d['next'](_0x11ffc9));}catch(_0x80ca10){_0x3c6e94(_0x80ca10);}}function _0x5dfc4b(_0x3a18c2){try{_0x5a3d52(_0x46e03d['throw'](_0x3a18c2));}catch(_0xf0be10){_0x3c6e94(_0xf0be10);}}function _0x5a3d52(_0x334946){_0x334946['done']?_0x2c8a15(_0x334946['value']):_0xe839c2(_0x334946['value'])['then'](_0x1fd106,_0x5dfc4b);}_0x5a3d52((_0x46e03d=_0x46e03d['apply'](_0x5e29a6,_0x5f24c4||[]))['next']());});};class AccountService{constructor(_0x3fd59c,_0x2e53bb){this['baseUri']=_0x3fd59c,this['tokenManager']=_0x2e53bb;}['get'](_0x22d394,_0x504d60){return __awaiter$4(this,arguments,void 0,function*(_0xce296c,_0x7c2a43,_0x34ac95={}){var _0xc8a4fb;const _0x51c257=yield this['tokenManager']['getTokens'](_0x7c2a43,_0x34ac95);if(!_0x51c257['isSuccess'])return new FailedAccountResponse(_0x51c257['toProblem']());_0x7c2a43=_0x51c257['toSuccess']();let _0x2512d2=(_0xc8a4fb=_0x34ac95['baseUri'])!==null&&_0xc8a4fb!==void 0?_0xc8a4fb:this['baseUri'];!_0x2512d2['endsWith']('/')&&(_0x2512d2=_0x2512d2+'/');_0x2512d2=_0x2512d2+'Account/'+_0xce296c+'/';const _0x1c97bc=yield Fetch['get'](_0x2512d2,_0x7c2a43['access_token']);try{if(_0x1c97bc['status']>0xc7&&_0x1c97bc['status']<0x12c){const _0x54c3dc=yield _0x1c97bc['json']();return new SuccessfulAccountResponse(_0x54c3dc);}const _0x504690=yield _0x1c97bc['json']();return new FailedAccountResponse(_0x504690);}catch(_0x4a9009){if(_0x4a9009 instanceof Error)return new FailedAccountResponse({'detail':_0x4a9009['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4a9009;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x437509,_0x4c9c12,_0x363c65,_0x487d3b){function _0x1f6afb(_0x2e15c7){return _0x2e15c7 instanceof _0x363c65?_0x2e15c7:new _0x363c65(function(_0x1c0ffe){_0x1c0ffe(_0x2e15c7);});}return new(_0x363c65||(_0x363c65=Promise))(function(_0x317032,_0x480ba0){function _0x4c2ab1(_0x2ec9c3){try{_0x341045(_0x487d3b['next'](_0x2ec9c3));}catch(_0xb0706d){_0x480ba0(_0xb0706d);}}function _0x1880fc(_0x389d02){try{_0x341045(_0x487d3b['throw'](_0x389d02));}catch(_0x269262){_0x480ba0(_0x269262);}}function _0x341045(_0x4beeb8){_0x4beeb8['done']?_0x317032(_0x4beeb8['value']):_0x1f6afb(_0x4beeb8['value'])['then'](_0x4c2ab1,_0x1880fc);}_0x341045((_0x487d3b=_0x487d3b['apply'](_0x437509,_0x4c9c12||[]))['next']());});};class ApiKeyService{constructor(_0x287d43,_0x556f62){this['baseUri']=_0x287d43,this['tokenManager']=_0x556f62;}['create'](_0x19f23b,_0x1c7f4e,_0x46ada6){return __awaiter$3(this,arguments,void 0,function*(_0x16246c,_0x1966aa,_0x1e666f,_0x1750e3={}){var _0x1607f0;const _0x2445da=yield this['tokenManager']['getTokens'](_0x1e666f,_0x1750e3);if(!_0x2445da['isSuccess'])return new FailedApiKeyResponse(_0x2445da['toProblem']());_0x1e666f=_0x2445da['toSuccess']();let _0x1b4264=(_0x1607f0=_0x1750e3['baseUri'])!==null&&_0x1607f0!==void 0?_0x1607f0:this['baseUri'];!_0x1b4264['endsWith']('/')&&(_0x1b4264=_0x1b4264+'/');_0x1b4264=_0x1b4264+'ApiKey/Create';const _0x2ab476={'account_name':_0x16246c,'name':_0x1966aa};try{const _0x8ddcce=yield Fetch['post'](_0x1b4264,_0x1e666f['access_token'],_0x2ab476);if(_0x8ddcce['status']>0xc7&&_0x8ddcce['status']<0x12c){const _0x2948dd=yield _0x8ddcce['json']();return new SuccessfulApiKeyResponse(_0x2948dd);}const _0x12cd8b=yield _0x8ddcce['json']();return new FailedApiKeyResponse(_0x12cd8b);}catch(_0x3d40a8){if(_0x3d40a8 instanceof Error)return new FailedApiKeyResponse({'detail':_0x3d40a8['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x3d40a8;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x27809c,_0x2db2b0,_0x418078,_0x4bdeb7){function _0x4950ad(_0x220e03){return _0x220e03 instanceof _0x418078?_0x220e03:new _0x418078(function(_0x22c1a0){_0x22c1a0(_0x220e03);});}return new(_0x418078||(_0x418078=Promise))(function(_0x250b57,_0x2bdd6a){function _0x5e3c0c(_0x1ab813){try{_0x5d9323(_0x4bdeb7['next'](_0x1ab813));}catch(_0x88f00d){_0x2bdd6a(_0x88f00d);}}function _0xb60d2(_0x3678ff){try{_0x5d9323(_0x4bdeb7['throw'](_0x3678ff));}catch(_0x4eee29){_0x2bdd6a(_0x4eee29);}}function _0x5d9323(_0x2f1834){_0x2f1834['done']?_0x250b57(_0x2f1834['value']):_0x4950ad(_0x2f1834['value'])['then'](_0x5e3c0c,_0xb60d2);}_0x5d9323((_0x4bdeb7=_0x4bdeb7['apply'](_0x27809c,_0x2db2b0||[]))['next']());});};class ListService{constructor(_0x23c338,_0x11b474){this['baseUri']=_0x23c338,this['tokenManager']=_0x11b474;}['add'](_0x3c02ab,_0x34fcc2,_0xa94ad9){return __awaiter$2(this,arguments,void 0,function*(_0x38ece5,_0x10b5d7,_0x375669,_0xb27022={}){var _0x1d625a;const _0x267f55=yield this['tokenManager']['getTokens'](_0x375669,_0xb27022);if(!_0x267f55['isSuccess'])return new FailedAccountResponse(_0x267f55['toProblem']());_0x375669=_0x267f55['toSuccess']();let _0x433afa=(_0x1d625a=_0xb27022['baseUri'])!==null&&_0x1d625a!==void 0?_0x1d625a:this['baseUri'];!_0x433afa['endsWith']('/')&&(_0x433afa=_0x433afa+'/');_0x433afa=_0x433afa+'List';const _0x5e0c34={'account_name':_0x38ece5,'list_name':_0x10b5d7};try{const _0x2807c3=yield Fetch['post'](_0x433afa,_0x375669['access_token'],_0x5e0c34);if(_0x2807c3['status']>0xc7&&_0x2807c3['status']<0x12c){const _0x25c5d0=yield _0x2807c3['json']();return new SuccessfulAccountResponse(_0x25c5d0);}const _0x490fef=yield _0x2807c3['json']();return new FailedAccountResponse(_0x490fef);}catch(_0x1f0cd6){if(_0x1f0cd6 instanceof Error)return new FailedAccountResponse({'detail':_0x1f0cd6['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x1f0cd6;}});}['remove'](_0x4b78f4,_0x979ff9,_0x38f236){return __awaiter$2(this,arguments,void 0,function*(_0x19fdd6,_0x570797,_0x54997b,_0x1fda81={}){var _0x4b3e0d;const _0x414cd6=yield this['tokenManager']['getTokens'](_0x54997b,_0x1fda81);if(!_0x414cd6['isSuccess'])return new FailedAccountResponse(_0x414cd6['toProblem']());_0x54997b=_0x414cd6['toSuccess']();let _0x271fd4=(_0x4b3e0d=_0x1fda81['baseUri'])!==null&&_0x4b3e0d!==void 0?_0x4b3e0d:this['baseUri'];_0x271fd4=_0x271fd4+'/List/'+_0x19fdd6+'/'+_0x570797;const _0x236633=yield Fetch['delete'](_0x271fd4,_0x54997b['access_token']);try{if(_0x236633['status']>0xc7&&_0x236633['status']<0x12c){const _0x3a99e0=yield _0x236633['json']();return new SuccessfulAccountResponse(_0x3a99e0);}const _0x29713e=yield _0x236633['json']();return new FailedAccountResponse(_0x29713e);}catch(_0x16281c){if(_0x16281c instanceof Error)return new FailedAccountResponse({'detail':_0x16281c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x16281c;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x3d1aec,_0x1778d3,_0xd63ef1,_0x5dd7d2){function _0x1884f1(_0x2bb879){return _0x2bb879 instanceof _0xd63ef1?_0x2bb879:new _0xd63ef1(function(_0x5ad107){_0x5ad107(_0x2bb879);});}return new(_0xd63ef1||(_0xd63ef1=Promise))(function(_0x1662ab,_0x26546e){function _0x4d10fe(_0x4d6629){try{_0x463c7f(_0x5dd7d2['next'](_0x4d6629));}catch(_0x1ba557){_0x26546e(_0x1ba557);}}function _0x7a112b(_0x397f12){try{_0x463c7f(_0x5dd7d2['throw'](_0x397f12));}catch(_0x40e2f9){_0x26546e(_0x40e2f9);}}function _0x463c7f(_0x4d68b2){_0x4d68b2['done']?_0x1662ab(_0x4d68b2['value']):_0x1884f1(_0x4d68b2['value'])['then'](_0x4d10fe,_0x7a112b);}_0x463c7f((_0x5dd7d2=_0x5dd7d2['apply'](_0x3d1aec,_0x1778d3||[]))['next']());});};class TokenManager{constructor(_0x2c1d12){this['tokenService']=_0x2c1d12,this['getTokens']=(_0xa082d0,..._0x341d7c)=>__awaiter$1(this,[_0xa082d0,..._0x341d7c],void 0,function*(_0x5a54d9,_0x284c17={}){if(_0x5a54d9){var _0x5b4bbf=yield this['refreshIfExpired'](_0x5a54d9,_0x284c17);if(_0x5b4bbf['isSuccess'])return _0x5b4bbf;}return yield this['tokenService']['get'](_0x284c17);});}['refreshIfExpired'](_0x584585){return __awaiter$1(this,arguments,void 0,function*(_0x53829c,_0x58d971={}){if(Date['now']()<_0x53829c['access_expires'])return new SuccessfulRefreshResponse(_0x53829c);if(Date['now']()>_0x53829c['refresh_expires']){const _0x116eff={'detail':'Forbidden','type':'','status':0x193,'title':'Forbidden','instance':''};return new FailedRefreshResponse(_0x116eff);}return yield this['tokenService']['refresh'](_0x53829c['refresh_token'],_0x58d971);});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x50b6d6,_0x2d7137,_0x15ff91,_0x2cd0b7){function _0x316883(_0x2d89d1){return _0x2d89d1 instanceof _0x15ff91?_0x2d89d1:new _0x15ff91(function(_0x296095){_0x296095(_0x2d89d1);});}return new(_0x15ff91||(_0x15ff91=Promise))(function(_0x581c0b,_0x3b9749){function _0x59389b(_0x565fa0){try{_0x2e4140(_0x2cd0b7['next'](_0x565fa0));}catch(_0x3d2b32){_0x3b9749(_0x3d2b32);}}function _0x1b6569(_0x514fe7){try{_0x2e4140(_0x2cd0b7['throw'](_0x514fe7));}catch(_0x3f4781){_0x3b9749(_0x3f4781);}}function _0x2e4140(_0x49b446){_0x49b446['done']?_0x581c0b(_0x49b446['value']):_0x316883(_0x49b446['value'])['then'](_0x59389b,_0x1b6569);}_0x2e4140((_0x2cd0b7=_0x2cd0b7['apply'](_0x50b6d6,_0x2d7137||[]))['next']());});};class TokenService{constructor(_0xba6950,_0x3e0736){this['apiKey']=_0xba6950,this['baseUri']=_0x3e0736;}['get'](){return __awaiter(this,arguments,void 0,function*(_0x10bc83={}){var _0xcf2473;let _0x5eb9f7=(_0xcf2473=_0x10bc83['baseUri'])!==null&&_0xcf2473!==void 0?_0xcf2473:this['baseUri'];!_0x5eb9f7['endsWith']('/')&&(_0x5eb9f7=_0x5eb9f7+'/');_0x5eb9f7=_0x5eb9f7+'tokens/get/'+this['apiKey'];try{const _0x5b7e9f=yield yield fetch(_0x5eb9f7,{'method':'POST','headers':{'Content-Type':'application/json'}});if(_0x5b7e9f['status']>0xc7&&_0x5b7e9f['status']<0x12c){const _0x3a738e=yield _0x5b7e9f['json']();return new SuccessfulRefreshResponse(_0x3a738e);}const _0x3c126d=yield _0x5b7e9f['json']();return new FailedRefreshResponse(_0x3c126d);}catch(_0x501ae5){if(_0x501ae5 instanceof Error)return new FailedRefreshResponse({'detail':_0x501ae5['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x501ae5;}});}['refresh'](_0x56a249){return __awaiter(this,arguments,void 0,function*(_0x4a698f,_0x200257={}){var _0x2044a7;let _0x200bdd=(_0x2044a7=_0x200257['baseUri'])!==null&&_0x2044a7!==void 0?_0x2044a7:this['baseUri'];!_0x200bdd['endsWith']('/')&&(_0x200bdd=_0x200bdd+'/');_0x200bdd=_0x200bdd+'Tokens/Refresh';try{const _0x2558ae=yield Fetch['post'](_0x200bdd,_0x4a698f,null);if(_0x2558ae['status']>0xc7&&_0x2558ae['status']<0x12c){const _0x22d87a=yield _0x2558ae['json']();return new SuccessfulRefreshResponse(_0x22d87a);}const _0x42d8d6=yield _0x2558ae['json']();return new FailedRefreshResponse(_0x42d8d6);}catch(_0x32152c){if(_0x32152c instanceof Error)return new FailedRefreshResponse({'detail':_0x32152c['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x32152c;}});}}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
class AdminClient{constructor(_0x522afe,_0x484664='https://admin.searchability.dev/'){this['apiKey']=_0x522afe,this['baseUri']=_0x484664,this['Tokens']=new TokenService(_0x522afe,this['baseUri']);const _0x35bc3f=new TokenManager(this['Tokens']);this['Accounts']=new AccountService(this['baseUri'],_0x35bc3f),this['Lists']=new ListService(this['baseUri'],_0x35bc3f),this['ApiKeys']=new ApiKeyService(this['baseUri'],_0x35bc3f);}}
|
|
16
16
|
|
|
17
17
|
export { AdminClient };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,41 +1,48 @@
|
|
|
1
|
-
declare class
|
|
1
|
+
declare class TokenService {
|
|
2
|
+
readonly apiKey: string;
|
|
2
3
|
readonly baseUri: string;
|
|
3
|
-
constructor(baseUri: string);
|
|
4
|
-
get(
|
|
4
|
+
constructor(apiKey: string, baseUri: string);
|
|
5
|
+
get(options?: Partial<Options>): Promise<Response<Tokens, Problem>>;
|
|
6
|
+
refresh(refreshToken: string, options?: Partial<Options>): Promise<Response<Tokens, Problem>>;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
declare class
|
|
8
|
-
readonly
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
9
|
+
declare class TokenManager {
|
|
10
|
+
readonly tokenService: TokenService;
|
|
11
|
+
constructor(tokenService: TokenService);
|
|
12
|
+
getTokens: (tokens: Tokens | undefined, options?: Partial<Options>) => Promise<Response<Tokens, Problem>>;
|
|
13
|
+
private refreshIfExpired;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
declare class
|
|
16
|
+
declare class AccountService {
|
|
14
17
|
readonly baseUri: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
readonly tokenManager: TokenManager;
|
|
19
|
+
constructor(baseUri: string, tokenManager: TokenManager);
|
|
20
|
+
get(accountName: string, tokens?: Tokens | undefined, options?: Partial<Options>): Promise<Response<Account, Problem>>;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
declare class
|
|
21
|
-
readonly
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
declare class ApiKeyService {
|
|
24
|
+
readonly baseUri: string;
|
|
25
|
+
readonly tokenManager: TokenManager;
|
|
26
|
+
constructor(baseUri: string, tokenManager: TokenManager);
|
|
27
|
+
create(accountName: string, apiKeyName: string, tokens?: Tokens | undefined, options?: Partial<Options>): Promise<Response<ApiKey, Problem>>;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
declare class
|
|
30
|
+
declare class ListService {
|
|
27
31
|
readonly baseUri: string;
|
|
28
|
-
constructor(baseUri: string);
|
|
29
|
-
refresh(refreshToken: string, options?: Partial<Options>): Promise<Response<Tokens, Problem>>;
|
|
30
32
|
readonly tokenManager: TokenManager;
|
|
33
|
+
constructor(baseUri: string, tokenManager: TokenManager);
|
|
34
|
+
add(accountName: string, listName: string, tokens?: Tokens | undefined, options?: Partial<Options>): Promise<Response<Account, Problem>>;
|
|
35
|
+
remove(accountName: string, listName: string, tokens?: Tokens | undefined, options?: Partial<Options>): Promise<Response<Account, Problem>>;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
declare class AdminClient {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
readonly apiKey: string;
|
|
40
|
+
readonly baseUri: string;
|
|
41
|
+
constructor(apiKey: string, baseUri?: string);
|
|
42
|
+
readonly Tokens: TokenService;
|
|
43
|
+
readonly Accounts: AccountService;
|
|
44
|
+
readonly Lists: ListService;
|
|
45
|
+
readonly ApiKeys: ApiKeyService;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
type Options = {
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
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 };
|