@meowpanel/api 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/esm/api.d.ts +76 -0
- package/esm/api.d.ts.map +1 -0
- package/esm/api.js +187 -0
- package/esm/components/auth.d.ts +15 -0
- package/esm/components/auth.d.ts.map +1 -0
- package/esm/components/auth.js +13 -0
- package/esm/components/connection/abstract.d.ts +23 -0
- package/esm/components/connection/abstract.d.ts.map +1 -0
- package/esm/components/connection/abstract.js +43 -0
- package/esm/components/connection/sse.d.ts +20 -0
- package/esm/components/connection/sse.d.ts.map +1 -0
- package/esm/components/connection/sse.js +65 -0
- package/esm/components/egg/egg.d.ts +32 -0
- package/esm/components/egg/egg.d.ts.map +1 -0
- package/esm/components/egg/egg.js +70 -0
- package/esm/components/group.d.ts +14 -0
- package/esm/components/group.d.ts.map +1 -0
- package/esm/components/group.js +33 -0
- package/esm/components/member_2.d.ts +69 -0
- package/esm/components/member_2.d.ts.map +1 -0
- package/esm/components/member_2.js +140 -0
- package/esm/components/node.d.ts +78 -0
- package/esm/components/node.d.ts.map +1 -0
- package/esm/components/node.js +342 -0
- package/esm/components/server/activity.d.ts +45 -0
- package/esm/components/server/activity.d.ts.map +1 -0
- package/esm/components/server/activity.js +158 -0
- package/esm/components/server/allocations.d.ts +45 -0
- package/esm/components/server/allocations.d.ts.map +1 -0
- package/esm/components/server/allocations.js +146 -0
- package/esm/components/server/files.d.ts +50 -0
- package/esm/components/server/files.d.ts.map +1 -0
- package/esm/components/server/files.js +90 -0
- package/esm/components/server/power.d.ts +21 -0
- package/esm/components/server/power.d.ts.map +1 -0
- package/esm/components/server/power.js +43 -0
- package/esm/components/server/profiles.d.ts +63 -0
- package/esm/components/server/profiles.d.ts.map +1 -0
- package/esm/components/server/profiles.js +163 -0
- package/esm/components/server/server.d.ts +141 -0
- package/esm/components/server/server.d.ts.map +1 -0
- package/esm/components/server/server.js +358 -0
- package/esm/components/server/sftp.d.ts +31 -0
- package/esm/components/server/sftp.d.ts.map +1 -0
- package/esm/components/server/sftp.js +84 -0
- package/esm/components/server/startup.d.ts +17 -0
- package/esm/components/server/startup.d.ts.map +1 -0
- package/esm/components/server/startup.js +21 -0
- package/esm/components/server/stats.d.ts +19 -0
- package/esm/components/server/stats.d.ts.map +1 -0
- package/esm/components/server/stats.js +46 -0
- package/esm/mod.d.ts +2 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +1 -0
- package/esm/package.json +3 -0
- package/esm/utils/cache.d.ts +20 -0
- package/esm/utils/cache.d.ts.map +1 -0
- package/esm/utils/cache.js +66 -0
- package/esm/utils/event.d.ts +38 -0
- package/esm/utils/event.d.ts.map +1 -0
- package/esm/utils/event.js +71 -0
- package/esm/utils/object.d.ts +58 -0
- package/esm/utils/object.d.ts.map +1 -0
- package/esm/utils/object.js +86 -0
- package/esm/utils/subscribe.d.ts +37 -0
- package/esm/utils/subscribe.d.ts.map +1 -0
- package/esm/utils/subscribe.js +29 -0
- package/esm/utils/timer.d.ts +13 -0
- package/esm/utils/timer.d.ts.map +1 -0
- package/esm/utils/timer.js +32 -0
- package/esm/utils/units.d.ts +18 -0
- package/esm/utils/units.d.ts.map +1 -0
- package/esm/utils/units.js +82 -0
- package/package.json +107 -0
- package/script/api.d.ts +76 -0
- package/script/api.d.ts.map +1 -0
- package/script/api.js +192 -0
- package/script/components/auth.d.ts +15 -0
- package/script/components/auth.d.ts.map +1 -0
- package/script/components/auth.js +17 -0
- package/script/components/connection/abstract.d.ts +23 -0
- package/script/components/connection/abstract.d.ts.map +1 -0
- package/script/components/connection/abstract.js +47 -0
- package/script/components/connection/sse.d.ts +20 -0
- package/script/components/connection/sse.d.ts.map +1 -0
- package/script/components/connection/sse.js +69 -0
- package/script/components/egg/egg.d.ts +32 -0
- package/script/components/egg/egg.d.ts.map +1 -0
- package/script/components/egg/egg.js +74 -0
- package/script/components/group.d.ts +14 -0
- package/script/components/group.d.ts.map +1 -0
- package/script/components/group.js +37 -0
- package/script/components/member_2.d.ts +69 -0
- package/script/components/member_2.d.ts.map +1 -0
- package/script/components/member_2.js +146 -0
- package/script/components/node.d.ts +78 -0
- package/script/components/node.d.ts.map +1 -0
- package/script/components/node.js +349 -0
- package/script/components/server/activity.d.ts +45 -0
- package/script/components/server/activity.d.ts.map +1 -0
- package/script/components/server/activity.js +164 -0
- package/script/components/server/allocations.d.ts +45 -0
- package/script/components/server/allocations.d.ts.map +1 -0
- package/script/components/server/allocations.js +152 -0
- package/script/components/server/files.d.ts +50 -0
- package/script/components/server/files.d.ts.map +1 -0
- package/script/components/server/files.js +94 -0
- package/script/components/server/power.d.ts +21 -0
- package/script/components/server/power.d.ts.map +1 -0
- package/script/components/server/power.js +47 -0
- package/script/components/server/profiles.d.ts +63 -0
- package/script/components/server/profiles.d.ts.map +1 -0
- package/script/components/server/profiles.js +168 -0
- package/script/components/server/server.d.ts +141 -0
- package/script/components/server/server.d.ts.map +1 -0
- package/script/components/server/server.js +362 -0
- package/script/components/server/sftp.d.ts +31 -0
- package/script/components/server/sftp.d.ts.map +1 -0
- package/script/components/server/sftp.js +88 -0
- package/script/components/server/startup.d.ts +17 -0
- package/script/components/server/startup.d.ts.map +1 -0
- package/script/components/server/startup.js +25 -0
- package/script/components/server/stats.d.ts +19 -0
- package/script/components/server/stats.d.ts.map +1 -0
- package/script/components/server/stats.js +50 -0
- package/script/mod.d.ts +2 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +5 -0
- package/script/package.json +3 -0
- package/script/utils/cache.d.ts +20 -0
- package/script/utils/cache.d.ts.map +1 -0
- package/script/utils/cache.js +70 -0
- package/script/utils/event.d.ts +38 -0
- package/script/utils/event.d.ts.map +1 -0
- package/script/utils/event.js +75 -0
- package/script/utils/object.d.ts +58 -0
- package/script/utils/object.d.ts.map +1 -0
- package/script/utils/object.js +90 -0
- package/script/utils/subscribe.d.ts +37 -0
- package/script/utils/subscribe.d.ts.map +1 -0
- package/script/utils/subscribe.js +32 -0
- package/script/utils/timer.d.ts +13 -0
- package/script/utils/timer.d.ts.map +1 -0
- package/script/utils/timer.js +36 -0
- package/script/utils/units.d.ts +18 -0
- package/script/utils/units.d.ts.map +1 -0
- package/script/utils/units.js +86 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a variable that can be subscribed to for changes.
|
|
3
|
+
*
|
|
4
|
+
* @param initValue The initial value
|
|
5
|
+
* @param notifier The {@link SubscriptionNotifier} function called on initialization, controlling the current value
|
|
6
|
+
* @returns A subscription object allowing to subscribe
|
|
7
|
+
*/
|
|
8
|
+
export function createSubscription(initValue, notifier) {
|
|
9
|
+
let currentValue = initValue;
|
|
10
|
+
const subscribers = new Set();
|
|
11
|
+
function set(value) {
|
|
12
|
+
currentValue = value;
|
|
13
|
+
subscribers.forEach((fn) => fn(currentValue));
|
|
14
|
+
}
|
|
15
|
+
async function update(value) {
|
|
16
|
+
currentValue = await value(currentValue);
|
|
17
|
+
subscribers.forEach((fn) => fn(currentValue));
|
|
18
|
+
}
|
|
19
|
+
notifier(set, update);
|
|
20
|
+
return {
|
|
21
|
+
subscribe(fn) {
|
|
22
|
+
subscribers.add(fn);
|
|
23
|
+
fn(currentValue);
|
|
24
|
+
return () => {
|
|
25
|
+
subscribers.delete(fn);
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for converting milliseconds to hours, minutes and seconds.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Timer extends Number {
|
|
5
|
+
private readonly timerMs;
|
|
6
|
+
constructor(timerMs: number);
|
|
7
|
+
get hour(): number;
|
|
8
|
+
get minute(): number;
|
|
9
|
+
get second(): number;
|
|
10
|
+
get millisecond(): number;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/utils/timer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,KAAM,SAAQ,MAAM;IACb,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAInD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,WAAW,IAAI,MAAM,CAE/B;IAEe,QAAQ,IAAI,MAAM;CAMlC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for converting milliseconds to hours, minutes and seconds.
|
|
3
|
+
*/
|
|
4
|
+
export class Timer extends Number {
|
|
5
|
+
constructor(timerMs) {
|
|
6
|
+
super(timerMs);
|
|
7
|
+
Object.defineProperty(this, "timerMs", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: timerMs
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
get hour() {
|
|
15
|
+
return Math.floor(this.timerMs / 1000 / 60 / 60);
|
|
16
|
+
}
|
|
17
|
+
get minute() {
|
|
18
|
+
return Math.floor(this.timerMs / 1000 / 60);
|
|
19
|
+
}
|
|
20
|
+
get second() {
|
|
21
|
+
return Math.floor(this.timerMs / 1000);
|
|
22
|
+
}
|
|
23
|
+
get millisecond() {
|
|
24
|
+
return this.timerMs;
|
|
25
|
+
}
|
|
26
|
+
toString() {
|
|
27
|
+
const hour = this.hour.toString().padStart(2, '0');
|
|
28
|
+
const minute = this.minute.toString().padStart(2, '0');
|
|
29
|
+
const second = this.second.toString().padStart(2, '0');
|
|
30
|
+
return `${hour}:${minute}:${second}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for converting bytes to other units.
|
|
3
|
+
*/
|
|
4
|
+
export declare class ByteUnit {
|
|
5
|
+
protected static readonly KB = 1024;
|
|
6
|
+
protected static readonly MB: number;
|
|
7
|
+
protected static readonly GB: number;
|
|
8
|
+
static stringify(value: number, unit?: 'b' | 'kb' | 'mb' | 'gb'): string;
|
|
9
|
+
static readonly ZERO: ByteUnit;
|
|
10
|
+
protected readonly valueBytes: number;
|
|
11
|
+
constructor(value: number, unit?: 'b' | 'kb' | 'mb' | 'gb');
|
|
12
|
+
get bytes(): number;
|
|
13
|
+
get kb(): number;
|
|
14
|
+
get mb(): number;
|
|
15
|
+
get gb(): number;
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/utils/units.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAQ;IACpB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;IACpC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAe;IAC3C,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAsB;WAEpC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAU,GAAG,MAAM;IAIpF,gBAAuB,IAAI,EAAE,QAAQ,CAAmB;IAExD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBACnB,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAU;IAmBtE,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,EAAE,IAAI,MAAM,CAEtB;IAEM,QAAQ,IAAI,MAAM;CAWzB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple class for converting bytes to other units.
|
|
3
|
+
*/
|
|
4
|
+
export class ByteUnit {
|
|
5
|
+
static stringify(value, unit = 'b') {
|
|
6
|
+
return new ByteUnit(value, unit).toString();
|
|
7
|
+
}
|
|
8
|
+
constructor(value, unit = 'b') {
|
|
9
|
+
Object.defineProperty(this, "valueBytes", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
switch (unit) {
|
|
16
|
+
case 'b':
|
|
17
|
+
this.valueBytes = value;
|
|
18
|
+
break;
|
|
19
|
+
case 'kb':
|
|
20
|
+
this.valueBytes = value * 1024;
|
|
21
|
+
break;
|
|
22
|
+
case 'mb':
|
|
23
|
+
this.valueBytes = value * 1024 * 1024;
|
|
24
|
+
break;
|
|
25
|
+
case 'gb':
|
|
26
|
+
this.valueBytes = value * 1024 * 1024 * 1024;
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`Unknown unit '${unit}'`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
get bytes() {
|
|
33
|
+
return this.valueBytes;
|
|
34
|
+
}
|
|
35
|
+
get kb() {
|
|
36
|
+
return this.valueBytes / ByteUnit.KB;
|
|
37
|
+
}
|
|
38
|
+
get mb() {
|
|
39
|
+
return this.valueBytes / ByteUnit.MB;
|
|
40
|
+
}
|
|
41
|
+
get gb() {
|
|
42
|
+
return this.valueBytes / ByteUnit.GB;
|
|
43
|
+
}
|
|
44
|
+
toString() {
|
|
45
|
+
if (this.valueBytes >= ByteUnit.GB) {
|
|
46
|
+
return `${this.gb.toFixed(2)} GB`;
|
|
47
|
+
}
|
|
48
|
+
else if (this.valueBytes >= ByteUnit.MB) {
|
|
49
|
+
return `${this.mb.toFixed(2)} MB`;
|
|
50
|
+
}
|
|
51
|
+
else if (this.valueBytes >= ByteUnit.KB) {
|
|
52
|
+
return `${this.kb.toFixed(2)} KB`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return `${this.valueBytes} B`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
Object.defineProperty(ByteUnit, "KB", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: 1024
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(ByteUnit, "MB", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: 1024 * 1024
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(ByteUnit, "GB", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: 1024 * 1024 * 1024
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(ByteUnit, "ZERO", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: new ByteUnit(0)
|
|
82
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meowpanel/api",
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
|
+
"description": "MeowPanel API Wrapper for JavsScript",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./script/mod.js",
|
|
7
|
+
"module": "./esm/mod.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./esm/mod.js",
|
|
11
|
+
"require": "./script/mod.js"
|
|
12
|
+
},
|
|
13
|
+
"./utils/timer": {
|
|
14
|
+
"import": "./esm/utils/timer.js",
|
|
15
|
+
"require": "./script/utils/timer.js"
|
|
16
|
+
},
|
|
17
|
+
"./utils/cache": {
|
|
18
|
+
"import": "./esm/utils/cache.js",
|
|
19
|
+
"require": "./script/utils/cache.js"
|
|
20
|
+
},
|
|
21
|
+
"./utils/event": {
|
|
22
|
+
"import": "./esm/utils/event.js",
|
|
23
|
+
"require": "./script/utils/event.js"
|
|
24
|
+
},
|
|
25
|
+
"./utils/subscribe": {
|
|
26
|
+
"import": "./esm/utils/subscribe.js",
|
|
27
|
+
"require": "./script/utils/subscribe.js"
|
|
28
|
+
},
|
|
29
|
+
"./utils/object": {
|
|
30
|
+
"import": "./esm/utils/object.js",
|
|
31
|
+
"require": "./script/utils/object.js"
|
|
32
|
+
},
|
|
33
|
+
"./utils/units": {
|
|
34
|
+
"import": "./esm/utils/units.js",
|
|
35
|
+
"require": "./script/utils/units.js"
|
|
36
|
+
},
|
|
37
|
+
"./components/auth": {
|
|
38
|
+
"import": "./esm/components/auth.js",
|
|
39
|
+
"require": "./script/components/auth.js"
|
|
40
|
+
},
|
|
41
|
+
"./components/member": {
|
|
42
|
+
"import": "./esm/components/member_2.js",
|
|
43
|
+
"require": "./script/components/member_2.js"
|
|
44
|
+
},
|
|
45
|
+
"./components/group": {
|
|
46
|
+
"import": "./esm/components/group.js",
|
|
47
|
+
"require": "./script/components/group.js"
|
|
48
|
+
},
|
|
49
|
+
"./components/server/profiles": {
|
|
50
|
+
"import": "./esm/components/server/profiles.js",
|
|
51
|
+
"require": "./script/components/server/profiles.js"
|
|
52
|
+
},
|
|
53
|
+
"./components/server/server": {
|
|
54
|
+
"import": "./esm/components/server/server.js",
|
|
55
|
+
"require": "./script/components/server/server.js"
|
|
56
|
+
},
|
|
57
|
+
"./components/server/allocations": {
|
|
58
|
+
"import": "./esm/components/server/allocations.js",
|
|
59
|
+
"require": "./script/components/server/allocations.js"
|
|
60
|
+
},
|
|
61
|
+
"./components/server/power": {
|
|
62
|
+
"import": "./esm/components/server/power.js",
|
|
63
|
+
"require": "./script/components/server/power.js"
|
|
64
|
+
},
|
|
65
|
+
"./components/server/activity": {
|
|
66
|
+
"import": "./esm/components/server/activity.js",
|
|
67
|
+
"require": "./script/components/server/activity.js"
|
|
68
|
+
},
|
|
69
|
+
"./components/server/sftp": {
|
|
70
|
+
"import": "./esm/components/server/sftp.js",
|
|
71
|
+
"require": "./script/components/server/sftp.js"
|
|
72
|
+
},
|
|
73
|
+
"./components/server/stats": {
|
|
74
|
+
"import": "./esm/components/server/stats.js",
|
|
75
|
+
"require": "./script/components/server/stats.js"
|
|
76
|
+
},
|
|
77
|
+
"./components/server/startup": {
|
|
78
|
+
"import": "./esm/components/server/startup.js",
|
|
79
|
+
"require": "./script/components/server/startup.js"
|
|
80
|
+
},
|
|
81
|
+
"./components/server/files": {
|
|
82
|
+
"import": "./esm/components/server/files.js",
|
|
83
|
+
"require": "./script/components/server/files.js"
|
|
84
|
+
},
|
|
85
|
+
"./components/connection/sse": {
|
|
86
|
+
"import": "./esm/components/connection/sse.js",
|
|
87
|
+
"require": "./script/components/connection/sse.js"
|
|
88
|
+
},
|
|
89
|
+
"./components/connection/abstract": {
|
|
90
|
+
"import": "./esm/components/connection/abstract.js",
|
|
91
|
+
"require": "./script/components/connection/abstract.js"
|
|
92
|
+
},
|
|
93
|
+
"./components/egg/egg": {
|
|
94
|
+
"import": "./esm/components/egg/egg.js",
|
|
95
|
+
"require": "./script/components/egg/egg.js"
|
|
96
|
+
},
|
|
97
|
+
"./components/node": {
|
|
98
|
+
"import": "./esm/components/node.js",
|
|
99
|
+
"require": "./script/components/node.js"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"scripts": {},
|
|
103
|
+
"devDependencies": {
|
|
104
|
+
"@types/node": "^20.9.0"
|
|
105
|
+
},
|
|
106
|
+
"_generatedBy": "dnt@dev"
|
|
107
|
+
}
|
package/script/api.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AuthApi } from './components/auth.js';
|
|
2
|
+
import { ServerGroup } from './components/group.js';
|
|
3
|
+
import { Member, type MemberInclude } from './components/member_2.js';
|
|
4
|
+
import { Node, type NodeInclude } from './components/node.js';
|
|
5
|
+
import { Server, type ServerInclude } from './components/server/server.js';
|
|
6
|
+
import { type EventFunction, EventManager, type EventManagerListener } from './utils/event.js';
|
|
7
|
+
export declare class ApiError extends Error {
|
|
8
|
+
readonly error: string;
|
|
9
|
+
readonly status: number;
|
|
10
|
+
constructor(response: Response, error: string);
|
|
11
|
+
}
|
|
12
|
+
export interface MainEvents {
|
|
13
|
+
error: ApiError;
|
|
14
|
+
}
|
|
15
|
+
export interface MeowPanelApiRequestData {
|
|
16
|
+
body?: Record<string, unknown> | FormData | ArrayBuffer | string;
|
|
17
|
+
params?: Record<string, string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export declare class MeowPanelApi implements EventManagerListener<MainEvents> {
|
|
20
|
+
private static isPlainJson;
|
|
21
|
+
protected readonly url: string | URL;
|
|
22
|
+
protected readonly token: string | undefined;
|
|
23
|
+
protected readonly fetch: typeof fetch;
|
|
24
|
+
protected readonly eventManager: EventManager<MainEvents>;
|
|
25
|
+
on<K extends keyof MainEvents>(event: K, func: EventFunction<MainEvents, K>): number;
|
|
26
|
+
off<K extends keyof MainEvents>(event: K, func: number | EventFunction<MainEvents, K>): boolean;
|
|
27
|
+
requestUrl(method: string, url: URL | string, data?: MeowPanelApiRequestData): Promise<Response>;
|
|
28
|
+
request<T>(method: string, endpoint: `/${string}`, init?: {
|
|
29
|
+
body?: Record<string, unknown>;
|
|
30
|
+
pagination?: Pagination;
|
|
31
|
+
params?: Record<string, string | undefined>;
|
|
32
|
+
}): Promise<ApiResponse<T>>;
|
|
33
|
+
constructor(options: Options);
|
|
34
|
+
/**
|
|
35
|
+
* Fetches the current logged in account
|
|
36
|
+
*/
|
|
37
|
+
me(include?: MemberInclude[]): Promise<Member>;
|
|
38
|
+
readonly members: {
|
|
39
|
+
list: (pagination: Pagination) => Promise<{
|
|
40
|
+
data: Member[];
|
|
41
|
+
page: Page | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
get: (id: string) => Promise<Member>;
|
|
44
|
+
};
|
|
45
|
+
readonly getNode: (id: string, include?: NodeInclude[]) => Promise<Node>;
|
|
46
|
+
readonly getServers: (page: number, include?: ServerInclude[], query?: string) => Promise<{
|
|
47
|
+
servers: Server[];
|
|
48
|
+
page: Page;
|
|
49
|
+
}>;
|
|
50
|
+
readonly getServer: (id: string, include?: ServerInclude[]) => Promise<Server>;
|
|
51
|
+
readonly getServerGroups: (page: number) => Promise<{
|
|
52
|
+
groups: ServerGroup[];
|
|
53
|
+
page: Page;
|
|
54
|
+
}>;
|
|
55
|
+
readonly getServerGroup: (id: string) => Promise<ServerGroup>;
|
|
56
|
+
readonly auth: AuthApi;
|
|
57
|
+
}
|
|
58
|
+
export interface Options {
|
|
59
|
+
url: string | URL;
|
|
60
|
+
token?: string;
|
|
61
|
+
fetch?: typeof fetch;
|
|
62
|
+
}
|
|
63
|
+
export interface ApiResponse<T> {
|
|
64
|
+
data: T;
|
|
65
|
+
page?: Page;
|
|
66
|
+
}
|
|
67
|
+
export interface Pagination {
|
|
68
|
+
page: number;
|
|
69
|
+
perPage?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface Page {
|
|
72
|
+
total: number;
|
|
73
|
+
from: number;
|
|
74
|
+
to: number;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,KAAK,aAAa,E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AAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAC/D;IAClC,SAAgB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAqC;IAEzG,SAAgB,IAAI,EAAE,OAAO,CAAqB;CAClD;AAED,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,IAAI;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX"}
|
package/script/api.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeowPanelApi = exports.ApiError = void 0;
|
|
4
|
+
const auth_js_1 = require("./components/auth.js");
|
|
5
|
+
const group_js_1 = require("./components/group.js");
|
|
6
|
+
const member_2_js_1 = require("./components/member_2.js");
|
|
7
|
+
const node_js_1 = require("./components/node.js");
|
|
8
|
+
const server_js_1 = require("./components/server/server.js");
|
|
9
|
+
const event_js_1 = require("./utils/event.js");
|
|
10
|
+
class ApiError extends Error {
|
|
11
|
+
constructor(response, error) {
|
|
12
|
+
super(`${response.status}: ${error}`);
|
|
13
|
+
Object.defineProperty(this, "error", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: error
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "status", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
this.status = response.status;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ApiError = ApiError;
|
|
29
|
+
class MeowPanelApi {
|
|
30
|
+
static isPlainJson(value) {
|
|
31
|
+
return typeof value === 'object' && value !== null &&
|
|
32
|
+
value.constructor === Object;
|
|
33
|
+
}
|
|
34
|
+
on(event, func) {
|
|
35
|
+
return this.eventManager.on(event, func);
|
|
36
|
+
}
|
|
37
|
+
off(event, func) {
|
|
38
|
+
return this.eventManager.off(event, func);
|
|
39
|
+
}
|
|
40
|
+
async requestUrl(method, url, data = {}) {
|
|
41
|
+
const headers = {};
|
|
42
|
+
if (this.token) {
|
|
43
|
+
headers.Authorization = `Bearer ${this.token}`;
|
|
44
|
+
}
|
|
45
|
+
const requestUrl = new URL(url.toString());
|
|
46
|
+
if (data.params) {
|
|
47
|
+
for (const [key, value] of Object.entries(data.params)) {
|
|
48
|
+
if (value !== undefined) {
|
|
49
|
+
requestUrl.searchParams.set(key, value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const response = await this.fetch(requestUrl, {
|
|
54
|
+
body: MeowPanelApi.isPlainJson(data.body) ? JSON.stringify(data.body) : data.body,
|
|
55
|
+
credentials: 'include',
|
|
56
|
+
headers,
|
|
57
|
+
method,
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
let message;
|
|
61
|
+
try {
|
|
62
|
+
const json = await response.json();
|
|
63
|
+
message = json.error;
|
|
64
|
+
}
|
|
65
|
+
catch (_) {
|
|
66
|
+
console.warn('Failed to parse error response');
|
|
67
|
+
message = 'Unknown error';
|
|
68
|
+
}
|
|
69
|
+
const error = new ApiError(response, message);
|
|
70
|
+
this.eventManager.dispatch('error', error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
async request(method, endpoint, init = {}) {
|
|
76
|
+
const url = new URL(this.url.toString());
|
|
77
|
+
url.pathname = `${url.pathname}/${endpoint}`.replace(/\/+/g, '/');
|
|
78
|
+
if (init.params) {
|
|
79
|
+
Object.entries(init.params).forEach(([key, value]) => value !== undefined && url.searchParams.set(key, value));
|
|
80
|
+
}
|
|
81
|
+
init.pagination &&
|
|
82
|
+
url.searchParams.set('page', `${init.pagination.page}`);
|
|
83
|
+
init.pagination?.perPage &&
|
|
84
|
+
url.searchParams.set('perPage', `${init.pagination.perPage}`);
|
|
85
|
+
const response = await this.requestUrl(method, url.toString(), init);
|
|
86
|
+
if (response.status === 204)
|
|
87
|
+
return {};
|
|
88
|
+
const json = await response.json();
|
|
89
|
+
let page = undefined;
|
|
90
|
+
if (init.pagination) {
|
|
91
|
+
const contentRange = response.headers.get('content-range');
|
|
92
|
+
if (!contentRange) {
|
|
93
|
+
throw new Error('Expected content-range header not found');
|
|
94
|
+
}
|
|
95
|
+
const [range, total] = contentRange.split('/') ??
|
|
96
|
+
['items 0-0', '0'];
|
|
97
|
+
const [from, to] = range.split(' ')[1].split('-').map(Number);
|
|
98
|
+
page = { total: Number(total), from, to };
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
page,
|
|
102
|
+
data: json,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
constructor(options) {
|
|
106
|
+
Object.defineProperty(this, "url", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true,
|
|
110
|
+
value: void 0
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(this, "token", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
configurable: true,
|
|
115
|
+
writable: true,
|
|
116
|
+
value: void 0
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(this, "fetch", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true,
|
|
121
|
+
writable: true,
|
|
122
|
+
value: void 0
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(this, "eventManager", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
configurable: true,
|
|
127
|
+
writable: true,
|
|
128
|
+
value: new event_js_1.EventManager()
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(this, "members", {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
configurable: true,
|
|
133
|
+
writable: true,
|
|
134
|
+
value: {
|
|
135
|
+
list: (pagination) => member_2_js_1.Member.list(this, pagination),
|
|
136
|
+
get: (id) => member_2_js_1.Member.get(this, id),
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(this, "getNode", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
configurable: true,
|
|
142
|
+
writable: true,
|
|
143
|
+
value: (id, include) => node_js_1.Node.get(this, id, include)
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(this, "getServers", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
configurable: true,
|
|
148
|
+
writable: true,
|
|
149
|
+
value: (page, include, query) => server_js_1.Server.getPaged(this, page, include, query)
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(this, "getServer", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
configurable: true,
|
|
154
|
+
writable: true,
|
|
155
|
+
value: (id, include) => server_js_1.Server.get(this, id, include)
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(this, "getServerGroups", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
configurable: true,
|
|
160
|
+
writable: true,
|
|
161
|
+
value: (page) => group_js_1.ServerGroup.getPaged(this, page)
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(this, "getServerGroup", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
configurable: true,
|
|
166
|
+
writable: true,
|
|
167
|
+
value: (id) => group_js_1.ServerGroup.get(this, id)
|
|
168
|
+
});
|
|
169
|
+
Object.defineProperty(this, "auth", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
configurable: true,
|
|
172
|
+
writable: true,
|
|
173
|
+
value: new auth_js_1.AuthApi(this)
|
|
174
|
+
});
|
|
175
|
+
this.url = options.url;
|
|
176
|
+
this.token = options.token;
|
|
177
|
+
this.fetch = options.fetch ?? fetch;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Fetches the current logged in account
|
|
181
|
+
*/
|
|
182
|
+
// TODO: update to accept API key response
|
|
183
|
+
async me(include) {
|
|
184
|
+
const response = await this.request('GET', '/v1/account', {
|
|
185
|
+
params: {
|
|
186
|
+
include: include?.join(','),
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
return new member_2_js_1.Member(this, response.data);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.MeowPanelApi = MeowPanelApi;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MeowPanelApi } from '../mod.js';
|
|
2
|
+
import type { ApiResponse } from '../api.js';
|
|
3
|
+
export interface AuthProvider {
|
|
4
|
+
fields: Record<string, string>;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthGetMeta {
|
|
8
|
+
providers: Record<string, AuthProvider>;
|
|
9
|
+
}
|
|
10
|
+
export declare class AuthApi {
|
|
11
|
+
protected readonly api: MeowPanelApi;
|
|
12
|
+
getMeta(): Promise<ApiResponse<AuthGetMeta>>;
|
|
13
|
+
constructor(api: MeowPanelApi);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/components/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACxC;AAED,qBAAa,OAAO;IAKA,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;IAJ1C,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAInB,GAAG,EAAE,YAAY;CACvD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthApi = void 0;
|
|
4
|
+
class AuthApi {
|
|
5
|
+
async getMeta() {
|
|
6
|
+
return await this.api.request('GET', '/v1/auth');
|
|
7
|
+
}
|
|
8
|
+
constructor(api) {
|
|
9
|
+
Object.defineProperty(this, "api", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: api
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AuthApi = AuthApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type EventFunction, EventManager, type EventManagerListener } from '../../utils/event.js';
|
|
2
|
+
import type { Server } from '../server/server.js';
|
|
3
|
+
import type { NodeServerEvents } from './node';
|
|
4
|
+
export declare abstract class ServerConnection implements EventManagerListener<NodeServerEvents> {
|
|
5
|
+
protected readonly subSystemName: string;
|
|
6
|
+
protected readonly server: Server;
|
|
7
|
+
constructor(subSystemName: string, server: Server);
|
|
8
|
+
readonly eventManager: EventManager<NodeServerEvents>;
|
|
9
|
+
on<K extends keyof NodeServerEvents>(event: K, func: EventFunction<NodeServerEvents, K>): number;
|
|
10
|
+
off<K extends keyof NodeServerEvents>(event: K | number, func?: EventFunction<NodeServerEvents, K> | number): boolean;
|
|
11
|
+
abstract connect(): Promise<void> | void;
|
|
12
|
+
abstract disconnect(): Promise<void> | void;
|
|
13
|
+
abstract isConnected: boolean;
|
|
14
|
+
logger: Logger;
|
|
15
|
+
private log;
|
|
16
|
+
}
|
|
17
|
+
export interface Logger {
|
|
18
|
+
debug: (message: string) => void;
|
|
19
|
+
info: (message: string) => void;
|
|
20
|
+
warn: (message: string) => void;
|
|
21
|
+
error: (message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=abstract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../src/components/connection/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C,8BAAsB,gBAAiB,YAAW,oBAAoB,CAAC,gBAAgB,CAAC;IAEtF,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM;IACxC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;gBADd,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM;IAGlC,SAAgB,YAAY,iCAAwC;IAC7D,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACzC,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,GACtC,MAAM;IAIF,GAAG,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAC1C,KAAK,EAAE,CAAC,GAAG,MAAM,EACjB,IAAI,CAAC,EAAE,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,MAAM,GAChD,OAAO;aAI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