@pelican.ts/sdk 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/.husky/pre-commit +2 -3
  2. package/biome.json +42 -32
  3. package/bun.lock +3 -0
  4. package/dist/api/index.d.mts +5 -5
  5. package/dist/api/index.d.ts +5 -5
  6. package/dist/api/index.js +168 -102
  7. package/dist/api/index.mjs +168 -102
  8. package/dist/index.d.mts +2 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +124 -70
  11. package/dist/index.mjs +124 -70
  12. package/dist/types.d.ts +1 -1
  13. package/package.json +60 -59
  14. package/scripts/create-types.ts +4 -4
  15. package/src/api/application/client.ts +26 -19
  16. package/src/api/application/database_hosts.ts +15 -20
  17. package/src/api/application/eggs.ts +14 -7
  18. package/src/api/application/mounts.ts +29 -16
  19. package/src/api/application/nodes.ts +34 -32
  20. package/src/api/application/nodes_allocations.ts +15 -11
  21. package/src/api/application/roles.ts +13 -27
  22. package/src/api/application/servers.ts +36 -27
  23. package/src/api/application/servers_databases.ts +11 -7
  24. package/src/api/application/types/container.ts +7 -8
  25. package/src/api/application/types/database_host.ts +8 -8
  26. package/src/api/application/types/egg.ts +47 -54
  27. package/src/api/application/types/location.ts +5 -7
  28. package/src/api/application/types/mount.ts +9 -9
  29. package/src/api/application/types/node.ts +49 -59
  30. package/src/api/application/types/role.ts +4 -6
  31. package/src/api/application/types/server.ts +21 -22
  32. package/src/api/application/types/server_allocation.ts +11 -12
  33. package/src/api/application/types/user.ts +25 -25
  34. package/src/api/application/users.ts +38 -27
  35. package/src/api/base/request.ts +28 -17
  36. package/src/api/base/types.ts +16 -23
  37. package/src/api/client/account.ts +20 -15
  38. package/src/api/client/client.ts +17 -18
  39. package/src/api/client/server.ts +24 -20
  40. package/src/api/client/server_activity.ts +10 -11
  41. package/src/api/client/server_allocations.ts +11 -6
  42. package/src/api/client/server_backups.ts +21 -17
  43. package/src/api/client/server_databases.ts +14 -8
  44. package/src/api/client/server_files.ts +56 -42
  45. package/src/api/client/server_schedules.ts +43 -19
  46. package/src/api/client/server_settings.ts +11 -8
  47. package/src/api/client/server_startup.ts +16 -8
  48. package/src/api/client/server_users.ts +22 -13
  49. package/src/api/client/server_websocket.ts +79 -33
  50. package/src/api/client/types/server.ts +8 -18
  51. package/src/api/client/types/server_allocation.ts +7 -8
  52. package/src/api/client/types/server_subuser.ts +10 -11
  53. package/src/api/client/types/user.ts +2 -5
  54. package/src/api/client/types/websocket.ts +12 -24
  55. package/src/api/common/types/egg.ts +7 -7
  56. package/src/api/common/types/enums.ts +1 -1
  57. package/src/api/common/types/server_backup.ts +4 -5
  58. package/src/api/common/types/server_database.ts +9 -12
  59. package/src/api/common/types/server_files.ts +9 -9
  60. package/src/api/common/types/server_limits.ts +11 -12
  61. package/src/api/common/types/server_power.ts +1 -1
  62. package/src/api/common/types/server_schedule.ts +27 -25
  63. package/src/api/common/types/server_startup.ts +7 -12
  64. package/src/api/index.ts +3 -3
  65. package/src/humane/Account.ts +2 -2
  66. package/src/humane/Client.ts +6 -6
  67. package/src/humane/Server.ts +31 -43
  68. package/src/humane/ServerAllocation.ts +3 -3
  69. package/src/humane/ServerBackup.ts +6 -9
  70. package/src/humane/ServerDatabase.ts +2 -2
  71. package/src/humane/ServerFile.ts +17 -11
  72. package/src/humane/ServerSchedule.ts +6 -6
  73. package/src/humane/ServerUser.ts +2 -2
  74. package/src/index.ts +3 -3
  75. package/src/utils/sized.ts +1 -1
  76. package/src/utils/transform.ts +5 -10
  77. package/src/utils/types.ts +6 -8
  78. package/tsconfig.json +0 -1
