@searchability/admin-client 0.0.47 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var TokenStatus;(function(_0x4484a4){_0x4484a4[_0x4484a4['Ok']=0x0]='Ok',_0x4484a4[_0x4484a4['Refresh']=0x1]='Refresh',_0x4484a4[_0x4484a4['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x23010e){this['isSuccess']=_0x23010e;}}class SuccessfulAccountResponse extends Response{constructor(_0x5e29df){super(!![]),this['account']=_0x5e29df;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x56284a){super(!![]),this['list']=_0x56284a;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x96db80){super(![]),this['problem']=_0x96db80;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x435f12){super(![]),this['problem']=_0x435f12;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0xc319bf){super(!![]),this['tokens']=_0xc319bf;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x3be8ee){super(![]),this['problem']=_0x3be8ee;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x7457be){super(!![]),this['apiKey']=_0x7457be;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x3e7093){super(![]),this['problem']=_0x3e7093;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x120b44){super(!![]),this['searchService']=_0x120b44;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x5f058e){super(![]),this['problem']=_0x5f058e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x402a6b){super(!![]),this['searchService']=_0x402a6b;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x5430f7){super(!![]),this['searchServices']=_0x5430f7;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x3c15da){super(![]),this['problem']=_0x3c15da;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x4bb88f){super(![]),this['problem']=_0x4bb88f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x340df7){super(!![]),this['apiKeyValue']=_0x340df7;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x29ae97){super(!![]),this['obj']=_0x29ae97;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x435ada){super(![]),this['problem']=_0x435ada;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x1ba74e){super(![]),this['problem']=_0x1ba74e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
+
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x5eb207,_0x2ad83f,_0x23cede,_0x46959f){function _0x564424(_0x5ae378){return _0x5ae378 instanceof _0x23cede?_0x5ae378:new _0x23cede(function(_0x51fb59){_0x51fb59(_0x5ae378);});}return new(_0x23cede||(_0x23cede=Promise))(function(_0x586e13,_0x28fdea){function _0x229c13(_0x4bc106){try{_0x5acdee(_0x46959f['next'](_0x4bc106));}catch(_0x365989){_0x28fdea(_0x365989);}}function _0x440f99(_0x4a77f0){try{_0x5acdee(_0x46959f['throw'](_0x4a77f0));}catch(_0x3d8653){_0x28fdea(_0x3d8653);}}function _0x5acdee(_0x178b43){_0x178b43['done']?_0x586e13(_0x178b43['value']):_0x564424(_0x178b43['value'])['then'](_0x229c13,_0x440f99);}_0x5acdee((_0x46959f=_0x46959f['apply'](_0x5eb207,_0x2ad83f||[]))['next']());});};class AccountService{constructor(_0x58dcb2){this['fetch']=_0x58dcb2;}['get'](_0x4ac82a,_0x1658a5){return __awaiter$5(this,void 0,void 0,function*(){const _0xb2f227='Account/'+_0x4ac82a+'/',_0x12db7a=yield this['fetch']['get'](_0xb2f227,_0x1658a5);try{if(_0x12db7a['status']>0xc7&&_0x12db7a['status']<0x12c){const _0x5d6bb8=yield _0x12db7a['json']();return new SuccessfulAccountResponse(_0x5d6bb8);}const _0x3418e4=yield _0x12db7a['json']();return new FailedAccountResponse(_0x3418e4);}catch(_0x5bf35c){if(_0x5bf35c instanceof Error)return new FailedAccountResponse({'detail':_0x5bf35c['message'],'title':_0x5bf35c['name'],'status':0x1f4,'instance':'','type':''});throw _0x5bf35c;}});}}
|
|
4
|
+
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x2f7a89,_0x47cfaf,_0x4738ad,_0x2d2c9e){function _0x3a3007(_0x265adf){return _0x265adf instanceof _0x4738ad?_0x265adf:new _0x4738ad(function(_0x5c49fe){_0x5c49fe(_0x265adf);});}return new(_0x4738ad||(_0x4738ad=Promise))(function(_0x435b0c,_0x41990b){function _0x14e635(_0x3bc6c5){try{_0x314a0a(_0x2d2c9e['next'](_0x3bc6c5));}catch(_0x2212f2){_0x41990b(_0x2212f2);}}function _0x44c27a(_0xf80c0){try{_0x314a0a(_0x2d2c9e['throw'](_0xf80c0));}catch(_0x1f78e7){_0x41990b(_0x1f78e7);}}function _0x314a0a(_0x1d204c){_0x1d204c['done']?_0x435b0c(_0x1d204c['value']):_0x3a3007(_0x1d204c['value'])['then'](_0x14e635,_0x44c27a);}_0x314a0a((_0x2d2c9e=_0x2d2c9e['apply'](_0x2f7a89,_0x47cfaf||[]))['next']());});};class ApiKeyService{constructor(_0x326fdb){this['fetch']=_0x326fdb,this['path']='api-key';}['create'](_0x387675,_0xe4970c,_0x3fd5dc){return __awaiter$4(this,void 0,void 0,function*(){const _0x211342={'account_name':_0x387675,'api_key_name':_0xe4970c};try{const _0x3503e7=yield this['fetch']['post'](this['path'],_0x3fd5dc,_0x211342);if(_0x3503e7['status']>0xc7&&_0x3503e7['status']<0x12c){const _0x1d4929=yield _0x3503e7['json']();return new SuccessfulApiKeyResponse(_0x1d4929);}const _0xb7571f=yield _0x3503e7['json']();return new FailedApiKeyResponse(_0xb7571f);}catch(_0xfb9c3d){if(_0xfb9c3d instanceof Error)return new FailedApiKeyResponse({'detail':_0xfb9c3d['message'],'title':_0xfb9c3d['name'],'status':0x1f4,'instance':'','type':''});throw _0xfb9c3d;}});}['view'](_0x3c26c2,_0x4e6329,_0x4f3ec0){return __awaiter$4(this,void 0,void 0,function*(){const _0x592452=this['path']+'/'+_0x3c26c2+'/'+_0x4e6329;try{const _0x25c8fe=yield this['fetch']['get'](_0x592452,_0x4f3ec0);if(_0x25c8fe['status']>0xc7&&_0x25c8fe['status']<0x12c){const _0x1baaff=yield _0x25c8fe['json']();return new SuccessfulApiKeyValueResponse(_0x1baaff);}const _0x34ec20=yield _0x25c8fe['json']();return new FailedApiKeyValueResponse(_0x34ec20);}catch(_0x525506){if(_0x525506 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x525506['message'],'title':_0x525506['name'],'status':0x1f4,'instance':'','type':''});throw _0x525506;}});}['delete'](_0x2c7de2,_0x16a7c8,_0x56157a){return __awaiter$4(this,void 0,void 0,function*(){const _0x3ce124=this['path']+'/'+_0x2c7de2+'/'+_0x16a7c8;try{const _0x2dc0de=yield this['fetch']['delete'](_0x3ce124,_0x56157a);if(_0x2dc0de['status']>0xc7&&_0x2dc0de['status']<0x12c)return new SuccessfulResponse({});const _0x582257=yield _0x2dc0de['json']();return new FailedResponse(_0x582257);}catch(_0x272287){if(_0x272287 instanceof Error)return new FailedResponse({'detail':_0x272287['message'],'title':_0x272287['name'],'status':0x1f4,'instance':'','type':''});throw _0x272287;}});}}
|
|
6
|
+
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x31ebcc,_0x4e509c,_0x331c16,_0x1c9140){function _0x1badbf(_0x29fde0){return _0x29fde0 instanceof _0x331c16?_0x29fde0:new _0x331c16(function(_0x16d246){_0x16d246(_0x29fde0);});}return new(_0x331c16||(_0x331c16=Promise))(function(_0x5dbcf9,_0x18ee62){function _0x3dbf87(_0x2a64c7){try{_0x1e88df(_0x1c9140['next'](_0x2a64c7));}catch(_0x4cb806){_0x18ee62(_0x4cb806);}}function _0xf56fa1(_0x5037e5){try{_0x1e88df(_0x1c9140['throw'](_0x5037e5));}catch(_0x189572){_0x18ee62(_0x189572);}}function _0x1e88df(_0x36cb5d){_0x36cb5d['done']?_0x5dbcf9(_0x36cb5d['value']):_0x1badbf(_0x36cb5d['value'])['then'](_0x3dbf87,_0xf56fa1);}_0x1e88df((_0x1c9140=_0x1c9140['apply'](_0x31ebcc,_0x4e509c||[]))['next']());});};class ListService{constructor(_0x5e8b1c){this['fetch']=_0x5e8b1c;}['add'](_0x505e73,_0x590948,_0x97e635,_0x2a10d4){return __awaiter$3(this,void 0,void 0,function*(){const _0x3fce7f='List',_0x2f3740={'account_name':_0x505e73,'list_name':_0x590948,'search_service_name':_0x97e635};try{const _0x1c7f56=yield this['fetch']['post'](_0x3fce7f,_0x2a10d4,_0x2f3740);if(_0x1c7f56['status']>0xc7&&_0x1c7f56['status']<0x12c){const _0x44f2f3=yield _0x1c7f56['json']();return new SuccessfulListIdentityResponse(_0x44f2f3);}const _0x2ebc2f=yield _0x1c7f56['json']();return new FailedListIdentityResponse(_0x2ebc2f);}catch(_0x1ac64d){if(_0x1ac64d instanceof Error)return new FailedListIdentityResponse({'detail':_0x1ac64d['message'],'title':_0x1ac64d['name'],'status':0x1f4,'instance':'','type':''});throw _0x1ac64d;}});}['delete'](_0x509c81,_0x72d82c,_0xabccf9){return __awaiter$3(this,void 0,void 0,function*(){const _0x2389fe='List/'+_0x509c81+'/'+_0x72d82c,_0x51e444=yield this['fetch']['delete'](_0x2389fe,_0xabccf9);try{if(_0x51e444['status']>0xc7&&_0x51e444['status']<0x12c){const _0x40c190=yield _0x51e444['json']();return new SuccessfulResponse({});}const _0x47d537=yield _0x51e444['json']();return new FailedResponse(_0x47d537);}catch(_0x576d63){if(_0x576d63 instanceof Error)return new FailedResponse({'detail':_0x576d63['message'],'title':_0x576d63['name'],'status':0x1f4,'instance':'','type':''});throw _0x576d63;}});}}
|
|
8
|
+
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x5f29b9,_0x542994,_0x28eeb0,_0x59c58b){function _0x375966(_0x472de7){return _0x472de7 instanceof _0x28eeb0?_0x472de7:new _0x28eeb0(function(_0x451e92){_0x451e92(_0x472de7);});}return new(_0x28eeb0||(_0x28eeb0=Promise))(function(_0x28864d,_0xcbf1aa){function _0x2341e5(_0x472031){try{_0x1c8a41(_0x59c58b['next'](_0x472031));}catch(_0x528fa6){_0xcbf1aa(_0x528fa6);}}function _0x1fa7d5(_0x1727d1){try{_0x1c8a41(_0x59c58b['throw'](_0x1727d1));}catch(_0x347044){_0xcbf1aa(_0x347044);}}function _0x1c8a41(_0x54965e){_0x54965e['done']?_0x28864d(_0x54965e['value']):_0x375966(_0x54965e['value'])['then'](_0x2341e5,_0x1fa7d5);}_0x1c8a41((_0x59c58b=_0x59c58b['apply'](_0x5f29b9,_0x542994||[]))['next']());});};class Fetch{constructor(_0x11bada){this['baseUri']=_0x11bada,this['getUrl']=_0x446985=>{return _0x446985['startsWith']('/')&&(_0x446985=_0x446985['replace']('/','')),''+this['baseUri']+_0x446985;},!_0x11bada['endsWith']('/')&&(_0x11bada=_0x11bada+'/');}['get'](_0x268d79,_0xa3565a){return __awaiter$2(this,void 0,void 0,function*(){const _0x268f2e=this['getUrl'](_0x268d79);return yield fetch(_0x268f2e,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xa3565a}});});}['post'](_0x4a006e,_0x4f317c,_0x62041e){return __awaiter$2(this,void 0,void 0,function*(){const _0x460bb0=this['getUrl'](_0x4a006e);return yield fetch(_0x460bb0,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4f317c},'body':_0x62041e?JSON['stringify'](_0x62041e):null});});}['PostNoAuth'](_0x3c58e8,_0x60545d){return __awaiter$2(this,void 0,void 0,function*(){const _0x5bbf2b=this['getUrl'](_0x3c58e8);return yield fetch(_0x5bbf2b,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x60545d?JSON['stringify'](_0x60545d):null});});}['put'](_0x23207b,_0x38340a,_0x2e9eef){return __awaiter$2(this,void 0,void 0,function*(){const _0x37ac4e=this['getUrl'](_0x23207b);return yield fetch(_0x37ac4e,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x38340a},'body':_0x2e9eef?JSON['stringify'](_0x2e9eef):null});});}['delete'](_0x1f654a,_0x863f4e){return __awaiter$2(this,void 0,void 0,function*(){const _0x1a2923=this['getUrl'](_0x1f654a);return yield fetch(_0x1a2923,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x863f4e}});});}}
|
|
10
|
+
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x466f0b,_0xe13cc5,_0x3b704a,_0x2180bf){function _0x35174f(_0x3479a5){return _0x3479a5 instanceof _0x3b704a?_0x3479a5:new _0x3b704a(function(_0x2c695c){_0x2c695c(_0x3479a5);});}return new(_0x3b704a||(_0x3b704a=Promise))(function(_0x3315e1,_0x3071f8){function _0x4865a0(_0x522991){try{_0x56db9f(_0x2180bf['next'](_0x522991));}catch(_0x48ca93){_0x3071f8(_0x48ca93);}}function _0x5732fb(_0x5949ec){try{_0x56db9f(_0x2180bf['throw'](_0x5949ec));}catch(_0x269193){_0x3071f8(_0x269193);}}function _0x56db9f(_0x4063e8){_0x4063e8['done']?_0x3315e1(_0x4063e8['value']):_0x35174f(_0x4063e8['value'])['then'](_0x4865a0,_0x5732fb);}_0x56db9f((_0x2180bf=_0x2180bf['apply'](_0x466f0b,_0xe13cc5||[]))['next']());});};class SearchServersService{constructor(_0x29af2e){this['fetch']=_0x29af2e,this['path']='search-services';}['create'](_0x57bee6,_0xff17b7,_0x2c412e,_0x24ecef,_0x28ee89,_0xba9aa1,_0x494d0a,_0x52b1c9){return __awaiter$1(this,void 0,void 0,function*(){const _0x812e38={'account_name':_0x57bee6,'search_service_name':_0xff17b7,'endpoint':_0x2c412e,'key':_0x24ecef,'country':_0x28ee89,'provider':_0xba9aa1,'index_name':_0x494d0a};try{const _0x34250d=yield this['fetch']['post'](this['path'],_0x52b1c9,_0x812e38);if(_0x34250d['status']>0xc7&&_0x34250d['status']<0x12c){const _0x26b847=yield _0x34250d['json']();return new SuccessfulSearchServiceResponse(_0x26b847);}const _0x4bcf19=yield _0x34250d['json']();return new FailedSearchServiceResponse(_0x4bcf19);}catch(_0x1e11c4){if(_0x1e11c4 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1e11c4['message'],'title':_0x1e11c4['name'],'status':0x1f4,'instance':'','type':''});throw _0x1e11c4;}});}['delete'](_0x5cc305,_0xd0d13b,_0x4e62ee){return __awaiter$1(this,void 0,void 0,function*(){const _0x57fdbd=this['path']+'/'+_0x5cc305+'/'+_0xd0d13b;try{const _0x57980b=yield this['fetch']['delete'](_0x57fdbd,_0x4e62ee);if(_0x57980b['status']>0xc7&&_0x57980b['status']<0x12c)return new SuccessfulResponse({});const _0x9359ab=yield _0x57980b['json']();return new FailedResponse(_0x9359ab);}catch(_0xb23924){if(_0xb23924 instanceof Error)return new FailedResponse({'detail':_0xb23924['message'],'title':_0xb23924['name'],'status':0x1f4,'instance':'','type':''});throw _0xb23924;}});}['view'](_0x2b5c47,_0x190e2f,_0x45f490){return __awaiter$1(this,void 0,void 0,function*(){const _0x35d21c=this['path']+'/'+_0x2b5c47+'/'+_0x190e2f;try{const _0x23e44c=yield this['fetch']['get'](_0x35d21c,_0x45f490);if(_0x23e44c['status']>0xc7&&_0x23e44c['status']<0x12c){const _0x5c5407=yield _0x23e44c['json']();return new SuccessfulViewSearchServiceResponse(_0x5c5407);}const _0x117f4e=yield _0x23e44c['json']();return new FailedViewSearchServiceResponse(_0x117f4e);}catch(_0x2ca9e1){if(_0x2ca9e1 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x2ca9e1['message'],'title':_0x2ca9e1['name'],'status':0x1f4,'instance':'','type':''});throw _0x2ca9e1;}});}['edit'](_0x470b15,_0x5e25b1,_0x3bc911,_0x7ba462,_0x2dc51b,_0x211e8a){return __awaiter$1(this,void 0,void 0,function*(){const _0x51b167={'account_name':_0x470b15,'search_service_name':_0x5e25b1,'new_search_service_name':_0x3bc911,'key':_0x7ba462,'country':_0x2dc51b};try{const _0x1d343d=yield this['fetch']['put'](this['path'],_0x211e8a,_0x51b167);if(_0x1d343d['status']>0xc7&&_0x1d343d['status']<0x12c){const _0x555040=yield _0x1d343d['json']();return new SuccessfulSearchServiceResponse(_0x555040);}const _0x16ef6c=yield _0x1d343d['json']();return new FailedSearchServiceResponse(_0x16ef6c);}catch(_0x3e6133){if(_0x3e6133 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x3e6133['message'],'title':_0x3e6133['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e6133;}});}['list'](_0x1dacb2,_0x5faaaf){return __awaiter$1(this,void 0,void 0,function*(){const _0x3f81b9=this['path']+'/'+_0x1dacb2;try{const _0x63493c=yield this['fetch']['get'](_0x3f81b9,_0x5faaaf);if(_0x63493c['status']>0xc7&&_0x63493c['status']<0x12c){const _0x54f5c4=yield _0x63493c['json']();return new SuccessfulListSearchServiceResponse(_0x54f5c4);}const _0x1b0425=yield _0x63493c['json']();return new FailedViewSearchServicesResponse(_0x1b0425);}catch(_0xd69e79){if(_0xd69e79 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0xd69e79['message'],'title':_0xd69e79['name'],'status':0x1f4,'instance':'','type':''});throw _0xd69e79;}});}}
|
|
12
|
+
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x580bfa,_0x4defda,_0x59f252,_0x14d194){function _0x3daa5b(_0x50da8d){return _0x50da8d instanceof _0x59f252?_0x50da8d:new _0x59f252(function(_0x43f649){_0x43f649(_0x50da8d);});}return new(_0x59f252||(_0x59f252=Promise))(function(_0x5c5a3d,_0x594aa9){function _0x2a62b5(_0x52b48f){try{_0x305919(_0x14d194['next'](_0x52b48f));}catch(_0x48a6dc){_0x594aa9(_0x48a6dc);}}function _0x8d3f30(_0x543882){try{_0x305919(_0x14d194['throw'](_0x543882));}catch(_0x94c55){_0x594aa9(_0x94c55);}}function _0x305919(_0x3652f8){_0x3652f8['done']?_0x5c5a3d(_0x3652f8['value']):_0x3daa5b(_0x3652f8['value'])['then'](_0x2a62b5,_0x8d3f30);}_0x305919((_0x14d194=_0x14d194['apply'](_0x580bfa,_0x4defda||[]))['next']());});};class AdminClient{constructor(_0x539006='https://admin.searchability.dev/'){var _0x3fd087=new Fetch(_0x539006);this['Accounts']=new AccountService(_0x3fd087),this['Lists']=new ListService(_0x3fd087),this['ApiKeys']=new ApiKeyService(_0x3fd087),this['SearchServices']=new SearchServersService(_0x3fd087);}}class AuthClient{constructor(_0x1f4a08='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x1f4a08);}['login'](_0x2b9ac7){return __awaiter(this,void 0,void 0,function*(){const _0x5c8338='login/'+_0x2b9ac7;try{const _0x494947=yield yield fetch(_0x5c8338);if(_0x494947['status']>0xc7&&_0x494947['status']<0x12c){const _0x3be166=yield _0x494947['json']();return new SuccessfulAuthResponse(_0x3be166);}const _0x13d869=yield _0x494947['json']();return new FailedAuthResponse(_0x13d869);}catch(_0x49d251){if(_0x49d251 instanceof Error)return new FailedAuthResponse({'detail':_0x49d251['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x49d251;}});}['refresh'](_0x4db934){return __awaiter(this,void 0,void 0,function*(){const _0x366f9e='refresh',_0x552bbf={'refresh_token':_0x4db934};try{const _0x2374cd=yield this['fetch']['PostNoAuth'](_0x366f9e,_0x552bbf);if(_0x2374cd['status']>0xc7&&_0x2374cd['status']<0x12c){const _0x327d41=yield _0x2374cd['json']();return new SuccessfulAuthResponse(_0x327d41);}const _0x59ac51=yield _0x2374cd['json']();return new FailedAuthResponse(_0x59ac51);}catch(_0x17e6c0){if(_0x17e6c0 instanceof Error)return new FailedAuthResponse({'detail':_0x17e6c0['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x17e6c0;}});}['getTokenStatus'](_0x3d8e13){if(Date['now']()<_0x3d8e13['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3d8e13['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
+
|
|
15
|
+
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports.TokenStatus = void 0;(function(
|
|
3
|
+
exports.TokenStatus = void 0;(function(_0x2d48b9){_0x2d48b9[_0x2d48b9['Ok']=0x0]='Ok',_0x2d48b9[_0x2d48b9['Refresh']=0x1]='Refresh',_0x2d48b9[_0x2d48b9['Expired']=0x2]='Expired';}(exports.TokenStatus||(exports.TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x36cea9){this['isSuccess']=_0x36cea9;}}class SuccessfulAccountResponse extends Response{constructor(_0x436424){super(!![]),this['account']=_0x436424;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0xcd3a0b){super(!![]),this['list']=_0xcd3a0b;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x4ba35d){super(![]),this['problem']=_0x4ba35d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x4913e6){super(![]),this['problem']=_0x4913e6;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x77722c){super(!![]),this['tokens']=_0x77722c;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x198c3a){super(![]),this['problem']=_0x198c3a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x3db14c){super(!![]),this['apiKey']=_0x3db14c;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x5482c2){super(![]),this['problem']=_0x5482c2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x54ffc0){super(!![]),this['searchService']=_0x54ffc0;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x3b18b0){super(![]),this['problem']=_0x3b18b0;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x27b916){super(!![]),this['searchService']=_0x27b916;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0xbabe32){super(!![]),this['searchServices']=_0xbabe32;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x5b44ea){super(![]),this['problem']=_0x5b44ea;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1d7116){super(![]),this['problem']=_0x1d7116;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x5395aa){super(!![]),this['apiKeyValue']=_0x5395aa;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0xb9330e){super(!![]),this['obj']=_0xb9330e;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x1b95f3){super(![]),this['problem']=_0x1b95f3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x4f0d41){super(![]),this['problem']=_0x4f0d41;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x4d092d,_0x2c130f,_0x5772a3,_0x551dfe){function _0x15e747(_0x33b752){return _0x33b752 instanceof _0x5772a3?_0x33b752:new _0x5772a3(function(_0x5e7c28){_0x5e7c28(_0x33b752);});}return new(_0x5772a3||(_0x5772a3=Promise))(function(_0x31cc4f,_0x242c9b){function _0x2cfac6(_0x190dde){try{_0x446de5(_0x551dfe['next'](_0x190dde));}catch(_0xcaa4dc){_0x242c9b(_0xcaa4dc);}}function _0x3cb3d1(_0x5eeb7f){try{_0x446de5(_0x551dfe['throw'](_0x5eeb7f));}catch(_0x1b14d2){_0x242c9b(_0x1b14d2);}}function _0x446de5(_0x431311){_0x431311['done']?_0x31cc4f(_0x431311['value']):_0x15e747(_0x431311['value'])['then'](_0x2cfac6,_0x3cb3d1);}_0x446de5((_0x551dfe=_0x551dfe['apply'](_0x4d092d,_0x2c130f||[]))['next']());});};class AccountService{constructor(_0x2ea1ea){this['fetch']=_0x2ea1ea;}['get'](_0x3c7617,_0x4dfcd6){return __awaiter$5(this,void 0,void 0,function*(){const _0x1d8a0d='Account/'+_0x3c7617+'/',_0x4f8485=yield this['fetch']['get'](_0x1d8a0d,_0x4dfcd6);try{if(_0x4f8485['status']>0xc7&&_0x4f8485['status']<0x12c){const _0x59ac5e=yield _0x4f8485['json']();return new SuccessfulAccountResponse(_0x59ac5e);}const _0x3be07b=yield _0x4f8485['json']();return new FailedAccountResponse(_0x3be07b);}catch(_0x308180){if(_0x308180 instanceof Error)return new FailedAccountResponse({'detail':_0x308180['message'],'title':_0x308180['name'],'status':0x1f4,'instance':'','type':''});throw _0x308180;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x24d482,_0xf4d54f,_0x39fcf9,_0x6e42b6){function _0x27cdca(_0x52901a){return _0x52901a instanceof _0x39fcf9?_0x52901a:new _0x39fcf9(function(_0xf01f56){_0xf01f56(_0x52901a);});}return new(_0x39fcf9||(_0x39fcf9=Promise))(function(_0x536328,_0x1d676c){function _0x4d5d69(_0x385b85){try{_0x158012(_0x6e42b6['next'](_0x385b85));}catch(_0x374381){_0x1d676c(_0x374381);}}function _0x324b44(_0x530176){try{_0x158012(_0x6e42b6['throw'](_0x530176));}catch(_0x553bcc){_0x1d676c(_0x553bcc);}}function _0x158012(_0x2963cd){_0x2963cd['done']?_0x536328(_0x2963cd['value']):_0x27cdca(_0x2963cd['value'])['then'](_0x4d5d69,_0x324b44);}_0x158012((_0x6e42b6=_0x6e42b6['apply'](_0x24d482,_0xf4d54f||[]))['next']());});};class ApiKeyService{constructor(_0x120b42){this['fetch']=_0x120b42,this['path']='api-key';}['create'](_0x356297,_0x4c06b5,_0x48769c){return __awaiter$4(this,void 0,void 0,function*(){const _0x38b212={'account_name':_0x356297,'api_key_name':_0x4c06b5};try{const _0x5dd74a=yield this['fetch']['post'](this['path'],_0x48769c,_0x38b212);if(_0x5dd74a['status']>0xc7&&_0x5dd74a['status']<0x12c){const _0x568c91=yield _0x5dd74a['json']();return new SuccessfulApiKeyResponse(_0x568c91);}const _0x15a6f9=yield _0x5dd74a['json']();return new FailedApiKeyResponse(_0x15a6f9);}catch(_0x419211){if(_0x419211 instanceof Error)return new FailedApiKeyResponse({'detail':_0x419211['message'],'title':_0x419211['name'],'status':0x1f4,'instance':'','type':''});throw _0x419211;}});}['view'](_0x23ead0,_0x676fd9,_0x5d6843){return __awaiter$4(this,void 0,void 0,function*(){const _0x5add62=this['path']+'/'+_0x23ead0+'/'+_0x676fd9;try{const _0xfd5eff=yield this['fetch']['get'](_0x5add62,_0x5d6843);if(_0xfd5eff['status']>0xc7&&_0xfd5eff['status']<0x12c){const _0x460ae8=yield _0xfd5eff['json']();return new SuccessfulApiKeyValueResponse(_0x460ae8);}const _0x43eff5=yield _0xfd5eff['json']();return new FailedApiKeyValueResponse(_0x43eff5);}catch(_0x274298){if(_0x274298 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x274298['message'],'title':_0x274298['name'],'status':0x1f4,'instance':'','type':''});throw _0x274298;}});}['delete'](_0x21f338,_0x3791a2,_0x1723f1){return __awaiter$4(this,void 0,void 0,function*(){const _0x21907b=this['path']+'/'+_0x21f338+'/'+_0x3791a2;try{const _0xd844a3=yield this['fetch']['delete'](_0x21907b,_0x1723f1);if(_0xd844a3['status']>0xc7&&_0xd844a3['status']<0x12c)return new SuccessfulResponse({});const _0xfff0c4=yield _0xd844a3['json']();return new FailedResponse(_0xfff0c4);}catch(_0xc9f2ee){if(_0xc9f2ee instanceof Error)return new FailedResponse({'detail':_0xc9f2ee['message'],'title':_0xc9f2ee['name'],'status':0x1f4,'instance':'','type':''});throw _0xc9f2ee;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5a3dc7,_0x18d12a,_0x2bc141,_0xd7c18a){function _0x588824(_0x3b3919){return _0x3b3919 instanceof _0x2bc141?_0x3b3919:new _0x2bc141(function(_0xbb68e0){_0xbb68e0(_0x3b3919);});}return new(_0x2bc141||(_0x2bc141=Promise))(function(_0x45aae3,_0x26ca65){function _0x5c1555(_0x20a7e1){try{_0x291822(_0xd7c18a['next'](_0x20a7e1));}catch(_0x2ff207){_0x26ca65(_0x2ff207);}}function _0xe1640f(_0x2b9631){try{_0x291822(_0xd7c18a['throw'](_0x2b9631));}catch(_0x55b078){_0x26ca65(_0x55b078);}}function _0x291822(_0x2e5e61){_0x2e5e61['done']?_0x45aae3(_0x2e5e61['value']):_0x588824(_0x2e5e61['value'])['then'](_0x5c1555,_0xe1640f);}_0x291822((_0xd7c18a=_0xd7c18a['apply'](_0x5a3dc7,_0x18d12a||[]))['next']());});};class ListService{constructor(_0xe09779){this['fetch']=_0xe09779;}['add'](_0x3dc361,_0x5c8ba9,_0x4ce58c,_0x33d97b){return __awaiter$3(this,void 0,void 0,function*(){const _0x5db087='List',_0xfb2ec5={'account_name':_0x3dc361,'list_name':_0x5c8ba9,'search_service_name':_0x4ce58c};try{const _0x2ddcec=yield this['fetch']['post'](_0x5db087,_0x33d97b,_0xfb2ec5);if(_0x2ddcec['status']>0xc7&&_0x2ddcec['status']<0x12c){const _0x1bc970=yield _0x2ddcec['json']();return new SuccessfulListIdentityResponse(_0x1bc970);}const _0x340dd4=yield _0x2ddcec['json']();return new FailedListIdentityResponse(_0x340dd4);}catch(_0x18046a){if(_0x18046a instanceof Error)return new FailedListIdentityResponse({'detail':_0x18046a['message'],'title':_0x18046a['name'],'status':0x1f4,'instance':'','type':''});throw _0x18046a;}});}['delete'](_0x35cfa1,_0x2974de,_0x842cb6){return __awaiter$3(this,void 0,void 0,function*(){const _0x524d72='List/'+_0x35cfa1+'/'+_0x2974de,_0x25a7b7=yield this['fetch']['delete'](_0x524d72,_0x842cb6);try{if(_0x25a7b7['status']>0xc7&&_0x25a7b7['status']<0x12c){const _0x41d3af=yield _0x25a7b7['json']();return new SuccessfulResponse({});}const _0x5e99a5=yield _0x25a7b7['json']();return new FailedResponse(_0x5e99a5);}catch(_0x4b68fb){if(_0x4b68fb instanceof Error)return new FailedResponse({'detail':_0x4b68fb['message'],'title':_0x4b68fb['name'],'status':0x1f4,'instance':'','type':''});throw _0x4b68fb;}});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x1662e8,_0x4351e1,_0x120107,_0x351d2e){function _0x34d7eb(_0x5244fd){return _0x5244fd instanceof _0x120107?_0x5244fd:new _0x120107(function(_0x288426){_0x288426(_0x5244fd);});}return new(_0x120107||(_0x120107=Promise))(function(_0x2cce69,_0x3d95d5){function _0x4b7262(_0x3e466f){try{_0x4d0b97(_0x351d2e['next'](_0x3e466f));}catch(_0x394cfe){_0x3d95d5(_0x394cfe);}}function _0x364ce7(_0x4ba6e3){try{_0x4d0b97(_0x351d2e['throw'](_0x4ba6e3));}catch(_0x56778d){_0x3d95d5(_0x56778d);}}function _0x4d0b97(_0x5deaa9){_0x5deaa9['done']?_0x2cce69(_0x5deaa9['value']):_0x34d7eb(_0x5deaa9['value'])['then'](_0x4b7262,_0x364ce7);}_0x4d0b97((_0x351d2e=_0x351d2e['apply'](_0x1662e8,_0x4351e1||[]))['next']());});};class Fetch{constructor(_0x544f21){this['baseUri']=_0x544f21,this['getUrl']=_0x1b8d2f=>{return _0x1b8d2f['startsWith']('/')&&(_0x1b8d2f=_0x1b8d2f['replace']('/','')),''+this['baseUri']+_0x1b8d2f;},!_0x544f21['endsWith']('/')&&(_0x544f21=_0x544f21+'/');}['get'](_0x21ff2b,_0x23a592){return __awaiter$2(this,void 0,void 0,function*(){const _0x5427a0=this['getUrl'](_0x21ff2b);return yield fetch(_0x5427a0,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x23a592}});});}['post'](_0x620b97,_0x239f2d,_0x4036e9){return __awaiter$2(this,void 0,void 0,function*(){const _0x16efb7=this['getUrl'](_0x620b97);return yield fetch(_0x16efb7,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x239f2d},'body':_0x4036e9?JSON['stringify'](_0x4036e9):null});});}['PostNoAuth'](_0x4ad639,_0x558a38){return __awaiter$2(this,void 0,void 0,function*(){const _0x17d259=this['getUrl'](_0x4ad639);return yield fetch(_0x17d259,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x558a38?JSON['stringify'](_0x558a38):null});});}['put'](_0x5a8bf0,_0x505e35,_0x3f220e){return __awaiter$2(this,void 0,void 0,function*(){const _0x1c5c5b=this['getUrl'](_0x5a8bf0);return yield fetch(_0x1c5c5b,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x505e35},'body':_0x3f220e?JSON['stringify'](_0x3f220e):null});});}['delete'](_0x2b3c2b,_0x234022){return __awaiter$2(this,void 0,void 0,function*(){const _0x46e971=this['getUrl'](_0x2b3c2b);return yield fetch(_0x46e971,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x234022}});});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x472044,_0x41162e,_0x534f25,_0x14528d){function _0x1c9775(_0x26fc34){return _0x26fc34 instanceof _0x534f25?_0x26fc34:new _0x534f25(function(_0x3a6859){_0x3a6859(_0x26fc34);});}return new(_0x534f25||(_0x534f25=Promise))(function(_0x1b0b5d,_0x59a150){function _0x441282(_0x350430){try{_0x6898e(_0x14528d['next'](_0x350430));}catch(_0x3d6839){_0x59a150(_0x3d6839);}}function _0xe31d4c(_0x33badd){try{_0x6898e(_0x14528d['throw'](_0x33badd));}catch(_0x3490f9){_0x59a150(_0x3490f9);}}function _0x6898e(_0x21ffb6){_0x21ffb6['done']?_0x1b0b5d(_0x21ffb6['value']):_0x1c9775(_0x21ffb6['value'])['then'](_0x441282,_0xe31d4c);}_0x6898e((_0x14528d=_0x14528d['apply'](_0x472044,_0x41162e||[]))['next']());});};class SearchServersService{constructor(_0x456268){this['fetch']=_0x456268,this['path']='search-services';}['create'](_0x54103e,_0x4ab377,_0x5a675e,_0x2d7e6d,_0x11bd5b,_0x2a544a,_0x26647b,_0x6596a1){return __awaiter$1(this,void 0,void 0,function*(){const _0x5cba27={'account_name':_0x54103e,'search_service_name':_0x4ab377,'endpoint':_0x5a675e,'key':_0x2d7e6d,'country':_0x11bd5b,'provider':_0x2a544a,'index_name':_0x26647b};try{const _0x6d36a4=yield this['fetch']['post'](this['path'],_0x6596a1,_0x5cba27);if(_0x6d36a4['status']>0xc7&&_0x6d36a4['status']<0x12c){const _0x532d0a=yield _0x6d36a4['json']();return new SuccessfulSearchServiceResponse(_0x532d0a);}const _0x456be6=yield _0x6d36a4['json']();return new FailedSearchServiceResponse(_0x456be6);}catch(_0x3922ec){if(_0x3922ec instanceof Error)return new FailedSearchServiceResponse({'detail':_0x3922ec['message'],'title':_0x3922ec['name'],'status':0x1f4,'instance':'','type':''});throw _0x3922ec;}});}['delete'](_0x451f08,_0x1b744d,_0x4163e0){return __awaiter$1(this,void 0,void 0,function*(){const _0x3b0b69=this['path']+'/'+_0x451f08+'/'+_0x1b744d;try{const _0x8b0201=yield this['fetch']['delete'](_0x3b0b69,_0x4163e0);if(_0x8b0201['status']>0xc7&&_0x8b0201['status']<0x12c)return new SuccessfulResponse({});const _0x3a3a31=yield _0x8b0201['json']();return new FailedResponse(_0x3a3a31);}catch(_0x52480e){if(_0x52480e instanceof Error)return new FailedResponse({'detail':_0x52480e['message'],'title':_0x52480e['name'],'status':0x1f4,'instance':'','type':''});throw _0x52480e;}});}['view'](_0x10b29c,_0x8a94f0,_0x242e3f){return __awaiter$1(this,void 0,void 0,function*(){const _0x48eec0=this['path']+'/'+_0x10b29c+'/'+_0x8a94f0;try{const _0x51868a=yield this['fetch']['get'](_0x48eec0,_0x242e3f);if(_0x51868a['status']>0xc7&&_0x51868a['status']<0x12c){const _0x171f7e=yield _0x51868a['json']();return new SuccessfulViewSearchServiceResponse(_0x171f7e);}const _0x4a40a8=yield _0x51868a['json']();return new FailedViewSearchServiceResponse(_0x4a40a8);}catch(_0x4d6211){if(_0x4d6211 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x4d6211['message'],'title':_0x4d6211['name'],'status':0x1f4,'instance':'','type':''});throw _0x4d6211;}});}['edit'](_0x58d898,_0x5ac8e1,_0x43d3f9,_0x5be5d6,_0x319955,_0x28f09d){return __awaiter$1(this,void 0,void 0,function*(){const _0x3a441f={'account_name':_0x58d898,'search_service_name':_0x5ac8e1,'new_search_service_name':_0x43d3f9,'key':_0x5be5d6,'country':_0x319955};try{const _0x450bfc=yield this['fetch']['put'](this['path'],_0x28f09d,_0x3a441f);if(_0x450bfc['status']>0xc7&&_0x450bfc['status']<0x12c){const _0x5381db=yield _0x450bfc['json']();return new SuccessfulSearchServiceResponse(_0x5381db);}const _0x21457f=yield _0x450bfc['json']();return new FailedSearchServiceResponse(_0x21457f);}catch(_0x461ed8){if(_0x461ed8 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x461ed8['message'],'title':_0x461ed8['name'],'status':0x1f4,'instance':'','type':''});throw _0x461ed8;}});}['list'](_0x300234,_0xd882ea){return __awaiter$1(this,void 0,void 0,function*(){const _0x44a770=this['path']+'/'+_0x300234;try{const _0x33e8da=yield this['fetch']['get'](_0x44a770,_0xd882ea);if(_0x33e8da['status']>0xc7&&_0x33e8da['status']<0x12c){const _0xa42780=yield _0x33e8da['json']();return new SuccessfulListSearchServiceResponse(_0xa42780);}const _0x2e1367=yield _0x33e8da['json']();return new FailedViewSearchServicesResponse(_0x2e1367);}catch(_0x18a369){if(_0x18a369 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x18a369['message'],'title':_0x18a369['name'],'status':0x1f4,'instance':'','type':''});throw _0x18a369;}});}}
|
|
14
14
|
|
|
15
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
15
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4533fc,_0x5121c4,_0x1c784d,_0x2120cb){function _0x1d9792(_0x226e88){return _0x226e88 instanceof _0x1c784d?_0x226e88:new _0x1c784d(function(_0x70600d){_0x70600d(_0x226e88);});}return new(_0x1c784d||(_0x1c784d=Promise))(function(_0x336753,_0x4ef15d){function _0x2e2c24(_0x4a8177){try{_0x392036(_0x2120cb['next'](_0x4a8177));}catch(_0x200d2b){_0x4ef15d(_0x200d2b);}}function _0xfad683(_0x4d7716){try{_0x392036(_0x2120cb['throw'](_0x4d7716));}catch(_0x3445dd){_0x4ef15d(_0x3445dd);}}function _0x392036(_0x2f8eee){_0x2f8eee['done']?_0x336753(_0x2f8eee['value']):_0x1d9792(_0x2f8eee['value'])['then'](_0x2e2c24,_0xfad683);}_0x392036((_0x2120cb=_0x2120cb['apply'](_0x4533fc,_0x5121c4||[]))['next']());});};class AdminClient{constructor(_0x4402b0='https://admin.searchability.dev/'){var _0x32db57=new Fetch(_0x4402b0);this['Accounts']=new AccountService(_0x32db57),this['Lists']=new ListService(_0x32db57),this['ApiKeys']=new ApiKeyService(_0x32db57),this['SearchServices']=new SearchServersService(_0x32db57);}}class AuthClient{constructor(_0x422da3='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x422da3);}['login'](_0x2428e9){return __awaiter(this,void 0,void 0,function*(){const _0x21608b='login/'+_0x2428e9;try{const _0x1965df=yield yield fetch(_0x21608b);if(_0x1965df['status']>0xc7&&_0x1965df['status']<0x12c){const _0xbc2ee=yield _0x1965df['json']();return new SuccessfulAuthResponse(_0xbc2ee);}const _0xc47595=yield _0x1965df['json']();return new FailedAuthResponse(_0xc47595);}catch(_0x838c03){if(_0x838c03 instanceof Error)return new FailedAuthResponse({'detail':_0x838c03['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x838c03;}});}['refresh'](_0x284bfa){return __awaiter(this,void 0,void 0,function*(){const _0x403c38='refresh',_0x14174f={'refresh_token':_0x284bfa};try{const _0x1a2c4c=yield this['fetch']['PostNoAuth'](_0x403c38,_0x14174f);if(_0x1a2c4c['status']>0xc7&&_0x1a2c4c['status']<0x12c){const _0x492469=yield _0x1a2c4c['json']();return new SuccessfulAuthResponse(_0x492469);}const _0x863366=yield _0x1a2c4c['json']();return new FailedAuthResponse(_0x863366);}catch(_0x532292){if(_0x532292 instanceof Error)return new FailedAuthResponse({'detail':_0x532292['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x532292;}});}['getTokenStatus'](_0x488c71){if(Date['now']()<_0x488c71['access_expires'])return exports.TokenStatus['Ok'];if(Date['now']()<_0x488c71['refresh_expires'])return exports.TokenStatus['Refresh'];return exports.TokenStatus['Expired'];}}
|
|
16
16
|
|
|
17
17
|
exports.AdminClient = AdminClient;
|
|
18
18
|
exports.AuthClient = AuthClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var TokenStatus;(function(
|
|
1
|
+
var TokenStatus;(function(_0x153689){_0x153689[_0x153689['Ok']=0x0]='Ok',_0x153689[_0x153689['Refresh']=0x1]='Refresh',_0x153689[_0x153689['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x10070e){this['isSuccess']=_0x10070e;}}class SuccessfulAccountResponse extends Response{constructor(_0x3edcf7){super(!![]),this['account']=_0x3edcf7;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x1ce362){super(!![]),this['list']=_0x1ce362;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x5a1c5b){super(![]),this['problem']=_0x5a1c5b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x53810e){super(![]),this['problem']=_0x53810e;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4b58eb){super(!![]),this['tokens']=_0x4b58eb;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x52eb4d){super(![]),this['problem']=_0x52eb4d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x32032a){super(!![]),this['apiKey']=_0x32032a;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x50e8fa){super(![]),this['problem']=_0x50e8fa;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x41ddc5){super(!![]),this['searchService']=_0x41ddc5;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x13de3f){super(![]),this['problem']=_0x13de3f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x3454cf){super(!![]),this['searchService']=_0x3454cf;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x58adee){super(!![]),this['searchServices']=_0x58adee;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x162e5b){super(![]),this['problem']=_0x162e5b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x4de720){super(![]),this['problem']=_0x4de720;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x1c5d6d){super(!![]),this['apiKeyValue']=_0x1c5d6d;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x142fab){super(!![]),this['obj']=_0x142fab;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x184e09){super(![]),this['problem']=_0x184e09;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x436126){super(![]),this['problem']=_0x436126;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
2
|
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(
|
|
3
|
+
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x1ea23a,_0x41763a,_0x1d37eb,_0x44cde9){function _0x227f0e(_0x952e73){return _0x952e73 instanceof _0x1d37eb?_0x952e73:new _0x1d37eb(function(_0xe5691){_0xe5691(_0x952e73);});}return new(_0x1d37eb||(_0x1d37eb=Promise))(function(_0x386284,_0x10cdc3){function _0x526f2e(_0x42ecbe){try{_0x731dc9(_0x44cde9['next'](_0x42ecbe));}catch(_0x33236d){_0x10cdc3(_0x33236d);}}function _0x48e7a7(_0x5ae244){try{_0x731dc9(_0x44cde9['throw'](_0x5ae244));}catch(_0x47c4f1){_0x10cdc3(_0x47c4f1);}}function _0x731dc9(_0x3e0c73){_0x3e0c73['done']?_0x386284(_0x3e0c73['value']):_0x227f0e(_0x3e0c73['value'])['then'](_0x526f2e,_0x48e7a7);}_0x731dc9((_0x44cde9=_0x44cde9['apply'](_0x1ea23a,_0x41763a||[]))['next']());});};class AccountService{constructor(_0x37cfbd){this['fetch']=_0x37cfbd;}['get'](_0x933e9a,_0x20c96d){return __awaiter$5(this,void 0,void 0,function*(){const _0x28b243='Account/'+_0x933e9a+'/',_0x2ffe35=yield this['fetch']['get'](_0x28b243,_0x20c96d);try{if(_0x2ffe35['status']>0xc7&&_0x2ffe35['status']<0x12c){const _0x342988=yield _0x2ffe35['json']();return new SuccessfulAccountResponse(_0x342988);}const _0x544eb9=yield _0x2ffe35['json']();return new FailedAccountResponse(_0x544eb9);}catch(_0x2c41a0){if(_0x2c41a0 instanceof Error)return new FailedAccountResponse({'detail':_0x2c41a0['message'],'title':_0x2c41a0['name'],'status':0x1f4,'instance':'','type':''});throw _0x2c41a0;}});}}
|
|
4
4
|
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(
|
|
5
|
+
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x9413e6,_0x23ec10,_0x5b0a22,_0x30ace4){function _0x34d972(_0xfc20fd){return _0xfc20fd instanceof _0x5b0a22?_0xfc20fd:new _0x5b0a22(function(_0x2c6b0c){_0x2c6b0c(_0xfc20fd);});}return new(_0x5b0a22||(_0x5b0a22=Promise))(function(_0x511bda,_0x35f709){function _0x377d37(_0x24bea7){try{_0x3d6d2c(_0x30ace4['next'](_0x24bea7));}catch(_0xd5bf17){_0x35f709(_0xd5bf17);}}function _0x922c65(_0x536c2f){try{_0x3d6d2c(_0x30ace4['throw'](_0x536c2f));}catch(_0x3ca593){_0x35f709(_0x3ca593);}}function _0x3d6d2c(_0x2057ea){_0x2057ea['done']?_0x511bda(_0x2057ea['value']):_0x34d972(_0x2057ea['value'])['then'](_0x377d37,_0x922c65);}_0x3d6d2c((_0x30ace4=_0x30ace4['apply'](_0x9413e6,_0x23ec10||[]))['next']());});};class ApiKeyService{constructor(_0x50d1a7){this['fetch']=_0x50d1a7,this['path']='api-key';}['create'](_0x296dae,_0xf4875e,_0x4220eb){return __awaiter$4(this,void 0,void 0,function*(){const _0x4bb96f={'account_name':_0x296dae,'api_key_name':_0xf4875e};try{const _0x574f70=yield this['fetch']['post'](this['path'],_0x4220eb,_0x4bb96f);if(_0x574f70['status']>0xc7&&_0x574f70['status']<0x12c){const _0x7765f3=yield _0x574f70['json']();return new SuccessfulApiKeyResponse(_0x7765f3);}const _0x2b9be2=yield _0x574f70['json']();return new FailedApiKeyResponse(_0x2b9be2);}catch(_0x241d2c){if(_0x241d2c instanceof Error)return new FailedApiKeyResponse({'detail':_0x241d2c['message'],'title':_0x241d2c['name'],'status':0x1f4,'instance':'','type':''});throw _0x241d2c;}});}['view'](_0x1582ef,_0x3b1802,_0x12b9b2){return __awaiter$4(this,void 0,void 0,function*(){const _0x483ba6=this['path']+'/'+_0x1582ef+'/'+_0x3b1802;try{const _0x106f62=yield this['fetch']['get'](_0x483ba6,_0x12b9b2);if(_0x106f62['status']>0xc7&&_0x106f62['status']<0x12c){const _0xfe6e41=yield _0x106f62['json']();return new SuccessfulApiKeyValueResponse(_0xfe6e41);}const _0x3c3999=yield _0x106f62['json']();return new FailedApiKeyValueResponse(_0x3c3999);}catch(_0x3e3efc){if(_0x3e3efc instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x3e3efc['message'],'title':_0x3e3efc['name'],'status':0x1f4,'instance':'','type':''});throw _0x3e3efc;}});}['delete'](_0x2ce01b,_0x273481,_0x3f4d56){return __awaiter$4(this,void 0,void 0,function*(){const _0x29ed89=this['path']+'/'+_0x2ce01b+'/'+_0x273481;try{const _0x40e951=yield this['fetch']['delete'](_0x29ed89,_0x3f4d56);if(_0x40e951['status']>0xc7&&_0x40e951['status']<0x12c)return new SuccessfulResponse({});const _0x45a00c=yield _0x40e951['json']();return new FailedResponse(_0x45a00c);}catch(_0x214916){if(_0x214916 instanceof Error)return new FailedResponse({'detail':_0x214916['message'],'title':_0x214916['name'],'status':0x1f4,'instance':'','type':''});throw _0x214916;}});}}
|
|
6
6
|
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(
|
|
7
|
+
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x2704ad,_0x56c8a0,_0x38950e,_0x5f0396){function _0x46d09b(_0x354e26){return _0x354e26 instanceof _0x38950e?_0x354e26:new _0x38950e(function(_0x2c5bfa){_0x2c5bfa(_0x354e26);});}return new(_0x38950e||(_0x38950e=Promise))(function(_0x5a60c4,_0x1d8b78){function _0x910245(_0x4ac265){try{_0x11c6c5(_0x5f0396['next'](_0x4ac265));}catch(_0x76cfb3){_0x1d8b78(_0x76cfb3);}}function _0x1cce60(_0x53323f){try{_0x11c6c5(_0x5f0396['throw'](_0x53323f));}catch(_0x26174a){_0x1d8b78(_0x26174a);}}function _0x11c6c5(_0x510e69){_0x510e69['done']?_0x5a60c4(_0x510e69['value']):_0x46d09b(_0x510e69['value'])['then'](_0x910245,_0x1cce60);}_0x11c6c5((_0x5f0396=_0x5f0396['apply'](_0x2704ad,_0x56c8a0||[]))['next']());});};class ListService{constructor(_0x1ac37b){this['fetch']=_0x1ac37b;}['add'](_0x5e4883,_0x1b0881,_0x3c8a01,_0x2d3564){return __awaiter$3(this,void 0,void 0,function*(){const _0x234ab0='List',_0x7ac033={'account_name':_0x5e4883,'list_name':_0x1b0881,'search_service_name':_0x3c8a01};try{const _0x5820e4=yield this['fetch']['post'](_0x234ab0,_0x2d3564,_0x7ac033);if(_0x5820e4['status']>0xc7&&_0x5820e4['status']<0x12c){const _0x4f7ef7=yield _0x5820e4['json']();return new SuccessfulListIdentityResponse(_0x4f7ef7);}const _0x4e79e6=yield _0x5820e4['json']();return new FailedListIdentityResponse(_0x4e79e6);}catch(_0x550a71){if(_0x550a71 instanceof Error)return new FailedListIdentityResponse({'detail':_0x550a71['message'],'title':_0x550a71['name'],'status':0x1f4,'instance':'','type':''});throw _0x550a71;}});}['delete'](_0x2c98de,_0x3eb9cd,_0x119ba1){return __awaiter$3(this,void 0,void 0,function*(){const _0x1745bb='List/'+_0x2c98de+'/'+_0x3eb9cd,_0x36b2c5=yield this['fetch']['delete'](_0x1745bb,_0x119ba1);try{if(_0x36b2c5['status']>0xc7&&_0x36b2c5['status']<0x12c){const _0x10e726=yield _0x36b2c5['json']();return new SuccessfulResponse({});}const _0x4f84d0=yield _0x36b2c5['json']();return new FailedResponse(_0x4f84d0);}catch(_0x542285){if(_0x542285 instanceof Error)return new FailedResponse({'detail':_0x542285['message'],'title':_0x542285['name'],'status':0x1f4,'instance':'','type':''});throw _0x542285;}});}}
|
|
8
8
|
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(
|
|
9
|
+
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x20c5b3,_0x127b6c,_0x144635,_0x44c69d){function _0x21d51b(_0xf45ec6){return _0xf45ec6 instanceof _0x144635?_0xf45ec6:new _0x144635(function(_0x10af1c){_0x10af1c(_0xf45ec6);});}return new(_0x144635||(_0x144635=Promise))(function(_0x380b5a,_0x26c943){function _0x256923(_0x359ad6){try{_0x9a4915(_0x44c69d['next'](_0x359ad6));}catch(_0x8ee4f8){_0x26c943(_0x8ee4f8);}}function _0x304af6(_0x5ac963){try{_0x9a4915(_0x44c69d['throw'](_0x5ac963));}catch(_0x410224){_0x26c943(_0x410224);}}function _0x9a4915(_0x7f1f7e){_0x7f1f7e['done']?_0x380b5a(_0x7f1f7e['value']):_0x21d51b(_0x7f1f7e['value'])['then'](_0x256923,_0x304af6);}_0x9a4915((_0x44c69d=_0x44c69d['apply'](_0x20c5b3,_0x127b6c||[]))['next']());});};class Fetch{constructor(_0x24ff7c){this['baseUri']=_0x24ff7c,this['getUrl']=_0x387801=>{return _0x387801['startsWith']('/')&&(_0x387801=_0x387801['replace']('/','')),''+this['baseUri']+_0x387801;},!_0x24ff7c['endsWith']('/')&&(_0x24ff7c=_0x24ff7c+'/');}['get'](_0x39a1f8,_0x150680){return __awaiter$2(this,void 0,void 0,function*(){const _0x2a96e6=this['getUrl'](_0x39a1f8);return yield fetch(_0x2a96e6,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x150680}});});}['post'](_0x3d8d19,_0x245f1a,_0x9f85f3){return __awaiter$2(this,void 0,void 0,function*(){const _0x22b7be=this['getUrl'](_0x3d8d19);return yield fetch(_0x22b7be,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x245f1a},'body':_0x9f85f3?JSON['stringify'](_0x9f85f3):null});});}['PostNoAuth'](_0x271e2d,_0x5729d1){return __awaiter$2(this,void 0,void 0,function*(){const _0x4d6d76=this['getUrl'](_0x271e2d);return yield fetch(_0x4d6d76,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x5729d1?JSON['stringify'](_0x5729d1):null});});}['put'](_0x198603,_0x421e4d,_0x345beb){return __awaiter$2(this,void 0,void 0,function*(){const _0x185e3f=this['getUrl'](_0x198603);return yield fetch(_0x185e3f,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x421e4d},'body':_0x345beb?JSON['stringify'](_0x345beb):null});});}['delete'](_0x23ec04,_0x45e1c5){return __awaiter$2(this,void 0,void 0,function*(){const _0x10da4e=this['getUrl'](_0x23ec04);return yield fetch(_0x10da4e,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x45e1c5}});});}}
|
|
10
10
|
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(
|
|
11
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x4cfd74,_0x1e6c1c,_0x4ceee3,_0x588068){function _0x17667d(_0x35479f){return _0x35479f instanceof _0x4ceee3?_0x35479f:new _0x4ceee3(function(_0x164373){_0x164373(_0x35479f);});}return new(_0x4ceee3||(_0x4ceee3=Promise))(function(_0x27be0b,_0x359567){function _0x21a536(_0x2ff402){try{_0x51c17f(_0x588068['next'](_0x2ff402));}catch(_0x34d4c5){_0x359567(_0x34d4c5);}}function _0x19c080(_0x103028){try{_0x51c17f(_0x588068['throw'](_0x103028));}catch(_0x5cc1c6){_0x359567(_0x5cc1c6);}}function _0x51c17f(_0xd56060){_0xd56060['done']?_0x27be0b(_0xd56060['value']):_0x17667d(_0xd56060['value'])['then'](_0x21a536,_0x19c080);}_0x51c17f((_0x588068=_0x588068['apply'](_0x4cfd74,_0x1e6c1c||[]))['next']());});};class SearchServersService{constructor(_0x52b150){this['fetch']=_0x52b150,this['path']='search-services';}['create'](_0x57bbc0,_0x4d52c5,_0xe01f47,_0x2ab26b,_0x20df33,_0xb4c848,_0x357ec0,_0x5643d6){return __awaiter$1(this,void 0,void 0,function*(){const _0x69c31c={'account_name':_0x57bbc0,'search_service_name':_0x4d52c5,'endpoint':_0xe01f47,'key':_0x2ab26b,'country':_0x20df33,'provider':_0xb4c848,'index_name':_0x357ec0};try{const _0x4a45df=yield this['fetch']['post'](this['path'],_0x5643d6,_0x69c31c);if(_0x4a45df['status']>0xc7&&_0x4a45df['status']<0x12c){const _0x1e7184=yield _0x4a45df['json']();return new SuccessfulSearchServiceResponse(_0x1e7184);}const _0x3308d4=yield _0x4a45df['json']();return new FailedSearchServiceResponse(_0x3308d4);}catch(_0xa26e87){if(_0xa26e87 instanceof Error)return new FailedSearchServiceResponse({'detail':_0xa26e87['message'],'title':_0xa26e87['name'],'status':0x1f4,'instance':'','type':''});throw _0xa26e87;}});}['delete'](_0x4b3b28,_0x11172b,_0x3bfb03){return __awaiter$1(this,void 0,void 0,function*(){const _0x18aa5e=this['path']+'/'+_0x4b3b28+'/'+_0x11172b;try{const _0x34dfff=yield this['fetch']['delete'](_0x18aa5e,_0x3bfb03);if(_0x34dfff['status']>0xc7&&_0x34dfff['status']<0x12c)return new SuccessfulResponse({});const _0x1bd43a=yield _0x34dfff['json']();return new FailedResponse(_0x1bd43a);}catch(_0xf7d186){if(_0xf7d186 instanceof Error)return new FailedResponse({'detail':_0xf7d186['message'],'title':_0xf7d186['name'],'status':0x1f4,'instance':'','type':''});throw _0xf7d186;}});}['view'](_0x43a899,_0x514e41,_0x2626bf){return __awaiter$1(this,void 0,void 0,function*(){const _0x157b21=this['path']+'/'+_0x43a899+'/'+_0x514e41;try{const _0x519b58=yield this['fetch']['get'](_0x157b21,_0x2626bf);if(_0x519b58['status']>0xc7&&_0x519b58['status']<0x12c){const _0x489b65=yield _0x519b58['json']();return new SuccessfulViewSearchServiceResponse(_0x489b65);}const _0xbe68bd=yield _0x519b58['json']();return new FailedViewSearchServiceResponse(_0xbe68bd);}catch(_0xc3d335){if(_0xc3d335 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0xc3d335['message'],'title':_0xc3d335['name'],'status':0x1f4,'instance':'','type':''});throw _0xc3d335;}});}['edit'](_0x4ac268,_0xdd786f,_0x50fecd,_0x5f24a4,_0x37082f,_0x32a0ae){return __awaiter$1(this,void 0,void 0,function*(){const _0x25ff8d={'account_name':_0x4ac268,'search_service_name':_0xdd786f,'new_search_service_name':_0x50fecd,'key':_0x5f24a4,'country':_0x37082f};try{const _0x3d028d=yield this['fetch']['put'](this['path'],_0x32a0ae,_0x25ff8d);if(_0x3d028d['status']>0xc7&&_0x3d028d['status']<0x12c){const _0xf01ea6=yield _0x3d028d['json']();return new SuccessfulSearchServiceResponse(_0xf01ea6);}const _0x4fd514=yield _0x3d028d['json']();return new FailedSearchServiceResponse(_0x4fd514);}catch(_0x1f00e1){if(_0x1f00e1 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x1f00e1['message'],'title':_0x1f00e1['name'],'status':0x1f4,'instance':'','type':''});throw _0x1f00e1;}});}['list'](_0x3b9fa8,_0x3b6a20){return __awaiter$1(this,void 0,void 0,function*(){const _0x13f7b1=this['path']+'/'+_0x3b9fa8;try{const _0x1008d9=yield this['fetch']['get'](_0x13f7b1,_0x3b6a20);if(_0x1008d9['status']>0xc7&&_0x1008d9['status']<0x12c){const _0x33e831=yield _0x1008d9['json']();return new SuccessfulListSearchServiceResponse(_0x33e831);}const _0xcefdd5=yield _0x1008d9['json']();return new FailedViewSearchServicesResponse(_0xcefdd5);}catch(_0x580988){if(_0x580988 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x580988['message'],'title':_0x580988['name'],'status':0x1f4,'instance':'','type':''});throw _0x580988;}});}}
|
|
12
12
|
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(
|
|
13
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x8db23,_0x33e99b,_0x421b51,_0x233461){function _0x251216(_0x508ccd){return _0x508ccd instanceof _0x421b51?_0x508ccd:new _0x421b51(function(_0x484c19){_0x484c19(_0x508ccd);});}return new(_0x421b51||(_0x421b51=Promise))(function(_0x49c43d,_0x203b7e){function _0x2b1790(_0x240408){try{_0x3a1fef(_0x233461['next'](_0x240408));}catch(_0x11fcf8){_0x203b7e(_0x11fcf8);}}function _0x26c97f(_0x33d14d){try{_0x3a1fef(_0x233461['throw'](_0x33d14d));}catch(_0x391129){_0x203b7e(_0x391129);}}function _0x3a1fef(_0x219a97){_0x219a97['done']?_0x49c43d(_0x219a97['value']):_0x251216(_0x219a97['value'])['then'](_0x2b1790,_0x26c97f);}_0x3a1fef((_0x233461=_0x233461['apply'](_0x8db23,_0x33e99b||[]))['next']());});};class AdminClient{constructor(_0x5648cb='https://admin.searchability.dev/'){var _0x5cf6f2=new Fetch(_0x5648cb);this['Accounts']=new AccountService(_0x5cf6f2),this['Lists']=new ListService(_0x5cf6f2),this['ApiKeys']=new ApiKeyService(_0x5cf6f2),this['SearchServices']=new SearchServersService(_0x5cf6f2);}}class AuthClient{constructor(_0x37d78f='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x37d78f);}['login'](_0x184cd5){return __awaiter(this,void 0,void 0,function*(){const _0x5a244b='login/'+_0x184cd5;try{const _0x447217=yield yield fetch(_0x5a244b);if(_0x447217['status']>0xc7&&_0x447217['status']<0x12c){const _0x12b4c4=yield _0x447217['json']();return new SuccessfulAuthResponse(_0x12b4c4);}const _0x6a1559=yield _0x447217['json']();return new FailedAuthResponse(_0x6a1559);}catch(_0x10476f){if(_0x10476f instanceof Error)return new FailedAuthResponse({'detail':_0x10476f['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x10476f;}});}['refresh'](_0x9d3de1){return __awaiter(this,void 0,void 0,function*(){const _0x40be3d='refresh',_0x235380={'refresh_token':_0x9d3de1};try{const _0x123b19=yield this['fetch']['PostNoAuth'](_0x40be3d,_0x235380);if(_0x123b19['status']>0xc7&&_0x123b19['status']<0x12c){const _0x59d0eb=yield _0x123b19['json']();return new SuccessfulAuthResponse(_0x59d0eb);}const _0x531a3a=yield _0x123b19['json']();return new FailedAuthResponse(_0x531a3a);}catch(_0x5b5217){if(_0x5b5217 instanceof Error)return new FailedAuthResponse({'detail':_0x5b5217['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x5b5217;}});}['getTokenStatus'](_0x4f4be7){if(Date['now']()<_0x4f4be7['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4f4be7['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
14
|
|
|
15
15
|
export { AdminClient, AuthClient, TokenStatus, Tokens };
|
package/dist/types.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare class ListService {
|
|
|
28
28
|
private readonly fetch;
|
|
29
29
|
constructor(fetch: Fetch);
|
|
30
30
|
add(account_name: string, list_name: string, search_service_name: string, access_token: string): Promise<Response<ListIdentity, Problem>>;
|
|
31
|
-
|
|
31
|
+
delete(accountName: string, listName: string, access_token: string): Promise<Response<any, Problem>>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
declare class SearchServersService {
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x4d3ec3){_0x4d3ec3[_0x4d3ec3['Ok']=0x0]='Ok',_0x4d3ec3[_0x4d3ec3['Refresh']=0x1]='Refresh',_0x4d3ec3[_0x4d3ec3['Expired']=0x2]='Expired';}(TokenStatus||(TokenStatus={})));class Tokens{constructor(){this['access_token']='',this['access_expires']=0x0,this['refresh_token']='',this['refresh_expires']=0x0;}}class Response{constructor(_0x5a8bf9){this['isSuccess']=_0x5a8bf9;}}class SuccessfulAccountResponse extends Response{constructor(_0xc5b5d6){super(!![]),this['account']=_0xc5b5d6;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListIdentityResponse extends Response{constructor(_0x34e2e5){super(!![]),this['list']=_0x34e2e5;}['toSuccess'](){return this['list'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x3d4d06){super(![]),this['problem']=_0x3d4d06;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedListIdentityResponse extends Response{constructor(_0x4d8bc8){super(![]),this['problem']=_0x4d8bc8;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4dcd68){super(!![]),this['tokens']=_0x4dcd68;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x57b323){super(![]),this['problem']=_0x57b323;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0x58d5d4){super(!![]),this['apiKey']=_0x58d5d4;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0x343c8c){super(![]),this['problem']=_0x343c8c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x2c331a){super(!![]),this['searchService']=_0x2c331a;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0x408c11){super(![]),this['problem']=_0x408c11;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x144831){super(!![]),this['searchService']=_0x144831;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x2a4a0a){super(!![]),this['searchServices']=_0x2a4a0a;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x8ad58f){super(![]),this['problem']=_0x8ad58f;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x34bcd5){super(![]),this['problem']=_0x34bcd5;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x28f7bd){super(!![]),this['apiKeyValue']=_0x28f7bd;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x2be9de){super(!![]),this['obj']=_0x2be9de;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x3a625c){super(![]),this['problem']=_0x3a625c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x3b12bc){super(![]),this['problem']=_0x3b12bc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x411806,_0x2872c9,_0x3916ab,_0x6c2387){function _0x5b2571(_0x66a044){return _0x66a044 instanceof _0x3916ab?_0x66a044:new _0x3916ab(function(_0xd58f13){_0xd58f13(_0x66a044);});}return new(_0x3916ab||(_0x3916ab=Promise))(function(_0x326def,_0x5c9dd4){function _0x4042a0(_0x1f3c5b){try{_0x2cec99(_0x6c2387['next'](_0x1f3c5b));}catch(_0xd0f44){_0x5c9dd4(_0xd0f44);}}function _0x12820d(_0x5ec64c){try{_0x2cec99(_0x6c2387['throw'](_0x5ec64c));}catch(_0x2278f3){_0x5c9dd4(_0x2278f3);}}function _0x2cec99(_0x3aa1a6){_0x3aa1a6['done']?_0x326def(_0x3aa1a6['value']):_0x5b2571(_0x3aa1a6['value'])['then'](_0x4042a0,_0x12820d);}_0x2cec99((_0x6c2387=_0x6c2387['apply'](_0x411806,_0x2872c9||[]))['next']());});};class AccountService{constructor(_0x2a155f){this['fetch']=_0x2a155f;}['get'](_0xdd2fe1,_0x4ec5da){return __awaiter$5(this,void 0,void 0,function*(){const _0x2215c0='Account/'+_0xdd2fe1+'/',_0x11b54c=yield this['fetch']['get'](_0x2215c0,_0x4ec5da);try{if(_0x11b54c['status']>0xc7&&_0x11b54c['status']<0x12c){const _0x509dd7=yield _0x11b54c['json']();return new SuccessfulAccountResponse(_0x509dd7);}const _0xf66bfc=yield _0x11b54c['json']();return new FailedAccountResponse(_0xf66bfc);}catch(_0x4a19f4){if(_0x4a19f4 instanceof Error)return new FailedAccountResponse({'detail':_0x4a19f4['message'],'title':_0x4a19f4['name'],'status':0x1f4,'instance':'','type':''});throw _0x4a19f4;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x1d1dff,_0x337777,_0x271aa1,_0x3d4ed8){function _0x2b53d0(_0x48c9c3){return _0x48c9c3 instanceof _0x271aa1?_0x48c9c3:new _0x271aa1(function(_0x1bd10f){_0x1bd10f(_0x48c9c3);});}return new(_0x271aa1||(_0x271aa1=Promise))(function(_0x5f1a85,_0x13d464){function _0x552692(_0x119763){try{_0x3c992e(_0x3d4ed8['next'](_0x119763));}catch(_0x26bf4e){_0x13d464(_0x26bf4e);}}function _0x34d525(_0x20e2b1){try{_0x3c992e(_0x3d4ed8['throw'](_0x20e2b1));}catch(_0x24709c){_0x13d464(_0x24709c);}}function _0x3c992e(_0x53be9b){_0x53be9b['done']?_0x5f1a85(_0x53be9b['value']):_0x2b53d0(_0x53be9b['value'])['then'](_0x552692,_0x34d525);}_0x3c992e((_0x3d4ed8=_0x3d4ed8['apply'](_0x1d1dff,_0x337777||[]))['next']());});};class ApiKeyService{constructor(_0x16dea8){this['fetch']=_0x16dea8,this['path']='api-key';}['create'](_0xd49a2d,_0x5bd8e0,_0x5ac2cf){return __awaiter$4(this,void 0,void 0,function*(){const _0x144524={'account_name':_0xd49a2d,'api_key_name':_0x5bd8e0};try{const _0x37afb6=yield this['fetch']['post'](this['path'],_0x5ac2cf,_0x144524);if(_0x37afb6['status']>0xc7&&_0x37afb6['status']<0x12c){const _0x2e82c1=yield _0x37afb6['json']();return new SuccessfulApiKeyResponse(_0x2e82c1);}const _0x5ee1c0=yield _0x37afb6['json']();return new FailedApiKeyResponse(_0x5ee1c0);}catch(_0x379419){if(_0x379419 instanceof Error)return new FailedApiKeyResponse({'detail':_0x379419['message'],'title':_0x379419['name'],'status':0x1f4,'instance':'','type':''});throw _0x379419;}});}['view'](_0x19f96e,_0x38996e,_0x464da0){return __awaiter$4(this,void 0,void 0,function*(){const _0x179fc6=this['path']+'/'+_0x19f96e+'/'+_0x38996e;try{const _0x328d99=yield this['fetch']['get'](_0x179fc6,_0x464da0);if(_0x328d99['status']>0xc7&&_0x328d99['status']<0x12c){const _0x58f415=yield _0x328d99['json']();return new SuccessfulApiKeyValueResponse(_0x58f415);}const _0x344524=yield _0x328d99['json']();return new FailedApiKeyValueResponse(_0x344524);}catch(_0x4ba695){if(_0x4ba695 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x4ba695['message'],'title':_0x4ba695['name'],'status':0x1f4,'instance':'','type':''});throw _0x4ba695;}});}['delete'](_0x4d12f7,_0x50d829,_0x385460){return __awaiter$4(this,void 0,void 0,function*(){const _0x4e3029=this['path']+'/'+_0x4d12f7+'/'+_0x50d829;try{const _0x7e504b=yield this['fetch']['delete'](_0x4e3029,_0x385460);if(_0x7e504b['status']>0xc7&&_0x7e504b['status']<0x12c)return new SuccessfulResponse({});const _0x37bdcc=yield _0x7e504b['json']();return new FailedResponse(_0x37bdcc);}catch(_0x37b304){if(_0x37b304 instanceof Error)return new FailedResponse({'detail':_0x37b304['message'],'title':_0x37b304['name'],'status':0x1f4,'instance':'','type':''});throw _0x37b304;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x1783f9,_0x3c8d7b,_0x2776dd,_0x5f0542){function _0x608a38(_0x175b8c){return _0x175b8c instanceof _0x2776dd?_0x175b8c:new _0x2776dd(function(_0x1e6c03){_0x1e6c03(_0x175b8c);});}return new(_0x2776dd||(_0x2776dd=Promise))(function(_0x40b758,_0x374f36){function _0x403eaf(_0x59114c){try{_0x195d49(_0x5f0542['next'](_0x59114c));}catch(_0x222bc6){_0x374f36(_0x222bc6);}}function _0x103c89(_0x5f1b25){try{_0x195d49(_0x5f0542['throw'](_0x5f1b25));}catch(_0x222310){_0x374f36(_0x222310);}}function _0x195d49(_0x56324d){_0x56324d['done']?_0x40b758(_0x56324d['value']):_0x608a38(_0x56324d['value'])['then'](_0x403eaf,_0x103c89);}_0x195d49((_0x5f0542=_0x5f0542['apply'](_0x1783f9,_0x3c8d7b||[]))['next']());});};class ListService{constructor(_0x4a5920){this['fetch']=_0x4a5920;}['add'](_0x442cea,_0x3ba5f7,_0x5ce268,_0x2bf7df){return __awaiter$3(this,void 0,void 0,function*(){const _0x44931e='List',_0x38f912={'account_name':_0x442cea,'list_name':_0x3ba5f7,'search_service_name':_0x5ce268};try{const _0x44b413=yield this['fetch']['post'](_0x44931e,_0x2bf7df,_0x38f912);if(_0x44b413['status']>0xc7&&_0x44b413['status']<0x12c){const _0x34d6c7=yield _0x44b413['json']();return new SuccessfulListIdentityResponse(_0x34d6c7);}const _0x39cef4=yield _0x44b413['json']();return new FailedListIdentityResponse(_0x39cef4);}catch(_0x5cf705){if(_0x5cf705 instanceof Error)return new FailedListIdentityResponse({'detail':_0x5cf705['message'],'title':_0x5cf705['name'],'status':0x1f4,'instance':'','type':''});throw _0x5cf705;}});}['remove'](_0x12e964,_0x55b6c1,_0x5680ba){return __awaiter$3(this,void 0,void 0,function*(){const _0x1b47ea='List/'+_0x12e964+'/'+_0x55b6c1,_0x2bffe8=yield this['fetch']['delete'](_0x1b47ea,_0x5680ba);try{if(_0x2bffe8['status']>0xc7&&_0x2bffe8['status']<0x12c){const _0x45007c=yield _0x2bffe8['json']();return new SuccessfulAccountResponse(_0x45007c);}const _0x5e764b=yield _0x2bffe8['json']();return new FailedAccountResponse(_0x5e764b);}catch(_0x565dd4){if(_0x565dd4 instanceof Error)return new FailedAccountResponse({'detail':_0x565dd4['message'],'title':_0x565dd4['name'],'status':0x1f4,'instance':'','type':''});throw _0x565dd4;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0xabea66,_0x909f21,_0x1c41c2,_0x1e682b){function _0x254a3d(_0x7e86de){return _0x7e86de instanceof _0x1c41c2?_0x7e86de:new _0x1c41c2(function(_0x139eae){_0x139eae(_0x7e86de);});}return new(_0x1c41c2||(_0x1c41c2=Promise))(function(_0x336c04,_0x13caf6){function _0xd2d033(_0xe1a284){try{_0x81b5c8(_0x1e682b['next'](_0xe1a284));}catch(_0x46f922){_0x13caf6(_0x46f922);}}function _0x5d1d68(_0x24398e){try{_0x81b5c8(_0x1e682b['throw'](_0x24398e));}catch(_0x2979aa){_0x13caf6(_0x2979aa);}}function _0x81b5c8(_0x5edd09){_0x5edd09['done']?_0x336c04(_0x5edd09['value']):_0x254a3d(_0x5edd09['value'])['then'](_0xd2d033,_0x5d1d68);}_0x81b5c8((_0x1e682b=_0x1e682b['apply'](_0xabea66,_0x909f21||[]))['next']());});};class Fetch{constructor(_0xcd44b6){this['baseUri']=_0xcd44b6,this['getUrl']=_0x31e9b6=>{return _0x31e9b6['startsWith']('/')&&(_0x31e9b6=_0x31e9b6['replace']('/','')),''+this['baseUri']+_0x31e9b6;},!_0xcd44b6['endsWith']('/')&&(_0xcd44b6=_0xcd44b6+'/');}['get'](_0x199d77,_0x341eec){return __awaiter$2(this,void 0,void 0,function*(){const _0x22a90f=this['getUrl'](_0x199d77);return yield fetch(_0x22a90f,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x341eec}});});}['post'](_0x5869c8,_0x464bca,_0x1b9ed4){return __awaiter$2(this,void 0,void 0,function*(){const _0x1fbb74=this['getUrl'](_0x5869c8);return yield fetch(_0x1fbb74,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x464bca},'body':_0x1b9ed4?JSON['stringify'](_0x1b9ed4):null});});}['PostNoAuth'](_0x396694,_0x1d03eb){return __awaiter$2(this,void 0,void 0,function*(){const _0x3a6236=this['getUrl'](_0x396694);return yield fetch(_0x3a6236,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x1d03eb?JSON['stringify'](_0x1d03eb):null});});}['put'](_0x27ef33,_0x26174a,_0x35e016){return __awaiter$2(this,void 0,void 0,function*(){const _0xd0afa1=this['getUrl'](_0x27ef33);return yield fetch(_0xd0afa1,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x26174a},'body':_0x35e016?JSON['stringify'](_0x35e016):null});});}['delete'](_0x4e0e9b,_0x47d06c){return __awaiter$2(this,void 0,void 0,function*(){const _0x250f10=this['getUrl'](_0x4e0e9b);return yield fetch(_0x250f10,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x47d06c}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x44c595,_0x23f7d6,_0xa613ff,_0x394aad){function _0x21a7ba(_0x408bb8){return _0x408bb8 instanceof _0xa613ff?_0x408bb8:new _0xa613ff(function(_0x3d16c7){_0x3d16c7(_0x408bb8);});}return new(_0xa613ff||(_0xa613ff=Promise))(function(_0x49fc0b,_0x1d963d){function _0x19bb26(_0x348154){try{_0x54f75e(_0x394aad['next'](_0x348154));}catch(_0x25a96a){_0x1d963d(_0x25a96a);}}function _0x121350(_0x32994e){try{_0x54f75e(_0x394aad['throw'](_0x32994e));}catch(_0x3df7d4){_0x1d963d(_0x3df7d4);}}function _0x54f75e(_0x1a2c2b){_0x1a2c2b['done']?_0x49fc0b(_0x1a2c2b['value']):_0x21a7ba(_0x1a2c2b['value'])['then'](_0x19bb26,_0x121350);}_0x54f75e((_0x394aad=_0x394aad['apply'](_0x44c595,_0x23f7d6||[]))['next']());});};class SearchServersService{constructor(_0xed024b){this['fetch']=_0xed024b,this['path']='search-services';}['create'](_0x3880d0,_0x51c979,_0x249b92,_0x3828e0,_0x1793ae,_0xb8bf2,_0x4d29db,_0x1a1c6f){return __awaiter$1(this,void 0,void 0,function*(){const _0x2ee976={'account_name':_0x3880d0,'search_service_name':_0x51c979,'endpoint':_0x249b92,'key':_0x3828e0,'country':_0x1793ae,'provider':_0xb8bf2,'index_name':_0x4d29db};try{const _0x4c95a6=yield this['fetch']['post'](this['path'],_0x1a1c6f,_0x2ee976);if(_0x4c95a6['status']>0xc7&&_0x4c95a6['status']<0x12c){const _0x36c761=yield _0x4c95a6['json']();return new SuccessfulSearchServiceResponse(_0x36c761);}const _0x4dc779=yield _0x4c95a6['json']();return new FailedSearchServiceResponse(_0x4dc779);}catch(_0x5a48ac){if(_0x5a48ac instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5a48ac['message'],'title':_0x5a48ac['name'],'status':0x1f4,'instance':'','type':''});throw _0x5a48ac;}});}['delete'](_0x23ad40,_0x428d3e,_0x6cf2dd){return __awaiter$1(this,void 0,void 0,function*(){const _0xc26049=this['path']+'/'+_0x23ad40+'/'+_0x428d3e;try{const _0x32b3ba=yield this['fetch']['delete'](_0xc26049,_0x6cf2dd);if(_0x32b3ba['status']>0xc7&&_0x32b3ba['status']<0x12c)return new SuccessfulResponse({});const _0x452da8=yield _0x32b3ba['json']();return new FailedResponse(_0x452da8);}catch(_0x3865ff){if(_0x3865ff instanceof Error)return new FailedResponse({'detail':_0x3865ff['message'],'title':_0x3865ff['name'],'status':0x1f4,'instance':'','type':''});throw _0x3865ff;}});}['view'](_0x3d8ea4,_0x4d108a,_0x3ed146){return __awaiter$1(this,void 0,void 0,function*(){const _0x1c785c=this['path']+'/'+_0x3d8ea4+'/'+_0x4d108a;try{const _0x1c4767=yield this['fetch']['get'](_0x1c785c,_0x3ed146);if(_0x1c4767['status']>0xc7&&_0x1c4767['status']<0x12c){const _0x1b078c=yield _0x1c4767['json']();return new SuccessfulViewSearchServiceResponse(_0x1b078c);}const _0x370987=yield _0x1c4767['json']();return new FailedViewSearchServiceResponse(_0x370987);}catch(_0x341e4f){if(_0x341e4f instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x341e4f['message'],'title':_0x341e4f['name'],'status':0x1f4,'instance':'','type':''});throw _0x341e4f;}});}['edit'](_0x433c67,_0x54f4c5,_0x251116,_0x7f197c,_0x260a3c,_0x9ea46){return __awaiter$1(this,void 0,void 0,function*(){const _0x41b931={'account_name':_0x433c67,'search_service_name':_0x54f4c5,'new_search_service_name':_0x251116,'key':_0x7f197c,'country':_0x260a3c};try{const _0x36fd22=yield this['fetch']['put'](this['path'],_0x9ea46,_0x41b931);if(_0x36fd22['status']>0xc7&&_0x36fd22['status']<0x12c){const _0x46bb01=yield _0x36fd22['json']();return new SuccessfulSearchServiceResponse(_0x46bb01);}const _0x4a7b1a=yield _0x36fd22['json']();return new FailedSearchServiceResponse(_0x4a7b1a);}catch(_0x30a596){if(_0x30a596 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x30a596['message'],'title':_0x30a596['name'],'status':0x1f4,'instance':'','type':''});throw _0x30a596;}});}['list'](_0x1adfa8,_0x2f5d86){return __awaiter$1(this,void 0,void 0,function*(){const _0x3ea079=this['path']+'/'+_0x1adfa8;try{const _0x57edd2=yield this['fetch']['get'](_0x3ea079,_0x2f5d86);if(_0x57edd2['status']>0xc7&&_0x57edd2['status']<0x12c){const _0x2ef86c=yield _0x57edd2['json']();return new SuccessfulListSearchServiceResponse(_0x2ef86c);}const _0x30de70=yield _0x57edd2['json']();return new FailedViewSearchServicesResponse(_0x30de70);}catch(_0x502510){if(_0x502510 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x502510['message'],'title':_0x502510['name'],'status':0x1f4,'instance':'','type':''});throw _0x502510;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x4feefb,_0x4aed65,_0x44a9fc,_0x46d97c){function _0x15971f(_0x17b6d5){return _0x17b6d5 instanceof _0x44a9fc?_0x17b6d5:new _0x44a9fc(function(_0x44400b){_0x44400b(_0x17b6d5);});}return new(_0x44a9fc||(_0x44a9fc=Promise))(function(_0x1cbf8e,_0x3ef8c9){function _0x10cc42(_0x23bdfe){try{_0x428371(_0x46d97c['next'](_0x23bdfe));}catch(_0x32e0dc){_0x3ef8c9(_0x32e0dc);}}function _0x581850(_0x515d14){try{_0x428371(_0x46d97c['throw'](_0x515d14));}catch(_0x1312e1){_0x3ef8c9(_0x1312e1);}}function _0x428371(_0x5825bb){_0x5825bb['done']?_0x1cbf8e(_0x5825bb['value']):_0x15971f(_0x5825bb['value'])['then'](_0x10cc42,_0x581850);}_0x428371((_0x46d97c=_0x46d97c['apply'](_0x4feefb,_0x4aed65||[]))['next']());});};class AdminClient{constructor(_0x2ae085='https://admin.searchability.dev/'){var _0x37181c=new Fetch(_0x2ae085);this['Accounts']=new AccountService(_0x37181c),this['Lists']=new ListService(_0x37181c),this['ApiKeys']=new ApiKeyService(_0x37181c),this['SearchServices']=new SearchServersService(_0x37181c);}}class AuthClient{constructor(_0x323247='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x323247);}['login'](_0x49bffe){return __awaiter(this,void 0,void 0,function*(){const _0x3b7a81='login/'+_0x49bffe;try{const _0x25c129=yield yield fetch(_0x3b7a81);if(_0x25c129['status']>0xc7&&_0x25c129['status']<0x12c){const _0x2df627=yield _0x25c129['json']();return new SuccessfulAuthResponse(_0x2df627);}const _0x82ab11=yield _0x25c129['json']();return new FailedAuthResponse(_0x82ab11);}catch(_0x4ce351){if(_0x4ce351 instanceof Error)return new FailedAuthResponse({'detail':_0x4ce351['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ce351;}});}['refresh'](_0x212e19){return __awaiter(this,void 0,void 0,function*(){const _0x5b75fd='refresh',_0xe157a6={'refresh_token':_0x212e19};try{const _0x14470c=yield this['fetch']['PostNoAuth'](_0x5b75fd,_0xe157a6);if(_0x14470c['status']>0xc7&&_0x14470c['status']<0x12c){const _0x5881b1=yield _0x14470c['json']();return new SuccessfulAuthResponse(_0x5881b1);}const _0x44e60d=yield _0x14470c['json']();return new FailedAuthResponse(_0x44e60d);}catch(_0x322595){if(_0x322595 instanceof Error)return new FailedAuthResponse({'detail':_0x322595['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x322595;}});}['getTokenStatus'](_0x3b3aa7){if(Date['now']()<_0x3b3aa7['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x3b3aa7['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|