@pelican.ts/sdk 0.2.3 → 0.2.5

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 (39) hide show
  1. package/README.md +12 -9
  2. package/dist/index.d.mts +911 -70
  3. package/dist/index.d.ts +911 -70
  4. package/dist/index.js +943 -17
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +943 -17
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/types.d.ts +1075 -0
  9. package/package.json +12 -3
  10. package/scripts/create-types.ts +24 -0
  11. package/src/api/application/client.ts +40 -0
  12. package/src/api/application/database_hosts.ts +70 -0
  13. package/src/api/application/nodes.ts +73 -46
  14. package/src/api/application/nodes_allocations.ts +4 -6
  15. package/src/api/application/roles.ts +53 -0
  16. package/src/api/application/servers.ts +135 -0
  17. package/src/api/application/servers_databases.ts +49 -0
  18. package/src/api/application/types/container.ts +1 -3
  19. package/src/api/application/types/database_host.ts +11 -0
  20. package/src/api/application/types/index.ts +8 -0
  21. package/src/api/application/types/node.ts +41 -6
  22. package/src/api/application/types/role.ts +8 -0
  23. package/src/api/application/types/server.ts +5 -5
  24. package/src/api/{common/types/server_allocations.ts → application/types/server_allocation.ts} +5 -4
  25. package/src/api/application/types/user.ts +7 -7
  26. package/src/api/application/users.ts +36 -26
  27. package/src/api/base/request.ts +3 -3
  28. package/src/api/client/server_allocations.ts +9 -9
  29. package/src/api/client/server_backups.ts +7 -7
  30. package/src/api/client/server_databases.ts +7 -7
  31. package/src/api/client/types/index.ts +5 -0
  32. package/src/api/client/types/server.ts +2 -2
  33. package/src/api/client/types/server_allocation.ts +11 -0
  34. package/src/api/common/types/enums.ts +21 -0
  35. package/src/api/common/types/index.ts +9 -0
  36. package/src/api/common/types/server_backup.ts +1 -1
  37. package/src/api/common/types/server_database.ts +1 -1
  38. package/src/index.ts +4 -4
  39. package/src/types.ts +3 -0
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "@pelican.ts/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Pelican panel SDK for TypeScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./types": {
10
+ "types": "./dist/types.d.ts"
11
+ }
12
+ },
8
13
  "scripts": {
9
- "build": "tsup src/index.ts --format esm,cjs --dts --sourcemap --target esnext",
10
- "pub": "npm publish --access=public"
14
+ "build:code": "tsup src/index.ts --format esm,cjs --dts --sourcemap --target esnext",
15
+ "build:types": "tsup src/types.ts --dts-only --target esnext",
16
+ "build": "npm run build:code && npm run build:types",
17
+ "pub": "npm publish --access=public",
18
+ "generate-types": "bun run scripts/create-types.ts"
11
19
  },
12
20
  "keywords": ["pterodactyl", "pterodactyl.ts", "pterodactyl.js", "pelican", "pelican.ts", "pelican.js"],
13
21
  "author": "M41den",
@@ -19,6 +27,7 @@
19
27
  "@types/node": "^22.18.12",
20
28
  "@types/strip-color": "^0.1.2",
21
29
  "tsc-alias": "^1.8.16",
30
+ "tsup": "^8.5.0",
22
31
  "typescript": "^5.9.3"
23
32
  },
