@pelican.ts/sdk 0.2.4 → 0.3.0
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 +4 -4
- package/dist/index.d.mts +118 -36
- package/dist/index.d.ts +118 -36
- package/dist/index.js +97 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -3
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1121 -0
- package/package.json +11 -3
- package/scripts/create-types.ts +24 -0
- package/src/api/application/client.ts +13 -7
- package/src/api/application/eggs.ts +31 -0
- package/src/api/application/mounts.ts +96 -0
- package/src/api/application/nodes.ts +1 -1
- package/src/api/application/servers.ts +3 -3
- package/src/api/application/types/egg.ts +37 -0
- package/src/api/application/types/index.ts +10 -0
- package/src/api/application/types/mount.ts +12 -0
- package/src/api/application/types/node.ts +2 -2
- package/src/api/application/types/server.ts +1 -1
- package/src/api/application/types/server_allocation.ts +2 -2
- package/src/api/application/types/user.ts +3 -3
- package/src/api/application/users.ts +11 -11
- package/src/api/client/server_allocations.ts +9 -9
- package/src/api/client/server_backups.ts +7 -7
- package/src/api/client/types/index.ts +5 -0
- package/src/api/client/types/server.ts +2 -2
- package/src/api/client/types/server_allocation.ts +1 -1
- package/src/api/common/types/index.ts +9 -0
- package/src/api/common/types/server_backup.ts +1 -1
- package/src/types.ts +3 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<img src=".github/logo.png" width="420" />
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
-
# Pelican.ts Typescript
|
|
5
|
+
# Pelican.ts — Typescript client for Pelican panel
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
```shell
|
|
@@ -27,15 +27,15 @@ main()
|
|
|
27
27
|
|
|
28
28
|
What's done:
|
|
29
29
|
- [X] Client
|
|
30
|
-
- [
|
|
30
|
+
- [X] Application
|
|
31
31
|
- [X] Users
|
|
32
32
|
- [X] Nodes
|
|
33
33
|
- [X] Servers
|
|
34
34
|
- [X] Databases (TODO: Check if server database type is valid)
|
|
35
35
|
- [X] Database Hosts (TODO: find out why create API returns 500 No Route)
|
|
36
36
|
- [X] Roles
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
37
|
+
- [X] Eggs
|
|
38
|
+
- [X] Mounts
|
|
39
39
|
- [ ] TSDoc
|
|
40
40
|
- [ ] Examples
|
|
41
41
|
- [ ] Tests
|
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,7 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
|
15
15
|
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
16
16
|
type Nullable<T> = T | null;
|
|
17
17
|
|
|
18
|
-
type User
|
|
18
|
+
type User = {
|
|
19
19
|
uuid: string;
|
|
20
20
|
username: string;
|
|
21
21
|
email: string;
|
|
@@ -48,7 +48,7 @@ type Permission = {
|
|
|
48
48
|
declare class Account {
|
|
49
49
|
private readonly r;
|
|
50
50
|
constructor(requester: AxiosInstance);
|
|
51
|
-
info: () => Promise<User
|
|
51
|
+
info: () => Promise<User>;
|
|
52
52
|
updateEmail: (newEmail: string, password: string) => Promise<void>;
|
|
53
53
|
updatePassword: (newPassword: string) => Promise<void>;
|
|
54
54
|
apiKeys: {
|
|
@@ -140,7 +140,7 @@ type FeatureLimits = {
|
|
|
140
140
|
backups: number;
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
type
|
|
143
|
+
type ServerAllocation = {
|
|
144
144
|
id: number;
|
|
145
145
|
ip: string;
|
|
146
146
|
alias: Nullable<string>;
|
|
@@ -149,7 +149,7 @@ type Allocation$1 = {
|
|
|
149
149
|
is_default: boolean;
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
type Server
|
|
152
|
+
type Server = {
|
|
153
153
|
server_owner: boolean;
|
|
154
154
|
identifier: string;
|
|
155
155
|
internal_id?: number;
|
|
@@ -173,7 +173,7 @@ type Server$1 = {
|
|
|
173
173
|
is_installing: boolean;
|
|
174
174
|
is_transferring: boolean;
|
|
175
175
|
relationships: {
|
|
176
|
-
allocations: GenericListResponse<GenericResponse<
|
|
176
|
+
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
177
177
|
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
178
178
|
egg?: GenericResponse<{
|
|
179
179
|
uuid: string;
|
|
@@ -347,10 +347,10 @@ declare class ServerAllocations {
|
|
|
347
347
|
private readonly r;
|
|
348
348
|
private readonly id;
|
|
349
349
|
constructor(requester: AxiosInstance, id: string);
|
|
350
|
-
list: () => Promise<
|
|
351
|
-
autoAssign: () => Promise<
|
|
352
|
-
setNotes: (alloc_id: number, notes: string) => Promise<
|
|
353
|
-
setPrimary: (alloc_id: number) => Promise<
|
|
350
|
+
list: () => Promise<ServerAllocation[]>;
|
|
351
|
+
autoAssign: () => Promise<ServerAllocation>;
|
|
352
|
+
setNotes: (alloc_id: number, notes: string) => Promise<ServerAllocation>;
|
|
353
|
+
setPrimary: (alloc_id: number) => Promise<ServerAllocation>;
|
|
354
354
|
unassign: (alloc_id: number) => Promise<void>;
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -365,7 +365,7 @@ declare class ServerUsers {
|
|
|
365
365
|
delete: (user_id: number) => Promise<void>;
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
type
|
|
368
|
+
type ServerBackup = {
|
|
369
369
|
uuid: string;
|
|
370
370
|
is_successful: boolean;
|
|
371
371
|
is_locked: boolean;
|
|
@@ -381,13 +381,13 @@ declare class ServerBackups {
|
|
|
381
381
|
private readonly r;
|
|
382
382
|
private readonly id;
|
|
383
383
|
constructor(requester: AxiosInstance, id: string);
|
|
384
|
-
list: (page?: number) => Promise<
|
|
384
|
+
list: (page?: number) => Promise<ServerBackup[]>;
|
|
385
385
|
create: (args: {
|
|
386
386
|
name?: string;
|
|
387
387
|
is_locked: boolean;
|
|
388
388
|
ignored_files: string[];
|
|
389
|
-
}) => Promise<
|
|
390
|
-
info: (backup_uuid: string) => Promise<
|
|
389
|
+
}) => Promise<ServerBackup>;
|
|
390
|
+
info: (backup_uuid: string) => Promise<ServerBackup>;
|
|
391
391
|
downloadGetUrl: (backup_uuid: string) => Promise<string>;
|
|
392
392
|
download: (backup_uuid: string) => Promise<ArrayBuffer>;
|
|
393
393
|
delete: (backup_uuid: string) => Promise<void>;
|
|
@@ -545,7 +545,7 @@ declare class ServerClient {
|
|
|
545
545
|
variables: ServerStartup;
|
|
546
546
|
settings: ServerSettings;
|
|
547
547
|
constructor(requester: AxiosInstance, id: string);
|
|
548
|
-
info: (include?: ("egg" | "subusers")[]) => Promise<Server
|
|
548
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<Server>;
|
|
549
549
|
websocket: (stripColors?: boolean) => ServerWebsocket;
|
|
550
550
|
resources: () => Promise<ServerStats>;
|
|
551
551
|
command: (command: string) => Promise<void>;
|
|
@@ -557,7 +557,7 @@ declare class Client$1 {
|
|
|
557
557
|
private readonly r;
|
|
558
558
|
constructor(requester: AxiosInstance);
|
|
559
559
|
listPermissions: () => Promise<Record<string, Permission>>;
|
|
560
|
-
listServers: (type?: "accessible" | "mine" | "admin" | "admin-all", page?: number, per_page?: number, include?: ("egg" | "subusers")[]) => Promise<Server
|
|
560
|
+
listServers: (type?: "accessible" | "mine" | "admin" | "admin-all", page?: number, per_page?: number, include?: ("egg" | "subusers")[]) => Promise<Server[]>;
|
|
561
561
|
server: (uuid: string) => ServerClient;
|
|
562
562
|
}
|
|
563
563
|
|
|
@@ -571,7 +571,7 @@ type Container = {
|
|
|
571
571
|
network_mode: string;
|
|
572
572
|
};
|
|
573
573
|
|
|
574
|
-
type
|
|
574
|
+
type ApplicationServer = {
|
|
575
575
|
id: number;
|
|
576
576
|
external_id: Nullable<string>;
|
|
577
577
|
uuid: string;
|
|
@@ -591,7 +591,7 @@ type Server = {
|
|
|
591
591
|
updated_at: Nullable<string>;
|
|
592
592
|
};
|
|
593
593
|
|
|
594
|
-
type
|
|
594
|
+
type ApplicationUser = {
|
|
595
595
|
id: number;
|
|
596
596
|
external_id: Nullable<string>;
|
|
597
597
|
uuid: string;
|
|
@@ -604,22 +604,22 @@ type User = {
|
|
|
604
604
|
created_at: string;
|
|
605
605
|
updated_at: Nullable<string>;
|
|
606
606
|
relationships?: {
|
|
607
|
-
servers: GenericListResponse<GenericResponse<
|
|
607
|
+
servers: GenericListResponse<GenericResponse<ApplicationServer>>;
|
|
608
608
|
};
|
|
609
609
|
};
|
|
610
610
|
|
|
611
611
|
declare class Users {
|
|
612
612
|
private readonly r;
|
|
613
613
|
constructor(requester: AxiosInstance);
|
|
614
|
-
list: (opts: ListType, page?: number) => Promise<
|
|
614
|
+
list: (opts: ListType, page?: number) => Promise<ApplicationUser[]>;
|
|
615
615
|
info: (id: number, { include }: {
|
|
616
616
|
include?: ("servers")[];
|
|
617
|
-
}) => Promise<
|
|
617
|
+
}) => Promise<ApplicationUser>;
|
|
618
618
|
infoByExternal: (external_id: string, { include }: {
|
|
619
619
|
include?: ("servers")[];
|
|
620
|
-
}) => Promise<
|
|
621
|
-
create: (user: z.infer<typeof CreateSchema>) => Promise<
|
|
622
|
-
update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<
|
|
620
|
+
}) => Promise<ApplicationUser>;
|
|
621
|
+
create: (user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
|
|
622
|
+
update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
|
|
623
623
|
delete: (id: number) => Promise<void>;
|
|
624
624
|
addRoles: (id: number, roles: number[]) => Promise<void>;
|
|
625
625
|
removeRoles: (id: number, roles: number[]) => Promise<void>;
|
|
@@ -1205,7 +1205,7 @@ type Location = {
|
|
|
1205
1205
|
updated_at: string | null;
|
|
1206
1206
|
};
|
|
1207
1207
|
|
|
1208
|
-
type Node = {
|
|
1208
|
+
type Node$1 = {
|
|
1209
1209
|
id: number;
|
|
1210
1210
|
uuid: string;
|
|
1211
1211
|
public: boolean;
|
|
@@ -1238,7 +1238,7 @@ type Node = {
|
|
|
1238
1238
|
relationships?: {
|
|
1239
1239
|
allocations?: GenericListResponse<GenericResponse<Allocation, "allocation">>;
|
|
1240
1240
|
location?: GenericResponse<Location, "location">;
|
|
1241
|
-
servers?: GenericListResponse<GenericResponse<
|
|
1241
|
+
servers?: GenericListResponse<GenericResponse<ApplicationServer, "server">>;
|
|
1242
1242
|
};
|
|
1243
1243
|
};
|
|
1244
1244
|
type NodeConfiguration = {
|
|
@@ -1276,8 +1276,8 @@ type Allocation = {
|
|
|
1276
1276
|
};
|
|
1277
1277
|
type AllocationRel = Allocation & {
|
|
1278
1278
|
relationships?: {
|
|
1279
|
-
node?: GenericResponse<Node, "node">;
|
|
1280
|
-
server?: GenericResponse<
|
|
1279
|
+
node?: GenericResponse<Node$1, "node">;
|
|
1280
|
+
server?: GenericResponse<ApplicationServer, "server">;
|
|
1281
1281
|
};
|
|
1282
1282
|
};
|
|
1283
1283
|
|
|
@@ -1293,18 +1293,18 @@ declare class NodesAllocations {
|
|
|
1293
1293
|
declare class Nodes {
|
|
1294
1294
|
private readonly r;
|
|
1295
1295
|
constructor(requester: AxiosInstance);
|
|
1296
|
-
list: (include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node[]>;
|
|
1296
|
+
list: (include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
1297
1297
|
listDeployable: (filters: {
|
|
1298
1298
|
disk: number;
|
|
1299
1299
|
memory: number;
|
|
1300
1300
|
cpu?: number;
|
|
1301
1301
|
location_ids?: string[];
|
|
1302
1302
|
tags?: string[];
|
|
1303
|
-
}, include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node[]>;
|
|
1304
|
-
info: (id: number, include?: ("allocations" | "location" | "servers")[]) => Promise<Node>;
|
|
1305
|
-
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node>;
|
|
1303
|
+
}, include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
1304
|
+
info: (id: number, include?: ("allocations" | "location" | "servers")[]) => Promise<Node$1>;
|
|
1305
|
+
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1306
1306
|
get_configuration: (id: number) => Promise<NodeConfiguration>;
|
|
1307
|
-
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node>;
|
|
1307
|
+
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1308
1308
|
delete: (id: number) => Promise<void>;
|
|
1309
1309
|
allocations: (server_id: number) => NodesAllocations;
|
|
1310
1310
|
}
|
|
@@ -1350,7 +1350,7 @@ declare class Servers {
|
|
|
1350
1350
|
private readonly id;
|
|
1351
1351
|
databases: ServersDatabases;
|
|
1352
1352
|
constructor(r: AxiosInstance, server_id: number);
|
|
1353
|
-
info: (include?: ("egg" | "subusers")[]) => Promise<
|
|
1353
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
1354
1354
|
delete: (force?: boolean) => Promise<void>;
|
|
1355
1355
|
updateDetails: (opts: z.infer<typeof UpdateDetailsSchema>) => Promise<void>;
|
|
1356
1356
|
updateBuild: (opts: z.infer<typeof UpdateBuildSchema>) => Promise<void>;
|
|
@@ -1479,16 +1479,98 @@ declare class Roles {
|
|
|
1479
1479
|
delete: (id: number) => Promise<void>;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
+
type Egg = {
|
|
1483
|
+
id: number;
|
|
1484
|
+
uuid: string;
|
|
1485
|
+
name: number;
|
|
1486
|
+
author: string;
|
|
1487
|
+
description: string;
|
|
1488
|
+
features: string[];
|
|
1489
|
+
tags: string[];
|
|
1490
|
+
docker_image: string;
|
|
1491
|
+
docker_images: Record<string, string>;
|
|
1492
|
+
config: {
|
|
1493
|
+
files: Record<string, FileConfig>;
|
|
1494
|
+
startup: Record<string, string>;
|
|
1495
|
+
stop: string;
|
|
1496
|
+
logs: object | [];
|
|
1497
|
+
file_denylist: string[];
|
|
1498
|
+
extends: Nullable<number>;
|
|
1499
|
+
};
|
|
1500
|
+
startup: string;
|
|
1501
|
+
startup_commands: Record<string, string>;
|
|
1502
|
+
script: {
|
|
1503
|
+
privileged: boolean;
|
|
1504
|
+
install: string;
|
|
1505
|
+
entry: string;
|
|
1506
|
+
container: string;
|
|
1507
|
+
extends: Nullable<number>;
|
|
1508
|
+
};
|
|
1509
|
+
created_at: string;
|
|
1510
|
+
updated_at: Nullable<string>;
|
|
1511
|
+
};
|
|
1512
|
+
type FileConfig = {
|
|
1513
|
+
parser: string;
|
|
1514
|
+
find: Record<string, string>;
|
|
1515
|
+
};
|
|
1516
|
+
|
|
1517
|
+
declare class Eggs {
|
|
1518
|
+
private readonly r;
|
|
1519
|
+
constructor(r: AxiosInstance);
|
|
1520
|
+
list: () => Promise<Egg[]>;
|
|
1521
|
+
info: (id: number) => Promise<Egg>;
|
|
1522
|
+
export: (id: number, format: "json" | "yaml") => Promise<string>;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
type Mount = {
|
|
1526
|
+
id: number;
|
|
1527
|
+
uuid: string;
|
|
1528
|
+
name: string;
|
|
1529
|
+
description: Nullable<string>;
|
|
1530
|
+
source: string;
|
|
1531
|
+
target: string;
|
|
1532
|
+
read_only: boolean;
|
|
1533
|
+
user_mountable: boolean;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
declare class Mounts {
|
|
1537
|
+
private readonly r;
|
|
1538
|
+
constructor(r: AxiosInstance);
|
|
1539
|
+
list: () => Promise<Mount[]>;
|
|
1540
|
+
info: (id: number) => Promise<Mount>;
|
|
1541
|
+
create: (opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
1542
|
+
update: (id: number, opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
1543
|
+
delete: (id: number) => Promise<void>;
|
|
1544
|
+
listAssignedEggs: (id: number) => Promise<Egg[]>;
|
|
1545
|
+
assignEggs: (id: number, eggs: number[]) => Promise<void>;
|
|
1546
|
+
unassignEgg: (id: number, egg_id: number) => Promise<void>;
|
|
1547
|
+
listAssignedNodes: (id: number) => Promise<Node[]>;
|
|
1548
|
+
assignNodes: (id: number, nodes: number[]) => Promise<void>;
|
|
1549
|
+
unassignNode: (id: number, node_id: number) => Promise<void>;
|
|
1550
|
+
listAssignedServers: (id: number) => Promise<ApplicationServer[]>;
|
|
1551
|
+
assignServers: (id: number, servers: number[]) => Promise<void>;
|
|
1552
|
+
unassignServer: (id: number, server_id: number) => Promise<void>;
|
|
1553
|
+
}
|
|
1554
|
+
declare const CreateMountSchema: z.ZodObject<{
|
|
1555
|
+
name: z.ZodString;
|
|
1556
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1557
|
+
source: z.ZodString;
|
|
1558
|
+
target: z.ZodString;
|
|
1559
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
1560
|
+
}, z.core.$strip>;
|
|
1561
|
+
|
|
1482
1562
|
declare class Client {
|
|
1483
1563
|
private readonly r;
|
|
1484
1564
|
users: Users;
|
|
1485
1565
|
nodes: Nodes;
|
|
1486
1566
|
databaseHosts: DatabaseHosts;
|
|
1487
1567
|
roles: Roles;
|
|
1568
|
+
eggs: Eggs;
|
|
1569
|
+
mounts: Mounts;
|
|
1488
1570
|
constructor(requester: AxiosInstance);
|
|
1489
|
-
listServers: (search?: string, page?: number) => Promise<
|
|
1490
|
-
createServer: (opts: z.infer<typeof CreateServerSchema>) => Promise<
|
|
1491
|
-
getServerByExternalId: (external_id: string, include?: ("egg" | "subusers")[]) => Promise<
|
|
1571
|
+
listServers: (search?: string, page?: number) => Promise<ApplicationServer[]>;
|
|
1572
|
+
createServer: (opts: z.infer<typeof CreateServerSchema>) => Promise<ApplicationServer>;
|
|
1573
|
+
getServerByExternalId: (external_id: string, include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
1492
1574
|
servers: (server_id: number) => Servers;
|
|
1493
1575
|
}
|
|
1494
1576
|
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
|
15
15
|
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
16
16
|
type Nullable<T> = T | null;
|
|
17
17
|
|
|
18
|
-
type User
|
|
18
|
+
type User = {
|
|
19
19
|
uuid: string;
|
|
20
20
|
username: string;
|
|
21
21
|
email: string;
|
|
@@ -48,7 +48,7 @@ type Permission = {
|
|
|
48
48
|
declare class Account {
|
|
49
49
|
private readonly r;
|
|
50
50
|
constructor(requester: AxiosInstance);
|
|
51
|
-
info: () => Promise<User
|
|
51
|
+
info: () => Promise<User>;
|
|
52
52
|
updateEmail: (newEmail: string, password: string) => Promise<void>;
|
|
53
53
|
updatePassword: (newPassword: string) => Promise<void>;
|
|
54
54
|
apiKeys: {
|
|
@@ -140,7 +140,7 @@ type FeatureLimits = {
|
|
|
140
140
|
backups: number;
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
type
|
|
143
|
+
type ServerAllocation = {
|
|
144
144
|
id: number;
|
|
145
145
|
ip: string;
|
|
146
146
|
alias: Nullable<string>;
|
|
@@ -149,7 +149,7 @@ type Allocation$1 = {
|
|
|
149
149
|
is_default: boolean;
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
type Server
|
|
152
|
+
type Server = {
|
|
153
153
|
server_owner: boolean;
|
|
154
154
|
identifier: string;
|
|
155
155
|
internal_id?: number;
|
|
@@ -173,7 +173,7 @@ type Server$1 = {
|
|
|
173
173
|
is_installing: boolean;
|
|
174
174
|
is_transferring: boolean;
|
|
175
175
|
relationships: {
|
|
176
|
-
allocations: GenericListResponse<GenericResponse<
|
|
176
|
+
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
177
177
|
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
178
178
|
egg?: GenericResponse<{
|
|
179
179
|
uuid: string;
|
|
@@ -347,10 +347,10 @@ declare class ServerAllocations {
|
|
|
347
347
|
private readonly r;
|
|
348
348
|
private readonly id;
|
|
349
349
|
constructor(requester: AxiosInstance, id: string);
|
|
350
|
-
list: () => Promise<
|
|
351
|
-
autoAssign: () => Promise<
|
|
352
|
-
setNotes: (alloc_id: number, notes: string) => Promise<
|
|
353
|
-
setPrimary: (alloc_id: number) => Promise<
|
|
350
|
+
list: () => Promise<ServerAllocation[]>;
|
|
351
|
+
autoAssign: () => Promise<ServerAllocation>;
|
|
352
|
+
setNotes: (alloc_id: number, notes: string) => Promise<ServerAllocation>;
|
|
353
|
+
setPrimary: (alloc_id: number) => Promise<ServerAllocation>;
|
|
354
354
|
unassign: (alloc_id: number) => Promise<void>;
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -365,7 +365,7 @@ declare class ServerUsers {
|
|
|
365
365
|
delete: (user_id: number) => Promise<void>;
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
type
|
|
368
|
+
type ServerBackup = {
|
|
369
369
|
uuid: string;
|
|
370
370
|
is_successful: boolean;
|
|
371
371
|
is_locked: boolean;
|
|
@@ -381,13 +381,13 @@ declare class ServerBackups {
|
|
|
381
381
|
private readonly r;
|
|
382
382
|
private readonly id;
|
|
383
383
|
constructor(requester: AxiosInstance, id: string);
|
|
384
|
-
list: (page?: number) => Promise<
|
|
384
|
+
list: (page?: number) => Promise<ServerBackup[]>;
|
|
385
385
|
create: (args: {
|
|
386
386
|
name?: string;
|
|
387
387
|
is_locked: boolean;
|
|
388
388
|
ignored_files: string[];
|
|
389
|
-
}) => Promise<
|
|
390
|
-
info: (backup_uuid: string) => Promise<
|
|
389
|
+
}) => Promise<ServerBackup>;
|
|
390
|
+
info: (backup_uuid: string) => Promise<ServerBackup>;
|
|
391
391
|
downloadGetUrl: (backup_uuid: string) => Promise<string>;
|
|
392
392
|
download: (backup_uuid: string) => Promise<ArrayBuffer>;
|
|
393
393
|
delete: (backup_uuid: string) => Promise<void>;
|
|
@@ -545,7 +545,7 @@ declare class ServerClient {
|
|
|
545
545
|
variables: ServerStartup;
|
|
546
546
|
settings: ServerSettings;
|
|
547
547
|
constructor(requester: AxiosInstance, id: string);
|
|
548
|
-
info: (include?: ("egg" | "subusers")[]) => Promise<Server
|
|
548
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<Server>;
|
|
549
549
|
websocket: (stripColors?: boolean) => ServerWebsocket;
|
|
550
550
|
resources: () => Promise<ServerStats>;
|
|
551
551
|
command: (command: string) => Promise<void>;
|
|
@@ -557,7 +557,7 @@ declare class Client$1 {
|
|
|
557
557
|
private readonly r;
|
|
558
558
|
constructor(requester: AxiosInstance);
|
|
559
559
|
listPermissions: () => Promise<Record<string, Permission>>;
|
|
560
|
-
listServers: (type?: "accessible" | "mine" | "admin" | "admin-all", page?: number, per_page?: number, include?: ("egg" | "subusers")[]) => Promise<Server
|
|
560
|
+
listServers: (type?: "accessible" | "mine" | "admin" | "admin-all", page?: number, per_page?: number, include?: ("egg" | "subusers")[]) => Promise<Server[]>;
|
|
561
561
|
server: (uuid: string) => ServerClient;
|
|
562
562
|
}
|
|
563
563
|
|
|
@@ -571,7 +571,7 @@ type Container = {
|
|
|
571
571
|
network_mode: string;
|
|
572
572
|
};
|
|
573
573
|
|
|
574
|
-
type
|
|
574
|
+
type ApplicationServer = {
|
|
575
575
|
id: number;
|
|
576
576
|
external_id: Nullable<string>;
|
|
577
577
|
uuid: string;
|
|
@@ -591,7 +591,7 @@ type Server = {
|
|
|
591
591
|
updated_at: Nullable<string>;
|
|
592
592
|
};
|
|
593
593
|
|
|
594
|
-
type
|
|
594
|
+
type ApplicationUser = {
|
|
595
595
|
id: number;
|
|
596
596
|
external_id: Nullable<string>;
|
|
597
597
|
uuid: string;
|
|
@@ -604,22 +604,22 @@ type User = {
|
|
|
604
604
|
created_at: string;
|
|
605
605
|
updated_at: Nullable<string>;
|
|
606
606
|
relationships?: {
|
|
607
|
-
servers: GenericListResponse<GenericResponse<
|
|
607
|
+
servers: GenericListResponse<GenericResponse<ApplicationServer>>;
|
|
608
608
|
};
|
|
609
609
|
};
|
|
610
610
|
|
|
611
611
|
declare class Users {
|
|
612
612
|
private readonly r;
|
|
613
613
|
constructor(requester: AxiosInstance);
|
|
614
|
-
list: (opts: ListType, page?: number) => Promise<
|
|
614
|
+
list: (opts: ListType, page?: number) => Promise<ApplicationUser[]>;
|
|
615
615
|
info: (id: number, { include }: {
|
|
616
616
|
include?: ("servers")[];
|
|
617
|
-
}) => Promise<
|
|
617
|
+
}) => Promise<ApplicationUser>;
|
|
618
618
|
infoByExternal: (external_id: string, { include }: {
|
|
619
619
|
include?: ("servers")[];
|
|
620
|
-
}) => Promise<
|
|
621
|
-
create: (user: z.infer<typeof CreateSchema>) => Promise<
|
|
622
|
-
update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<
|
|
620
|
+
}) => Promise<ApplicationUser>;
|
|
621
|
+
create: (user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
|
|
622
|
+
update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
|
|
623
623
|
delete: (id: number) => Promise<void>;
|
|
624
624
|
addRoles: (id: number, roles: number[]) => Promise<void>;
|
|
625
625
|
removeRoles: (id: number, roles: number[]) => Promise<void>;
|
|
@@ -1205,7 +1205,7 @@ type Location = {
|
|
|
1205
1205
|
updated_at: string | null;
|
|
1206
1206
|
};
|
|
1207
1207
|
|
|
1208
|
-
type Node = {
|
|
1208
|
+
type Node$1 = {
|
|
1209
1209
|
id: number;
|
|
1210
1210
|
uuid: string;
|
|
1211
1211
|
public: boolean;
|
|
@@ -1238,7 +1238,7 @@ type Node = {
|
|
|
1238
1238
|
relationships?: {
|
|
1239
1239
|
allocations?: GenericListResponse<GenericResponse<Allocation, "allocation">>;
|
|
1240
1240
|
location?: GenericResponse<Location, "location">;
|
|
1241
|
-
servers?: GenericListResponse<GenericResponse<
|
|
1241
|
+
servers?: GenericListResponse<GenericResponse<ApplicationServer, "server">>;
|
|
1242
1242
|
};
|
|
1243
1243
|
};
|
|
1244
1244
|
type NodeConfiguration = {
|
|
@@ -1276,8 +1276,8 @@ type Allocation = {
|
|
|
1276
1276
|
};
|
|
1277
1277
|
type AllocationRel = Allocation & {
|
|
1278
1278
|
relationships?: {
|
|
1279
|
-
node?: GenericResponse<Node, "node">;
|
|
1280
|
-
server?: GenericResponse<
|
|
1279
|
+
node?: GenericResponse<Node$1, "node">;
|
|
1280
|
+
server?: GenericResponse<ApplicationServer, "server">;
|
|
1281
1281
|
};
|
|
1282
1282
|
};
|
|
1283
1283
|
|
|
@@ -1293,18 +1293,18 @@ declare class NodesAllocations {
|
|
|
1293
1293
|
declare class Nodes {
|
|
1294
1294
|
private readonly r;
|
|
1295
1295
|
constructor(requester: AxiosInstance);
|
|
1296
|
-
list: (include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node[]>;
|
|
1296
|
+
list: (include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
1297
1297
|
listDeployable: (filters: {
|
|
1298
1298
|
disk: number;
|
|
1299
1299
|
memory: number;
|
|
1300
1300
|
cpu?: number;
|
|
1301
1301
|
location_ids?: string[];
|
|
1302
1302
|
tags?: string[];
|
|
1303
|
-
}, include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node[]>;
|
|
1304
|
-
info: (id: number, include?: ("allocations" | "location" | "servers")[]) => Promise<Node>;
|
|
1305
|
-
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node>;
|
|
1303
|
+
}, include?: ("allocations" | "location" | "servers")[], page?: number) => Promise<Node$1[]>;
|
|
1304
|
+
info: (id: number, include?: ("allocations" | "location" | "servers")[]) => Promise<Node$1>;
|
|
1305
|
+
create: (node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1306
1306
|
get_configuration: (id: number) => Promise<NodeConfiguration>;
|
|
1307
|
-
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node>;
|
|
1307
|
+
update: (id: number, node: z.infer<typeof NodeCreateSchema>) => Promise<Node$1>;
|
|
1308
1308
|
delete: (id: number) => Promise<void>;
|
|
1309
1309
|
allocations: (server_id: number) => NodesAllocations;
|
|
1310
1310
|
}
|
|
@@ -1350,7 +1350,7 @@ declare class Servers {
|
|
|
1350
1350
|
private readonly id;
|
|
1351
1351
|
databases: ServersDatabases;
|
|
1352
1352
|
constructor(r: AxiosInstance, server_id: number);
|
|
1353
|
-
info: (include?: ("egg" | "subusers")[]) => Promise<
|
|
1353
|
+
info: (include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
1354
1354
|
delete: (force?: boolean) => Promise<void>;
|
|
1355
1355
|
updateDetails: (opts: z.infer<typeof UpdateDetailsSchema>) => Promise<void>;
|
|
1356
1356
|
updateBuild: (opts: z.infer<typeof UpdateBuildSchema>) => Promise<void>;
|
|
@@ -1479,16 +1479,98 @@ declare class Roles {
|
|
|
1479
1479
|
delete: (id: number) => Promise<void>;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
+
type Egg = {
|
|
1483
|
+
id: number;
|
|
1484
|
+
uuid: string;
|
|
1485
|
+
name: number;
|
|
1486
|
+
author: string;
|
|
1487
|
+
description: string;
|
|
1488
|
+
features: string[];
|
|
1489
|
+
tags: string[];
|
|
1490
|
+
docker_image: string;
|
|
1491
|
+
docker_images: Record<string, string>;
|
|
1492
|
+
config: {
|
|
1493
|
+
files: Record<string, FileConfig>;
|
|
1494
|
+
startup: Record<string, string>;
|
|
1495
|
+
stop: string;
|
|
1496
|
+
logs: object | [];
|
|
1497
|
+
file_denylist: string[];
|
|
1498
|
+
extends: Nullable<number>;
|
|
1499
|
+
};
|
|
1500
|
+
startup: string;
|
|
1501
|
+
startup_commands: Record<string, string>;
|
|
1502
|
+
script: {
|
|
1503
|
+
privileged: boolean;
|
|
1504
|
+
install: string;
|
|
1505
|
+
entry: string;
|
|
1506
|
+
container: string;
|
|
1507
|
+
extends: Nullable<number>;
|
|
1508
|
+
};
|
|
1509
|
+
created_at: string;
|
|
1510
|
+
updated_at: Nullable<string>;
|
|
1511
|
+
};
|
|
1512
|
+
type FileConfig = {
|
|
1513
|
+
parser: string;
|
|
1514
|
+
find: Record<string, string>;
|
|
1515
|
+
};
|
|
1516
|
+
|
|
1517
|
+
declare class Eggs {
|
|
1518
|
+
private readonly r;
|
|
1519
|
+
constructor(r: AxiosInstance);
|
|
1520
|
+
list: () => Promise<Egg[]>;
|
|
1521
|
+
info: (id: number) => Promise<Egg>;
|
|
1522
|
+
export: (id: number, format: "json" | "yaml") => Promise<string>;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
type Mount = {
|
|
1526
|
+
id: number;
|
|
1527
|
+
uuid: string;
|
|
1528
|
+
name: string;
|
|
1529
|
+
description: Nullable<string>;
|
|
1530
|
+
source: string;
|
|
1531
|
+
target: string;
|
|
1532
|
+
read_only: boolean;
|
|
1533
|
+
user_mountable: boolean;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
declare class Mounts {
|
|
1537
|
+
private readonly r;
|
|
1538
|
+
constructor(r: AxiosInstance);
|
|
1539
|
+
list: () => Promise<Mount[]>;
|
|
1540
|
+
info: (id: number) => Promise<Mount>;
|
|
1541
|
+
create: (opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
1542
|
+
update: (id: number, opts: z.infer<typeof CreateMountSchema>) => Promise<Mount>;
|
|
1543
|
+
delete: (id: number) => Promise<void>;
|
|
1544
|
+
listAssignedEggs: (id: number) => Promise<Egg[]>;
|
|
1545
|
+
assignEggs: (id: number, eggs: number[]) => Promise<void>;
|
|
1546
|
+
unassignEgg: (id: number, egg_id: number) => Promise<void>;
|
|
1547
|
+
listAssignedNodes: (id: number) => Promise<Node[]>;
|
|
1548
|
+
assignNodes: (id: number, nodes: number[]) => Promise<void>;
|
|
1549
|
+
unassignNode: (id: number, node_id: number) => Promise<void>;
|
|
1550
|
+
listAssignedServers: (id: number) => Promise<ApplicationServer[]>;
|
|
1551
|
+
assignServers: (id: number, servers: number[]) => Promise<void>;
|
|
1552
|
+
unassignServer: (id: number, server_id: number) => Promise<void>;
|
|
1553
|
+
}
|
|
1554
|
+
declare const CreateMountSchema: z.ZodObject<{
|
|
1555
|
+
name: z.ZodString;
|
|
1556
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1557
|
+
source: z.ZodString;
|
|
1558
|
+
target: z.ZodString;
|
|
1559
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
1560
|
+
}, z.core.$strip>;
|
|
1561
|
+
|
|
1482
1562
|
declare class Client {
|
|
1483
1563
|
private readonly r;
|
|
1484
1564
|
users: Users;
|
|
1485
1565
|
nodes: Nodes;
|
|
1486
1566
|
databaseHosts: DatabaseHosts;
|
|
1487
1567
|
roles: Roles;
|
|
1568
|
+
eggs: Eggs;
|
|
1569
|
+
mounts: Mounts;
|
|
1488
1570
|
constructor(requester: AxiosInstance);
|
|
1489
|
-
listServers: (search?: string, page?: number) => Promise<
|
|
1490
|
-
createServer: (opts: z.infer<typeof CreateServerSchema>) => Promise<
|
|
1491
|
-
getServerByExternalId: (external_id: string, include?: ("egg" | "subusers")[]) => Promise<
|
|
1571
|
+
listServers: (search?: string, page?: number) => Promise<ApplicationServer[]>;
|
|
1572
|
+
createServer: (opts: z.infer<typeof CreateServerSchema>) => Promise<ApplicationServer>;
|
|
1573
|
+
getServerByExternalId: (external_id: string, include?: ("egg" | "subusers")[]) => Promise<ApplicationServer>;
|
|
1492
1574
|
servers: (server_id: number) => Servers;
|
|
1493
1575
|
}
|
|
1494
1576
|
|