@searchability/admin-client 0.0.1
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.
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# searchability-admin-client
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x2ec56e,_0x30298d,_0xb65223,_0x1cad79){function _0x473bb1(_0x3da147){return _0x3da147 instanceof _0xb65223?_0x3da147:new _0xb65223(function(_0xe8f72b){_0xe8f72b(_0x3da147);});}return new(_0xb65223||(_0xb65223=Promise))(function(_0x29e400,_0x2a27f3){function _0x535586(_0x2f7973){try{_0x3675de(_0x1cad79['next'](_0x2f7973));}catch(_0x458bfa){_0x2a27f3(_0x458bfa);}}function _0x287771(_0x350ea5){try{_0x3675de(_0x1cad79['throw'](_0x350ea5));}catch(_0x4ffc7b){_0x2a27f3(_0x4ffc7b);}}function _0x3675de(_0x3b038a){_0x3b038a['done']?_0x29e400(_0x3b038a['value']):_0x473bb1(_0x3b038a['value'])['then'](_0x535586,_0x287771);}_0x3675de((_0x1cad79=_0x1cad79['apply'](_0x2ec56e,_0x30298d||[]))['next']());});};class Fetch{static['get'](_0x4d40e0,_0x67bbc9){return __awaiter$1(this,void 0,void 0,function*(){return yield fetch(_0x4d40e0,{'method':'get','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x67bbc9}});});}}
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x345240){this['isSuccess']=_0x345240;}}class SuccessfulAccountResponse extends Response{constructor(_0x47e5af){super(!![]),this['account']=_0x47e5af;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x1babe2){super(![]),this['problem']=_0x1babe2;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0xd89516,_0x3ae92c,_0x251e40,_0x1b04f7){function _0x157ec3(_0xd83d87){return _0xd83d87 instanceof _0x251e40?_0xd83d87:new _0x251e40(function(_0x24dfda){_0x24dfda(_0xd83d87);});}return new(_0x251e40||(_0x251e40=Promise))(function(_0x4b0c38,_0x104ea9){function _0x419869(_0x4f155b){try{_0x4ef678(_0x1b04f7['next'](_0x4f155b));}catch(_0x80c5e){_0x104ea9(_0x80c5e);}}function _0x219362(_0x218553){try{_0x4ef678(_0x1b04f7['throw'](_0x218553));}catch(_0x14ec6b){_0x104ea9(_0x14ec6b);}}function _0x4ef678(_0x1cff1f){_0x1cff1f['done']?_0x4b0c38(_0x1cff1f['value']):_0x157ec3(_0x1cff1f['value'])['then'](_0x419869,_0x219362);}_0x4ef678((_0x1b04f7=_0x1b04f7['apply'](_0xd89516,_0x3ae92c||[]))['next']());});};class AccountService{constructor(){}['get'](_0x2fce04,_0x564285){return __awaiter(this,arguments,void 0,function*(_0x2c64e6,_0x4fe00f,_0x55a52e={}){let _0x26e3d3=_0x55a52e['baseUri'];_0x26e3d3=_0x26e3d3+'/Account/'+_0x4fe00f+'/';const _0x236137=yield Fetch['get'](_0x26e3d3,_0x2c64e6);if(_0x236137['status']>0xc7&&_0x236137['status']<0x12c){const _0x5e6854=yield _0x236137['json']();return new SuccessfulAccountResponse(_0x5e6854);}if(_0x236137['bodyUsed']){const _0x58011e=yield _0x236137['json']();return new FailedAccountResponse(_0x58011e);}const _0x523223={'type':'','status':_0x236137['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x523223);});}}
|
|
6
|
+
|
|
7
|
+
class AdminClient{constructor(){this['baseUri']='https://admin.searchability.dev',this['Accounts']=new AccountService();}}
|
|
8
|
+
|
|
9
|
+
export { AdminClient };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0x5a75d9,_0x6ba4bc,_0x4cb627,_0x5aa308){function _0x23fbb3(_0x4f444a){return _0x4f444a instanceof _0x4cb627?_0x4f444a:new _0x4cb627(function(_0x4e8d3e){_0x4e8d3e(_0x4f444a);});}return new(_0x4cb627||(_0x4cb627=Promise))(function(_0x41ce9c,_0x3aeed0){function _0x18e4a5(_0x3a03e9){try{_0x4a0076(_0x5aa308['next'](_0x3a03e9));}catch(_0x1a240e){_0x3aeed0(_0x1a240e);}}function _0x37f5b4(_0x348154){try{_0x4a0076(_0x5aa308['throw'](_0x348154));}catch(_0x5d0995){_0x3aeed0(_0x5d0995);}}function _0x4a0076(_0x35a040){_0x35a040['done']?_0x41ce9c(_0x35a040['value']):_0x23fbb3(_0x35a040['value'])['then'](_0x18e4a5,_0x37f5b4);}_0x4a0076((_0x5aa308=_0x5aa308['apply'](_0x5a75d9,_0x6ba4bc||[]))['next']());});};class Fetch{static['get'](_0x4e9c86,_0xaac7bb){return __awaiter$1(this,void 0,void 0,function*(){return yield fetch(_0x4e9c86,{'method':'get','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xaac7bb}});});}}
|
|
4
|
+
|
|
5
|
+
class Response{constructor(_0x78a668){this['isSuccess']=_0x78a668;}}class SuccessfulAccountResponse extends Response{constructor(_0x146923){super(!![]),this['account']=_0x146923;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0xc83e06){super(![]),this['problem']=_0xc83e06;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
6
|
+
|
|
7
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x3a5d36,_0x3e67e1,_0x3e596b,_0x56ba57){function _0xeb6baf(_0xd03f22){return _0xd03f22 instanceof _0x3e596b?_0xd03f22:new _0x3e596b(function(_0xb389b3){_0xb389b3(_0xd03f22);});}return new(_0x3e596b||(_0x3e596b=Promise))(function(_0x529db7,_0x4c0742){function _0x43fe38(_0x5bf0cd){try{_0x38bdca(_0x56ba57['next'](_0x5bf0cd));}catch(_0x1a86a1){_0x4c0742(_0x1a86a1);}}function _0x39a679(_0x59ff66){try{_0x38bdca(_0x56ba57['throw'](_0x59ff66));}catch(_0x189780){_0x4c0742(_0x189780);}}function _0x38bdca(_0x31767c){_0x31767c['done']?_0x529db7(_0x31767c['value']):_0xeb6baf(_0x31767c['value'])['then'](_0x43fe38,_0x39a679);}_0x38bdca((_0x56ba57=_0x56ba57['apply'](_0x3a5d36,_0x3e67e1||[]))['next']());});};class AccountService{constructor(){}['get'](_0x53e1db,_0x450685){return __awaiter(this,arguments,void 0,function*(_0x5ed4a2,_0x103326,_0x1bf6cb={}){let _0x487b69=_0x1bf6cb['baseUri'];_0x487b69=_0x487b69+'/Account/'+_0x103326+'/';const _0x3ab0c0=yield Fetch['get'](_0x487b69,_0x5ed4a2);if(_0x3ab0c0['status']>0xc7&&_0x3ab0c0['status']<0x12c){const _0x45e047=yield _0x3ab0c0['json']();return new SuccessfulAccountResponse(_0x45e047);}if(_0x3ab0c0['bodyUsed']){const _0x41e5f5=yield _0x3ab0c0['json']();return new FailedAccountResponse(_0x41e5f5);}const _0x4d83c8={'type':'','status':_0x3ab0c0['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x4d83c8);});}}
|
|
8
|
+
|
|
9
|
+
class AdminClient{constructor(){this['baseUri']='https://admin.searchability.dev',this['Accounts']=new AccountService();}}
|
|
10
|
+
|
|
11
|
+
exports.AdminClient = AdminClient;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __awaiter$1=undefined&&undefined['__awaiter']||function(_0xe1d169,_0x310f23,_0x7dc183,_0x4ebf66){function _0x27cc91(_0x59207e){return _0x59207e instanceof _0x7dc183?_0x59207e:new _0x7dc183(function(_0x44a99e){_0x44a99e(_0x59207e);});}return new(_0x7dc183||(_0x7dc183=Promise))(function(_0x4c2c2e,_0x18f062){function _0x2ea042(_0x48e8ba){try{_0xf92b18(_0x4ebf66['next'](_0x48e8ba));}catch(_0x213d08){_0x18f062(_0x213d08);}}function _0x3727e4(_0x4efdb9){try{_0xf92b18(_0x4ebf66['throw'](_0x4efdb9));}catch(_0x511180){_0x18f062(_0x511180);}}function _0xf92b18(_0x15e3a4){_0x15e3a4['done']?_0x4c2c2e(_0x15e3a4['value']):_0x27cc91(_0x15e3a4['value'])['then'](_0x2ea042,_0x3727e4);}_0xf92b18((_0x4ebf66=_0x4ebf66['apply'](_0xe1d169,_0x310f23||[]))['next']());});};class Fetch{static['get'](_0x16edad,_0x2295b1){return __awaiter$1(this,void 0,void 0,function*(){return yield fetch(_0x16edad,{'method':'get','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2295b1}});});}}
|
|
2
|
+
|
|
3
|
+
class Response{constructor(_0x4b4b5a){this['isSuccess']=_0x4b4b5a;}}class SuccessfulAccountResponse extends Response{constructor(_0x3a9d48){super(!![]),this['account']=_0x3a9d48;}['toSuccess'](){return this['account'];}['toProblem'](){throw new Error('Did\x20not\x20fail');}}class FailedAccountResponse extends Response{constructor(_0x42d662){super(![]),this['problem']=_0x42d662;}['toSuccess'](){throw new Error('Not\x20a\x20success');}['toProblem'](){return this['problem'];}}
|
|
4
|
+
|
|
5
|
+
var __awaiter=undefined&&undefined['__awaiter']||function(_0x5efb31,_0x213af3,_0x2d164a,_0x25532e){function _0x172889(_0x3f1a1e){return _0x3f1a1e instanceof _0x2d164a?_0x3f1a1e:new _0x2d164a(function(_0x192ded){_0x192ded(_0x3f1a1e);});}return new(_0x2d164a||(_0x2d164a=Promise))(function(_0x500ae5,_0x557cfd){function _0x522302(_0x3a04cc){try{_0x123439(_0x25532e['next'](_0x3a04cc));}catch(_0x395e2e){_0x557cfd(_0x395e2e);}}function _0x3401a1(_0x5c39d5){try{_0x123439(_0x25532e['throw'](_0x5c39d5));}catch(_0x24e2cd){_0x557cfd(_0x24e2cd);}}function _0x123439(_0x3208d1){_0x3208d1['done']?_0x500ae5(_0x3208d1['value']):_0x172889(_0x3208d1['value'])['then'](_0x522302,_0x3401a1);}_0x123439((_0x25532e=_0x25532e['apply'](_0x5efb31,_0x213af3||[]))['next']());});};class AccountService{constructor(){}['get'](_0x1522eb,_0x5c9b66){return __awaiter(this,arguments,void 0,function*(_0x50fe7d,_0x2929d1,_0x4f59e7={}){let _0x15bb2e=_0x4f59e7['baseUri'];_0x15bb2e=_0x15bb2e+'/Account/'+_0x2929d1+'/';const _0x2c7e24=yield Fetch['get'](_0x15bb2e,_0x50fe7d);if(_0x2c7e24['status']>0xc7&&_0x2c7e24['status']<0x12c){const _0x5151f1=yield _0x2c7e24['json']();return new SuccessfulAccountResponse(_0x5151f1);}if(_0x2c7e24['bodyUsed']){const _0x50d428=yield _0x2c7e24['json']();return new FailedAccountResponse(_0x50d428);}const _0x285dc0={'type':'','status':_0x2c7e24['status'],'title':'','instance':'','errors':{}};return new FailedAccountResponse(_0x285dc0);});}}
|
|
6
|
+
|
|
7
|
+
class AdminClient{constructor(){this['baseUri']='https://admin.searchability.dev',this['Accounts']=new AccountService();}}
|
|
8
|
+
|
|
9
|
+
export { AdminClient };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare class AccountService {
|
|
2
|
+
constructor();
|
|
3
|
+
get(accessToken: string, accountName: string, options?: Partial<Options>): Promise<Response<Account, Problem>>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare class AdminClient {
|
|
7
|
+
readonly baseUri = "https://admin.searchability.dev";
|
|
8
|
+
readonly Accounts: AccountService;
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type Options = {
|
|
13
|
+
baseUri?: string;
|
|
14
|
+
};
|
|
15
|
+
declare abstract class Response<S, F> {
|
|
16
|
+
readonly isSuccess: boolean;
|
|
17
|
+
constructor(isSuccess: boolean);
|
|
18
|
+
abstract toSuccess(): S;
|
|
19
|
+
abstract toProblem(): F;
|
|
20
|
+
}
|
|
21
|
+
type Account = {
|
|
22
|
+
name: string;
|
|
23
|
+
owner: string;
|
|
24
|
+
created_utc: Date;
|
|
25
|
+
lists: List[];
|
|
26
|
+
};
|
|
27
|
+
type List = {
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
type Error = {
|
|
31
|
+
[key: string]: string[];
|
|
32
|
+
};
|
|
33
|
+
declare class SuccessfulAccountResponse extends Response<Account, Problem> {
|
|
34
|
+
readonly account: Account;
|
|
35
|
+
constructor(account: Account);
|
|
36
|
+
toSuccess(): Account;
|
|
37
|
+
toProblem(): Problem;
|
|
38
|
+
}
|
|
39
|
+
type Problem = {
|
|
40
|
+
type: string;
|
|
41
|
+
title: string;
|
|
42
|
+
status: number;
|
|
43
|
+
instance: string;
|
|
44
|
+
errors: Error;
|
|
45
|
+
};
|
|
46
|
+
declare class FailedAccountResponse extends Response<Account, Problem> {
|
|
47
|
+
readonly problem: Problem;
|
|
48
|
+
constructor(problem: Problem);
|
|
49
|
+
toSuccess(): Account;
|
|
50
|
+
toProblem(): Problem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { type Account, AdminClient, type Error, FailedAccountResponse, type List, type Options, type Problem, Response, SuccessfulAccountResponse };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@searchability/admin-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Searchability admin client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./dist/types.d.ts",
|
|
7
|
+
"typings": "./dist/types.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import":{
|
|
10
|
+
"types":"./dist/types.d.ts",
|
|
11
|
+
"default":"./dist/searchability-admin-client.js"
|
|
12
|
+
},
|
|
13
|
+
"require":{
|
|
14
|
+
"types":"./dist/types.d.ts",
|
|
15
|
+
"default":"./dist/searchability-admin-client.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/*"
|
|
20
|
+
],
|
|
21
|
+
"author": "Codeberry Limited",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"cleanDist": "rimraf dist/*",
|
|
28
|
+
"rollup": "rollup -c",
|
|
29
|
+
"watch": "rollup -c --watch",
|
|
30
|
+
"watchTs": "tsc -p . --watch",
|
|
31
|
+
"compile": "tsc -p .",
|
|
32
|
+
"build": "npm-run-all cleanDist compile rollup"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
36
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
37
|
+
"npm-run-all": "^4.1.5",
|
|
38
|
+
"rimraf": "^3.0.2",
|
|
39
|
+
"rollup": "^4.29.1",
|
|
40
|
+
"rollup-obfuscator": "^4.1.1",
|
|
41
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
42
|
+
"tslib": "^2.8.1",
|
|
43
|
+
"typescript": "^5.7.2"
|
|
44
|
+
}
|
|
45
|
+
}
|