24
33
  "dependencies": {
@@ -0,0 +1,24 @@
1
+
2
+ import fs from "fs"
3
+ import path from "path"
4
+
5
+ const typesPaths = [
6
+ "./api/common/types",
7
+ "./api/application/types",
8
+ "./api/client/types"
9
+ ]
10
+
11
+ typesPaths.forEach(p => {
12
+ const prefix = path.join(__dirname, "../src" , p)
13
+ const files = fs.readdirSync(prefix)
14
+ .filter(f => f!=="index.ts")
15
+ .map(f => f.replace(/\.ts$/, ""))
16
+ const strings: Array<string> = []
17
+ files.forEach(f => {
18
+ strings.push(`export * from "./${f}"`)
19
+ })
20
+ fs.writeFileSync(path.join(prefix, "index.ts"), strings.join("\n"))
21
+ })
22
+
23
+ const strings = typesPaths.map(p => `export * from "${p}"`)
24
+ fs.writeFileSync(path.join(__dirname, "../src/types.ts"), strings.join("\n"))
@@ -1,13 +1,53 @@
1
1
  import {AxiosInstance} from "axios";
2
2
  import {Users} from "@/api/application/users";
3
+ import {Nodes} from "@/api/application/nodes";
4
+ import {GenericListResponse, GenericResponse} from "@/api/base/types";
5
+ import {ApplicationServer} from "@/api/application/types/server";
6
+ import {CreateServerSchema, Servers} from "@/api/application/servers";
7
+ import z from "zod";
8
+ import {DatabaseHosts} from "@/api/application/database_hosts";
9
+ import {Roles} from "@/api/application/roles";
3
10
 
4
11
  export class Client {
5
12
  private readonly r: AxiosInstance
6
13
  users: Users
14
+ nodes: Nodes
15
+ databaseHosts: DatabaseHosts
16
+ roles: Roles
7
17
 
8
18
  constructor(requester: AxiosInstance) {
9
19
  this.r = requester
10
20
 
11
21
  this.users = new Users(requester)
22
+ this.nodes = new Nodes(requester)
23
+ this.databaseHosts = new DatabaseHosts(requester)
24
+ this.roles = new Roles(requester)
12
25
  }
26
+
27
+ listServers = async (
28
+ search?: string,
29
+ page: number = 1
30
+ ): Promise<ApplicationServer[]> => {
31
+ const {data} = await this.r.get<
32
+ GenericListResponse<GenericResponse<ApplicationServer, "server">>
33
+ >("/servers", {
34
+ params: {search, page}
35
+ })
36
+ return data.data.map(s => s.attributes)
37
+ }
38
+
39
+ createServer = async (opts: z.infer<typeof CreateServerSchema>): Promise<ApplicationServer> => {
40
+ opts = CreateServerSchema.parse(opts)
41
+ const {data} = await this.r.post<GenericResponse<ApplicationServer, "server">>("/servers", opts)
42
+ return data.attributes
43
+ }
44
+
45
+ getServerByExternalId = async (external_id: string, include?: ("egg" | "subusers")[]): Promise<ApplicationServer> => {
46
+ const {data} = await this.r.get<GenericResponse<ApplicationServer, "server">>(`/servers/external/${external_id}`, {
47
+ params: {include: include?.join(",")}
48
+ })
49
+ return data.attributes
50
+ }
51
+
52
+ servers = (server_id: number) => new Servers(this.r, server_id)
13
53
  }
@@ -0,0 +1,70 @@
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
+
6
+ export class DatabaseHosts {
7
+ private readonly r: AxiosInstance
8
+
9
+ constructor(r: AxiosInstance) {
10
+ this.r = r
11
+ }
12
+
13
+ list = async (
14
+ page: number = 1
15
+ ): Promise<DatabaseHost[]> => {
16
+ const {data} = await this.r.get<
17
+ GenericListResponse<GenericResponse<DatabaseHost, "database_host">>
18
+ >("/database-hosts", {
19
+ params: {page}
20
+ })
21
+ return data.data.map(d => d.attributes)
22
+ }
23
+
24
+ info = async (
25
+ id: string
26
+ ): Promise<DatabaseHost> => {
27
+ const {data} = await this.r.get<
28
+ GenericResponse<DatabaseHost, "database_host">
29
+ >(`/database-hosts/${id}`)
30
+ return data.attributes
31
+ }
32
+
33
+ // TODO: find out why API returns 500
34
+ create = async (
35
+ opts: z.infer<typeof CreateDBHostSchema>
36
+ ): Promise<void> => {
37
+ opts = CreateDBHostSchema.parse(opts)
38
+ await this.r.post<
39
+ GenericResponse<DatabaseHost, "database_host">
40
+ >("/database-hosts", opts).catch(e=>{})
41
+ }
42
+
43
+ update = async (
44
+ id: string,
45
+ opts: z.infer<typeof CreateDBHostSchema>
46
+ ): Promise<DatabaseHost> => {
47
+ opts = CreateDBHostSchema.parse(opts)
48
+ const {data} = await this.r.patch<
49
+ GenericResponse<DatabaseHost, "database_host">
50
+ >(`/database-hosts/${id}`, opts)
51
+
52
+ return data.attributes
53
+ }
54
+
55
+ delete = async (
56
+ id: string
57
+ ): Promise<void> => {
58
+ await this.r.delete(`/database-hosts/${id}`)
59
+ }
60
+ }
61
+
62
+ const CreateDBHostSchema = z.object({
63
+ name: z.string().min(1).max(255),
64
+ host: z.string(),
65
+ port: z.number().min(1).max(65535),
66
+ username: z.string().min(1).max(255),
67
+ password: z.string().optional(),
68
+ node_ids: z.array(z.string()).optional(),
69
+ max_databases: z.number().optional()
70
+ })
@@ -1,9 +1,9 @@
1
1
  import {AxiosInstance} from "axios";
2
2
  import {NodesAllocations} from "@/api/application/nodes_allocations";
3
- import {Server} from "@/api/application/types/server";
3
+ import {ApplicationServer} from "@/api/application/types/server";
4
4
  import {GenericListResponse, GenericResponse} from "@/api/base/types";
5
5
  import z from "zod";
6
- import {Node} from "@/api/application/types/node";
6
+ import {Node, NodeConfiguration} from "@/api/application/types/node";
7
7
 
8
8
 
9
9
  export class Nodes {
@@ -26,42 +26,67 @@ export class Nodes {
26
26
  return data.data.map(s => s.attributes)
27
27
  }
28
28
 
29
+ listDeployable = async (
30
+ filters: {
31
+ disk: number,
32
+ memory: number,
33
+ cpu?: number,
34
+ location_ids?: string[],
35
+ tags?: string[]
36
+ },
37
+ include?: ("allocations" | "location" | "servers")[],
38
+ page: number = 1
39
+ ): Promise<Node[]> => {
40
+ z.number().positive().parse(page)
41
+ const {data} = await this.r.get<
42
+ GenericListResponse<GenericResponse<Node, "node">>
43
+ >("/nodes/deployable", {
44
+ params: {
45
+ include: include?.join(","),
46
+ disk: filters.disk,
47
+ memory: filters.memory,
48
+ cpu: filters.cpu,
49
+ location_ids: filters.location_ids,
50
+ tags: filters.tags,
51
+ page: page
52
+ }
53
+ })
54
+ return data.data.map(s => s.attributes)
55
+ }
56
+
29
57
  info = async (
30
58
  id: number,
31
59
  include?: ("allocations" | "location" | "servers")[],
32
- ): Promise<Node> => {
60
+ ): Promise<Node> => {
33
61
  z.number().positive().parse(id)
34
- const {data} = await this.r.get<GenericResponse<Node, "node">>(
35
- `/nodes/${id}`,
36
- {params: {include: include?.join(",")}}
37
- )
62
+ const {data} = await this.r.get<
63
+ GenericResponse<Node, "node">
64
+ >(`/nodes/${id}`, {
65
+ params: {include: include?.join(",")}
66
+ })
38
67
  return data.attributes
39
68
  }
40
69
 
41
- show_configuration = async (id: number): Promise<any> => {
42
- z.number().positive().parse(id)
43
- const {data} = await this.r.get(`/nodes/${id}/configuration`)
44
- return data
45
- }
46
-
47
- create = async (node: NodeCreate): Promise<NodeUpdated> => {
70
+ create = async (node: z.infer<typeof NodeCreateSchema>): Promise<Node> => {
71
+ node = NodeCreateSchema.parse(node)
48
72
  const {data} = await this.r.post<
49
- GenericResponse<NodeUpdated, "node">
50
- >(
51
- "/nodes",
52
- node
53
- )
73
+ GenericResponse<Node, "node">
74
+ >("/nodes", node)
54
75
  return data.attributes
55
76
  }
56
77
 
57
- update = async (id: number, node: Node): Promise<NodeUpdated> => {
78
+ get_configuration = async (id: number): Promise<NodeConfiguration> => {
79
+ z.number().positive().parse(id)
80
+ const {data} = await this.r.get<NodeConfiguration>(`/nodes/${id}/configuration`)
81
+ return data
82
+ }
83
+
84
+ update = async (id: number, node: z.infer<typeof NodeCreateSchema>): Promise<Node> => {
58
85
  z.number().positive().parse(id)
59
- const {data} = await this.r.put<
60
- GenericResponse<NodeUpdated, "node">
61
- >(
62
- `/nodes/${id}`,
63
- node
64
- )
86
+ node = NodeCreateSchema.parse(node)
87
+ const {data} = await this.r.patch<
88
+ GenericResponse<Node, "node">
89
+ >(`/nodes/${id}`, node)
65
90
  return data.attributes
66
91
  }
67
92
 
@@ -75,23 +100,25 @@ export class Nodes {
75
100
  )
76
101
  }
77
102
 
78
- type NodeCreate = {
79
- name: string,
80
- location_id: number,
81
- fqdn: string,
82
- scheme: "https" | "http",
83
- memory: number,
84
- memory_overallocate: number,
85
- disk: number,
86
- disk_overallocate: number,
87
- upload_size: number,
88
- daemon_listen: number,
89
- daemon_sftp: number
90
- }
91
-
92
- type NodeAllocatedResources = {
93
- memory: number,
94
- disk: number
95
- }
96
-
97
- type NodeUpdated = Node & {allocated_resources: NodeAllocatedResources}
103
+ const NodeCreateSchema = z.object({
104
+ name: z.string().min(1).max(100),
105
+ description: z.string().optional(),
106
+ public: z.boolean().optional(),
107
+ fqdn: z.string().nonempty(),
108
+ scheme: z.enum(["http", "https"]),
109
+ behind_proxy: z.boolean().optional(),
110
+ memory: z.number().min(0),
111
+ memory_overallocate: z.number().min(-1),
112
+ disk: z.number().min(0),
113
+ disk_overallocate: z.number().min(-1),
114
+ cpu: z.number().min(0),
115
+ cpu_overallocate: z.number().min(-1),
116
+ daemon_base: z.string().nonempty().optional(),
117
+ daemon_sftp: z.number().min(1).max(65535),
118
+ daemon_sftp_alias: z.string().optional(),
119
+ daemon_listen: z.number().min(1).max(65535),
120
+ daemon_connect: z.number().min(1).max(65535),
121
+ maintenance_mode: z.boolean().optional(),
122
+ upload_size: z.number().min(1).max(1024),
123
+ tags: z.array(z.string()).optional(),
124
+ })
@@ -1,5 +1,5 @@
1
1
  import {AxiosInstance} from "axios";
2
- import {Allocation, AllocationRel} from "@/api/common/types/server_allocations";
2
+ import {Allocation, AllocationRel} from "@/api/application/types/server_allocation";
3
3
  import {GenericListResponse, GenericResponse} from "@/api/base/types";
4
4
  import z from "zod";
5
5
 
@@ -25,17 +25,15 @@ export class NodesAllocations {
25
25
 
26
26
  create = async (
27
27
  ip: string,
28
- ports: number[] | string,
28
+ ports: string[],
29
29
  alias?: string
30
30
  ): Promise<void> => {
31
31
  z.ipv4().parse(ip)
32
- z.ipv4().or(z.url()).optional().parse(alias)
32
+ z.ipv4().or(z.url().max(255)).optional().parse(alias)
33
33
  z.array(z.number()).or(z.string().regex(/\d+-\d+/)).parse(ports)
34
34
 
35
35
  await this.r.post(`/nodes/${this.id}/allocations`, {
36
- ip,
37
- ports,
38
- alias
36
+ ip, ports, alias
39
37
  })
40
38
  }
41
39
 
@@ -0,0 +1,53 @@
1
+ import {AxiosInstance} from "axios";
2
+ import {GenericListResponse, GenericResponse} from "@/api/base/types";
3
+ import {Role} from "@/api/application/types/role";
4
+
5
+
6
+ // TODO: API is incomplete
7
+
8
+ export class Roles {
9
+ private readonly r: AxiosInstance
10
+
11
+ constructor(r: AxiosInstance) {
12
+ this.r = r
13
+ }
14
+
15
+ list = async (
16
+ page: number = 1
17
+ ): Promise<Role[]> => {
18
+ const {data} = await this.r.get<
19
+ GenericListResponse<GenericResponse<Role, "role">>
20
+ >(`/roles`, {
21
+ params: {page}
22
+ })
23
+ return data.data.map(r => r.attributes)
24
+ }
25
+
26
+ info = async (
27
+ id: number
28
+ ): Promise<Role> => {
29
+ const {data} = await this.r.get<
30
+ GenericResponse<Role, "role">
31
+ >(`/roles/${id}`)
32
+ return data.attributes
33
+ }
34
+
35
+ create = async (
36
+ opts: {name: string}
37
+ ): Promise<void> => {
38
+ await this.r.post(`/roles`, opts)
39
+ }
40
+
41
+ update = async (
42
+ id: number,
43
+ opts: {name: string}
44
+ ): Promise<void> => {
45
+ await this.r.patch(`/roles/${id}`, opts)
46
+ }
47
+
48
+ delete = async (
49
+ id: number
50
+ ): Promise<void> => {
51
+ await this.r.delete(`/roles/${id}`)
52
+ }
53
+ }
@@ -0,0 +1,135 @@
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
+
7
+ export class Servers {
8
+ private readonly r: AxiosInstance
9
+ private readonly id: number
10
+ databases: ServersDatabases
11
+
12
+ constructor(r: AxiosInstance, server_id: number) {
13
+ this.r = r
14
+ this.id = server_id
15
+
16
+ this.databases = new ServersDatabases(this.r, this.id)
17
+ }
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
+ })
23
+ return data.attributes
24
+ }
25
+
26
+ delete = async (force: boolean = false) => {
27
+ await this.r.delete(`/servers/${this.id}${force ? "/force" : ""}`)
28
+ }
29
+
30
+ updateDetails = async (opts: z.infer<typeof UpdateDetailsSchema>): Promise<void> => {
31
+ opts = UpdateDetailsSchema.parse(opts)
32
+ await this.r.patch(`/servers/${this.id}/details`, opts)
33
+ }
34
+
35
+ updateBuild = async (opts: z.infer<typeof UpdateBuildSchema>): Promise<void> => {
36
+ opts = UpdateBuildSchema.parse(opts)
37
+ await this.r.patch(`/servers/${this.id}/build`, opts)
38
+ }
39
+
40
+ updateStartup = async (opts: z.infer<typeof UpdateStartupSchema>): Promise<void> => {
41
+ opts = UpdateStartupSchema.parse(opts)
42
+ await this.r.patch(`/servers/${this.id}/startup`, opts)
43
+ }
44
+
45
+ suspend = async (): Promise<void> => {
46
+ await this.r.post(`/servers/${this.id}/suspend`)
47
+ }
48
+
49
+ unsuspend = async (): Promise<void> => {
50
+ await this.r.post(`/servers/${this.id}/unsuspend`)
51
+ }
52
+
53
+ reinstall = async (): Promise<void> => {
54
+ await this.r.post(`/servers/${this.id}/reinstall`)
55
+ }
56
+
57
+ transferStart = async (
58
+ node_id: number,
59
+ allocation_id: number,
60
+ allocation_additional?: string[]
61
+ ): Promise<void> => {
62
+ await this.r.post(`/servers/${this.id}/transfer`, {
63
+ node_id,
64
+ allocation_id,
65
+ allocation_additional
66
+ })
67
+ }
68
+
69
+ transferCancel = async (): Promise<void> => {
70
+ await this.r.post(`/servers/${this.id}/transfer/cancel`)
71
+ }
72
+ }
73
+
74
+
75
+ export const CreateServerSchema = z.object({
76
+ external_id: z.string().min(1).max(255).optional(),
77
+ name: z.string().min(1).max(255),
78
+ description: z.string().optional(),
79
+ user: z.number(),
80
+ egg: z.number(),
81
+ docker_image: z.string().optional(),
82
+ startup: z.string().optional(),
83
+ environment: z.array(z.string()),
84
+ skip_scripts: z.boolean().optional(),
85
+ oom_killer: z.boolean().optional(),
86
+ start_on_completion: z.boolean().optional(),
87
+ limits: z.object({
88
+ memory: z.number().min(0),
89
+ swap: z.number().min(-1),
90
+ disk: z.number().min(0),
91
+ io: z.number().min(0),
92
+ threads: z.string().optional(),
93
+ cpu: z.number().min(0)
94
+ }),
95
+ feature_limits: z.object({
96
+ databases: z.number().min(0),
97
+ allocations: z.number().min(0),
98
+ backups: z.number().min(0)
99
+ }),
100
+ allocation: z.object({
101
+ default: z.string(),
102
+ additional: z.array(z.string()).optional()
103
+ }).optional(),
104
+ deploy: z.object({
105
+ tags: z.array(z.string()).optional(),
106
+ dedicated_ip: z.boolean().optional(),
107
+ port_range: z.array(z.string()).optional()
108
+ }).optional()
109
+ })
110
+
111
+ const UpdateDetailsSchema = CreateServerSchema.pick({
112
+ external_id: true,
113
+ name: true,
114
+ user: true,
115
+ description: true
116
+ })
117
+
118
+ const UpdateBuildSchema = CreateServerSchema.pick({
119
+ oom_killer: true,
120
+ limits: true,
121
+ feature_limits: true,
122
+ }).extend({
123
+ allocation: z.number().optional(),
124
+ add_allocations: z.array(z.string()).optional(),
125
+ remove_allocations: z.array(z.string()).optional(),
126
+ })
127
+
128
+ const UpdateStartupSchema = CreateServerSchema.pick({
129
+ startup: true,
130
+ environment: true,
131
+ egg: true,
132
+ skip_scripts: true
133
+ }).extend({
134
+ image: z.string().optional()
135
+ })
@@ -0,0 +1,49 @@
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
+
6
+ // TODO: Check if database type is valid
7
+ export class ServersDatabases {
8
+ private readonly r: AxiosInstance
9
+ private readonly id: number
10
+
11
+ constructor(r: AxiosInstance, server_id: number) {
12
+ this.r = r
13
+ this.id = server_id
14
+ }
15
+
16
+ list = async (): Promise<ServerDatabase[]> => {
17
+ const {data} = await this.r.get<
18
+ GenericListResponse<GenericResponse<ServerDatabase, "server_database">>
19
+ >(`/servers/${this.id}/databases`)
20
+ return data.data.map(d => d.attributes)
21
+ }
22
+
23
+ create = async (
24
+ database: string,
25
+ remote: string,
26
+ host: string
27
+ ): Promise<ServerDatabase> => {
28
+ database = z.string().min(1).max(48).parse(database)
29
+ const {data} = await this.r.post<
30
+ GenericResponse<ServerDatabase, "server_database">
31
+ >(`/servers/${this.id}/databases`, {database, remote, host})
32
+ return data.attributes
33
+ }
34
+
35
+ info = async (database_id: number): Promise<ServerDatabase> => {
36
+ const {data} = await this.r.get<
37
+ GenericResponse<ServerDatabase, "server_database">
38
+ >(`/servers/${this.id}/databases/${database_id}`)
39
+ return data.attributes
40
+ }
41
+
42
+ delete = async (database_id: number): Promise<void> => {
43
+ await this.r.delete(`/servers/${this.id}/databases/${database_id}`)
44
+ }
45
+
46
+ resetPassword = async (database_id: number): Promise<void> => {
47
+ await this.r.post(`/servers/${this.id}/databases/${database_id}/reset-password`)
48
+ }
49
+ }
@@ -3,9 +3,7 @@ export type Container = {
3
3
  startup_command: string,
4
4
  image: string,
5
5
  installed: number,
6
- environment: {
7
- [key: string]: string | number
8
- },
6
+ environment: Record<string, string>,
9
7
  ports: number[],
10
8
  volumes: string[],
11
9
  network_mode: string
@@ -0,0 +1,11 @@
1
+ import {Nullable} from "@/utils/types";
2
+
3
+ export type DatabaseHost = {
4
+ id: number,
5
+ name: string,
6
+ host: string,
7
+ port: number,
8
+ username: string,
9
+ created_at: string,
10
+ updated_at: Nullable<string>
11
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./node"
2
+ export * from "./location"
3
+ export * from "./database_host"
4
+ export * from "./container"
5
+ export * from "./role"
6
+ export * from "./server_allocation"
7
+ export * from "./server"
8
+ export * from "./user"