pterodactyl-api-client 3.4.0 → 3.4.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 +13 -13
- package/dist/application/application.client.d.ts +12 -12
- package/dist/application/application.client.js +11 -11
- package/dist/application/index.d.ts +2 -2
- package/dist/application/index.js +2 -2
- package/dist/application/location/index.d.ts +3 -3
- package/dist/application/location/index.js +3 -3
- package/dist/application/location/location.client.d.ts +2 -2
- package/dist/application/location/location.client.js +5 -5
- package/dist/application/location/location.schemas.d.ts +1 -1
- package/dist/application/location/location.schemas.js +4 -4
- package/dist/application/location/location.types.d.ts +2 -2
- package/dist/application/locations/index.d.ts +3 -3
- package/dist/application/locations/index.js +3 -3
- package/dist/application/locations/locations.client.d.ts +3 -3
- package/dist/application/locations/locations.client.js +5 -5
- package/dist/application/locations/locations.schemas.d.ts +1 -1
- package/dist/application/locations/locations.schemas.js +1 -1
- package/dist/application/locations/locations.types.d.ts +2 -2
- package/dist/application/nest/egg/egg.client.d.ts +1 -1
- package/dist/application/nest/egg/egg.client.js +2 -2
- package/dist/application/nest/egg/egg.types.d.ts +1 -1
- package/dist/application/nest/eggs/eggs.client.d.ts +1 -1
- package/dist/application/nest/eggs/eggs.client.d.ts.map +1 -1
- package/dist/application/nest/eggs/eggs.client.js +1 -1
- package/dist/application/nest/eggs/eggs.types.d.ts +2 -2
- package/dist/application/nest/index.d.ts +6 -6
- package/dist/application/nest/index.js +6 -6
- package/dist/application/nest/nest.client.d.ts +3 -3
- package/dist/application/nest/nest.client.js +4 -4
- package/dist/application/nest/nest.schemas.js +1 -1
- package/dist/application/nest/nest.types.d.ts +1 -1
- package/dist/application/nest/nest.types.d.ts.map +1 -1
- package/dist/application/nests/index.d.ts +2 -2
- package/dist/application/nests/index.js +2 -2
- package/dist/application/nests/nests.client.d.ts +1 -1
- package/dist/application/nests/nests.client.js +1 -1
- package/dist/application/nests/nests.types.d.ts +2 -2
- package/dist/application/node/allocation/allocation.client.d.ts +1 -1
- package/dist/application/node/allocation/allocation.client.js +2 -2
- package/dist/application/node/allocations/allocations.client.d.ts +3 -3
- package/dist/application/node/allocations/allocations.client.js +4 -4
- package/dist/application/node/allocations/allocations.types.d.ts +2 -2
- package/dist/application/node/index.d.ts +6 -6
- package/dist/application/node/index.js +6 -6
- package/dist/application/node/node.client.d.ts +5 -5
- package/dist/application/node/node.client.js +9 -9
- package/dist/application/node/node.schemas.d.ts +1 -1
- package/dist/application/node/node.schemas.js +2 -2
- package/dist/application/node/node.types.d.ts +1 -1
- package/dist/application/nodes/index.d.ts +3 -3
- package/dist/application/nodes/index.js +3 -3
- package/dist/application/nodes/nodes.client.d.ts +3 -3
- package/dist/application/nodes/nodes.client.js +5 -5
- package/dist/application/nodes/nodes.schemas.d.ts +1 -1
- package/dist/application/nodes/nodes.schemas.js +3 -3
- package/dist/application/nodes/nodes.types.d.ts +3 -3
- package/dist/application/nodes/nodes.types.d.ts.map +1 -1
- package/dist/application/server/database/database.client.d.ts +2 -2
- package/dist/application/server/database/database.client.js +4 -4
- package/dist/application/server/database/database.types.d.ts +3 -3
- package/dist/application/server/database/password/password.client.d.ts +1 -1
- package/dist/application/server/database/password/password.client.js +1 -1
- package/dist/application/server/databases/databases.client.d.ts +2 -2
- package/dist/application/server/databases/databases.client.js +4 -4
- package/dist/application/server/databases/databases.types.d.ts +4 -4
- package/dist/application/server/index.d.ts +8 -8
- package/dist/application/server/index.js +8 -8
- package/dist/application/server/server.client.d.ts +4 -4
- package/dist/application/server/server.client.js +13 -13
- package/dist/application/server/server.schemas.d.ts +1 -1
- package/dist/application/server/server.schemas.js +2 -2
- package/dist/application/server/server.types.d.ts +1 -1
- package/dist/application/servers/index.d.ts +3 -3
- package/dist/application/servers/index.js +3 -3
- package/dist/application/servers/servers.client.d.ts +3 -3
- package/dist/application/servers/servers.client.js +5 -5
- package/dist/application/servers/servers.schemas.d.ts +1 -1
- package/dist/application/servers/servers.schemas.js +2 -2
- package/dist/application/servers/servers.types.d.ts +4 -4
- package/dist/application/user/index.d.ts +3 -3
- package/dist/application/user/index.js +3 -3
- package/dist/application/user/user.client.d.ts +3 -3
- package/dist/application/user/user.client.js +6 -6
- package/dist/application/user/user.schemas.d.ts +1 -1
- package/dist/application/user/user.schemas.js +2 -2
- package/dist/application/users/index.d.ts +3 -3
- package/dist/application/users/index.js +3 -3
- package/dist/application/users/users.client.d.ts +3 -3
- package/dist/application/users/users.client.d.ts.map +1 -1
- package/dist/application/users/users.client.js +5 -5
- package/dist/application/users/users.schemas.d.ts +1 -1
- package/dist/application/users/users.schemas.js +1 -1
- package/dist/application/users/users.types.d.ts +5 -5
- package/dist/class/HttpClient.d.ts +2 -2
- package/dist/class/HttpClient.js +3 -3
- package/dist/class.d.ts +4 -4
- package/dist/class.js +6 -6
- package/dist/client/account/a2f/a2f.client.d.ts +3 -3
- package/dist/client/account/a2f/a2f.client.js +5 -5
- package/dist/client/account/a2f/a2f.types.d.ts +3 -3
- package/dist/client/account/account.client.d.ts +8 -8
- package/dist/client/account/account.client.js +8 -8
- package/dist/client/account/account.schemas.d.ts +1 -1
- package/dist/client/account/account.schemas.js +13 -13
- package/dist/client/account/account.types.d.ts +2 -2
- package/dist/client/account/activity/activity.client.d.ts +5 -5
- package/dist/client/account/activity/activity.client.d.ts.map +1 -1
- package/dist/client/account/activity/activity.client.js +3 -3
- package/dist/client/account/activity/activity.types.d.ts +8 -8
- package/dist/client/account/api-key/api-key.client.d.ts +2 -2
- package/dist/client/account/api-key/api-key.client.js +4 -4
- package/dist/client/account/api-key/api-key.types.d.ts +2 -2
- package/dist/client/account/email/email.client.d.ts +2 -2
- package/dist/client/account/email/email.client.js +2 -2
- package/dist/client/account/email/email.types.d.ts +1 -1
- package/dist/client/account/index.d.ts +15 -15
- package/dist/client/account/index.js +15 -15
- package/dist/client/account/password/password.client.d.ts +2 -2
- package/dist/client/account/password/password.client.js +2 -2
- package/dist/client/account/password/password.types.d.ts +1 -1
- package/dist/client/account/ssh-key/ssh-key.client.d.ts +2 -2
- package/dist/client/account/ssh-key/ssh-key.client.js +4 -4
- package/dist/client/account/ssh-key/ssh-key.types.d.ts +2 -2
- package/dist/client/client.class.d.ts +3 -3
- package/dist/client/client.class.js +6 -6
- package/dist/client/client.schema.d.ts +1 -1
- package/dist/client/client.schema.js +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/server/allocation/allocation.client.d.ts +3 -3
- package/dist/client/server/allocation/allocation.client.js +4 -4
- package/dist/client/server/allocation.types.d.ts +2 -2
- package/dist/client/server/allocations/allocations.client.d.ts +3 -3
- package/dist/client/server/allocations/allocations.client.js +3 -3
- package/dist/client/server/backup/backup.client.d.ts +3 -3
- package/dist/client/server/backup/backup.client.js +6 -6
- package/dist/client/server/backup/lock/lock.client.d.ts +1 -1
- package/dist/client/server/backup/lock/lock.client.js +1 -1
- package/dist/client/server/backup.types.d.ts +3 -3
- package/dist/client/server/backups/backups.client.d.ts +2 -2
- package/dist/client/server/backups/backups.client.js +3 -3
- package/dist/client/server/console/console.client.d.ts +3 -3
- package/dist/client/server/console/console.client.js +3 -3
- package/dist/client/server/console/console.types.d.ts +2 -2
- package/dist/client/server/console/console.types.js +1 -1
- package/dist/client/server/console/websocket/websocket.console.client.d.ts +3 -3
- package/dist/client/server/console/websocket/websocket.console.client.js +13 -13
- package/dist/client/server/console/websocket/websocket.console.types.d.ts +13 -13
- package/dist/client/server/database/database.client.d.ts +2 -2
- package/dist/client/server/database/database.client.js +3 -3
- package/dist/client/server/database/password/password.client.d.ts +1 -1
- package/dist/client/server/database/password/password.client.js +1 -1
- package/dist/client/server/database.types.d.ts +6 -6
- package/dist/client/server/databases/databases.client.d.ts +2 -2
- package/dist/client/server/databases/databases.client.js +3 -3
- package/dist/client/server/image/image.client.d.ts +2 -2
- package/dist/client/server/image/image.client.js +2 -2
- package/dist/client/server/image/image.types.d.ts +1 -1
- package/dist/client/server/index.d.ts +29 -29
- package/dist/client/server/index.js +29 -29
- package/dist/client/server/power/power.client.d.ts +1 -1
- package/dist/client/server/power/power.client.js +8 -8
- package/dist/client/server/power/power.types.d.ts +2 -2
- package/dist/client/server/ressource/ressource.client.d.ts +2 -2
- package/dist/client/server/ressource/ressource.client.js +1 -1
- package/dist/client/server/ressource/ressource.types.d.ts +2 -2
- package/dist/client/server/schedule/schedule.client.d.ts +4 -4
- package/dist/client/server/schedule/schedule.client.js +7 -7
- package/dist/client/server/schedule/schedule.types.d.ts +6 -6
- package/dist/client/server/schedule/schedule.types.d.ts.map +1 -1
- package/dist/client/server/schedule/task/task.client.d.ts +3 -3
- package/dist/client/server/schedule/task/task.client.js +3 -3
- package/dist/client/server/schedule/tasks/tasks.client.d.ts +3 -3
- package/dist/client/server/schedule/tasks/tasks.client.js +3 -3
- package/dist/client/server/schedule/tasks.types.d.ts +3 -3
- package/dist/client/server/schedule.types.d.ts +6 -6
- package/dist/client/server/schedules/schedules.client.d.ts +2 -2
- package/dist/client/server/schedules/schedules.client.js +3 -3
- package/dist/client/server/server.client.d.ts +18 -18
- package/dist/client/server/server.client.js +22 -22
- package/dist/client/server/server.schemas.d.ts +1 -1
- package/dist/client/server/server.schemas.js +83 -83
- package/dist/client/server/server.types.d.ts +73 -73
- package/dist/client/server/startup/startup.client.d.ts +3 -3
- package/dist/client/server/startup/startup.client.js +3 -3
- package/dist/client/server/startup/startup.types.d.ts +2 -2
- package/dist/client/server/subuser/subuser.client.d.ts +4 -4
- package/dist/client/server/subuser/subuser.client.js +4 -4
- package/dist/client/server/subuser.types.d.ts +4 -4
- package/dist/client/server/subusers/subusers.client.d.ts +4 -4
- package/dist/client/server/subusers/subusers.client.js +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +4 -4
- package/dist/types.d.ts +5 -5
- package/dist/utils/buildQueryParams.d.ts +1 -1
- package/dist/utils/buildQueryParams.js +3 -3
- package/package.json +5 -2
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import HttpClient from
|
|
2
|
-
import buildQueryParams from
|
|
3
|
-
import AllocationClient from
|
|
4
|
-
import AllocationsClient from
|
|
5
|
-
import BackupClient from
|
|
6
|
-
import BackupsClient from
|
|
7
|
-
import ConsoleClient from
|
|
8
|
-
import DatabaseClient from
|
|
9
|
-
import DatabasesClient from
|
|
10
|
-
import ImageClient from
|
|
11
|
-
import PowerClient from
|
|
12
|
-
import RessourceClient from
|
|
13
|
-
import ScheduleClient from
|
|
14
|
-
import SchedulesClient from
|
|
15
|
-
import { renameServerSchema, userServerActivityEvent, userServerId, } from
|
|
16
|
-
import StartupClient from
|
|
17
|
-
import SubuserClient from
|
|
18
|
-
import SubusersClient from
|
|
1
|
+
import HttpClient from '../../class/HttpClient.js';
|
|
2
|
+
import buildQueryParams from '../../utils/buildQueryParams.js';
|
|
3
|
+
import AllocationClient from './allocation/allocation.client.js';
|
|
4
|
+
import AllocationsClient from './allocations/allocations.client.js';
|
|
5
|
+
import BackupClient from './backup/backup.client.js';
|
|
6
|
+
import BackupsClient from './backups/backups.client.js';
|
|
7
|
+
import ConsoleClient from './console/console.client.js';
|
|
8
|
+
import DatabaseClient from './database/database.client.js';
|
|
9
|
+
import DatabasesClient from './databases/databases.client.js';
|
|
10
|
+
import ImageClient from './image/image.client.js';
|
|
11
|
+
import PowerClient from './power/power.client.js';
|
|
12
|
+
import RessourceClient from './ressource/ressource.client.js';
|
|
13
|
+
import ScheduleClient from './schedule/schedule.client.js';
|
|
14
|
+
import SchedulesClient from './schedules/schedules.client.js';
|
|
15
|
+
import { renameServerSchema, userServerActivityEvent, userServerId, } from './server.schemas.js';
|
|
16
|
+
import StartupClient from './startup/startup.client.js';
|
|
17
|
+
import SubuserClient from './subuser/subuser.client.js';
|
|
18
|
+
import SubusersClient from './subusers/subusers.client.js';
|
|
19
19
|
export default class Servers {
|
|
20
20
|
httpClient;
|
|
21
21
|
panelUrl;
|
|
@@ -53,7 +53,7 @@ export default class Servers {
|
|
|
53
53
|
filter: { event },
|
|
54
54
|
sort,
|
|
55
55
|
});
|
|
56
|
-
const res = await this.httpClient.request(
|
|
56
|
+
const res = await this.httpClient.request('GET', `/client/servers/${this.id}/activity?${queries}`);
|
|
57
57
|
return {
|
|
58
58
|
...res,
|
|
59
59
|
data: res.data.map((data) => ({
|
|
@@ -81,12 +81,12 @@ export default class Servers {
|
|
|
81
81
|
return new SubuserClient(this.httpClient, this.id, subuser);
|
|
82
82
|
}
|
|
83
83
|
info() {
|
|
84
|
-
return this.httpClient.request(
|
|
84
|
+
return this.httpClient.request('GET', `/client/servers/${this.id}`);
|
|
85
85
|
}
|
|
86
86
|
edit(options) {
|
|
87
|
-
return this.httpClient.request(
|
|
87
|
+
return this.httpClient.request('POST', `/client/servers/${this.id}/settings/rename`, renameServerSchema.parse(options));
|
|
88
88
|
}
|
|
89
89
|
reinstall() {
|
|
90
|
-
return this.httpClient.request(
|
|
90
|
+
return this.httpClient.request('POST', `/client/servers/${this.id}/settings/reinstall`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import z from
|
|
2
|
-
import { uuidSchema } from
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { uuidSchema } from '../../schemas.js';
|
|
3
3
|
export const userServerId = z.union([z.string().length(8), uuidSchema]);
|
|
4
4
|
export const userServerSubuserId = uuidSchema;
|
|
5
5
|
export const userServerDatabaseId = z.string().length(8);
|
|
@@ -8,46 +8,46 @@ export const userServerBackupId = uuidSchema;
|
|
|
8
8
|
export const userServerScheduleId = z.int().positive();
|
|
9
9
|
export const userServerScheduleTaskId = z.int().positive();
|
|
10
10
|
export const allocationId = z.coerce.number();
|
|
11
|
-
export const state = z.literal([
|
|
11
|
+
export const state = z.literal(['running', 'starting', 'stopping', 'offline']);
|
|
12
12
|
export const cronString = z.string().regex(/^(?:\*|\d+|\*\/\d+)$/);
|
|
13
13
|
export const userServerActivityEvent = z.literal([
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
14
|
+
'server:control.console',
|
|
15
|
+
'server:control.start',
|
|
16
|
+
'server:control.stop',
|
|
17
|
+
'server:control.restart',
|
|
18
|
+
'server:control.kill',
|
|
19
|
+
'server:file.create',
|
|
20
|
+
'server:file.read',
|
|
21
|
+
'server:file.update',
|
|
22
|
+
'server:file.delete',
|
|
23
|
+
'server:file.archive',
|
|
24
|
+
'server:file.sftp',
|
|
25
|
+
'server:backup.create',
|
|
26
|
+
'server:backup.read',
|
|
27
|
+
'server:backup.delete',
|
|
28
|
+
'server:backup.download',
|
|
29
|
+
'server:backup.restore',
|
|
30
|
+
'server:allocation.read',
|
|
31
|
+
'server:allocation.create',
|
|
32
|
+
'server:allocation.update',
|
|
33
|
+
'server:allocation.delete',
|
|
34
|
+
'server:database.read',
|
|
35
|
+
'server:database.create',
|
|
36
|
+
'server:database.update',
|
|
37
|
+
'server:schedule.read',
|
|
38
|
+
'server:schedule.create',
|
|
39
|
+
'server:schedule.update',
|
|
40
|
+
'server:schedule.delete',
|
|
41
|
+
'server:database.delete',
|
|
42
|
+
'server:user.read',
|
|
43
|
+
'server:user.create',
|
|
44
|
+
'server:user.update',
|
|
45
|
+
'server:user.delete',
|
|
46
|
+
'server:startup.read',
|
|
47
|
+
'server:startup.update',
|
|
48
|
+
'server:admin.websocket.errors',
|
|
49
|
+
'server:admin.websocket.install',
|
|
50
|
+
'server:admin.websocket.transfer',
|
|
51
51
|
]);
|
|
52
52
|
export const assignAllocationSchema = z.object({
|
|
53
53
|
ip: z.ipv4(),
|
|
@@ -107,68 +107,68 @@ export const createScheduleSchema = z.object({
|
|
|
107
107
|
is_active: z.boolean().optional(),
|
|
108
108
|
only_when_online: z.boolean().optional(),
|
|
109
109
|
});
|
|
110
|
-
export const createTaskSchema = z.discriminatedUnion(
|
|
110
|
+
export const createTaskSchema = z.discriminatedUnion('action', [
|
|
111
111
|
z.object({
|
|
112
|
-
action: z.literal(
|
|
112
|
+
action: z.literal('command'),
|
|
113
113
|
payload: z.string(),
|
|
114
114
|
time_offset: z.int().min(0).max(900),
|
|
115
115
|
continue_on_failure: z.boolean().optional(),
|
|
116
116
|
}),
|
|
117
117
|
z.object({
|
|
118
|
-
action: z.literal(
|
|
119
|
-
payload: z.literal([
|
|
118
|
+
action: z.literal('power'),
|
|
119
|
+
payload: z.literal(['start', 'stop', 'restart', 'kill']),
|
|
120
120
|
time_offset: z.int().min(0).max(900),
|
|
121
121
|
continue_on_failure: z.boolean().optional(),
|
|
122
122
|
}),
|
|
123
123
|
z.object({
|
|
124
|
-
action: z.literal(
|
|
124
|
+
action: z.literal('backup'),
|
|
125
125
|
payload: z.string().optional(),
|
|
126
126
|
time_offset: z.int().min(0).max(900),
|
|
127
127
|
continue_on_failure: z.boolean().optional(),
|
|
128
128
|
}),
|
|
129
129
|
]);
|
|
130
130
|
export const serverPermissionSchema = z.literal([
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
131
|
+
'control.console',
|
|
132
|
+
'control.start',
|
|
133
|
+
'control.stop',
|
|
134
|
+
'control.restart',
|
|
135
|
+
'control.kill',
|
|
136
|
+
'file.create',
|
|
137
|
+
'file.read',
|
|
138
|
+
'file.update',
|
|
139
|
+
'file.delete',
|
|
140
|
+
'file.archive',
|
|
141
|
+
'file.sftp',
|
|
142
|
+
'backup.create',
|
|
143
|
+
'backup.read',
|
|
144
|
+
'backup.delete',
|
|
145
|
+
'backup.download',
|
|
146
|
+
'backup.restore',
|
|
147
|
+
'allocation.read',
|
|
148
|
+
'allocation.create',
|
|
149
|
+
'allocation.update',
|
|
150
|
+
'allocation.delete',
|
|
151
|
+
'database.read',
|
|
152
|
+
'database.create',
|
|
153
|
+
'database.update',
|
|
154
|
+
'database.delete',
|
|
155
|
+
'schedule.read',
|
|
156
|
+
'schedule.create',
|
|
157
|
+
'schedule.update',
|
|
158
|
+
'schedule.delete',
|
|
159
|
+
'user.read',
|
|
160
|
+
'user.create',
|
|
161
|
+
'user.update',
|
|
162
|
+
'user.delete',
|
|
163
|
+
'startup.read',
|
|
164
|
+
'startup.update',
|
|
165
|
+
'admin.websocket.errors',
|
|
166
|
+
'admin.websocket.install',
|
|
167
|
+
'admin.websocket.transfer',
|
|
168
168
|
]);
|
|
169
169
|
export const subuserPermissionSchema = z.union([
|
|
170
170
|
serverPermissionSchema,
|
|
171
|
-
z.literal(
|
|
171
|
+
z.literal('*'),
|
|
172
172
|
]);
|
|
173
173
|
export const createSubuserSchema = z.object({
|
|
174
174
|
email: z.string().email().min(1).max(191),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { BaseArgs, IP, ListwithPagination, Tuple } from
|
|
2
|
-
import type { AllocationList } from
|
|
3
|
-
import type { EggVariableList } from
|
|
4
|
-
export type ServerPermissions = ServerControlPermissions | FileManagementPermissions | BackupPermissions | NetworkAllocationPermissions | DatabsePermissions | SchedulePermissions | UserManagementPermissions | StartupPermissions | AdminPermissions |
|
|
5
|
-
export type ServerControlPermissions =
|
|
6
|
-
export type FileManagementPermissions =
|
|
7
|
-
export type BackupPermissions =
|
|
8
|
-
export type NetworkAllocationPermissions =
|
|
9
|
-
export type DatabsePermissions =
|
|
10
|
-
export type SchedulePermissions =
|
|
11
|
-
export type UserManagementPermissions =
|
|
12
|
-
export type StartupPermissions =
|
|
13
|
-
export type AdminPermissions =
|
|
1
|
+
import type { BaseArgs, IP, ListwithPagination, Tuple } from '../../types.js';
|
|
2
|
+
import type { AllocationList } from './allocation.types.js';
|
|
3
|
+
import type { EggVariableList } from './startup/startup.types.js';
|
|
4
|
+
export type ServerPermissions = ServerControlPermissions | FileManagementPermissions | BackupPermissions | NetworkAllocationPermissions | DatabsePermissions | SchedulePermissions | UserManagementPermissions | StartupPermissions | AdminPermissions | '*';
|
|
5
|
+
export type ServerControlPermissions = 'control.console' | 'control.start' | 'control.stop' | 'control.restart' | 'control.kill';
|
|
6
|
+
export type FileManagementPermissions = 'file.create' | 'file.read' | 'file.update' | 'file.delete' | 'file.archive' | 'file.sftp';
|
|
7
|
+
export type BackupPermissions = 'backup.create' | 'backup.read' | 'backup.delete' | 'backup.download' | 'backup.restore';
|
|
8
|
+
export type NetworkAllocationPermissions = 'allocation.read' | 'allocation.create' | 'allocation.update' | 'allocation.delete';
|
|
9
|
+
export type DatabsePermissions = 'database.read' | 'database.create' | 'database.update' | 'database.delete';
|
|
10
|
+
export type SchedulePermissions = 'schedule.read' | 'schedule.create' | 'schedule.update' | 'schedule.delete';
|
|
11
|
+
export type UserManagementPermissions = 'user.read' | 'user.create' | 'user.update' | 'user.delete';
|
|
12
|
+
export type StartupPermissions = 'startup.read' | 'startup.update';
|
|
13
|
+
export type AdminPermissions = 'admin.websocket.errors' | 'admin.websocket.install' | 'admin.websocket.transfer';
|
|
14
14
|
export interface Allocation {
|
|
15
|
-
object:
|
|
15
|
+
object: 'allocation';
|
|
16
16
|
attributes: {
|
|
17
17
|
id: number;
|
|
18
18
|
ip: IP;
|
|
@@ -23,7 +23,7 @@ export interface Allocation {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
export interface EggVariable {
|
|
26
|
-
object:
|
|
26
|
+
object: 'egg_variable';
|
|
27
27
|
attributes: {
|
|
28
28
|
name: string;
|
|
29
29
|
description: string;
|
|
@@ -35,7 +35,7 @@ export interface EggVariable {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
export interface BaseUserServer {
|
|
38
|
-
object:
|
|
38
|
+
object: 'server';
|
|
39
39
|
attributes: {
|
|
40
40
|
server_owner: boolean;
|
|
41
41
|
identifier: string;
|
|
@@ -82,13 +82,13 @@ export type UserServer = BaseUserServer & ({
|
|
|
82
82
|
};
|
|
83
83
|
} | {
|
|
84
84
|
attributes: {
|
|
85
|
-
status:
|
|
85
|
+
status: 'installing';
|
|
86
86
|
is_installing: true;
|
|
87
87
|
is_suspended: false;
|
|
88
88
|
};
|
|
89
89
|
} | {
|
|
90
90
|
attributes: {
|
|
91
|
-
status:
|
|
91
|
+
status: 'suspended';
|
|
92
92
|
is_installing: false;
|
|
93
93
|
is_suspended: true;
|
|
94
94
|
};
|
|
@@ -102,24 +102,24 @@ export type UserServerWithDetails = UserServer & {
|
|
|
102
102
|
export interface UserServerList extends ListwithPagination {
|
|
103
103
|
data: UserServer[];
|
|
104
104
|
}
|
|
105
|
-
export type State =
|
|
106
|
-
export type Signal =
|
|
105
|
+
export type State = 'running' | 'starting' | 'stopping' | 'offline';
|
|
106
|
+
export type Signal = 'start' | 'stop' | 'restart' | 'kill';
|
|
107
107
|
export interface EditServerArgs extends BaseArgs {
|
|
108
108
|
name: string;
|
|
109
109
|
description?: string | undefined;
|
|
110
110
|
}
|
|
111
|
-
export type TaskAction =
|
|
112
|
-
export type ServerFileEvent =
|
|
113
|
-
export type ServerConsoleEvent =
|
|
114
|
-
export type ServerSettingsEvent =
|
|
115
|
-
export type ServerReinstallEvent =
|
|
116
|
-
export type ServerStartupEvent =
|
|
117
|
-
export type ServerDatabaseEvent =
|
|
118
|
-
export type ServerScheduleEvent =
|
|
119
|
-
export type ServerSubuserEvent =
|
|
120
|
-
export type ServerAllocationEvent =
|
|
121
|
-
export type ServerTaskEvent =
|
|
122
|
-
export type ServerBackupEvent =
|
|
111
|
+
export type TaskAction = 'command' | 'power' | 'backup';
|
|
112
|
+
export type ServerFileEvent = 'server:file.read' | 'server:file.download' | 'server:file.write' | 'server:file.copy' | 'server:file.rename' | 'server:file.compress' | 'server:file.decompress' | 'server:file.delete' | 'server:file.create-directory' | 'server:file.pull';
|
|
113
|
+
export type ServerConsoleEvent = 'server:console.command';
|
|
114
|
+
export type ServerSettingsEvent = 'server:settings.rename' | 'server:settings.description';
|
|
115
|
+
export type ServerReinstallEvent = 'server:reinstall';
|
|
116
|
+
export type ServerStartupEvent = 'server:startup.image' | 'server:startup.edit';
|
|
117
|
+
export type ServerDatabaseEvent = 'server:database.create' | 'server:database.rotate-password' | 'server:database.delete';
|
|
118
|
+
export type ServerScheduleEvent = 'server:schedule.create' | 'server:schedule.update' | 'server:schedule.execute' | 'server:schedule.delete';
|
|
119
|
+
export type ServerSubuserEvent = 'server:subuser.create' | 'server:subuser.update' | 'server:subuser.delete';
|
|
120
|
+
export type ServerAllocationEvent = 'server:allocation.notes' | 'server:allocation.primary' | 'server:allocation.create' | 'server:allocation.delete';
|
|
121
|
+
export type ServerTaskEvent = 'server:task.create' | 'server:task.update' | 'server:task.delete';
|
|
122
|
+
export type ServerBackupEvent = 'server:backup.start' | 'server:backup.unlock' | 'server:backup.lock' | 'server:backup.delete' | 'server:backup.download' | 'server:backup.restore' | 'server:backup.restore-complete';
|
|
123
123
|
export type ServerEvent = ServerFileEvent | ServerConsoleEvent | ServerSettingsEvent | ServerReinstallEvent | ServerStartupEvent | ServerDatabaseEvent | ServerScheduleEvent | ServerSubuserEvent | ServerAllocationEvent | ServerTaskEvent | ServerBackupEvent;
|
|
124
124
|
export interface OldNew {
|
|
125
125
|
old: string;
|
|
@@ -153,7 +153,7 @@ export interface EmailRevoked {
|
|
|
153
153
|
}
|
|
154
154
|
export interface TaskPayload<T extends TaskAction = TaskAction> extends NameOnly {
|
|
155
155
|
action: T;
|
|
156
|
-
payload: T extends
|
|
156
|
+
payload: T extends 'power' ? Signal : string;
|
|
157
157
|
}
|
|
158
158
|
export type AllocationType = `${IP}:${number}`;
|
|
159
159
|
export interface AllocationInterface {
|
|
@@ -176,71 +176,71 @@ export interface FileRename<N extends number = number> {
|
|
|
176
176
|
count: N;
|
|
177
177
|
}
|
|
178
178
|
export type ServerActivityMap = {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
'server:file.read': FileSingle;
|
|
180
|
+
'server:file.download': FileSingle;
|
|
181
|
+
'server:file.write': FileSingle;
|
|
182
|
+
'server:file.copy': FileSingle;
|
|
183
|
+
'server:file.rename': FileRename;
|
|
184
|
+
'server:file.compress': FileBatch;
|
|
185
|
+
'server:file.delete': FileBatch;
|
|
186
|
+
'server:file.decompress': {
|
|
187
187
|
directory: string;
|
|
188
188
|
files: string;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
'server:file.create-directory': {
|
|
191
191
|
name: string;
|
|
192
192
|
directory: string;
|
|
193
193
|
};
|
|
194
|
-
|
|
194
|
+
'server:file.pull': {
|
|
195
195
|
directory: string;
|
|
196
196
|
url: string;
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
'server:console.command': {
|
|
199
199
|
command: string;
|
|
200
200
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
'server:settings.rename': OldNew;
|
|
202
|
+
'server:settings.description': OldNew;
|
|
203
|
+
'server:startup.image': OldNew;
|
|
204
|
+
'server:startup.edit': {
|
|
205
205
|
variable: string;
|
|
206
206
|
} & OldNew;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
'server:database.create': NameOnly;
|
|
208
|
+
'server:database.rotate-password': NameOnly;
|
|
209
|
+
'server:database.delete': NameOnly;
|
|
210
|
+
'server:schedule.create': NameOnly;
|
|
211
|
+
'server:schedule.update': {
|
|
212
212
|
name: string;
|
|
213
213
|
active: boolean;
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
'server:schedule.execute': NameOnly;
|
|
216
|
+
'server:schedule.delete': NameOnly;
|
|
217
|
+
'server:subuser.create': EmailPerms;
|
|
218
|
+
'server:subuser.update': PermissionsUpdate;
|
|
219
|
+
'server:subuser.delete': EmailRevoked;
|
|
220
|
+
'server:allocation.notes': {
|
|
221
221
|
old: null | string;
|
|
222
222
|
new: null | string;
|
|
223
223
|
} & AllocationInterface;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
224
|
+
'server:allocation.primary': AllocationInterface;
|
|
225
|
+
'server:allocation.create': AllocationInterface;
|
|
226
|
+
'server:allocation.delete': AllocationInterface;
|
|
227
|
+
'server:task.create': TaskPayload;
|
|
228
|
+
'server:task.update': TaskPayload;
|
|
229
|
+
'server:task.delete': NameOnly;
|
|
230
|
+
'server:backup.start': NameLocked;
|
|
231
|
+
'server:backup.unlock': NameOnly;
|
|
232
|
+
'server:backup.lock': NameOnly;
|
|
233
|
+
'server:backup.delete': NameFailed;
|
|
234
|
+
'server:backup.download': NameOnly;
|
|
235
|
+
'server:backup.restore': {
|
|
236
236
|
name: string;
|
|
237
237
|
truncate: boolean;
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
'server:backup.restore-complete': NameOnly;
|
|
240
240
|
};
|
|
241
241
|
export type ServerActivityProperties<U extends ServerEvent> = U extends keyof ServerActivityMap ? ServerActivityMap[U] : never;
|
|
242
242
|
export interface ActivityLog<T extends string | Date, U extends ServerEvent = ServerEvent> {
|
|
243
|
-
object:
|
|
243
|
+
object: 'activity_log';
|
|
244
244
|
attributes: {
|
|
245
245
|
id: string;
|
|
246
246
|
batch: null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type HttpClient from
|
|
2
|
-
import type { EggVariable } from
|
|
3
|
-
import type { EditEggVariable, EggVariableList } from
|
|
1
|
+
import type HttpClient from '../../../class/HttpClient.js';
|
|
2
|
+
import type { EggVariable } from '../server.types.js';
|
|
3
|
+
import type { EditEggVariable, EggVariableList } from './startup.types.js';
|
|
4
4
|
export default class StartupClient {
|
|
5
5
|
private httpClient;
|
|
6
6
|
readonly server: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { editVariableSchema } from
|
|
1
|
+
import { editVariableSchema } from '../server.schemas.js';
|
|
2
2
|
export default class StartupClient {
|
|
3
3
|
httpClient;
|
|
4
4
|
server;
|
|
@@ -7,9 +7,9 @@ export default class StartupClient {
|
|
|
7
7
|
this.server = server;
|
|
8
8
|
}
|
|
9
9
|
info() {
|
|
10
|
-
return this.httpClient.request(
|
|
10
|
+
return this.httpClient.request('GET', `/client/servers/${this.server}/settings/startup`);
|
|
11
11
|
}
|
|
12
12
|
edit(options) {
|
|
13
|
-
return this.httpClient.request(
|
|
13
|
+
return this.httpClient.request('PUT', `/client/servers/${this.server}/settings/startup`, editVariableSchema.parse(options));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseArgs, List } from
|
|
2
|
-
import type { EggVariable } from
|
|
1
|
+
import type { BaseArgs, List } from '../../../types.js';
|
|
2
|
+
import type { EggVariable } from '../server.types.js';
|
|
3
3
|
export interface EggVariableList extends List {
|
|
4
4
|
data: EggVariable[];
|
|
5
5
|
meta: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type HttpClient from
|
|
2
|
-
import type { EditSubuserArgs } from
|
|
1
|
+
import type HttpClient from '../../../class/HttpClient.js';
|
|
2
|
+
import type { EditSubuserArgs } from '../subuser.types.js';
|
|
3
3
|
export default class SubuserClient {
|
|
4
4
|
private httpClient;
|
|
5
5
|
readonly server: string;
|
|
@@ -12,7 +12,7 @@ export default class SubuserClient {
|
|
|
12
12
|
username: string;
|
|
13
13
|
email: string;
|
|
14
14
|
image: string;
|
|
15
|
-
|
|
15
|
+
'2fa_enabled': boolean;
|
|
16
16
|
permissions: import("../server.types.js").ServerPermissions[];
|
|
17
17
|
};
|
|
18
18
|
object: "server_subuser";
|
|
@@ -24,7 +24,7 @@ export default class SubuserClient {
|
|
|
24
24
|
username: string;
|
|
25
25
|
email: string;
|
|
26
26
|
image: string;
|
|
27
|
-
|
|
27
|
+
'2fa_enabled': boolean;
|
|
28
28
|
permissions: import("../server.types.js").ServerPermissions[];
|
|
29
29
|
};
|
|
30
30
|
object: "server_subuser";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { editSubuserSchema, userServerSubuserId } from
|
|
1
|
+
import { editSubuserSchema, userServerSubuserId } from '../server.schemas.js';
|
|
2
2
|
export default class SubuserClient {
|
|
3
3
|
httpClient;
|
|
4
4
|
server;
|
|
@@ -9,7 +9,7 @@ export default class SubuserClient {
|
|
|
9
9
|
this.subuser = userServerSubuserId.parse(subuser);
|
|
10
10
|
}
|
|
11
11
|
async info() {
|
|
12
|
-
const res = await this.httpClient.request(
|
|
12
|
+
const res = await this.httpClient.request('GET', `/client/servers/${this.server}/users/${this.subuser}`);
|
|
13
13
|
return {
|
|
14
14
|
...res,
|
|
15
15
|
attributes: {
|
|
@@ -19,7 +19,7 @@ export default class SubuserClient {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
async edit(options) {
|
|
22
|
-
const res = await this.httpClient.request(
|
|
22
|
+
const res = await this.httpClient.request('POST', `/client/servers/${this.server}/users/${this.subuser}`, editSubuserSchema.parse(options));
|
|
23
23
|
return {
|
|
24
24
|
...res,
|
|
25
25
|
attributes: {
|
|
@@ -29,6 +29,6 @@ export default class SubuserClient {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
delete() {
|
|
32
|
-
return this.httpClient.request(
|
|
32
|
+
return this.httpClient.request('DELETE', `/client/servers/${this.server}/users/${this.subuser}`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { BaseArgs, List } from
|
|
2
|
-
import type { ServerPermissions } from
|
|
1
|
+
import type { BaseArgs, List } from '../../types.js';
|
|
2
|
+
import type { ServerPermissions } from './server.types.js';
|
|
3
3
|
export interface Subuser<T extends string | Date> {
|
|
4
|
-
object:
|
|
4
|
+
object: 'server_subuser';
|
|
5
5
|
attributes: {
|
|
6
6
|
uuid: string;
|
|
7
7
|
username: string;
|
|
8
8
|
email: string;
|
|
9
9
|
image: string;
|
|
10
|
-
|
|
10
|
+
'2fa_enabled': boolean;
|
|
11
11
|
created_at: T;
|
|
12
12
|
permissions: ServerPermissions[];
|
|
13
13
|
};
|