@@ -1,7 +1,7 @@
1
- import {AxiosInstance} from "axios";
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
3
- import {DatabaseHost} from "@/api/application/types/database_host";
4
- import z from "zod";
1
+ import {AxiosInstance} from "axios"
2
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
+ import {DatabaseHost} from "@/api/application/types/database_host"
4
+ import z from "zod"
5
5
 
6
6
  export class DatabaseHosts {
7
7
  private readonly r: AxiosInstance
@@ -10,20 +10,14 @@ export class DatabaseHosts {
10
10
  this.r = r
11
11
  }
12
12
 
13
- list = async (
14
- page: number = 1
15
- ): Promise<DatabaseHost[]> => {
13
+ list = async (page: number = 1): Promise<DatabaseHost[]> => {
16
14
  const {data} = await this.r.get<
17
15
  GenericListResponse<GenericResponse<DatabaseHost, "database_host">>
18
- >("/database-hosts", {
19
- params: {page}
20
- })
16
+ >("/database-hosts", {params: {page}})
21
17
  return data.data.map(d => d.attributes)
22
18
  }
23
19
 
24
- info = async (
25
- id: string
26
- ): Promise<DatabaseHost> => {
20
+ info = async (id: string): Promise<DatabaseHost> => {
27
21
  const {data} = await this.r.get<
28
22
  GenericResponse<DatabaseHost, "database_host">
29
23
  >(`/database-hosts/${id}`)
@@ -35,9 +29,12 @@ export class DatabaseHosts {
35
29
  opts: z.infer<typeof CreateDBHostSchema>
36
30
  ): Promise<void> => {
37
31
  opts = CreateDBHostSchema.parse(opts)
38
- await this.r.post<
39
- GenericResponse<DatabaseHost, "database_host">
40
- >("/database-hosts", opts).catch(e=>{})
32
+ await this.r
33
+ .post<GenericResponse<DatabaseHost, "database_host">>(
34
+ "/database-hosts",
35
+ opts
36
+ )
37
+ .catch(e => {})
41
38
  }
42
39
 
43
40
  update = async (
@@ -52,9 +49,7 @@ export class DatabaseHosts {
52
49
  return data.attributes
53
50
  }
54
51
 
55
- delete = async (
56
- id: string
57
- ): Promise<void> => {
52
+ delete = async (id: string): Promise<void> => {
58
53
  await this.r.delete(`/database-hosts/${id}`)
59
54
  }
60
55
  }
@@ -67,4 +62,4 @@ const CreateDBHostSchema = z.object({
67
62
  password: z.string().optional(),
68
63
  node_ids: z.array(z.string()).optional(),
69
64
  max_databases: z.number().optional()
70
- })
65
+ })
@@ -1,6 +1,6 @@
1
- import {AxiosInstance} from "axios";
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
3
- import {Egg, ExportedEgg} from "@/api/application/types/egg";
1
+ import {AxiosInstance} from "axios"
2
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
+ import {Egg, ExportedEgg} from "@/api/application/types/egg"
4
4
 
5
5
  // TODO: API is incomplete
6
6
 
@@ -12,12 +12,17 @@ export class Eggs {
12
12
  }
13
13
 
14
14
  list = async (): Promise<Egg[]> => {
15
- const {data} = await this.r.get<GenericListResponse<GenericResponse<Egg, "egg">>>("/eggs")
15
+ const {data} =
16
+ await this.r.get<GenericListResponse<GenericResponse<Egg, "egg">>>(
17
+ "/eggs"
18
+ )
16
19
  return data.data.map(d => d.attributes)
17
20
  }
18
21
 
19
22
  info = async (id: number): Promise<Egg> => {
20
- const {data} = await this.r.get<GenericResponse<Egg, "egg">>(`/eggs/${id}`)
23
+ const {data} = await this.r.get<GenericResponse<Egg, "egg">>(
24
+ `/eggs/${id}`
25
+ )
21
26
  return data.attributes
22
27
  }
23
28
 
@@ -30,7 +35,9 @@ export class Eggs {
30
35
  }
31
36
 
32
37
  infoExportable = async (id: number): Promise<ExportedEgg> => {
33
- const {data} = await this.r.get<ExportedEgg>(`/eggs/${id}/export`, {params: {format: "json"}})
38
+ const {data} = await this.r.get<ExportedEgg>(`/eggs/${id}/export`, {
39
+ params: {format: "json"}
40
+ })
34
41
  return data
35
42
  }
36
- }
43
+ }
@@ -1,9 +1,9 @@
1
- import {AxiosInstance} from "axios";
2
- import {Mount} from "@/api/application/types/mount";
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
4
- import z from "zod";
5
- import {Egg} from "@/api/application/types/egg";
6
- import {ApplicationServer} from "@/api/application/types";
1
+ import {AxiosInstance} from "axios"
2
+ import {Mount} from "@/api/application/types/mount"
3
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
+ import z from "zod"
5
+ import {Egg} from "@/api/application/types/egg"
6
+ import {ApplicationServer} from "@/api/application/types"
7
7
 
8
8
  export class Mounts {
9
9
  private readonly r: AxiosInstance
@@ -13,26 +13,40 @@ export class Mounts {
13
13
  }
14
14
 
15
15
  list = async (): Promise<Mount[]> => {
16
- const {data} = await this.r.get<
17
- GenericListResponse<GenericResponse<Mount, "mount">>
18
- >("/mounts")
16
+ const {data} =
17
+ await this.r.get<
18
+ GenericListResponse<GenericResponse<Mount, "mount">>
19
+ >("/mounts")
19
20
  return data.data.map(d => d.attributes)
20
21
  }
21
22
 
22
23
  info = async (id: number): Promise<Mount> => {
23
- const {data} = await this.r.get<GenericResponse<Mount, "mount">>(`/mounts/${id}`)
24
+ const {data} = await this.r.get<GenericResponse<Mount, "mount">>(
25
+ `/mounts/${id}`
26
+ )
24
27
  return data.attributes
25
28
  }
26
29
 
27
- create = async (opts: z.infer<typeof CreateMountSchema>): Promise<Mount> => {
30
+ create = async (
31
+ opts: z.infer<typeof CreateMountSchema>
32
+ ): Promise<Mount> => {
28
33
  opts = CreateMountSchema.parse(opts)
29
- const {data} = await this.r.post<GenericResponse<Mount, "mount">>("/mounts", opts)
34
+ const {data} = await this.r.post<GenericResponse<Mount, "mount">>(
35
+ "/mounts",
36
+ opts
37
+ )
30
38
  return data.attributes
31
39
  }
32
40
 
33
- update = async (id: number, opts: z.infer<typeof CreateMountSchema>): Promise<Mount> => {
41
+ update = async (
42
+ id: number,
43
+ opts: z.infer<typeof CreateMountSchema>
44
+ ): Promise<Mount> => {
34
45
  opts = CreateMountSchema.parse(opts)
35
- const {data} = await this.r.patch<GenericResponse<Mount, "mount">>(`/mounts/${id}`, opts)
46
+ const {data} = await this.r.patch<GenericResponse<Mount, "mount">>(
47
+ `/mounts/${id}`,
48
+ opts
49
+ )
36
50
  return data.attributes
37
51
  }
38
52
 
@@ -86,11 +100,10 @@ export class Mounts {
86
100
  }
87
101
  }
88
102
 
89
-
90
103
  const CreateMountSchema = z.object({
91
104
  name: z.string().min(1).max(255),
92
105
  description: z.string().optional(),
93
106
  source: z.string(),
94
107
  target: z.string(),
95
108
  read_only: z.boolean().optional()
96
- })
109
+ })
@@ -1,10 +1,9 @@
1
- import {AxiosInstance} from "axios";
2
- import {NodesAllocations} from "@/api/application/nodes_allocations";
3
- import {ApplicationServer} from "@/api/application/types/server";
4
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
5
- import z from "zod";
6
- import {Node, NodeConfiguration} from "@/api/application/types/node";
7
-
1
+ import {AxiosInstance} from "axios"
2
+ import {NodesAllocations} from "@/api/application/nodes_allocations"
3
+ import {ApplicationServer} from "@/api/application/types/server"
4
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
5
+ import z from "zod"
6
+ import {Node, NodeConfiguration} from "@/api/application/types/node"
8
7
 
9
8
  export class Nodes {
10
9
  private readonly r: AxiosInstance
@@ -20,18 +19,16 @@ export class Nodes {
20
19
  z.number().positive().parse(page)
21
20
  const {data} = await this.r.get<
22
21
  GenericListResponse<GenericResponse<Node, "node">>
23
- >("/nodes", {
24
- params: {include: include?.join(","), page}
25
- })
22
+ >("/nodes", {params: {include: include?.join(","), page}})
26
23
  return data.data.map(s => s.attributes)
27
24
  }
28
25
 
29
26
  listDeployable = async (
30
27
  filters: {
31
- disk: number,
32
- memory: number,
33
- cpu?: number,
34
- location_ids?: string[],
28
+ disk: number
29
+ memory: number
30
+ cpu?: number
31
+ location_ids?: string[]
35
32
  tags?: string[]
36
33
  },
37
34
  include?: ("allocations" | "location" | "servers")[],
@@ -56,37 +53,43 @@ export class Nodes {
56
53
 
57
54
  info = async (
58
55
  id: number,
59
- include?: ("allocations" | "location" | "servers")[],
56
+ include?: ("allocations" | "location" | "servers")[]
60
57
  ): Promise<Node> => {
61
58
  z.number().positive().parse(id)
62
- const {data} = await this.r.get<
63
- GenericResponse<Node, "node">
64
- >(`/nodes/${id}`, {
65
- params: {include: include?.join(",")}
66
- })
59
+ const {data} = await this.r.get<GenericResponse<Node, "node">>(
60
+ `/nodes/${id}`,
61
+ {params: {include: include?.join(",")}}
62
+ )
67
63
  return data.attributes
68
64
  }
69
65
 
70
66
  create = async (node: z.infer<typeof NodeCreateSchema>): Promise<Node> => {
71
67
  node = NodeCreateSchema.parse(node)
72
- const {data} = await this.r.post<
73
- GenericResponse<Node, "node">
74
- >("/nodes", node)
68
+ const {data} = await this.r.post<GenericResponse<Node, "node">>(
69
+ "/nodes",
70
+ node
71
+ )
75
72
  return data.attributes
76
73
  }
77
74
 
78
75
  get_configuration = async (id: number): Promise<NodeConfiguration> => {
79
76
  z.number().positive().parse(id)
80
- const {data} = await this.r.get<NodeConfiguration>(`/nodes/${id}/configuration`)
77
+ const {data} = await this.r.get<NodeConfiguration>(
78
+ `/nodes/${id}/configuration`
79
+ )
81
80
  return data
82
81
  }
83
82
 
84
- update = async (id: number, node: z.infer<typeof NodeCreateSchema>): Promise<Node> => {
83
+ update = async (
84
+ id: number,
85
+ node: z.infer<typeof NodeCreateSchema>
86
+ ): Promise<Node> => {
85
87
  z.number().positive().parse(id)
86
88
  node = NodeCreateSchema.parse(node)
87
- const {data} = await this.r.patch<
88
- GenericResponse<Node, "node">
89
- >(`/nodes/${id}`, node)
89
+ const {data} = await this.r.patch<GenericResponse<Node, "node">>(
90
+ `/nodes/${id}`,
91
+ node
92
+ )
90
93
  return data.attributes
91
94
  }
92
95
 
@@ -95,9 +98,8 @@ export class Nodes {
95
98
  await this.r.delete(`/nodes/${id}`)
96
99
  }
97
100
 
98
- allocations = (server_id: number): NodesAllocations => (
101
+ allocations = (server_id: number): NodesAllocations =>
99
102
  new NodesAllocations(this.r, server_id)
100
- )
101
103
  }
102
104
 
103
105
  const NodeCreateSchema = z.object({
@@ -120,5 +122,5 @@ const NodeCreateSchema = z.object({
120
122
  daemon_connect: z.number().min(1).max(65535),
121
123
  maintenance_mode: z.boolean().optional(),
122
124
  upload_size: z.number().min(1).max(1024),
123
- tags: z.array(z.string()).optional(),
124
- })
125
+ tags: z.array(z.string()).optional()
126
+ })
@@ -1,8 +1,10 @@
1
- import {AxiosInstance} from "axios";
2
- import {Allocation, AllocationRel} from "@/api/application/types/server_allocation";
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
4
- import z from "zod";
5
-
1
+ import {AxiosInstance} from "axios"
2
+ import {
3
+ Allocation,
4
+ AllocationRel
5
+ } from "@/api/application/types/server_allocation"
6
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
7
+ import z from "zod"
6
8
 
7
9
  export class NodesAllocations {
8
10
  private readonly r: AxiosInstance
@@ -13,7 +15,9 @@ export class NodesAllocations {
13
15
  this.id = id
14
16
  }
15
17
 
16
- list = async (include?: ("node" | "server")[]): Promise<AllocationRel[]> => {
18
+ list = async (
19
+ include?: ("node" | "server")[]
20
+ ): Promise<AllocationRel[]> => {
17
21
  const {data} = await this.r.get<
18
22
  GenericListResponse<GenericResponse<AllocationRel, "allocation">>
19
23
  >(`/nodes/${this.id}/allocations`, {
@@ -30,14 +34,14 @@ export class NodesAllocations {
30
34
  ): Promise<void> => {
31
35
  z.ipv4().parse(ip)
32
36
  z.ipv4().or(z.url().max(255)).optional().parse(alias)
33
- z.array(z.number()).or(z.string().regex(/\d+-\d+/)).parse(ports)
37
+ z.array(z.number())
38
+ .or(z.string().regex(/\d+-\d+/))
39
+ .parse(ports)
34
40
 
35
- await this.r.post(`/nodes/${this.id}/allocations`, {
36
- ip, ports, alias
37
- })
41
+ await this.r.post(`/nodes/${this.id}/allocations`, {ip, ports, alias})
38
42
  }
39
43
 
40
44
  delete = async (alloc_id: number): Promise<void> => {
41
45
  await this.r.delete(`/nodes/${this.id}/allocations/${alloc_id}`)
42
46
  }
43
- }
47
+ }
@@ -1,7 +1,6 @@
1
- import {AxiosInstance} from "axios";
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
3
- import {Role} from "@/api/application/types/role";
4
-
1
+ import {AxiosInstance} from "axios"
2
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
+ import {Role} from "@/api/application/types/role"
5
4
 
6
5
  // TODO: API is incomplete
7
6
 
@@ -12,42 +11,29 @@ export class Roles {
12
11
  this.r = r
13
12
  }
14
13
 
15
- list = async (
16
- page: number = 1
17
- ): Promise<Role[]> => {
14
+ list = async (page: number = 1): Promise<Role[]> => {
18
15
  const {data} = await this.r.get<
19
16
  GenericListResponse<GenericResponse<Role, "role">>
20
- >(`/roles`, {
21
- params: {page}
22
- })
17
+ >(`/roles`, {params: {page}})
23
18
  return data.data.map(r => r.attributes)
24
19
  }
25
20
 
26
- info = async (
27
- id: number
28
- ): Promise<Role> => {
29
- const {data} = await this.r.get<
30
- GenericResponse<Role, "role">
31
- >(`/roles/${id}`)
21
+ info = async (id: number): Promise<Role> => {
22
+ const {data} = await this.r.get<GenericResponse<Role, "role">>(
23
+ `/roles/${id}`
24
+ )
32
25
  return data.attributes
33
26
  }
34
27
 
35
- create = async (
36
- opts: {name: string}
37
- ): Promise<void> => {
28
+ create = async (opts: {name: string}): Promise<void> => {
38
29
  await this.r.post(`/roles`, opts)
39
30
  }
40
31
 
41
- update = async (
42
- id: number,
43
- opts: {name: string}
44
- ): Promise<void> => {
32
+ update = async (id: number, opts: {name: string}): Promise<void> => {
45
33
  await this.r.patch(`/roles/${id}`, opts)
46
34
  }
47
35
 
48
- delete = async (
49
- id: number
50
- ): Promise<void> => {
36
+ delete = async (id: number): Promise<void> => {
51
37
  await this.r.delete(`/roles/${id}`)
52
38
  }
53
- }
39
+ }
@@ -1,8 +1,8 @@
1
- import {AxiosInstance} from "axios";
2
- import z from "zod";
3
- import {GenericResponse} from "@/api/base/types";
4
- import {ApplicationServer} from "@/api/application/types/server";
5
- import {ServersDatabases} from "@/api/application/servers_databases";
1
+ import {AxiosInstance} from "axios"
2
+ import z from "zod"
3
+ import {GenericResponse} from "@/api/base/types"
4
+ import {ApplicationServer} from "@/api/application/types/server"
5
+ import {ServersDatabases} from "@/api/application/servers_databases"
6
6
 
7
7
  export class Servers {
8
8
  private readonly r: AxiosInstance
@@ -16,10 +16,12 @@ export class Servers {
16
16
  this.databases = new ServersDatabases(this.r, this.id)
17
17
  }
18
18
 
19
- info = async (include?: ("egg" | "subusers")[]): Promise<ApplicationServer> => {
20
- const {data} = await this.r.get<GenericResponse<ApplicationServer, "server">>(`/servers/${this.id}`, {
21
- params: {include: include?.join(",")}
22
- })
19
+ info = async (
20
+ include?: ("egg" | "subusers")[]
21
+ ): Promise<ApplicationServer> => {
22
+ const {data} = await this.r.get<
23
+ GenericResponse<ApplicationServer, "server">
24
+ >(`/servers/${this.id}`, {params: {include: include?.join(",")}})
23
25
  return data.attributes
24
26
  }
25
27
 
@@ -27,17 +29,23 @@ export class Servers {
27
29
  await this.r.delete(`/servers/${this.id}${force ? "/force" : ""}`)
28
30
  }
29
31
 
30
- updateDetails = async (opts: z.infer<typeof UpdateDetailsSchema>): Promise<void> => {
32
+ updateDetails = async (
33
+ opts: z.infer<typeof UpdateDetailsSchema>
34
+ ): Promise<void> => {
31
35
  opts = UpdateDetailsSchema.parse(opts)
32
36
  await this.r.patch(`/servers/${this.id}/details`, opts)
33
37
  }
34
38
 
35
- updateBuild = async (opts: z.infer<typeof UpdateBuildSchema>): Promise<void> => {
39
+ updateBuild = async (
40
+ opts: z.infer<typeof UpdateBuildSchema>
41
+ ): Promise<void> => {
36
42
  opts = UpdateBuildSchema.parse(opts)
37
43
  await this.r.patch(`/servers/${this.id}/build`, opts)
38
44
  }
39
45
 
40
- updateStartup = async (opts: z.infer<typeof UpdateStartupSchema>): Promise<void> => {
46
+ updateStartup = async (
47
+ opts: z.infer<typeof UpdateStartupSchema>
48
+ ): Promise<void> => {
41
49
  opts = UpdateStartupSchema.parse(opts)
42
50
  await this.r.patch(`/servers/${this.id}/startup`, opts)
43
51
  }
@@ -71,7 +79,6 @@ export class Servers {
71
79
  }
72
80
  }
73
81
 
74
-
75
82
  export const CreateServerSchema = z.object({
76
83
  external_id: z.string().min(1).max(255).optional(),
77
84
  name: z.string().min(1).max(255),
@@ -98,15 +105,19 @@ export const CreateServerSchema = z.object({
98
105
  allocations: z.number().min(0),
99
106
  backups: z.number().min(0)
100
107
  }),
101
- allocation: z.object({
102
- default: z.string(),
103
- additional: z.array(z.string()).optional()
104
- }).optional(),
105
- deploy: z.object({
106
- tags: z.array(z.string()).optional(),
107
- dedicated_ip: z.boolean().optional(),
108
- port_range: z.array(z.string()).optional()
109
- }).optional()
108
+ allocation: z
109
+ .object({
110
+ default: z.string(),
111
+ additional: z.array(z.string()).optional()
112
+ })
113
+ .optional(),
114
+ deploy: z
115
+ .object({
116
+ tags: z.array(z.string()).optional(),
117
+ dedicated_ip: z.boolean().optional(),
118
+ port_range: z.array(z.string()).optional()
119
+ })
120
+ .optional()
110
121
  })
111
122
 
112
123
  const UpdateDetailsSchema = CreateServerSchema.pick({
@@ -120,11 +131,11 @@ const UpdateDetailsSchema = CreateServerSchema.pick({
120
131
  const UpdateBuildSchema = CreateServerSchema.pick({
121
132
  oom_killer: true,
122
133
  limits: true,
123
- feature_limits: true,
134
+ feature_limits: true
124
135
  }).extend({
125
136
  allocation: z.number().optional(),
126
137
  add_allocations: z.array(z.string()).optional(),
127
- remove_allocations: z.array(z.string()).optional(),
138
+ remove_allocations: z.array(z.string()).optional()
128
139
  })
129
140
 
130
141
  const UpdateStartupSchema = CreateServerSchema.pick({
@@ -132,6 +143,4 @@ const UpdateStartupSchema = CreateServerSchema.pick({
132
143
  environment: true,
133
144
  egg: true,
134
145
  skip_scripts: true
135
- }).extend({
136
- image: z.string().optional()
137
- })
146
+ }).extend({image: z.string().optional()})
@@ -1,7 +1,7 @@
1
- import {AxiosInstance} from "axios";
2
- import {ServerDatabase} from "@/api/common/types/server_database";
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
4
- import z from "zod";
1
+ import {AxiosInstance} from "axios"
2
+ import {ServerDatabase} from "@/api/common/types/server_database"
3
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
+ import z from "zod"
5
5
 
6
6
  // TODO: Check if database type is valid
7
7
  export class ServersDatabases {
@@ -15,7 +15,9 @@ export class ServersDatabases {
15
15
 
16
16
  list = async (): Promise<ServerDatabase[]> => {
17
17
  const {data} = await this.r.get<
18
- GenericListResponse<GenericResponse<ServerDatabase, "server_database">>
18
+ GenericListResponse<
19
+ GenericResponse<ServerDatabase, "server_database">
20
+ >
19
21
  >(`/servers/${this.id}/databases`)
20
22
  return data.data.map(d => d.attributes)
21
23
  }
@@ -44,6 +46,8 @@ export class ServersDatabases {
44
46
  }
45
47
 
46
48
  resetPassword = async (database_id: number): Promise<void> => {
47
- await this.r.post(`/servers/${this.id}/databases/${database_id}/reset-password`)
49
+ await this.r.post(
50
+ `/servers/${this.id}/databases/${database_id}/reset-password`
51
+ )
48
52
  }
49
- }
53
+ }
@@ -1,10 +1,9 @@
1
-
2
1
  export type Container = {
3
- startup_command: string,
4
- image: string,
5
- installed: number,
6
- environment: Record<string, string>,
7
- ports: number[],
8
- volumes: string[],
2
+ startup_command: string
3
+ image: string
4
+ installed: number
5
+ environment: Record<string, string>
6
+ ports: number[]
7
+ volumes: string[]
9
8
  network_mode: string
10
- }
9
+ }
@@ -1,11 +1,11 @@
1
- import {Nullable} from "@/utils/types";
1
+ import {Nullable} from "@/utils/types"
2
2
 
3
3
  export type DatabaseHost = {
4
- id: number,
5
- name: string,
6
- host: string,
7
- port: number,
8
- username: string,
9
- created_at: string,
4
+ id: number
5
+ name: string
6
+ host: string
7
+ port: number
8
+ username: string
9
+ created_at: string
10
10
  updated_at: Nullable<string>
11
- }
11
+ }