@meowpanel/api 0.1.0-alpha.11 → 1.0.0-beta.2
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 +1 -1
- package/README.md +40 -0
- package/esm/mod.d.ts +87 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +85 -1
- package/esm/src/client.d.ts +248 -0
- package/esm/src/client.d.ts.map +1 -0
- package/esm/src/client.js +235 -0
- package/esm/src/emitter.d.ts +53 -0
- package/esm/src/emitter.d.ts.map +1 -0
- package/esm/src/emitter.js +55 -0
- package/esm/src/errors.d.ts +42 -0
- package/esm/src/errors.d.ts.map +1 -0
- package/esm/src/errors.js +45 -0
- package/esm/src/http.d.ts +157 -0
- package/esm/src/http.d.ts.map +1 -0
- package/esm/src/http.js +317 -0
- package/esm/src/namespace.d.ts +59 -0
- package/esm/src/namespace.d.ts.map +1 -0
- package/esm/src/namespace.js +79 -0
- package/esm/src/reactive.d.ts +29 -0
- package/esm/src/reactive.d.ts.map +1 -0
- package/esm/src/reactive.js +35 -0
- package/esm/src/resources/account.d.ts +125 -0
- package/esm/src/resources/account.d.ts.map +1 -0
- package/esm/src/resources/account.js +151 -0
- package/esm/src/resources/api-keys.d.ts +116 -0
- package/esm/src/resources/api-keys.d.ts.map +1 -0
- package/esm/src/resources/api-keys.js +105 -0
- package/esm/src/resources/auth.d.ts +57 -0
- package/esm/src/resources/auth.d.ts.map +1 -0
- package/esm/src/resources/auth.js +39 -0
- package/esm/src/resources/eggs.d.ts +238 -0
- package/esm/src/resources/eggs.d.ts.map +1 -0
- package/esm/src/resources/eggs.js +187 -0
- package/esm/src/resources/hosts.d.ts +62 -0
- package/esm/src/resources/hosts.d.ts.map +1 -0
- package/esm/src/resources/hosts.js +62 -0
- package/esm/src/resources/members.d.ts +138 -0
- package/esm/src/resources/members.d.ts.map +1 -0
- package/esm/src/resources/members.js +122 -0
- package/esm/src/resources/nodes.d.ts +397 -0
- package/esm/src/resources/nodes.d.ts.map +1 -0
- package/esm/src/resources/nodes.js +352 -0
- package/esm/src/resources/server-groups.d.ts +150 -0
- package/esm/src/resources/server-groups.d.ts.map +1 -0
- package/esm/src/resources/server-groups.js +111 -0
- package/esm/src/resources/servers/activity.d.ts +120 -0
- package/esm/src/resources/servers/activity.d.ts.map +1 -0
- package/esm/src/resources/servers/activity.js +163 -0
- package/esm/src/resources/servers/allocations.d.ts +125 -0
- package/esm/src/resources/servers/allocations.d.ts.map +1 -0
- package/esm/src/resources/servers/allocations.js +137 -0
- package/esm/src/resources/servers/connection.d.ts +108 -0
- package/esm/src/resources/servers/connection.d.ts.map +1 -0
- package/esm/src/resources/servers/connection.js +169 -0
- package/esm/src/resources/servers/files.d.ts +164 -0
- package/esm/src/resources/servers/files.d.ts.map +1 -0
- package/esm/src/resources/servers/files.js +281 -0
- package/esm/src/resources/servers/index.d.ts +126 -0
- package/esm/src/resources/servers/index.d.ts.map +1 -0
- package/esm/src/resources/servers/index.js +135 -0
- package/esm/src/resources/servers/profiles.d.ts +138 -0
- package/esm/src/resources/servers/profiles.d.ts.map +1 -0
- package/esm/src/resources/servers/profiles.js +177 -0
- package/esm/src/resources/servers/server.d.ts +136 -0
- package/esm/src/resources/servers/server.d.ts.map +1 -0
- package/esm/src/resources/servers/server.js +202 -0
- package/esm/src/resources/servers/sftp.d.ts +147 -0
- package/esm/src/resources/servers/sftp.d.ts.map +1 -0
- package/esm/src/resources/servers/sftp.js +153 -0
- package/esm/src/resources/servers/types.d.ts +199 -0
- package/esm/src/resources/servers/types.d.ts.map +1 -0
- package/esm/src/resources/servers/types.js +1 -0
- package/esm/src/sse.d.ts +53 -0
- package/esm/src/sse.d.ts.map +1 -0
- package/esm/src/sse.js +133 -0
- package/esm/src/types.d.ts +126 -0
- package/esm/src/types.d.ts.map +1 -0
- package/esm/src/types.js +21 -0
- package/package.json +4 -92
- package/script/mod.d.ts +87 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +132 -3
- package/script/src/client.d.ts +248 -0
- package/script/src/client.d.ts.map +1 -0
- package/script/src/client.js +239 -0
- package/script/src/emitter.d.ts +53 -0
- package/script/src/emitter.d.ts.map +1 -0
- package/script/src/emitter.js +59 -0
- package/script/src/errors.d.ts +42 -0
- package/script/src/errors.d.ts.map +1 -0
- package/script/src/errors.js +49 -0
- package/script/src/http.d.ts +157 -0
- package/script/src/http.d.ts.map +1 -0
- package/script/src/http.js +321 -0
- package/script/src/namespace.d.ts +59 -0
- package/script/src/namespace.d.ts.map +1 -0
- package/script/src/namespace.js +83 -0
- package/script/src/reactive.d.ts +29 -0
- package/script/src/reactive.d.ts.map +1 -0
- package/script/src/reactive.js +39 -0
- package/script/src/resources/account.d.ts +125 -0
- package/script/src/resources/account.d.ts.map +1 -0
- package/script/src/resources/account.js +158 -0
- package/script/src/resources/api-keys.d.ts +116 -0
- package/script/src/resources/api-keys.d.ts.map +1 -0
- package/script/src/resources/api-keys.js +110 -0
- package/script/src/resources/auth.d.ts +57 -0
- package/script/src/resources/auth.d.ts.map +1 -0
- package/script/src/resources/auth.js +43 -0
- package/script/src/resources/eggs.d.ts +238 -0
- package/script/src/resources/eggs.d.ts.map +1 -0
- package/script/src/resources/eggs.js +193 -0
- package/script/src/resources/hosts.d.ts +62 -0
- package/script/src/resources/hosts.d.ts.map +1 -0
- package/script/src/resources/hosts.js +67 -0
- package/script/src/resources/members.d.ts +138 -0
- package/script/src/resources/members.d.ts.map +1 -0
- package/script/src/resources/members.js +127 -0
- package/script/src/resources/nodes.d.ts +397 -0
- package/script/src/resources/nodes.d.ts.map +1 -0
- package/script/src/resources/nodes.js +362 -0
- package/script/src/resources/server-groups.d.ts +150 -0
- package/script/src/resources/server-groups.d.ts.map +1 -0
- package/script/src/resources/server-groups.js +116 -0
- package/script/src/resources/servers/activity.d.ts +120 -0
- package/script/src/resources/servers/activity.d.ts.map +1 -0
- package/script/src/resources/servers/activity.js +170 -0
- package/script/src/resources/servers/allocations.d.ts +125 -0
- package/script/src/resources/servers/allocations.d.ts.map +1 -0
- package/script/src/resources/servers/allocations.js +142 -0
- package/script/src/resources/servers/connection.d.ts +108 -0
- package/script/src/resources/servers/connection.d.ts.map +1 -0
- package/script/src/resources/servers/connection.js +173 -0
- package/script/src/resources/servers/files.d.ts +164 -0
- package/script/src/resources/servers/files.d.ts.map +1 -0
- package/script/src/resources/servers/files.js +286 -0
- package/script/src/resources/servers/index.d.ts +126 -0
- package/script/src/resources/servers/index.d.ts.map +1 -0
- package/script/src/resources/servers/index.js +139 -0
- package/script/src/resources/servers/profiles.d.ts +138 -0
- package/script/src/resources/servers/profiles.d.ts.map +1 -0
- package/script/src/resources/servers/profiles.js +182 -0
- package/script/src/resources/servers/server.d.ts +136 -0
- package/script/src/resources/servers/server.d.ts.map +1 -0
- package/script/src/resources/servers/server.js +206 -0
- package/script/src/resources/servers/sftp.d.ts +147 -0
- package/script/src/resources/servers/sftp.d.ts.map +1 -0
- package/script/src/resources/servers/sftp.js +158 -0
- package/script/src/resources/servers/types.d.ts +199 -0
- package/script/src/resources/servers/types.d.ts.map +1 -0
- package/script/src/resources/servers/types.js +2 -0
- package/script/src/sse.d.ts +53 -0
- package/script/src/sse.d.ts.map +1 -0
- package/script/src/sse.js +137 -0
- package/script/src/types.d.ts +126 -0
- package/script/src/types.d.ts.map +1 -0
- package/script/src/types.js +25 -0
- package/esm/api.d.ts +0 -76
- package/esm/api.d.ts.map +0 -1
- package/esm/api.js +0 -187
- package/esm/components/auth.d.ts +0 -15
- package/esm/components/auth.d.ts.map +0 -1
- package/esm/components/auth.js +0 -13
- package/esm/components/connection/abstract.d.ts +0 -23
- package/esm/components/connection/abstract.d.ts.map +0 -1
- package/esm/components/connection/abstract.js +0 -43
- package/esm/components/connection/sse.d.ts +0 -20
- package/esm/components/connection/sse.d.ts.map +0 -1
- package/esm/components/connection/sse.js +0 -65
- package/esm/components/egg/egg.d.ts +0 -32
- package/esm/components/egg/egg.d.ts.map +0 -1
- package/esm/components/egg/egg.js +0 -70
- package/esm/components/group.d.ts +0 -14
- package/esm/components/group.d.ts.map +0 -1
- package/esm/components/group.js +0 -33
- package/esm/components/member_2.d.ts +0 -69
- package/esm/components/member_2.d.ts.map +0 -1
- package/esm/components/member_2.js +0 -140
- package/esm/components/node.d.ts +0 -78
- package/esm/components/node.d.ts.map +0 -1
- package/esm/components/node.js +0 -342
- package/esm/components/server/activity.d.ts +0 -45
- package/esm/components/server/activity.d.ts.map +0 -1
- package/esm/components/server/activity.js +0 -158
- package/esm/components/server/allocations.d.ts +0 -45
- package/esm/components/server/allocations.d.ts.map +0 -1
- package/esm/components/server/allocations.js +0 -146
- package/esm/components/server/files.d.ts +0 -50
- package/esm/components/server/files.d.ts.map +0 -1
- package/esm/components/server/files.js +0 -90
- package/esm/components/server/power.d.ts +0 -21
- package/esm/components/server/power.d.ts.map +0 -1
- package/esm/components/server/power.js +0 -43
- package/esm/components/server/profiles.d.ts +0 -63
- package/esm/components/server/profiles.d.ts.map +0 -1
- package/esm/components/server/profiles.js +0 -163
- package/esm/components/server/server.d.ts +0 -141
- package/esm/components/server/server.d.ts.map +0 -1
- package/esm/components/server/server.js +0 -358
- package/esm/components/server/sftp.d.ts +0 -31
- package/esm/components/server/sftp.d.ts.map +0 -1
- package/esm/components/server/sftp.js +0 -84
- package/esm/components/server/startup.d.ts +0 -17
- package/esm/components/server/startup.d.ts.map +0 -1
- package/esm/components/server/startup.js +0 -21
- package/esm/components/server/stats.d.ts +0 -19
- package/esm/components/server/stats.d.ts.map +0 -1
- package/esm/components/server/stats.js +0 -46
- package/esm/utils/cache.d.ts +0 -20
- package/esm/utils/cache.d.ts.map +0 -1
- package/esm/utils/cache.js +0 -66
- package/esm/utils/event.d.ts +0 -38
- package/esm/utils/event.d.ts.map +0 -1
- package/esm/utils/event.js +0 -71
- package/esm/utils/object.d.ts +0 -58
- package/esm/utils/object.d.ts.map +0 -1
- package/esm/utils/object.js +0 -86
- package/esm/utils/subscribe.d.ts +0 -37
- package/esm/utils/subscribe.d.ts.map +0 -1
- package/esm/utils/subscribe.js +0 -29
- package/esm/utils/timer.d.ts +0 -13
- package/esm/utils/timer.d.ts.map +0 -1
- package/esm/utils/timer.js +0 -32
- package/esm/utils/units.d.ts +0 -18
- package/esm/utils/units.d.ts.map +0 -1
- package/esm/utils/units.js +0 -82
- package/script/api.d.ts +0 -76
- package/script/api.d.ts.map +0 -1
- package/script/api.js +0 -192
- package/script/components/auth.d.ts +0 -15
- package/script/components/auth.d.ts.map +0 -1
- package/script/components/auth.js +0 -17
- package/script/components/connection/abstract.d.ts +0 -23
- package/script/components/connection/abstract.d.ts.map +0 -1
- package/script/components/connection/abstract.js +0 -47
- package/script/components/connection/sse.d.ts +0 -20
- package/script/components/connection/sse.d.ts.map +0 -1
- package/script/components/connection/sse.js +0 -69
- package/script/components/egg/egg.d.ts +0 -32
- package/script/components/egg/egg.d.ts.map +0 -1
- package/script/components/egg/egg.js +0 -74
- package/script/components/group.d.ts +0 -14
- package/script/components/group.d.ts.map +0 -1
- package/script/components/group.js +0 -37
- package/script/components/member_2.d.ts +0 -69
- package/script/components/member_2.d.ts.map +0 -1
- package/script/components/member_2.js +0 -146
- package/script/components/node.d.ts +0 -78
- package/script/components/node.d.ts.map +0 -1
- package/script/components/node.js +0 -349
- package/script/components/server/activity.d.ts +0 -45
- package/script/components/server/activity.d.ts.map +0 -1
- package/script/components/server/activity.js +0 -164
- package/script/components/server/allocations.d.ts +0 -45
- package/script/components/server/allocations.d.ts.map +0 -1
- package/script/components/server/allocations.js +0 -152
- package/script/components/server/files.d.ts +0 -50
- package/script/components/server/files.d.ts.map +0 -1
- package/script/components/server/files.js +0 -94
- package/script/components/server/power.d.ts +0 -21
- package/script/components/server/power.d.ts.map +0 -1
- package/script/components/server/power.js +0 -47
- package/script/components/server/profiles.d.ts +0 -63
- package/script/components/server/profiles.d.ts.map +0 -1
- package/script/components/server/profiles.js +0 -168
- package/script/components/server/server.d.ts +0 -141
- package/script/components/server/server.d.ts.map +0 -1
- package/script/components/server/server.js +0 -362
- package/script/components/server/sftp.d.ts +0 -31
- package/script/components/server/sftp.d.ts.map +0 -1
- package/script/components/server/sftp.js +0 -88
- package/script/components/server/startup.d.ts +0 -17
- package/script/components/server/startup.d.ts.map +0 -1
- package/script/components/server/startup.js +0 -25
- package/script/components/server/stats.d.ts +0 -19
- package/script/components/server/stats.d.ts.map +0 -1
- package/script/components/server/stats.js +0 -50
- package/script/utils/cache.d.ts +0 -20
- package/script/utils/cache.d.ts.map +0 -1
- package/script/utils/cache.js +0 -70
- package/script/utils/event.d.ts +0 -38
- package/script/utils/event.d.ts.map +0 -1
- package/script/utils/event.js +0 -75
- package/script/utils/object.d.ts +0 -58
- package/script/utils/object.d.ts.map +0 -1
- package/script/utils/object.js +0 -90
- package/script/utils/subscribe.d.ts +0 -37
- package/script/utils/subscribe.d.ts.map +0 -1
- package/script/utils/subscribe.js +0 -32
- package/script/utils/timer.d.ts +0 -13
- package/script/utils/timer.d.ts.map +0 -1
- package/script/utils/timer.js +0 -36
- package/script/utils/units.d.ts +0 -18
- package/script/utils/units.d.ts.map +0 -1
- package/script/utils/units.js +0 -86
package/esm/api.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { AuthApi } from './components/auth.js';
|
|
2
|
-
import { ServerGroup } from './components/group.js';
|
|
3
|
-
import { Member } from './components/member_2.js';
|
|
4
|
-
import { Node } from './components/node.js';
|
|
5
|
-
import { Server } from './components/server/server.js';
|
|
6
|
-
import { EventManager } from './utils/event.js';
|
|
7
|
-
export class ApiError extends Error {
|
|
8
|
-
constructor(response, error) {
|
|
9
|
-
super(`${response.status}: ${error}`);
|
|
10
|
-
Object.defineProperty(this, "error", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: error
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "status", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
this.status = response.status;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export class MeowPanelApi {
|
|
26
|
-
static isPlainJson(value) {
|
|
27
|
-
return typeof value === 'object' && value !== null &&
|
|
28
|
-
value.constructor === Object;
|
|
29
|
-
}
|
|
30
|
-
on(event, func) {
|
|
31
|
-
return this.eventManager.on(event, func);
|
|
32
|
-
}
|
|
33
|
-
off(event, func) {
|
|
34
|
-
return this.eventManager.off(event, func);
|
|
35
|
-
}
|
|
36
|
-
async requestUrl(method, url, data = {}) {
|
|
37
|
-
const headers = {};
|
|
38
|
-
if (this.token) {
|
|
39
|
-
headers.Authorization = `Bearer ${this.token}`;
|
|
40
|
-
}
|
|
41
|
-
const requestUrl = new URL(url.toString());
|
|
42
|
-
if (data.params) {
|
|
43
|
-
for (const [key, value] of Object.entries(data.params)) {
|
|
44
|
-
if (value !== undefined) {
|
|
45
|
-
requestUrl.searchParams.set(key, value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const response = await this.fetch(requestUrl, {
|
|
50
|
-
body: MeowPanelApi.isPlainJson(data.body) ? JSON.stringify(data.body) : data.body,
|
|
51
|
-
credentials: 'include',
|
|
52
|
-
headers,
|
|
53
|
-
method,
|
|
54
|
-
});
|
|
55
|
-
if (!response.ok) {
|
|
56
|
-
let message;
|
|
57
|
-
try {
|
|
58
|
-
const json = await response.json();
|
|
59
|
-
message = json.error;
|
|
60
|
-
}
|
|
61
|
-
catch (_) {
|
|
62
|
-
console.warn('Failed to parse error response');
|
|
63
|
-
message = 'Unknown error';
|
|
64
|
-
}
|
|
65
|
-
const error = new ApiError(response, message);
|
|
66
|
-
this.eventManager.dispatch('error', error);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
return response;
|
|
70
|
-
}
|
|
71
|
-
async request(method, endpoint, init = {}) {
|
|
72
|
-
const url = new URL(this.url.toString());
|
|
73
|
-
url.pathname = `${url.pathname}/${endpoint}`.replace(/\/+/g, '/');
|
|
74
|
-
if (init.params) {
|
|
75
|
-
Object.entries(init.params).forEach(([key, value]) => value !== undefined && url.searchParams.set(key, value));
|
|
76
|
-
}
|
|
77
|
-
init.pagination &&
|
|
78
|
-
url.searchParams.set('page', `${init.pagination.page}`);
|
|
79
|
-
init.pagination?.perPage &&
|
|
80
|
-
url.searchParams.set('perPage', `${init.pagination.perPage}`);
|
|
81
|
-
const response = await this.requestUrl(method, url.toString(), init);
|
|
82
|
-
if (response.status === 204)
|
|
83
|
-
return {};
|
|
84
|
-
const json = await response.json();
|
|
85
|
-
let page = undefined;
|
|
86
|
-
if (init.pagination) {
|
|
87
|
-
const contentRange = response.headers.get('content-range');
|
|
88
|
-
if (!contentRange) {
|
|
89
|
-
throw new Error('Expected content-range header not found');
|
|
90
|
-
}
|
|
91
|
-
const [range, total] = contentRange.split('/') ??
|
|
92
|
-
['items 0-0', '0'];
|
|
93
|
-
const [from, to] = range.split(' ')[1].split('-').map(Number);
|
|
94
|
-
page = { total: Number(total), from, to };
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
page,
|
|
98
|
-
data: json,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
constructor(options) {
|
|
102
|
-
Object.defineProperty(this, "url", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
configurable: true,
|
|
105
|
-
writable: true,
|
|
106
|
-
value: void 0
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(this, "token", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
writable: true,
|
|
112
|
-
value: void 0
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(this, "fetch", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true,
|
|
117
|
-
writable: true,
|
|
118
|
-
value: void 0
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(this, "eventManager", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
configurable: true,
|
|
123
|
-
writable: true,
|
|
124
|
-
value: new EventManager()
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(this, "members", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
configurable: true,
|
|
129
|
-
writable: true,
|
|
130
|
-
value: {
|
|
131
|
-
list: (pagination) => Member.list(this, pagination),
|
|
132
|
-
get: (id) => Member.get(this, id),
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
Object.defineProperty(this, "getNode", {
|
|
136
|
-
enumerable: true,
|
|
137
|
-
configurable: true,
|
|
138
|
-
writable: true,
|
|
139
|
-
value: (id, include) => Node.get(this, id, include)
|
|
140
|
-
});
|
|
141
|
-
Object.defineProperty(this, "getServers", {
|
|
142
|
-
enumerable: true,
|
|
143
|
-
configurable: true,
|
|
144
|
-
writable: true,
|
|
145
|
-
value: (page, include, query) => Server.getPaged(this, page, include, query)
|
|
146
|
-
});
|
|
147
|
-
Object.defineProperty(this, "getServer", {
|
|
148
|
-
enumerable: true,
|
|
149
|
-
configurable: true,
|
|
150
|
-
writable: true,
|
|
151
|
-
value: (id, include) => Server.get(this, id, include)
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(this, "getServerGroups", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
configurable: true,
|
|
156
|
-
writable: true,
|
|
157
|
-
value: (page) => ServerGroup.getPaged(this, page)
|
|
158
|
-
});
|
|
159
|
-
Object.defineProperty(this, "getServerGroup", {
|
|
160
|
-
enumerable: true,
|
|
161
|
-
configurable: true,
|
|
162
|
-
writable: true,
|
|
163
|
-
value: (id) => ServerGroup.get(this, id)
|
|
164
|
-
});
|
|
165
|
-
Object.defineProperty(this, "auth", {
|
|
166
|
-
enumerable: true,
|
|
167
|
-
configurable: true,
|
|
168
|
-
writable: true,
|
|
169
|
-
value: new AuthApi(this)
|
|
170
|
-
});
|
|
171
|
-
this.url = options.url;
|
|
172
|
-
this.token = options.token;
|
|
173
|
-
this.fetch = options.fetch ?? fetch;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Fetches the current logged in account
|
|
177
|
-
*/
|
|
178
|
-
// TODO: update to accept API key response
|
|
179
|
-
async me(include) {
|
|
180
|
-
const response = await this.request('GET', '/v1/account', {
|
|
181
|
-
params: {
|
|
182
|
-
include: include?.join(','),
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
return new Member(this, response.data);
|
|
186
|
-
}
|
|
187
|
-
}
|
package/esm/components/auth.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/components/auth.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;aAIM,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;aAC/B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAClD,SAAgB,WAAW,EAAE,OAAO,CAAC;IAE9B,MAAM,EAAE,MAAM,CAKnB;IAEF,OAAO,CAAC,GAAG;CAGX;AAED,MAAM,WAAW,MAAM;IACtB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { EventManager } from '../../utils/event.js';
|
|
2
|
-
export class ServerConnection {
|
|
3
|
-
constructor(subSystemName, server) {
|
|
4
|
-
Object.defineProperty(this, "subSystemName", {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true,
|
|
8
|
-
value: subSystemName
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(this, "server", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: server
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "eventManager", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: new EventManager()
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(this, "logger", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: {
|
|
27
|
-
debug: (message) => this.log('debug', message),
|
|
28
|
-
info: (message) => this.log('info', message),
|
|
29
|
-
warn: (message) => this.log('warn', message),
|
|
30
|
-
error: (message) => this.log('error', message),
|
|
31
|
-
}
|
|
32
|
-
});
|
|
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
|
-
log(level, message) {
|
|
41
|
-
console[level](`[${this.server.id}/${this.subSystemName}] ${message}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { EventFunction } from '../../utils/event.js';
|
|
2
|
-
import type { Server } from '../server/server.js';
|
|
3
|
-
import { ServerConnection } from './abstract.js';
|
|
4
|
-
import type { NodeServerEvents } from './node';
|
|
5
|
-
export declare class SseServerConnection extends ServerConnection {
|
|
6
|
-
private eventSource;
|
|
7
|
-
constructor(server: Server);
|
|
8
|
-
connect(): Promise<void>;
|
|
9
|
-
disconnect(): void;
|
|
10
|
-
get isConnected(): boolean;
|
|
11
|
-
protected readonly eventSourceListenerTracker: Array<{
|
|
12
|
-
id: number;
|
|
13
|
-
func: EventFunction<NodeServerEvents, keyof NodeServerEvents>;
|
|
14
|
-
wrapper: (message: MessageEvent) => unknown;
|
|
15
|
-
}>;
|
|
16
|
-
protected registerEventToSource<K extends keyof NodeServerEvents>(event: K, id: number, func: (value: NodeServerEvents[K]) => unknown): void;
|
|
17
|
-
on<K extends keyof NodeServerEvents>(event: K, func: EventFunction<NodeServerEvents, K>): number;
|
|
18
|
-
off<K extends keyof NodeServerEvents>(event: K, func: number | EventFunction<NodeServerEvents, K>): boolean;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/components/connection/sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C,qBAAa,mBAAoB,SAAQ,gBAAgB;IACxD,OAAO,CAAC,WAAW,CAA0B;gBAE1B,MAAM,EAAE,MAAM;IAIpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB9B,UAAU,IAAI,IAAI;IAOzB,IAAoB,WAAW,YAG9B;IAED,SAAS,CAAC,QAAQ,CAAC,0BAA0B,EAAE,KAAK,CAAC;QACpD,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,aAAa,CAAC,gBAAgB,EAAE,MAAM,gBAAgB,CAAC,CAAC;QAC9D,OAAO,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC;KAC5C,CAAC,CAAM;IAER,SAAS,CAAC,qBAAqB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAC/D,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,GAC3C,IAAI;IASS,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAClD,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,GACtC,MAAM;IAMO,GAAG,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACnD,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAC/C,OAAO;CAUV"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ServerConnection } from './abstract.js';
|
|
2
|
-
export class SseServerConnection extends ServerConnection {
|
|
3
|
-
constructor(server) {
|
|
4
|
-
super('sse', server);
|
|
5
|
-
Object.defineProperty(this, "eventSource", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: void 0
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "eventSourceListenerTracker", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: []
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
async connect() {
|
|
19
|
-
this.disconnect();
|
|
20
|
-
this.logger.debug('Connecting to SSE');
|
|
21
|
-
const group = await this.server.group.get();
|
|
22
|
-
const node = await group.node.get();
|
|
23
|
-
const { connection } = node; // TODO: use Cache Relation for connection
|
|
24
|
-
if (!connection)
|
|
25
|
-
throw new Error('No permission to connect to server');
|
|
26
|
-
const url = new URL(connection.url);
|
|
27
|
-
url.pathname = `/api/servers/${this.server.id}/sse`;
|
|
28
|
-
this.eventSource = new EventSource(url, { withCredentials: true });
|
|
29
|
-
this.logger.info('Connected to SSE');
|
|
30
|
-
this.eventManager.assignAllEvents((event, id, func) => this.registerEventToSource(event, id, func));
|
|
31
|
-
}
|
|
32
|
-
disconnect() {
|
|
33
|
-
if (!this.eventSource)
|
|
34
|
-
return;
|
|
35
|
-
this.logger.info('Closing SSE connection');
|
|
36
|
-
this.eventSource.close();
|
|
37
|
-
this.eventSource = undefined;
|
|
38
|
-
}
|
|
39
|
-
get isConnected() {
|
|
40
|
-
return !!this.eventSource &&
|
|
41
|
-
this.eventSource.readyState === EventSource.OPEN;
|
|
42
|
-
}
|
|
43
|
-
registerEventToSource(event, id, func) {
|
|
44
|
-
if (!this.eventSource)
|
|
45
|
-
return;
|
|
46
|
-
const wrapper = (message) => func(JSON.parse(message.data));
|
|
47
|
-
this.eventSource.addEventListener(event, wrapper);
|
|
48
|
-
this.eventSourceListenerTracker.push({ id, func, wrapper });
|
|
49
|
-
this.logger.debug(`Registered: ${event}`);
|
|
50
|
-
}
|
|
51
|
-
on(event, func) {
|
|
52
|
-
const id = super.on(event, func);
|
|
53
|
-
this.registerEventToSource(event, id, func);
|
|
54
|
-
return id;
|
|
55
|
-
}
|
|
56
|
-
off(event, func) {
|
|
57
|
-
const i = this.eventSourceListenerTracker.findIndex((v) => v.id === func || v.func === func);
|
|
58
|
-
if (i >= 0) {
|
|
59
|
-
const { wrapper } = this.eventSourceListenerTracker[i];
|
|
60
|
-
this.eventSource?.removeEventListener(event, wrapper);
|
|
61
|
-
this.eventSourceListenerTracker.splice(i, 1);
|
|
62
|
-
}
|
|
63
|
-
return super.off(event, func);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { MeowPanelApi, Page } from '../../api.js';
|
|
2
|
-
import { CachedRelation } from '../../utils/cache.js';
|
|
3
|
-
import { UpdatableObject } from '../../utils/object.js';
|
|
4
|
-
import type { Subscription } from '../../utils/subscribe.js';
|
|
5
|
-
import type { Extended } from '../../utils/types';
|
|
6
|
-
export type EggInclude = 'app_background_url';
|
|
7
|
-
interface Modified {
|
|
8
|
-
app_background_url: CachedRelation<string | null>;
|
|
9
|
-
}
|
|
10
|
-
export declare class Egg extends UpdatableObject<EggResponse, Modified, EggInclude> implements Subscription<Egg> {
|
|
11
|
-
static getPaged(api: MeowPanelApi, page: number, include?: EggInclude[]): Promise<{
|
|
12
|
-
groups: Egg[];
|
|
13
|
-
page: Page;
|
|
14
|
-
}>;
|
|
15
|
-
static get(api: MeowPanelApi, id: string, include?: EggInclude[]): Promise<Egg>;
|
|
16
|
-
constructor(api: MeowPanelApi, data: EggResponse);
|
|
17
|
-
protected applyResponse(oldData: Extended<EggResponse, Modified> | undefined, _newData: EggResponse): Modified;
|
|
18
|
-
subscribe(_fn: (value: Egg) => void): () => void;
|
|
19
|
-
get id(): string;
|
|
20
|
-
get name(): string;
|
|
21
|
-
get description(): string;
|
|
22
|
-
get appBackgroundUrl(): CachedRelation<string | null>;
|
|
23
|
-
get nest(): string;
|
|
24
|
-
get images(): EggDockerImage[];
|
|
25
|
-
get startupCommand(): string;
|
|
26
|
-
get stopCommand(): string;
|
|
27
|
-
get forceOutgoingIp(): boolean;
|
|
28
|
-
get createdAt(): string;
|
|
29
|
-
get updatedAt(): string;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=egg.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"egg.d.ts","sourceRoot":"","sources":["../../../src/components/egg/egg.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAE9C,UAAU,QAAQ;IACjB,kBAAkB,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CA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atableObject } from '../../utils/object.js';
|
|
4
|
-
export class Egg extends UpdatableObject {
|
|
5
|
-
static async getPaged(api, page, include = []) {
|
|
6
|
-
const response = await api.request('GET', `/v1/eggs`, {
|
|
7
|
-
pagination: { page },
|
|
8
|
-
params: { include: include?.join(',') },
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
groups: response.data.map((data) => new Egg(api, data)),
|
|
12
|
-
page: response.page,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
static async get(api, id, include = []) {
|
|
16
|
-
const response = await api.request('GET', `/v1/eggs/${id}`, {
|
|
17
|
-
params: { include: include?.join(',') },
|
|
18
|
-
});
|
|
19
|
-
return new Egg(api, response.data);
|
|
20
|
-
}
|
|
21
|
-
constructor(api, data) {
|
|
22
|
-
super(api, data, `/v1/eggs/${data.id}`);
|
|
23
|
-
}
|
|
24
|
-
applyResponse(oldData, _newData) {
|
|
25
|
-
const response = {
|
|
26
|
-
app_background_url: oldData?.app_background_url ??
|
|
27
|
-
new CachedRelation(async () => {
|
|
28
|
-
const response = await this.fetchSelf(['app_background_url']);
|
|
29
|
-
return response.app_background_url;
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
return response;
|
|
33
|
-
}
|
|
34
|
-
subscribe(_fn) {
|
|
35
|
-
throw new Error('Method not implemented.');
|
|
36
|
-
}
|
|
37
|
-
get id() {
|
|
38
|
-
return this.response.id;
|
|
39
|
-
}
|
|
40
|
-
get name() {
|
|
41
|
-
return this.response.name;
|
|
42
|
-
}
|
|
43
|
-
get description() {
|
|
44
|
-
return this.response.description;
|
|
45
|
-
}
|
|
46
|
-
get appBackgroundUrl() {
|
|
47
|
-
return this.response.app_background_url;
|
|
48
|
-
}
|
|
49
|
-
get nest() {
|
|
50
|
-
return this.response.nest;
|
|
51
|
-
}
|
|
52
|
-
get images() {
|
|
53
|
-
return this.response.images;
|
|
54
|
-
}
|
|
55
|
-
get startupCommand() {
|
|
56
|
-
return this.response.startup_command;
|
|
57
|
-
}
|
|
58
|
-
get stopCommand() {
|
|
59
|
-
return this.response.stop_command;
|
|
60
|
-
}
|
|
61
|
-
get forceOutgoingIp() {
|
|
62
|
-
return this.response.force_outgoing_ip;
|
|
63
|
-
}
|
|
64
|
-
get createdAt() {
|
|
65
|
-
return this.response.created_at;
|
|
66
|
-
}
|
|
67
|
-
get updatedAt() {
|
|
68
|
-
return this.response.updated_at;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { MeowPanelApi, Page } from '../api.js';
|
|
2
|
-
import { CachedRelation } from '../utils/cache.js';
|
|
3
|
-
import { Node } from './node.js';
|
|
4
|
-
export declare class ServerGroup {
|
|
5
|
-
protected readonly api: MeowPanelApi;
|
|
6
|
-
static getPaged(api: MeowPanelApi, page: number): Promise<{
|
|
7
|
-
groups: ServerGroup[];
|
|
8
|
-
page: Page;
|
|
9
|
-
}>;
|
|
10
|
-
static get(api: MeowPanelApi, id: string): Promise<ServerGroup>;
|
|
11
|
-
constructor(api: MeowPanelApi, data: Record<string, never>);
|
|
12
|
-
readonly node: CachedRelation<Node>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/components/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,WAAW;IA0BtB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;WAzBjB,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;WAezF,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;gBAUxD,GAAG,EAAE,YAAY,EACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAM5B,SAAgB,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;CAC3C"}
|
package/esm/components/group.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CachedRelation } from '../utils/cache.js';
|
|
2
|
-
import { Node } from './node.js';
|
|
3
|
-
export class ServerGroup {
|
|
4
|
-
static async getPaged(api, page) {
|
|
5
|
-
const response = await api.request('GET', `/v1/servers/groups`, {
|
|
6
|
-
pagination: { page },
|
|
7
|
-
});
|
|
8
|
-
return {
|
|
9
|
-
groups: response.data.map((data) => new ServerGroup(api, data)),
|
|
10
|
-
page: response.page,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
static async get(api, id) {
|
|
14
|
-
const response = await api.request('GET', `/v1/servers/groups/${id}`);
|
|
15
|
-
return new ServerGroup(api, response.data);
|
|
16
|
-
}
|
|
17
|
-
constructor(api, data) {
|
|
18
|
-
Object.defineProperty(this, "api", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: api
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(this, "node", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
this.node = new CachedRelation(() => Node.get(api, data.node_id, ['connection']));
|
|
31
|
-
this.node.setCache(data.node);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { MeowPanelApi, Page, Pagination } from '../api.js';
|
|
2
|
-
import { CachedRelation } from '../utils/cache.js';
|
|
3
|
-
import { type EventFunction, EventManager, type EventManagerListener } from '../utils/event.js';
|
|
4
|
-
import { UpdatableObject } from '../utils/object.js';
|
|
5
|
-
import type { Extended } from '../utils/types';
|
|
6
|
-
interface AdjustedResponse {
|
|
7
|
-
display: CachedRelation<Display | null>;
|
|
8
|
-
permissions: CachedRelation<PermissionsList>;
|
|
9
|
-
}
|
|
10
|
-
export type MemberInclude = 'display' | 'permissions';
|
|
11
|
-
export declare class Member extends UpdatableObject<MemberResponse, AdjustedResponse, MemberInclude> implements EventManagerListener<MemberEvents> {
|
|
12
|
-
static list(api: MeowPanelApi, pagination: Pagination): Promise<{
|
|
13
|
-
data: Member[];
|
|
14
|
-
page: Page | undefined;
|
|
15
|
-
}>;
|
|
16
|
-
static get(api: MeowPanelApi, id: string): Promise<Member>;
|
|
17
|
-
constructor(api: MeowPanelApi, data: MemberResponse);
|
|
18
|
-
protected applyResponse(oldData: Extended<MemberResponse, AdjustedResponse> | undefined, newData: MemberResponse): AdjustedResponse;
|
|
19
|
-
protected readonly eventManager: EventManager<MemberEvents>;
|
|
20
|
-
on<K extends keyof MemberEvents>(event: K, func: EventFunction<MemberEvents, K>): number;
|
|
21
|
-
off<K extends keyof MemberEvents>(event: K | number, func?: EventFunction<MemberEvents, K> | number): boolean;
|
|
22
|
-
get name(): string;
|
|
23
|
-
update(data: {
|
|
24
|
-
email?: string;
|
|
25
|
-
firstName?: string;
|
|
26
|
-
lastName?: string;
|
|
27
|
-
nickname?: string;
|
|
28
|
-
display?: {
|
|
29
|
-
language?: string | null;
|
|
30
|
-
theme?: string | null;
|
|
31
|
-
};
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
get id(): string;
|
|
34
|
-
get email(): string;
|
|
35
|
-
get firstName(): string;
|
|
36
|
-
get lastName(): string;
|
|
37
|
-
get nickname(): string;
|
|
38
|
-
get avatarUri(): string;
|
|
39
|
-
get createdAt(): Date;
|
|
40
|
-
get updatedAt(): Date;
|
|
41
|
-
get display(): CachedRelation<Display | null>;
|
|
42
|
-
get permissions(): CachedRelation<PermissionsList>;
|
|
43
|
-
}
|
|
44
|
-
interface DisplayResponse {
|
|
45
|
-
language: string | null;
|
|
46
|
-
theme: string | null;
|
|
47
|
-
}
|
|
48
|
-
export declare class Display {
|
|
49
|
-
protected readonly api: MeowPanelApi;
|
|
50
|
-
protected readonly member: Member;
|
|
51
|
-
protected response: DisplayResponse;
|
|
52
|
-
get language(): string | null;
|
|
53
|
-
get theme(): string | null;
|
|
54
|
-
constructor(api: MeowPanelApi, member: Member, response: DisplayResponse);
|
|
55
|
-
update(data: {
|
|
56
|
-
language?: string | null;
|
|
57
|
-
theme?: string | null;
|
|
58
|
-
}): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
export declare class PermissionsList {
|
|
61
|
-
protected readonly permissions: string[];
|
|
62
|
-
constructor(permissions: string[]);
|
|
63
|
-
has(permission: string): boolean;
|
|
64
|
-
}
|
|
65
|
-
interface MemberEvents {
|
|
66
|
-
update: Member;
|
|
67
|
-
}
|
|
68
|
-
export {};
|
|
69
|
-
//# sourceMappingURL=member_2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"member_2.d.ts","sourceRoot":"","sources":["../../src/components/member_2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,UAAU,gBAAgB;IACzB,OAAO,EAAE,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACxC,WAAW,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;CAC7C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