@pelican.ts/sdk 0.4.15 → 0.4.16-next.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 +5 -4
- package/bun.lock +40 -0
- package/dist/api/index.d.mts +774 -783
- package/dist/api/index.d.ts +774 -783
- package/dist/api/index.js +1540 -1534
- package/dist/api/index.mjs +1540 -1534
- package/dist/index.d.mts +270 -188
- package/dist/index.d.ts +270 -188
- package/dist/index.js +1118 -1081
- package/dist/index.mjs +1118 -1081
- package/dist/types.d.ts +250 -259
- package/package.json +3 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import WebSocket from 'isomorphic-ws';
|
|
3
2
|
import z from 'zod';
|
|
3
|
+
import WebSocket from 'isomorphic-ws';
|
|
4
4
|
|
|
5
5
|
type ExactlyOneKey<K extends keyof any, V, KK extends keyof any = K> = {
|
|
6
6
|
[P in K]: {
|
|
@@ -14,55 +14,36 @@ type ExactlyOneKey<K extends keyof any, V, KK extends keyof any = K> = {
|
|
|
14
14
|
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
15
15
|
type Nullable<T> = T | null;
|
|
16
16
|
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
username: string;
|
|
20
|
-
email: string;
|
|
21
|
-
language: string;
|
|
22
|
-
image: string;
|
|
23
|
-
admin: boolean;
|
|
24
|
-
root_admin: boolean;
|
|
25
|
-
"2fa_enabled": boolean;
|
|
26
|
-
created_at: string;
|
|
27
|
-
updated_at: string;
|
|
28
|
-
};
|
|
29
|
-
type APIKey = {
|
|
30
|
-
identifier: string;
|
|
31
|
-
description: string;
|
|
32
|
-
allowed_ips: string[];
|
|
33
|
-
last_used_at: Nullable<string>;
|
|
34
|
-
created_at: string;
|
|
35
|
-
};
|
|
36
|
-
type SSHKey = {
|
|
17
|
+
type DatabaseHost = {
|
|
18
|
+
id: number;
|
|
37
19
|
name: string;
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
host: string;
|
|
21
|
+
port: number;
|
|
22
|
+
username: string;
|
|
40
23
|
created_at: string;
|
|
41
|
-
|
|
42
|
-
type Permission = {
|
|
43
|
-
description: string;
|
|
44
|
-
keys: Record<string, string>;
|
|
24
|
+
updated_at: Nullable<string>;
|
|
45
25
|
};
|
|
46
26
|
|
|
47
|
-
declare class
|
|
27
|
+
declare class DatabaseHosts {
|
|
48
28
|
private readonly r;
|
|
49
|
-
constructor(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
create: (description: string, allowed_ips?: string[]) => Promise<APIKey & {
|
|
56
|
-
secret_token: string;
|
|
57
|
-
}>;
|
|
58
|
-
delete: (identifier: string) => Promise<void>;
|
|
59
|
-
};
|
|
60
|
-
sshKeys: {
|
|
61
|
-
list: () => Promise<SSHKey[]>;
|
|
62
|
-
create: (name: string, public_key: string) => Promise<SSHKey>;
|
|
63
|
-
delete: (fingerprint: string) => Promise<void>;
|
|
64
|
-
};
|
|
29
|
+
constructor(r: AxiosInstance);
|
|
30
|
+
list: (page?: number) => Promise<DatabaseHost[]>;
|
|
31
|
+
info: (id: string) => Promise<DatabaseHost>;
|
|
32
|
+
create: (opts: z.infer<typeof CreateDBHostSchema>) => Promise<void>;
|
|
33
|
+
update: (id: string, opts: z.infer<typeof CreateDBHostSchema>) => Promise<DatabaseHost>;
|
|
34
|
+
delete: (id: string) => Promise<void>;
|
|
65
35
|
}
|
|
36
|
+
declare const CreateDBHostSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
host: z.ZodString;
|
|
39
|
+
port: z.ZodNumber;
|
|
40
|
+
username: z.ZodString;
|
|
41
|
+
password: z.ZodOptional<z.ZodString>;
|
|
42
|
+
node_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
max_databases: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
|
|
46
|
+
type ServerSignalOption = "start" | "stop" | "restart" | "kill";
|
|
66
47
|
|
|
67
48
|
type GenericResponse<T, N extends string = string, M = undefined> = {
|
|
68
49
|
object: N;
|
|
@@ -75,7 +56,7 @@ type PaginationMeta = {
|
|
|
75
56
|
per_page: number;
|
|
76
57
|
current_page: number;
|
|
77
58
|
total_pages: number;
|
|
78
|
-
links:
|
|
59
|
+
links: unknown;
|
|
79
60
|
};
|
|
80
61
|
type GenericListResponse<T> = {
|
|
81
62
|
object: "list";
|
|
@@ -90,29 +71,22 @@ type CustomListResponse<T, M> = {
|
|
|
90
71
|
meta?: M;
|
|
91
72
|
};
|
|
92
73
|
|
|
93
|
-
type
|
|
74
|
+
type ServerDatabase = {
|
|
75
|
+
id: string;
|
|
76
|
+
host: {
|
|
77
|
+
address: string;
|
|
78
|
+
port: number;
|
|
79
|
+
};
|
|
94
80
|
name: string;
|
|
95
|
-
description: string;
|
|
96
|
-
env_variable: string;
|
|
97
|
-
default_value: string;
|
|
98
|
-
server_value: string;
|
|
99
|
-
is_editable: boolean;
|
|
100
|
-
rules: string;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
type ServerSubuser = {
|
|
104
|
-
uuid: string;
|
|
105
81
|
username: string;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
permissions: SubuserPermission[] | string[];
|
|
82
|
+
connections_from: string;
|
|
83
|
+
max_connections: number;
|
|
84
|
+
relationships?: {
|
|
85
|
+
password: GenericResponse<{
|
|
86
|
+
password: string;
|
|
87
|
+
}, "database_password">;
|
|
88
|
+
};
|
|
114
89
|
};
|
|
115
|
-
type SubuserPermission = "activity.read" | "allocation.create" | "allocation.delete" | "allocation.read" | "allocation.update" | "backup.create" | "backup.delete" | "backup.download" | "backup.read" | "backup.restore" | "control.console" | "control.restart" | "control.start" | "control.stop" | "database.create" | "database.delete" | "database.read" | "database.update" | "database.view-password" | "file.archive" | "file.create" | "file.delete" | "file.read" | "file.read-content" | "file.sftp" | "file.update" | "schedule.create" | "schedule.delete" | "schedule.read" | "schedule.update" | "settings.description" | "settings.reinstall" | "settings.rename" | "startup.docker-image" | "startup.read" | "startup.update" | "user.create" | "user.delete" | "user.read" | "user.update" | "websocket.connect";
|
|
116
90
|
|
|
117
91
|
type ServerLimits = {
|
|
118
92
|
memory: number;
|
|
@@ -130,98 +104,41 @@ type FeatureLimits = {
|
|
|
130
104
|
backups: number;
|
|
131
105
|
};
|
|
132
106
|
|
|
133
|
-
type
|
|
134
|
-
id: number;
|
|
135
|
-
ip: string;
|
|
136
|
-
ip_alias: Nullable<string>;
|
|
137
|
-
port: number;
|
|
138
|
-
notes: Nullable<string>;
|
|
139
|
-
is_default: boolean;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
type Server = {
|
|
143
|
-
server_owner: boolean;
|
|
144
|
-
identifier: string;
|
|
145
|
-
internal_id?: number;
|
|
146
|
-
uuid: string;
|
|
107
|
+
type StartupParams = {
|
|
147
108
|
name: string;
|
|
148
|
-
node: string;
|
|
149
|
-
is_node_under_maintenance: boolean;
|
|
150
|
-
sftp_details: {
|
|
151
|
-
ip: string;
|
|
152
|
-
alias: Nullable<string>;
|
|
153
|
-
port: number;
|
|
154
|
-
};
|
|
155
109
|
description: string;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
status: Nullable<unknown>;
|
|
162
|
-
is_suspended: boolean;
|
|
163
|
-
is_installing: boolean;
|
|
164
|
-
is_transferring: boolean;
|
|
165
|
-
relationships: {
|
|
166
|
-
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
167
|
-
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
168
|
-
egg?: GenericResponse<{
|
|
169
|
-
uuid: string;
|
|
170
|
-
name: string;
|
|
171
|
-
}, "egg">;
|
|
172
|
-
subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
type ServerStats = {
|
|
176
|
-
current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
|
|
177
|
-
is_suspended: boolean;
|
|
178
|
-
resources: ServerResources;
|
|
179
|
-
};
|
|
180
|
-
type ServerResources = {
|
|
181
|
-
memory_bytes: number;
|
|
182
|
-
cpu_absolute: number;
|
|
183
|
-
disk_bytes: number;
|
|
184
|
-
network_tx_bytes: number;
|
|
185
|
-
network_rx_bytes: number;
|
|
186
|
-
uptime: number;
|
|
110
|
+
env_variables: string;
|
|
111
|
+
default_value: string;
|
|
112
|
+
server_value: string;
|
|
113
|
+
is_editable: boolean;
|
|
114
|
+
rules: string;
|
|
187
115
|
};
|
|
188
|
-
type
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
is_api: boolean;
|
|
192
|
-
ip: string;
|
|
193
|
-
description: Nullable<string>;
|
|
194
|
-
properties: Record<string, string>;
|
|
195
|
-
has_additional_metadata: boolean;
|
|
196
|
-
timestamp: string;
|
|
116
|
+
type StartupMeta = {
|
|
117
|
+
startup_command: string;
|
|
118
|
+
raw_startup_command: string;
|
|
197
119
|
};
|
|
198
120
|
|
|
199
|
-
type
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
port: number;
|
|
204
|
-
};
|
|
121
|
+
type ServerBackup = {
|
|
122
|
+
uuid: string;
|
|
123
|
+
is_successful: boolean;
|
|
124
|
+
is_locked: boolean;
|
|
205
125
|
name: string;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
password: string;
|
|
212
|
-
}, "database_password">;
|
|
213
|
-
};
|
|
126
|
+
ignored_files: string[];
|
|
127
|
+
checksum: Nullable<string>;
|
|
128
|
+
bytes: number;
|
|
129
|
+
created_at: string;
|
|
130
|
+
completed_at: Nullable<string>;
|
|
214
131
|
};
|
|
215
132
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
133
|
+
type EggVariable = {
|
|
134
|
+
name: string;
|
|
135
|
+
description: string;
|
|
136
|
+
env_variable: string;
|
|
137
|
+
default_value: string;
|
|
138
|
+
server_value: string;
|
|
139
|
+
is_editable: boolean;
|
|
140
|
+
rules: string;
|
|
141
|
+
};
|
|
225
142
|
|
|
226
143
|
type FileObject = {
|
|
227
144
|
name: string;
|
|
@@ -235,38 +152,6 @@ type FileObject = {
|
|
|
235
152
|
modified_at: string;
|
|
236
153
|
};
|
|
237
154
|
|
|
238
|
-
declare class ServerFiles {
|
|
239
|
-
private readonly r;
|
|
240
|
-
private readonly id;
|
|
241
|
-
constructor(requester: AxiosInstance, id: string);
|
|
242
|
-
list: (path?: string) => Promise<FileObject[]>;
|
|
243
|
-
/**
|
|
244
|
-
* Return the contents of a file. To read binary file (non-editable) use {@link download} instead
|
|
245
|
-
*/
|
|
246
|
-
contents: (path: string) => Promise<string>;
|
|
247
|
-
downloadGetUrl: (path: string) => Promise<string>;
|
|
248
|
-
download: (path: string) => Promise<ArrayBuffer>;
|
|
249
|
-
rename: (root: string | undefined, files: {
|
|
250
|
-
from: string;
|
|
251
|
-
to: string;
|
|
252
|
-
}[]) => Promise<void>;
|
|
253
|
-
copy: (location: string) => Promise<void>;
|
|
254
|
-
write: (path: string, content: string) => Promise<void>;
|
|
255
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
256
|
-
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
257
|
-
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
258
|
-
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
259
|
-
chmod: (root: string | undefined, files: Array<{
|
|
260
|
-
file: string;
|
|
261
|
-
mode: number;
|
|
262
|
-
}>) => Promise<void>;
|
|
263
|
-
pullFromRemote: (url: string, directory?: string, filename?: string, // Unused
|
|
264
|
-
use_header?: boolean, // Unused
|
|
265
|
-
foreground?: boolean) => Promise<void>;
|
|
266
|
-
uploadGetUrl: () => Promise<string>;
|
|
267
|
-
upload: (file: File, root?: string) => Promise<void>;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
155
|
type Schedule = {
|
|
271
156
|
id: number;
|
|
272
157
|
name: string;
|
|
@@ -299,260 +184,80 @@ type ScheduleTask = {
|
|
|
299
184
|
updated_at: Nullable<string>;
|
|
300
185
|
};
|
|
301
186
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
private readonly id;
|
|
305
|
-
constructor(requester: AxiosInstance, id: string);
|
|
306
|
-
list: () => Promise<Schedule[]>;
|
|
307
|
-
create: (params: ScheduleCreateParams) => Promise<Schedule>;
|
|
308
|
-
control: (sched_id: number) => ScheduleControl;
|
|
309
|
-
}
|
|
310
|
-
type ScheduleCreateParams = {
|
|
311
|
-
name: string;
|
|
312
|
-
is_active?: boolean;
|
|
313
|
-
only_when_online?: boolean;
|
|
314
|
-
minute: string;
|
|
315
|
-
hour: string;
|
|
316
|
-
day_of_week: string;
|
|
317
|
-
month: string;
|
|
318
|
-
day_of_month: string;
|
|
319
|
-
};
|
|
320
|
-
declare class ScheduleControl {
|
|
321
|
-
private r;
|
|
322
|
-
private readonly id;
|
|
323
|
-
private readonly sched_id;
|
|
324
|
-
constructor(requester: AxiosInstance, id: string, sched_id: number);
|
|
325
|
-
info: () => Promise<Schedule>;
|
|
326
|
-
update: (params: ScheduleCreateParams) => Promise<Schedule>;
|
|
327
|
-
delete: () => Promise<void>;
|
|
328
|
-
execute: () => Promise<void>;
|
|
329
|
-
tasks: {
|
|
330
|
-
create: (opts: PartialBy<Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">, "payload" | "sequence_id" | "continue_on_failure">) => Promise<ScheduleTask>;
|
|
331
|
-
update: <T extends "command" | "power" | "backup" | "delete_files">(task_id: number, opts: PartialBy<Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">, "payload" | "sequence_id" | "continue_on_failure">) => Promise<ScheduleTask>;
|
|
332
|
-
delete: (task_id: number) => Promise<void>;
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
declare class ServerAllocations {
|
|
337
|
-
private readonly r;
|
|
338
|
-
private readonly id;
|
|
339
|
-
constructor(requester: AxiosInstance, id: string);
|
|
340
|
-
list: () => Promise<ServerAllocation[]>;
|
|
341
|
-
autoAssign: () => Promise<ServerAllocation>;
|
|
342
|
-
setNotes: (alloc_id: number, notes: string) => Promise<ServerAllocation>;
|
|
343
|
-
setPrimary: (alloc_id: number) => Promise<ServerAllocation>;
|
|
344
|
-
unassign: (alloc_id: number) => Promise<void>;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
declare class ServerUsers {
|
|
348
|
-
private readonly r;
|
|
349
|
-
private readonly id;
|
|
350
|
-
constructor(requester: AxiosInstance, id: string);
|
|
351
|
-
list: () => Promise<ServerSubuser[]>;
|
|
352
|
-
create: (email: string, permissions: SubuserPermission[] | string[]) => Promise<ServerSubuser>;
|
|
353
|
-
info: (user_uuid: string) => Promise<ServerSubuser>;
|
|
354
|
-
update: (user_uuid: string, permissions: SubuserPermission[] | string[]) => Promise<ServerSubuser>;
|
|
355
|
-
delete: (user_uuid: string) => Promise<void>;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
type ServerBackup = {
|
|
187
|
+
type Egg = {
|
|
188
|
+
id: number;
|
|
359
189
|
uuid: string;
|
|
360
|
-
is_successful: boolean;
|
|
361
|
-
is_locked: boolean;
|
|
362
190
|
name: string;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
191
|
+
author: string;
|
|
192
|
+
description: string;
|
|
193
|
+
features: string[];
|
|
194
|
+
tags: string[];
|
|
195
|
+
docker_image: Nullable<string>;
|
|
196
|
+
docker_images: Record<string, string>;
|
|
197
|
+
config: {
|
|
198
|
+
files: Record<string, FileConfig>;
|
|
199
|
+
startup: Record<string, string>;
|
|
200
|
+
stop: string;
|
|
201
|
+
logs: object | [];
|
|
202
|
+
file_denylist: string[];
|
|
203
|
+
extends: Nullable<number>;
|
|
204
|
+
};
|
|
205
|
+
startup: string;
|
|
206
|
+
startup_commands: Record<string, string>;
|
|
207
|
+
script: {
|
|
208
|
+
privileged: boolean;
|
|
209
|
+
install: string;
|
|
210
|
+
entry: string;
|
|
211
|
+
container: string;
|
|
212
|
+
extends: Nullable<number>;
|
|
213
|
+
};
|
|
366
214
|
created_at: string;
|
|
367
|
-
|
|
215
|
+
updated_at: Nullable<string>;
|
|
368
216
|
};
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
private readonly id;
|
|
373
|
-
constructor(requester: AxiosInstance, id: string);
|
|
374
|
-
list: (page?: number) => Promise<ServerBackup[]>;
|
|
375
|
-
create: (args: {
|
|
376
|
-
name?: string;
|
|
377
|
-
is_locked: boolean;
|
|
378
|
-
ignored_files: string[];
|
|
379
|
-
}) => Promise<ServerBackup>;
|
|
380
|
-
info: (backup_uuid: string) => Promise<ServerBackup>;
|
|
381
|
-
downloadGetUrl: (backup_uuid: string) => Promise<string>;
|
|
382
|
-
download: (backup_uuid: string) => Promise<ArrayBuffer>;
|
|
383
|
-
delete: (backup_uuid: string) => Promise<void>;
|
|
384
|
-
rename: (backup_uuid: string, name: string) => Promise<void>;
|
|
385
|
-
toggleLock: (backup_uuid: string) => Promise<void>;
|
|
386
|
-
restore: (backup_uuid: string, truncate: boolean) => Promise<void>;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
type StartupParams = {
|
|
390
|
-
name: string;
|
|
391
|
-
description: string;
|
|
392
|
-
env_variables: string;
|
|
393
|
-
default_value: string;
|
|
394
|
-
server_value: string;
|
|
395
|
-
is_editable: boolean;
|
|
396
|
-
rules: string;
|
|
217
|
+
type FileConfig = {
|
|
218
|
+
parser: string;
|
|
219
|
+
find: Record<string, string>;
|
|
397
220
|
};
|
|
398
|
-
type
|
|
399
|
-
|
|
400
|
-
|
|
221
|
+
type ApplicationEggVariable = Omit<EggVariable, "server_value" | "is_editable" | "rules"> & {
|
|
222
|
+
rules: string[];
|
|
223
|
+
sort: number;
|
|
224
|
+
user_viewable: boolean;
|
|
225
|
+
user_editable: boolean;
|
|
401
226
|
};
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
declare class ServerSettings {
|
|
412
|
-
private readonly r;
|
|
413
|
-
private readonly id;
|
|
414
|
-
constructor(requester: AxiosInstance, id: string);
|
|
415
|
-
rename: (name: string) => Promise<void>;
|
|
416
|
-
updateDescription: (description: Nullable<string>) => Promise<void>;
|
|
417
|
-
reinstall: () => Promise<void>;
|
|
418
|
-
changeDockerImage: (image: string) => Promise<void>;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Source: https://github.com/pterodactyl/panel/blob/1.0-develop/resources/scripts/components/server/events.ts
|
|
423
|
-
*/
|
|
424
|
-
declare enum SOCKET_EVENT {
|
|
425
|
-
AUTH_SUCCESS = "auth success",
|
|
426
|
-
DAEMON_MESSAGE = "daemon message",
|
|
427
|
-
DAEMON_ERROR = "daemon error",
|
|
428
|
-
INSTALL_OUTPUT = "install output",
|
|
429
|
-
INSTALL_STARTED = "install started",
|
|
430
|
-
INSTALL_COMPLETED = "install completed",
|
|
431
|
-
CONSOLE_OUTPUT = "console output",
|
|
432
|
-
STATUS = "status",
|
|
433
|
-
STATS = "stats",
|
|
434
|
-
TRANSFER_LOGS = "transfer logs",
|
|
435
|
-
TRANSFER_STATUS = "transfer status",
|
|
436
|
-
BACKUP_COMPLETED = "backup completed",
|
|
437
|
-
BACKUP_RESTORE_COMPLETED = "backup restore completed",
|
|
438
|
-
TOKEN_EXPIRING = "token expiring",
|
|
439
|
-
TOKEN_EXPIRED = "token expired",
|
|
440
|
-
JWT_ERROR = "jwt error"
|
|
441
|
-
}
|
|
442
|
-
type BackupCompletedJson = {
|
|
443
|
-
checksum: string;
|
|
444
|
-
checksum_type: "sha1";
|
|
445
|
-
file_size: number;
|
|
446
|
-
is_successful: boolean;
|
|
227
|
+
type ExportedEgg = {
|
|
228
|
+
meta: {
|
|
229
|
+
version: "PLCN_v3";
|
|
230
|
+
update_url: Nullable<string>;
|
|
231
|
+
};
|
|
232
|
+
exported_at: string;
|
|
233
|
+
name: string;
|
|
234
|
+
author: string;
|
|
235
|
+
description: string;
|
|
447
236
|
uuid: string;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
237
|
+
image: Nullable<string>;
|
|
238
|
+
docker_images: Record<string, string>;
|
|
239
|
+
features: string[];
|
|
240
|
+
tags: string[];
|
|
241
|
+
file_denylist: string[];
|
|
242
|
+
startup_commands: Record<string, string>;
|
|
243
|
+
config: Omit<Egg["config"], "extends" | "file_denylist">;
|
|
244
|
+
scripts: {
|
|
245
|
+
installation: {
|
|
246
|
+
script: string;
|
|
247
|
+
container: string;
|
|
248
|
+
entrypoint: string;
|
|
249
|
+
};
|
|
457
250
|
};
|
|
458
|
-
|
|
459
|
-
uptime: number;
|
|
460
|
-
disk_bytes: number;
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
type ServerSignalOption = "start" | "stop" | "restart" | "kill";
|
|
464
|
-
|
|
465
|
-
type SocketEventPayloadMap = {
|
|
466
|
-
[SOCKET_EVENT.AUTH_SUCCESS]: undefined;
|
|
467
|
-
[SOCKET_EVENT.STATUS]: PowerState;
|
|
468
|
-
[SOCKET_EVENT.CONSOLE_OUTPUT]: string;
|
|
469
|
-
[SOCKET_EVENT.STATS]: StatsWsJson;
|
|
470
|
-
[SOCKET_EVENT.DAEMON_ERROR]: undefined;
|
|
471
|
-
[SOCKET_EVENT.DAEMON_MESSAGE]: string;
|
|
472
|
-
[SOCKET_EVENT.INSTALL_OUTPUT]: string;
|
|
473
|
-
[SOCKET_EVENT.INSTALL_STARTED]: undefined;
|
|
474
|
-
[SOCKET_EVENT.INSTALL_COMPLETED]: undefined;
|
|
475
|
-
[SOCKET_EVENT.TRANSFER_LOGS]: string;
|
|
476
|
-
[SOCKET_EVENT.TRANSFER_STATUS]: string;
|
|
477
|
-
[SOCKET_EVENT.BACKUP_COMPLETED]: BackupCompletedJson;
|
|
478
|
-
[SOCKET_EVENT.BACKUP_RESTORE_COMPLETED]: undefined;
|
|
479
|
-
[SOCKET_EVENT.TOKEN_EXPIRING]: undefined;
|
|
480
|
-
[SOCKET_EVENT.TOKEN_EXPIRED]: undefined;
|
|
481
|
-
[SOCKET_EVENT.JWT_ERROR]: string;
|
|
251
|
+
variables: ApplicationEggVariable[];
|
|
482
252
|
};
|
|
483
|
-
type Listener<E extends SOCKET_EVENT> = SocketEventPayloadMap[E] extends undefined ? () => void : (payload: SocketEventPayloadMap[E]) => void;
|
|
484
|
-
type CloseEventLike = Parameters<NonNullable<WebSocket["onclose"]>>[0];
|
|
485
|
-
type ErrorEventLike = Parameters<NonNullable<WebSocket["onerror"]>>[0];
|
|
486
|
-
declare class ServerWebsocket {
|
|
487
|
-
private readonly r;
|
|
488
|
-
private readonly serverId;
|
|
489
|
-
private socket?;
|
|
490
|
-
private currentToken?;
|
|
491
|
-
private readonly bus;
|
|
492
|
-
private debugLogging;
|
|
493
|
-
private stripColors;
|
|
494
|
-
private detachMessageListener?;
|
|
495
|
-
constructor(requester: AxiosInstance, id: string, stripColors?: boolean);
|
|
496
|
-
on<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): () => void;
|
|
497
|
-
deregister<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): void;
|
|
498
|
-
private emit;
|
|
499
|
-
connect(resumable?: boolean, debugLogging?: boolean): Promise<void>;
|
|
500
|
-
onSocketDisconnect(handler: (event: CloseEventLike) => void): void;
|
|
501
|
-
onSocketError(handler: (event: ErrorEventLike) => void): void;
|
|
502
|
-
makeResumable(disconnectsToo: boolean): void;
|
|
503
|
-
private attachMessageListener;
|
|
504
|
-
private handleIncomingMessage;
|
|
505
|
-
private parseMessage;
|
|
506
|
-
private normalisePayload;
|
|
507
|
-
private dispatchMessage;
|
|
508
|
-
private refreshCredentials;
|
|
509
|
-
private authenticate;
|
|
510
|
-
disconnect(): void;
|
|
511
|
-
requestStats(): void;
|
|
512
|
-
requestLogs(): void;
|
|
513
|
-
private send;
|
|
514
|
-
getStats(): Promise<StatsWsJson>;
|
|
515
|
-
getLogs(): Promise<string[]>;
|
|
516
|
-
sendPoweraction(action: ServerSignalOption): void;
|
|
517
|
-
sendCommand(cmd: string): void;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
declare class ServerActivity {
|
|
521
|
-
private readonly r;
|
|
522
|
-
private readonly id;
|
|
523
|
-
constructor(r: AxiosInstance, id: string);
|
|
524
|
-
list: (page?: number, per_page?: number) => Promise<ServerActivityLog[]>;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
declare class ServerClient {
|
|
528
|
-
private readonly r;
|
|
529
|
-
private readonly id;
|
|
530
|
-
activity: ServerActivity;
|
|
531
|
-
databases: ServerDatabases;
|
|
532
|
-
files: ServerFiles;
|
|
533
|
-
schedules: ServerSchedules;
|
|
534
|
-
allocations: ServerAllocations;
|
|
535
|
-
users: ServerUsers;
|
|
536
|
-
backups: ServerBackups;
|
|
537
|
-
startup: ServerStartup;
|
|
538
|
-
variables: ServerStartup;
|
|
539
|
-
settings: ServerSettings;
|
|
540
|
-
constructor(requester: AxiosInstance, id: string);
|
|
541
|
-
info: (include?: ("egg" | "subusers")[]) => Promise<Server>;
|
|
542
|
-
websocket: (stripColors?: boolean) => ServerWebsocket;
|
|
543
|
-
resources: () => Promise<ServerStats>;
|
|
544
|
-
command: (command: string) => Promise<void>;
|
|
545
|
-
power: (signal: "start" | "stop" | "restart" | "kill") => Promise<void>;
|
|
546
|
-
}
|
|
547
253
|
|
|
548
|
-
declare class
|
|
549
|
-
account: Account;
|
|
254
|
+
declare class Eggs {
|
|
550
255
|
private readonly r;
|
|
551
|
-
constructor(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
256
|
+
constructor(r: AxiosInstance);
|
|
257
|
+
list: () => Promise<Egg[]>;
|
|
258
|
+
info: (id: number) => Promise<Egg>;
|
|
259
|
+
export: (id: number, format: "json" | "yaml") => Promise<string>;
|
|
260
|
+
infoExportable: (id: number) => Promise<ExportedEgg>;
|
|
556
261
|
}
|
|
557
262
|
|
|
558
263
|
type Container = {
|
|
@@ -586,6 +291,99 @@ type ApplicationServer = {
|
|
|
586
291
|
updated_at: Nullable<string>;
|
|
587
292
|
};
|
|
588
293
|
|
|
294
|
+
type Allocation = {
|
|
295
|
+
id: number;
|
|
296
|
+
ip: string;
|
|
297
|
+
alias: Nullable<string>;
|
|
298
|
+
port: number;
|
|
299
|
+
notes: Nullable<string>;
|
|
300
|
+
assigned: boolean;
|
|
301
|
+
};
|
|
302
|
+
type AllocationRel = Allocation & {
|
|
303
|
+
relationships?: {
|
|
304
|
+
node?: GenericResponse<Node$1, "node">;
|
|
305
|
+
server?: GenericResponse<ApplicationServer, "server">;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
type Node$1 = {
|
|
310
|
+
id: number;
|
|
311
|
+
uuid: string;
|
|
312
|
+
public: boolean;
|
|
313
|
+
name: string;
|
|
314
|
+
description: Nullable<string>;
|
|
315
|
+
fqdn: string;
|
|
316
|
+
scheme: "https" | "http";
|
|
317
|
+
behind_proxy: boolean;
|
|
318
|
+
maintenance_mode: boolean;
|
|
319
|
+
memory: number;
|
|
320
|
+
memory_overallocate: number;
|
|
321
|
+
disk: number;
|
|
322
|
+
disk_overallocate: number;
|
|
323
|
+
cpu: number;
|
|
324
|
+
cpu_overallocate: number;
|
|
325
|
+
upload_size: number;
|
|
326
|
+
daemon_listen: number;
|
|
327
|
+
daemon_sftp: number;
|
|
328
|
+
daemon_sftp_alias: Nullable<string>;
|
|
329
|
+
daemon_base: string;
|
|
330
|
+
daemon_connect: number;
|
|
331
|
+
created_at: string;
|
|
332
|
+
updated_at: Nullable<string>;
|
|
333
|
+
tags: string[];
|
|
334
|
+
allocated_resources: {
|
|
335
|
+
memory: number;
|
|
336
|
+
disk: number;
|
|
337
|
+
cpu: number;
|
|
338
|
+
};
|
|
339
|
+
relationships?: {
|
|
340
|
+
allocations?: GenericListResponse<GenericResponse<Allocation, "allocation">>;
|
|
341
|
+
servers?: GenericListResponse<GenericResponse<ApplicationServer, "server">>;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
type NodeConfiguration = {
|
|
345
|
+
debug: boolean;
|
|
346
|
+
uuid: string;
|
|
347
|
+
token_id: string;
|
|
348
|
+
token: string;
|
|
349
|
+
api: {
|
|
350
|
+
host: string;
|
|
351
|
+
port: number;
|
|
352
|
+
upload_limit: number;
|
|
353
|
+
ssl: {
|
|
354
|
+
enabled: boolean;
|
|
355
|
+
cert: string;
|
|
356
|
+
key: string;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
system: {
|
|
360
|
+
data: string;
|
|
361
|
+
sftp: {
|
|
362
|
+
bind_port: number;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
allowed_mounts: string[];
|
|
366
|
+
remote: string;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
type Mount = {
|
|
370
|
+
id: number;
|
|
371
|
+
uuid: string;
|
|
372
|
+
name: string;
|
|
373
|
+
description: Nullable<string>;
|
|
374
|
+
source: string;
|
|
375
|
+
target: string;
|
|
376
|
+
read_only: boolean;
|
|
377
|
+
user_mountable: boolean;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type Role = {
|
|
381
|
+
id: number;
|
|
382
|
+
name: string;
|
|
383
|
+
created_at: string;
|
|
384
|
+
updated_at: string;
|
|
385
|
+
};
|
|
386
|
+
|
|
589
387
|
type ApplicationUser = {
|
|
590
388
|
id: number;
|
|
591
389
|
external_id: Nullable<string>;
|
|
@@ -616,6 +414,196 @@ type ApplicationUserApiKey = {
|
|
|
616
414
|
updated_at: string;
|
|
617
415
|
};
|
|
618
416
|
|
|
417
|
+
declare class Mounts {
|
|
418
|
+
private readonly r;
|
|
419
|
+
constructor(r: AxiosInstance);
|
|
420
|
+
list: () => Promise<Mount[]>;
|
|
421
|
+
info: (id: number) => Promise<Mount>;
|
|
422
|
+
create: (opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
423
|
+
update: (id: number, opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
424
|
+
delete: (id: number) => Promise<void>;
|
|
425
|
+
listAssignedEggs: (id: number) => Promise<Egg[]>;
|
|
426
|
+
assignEggs: (id: number, eggs: number[]) => Promise<void>;
|
|
427
|
+
unassignEgg: (id: number, egg_id: number) => Promise<void>;
|
|
428
|
+
listAssignedNodes: (id: number) => Promise<Node[]>;
|
|
429
|
+
assignNodes: (id: number, nodes: number[]) => Promise<void>;
|
|
430
|
+
unassignNode: (id: number, node_id: number) => Promise<void>;
|
|
431
|
+
listAssignedServers: (id: number) => Promise<ApplicationServer[]>;
|
|
432
|
+
assignServers: (id: number, servers: number[]) => Promise<void>;
|
|
433
|
+
unassignServer: (id: number, server_id: number) => Promise<void>;
|
|
434
|
+
}
|
|
435
|
+
declare const CreateMountSchema: z.ZodObject<{
|
|
436
|
+
name: z.ZodString;
|
|
437
|
+
description: z.ZodOptional<z.ZodString>;
|
|
438
|
+
source: z.ZodString;
|
|
439
|
+
target: z.ZodString;
|
|
440
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
441
|
+
}, z.core.$strip>;
|
|
442
|
+
|
|
443
|
+
declare class NodesAllocations {
|
|
444
|
+
private readonly r;
|
|
445
|
+
private readonly id;
|
|
446
|
+
constructor(requester: AxiosInstance, id: number);
|
|
447
|
+
list: (page?: number, per_page?: number, include?: ("node" | "server")[]) => Promise<AllocationRel[]>;
|
|
448
|
+
create: (ip: string, ports: string[], alias?: string) => Promise<void>;
|
|
449
|
+
delete: (alloc_id: number) => Promise<void>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class Nodes {
|
|
453
|
+
private readonly r;
|
|
454
|
+
constructor(requester: AxiosInstance);
|
|
455
|
+
list: (include?: ("allocations" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
456
|
+
listDeployable: (filters: {
|
|
457
|
+
disk: number;
|
|
458
|
+
memory: number;
|
|
459
|
+
cpu?: number;
|
|
460
|
+
location_ids?: string[];
|
|
461
|
+
tags?: string[];
|
|
462
|
+
}, include?: ("allocations" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
463
|
+
info: (id: number, include?: ("allocations" | "servers")[]) => Promise<Node$1>;
|
|
464
|
+
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
465
|
+
get_configuration: (id: number) => Promise<NodeConfiguration>;
|
|
466
|
+
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
467
|
+
delete: (id: number) => Promise<void>;
|
|
468
|
+
allocations: (server_id: number) => NodesAllocations;
|
|
469
|
+
}
|
|
470
|
+
declare const NodeCreateSchema: z.ZodObject<{
|
|
471
|
+
name: z.ZodString;
|
|
472
|
+
description: z.ZodOptional<z.ZodString>;
|
|
473
|
+
public: z.ZodOptional<z.ZodBoolean>;
|
|
474
|
+
fqdn: z.ZodString;
|
|
475
|
+
scheme: z.ZodEnum<{
|
|
476
|
+
https: "https";
|
|
477
|
+
http: "http";
|
|
478
|
+
}>;
|
|
479
|
+
behind_proxy: z.ZodOptional<z.ZodBoolean>;
|
|
480
|
+
memory: z.ZodNumber;
|
|
481
|
+
memory_overallocate: z.ZodNumber;
|
|
482
|
+
disk: z.ZodNumber;
|
|
483
|
+
disk_overallocate: z.ZodNumber;
|
|
484
|
+
cpu: z.ZodNumber;
|
|
485
|
+
cpu_overallocate: z.ZodNumber;
|
|
486
|
+
daemon_base: z.ZodOptional<z.ZodString>;
|
|
487
|
+
daemon_sftp: z.ZodNumber;
|
|
488
|
+
daemon_sftp_alias: z.ZodOptional<z.ZodString>;
|
|
489
|
+
daemon_listen: z.ZodNumber;
|
|
490
|
+
daemon_connect: z.ZodNumber;
|
|
491
|
+
maintenance_mode: z.ZodOptional<z.ZodBoolean>;
|
|
492
|
+
upload_size: z.ZodNumber;
|
|
493
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
494
|
+
}, z.core.$strip>;
|
|
495
|
+
|
|
496
|
+
declare class Roles {
|
|
497
|
+
private readonly r;
|
|
498
|
+
constructor(r: AxiosInstance);
|
|
499
|
+
list: (page?: number) => Promise<Role[]>;
|
|
500
|
+
info: (id: number) => Promise<Role>;
|
|
501
|
+
create: (opts: {
|
|
502
|
+
name: string;
|
|
503
|
+
}) => Promise<void>;
|
|
504
|
+
update: (id: number, opts: {
|
|
505
|
+
name: string;
|
|
506
|
+
}) => Promise<void>;
|
|
507
|
+
delete: (id: number) => Promise<void>;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
declare class ServersDatabases {
|
|
511
|
+
private readonly r;
|
|
512
|
+
private readonly id;
|
|
513
|
+
constructor(r: AxiosInstance, server_id: number);
|
|
514
|
+
list: () => Promise<ServerDatabase[]>;
|
|
515
|
+
create: (database: string, remote: string, host: string) => Promise<ServerDatabase>;
|
|
516
|
+
info: (database_id: number) => Promise<ServerDatabase>;
|
|
517
|
+
delete: (database_id: number) => Promise<void>;
|
|
518
|
+
resetPassword: (database_id: number) => Promise<void>;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
declare class Servers {
|
|
522
|
+
private readonly r;
|
|
523
|
+
private readonly id;
|
|
524
|
+
databases: ServersDatabases;
|
|
525
|
+
constructor(r: AxiosInstance, server_id: number);
|
|
526
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
527
|
+
delete: (force?: boolean) => Promise<void>;
|
|
528
|
+
updateDetails: (opts: z.infer<typeof UpdateDetailsSchema>) => Promise<void>;
|
|
529
|
+
updateBuild: (opts: z.infer<typeof UpdateBuildSchema>) => Promise<void>;
|
|
530
|
+
updateStartup: (opts: z.infer<typeof UpdateStartupSchema>) => Promise<void>;
|
|
531
|
+
suspend: () => Promise<void>;
|
|
532
|
+
unsuspend: () => Promise<void>;
|
|
533
|
+
reinstall: () => Promise<void>;
|
|
534
|
+
transferStart: (node_id: number, allocation_id: number, allocation_additional?: number[]) => Promise<void>;
|
|
535
|
+
transferCancel: () => Promise<void>;
|
|
536
|
+
}
|
|
537
|
+
declare const CreateServerSchema: z.ZodObject<{
|
|
538
|
+
external_id: z.ZodOptional<z.ZodString>;
|
|
539
|
+
name: z.ZodString;
|
|
540
|
+
description: z.ZodOptional<z.ZodString>;
|
|
541
|
+
user: z.ZodNumber;
|
|
542
|
+
egg: z.ZodNumber;
|
|
543
|
+
docker_image: z.ZodOptional<z.ZodString>;
|
|
544
|
+
startup: z.ZodOptional<z.ZodString>;
|
|
545
|
+
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
546
|
+
skip_scripts: z.ZodOptional<z.ZodBoolean>;
|
|
547
|
+
oom_killer: z.ZodOptional<z.ZodBoolean>;
|
|
548
|
+
start_on_completion: z.ZodOptional<z.ZodBoolean>;
|
|
549
|
+
docker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
550
|
+
limits: z.ZodObject<{
|
|
551
|
+
memory: z.ZodNumber;
|
|
552
|
+
swap: z.ZodNumber;
|
|
553
|
+
disk: z.ZodNumber;
|
|
554
|
+
io: z.ZodNumber;
|
|
555
|
+
threads: z.ZodOptional<z.ZodString>;
|
|
556
|
+
cpu: z.ZodNumber;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
feature_limits: z.ZodObject<{
|
|
559
|
+
databases: z.ZodNumber;
|
|
560
|
+
allocations: z.ZodNumber;
|
|
561
|
+
backups: z.ZodNumber;
|
|
562
|
+
}, z.core.$strip>;
|
|
563
|
+
allocation: z.ZodOptional<z.ZodObject<{
|
|
564
|
+
default: z.ZodNullable<z.ZodString>;
|
|
565
|
+
additional: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
566
|
+
}, z.core.$strip>>;
|
|
567
|
+
deploy: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
569
|
+
dedicated_ip: z.ZodOptional<z.ZodBoolean>;
|
|
570
|
+
port_range: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
571
|
+
}, z.core.$strip>>;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
declare const UpdateDetailsSchema: z.ZodObject<{
|
|
574
|
+
name: z.ZodString;
|
|
575
|
+
description: z.ZodOptional<z.ZodString>;
|
|
576
|
+
external_id: z.ZodOptional<z.ZodString>;
|
|
577
|
+
user: z.ZodNumber;
|
|
578
|
+
docker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
579
|
+
}, z.core.$strip>;
|
|
580
|
+
declare const UpdateBuildSchema: z.ZodObject<{
|
|
581
|
+
oom_killer: z.ZodOptional<z.ZodBoolean>;
|
|
582
|
+
limits: z.ZodObject<{
|
|
583
|
+
memory: z.ZodNumber;
|
|
584
|
+
swap: z.ZodNumber;
|
|
585
|
+
disk: z.ZodNumber;
|
|
586
|
+
io: z.ZodNumber;
|
|
587
|
+
threads: z.ZodOptional<z.ZodString>;
|
|
588
|
+
cpu: z.ZodNumber;
|
|
589
|
+
}, z.core.$strip>;
|
|
590
|
+
feature_limits: z.ZodObject<{
|
|
591
|
+
databases: z.ZodNumber;
|
|
592
|
+
allocations: z.ZodNumber;
|
|
593
|
+
backups: z.ZodNumber;
|
|
594
|
+
}, z.core.$strip>;
|
|
595
|
+
allocation: z.ZodOptional<z.ZodNumber>;
|
|
596
|
+
add_allocations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
597
|
+
remove_allocations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
598
|
+
}, z.core.$strip>;
|
|
599
|
+
declare const UpdateStartupSchema: z.ZodObject<{
|
|
600
|
+
startup: z.ZodOptional<z.ZodString>;
|
|
601
|
+
egg: z.ZodNumber;
|
|
602
|
+
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
603
|
+
image: z.ZodOptional<z.ZodString>;
|
|
604
|
+
skip_scripts: z.ZodBoolean;
|
|
605
|
+
}, z.core.$strip>;
|
|
606
|
+
|
|
619
607
|
declare class Users {
|
|
620
608
|
private readonly r;
|
|
621
609
|
constructor(requester: AxiosInstance);
|
|
@@ -654,7 +642,6 @@ declare const CreateSchema: z.ZodObject<{
|
|
|
654
642
|
username: z.ZodString;
|
|
655
643
|
password: z.ZodOptional<z.ZodString>;
|
|
656
644
|
language: z.ZodEnum<{
|
|
657
|
-
id: "id";
|
|
658
645
|
af: "af";
|
|
659
646
|
ak: "ak";
|
|
660
647
|
am: "am";
|
|
@@ -701,6 +688,7 @@ declare const CreateSchema: z.ZodObject<{
|
|
|
701
688
|
hu: "hu";
|
|
702
689
|
hy: "hy";
|
|
703
690
|
ia: "ia";
|
|
691
|
+
id: "id";
|
|
704
692
|
ig: "ig";
|
|
705
693
|
ii: "ii";
|
|
706
694
|
is: "is";
|
|
@@ -1212,423 +1200,426 @@ declare const CreateSchema: z.ZodObject<{
|
|
|
1212
1200
|
}>;
|
|
1213
1201
|
}, z.core.$strip>;
|
|
1214
1202
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1203
|
+
declare class Client$1 {
|
|
1204
|
+
private readonly r;
|
|
1205
|
+
users: Users;
|
|
1206
|
+
nodes: Nodes;
|
|
1207
|
+
databaseHosts: DatabaseHosts;
|
|
1208
|
+
roles: Roles;
|
|
1209
|
+
eggs: Eggs;
|
|
1210
|
+
mounts: Mounts;
|
|
1211
|
+
constructor(requester: AxiosInstance);
|
|
1212
|
+
get $r(): AxiosInstance;
|
|
1213
|
+
listServers: (search?: string, page?: number) => Promise<ApplicationServer[]>;
|
|
1214
|
+
createServer: (opts: z.infer<typeof CreateServerSchema>) => Promise<ApplicationServer>;
|
|
1215
|
+
getServerByExternalId: (external_id: string, include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
1216
|
+
servers: (server_id: number) => Servers;
|
|
1217
|
+
}
|
|
1222
1218
|
|
|
1223
|
-
type
|
|
1224
|
-
id: number;
|
|
1219
|
+
type User = {
|
|
1225
1220
|
uuid: string;
|
|
1226
|
-
|
|
1221
|
+
username: string;
|
|
1222
|
+
email: string;
|
|
1223
|
+
language: string;
|
|
1224
|
+
image: string;
|
|
1225
|
+
admin: boolean;
|
|
1226
|
+
root_admin: boolean;
|
|
1227
|
+
"2fa_enabled": boolean;
|
|
1228
|
+
created_at: string;
|
|
1229
|
+
updated_at: string;
|
|
1230
|
+
};
|
|
1231
|
+
type APIKey = {
|
|
1232
|
+
identifier: string;
|
|
1233
|
+
description: string;
|
|
1234
|
+
allowed_ips: string[];
|
|
1235
|
+
last_used_at: Nullable<string>;
|
|
1236
|
+
created_at: string;
|
|
1237
|
+
};
|
|
1238
|
+
type SSHKey = {
|
|
1227
1239
|
name: string;
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
scheme: "https" | "http";
|
|
1231
|
-
behind_proxy: boolean;
|
|
1232
|
-
maintenance_mode: boolean;
|
|
1233
|
-
memory: number;
|
|
1234
|
-
memory_overallocate: number;
|
|
1235
|
-
disk: number;
|
|
1236
|
-
disk_overallocate: number;
|
|
1237
|
-
cpu: number;
|
|
1238
|
-
cpu_overallocate: number;
|
|
1239
|
-
upload_size: number;
|
|
1240
|
-
daemon_listen: number;
|
|
1241
|
-
daemon_sftp: number;
|
|
1242
|
-
daemon_sftp_alias: Nullable<string>;
|
|
1243
|
-
daemon_base: string;
|
|
1244
|
-
daemon_connect: number;
|
|
1240
|
+
fingerprint: string;
|
|
1241
|
+
pubic_key: string;
|
|
1245
1242
|
created_at: string;
|
|
1246
|
-
updated_at: Nullable<string>;
|
|
1247
|
-
tags: string[];
|
|
1248
|
-
allocated_resources: {
|
|
1249
|
-
memory: number;
|
|
1250
|
-
disk: number;
|
|
1251
|
-
cpu: number;
|
|
1252
|
-
};
|
|
1253
|
-
relationships?: {
|
|
1254
|
-
allocations?: GenericListResponse<GenericResponse<Allocation, "allocation">>;
|
|
1255
|
-
location?: GenericResponse<Location, "location">;
|
|
1256
|
-
servers?: GenericListResponse<GenericResponse<ApplicationServer, "server">>;
|
|
1257
|
-
};
|
|
1258
1243
|
};
|
|
1259
|
-
type
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1244
|
+
type Permission = {
|
|
1245
|
+
description: string;
|
|
1246
|
+
keys: Record<string, string>;
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
declare class Account {
|
|
1250
|
+
private readonly r;
|
|
1251
|
+
constructor(requester: AxiosInstance);
|
|
1252
|
+
info: () => Promise<User>;
|
|
1253
|
+
updateEmail: (newEmail: string, password: string) => Promise<void>;
|
|
1254
|
+
updatePassword: (newPassword: string) => Promise<void>;
|
|
1255
|
+
apiKeys: {
|
|
1256
|
+
list: () => Promise<APIKey[]>;
|
|
1257
|
+
create: (description: string, allowed_ips?: string[]) => Promise<APIKey & {
|
|
1258
|
+
secret_token: string;
|
|
1259
|
+
}>;
|
|
1260
|
+
delete: (identifier: string) => Promise<void>;
|
|
1273
1261
|
};
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
};
|
|
1262
|
+
sshKeys: {
|
|
1263
|
+
list: () => Promise<SSHKey[]>;
|
|
1264
|
+
create: (name: string, public_key: string) => Promise<SSHKey>;
|
|
1265
|
+
delete: (fingerprint: string) => Promise<void>;
|
|
1279
1266
|
};
|
|
1280
|
-
|
|
1281
|
-
remote: string;
|
|
1282
|
-
};
|
|
1267
|
+
}
|
|
1283
1268
|
|
|
1284
|
-
type
|
|
1269
|
+
type ServerAllocation = {
|
|
1285
1270
|
id: number;
|
|
1286
1271
|
ip: string;
|
|
1287
|
-
|
|
1272
|
+
ip_alias: Nullable<string>;
|
|
1288
1273
|
port: number;
|
|
1289
1274
|
notes: Nullable<string>;
|
|
1290
|
-
|
|
1275
|
+
is_default: boolean;
|
|
1291
1276
|
};
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1277
|
+
|
|
1278
|
+
type ServerSubuser = {
|
|
1279
|
+
uuid: string;
|
|
1280
|
+
username: string;
|
|
1281
|
+
email: string;
|
|
1282
|
+
language: string;
|
|
1283
|
+
image: string;
|
|
1284
|
+
admin: false;
|
|
1285
|
+
root_admin: false;
|
|
1286
|
+
"2fa_enabled": boolean;
|
|
1287
|
+
created_at: string;
|
|
1288
|
+
permissions: SubuserPermission[] | string[];
|
|
1289
|
+
};
|
|
1290
|
+
type SubuserPermission = "activity.read" | "allocation.create" | "allocation.delete" | "allocation.read" | "allocation.update" | "backup.create" | "backup.delete" | "backup.download" | "backup.read" | "backup.restore" | "control.console" | "control.restart" | "control.start" | "control.stop" | "database.create" | "database.delete" | "database.read" | "database.update" | "database.view-password" | "file.archive" | "file.create" | "file.delete" | "file.read" | "file.read-content" | "file.sftp" | "file.update" | "schedule.create" | "schedule.delete" | "schedule.read" | "schedule.update" | "settings.description" | "settings.reinstall" | "settings.rename" | "startup.docker-image" | "startup.read" | "startup.update" | "user.create" | "user.delete" | "user.read" | "user.update" | "websocket.connect";
|
|
1291
|
+
|
|
1292
|
+
type Server = {
|
|
1293
|
+
server_owner: boolean;
|
|
1294
|
+
identifier: string;
|
|
1295
|
+
internal_id?: number;
|
|
1296
|
+
uuid: string;
|
|
1297
|
+
name: string;
|
|
1298
|
+
node: string;
|
|
1299
|
+
is_node_under_maintenance: boolean;
|
|
1300
|
+
sftp_details: {
|
|
1301
|
+
ip: string;
|
|
1302
|
+
alias: Nullable<string>;
|
|
1303
|
+
port: number;
|
|
1304
|
+
};
|
|
1305
|
+
description: string;
|
|
1306
|
+
limits: ServerLimits;
|
|
1307
|
+
invocation: string;
|
|
1308
|
+
docker_image: string;
|
|
1309
|
+
egg_features: Nullable<string[]>;
|
|
1310
|
+
feature_limits: FeatureLimits;
|
|
1311
|
+
status: Nullable<unknown>;
|
|
1312
|
+
is_suspended: boolean;
|
|
1313
|
+
is_installing: boolean;
|
|
1314
|
+
is_transferring: boolean;
|
|
1315
|
+
relationships: {
|
|
1316
|
+
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
1317
|
+
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
1318
|
+
egg?: GenericResponse<{
|
|
1319
|
+
uuid: string;
|
|
1320
|
+
name: string;
|
|
1321
|
+
}, "egg">;
|
|
1322
|
+
subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
|
|
1296
1323
|
};
|
|
1297
1324
|
};
|
|
1325
|
+
type ServerStats = {
|
|
1326
|
+
current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
|
|
1327
|
+
is_suspended: boolean;
|
|
1328
|
+
resources: ServerResources;
|
|
1329
|
+
};
|
|
1330
|
+
type ServerResources = {
|
|
1331
|
+
memory_bytes: number;
|
|
1332
|
+
cpu_absolute: number;
|
|
1333
|
+
disk_bytes: number;
|
|
1334
|
+
network_tx_bytes: number;
|
|
1335
|
+
network_rx_bytes: number;
|
|
1336
|
+
uptime: number;
|
|
1337
|
+
};
|
|
1338
|
+
type ServerActivityLog = {
|
|
1339
|
+
id: string;
|
|
1340
|
+
event: string;
|
|
1341
|
+
is_api: boolean;
|
|
1342
|
+
ip: string;
|
|
1343
|
+
description: Nullable<string>;
|
|
1344
|
+
properties: Record<string, string>;
|
|
1345
|
+
has_additional_metadata: boolean;
|
|
1346
|
+
timestamp: string;
|
|
1347
|
+
};
|
|
1298
1348
|
|
|
1299
|
-
declare class
|
|
1349
|
+
declare class ServerActivity {
|
|
1300
1350
|
private readonly r;
|
|
1301
1351
|
private readonly id;
|
|
1302
|
-
constructor(
|
|
1303
|
-
list: (
|
|
1304
|
-
create: (ip: string, ports: string[], alias?: string) => Promise<void>;
|
|
1305
|
-
delete: (alloc_id: number) => Promise<void>;
|
|
1352
|
+
constructor(r: AxiosInstance, id: string);
|
|
1353
|
+
list: (page?: number, per_page?: number) => Promise<ServerActivityLog[]>;
|
|
1306
1354
|
}
|
|
1307
1355
|
|
|
1308
|
-
declare class
|
|
1356
|
+
declare class ServerAllocations {
|
|
1309
1357
|
private readonly r;
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
tags?: string[];
|
|
1318
|
-
}, include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
1319
|
-
info: (id: number, include?: ("allocations" | "location" | "servers")[]) => Promise<Node$1>;
|
|
1320
|
-
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1321
|
-
get_configuration: (id: number) => Promise<NodeConfiguration>;
|
|
1322
|
-
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1323
|
-
delete: (id: number) => Promise<void>;
|
|
1324
|
-
allocations: (server_id: number) => NodesAllocations;
|
|
1358
|
+
private readonly id;
|
|
1359
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1360
|
+
list: () => Promise<ServerAllocation[]>;
|
|
1361
|
+
autoAssign: () => Promise<ServerAllocation>;
|
|
1362
|
+
setNotes: (alloc_id: number, notes: string) => Promise<ServerAllocation>;
|
|
1363
|
+
setPrimary: (alloc_id: number) => Promise<ServerAllocation>;
|
|
1364
|
+
unassign: (alloc_id: number) => Promise<void>;
|
|
1325
1365
|
}
|
|
1326
|
-
declare const NodeCreateSchema: z.ZodObject<{
|
|
1327
|
-
name: z.ZodString;
|
|
1328
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1329
|
-
public: z.ZodOptional<z.ZodBoolean>;
|
|
1330
|
-
fqdn: z.ZodString;
|
|
1331
|
-
scheme: z.ZodEnum<{
|
|
1332
|
-
https: "https";
|
|
1333
|
-
http: "http";
|
|
1334
|
-
}>;
|
|
1335
|
-
behind_proxy: z.ZodOptional<z.ZodBoolean>;
|
|
1336
|
-
memory: z.ZodNumber;
|
|
1337
|
-
memory_overallocate: z.ZodNumber;
|
|
1338
|
-
disk: z.ZodNumber;
|
|
1339
|
-
disk_overallocate: z.ZodNumber;
|
|
1340
|
-
cpu: z.ZodNumber;
|
|
1341
|
-
cpu_overallocate: z.ZodNumber;
|
|
1342
|
-
daemon_base: z.ZodOptional<z.ZodString>;
|
|
1343
|
-
daemon_sftp: z.ZodNumber;
|
|
1344
|
-
daemon_sftp_alias: z.ZodOptional<z.ZodString>;
|
|
1345
|
-
daemon_listen: z.ZodNumber;
|
|
1346
|
-
daemon_connect: z.ZodNumber;
|
|
1347
|
-
maintenance_mode: z.ZodOptional<z.ZodBoolean>;
|
|
1348
|
-
upload_size: z.ZodNumber;
|
|
1349
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1350
|
-
}, z.core.$strip>;
|
|
1351
1366
|
|
|
1352
|
-
declare class
|
|
1367
|
+
declare class ServerBackups {
|
|
1353
1368
|
private readonly r;
|
|
1354
1369
|
private readonly id;
|
|
1355
|
-
constructor(
|
|
1356
|
-
list: () => Promise<
|
|
1357
|
-
create: (
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1370
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1371
|
+
list: (page?: number) => Promise<ServerBackup[]>;
|
|
1372
|
+
create: (args: {
|
|
1373
|
+
name?: string;
|
|
1374
|
+
is_locked: boolean;
|
|
1375
|
+
ignored_files: string[];
|
|
1376
|
+
}) => Promise<ServerBackup>;
|
|
1377
|
+
info: (backup_uuid: string) => Promise<ServerBackup>;
|
|
1378
|
+
downloadGetUrl: (backup_uuid: string) => Promise<string>;
|
|
1379
|
+
download: (backup_uuid: string) => Promise<ArrayBuffer>;
|
|
1380
|
+
delete: (backup_uuid: string) => Promise<void>;
|
|
1381
|
+
rename: (backup_uuid: string, name: string) => Promise<void>;
|
|
1382
|
+
toggleLock: (backup_uuid: string) => Promise<void>;
|
|
1383
|
+
restore: (backup_uuid: string, truncate: boolean) => Promise<void>;
|
|
1361
1384
|
}
|
|
1362
1385
|
|
|
1363
|
-
declare class
|
|
1386
|
+
declare class ServerDatabases {
|
|
1364
1387
|
private readonly r;
|
|
1365
1388
|
private readonly id;
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
updateBuild: (opts: z.infer<typeof UpdateBuildSchema>) => Promise<void>;
|
|
1372
|
-
updateStartup: (opts: z.infer<typeof UpdateStartupSchema>) => Promise<void>;
|
|
1373
|
-
suspend: () => Promise<void>;
|
|
1374
|
-
unsuspend: () => Promise<void>;
|
|
1375
|
-
reinstall: () => Promise<void>;
|
|
1376
|
-
transferStart: (node_id: number, allocation_id: number, allocation_additional?: number[]) => Promise<void>;
|
|
1377
|
-
transferCancel: () => Promise<void>;
|
|
1389
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1390
|
+
list: (include?: "password"[], page?: number) => Promise<ServerDatabase[]>;
|
|
1391
|
+
create: (database: string, remote: string) => Promise<ServerDatabase>;
|
|
1392
|
+
rotatePassword: (database_id: string) => Promise<ServerDatabase>;
|
|
1393
|
+
delete: (database_id: string) => Promise<void>;
|
|
1378
1394
|
}
|
|
1379
|
-
declare const CreateServerSchema: z.ZodObject<{
|
|
1380
|
-
external_id: z.ZodOptional<z.ZodString>;
|
|
1381
|
-
name: z.ZodString;
|
|
1382
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1383
|
-
user: z.ZodNumber;
|
|
1384
|
-
egg: z.ZodNumber;
|
|
1385
|
-
docker_image: z.ZodOptional<z.ZodString>;
|
|
1386
|
-
startup: z.ZodOptional<z.ZodString>;
|
|
1387
|
-
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1388
|
-
skip_scripts: z.ZodOptional<z.ZodBoolean>;
|
|
1389
|
-
oom_killer: z.ZodOptional<z.ZodBoolean>;
|
|
1390
|
-
start_on_completion: z.ZodOptional<z.ZodBoolean>;
|
|
1391
|
-
docker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1392
|
-
limits: z.ZodObject<{
|
|
1393
|
-
memory: z.ZodNumber;
|
|
1394
|
-
swap: z.ZodNumber;
|
|
1395
|
-
disk: z.ZodNumber;
|
|
1396
|
-
io: z.ZodNumber;
|
|
1397
|
-
threads: z.ZodOptional<z.ZodString>;
|
|
1398
|
-
cpu: z.ZodNumber;
|
|
1399
|
-
}, z.core.$strip>;
|
|
1400
|
-
feature_limits: z.ZodObject<{
|
|
1401
|
-
databases: z.ZodNumber;
|
|
1402
|
-
allocations: z.ZodNumber;
|
|
1403
|
-
backups: z.ZodNumber;
|
|
1404
|
-
}, z.core.$strip>;
|
|
1405
|
-
allocation: z.ZodOptional<z.ZodObject<{
|
|
1406
|
-
default: z.ZodString;
|
|
1407
|
-
additional: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1408
|
-
}, z.core.$strip>>;
|
|
1409
|
-
deploy: z.ZodOptional<z.ZodObject<{
|
|
1410
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1411
|
-
dedicated_ip: z.ZodOptional<z.ZodBoolean>;
|
|
1412
|
-
port_range: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1413
|
-
}, z.core.$strip>>;
|
|
1414
|
-
}, z.core.$strip>;
|
|
1415
|
-
declare const UpdateDetailsSchema: z.ZodObject<{
|
|
1416
|
-
user: z.ZodNumber;
|
|
1417
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1418
|
-
name: z.ZodString;
|
|
1419
|
-
external_id: z.ZodOptional<z.ZodString>;
|
|
1420
|
-
docker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1421
|
-
}, z.core.$strip>;
|
|
1422
|
-
declare const UpdateBuildSchema: z.ZodObject<{
|
|
1423
|
-
oom_killer: z.ZodOptional<z.ZodBoolean>;
|
|
1424
|
-
limits: z.ZodObject<{
|
|
1425
|
-
memory: z.ZodNumber;
|
|
1426
|
-
swap: z.ZodNumber;
|
|
1427
|
-
disk: z.ZodNumber;
|
|
1428
|
-
io: z.ZodNumber;
|
|
1429
|
-
threads: z.ZodOptional<z.ZodString>;
|
|
1430
|
-
cpu: z.ZodNumber;
|
|
1431
|
-
}, z.core.$strip>;
|
|
1432
|
-
feature_limits: z.ZodObject<{
|
|
1433
|
-
databases: z.ZodNumber;
|
|
1434
|
-
allocations: z.ZodNumber;
|
|
1435
|
-
backups: z.ZodNumber;
|
|
1436
|
-
}, z.core.$strip>;
|
|
1437
|
-
allocation: z.ZodOptional<z.ZodNumber>;
|
|
1438
|
-
add_allocations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1439
|
-
remove_allocations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1440
|
-
}, z.core.$strip>;
|
|
1441
|
-
declare const UpdateStartupSchema: z.ZodObject<{
|
|
1442
|
-
egg: z.ZodNumber;
|
|
1443
|
-
startup: z.ZodOptional<z.ZodString>;
|
|
1444
|
-
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1445
|
-
image: z.ZodOptional<z.ZodString>;
|
|
1446
|
-
skip_scripts: z.ZodBoolean;
|
|
1447
|
-
}, z.core.$strip>;
|
|
1448
1395
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1396
|
+
declare class ServerFiles {
|
|
1397
|
+
private readonly r;
|
|
1398
|
+
private readonly id;
|
|
1399
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1400
|
+
list: (path?: string) => Promise<FileObject[]>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Return the contents of a file. To read binary file (non-editable) use {@link download} instead
|
|
1403
|
+
*/
|
|
1404
|
+
contents: (path: string) => Promise<string>;
|
|
1405
|
+
downloadGetUrl: (path: string) => Promise<string>;
|
|
1406
|
+
download: (path: string) => Promise<ArrayBuffer>;
|
|
1407
|
+
rename: (root: string | undefined, files: {
|
|
1408
|
+
from: string;
|
|
1409
|
+
to: string;
|
|
1410
|
+
}[]) => Promise<void>;
|
|
1411
|
+
copy: (location: string) => Promise<void>;
|
|
1412
|
+
write: (path: string, content: string) => Promise<void>;
|
|
1413
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
1414
|
+
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
1415
|
+
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
1416
|
+
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
1417
|
+
chmod: (root: string | undefined, files: Array<{
|
|
1418
|
+
file: string;
|
|
1419
|
+
mode: number;
|
|
1420
|
+
}>) => Promise<void>;
|
|
1421
|
+
pullFromRemote: (url: string, directory?: string, filename?: string, // Unused
|
|
1422
|
+
use_header?: boolean, // Unused
|
|
1423
|
+
foreground?: boolean) => Promise<void>;
|
|
1424
|
+
uploadGetUrl: () => Promise<string>;
|
|
1425
|
+
upload: (file: File, root?: string) => Promise<void>;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
declare class ServerSchedules {
|
|
1429
|
+
private readonly r;
|
|
1430
|
+
private readonly id;
|
|
1431
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1432
|
+
list: () => Promise<Schedule[]>;
|
|
1433
|
+
create: (params: ScheduleCreateParams) => Promise<Schedule>;
|
|
1434
|
+
control: (sched_id: number) => ScheduleControl;
|
|
1435
|
+
}
|
|
1436
|
+
type ScheduleCreateParams = {
|
|
1451
1437
|
name: string;
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1438
|
+
is_active?: boolean;
|
|
1439
|
+
only_when_online?: boolean;
|
|
1440
|
+
minute: string;
|
|
1441
|
+
hour: string;
|
|
1442
|
+
day_of_week: string;
|
|
1443
|
+
month: string;
|
|
1444
|
+
day_of_month: string;
|
|
1457
1445
|
};
|
|
1446
|
+
declare class ScheduleControl {
|
|
1447
|
+
private r;
|
|
1448
|
+
private readonly id;
|
|
1449
|
+
private readonly sched_id;
|
|
1450
|
+
constructor(requester: AxiosInstance, id: string, sched_id: number);
|
|
1451
|
+
info: () => Promise<Schedule>;
|
|
1452
|
+
update: (params: ScheduleCreateParams) => Promise<Schedule>;
|
|
1453
|
+
delete: () => Promise<void>;
|
|
1454
|
+
execute: () => Promise<void>;
|
|
1455
|
+
tasks: {
|
|
1456
|
+
create: (opts: PartialBy<Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">, "payload" | "sequence_id" | "continue_on_failure">) => Promise<ScheduleTask>;
|
|
1457
|
+
update: <T extends "command" | "power" | "backup" | "delete_files">(task_id: number, opts: PartialBy<Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">, "payload" | "sequence_id" | "continue_on_failure">) => Promise<ScheduleTask>;
|
|
1458
|
+
delete: (task_id: number) => Promise<void>;
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1458
1461
|
|
|
1459
|
-
declare class
|
|
1462
|
+
declare class ServerSettings {
|
|
1460
1463
|
private readonly r;
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
}
|
|
1468
|
-
declare const CreateDBHostSchema: z.ZodObject<{
|
|
1469
|
-
name: z.ZodString;
|
|
1470
|
-
host: z.ZodString;
|
|
1471
|
-
port: z.ZodNumber;
|
|
1472
|
-
username: z.ZodString;
|
|
1473
|
-
password: z.ZodOptional<z.ZodString>;
|
|
1474
|
-
node_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1475
|
-
max_databases: z.ZodOptional<z.ZodNumber>;
|
|
1476
|
-
}, z.core.$strip>;
|
|
1464
|
+
private readonly id;
|
|
1465
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1466
|
+
rename: (name: string) => Promise<void>;
|
|
1467
|
+
updateDescription: (description: Nullable<string>) => Promise<void>;
|
|
1468
|
+
reinstall: () => Promise<void>;
|
|
1469
|
+
changeDockerImage: (image: string) => Promise<void>;
|
|
1470
|
+
}
|
|
1477
1471
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1472
|
+
declare class ServerStartup {
|
|
1473
|
+
private readonly r;
|
|
1474
|
+
private readonly id;
|
|
1475
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1476
|
+
list: () => Promise<CustomListResponse<StartupParams, StartupMeta>>;
|
|
1477
|
+
set: (key: string, value: string) => Promise<StartupParams>;
|
|
1478
|
+
}
|
|
1484
1479
|
|
|
1485
|
-
declare class
|
|
1480
|
+
declare class ServerUsers {
|
|
1486
1481
|
private readonly r;
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
create: (
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
name: string;
|
|
1495
|
-
}) => Promise<void>;
|
|
1496
|
-
delete: (id: number) => Promise<void>;
|
|
1482
|
+
private readonly id;
|
|
1483
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1484
|
+
list: () => Promise<ServerSubuser[]>;
|
|
1485
|
+
create: (email: string, permissions: SubuserPermission[] | string[]) => Promise<ServerSubuser>;
|
|
1486
|
+
info: (user_uuid: string) => Promise<ServerSubuser>;
|
|
1487
|
+
update: (user_uuid: string, permissions: SubuserPermission[] | string[]) => Promise<ServerSubuser>;
|
|
1488
|
+
delete: (user_uuid: string) => Promise<void>;
|
|
1497
1489
|
}
|
|
1498
1490
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1491
|
+
/**
|
|
1492
|
+
* Source: https://github.com/pterodactyl/panel/blob/1.0-develop/resources/scripts/components/server/events.ts
|
|
1493
|
+
*/
|
|
1494
|
+
declare enum SOCKET_EVENT {
|
|
1495
|
+
AUTH_SUCCESS = "auth success",
|
|
1496
|
+
DAEMON_MESSAGE = "daemon message",
|
|
1497
|
+
DAEMON_ERROR = "daemon error",
|
|
1498
|
+
INSTALL_OUTPUT = "install output",
|
|
1499
|
+
INSTALL_STARTED = "install started",
|
|
1500
|
+
INSTALL_COMPLETED = "install completed",
|
|
1501
|
+
CONSOLE_OUTPUT = "console output",
|
|
1502
|
+
STATUS = "status",
|
|
1503
|
+
STATS = "stats",
|
|
1504
|
+
TRANSFER_LOGS = "transfer logs",
|
|
1505
|
+
TRANSFER_STATUS = "transfer status",
|
|
1506
|
+
BACKUP_COMPLETED = "backup completed",
|
|
1507
|
+
BACKUP_RESTORE_COMPLETED = "backup restore completed",
|
|
1508
|
+
TOKEN_EXPIRING = "token expiring",
|
|
1509
|
+
TOKEN_EXPIRED = "token expired",
|
|
1510
|
+
JWT_ERROR = "jwt error"
|
|
1511
|
+
}
|
|
1512
|
+
type BackupCompletedJson = {
|
|
1513
|
+
checksum: string;
|
|
1514
|
+
checksum_type: "sha1";
|
|
1515
|
+
file_size: number;
|
|
1516
|
+
is_successful: boolean;
|
|
1501
1517
|
uuid: string;
|
|
1502
|
-
name: string;
|
|
1503
|
-
author: string;
|
|
1504
|
-
description: string;
|
|
1505
|
-
features: string[];
|
|
1506
|
-
tags: string[];
|
|
1507
|
-
docker_image: Nullable<string>;
|
|
1508
|
-
docker_images: Record<string, string>;
|
|
1509
|
-
config: {
|
|
1510
|
-
files: Record<string, FileConfig>;
|
|
1511
|
-
startup: Record<string, string>;
|
|
1512
|
-
stop: string;
|
|
1513
|
-
logs: object | [];
|
|
1514
|
-
file_denylist: string[];
|
|
1515
|
-
extends: Nullable<number>;
|
|
1516
|
-
};
|
|
1517
|
-
startup: string;
|
|
1518
|
-
startup_commands: Record<string, string>;
|
|
1519
|
-
script: {
|
|
1520
|
-
privileged: boolean;
|
|
1521
|
-
install: string;
|
|
1522
|
-
entry: string;
|
|
1523
|
-
container: string;
|
|
1524
|
-
extends: Nullable<number>;
|
|
1525
|
-
};
|
|
1526
|
-
created_at: string;
|
|
1527
|
-
updated_at: Nullable<string>;
|
|
1528
|
-
};
|
|
1529
|
-
type FileConfig = {
|
|
1530
|
-
parser: string;
|
|
1531
|
-
find: Record<string, string>;
|
|
1532
|
-
};
|
|
1533
|
-
type ApplicationEggVariable = Omit<EggVariable, "server_value" | "is_editable" | "rules"> & {
|
|
1534
|
-
rules: string[];
|
|
1535
|
-
sort: number;
|
|
1536
|
-
user_viewable: boolean;
|
|
1537
|
-
user_editable: boolean;
|
|
1538
1518
|
};
|
|
1539
|
-
type
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
description: string;
|
|
1548
|
-
uuid: string;
|
|
1549
|
-
image: Nullable<string>;
|
|
1550
|
-
docker_images: Record<string, string>;
|
|
1551
|
-
features: string[];
|
|
1552
|
-
tags: string[];
|
|
1553
|
-
file_denylist: string[];
|
|
1554
|
-
startup_commands: Record<string, string>;
|
|
1555
|
-
config: Omit<Egg["config"], "extends" | "file_denylist">;
|
|
1556
|
-
scripts: {
|
|
1557
|
-
installation: {
|
|
1558
|
-
script: string;
|
|
1559
|
-
container: string;
|
|
1560
|
-
entrypoint: string;
|
|
1561
|
-
};
|
|
1519
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
1520
|
+
type StatsWsJson = {
|
|
1521
|
+
memory_bytes: number;
|
|
1522
|
+
memory_limit_bytes: number;
|
|
1523
|
+
cpu_absolute: number;
|
|
1524
|
+
network: {
|
|
1525
|
+
rx_bytes: number;
|
|
1526
|
+
tx_bytes: number;
|
|
1562
1527
|
};
|
|
1563
|
-
|
|
1528
|
+
state: PowerState;
|
|
1529
|
+
uptime: number;
|
|
1530
|
+
disk_bytes: number;
|
|
1564
1531
|
};
|
|
1565
1532
|
|
|
1566
|
-
|
|
1533
|
+
type SocketEventPayloadMap = {
|
|
1534
|
+
[SOCKET_EVENT.AUTH_SUCCESS]: undefined;
|
|
1535
|
+
[SOCKET_EVENT.STATUS]: PowerState;
|
|
1536
|
+
[SOCKET_EVENT.CONSOLE_OUTPUT]: string;
|
|
1537
|
+
[SOCKET_EVENT.STATS]: StatsWsJson;
|
|
1538
|
+
[SOCKET_EVENT.DAEMON_ERROR]: undefined;
|
|
1539
|
+
[SOCKET_EVENT.DAEMON_MESSAGE]: string;
|
|
1540
|
+
[SOCKET_EVENT.INSTALL_OUTPUT]: string;
|
|
1541
|
+
[SOCKET_EVENT.INSTALL_STARTED]: undefined;
|
|
1542
|
+
[SOCKET_EVENT.INSTALL_COMPLETED]: undefined;
|
|
1543
|
+
[SOCKET_EVENT.TRANSFER_LOGS]: string;
|
|
1544
|
+
[SOCKET_EVENT.TRANSFER_STATUS]: string;
|
|
1545
|
+
[SOCKET_EVENT.BACKUP_COMPLETED]: BackupCompletedJson;
|
|
1546
|
+
[SOCKET_EVENT.BACKUP_RESTORE_COMPLETED]: undefined;
|
|
1547
|
+
[SOCKET_EVENT.TOKEN_EXPIRING]: undefined;
|
|
1548
|
+
[SOCKET_EVENT.TOKEN_EXPIRED]: undefined;
|
|
1549
|
+
[SOCKET_EVENT.JWT_ERROR]: string;
|
|
1550
|
+
};
|
|
1551
|
+
type Listener<E extends SOCKET_EVENT> = SocketEventPayloadMap[E] extends undefined ? () => void : (payload: SocketEventPayloadMap[E]) => void;
|
|
1552
|
+
type CloseEventLike = Parameters<NonNullable<WebSocket["onclose"]>>[0];
|
|
1553
|
+
type ErrorEventLike = Parameters<NonNullable<WebSocket["onerror"]>>[0];
|
|
1554
|
+
declare class ServerWebsocket {
|
|
1567
1555
|
private readonly r;
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1556
|
+
private readonly serverId;
|
|
1557
|
+
private socket?;
|
|
1558
|
+
private currentToken?;
|
|
1559
|
+
private readonly bus;
|
|
1560
|
+
private debugLogging;
|
|
1561
|
+
private stripColors;
|
|
1562
|
+
private detachMessageListener?;
|
|
1563
|
+
constructor(requester: AxiosInstance, id: string, stripColors?: boolean);
|
|
1564
|
+
on<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): () => void;
|
|
1565
|
+
deregister<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): void;
|
|
1566
|
+
private emit;
|
|
1567
|
+
connect(resumable?: boolean, debugLogging?: boolean): Promise<void>;
|
|
1568
|
+
onSocketDisconnect(handler: (event: CloseEventLike) => void): void;
|
|
1569
|
+
onSocketError(handler: (event: ErrorEventLike) => void): void;
|
|
1570
|
+
makeResumable(disconnectsToo: boolean): void;
|
|
1571
|
+
private attachMessageListener;
|
|
1572
|
+
private handleIncomingMessage;
|
|
1573
|
+
private parseMessage;
|
|
1574
|
+
private normalisePayload;
|
|
1575
|
+
private dispatchMessage;
|
|
1576
|
+
private refreshCredentials;
|
|
1577
|
+
private authenticate;
|
|
1578
|
+
disconnect(): void;
|
|
1579
|
+
requestStats(): void;
|
|
1580
|
+
requestLogs(): void;
|
|
1581
|
+
private send;
|
|
1582
|
+
getStats(): Promise<StatsWsJson>;
|
|
1583
|
+
getLogs(): Promise<string[]>;
|
|
1584
|
+
sendPoweraction(action: ServerSignalOption): void;
|
|
1585
|
+
sendCommand(cmd: string): void;
|
|
1573
1586
|
}
|
|
1574
1587
|
|
|
1575
|
-
|
|
1576
|
-
id: number;
|
|
1577
|
-
uuid: string;
|
|
1578
|
-
name: string;
|
|
1579
|
-
description: Nullable<string>;
|
|
1580
|
-
source: string;
|
|
1581
|
-
target: string;
|
|
1582
|
-
read_only: boolean;
|
|
1583
|
-
user_mountable: boolean;
|
|
1584
|
-
};
|
|
1585
|
-
|
|
1586
|
-
declare class Mounts {
|
|
1588
|
+
declare class ServerClient {
|
|
1587
1589
|
private readonly r;
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1590
|
+
private readonly id;
|
|
1591
|
+
activity: ServerActivity;
|
|
1592
|
+
databases: ServerDatabases;
|
|
1593
|
+
files: ServerFiles;
|
|
1594
|
+
schedules: ServerSchedules;
|
|
1595
|
+
allocations: ServerAllocations;
|
|
1596
|
+
users: ServerUsers;
|
|
1597
|
+
backups: ServerBackups;
|
|
1598
|
+
startup: ServerStartup;
|
|
1599
|
+
variables: ServerStartup;
|
|
1600
|
+
settings: ServerSettings;
|
|
1601
|
+
constructor(requester: AxiosInstance, id: string);
|
|
1602
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<Server>;
|
|
1603
|
+
websocket: (stripColors?: boolean) => ServerWebsocket;
|
|
1604
|
+
resources: () => Promise<ServerStats>;
|
|
1605
|
+
command: (command: string) => Promise<void>;
|
|
1606
|
+
power: (signal: "start" | "stop" | "restart" | "kill") => Promise<void>;
|
|
1603
1607
|
}
|
|
1604
|
-
declare const CreateMountSchema: z.ZodObject<{
|
|
1605
|
-
name: z.ZodString;
|
|
1606
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1607
|
-
source: z.ZodString;
|
|
1608
|
-
target: z.ZodString;
|
|
1609
|
-
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
1610
|
-
}, z.core.$strip>;
|
|
1611
1608
|
|
|
1612
1609
|
declare class Client {
|
|
1610
|
+
account: Account;
|
|
1613
1611
|
private readonly r;
|
|
1614
|
-
users: Users;
|
|
1615
|
-
nodes: Nodes;
|
|
1616
|
-
databaseHosts: DatabaseHosts;
|
|
1617
|
-
roles: Roles;
|
|
1618
|
-
eggs: Eggs;
|
|
1619
|
-
mounts: Mounts;
|
|
1620
1612
|
constructor(requester: AxiosInstance);
|
|
1621
1613
|
get $r(): AxiosInstance;
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
servers: (server_id: number) => Servers;
|
|
1614
|
+
listPermissions: () => Promise<Record<string, Permission>>;
|
|
1615
|
+
listServers: (type?: "accessible" | "mine" | "admin" | "admin-all", page?: number, per_page?: number, include?: ("egg" | "subusers")[]) => Promise<Server[]>;
|
|
1616
|
+
server: (uuid: string) => ServerClient;
|
|
1626
1617
|
}
|
|
1627
1618
|
|
|
1628
|
-
declare class PelicanAPIClient extends Client
|
|
1619
|
+
declare class PelicanAPIClient extends Client {
|
|
1629
1620
|
constructor(url: string, token: string, suffix?: string);
|
|
1630
1621
|
}
|
|
1631
|
-
declare class PelicanAPIApplication extends Client {
|
|
1622
|
+
declare class PelicanAPIApplication extends Client$1 {
|
|
1632
1623
|
constructor(url: string, token: string, suffix?: string);
|
|
1633
1624
|
}
|
|
1634
1625
|
|