@searchability/admin-client 0.0.46 → 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
|
@@ -27,8 +27,8 @@ declare class ApiKeyService {
|
|
|
27
27
|
declare class ListService {
|
|
28
28
|
private readonly fetch;
|
|
29
29
|
constructor(fetch: Fetch);
|
|
30
|
-
add(
|
|
31
|
-
|
|
30
|
+
add(account_name: string, list_name: string, search_service_name: string, access_token: string): Promise<Response<ListIdentity, Problem>>;
|
|
31
|
+
delete(accountName: string, listName: string, access_token: string): Promise<Response<any, Problem>>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
declare class SearchServersService {
|
|
@@ -135,12 +135,24 @@ declare class SuccessfulAccountResponse extends Response<Account, Problem> {
|
|
|
135
135
|
toSuccess(): Account;
|
|
136
136
|
toProblem(): Problem;
|
|
137
137
|
}
|
|
138
|
+
declare class SuccessfulListIdentityResponse extends Response<ListIdentity, Problem> {
|
|
139
|
+
readonly list: ListIdentity;
|
|
140
|
+
constructor(list: ListIdentity);
|
|
141
|
+
toSuccess(): ListIdentity;
|
|
142
|
+
toProblem(): Problem;
|
|
143
|
+
}
|
|
138
144
|
declare class FailedAccountResponse extends Response<Account, Problem> {
|
|
139
145
|
readonly problem: Problem;
|
|
140
146
|
constructor(problem: Problem);
|
|
141
147
|
toSuccess(): Account;
|
|
142
148
|
toProblem(): Problem;
|
|
143
149
|
}
|
|
150
|
+
declare class FailedListIdentityResponse extends Response<ListIdentity, Problem> {
|
|
151
|
+
readonly problem: Problem;
|
|
152
|
+
constructor(problem: Problem);
|
|
153
|
+
toSuccess(): ListIdentity;
|
|
154
|
+
toProblem(): Problem;
|
|
155
|
+
}
|
|
144
156
|
declare class SuccessfulAuthResponse extends Response<Tokens, Problem> {
|
|
145
157
|
readonly tokens: Tokens;
|
|
146
158
|
constructor(tokens: Tokens);
|
|
@@ -226,4 +238,4 @@ declare class FailedApiKeyValueResponse extends Response<ApiKeyValue, Problem> {
|
|
|
226
238
|
toProblem(): Problem;
|
|
227
239
|
}
|
|
228
240
|
|
|
229
|
-
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, FailedViewSearchServicesResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulListSearchServiceResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
|
241
|
+
export { type Account, AdminClient, type ApiKey, type ApiKeyValue, AuthClient, type Error, FailedAccountResponse, FailedApiKeyResponse, FailedApiKeyValueResponse, FailedAuthResponse, FailedListIdentityResponse, FailedResponse, FailedSearchServiceResponse, FailedViewSearchServiceResponse, FailedViewSearchServicesResponse, type List, type ListIdentity, type Problem, type RefreshRequest, Response, type SearchService, type SearchServiceDetails, SuccessfulAccountResponse, SuccessfulApiKeyResponse, SuccessfulApiKeyValueResponse, SuccessfulAuthResponse, SuccessfulListIdentityResponse, SuccessfulListSearchServiceResponse, SuccessfulResponse, SuccessfulSearchServiceResponse, SuccessfulViewSearchServiceResponse, TokenStatus, Tokens };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var TokenStatus;(function(_0x405825){_0x405825[_0x405825['Ok']=0x0]='Ok',_0x405825[_0x405825['Refresh']=0x1]='Refresh',_0x405825[_0x405825['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(_0x2d5b24){this['isSuccess']=_0x2d5b24;}}class SuccessfulAccountResponse extends Response{constructor(_0x130dd1){super(!![]),this['account']=_0x130dd1;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x30aafc){super(![]),this['problem']=_0x30aafc;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulAuthResponse extends Response{constructor(_0x4aa2f2){super(!![]),this['tokens']=_0x4aa2f2;}['toSuccess'](){return this['tokens'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAuthResponse extends Response{constructor(_0x419e7d){super(![]),this['problem']=_0x419e7d;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyResponse extends Response{constructor(_0xf12771){super(!![]),this['apiKey']=_0xf12771;}['toSuccess'](){return this['apiKey'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedApiKeyResponse extends Response{constructor(_0xe4f89b){super(![]),this['problem']=_0xe4f89b;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulSearchServiceResponse extends Response{constructor(_0x449bf3){super(!![]),this['searchService']=_0x449bf3;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedSearchServiceResponse extends Response{constructor(_0xea6ba9){super(![]),this['problem']=_0xea6ba9;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulViewSearchServiceResponse extends Response{constructor(_0x5b4413){super(!![]),this['searchService']=_0x5b4413;}['toSuccess'](){return this['searchService'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulListSearchServiceResponse extends Response{constructor(_0x12b76f){super(!![]),this['searchServices']=_0x12b76f;}['toSuccess'](){return this['searchServices'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedViewSearchServicesResponse extends Response{constructor(_0x136b0c){super(![]),this['problem']=_0x136b0c;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedViewSearchServiceResponse extends Response{constructor(_0x1eee7a){super(![]),this['problem']=_0x1eee7a;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class SuccessfulApiKeyValueResponse extends Response{constructor(_0x598570){super(!![]),this['apiKeyValue']=_0x598570;}['toSuccess'](){return this['apiKeyValue'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class SuccessfulResponse extends Response{constructor(_0x3d4eae){super(!![]),this['obj']=_0x3d4eae;}['toSuccess'](){return this['obj'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedResponse extends Response{constructor(_0x151c37){super(![]),this['problem']=_0x151c37;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}class FailedApiKeyValueResponse extends Response{constructor(_0x379ad3){super(![]),this['problem']=_0x379ad3;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
2
|
-
|
|
3
|
-
var __awaiter$5=undefined&&undefined['__awaiter']||function(_0x5f10e2,_0x5616e6,_0x59375a,_0x38ce2a){function _0x43120f(_0x2d3a56){return _0x2d3a56 instanceof _0x59375a?_0x2d3a56:new _0x59375a(function(_0x18900b){_0x18900b(_0x2d3a56);});}return new(_0x59375a||(_0x59375a=Promise))(function(_0x4bb38c,_0x1827fa){function _0x3b5107(_0x2d346e){try{_0x198dbb(_0x38ce2a['next'](_0x2d346e));}catch(_0xfec8cf){_0x1827fa(_0xfec8cf);}}function _0x2c3086(_0x4b2f52){try{_0x198dbb(_0x38ce2a['throw'](_0x4b2f52));}catch(_0x52f675){_0x1827fa(_0x52f675);}}function _0x198dbb(_0x5e7d53){_0x5e7d53['done']?_0x4bb38c(_0x5e7d53['value']):_0x43120f(_0x5e7d53['value'])['then'](_0x3b5107,_0x2c3086);}_0x198dbb((_0x38ce2a=_0x38ce2a['apply'](_0x5f10e2,_0x5616e6||[]))['next']());});};class AccountService{constructor(_0x428417){this['fetch']=_0x428417;}['get'](_0x4d95b5,_0x2e8cda){return __awaiter$5(this,void 0,void 0,function*(){const _0x383708='Account/'+_0x4d95b5+'/',_0x247353=yield this['fetch']['get'](_0x383708,_0x2e8cda);try{if(_0x247353['status']>0xc7&&_0x247353['status']<0x12c){const _0x580b1e=yield _0x247353['json']();return new SuccessfulAccountResponse(_0x580b1e);}const _0x4a9746=yield _0x247353['json']();return new FailedAccountResponse(_0x4a9746);}catch(_0x44d45c){if(_0x44d45c instanceof Error)return new FailedAccountResponse({'detail':_0x44d45c['message'],'title':_0x44d45c['name'],'status':0x1f4,'instance':'','type':''});throw _0x44d45c;}});}}
|
|
4
|
-
|
|
5
|
-
var __awaiter$4=undefined&&undefined['__awaiter']||function(_0x195ca5,_0x19f345,_0x3dadae,_0x1db88f){function _0x444a99(_0x5b9285){return _0x5b9285 instanceof _0x3dadae?_0x5b9285:new _0x3dadae(function(_0x35fc4a){_0x35fc4a(_0x5b9285);});}return new(_0x3dadae||(_0x3dadae=Promise))(function(_0x408082,_0x462ee8){function _0x5ba137(_0xcb1d13){try{_0x1413c9(_0x1db88f['next'](_0xcb1d13));}catch(_0x7447a9){_0x462ee8(_0x7447a9);}}function _0x3293a1(_0x521fc1){try{_0x1413c9(_0x1db88f['throw'](_0x521fc1));}catch(_0x4e9964){_0x462ee8(_0x4e9964);}}function _0x1413c9(_0x6591c7){_0x6591c7['done']?_0x408082(_0x6591c7['value']):_0x444a99(_0x6591c7['value'])['then'](_0x5ba137,_0x3293a1);}_0x1413c9((_0x1db88f=_0x1db88f['apply'](_0x195ca5,_0x19f345||[]))['next']());});};class ApiKeyService{constructor(_0xd43b33){this['fetch']=_0xd43b33,this['path']='api-key';}['create'](_0x2016dd,_0x23a5a3,_0x2efaa1){return __awaiter$4(this,void 0,void 0,function*(){const _0x496eac={'account_name':_0x2016dd,'api_key_name':_0x23a5a3};try{const _0x5208af=yield this['fetch']['post'](this['path'],_0x2efaa1,_0x496eac);if(_0x5208af['status']>0xc7&&_0x5208af['status']<0x12c){const _0x13a4c1=yield _0x5208af['json']();return new SuccessfulApiKeyResponse(_0x13a4c1);}const _0x273f67=yield _0x5208af['json']();return new FailedApiKeyResponse(_0x273f67);}catch(_0x660c4){if(_0x660c4 instanceof Error)return new FailedApiKeyResponse({'detail':_0x660c4['message'],'title':_0x660c4['name'],'status':0x1f4,'instance':'','type':''});throw _0x660c4;}});}['view'](_0x4ada30,_0x117b33,_0x40399b){return __awaiter$4(this,void 0,void 0,function*(){const _0x68dde9=this['path']+'/'+_0x4ada30+'/'+_0x117b33;try{const _0x7ac3ee=yield this['fetch']['get'](_0x68dde9,_0x40399b);if(_0x7ac3ee['status']>0xc7&&_0x7ac3ee['status']<0x12c){const _0x3d7c5a=yield _0x7ac3ee['json']();return new SuccessfulApiKeyValueResponse(_0x3d7c5a);}const _0x5cd93e=yield _0x7ac3ee['json']();return new FailedApiKeyValueResponse(_0x5cd93e);}catch(_0x60f92){if(_0x60f92 instanceof Error)return new FailedApiKeyValueResponse({'detail':_0x60f92['message'],'title':_0x60f92['name'],'status':0x1f4,'instance':'','type':''});throw _0x60f92;}});}['delete'](_0x4d29a9,_0x399afc,_0x420453){return __awaiter$4(this,void 0,void 0,function*(){const _0x38239c=this['path']+'/'+_0x4d29a9+'/'+_0x399afc;try{const _0x3a99ba=yield this['fetch']['delete'](_0x38239c,_0x420453);if(_0x3a99ba['status']>0xc7&&_0x3a99ba['status']<0x12c)return new SuccessfulResponse({});const _0x5498fc=yield _0x3a99ba['json']();return new FailedResponse(_0x5498fc);}catch(_0x148ea0){if(_0x148ea0 instanceof Error)return new FailedResponse({'detail':_0x148ea0['message'],'title':_0x148ea0['name'],'status':0x1f4,'instance':'','type':''});throw _0x148ea0;}});}}
|
|
6
|
-
|
|
7
|
-
var __awaiter$3=undefined&&undefined['__awaiter']||function(_0x5a3044,_0x4e7fe6,_0x492edb,_0x4fdff4){function _0xb2556(_0x32ae61){return _0x32ae61 instanceof _0x492edb?_0x32ae61:new _0x492edb(function(_0x33579e){_0x33579e(_0x32ae61);});}return new(_0x492edb||(_0x492edb=Promise))(function(_0x32dbc6,_0x2b243a){function _0x2b97a8(_0x12d690){try{_0x457100(_0x4fdff4['next'](_0x12d690));}catch(_0x56c899){_0x2b243a(_0x56c899);}}function _0x1fd9c4(_0x643d13){try{_0x457100(_0x4fdff4['throw'](_0x643d13));}catch(_0x2741d7){_0x2b243a(_0x2741d7);}}function _0x457100(_0x3d6789){_0x3d6789['done']?_0x32dbc6(_0x3d6789['value']):_0xb2556(_0x3d6789['value'])['then'](_0x2b97a8,_0x1fd9c4);}_0x457100((_0x4fdff4=_0x4fdff4['apply'](_0x5a3044,_0x4e7fe6||[]))['next']());});};class ListService{constructor(_0x4e82a8){this['fetch']=_0x4e82a8;}['add'](_0x33793e,_0xb86175,_0x1cbef2){return __awaiter$3(this,void 0,void 0,function*(){const _0x1ca9e7='List',_0x5d1f5a={'account_name':_0x33793e,'list_name':_0xb86175};try{const _0x42766d=yield this['fetch']['post'](_0x1ca9e7,_0x1cbef2,_0x5d1f5a);if(_0x42766d['status']>0xc7&&_0x42766d['status']<0x12c){const _0x302eca=yield _0x42766d['json']();return new SuccessfulAccountResponse(_0x302eca);}const _0xd16586=yield _0x42766d['json']();return new FailedAccountResponse(_0xd16586);}catch(_0x1b1ab7){if(_0x1b1ab7 instanceof Error)return new FailedAccountResponse({'detail':_0x1b1ab7['message'],'title':_0x1b1ab7['name'],'status':0x1f4,'instance':'','type':''});throw _0x1b1ab7;}});}['remove'](_0x69a688,_0x2b3ac3,_0x2d7792){return __awaiter$3(this,void 0,void 0,function*(){const _0x233ce4='List/'+_0x69a688+'/'+_0x2b3ac3,_0x5d72ca=yield this['fetch']['delete'](_0x233ce4,_0x2d7792);try{if(_0x5d72ca['status']>0xc7&&_0x5d72ca['status']<0x12c){const _0x76797d=yield _0x5d72ca['json']();return new SuccessfulAccountResponse(_0x76797d);}const _0x5ed919=yield _0x5d72ca['json']();return new FailedAccountResponse(_0x5ed919);}catch(_0x5c6bf4){if(_0x5c6bf4 instanceof Error)return new FailedAccountResponse({'detail':_0x5c6bf4['message'],'title':_0x5c6bf4['name'],'status':0x1f4,'instance':'','type':''});throw _0x5c6bf4;}});}}
|
|
8
|
-
|
|
9
|
-
var __awaiter$2=undefined&&undefined['__awaiter']||function(_0x58cb04,_0x2bcfe6,_0x46b3c0,_0x29232e){function _0x485a7a(_0x39f2c7){return _0x39f2c7 instanceof _0x46b3c0?_0x39f2c7:new _0x46b3c0(function(_0x374b80){_0x374b80(_0x39f2c7);});}return new(_0x46b3c0||(_0x46b3c0=Promise))(function(_0x440c7f,_0x3986a6){function _0x55b26(_0xcced1b){try{_0x44fcd0(_0x29232e['next'](_0xcced1b));}catch(_0x3c98e3){_0x3986a6(_0x3c98e3);}}function _0x1bf77b(_0x4911f0){try{_0x44fcd0(_0x29232e['throw'](_0x4911f0));}catch(_0x1bf27d){_0x3986a6(_0x1bf27d);}}function _0x44fcd0(_0x45f089){_0x45f089['done']?_0x440c7f(_0x45f089['value']):_0x485a7a(_0x45f089['value'])['then'](_0x55b26,_0x1bf77b);}_0x44fcd0((_0x29232e=_0x29232e['apply'](_0x58cb04,_0x2bcfe6||[]))['next']());});};class Fetch{constructor(_0x4b830d){this['baseUri']=_0x4b830d,this['getUrl']=_0x456125=>{return _0x456125['startsWith']('/')&&(_0x456125=_0x456125['replace']('/','')),''+this['baseUri']+_0x456125;},!_0x4b830d['endsWith']('/')&&(_0x4b830d=_0x4b830d+'/');}['get'](_0x1eaf91,_0x492559){return __awaiter$2(this,void 0,void 0,function*(){const _0xe2f3ab=this['getUrl'](_0x1eaf91);return yield fetch(_0xe2f3ab,{'method':'GET','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x492559}});});}['post'](_0x12050c,_0x28cd3d,_0x50188e){return __awaiter$2(this,void 0,void 0,function*(){const _0x44cb3c=this['getUrl'](_0x12050c);return yield fetch(_0x44cb3c,{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x28cd3d},'body':_0x50188e?JSON['stringify'](_0x50188e):null});});}['PostNoAuth'](_0xcc6f26,_0x2f2236){return __awaiter$2(this,void 0,void 0,function*(){const _0x253ce6=this['getUrl'](_0xcc6f26);return yield fetch(_0x253ce6,{'method':'POST','headers':{'Content-Type':'application/json'},'body':_0x2f2236?JSON['stringify'](_0x2f2236):null});});}['put'](_0x569a1e,_0x1c0402,_0x591d2c){return __awaiter$2(this,void 0,void 0,function*(){const _0x446c53=this['getUrl'](_0x569a1e);return yield fetch(_0x446c53,{'method':'PUT','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x1c0402},'body':_0x591d2c?JSON['stringify'](_0x591d2c):null});});}['delete'](_0x5e7f12,_0x578ce2){return __awaiter$2(this,void 0,void 0,function*(){const _0x4941ea=this['getUrl'](_0x5e7f12);return yield fetch(_0x4941ea,{'method':'DELETE','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x578ce2}});});}}
|
|
10
|
-
|
|
11
|
-
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x549bd1,_0x5467e1,_0x4758b6,_0x54484a){function _0x3e2396(_0x176f71){return _0x176f71 instanceof _0x4758b6?_0x176f71:new _0x4758b6(function(_0x4a2349){_0x4a2349(_0x176f71);});}return new(_0x4758b6||(_0x4758b6=Promise))(function(_0x192751,_0x23d31f){function _0x320b21(_0x53c39c){try{_0x139dff(_0x54484a['next'](_0x53c39c));}catch(_0x4d3e7b){_0x23d31f(_0x4d3e7b);}}function _0x402250(_0x15e77a){try{_0x139dff(_0x54484a['throw'](_0x15e77a));}catch(_0x1d5fca){_0x23d31f(_0x1d5fca);}}function _0x139dff(_0x55b17c){_0x55b17c['done']?_0x192751(_0x55b17c['value']):_0x3e2396(_0x55b17c['value'])['then'](_0x320b21,_0x402250);}_0x139dff((_0x54484a=_0x54484a['apply'](_0x549bd1,_0x5467e1||[]))['next']());});};class SearchServersService{constructor(_0x57bec4){this['fetch']=_0x57bec4,this['path']='search-services';}['create'](_0x55d18e,_0x2445ae,_0x31abea,_0x42e30c,_0x3a57f7,_0x204cce,_0x5be6ec,_0x2de986){return __awaiter$1(this,void 0,void 0,function*(){const _0x2a6931={'account_name':_0x55d18e,'search_service_name':_0x2445ae,'endpoint':_0x31abea,'key':_0x42e30c,'country':_0x3a57f7,'provider':_0x204cce,'index_name':_0x5be6ec};try{const _0xb2c02f=yield this['fetch']['post'](this['path'],_0x2de986,_0x2a6931);if(_0xb2c02f['status']>0xc7&&_0xb2c02f['status']<0x12c){const _0x4ee6b5=yield _0xb2c02f['json']();return new SuccessfulSearchServiceResponse(_0x4ee6b5);}const _0x174c53=yield _0xb2c02f['json']();return new FailedSearchServiceResponse(_0x174c53);}catch(_0x9ba5cb){if(_0x9ba5cb instanceof Error)return new FailedSearchServiceResponse({'detail':_0x9ba5cb['message'],'title':_0x9ba5cb['name'],'status':0x1f4,'instance':'','type':''});throw _0x9ba5cb;}});}['delete'](_0x52beb4,_0x61bdfb,_0x389f0c){return __awaiter$1(this,void 0,void 0,function*(){const _0x3fbee1=this['path']+'/'+_0x52beb4+'/'+_0x61bdfb;try{const _0x27e294=yield this['fetch']['delete'](_0x3fbee1,_0x389f0c);if(_0x27e294['status']>0xc7&&_0x27e294['status']<0x12c)return new SuccessfulResponse({});const _0x8b43b0=yield _0x27e294['json']();return new FailedResponse(_0x8b43b0);}catch(_0x3eb38b){if(_0x3eb38b instanceof Error)return new FailedResponse({'detail':_0x3eb38b['message'],'title':_0x3eb38b['name'],'status':0x1f4,'instance':'','type':''});throw _0x3eb38b;}});}['view'](_0x4b80ff,_0x331df7,_0xc57edf){return __awaiter$1(this,void 0,void 0,function*(){const _0x41dee6=this['path']+'/'+_0x4b80ff+'/'+_0x331df7;try{const _0x5c3556=yield this['fetch']['get'](_0x41dee6,_0xc57edf);if(_0x5c3556['status']>0xc7&&_0x5c3556['status']<0x12c){const _0x4f7efd=yield _0x5c3556['json']();return new SuccessfulViewSearchServiceResponse(_0x4f7efd);}const _0xb320af=yield _0x5c3556['json']();return new FailedViewSearchServiceResponse(_0xb320af);}catch(_0x2a1790){if(_0x2a1790 instanceof Error)return new FailedViewSearchServiceResponse({'detail':_0x2a1790['message'],'title':_0x2a1790['name'],'status':0x1f4,'instance':'','type':''});throw _0x2a1790;}});}['edit'](_0x506d96,_0x3e8520,_0x568416,_0x4a6530,_0x588e01,_0x259d27){return __awaiter$1(this,void 0,void 0,function*(){const _0x1432ab={'account_name':_0x506d96,'search_service_name':_0x3e8520,'new_search_service_name':_0x568416,'key':_0x4a6530,'country':_0x588e01};try{const _0x158eb2=yield this['fetch']['put'](this['path'],_0x259d27,_0x1432ab);if(_0x158eb2['status']>0xc7&&_0x158eb2['status']<0x12c){const _0x53d7fd=yield _0x158eb2['json']();return new SuccessfulSearchServiceResponse(_0x53d7fd);}const _0xc03c44=yield _0x158eb2['json']();return new FailedSearchServiceResponse(_0xc03c44);}catch(_0x5e6e96){if(_0x5e6e96 instanceof Error)return new FailedSearchServiceResponse({'detail':_0x5e6e96['message'],'title':_0x5e6e96['name'],'status':0x1f4,'instance':'','type':''});throw _0x5e6e96;}});}['list'](_0x42bdce,_0x352874){return __awaiter$1(this,void 0,void 0,function*(){const _0x472d6f=this['path']+'/'+_0x42bdce;try{const _0x1038bc=yield this['fetch']['get'](_0x472d6f,_0x352874);if(_0x1038bc['status']>0xc7&&_0x1038bc['status']<0x12c){const _0x2643c1=yield _0x1038bc['json']();return new SuccessfulListSearchServiceResponse(_0x2643c1);}const _0x4cdd25=yield _0x1038bc['json']();return new FailedViewSearchServicesResponse(_0x4cdd25);}catch(_0x856e45){if(_0x856e45 instanceof Error)return new FailedViewSearchServicesResponse({'detail':_0x856e45['message'],'title':_0x856e45['name'],'status':0x1f4,'instance':'','type':''});throw _0x856e45;}});}}
|
|
12
|
-
|
|
13
|
-
var __awaiter=undefined&&undefined['__awaiter']||function(_0x589005,_0xdef6ab,_0xe6ef17,_0x4f290a){function _0x22c870(_0x476d1c){return _0x476d1c instanceof _0xe6ef17?_0x476d1c:new _0xe6ef17(function(_0x1e89f6){_0x1e89f6(_0x476d1c);});}return new(_0xe6ef17||(_0xe6ef17=Promise))(function(_0x31fac4,_0x2f7ca2){function _0x59d61e(_0x208379){try{_0x5e66ab(_0x4f290a['next'](_0x208379));}catch(_0x225961){_0x2f7ca2(_0x225961);}}function _0x62c6e7(_0x5554ac){try{_0x5e66ab(_0x4f290a['throw'](_0x5554ac));}catch(_0x482fe1){_0x2f7ca2(_0x482fe1);}}function _0x5e66ab(_0x1a11ca){_0x1a11ca['done']?_0x31fac4(_0x1a11ca['value']):_0x22c870(_0x1a11ca['value'])['then'](_0x59d61e,_0x62c6e7);}_0x5e66ab((_0x4f290a=_0x4f290a['apply'](_0x589005,_0xdef6ab||[]))['next']());});};class AdminClient{constructor(_0x57e0d4='https://admin.searchability.dev/'){var _0x2cb9be=new Fetch(_0x57e0d4);this['Accounts']=new AccountService(_0x2cb9be),this['Lists']=new ListService(_0x2cb9be),this['ApiKeys']=new ApiKeyService(_0x2cb9be),this['SearchServices']=new SearchServersService(_0x2cb9be);}}class AuthClient{constructor(_0x40934e='https://auth.searchability.dev/'){this['fetch']=new Fetch(_0x40934e);}['login'](_0x363a61){return __awaiter(this,void 0,void 0,function*(){const _0x37e011='login/'+_0x363a61;try{const _0x20555c=yield yield fetch(_0x37e011);if(_0x20555c['status']>0xc7&&_0x20555c['status']<0x12c){const _0x386b74=yield _0x20555c['json']();return new SuccessfulAuthResponse(_0x386b74);}const _0x27edba=yield _0x20555c['json']();return new FailedAuthResponse(_0x27edba);}catch(_0x4ac9f2){if(_0x4ac9f2 instanceof Error)return new FailedAuthResponse({'detail':_0x4ac9f2['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ac9f2;}});}['refresh'](_0x28c36d){return __awaiter(this,void 0,void 0,function*(){const _0x5cda0f='refresh',_0x10377f={'refresh_token':_0x28c36d};try{const _0x3d2168=yield this['fetch']['PostNoAuth'](_0x5cda0f,_0x10377f);if(_0x3d2168['status']>0xc7&&_0x3d2168['status']<0x12c){const _0x2bab85=yield _0x3d2168['json']();return new SuccessfulAuthResponse(_0x2bab85);}const _0x3fd88e=yield _0x3d2168['json']();return new FailedAuthResponse(_0x3fd88e);}catch(_0x4ea930){if(_0x4ea930 instanceof Error)return new FailedAuthResponse({'detail':_0x4ea930['message'],'title':'','status':0x1f4,'instance':'','type':''});throw _0x4ea930;}});}['getTokenStatus'](_0x4ab781){if(Date['now']()<_0x4ab781['access_expires'])return TokenStatus['Ok'];if(Date['now']()<_0x4ab781['refresh_expires'])return TokenStatus['Refresh'];return TokenStatus['Expired'];}}
|
|
14
|
-
|
|
15
|
-
export { AdminClient, AuthClient, TokenStatus, Tokens };
|