@pelican.ts/sdk 0.4.8 → 0.4.9

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 +167 -101
  7. package/dist/api/index.mjs +167 -101
  8. package/dist/index.d.mts +2 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +123 -69
  11. package/dist/index.mjs +123 -69
  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 +10 -7
  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 {Schedule, ScheduleTask} from "@/api/common/types/server_schedule";
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
4
- import {PartialBy} from "@/utils/types";
1
+ import {AxiosInstance} from "axios"
2
+ import {Schedule, ScheduleTask} from "@/api/common/types/server_schedule"
3
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
+ import {PartialBy} from "@/utils/types"
5
5
 
6
6
  export class ServerSchedules {
7
7
  private readonly r: AxiosInstance
@@ -26,17 +26,18 @@ export class ServerSchedules {
26
26
  return data.attributes
27
27
  }
28
28
 
29
- control = (sched_id: number) => new ScheduleControl(this.r, this.id, sched_id)
29
+ control = (sched_id: number) =>
30
+ new ScheduleControl(this.r, this.id, sched_id)
30
31
  }
31
32
 
32
33
  type ScheduleCreateParams = {
33
- name: string,
34
- is_active?: boolean,
35
- only_when_online?: boolean,
36
- minute: string,
37
- hour: string,
38
- day_of_week: string,
39
- month: string,
34
+ name: string
35
+ is_active?: boolean
36
+ only_when_online?: boolean
37
+ minute: string
38
+ hour: string
39
+ day_of_week: string
40
+ month: string
40
41
  day_of_month: string
41
42
  }
42
43
 
@@ -70,13 +71,22 @@ class ScheduleControl {
70
71
  }
71
72
 
72
73
  execute = async (): Promise<void> => {
73
- await this.r.post(`/servers/${this.id}/schedules/${this.sched_id}/execute`)
74
+ await this.r.post(
75
+ `/servers/${this.id}/schedules/${this.sched_id}/execute`
76
+ )
74
77
  }
75
78
 
76
79
  tasks = {
77
80
  create: async (
78
81
  opts: PartialBy<
79
- Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">,
82
+ Pick<
83
+ ScheduleTask,
84
+ | "action"
85
+ | "payload"
86
+ | "time_offset"
87
+ | "sequence_id"
88
+ | "continue_on_failure"
89
+ >,
80
90
  "payload" | "sequence_id" | "continue_on_failure"
81
91
  >
82
92
  ): Promise<ScheduleTask> => {
@@ -86,21 +96,35 @@ class ScheduleControl {
86
96
  return data.attributes
87
97
  },
88
98
 
89
- update: async <T extends "command" | "power" | "backup" | "delete_files">(
99
+ update: async <
100
+ T extends "command" | "power" | "backup" | "delete_files"
101
+ >(
90
102
  task_id: number,
91
103
  opts: PartialBy<
92
- Pick<ScheduleTask, "action" | "payload" | "time_offset" | "sequence_id" | "continue_on_failure">,
104
+ Pick<
105
+ ScheduleTask,
106
+ | "action"
107
+ | "payload"
108
+ | "time_offset"
109
+ | "sequence_id"
110
+ | "continue_on_failure"
111
+ >,
93
112
  "payload" | "sequence_id" | "continue_on_failure"
94
113
  >
95
114
  ): Promise<ScheduleTask> => {
96
115
  const {data} = await this.r.post<
97
116
  GenericResponse<ScheduleTask, "server_schedule_task">
98
- >(`/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`, opts)
117
+ >(
118
+ `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`,
119
+ opts
120
+ )
99
121
  return data.attributes
100
122
  },
101
123
 
102
124
  delete: async (task_id: number): Promise<void> => {
103
- await this.r.delete(`/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`)
125
+ await this.r.delete(
126
+ `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`
127
+ )
104
128
  }
105
129
  }
106
- }
130
+ }
@@ -1,7 +1,6 @@
1
- import {AxiosInstance} from "axios";
2
- import z from "zod";
3
- import {Nullable} from "@/utils/types";
4
-
1
+ import {AxiosInstance} from "axios"
2
+ import z from "zod"
3
+ import {Nullable} from "@/utils/types"
5
4
 
6
5
  export class ServerSettings {
7
6
  private readonly r: AxiosInstance
@@ -17,8 +16,12 @@ export class ServerSettings {
17
16
  await this.r.post(`/servers/${this.id}/settings/rename`, {name})
18
17
  }
19
18
 
20
- updateDescription = async (description: Nullable<string>): Promise<void> => {
21
- await this.r.post(`/servers/${this.id}/settings/description`, {description})
19
+ updateDescription = async (
20
+ description: Nullable<string>
21
+ ): Promise<void> => {
22
+ await this.r.post(`/servers/${this.id}/settings/description`, {
23
+ description
24
+ })
22
25
  }
23
26
 
24
27
  reinstall = async (): Promise<void> => {
@@ -28,4 +31,4 @@ export class ServerSettings {
28
31
  changeDockerImage = async (image: string): Promise<void> => {
29
32
  await this.r.post(`/servers/${this.id}/settings/docker-image`, {image})
30
33
  }
31
- }
34
+ }
@@ -1,7 +1,10 @@
1
- import {AxiosInstance} from "axios";
2
- import {CustomListResponse, GenericListResponse, GenericResponse} from "@/api/base/types";
3
- import {StartupMeta, StartupParams} from "@/api/common/types/server_startup";
4
-
1
+ import {AxiosInstance} from "axios"
2
+ import {
3
+ CustomListResponse,
4
+ GenericListResponse,
5
+ GenericResponse
6
+ } from "@/api/base/types"
7
+ import {StartupMeta, StartupParams} from "@/api/common/types/server_startup"
5
8
 
6
9
  export class ServerStartup {
7
10
  private readonly r: AxiosInstance
@@ -12,15 +15,20 @@ export class ServerStartup {
12
15
  this.id = id
13
16
  }
14
17
 
15
- list = async (): Promise<CustomListResponse<StartupParams, StartupMeta>> => {
18
+ list = async (): Promise<
19
+ CustomListResponse<StartupParams, StartupMeta>
20
+ > => {
16
21
  const {data} = await this.r.get<
17
- CustomListResponse<GenericResponse<StartupParams, "egg_variable">, StartupMeta>
22
+ CustomListResponse<
23
+ GenericResponse<StartupParams, "egg_variable">,
24
+ StartupMeta
25
+ >
18
26
  >(`/servers/${this.id}/startup`)
19
27
 
20
28
  return {
21
29
  object: "list",
22
30
  meta: data.meta,
23
- data: data.data.map(d=>d.attributes)
31
+ data: data.data.map(d => d.attributes)
24
32
  }
25
33
  }
26
34
 
@@ -30,4 +38,4 @@ export class ServerStartup {
30
38
  >(`/servers/${this.id}/startup/variable`, {key, value})
31
39
  return data.attributes
32
40
  }
33
- }
41
+ }
@@ -1,6 +1,9 @@
1
- import {AxiosInstance} from "axios";
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types";
3
- import {ServerSubuser, SubuserPermission} from "@/api/client/types/server_subuser";
1
+ import {AxiosInstance} from "axios"
2
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
+ import {
4
+ ServerSubuser,
5
+ SubuserPermission
6
+ } from "@/api/client/types/server_subuser"
4
7
 
5
8
  export class ServerUsers {
6
9
  private readonly r: AxiosInstance
@@ -18,7 +21,10 @@ export class ServerUsers {
18
21
  return data.data.map(d => d.attributes)
19
22
  }
20
23
 
21
- create = async (email: string, permissions: SubuserPermission[] | string[]): Promise<ServerSubuser> => {
24
+ create = async (
25
+ email: string,
26
+ permissions: SubuserPermission[] | string[]
27
+ ): Promise<ServerSubuser> => {
22
28
  const {data} = await this.r.post<
23
29
  GenericResponse<ServerSubuser, "user">
24
30
  >(`/servers/${this.id}/users`, {email, permissions})
@@ -26,21 +32,24 @@ export class ServerUsers {
26
32
  }
27
33
 
28
34
  info = async (user_uuid: string): Promise<ServerSubuser> => {
29
- const {data} = await this.r.get<
30
- GenericResponse<ServerSubuser, "user">
31
- >(`/servers/${this.id}/users/${user_uuid}`)
35
+ const {data} = await this.r.get<GenericResponse<ServerSubuser, "user">>(
36
+ `/servers/${this.id}/users/${user_uuid}`
37
+ )
32
38
  return data.attributes
33
39
  }
34
40
 
35
- update = async (user_uuid: string, permissions: SubuserPermission[] | string[]): Promise<ServerSubuser> => {
36
- const {data} = await this.r.put<
37
- GenericResponse<ServerSubuser, "user">
38
- >(`/servers/${this.id}/users/${user_uuid}`, {permissions})
41
+ update = async (
42
+ user_uuid: string,
43
+ permissions: SubuserPermission[] | string[]
44
+ ): Promise<ServerSubuser> => {
45
+ const {data} = await this.r.put<GenericResponse<ServerSubuser, "user">>(
46
+ `/servers/${this.id}/users/${user_uuid}`,
47
+ {permissions}
48
+ )
39
49
  return data.attributes
40
50
  }
41
51
 
42
52
  delete = async (user_uuid: string): Promise<void> => {
43
53
  await this.r.delete(`/servers/${this.id}/users/${user_uuid}`)
44
54
  }
45
-
46
- }
55
+ }
@@ -8,18 +8,12 @@ import {
8
8
  SOCKET_EVENT,
9
9
  StatsWsJson,
10
10
  WebsocketEvent
11
- } from "@/api/client/types/websocket";
12
- import {ServerSignalOption} from "@/api/common/types/server_power";
11
+ } from "@/api/client/types/websocket"
12
+ import {ServerSignalOption} from "@/api/common/types/server_power"
13
13
 
14
14
  const isBrowser = typeof window !== "undefined"
15
15
 
16
-
17
- type WebsocketHandshakePayload = {
18
- data: {
19
- token: string
20
- socket: string
21
- }
22
- }
16
+ type WebsocketHandshakePayload = {data: {token: string; socket: string}}
23
17
 
24
18
  type SocketEventPayloadMap = {
25
19
  [SOCKET_EVENT.AUTH_SUCCESS]: undefined
@@ -40,9 +34,10 @@ type SocketEventPayloadMap = {
40
34
  [SOCKET_EVENT.JWT_ERROR]: string
41
35
  }
42
36
 
43
- type Listener<E extends SOCKET_EVENT> = SocketEventPayloadMap[E] extends undefined
44
- ? () => void
45
- : (payload: SocketEventPayloadMap[E]) => void
37
+ type Listener<E extends SOCKET_EVENT> =
38
+ SocketEventPayloadMap[E] extends undefined
39
+ ? () => void
40
+ : (payload: SocketEventPayloadMap[E]) => void
46
41
 
47
42
  type MessageEventLike = {data?: unknown}
48
43
 
@@ -52,7 +47,7 @@ type ErrorEventLike = Parameters<NonNullable<WebSocket["onerror"]>>[0]
52
47
 
53
48
  const RECONNECT_ERRORS = new Set([
54
49
  "jwt: exp claim is invalid",
55
- "jwt: created too far in past (denylist)",
50
+ "jwt: created too far in past (denylist)"
56
51
  ])
57
52
 
58
53
  const FALLBACK_LOG_MESSAGE = "No logs - is the server online?"
@@ -67,13 +62,20 @@ export class ServerWebsocket {
67
62
  private stripColors: boolean
68
63
  private detachMessageListener?: () => void
69
64
 
70
- constructor(requester: AxiosInstance, id: string, stripColors: boolean = false) {
65
+ constructor(
66
+ requester: AxiosInstance,
67
+ id: string,
68
+ stripColors: boolean = false
69
+ ) {
71
70
  this.r = requester
72
71
  this.serverId = id
73
72
  this.stripColors = stripColors
74
73
  }
75
74
 
76
- public on<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): () => void {
75
+ public on<E extends SOCKET_EVENT>(
76
+ event: E,
77
+ listener: Listener<E>
78
+ ): () => void {
77
79
  const handler = listener as (...args: unknown[]) => void
78
80
  this.bus.on(event, handler)
79
81
  return () => {
@@ -81,12 +83,20 @@ export class ServerWebsocket {
81
83
  }
82
84
  }
83
85
 
84
- public deregister<E extends SOCKET_EVENT>(event: E, listener: Listener<E>): void {
86
+ public deregister<E extends SOCKET_EVENT>(
87
+ event: E,
88
+ listener: Listener<E>
89
+ ): void {
85
90
  const handler = listener as (...args: unknown[]) => void
86
91
  this.bus.removeListener(event, handler)
87
92
  }
88
93
 
89
- private emit<E extends SOCKET_EVENT>(event: E, ...args: SocketEventPayloadMap[E] extends undefined ? [] : [SocketEventPayloadMap[E]]): void {
94
+ private emit<E extends SOCKET_EVENT>(
95
+ event: E,
96
+ ...args: SocketEventPayloadMap[E] extends undefined
97
+ ? []
98
+ : [SocketEventPayloadMap[E]]
99
+ ): void {
90
100
  if (args.length === 0) {
91
101
  this.bus.emit(event)
92
102
  } else {
@@ -94,7 +104,10 @@ export class ServerWebsocket {
94
104
  }
95
105
  }
96
106
 
97
- public async connect(resumable?: boolean, debugLogging?: boolean): Promise<void> {
107
+ public async connect(
108
+ resumable?: boolean,
109
+ debugLogging?: boolean
110
+ ): Promise<void> {
98
111
  this.debugLogging = debugLogging ?? false
99
112
 
100
113
  if (this.socket) {
@@ -105,7 +118,9 @@ export class ServerWebsocket {
105
118
 
106
119
  this.socket = isBrowser
107
120
  ? new WebSocket(socketUrl)
108
- : new WebSocket(socketUrl, undefined, {origin: new URL(socketUrl).origin})
121
+ : new WebSocket(socketUrl, undefined, {
122
+ origin: new URL(socketUrl).origin
123
+ })
109
124
 
110
125
  await new Promise<void>((resolve, reject) => {
111
126
  const socket = this.socket
@@ -124,14 +139,22 @@ export class ServerWebsocket {
124
139
  } catch (error) {
125
140
  socket.onopen = null
126
141
  socket.onerror = null
127
- reject(error instanceof Error ? error : new Error("Websocket authentication failed"))
142
+ reject(
143
+ error instanceof Error
144
+ ? error
145
+ : new Error("Websocket authentication failed")
146
+ )
128
147
  }
129
148
  }
130
149
 
131
150
  socket.onerror = (event: ErrorEventLike) => {
132
151
  socket.onopen = null
133
152
  socket.onerror = null
134
- reject(event instanceof Error ? event : new Error("Websocket connection error"))
153
+ reject(
154
+ event instanceof Error
155
+ ? event
156
+ : new Error("Websocket connection error")
157
+ )
135
158
  }
136
159
  })
137
160
 
@@ -189,21 +212,33 @@ export class ServerWebsocket {
189
212
  }
190
213
 
191
214
  if (typeof this.socket.addEventListener === "function") {
192
- this.socket.addEventListener("message", handler as (event: MessageEventLike) => void)
215
+ this.socket.addEventListener(
216
+ "message",
217
+ handler as (event: MessageEventLike) => void
218
+ )
193
219
  this.detachMessageListener = () => {
194
- this.socket?.removeEventListener?.("message", handler as (event: MessageEventLike) => void)
220
+ this.socket?.removeEventListener?.(
221
+ "message",
222
+ handler as (event: MessageEventLike) => void
223
+ )
195
224
  }
196
225
  } else {
197
- const fallback = (data: unknown) => handler({data} satisfies MessageEventLike)
226
+ const fallback = (data: unknown) =>
227
+ handler({data} satisfies MessageEventLike)
198
228
  const socket = this.socket as unknown as {
199
229
  on?: (event: string, listener: (data: unknown) => void) => void
200
230
  off?: (event: string, listener: (data: unknown) => void) => void
201
- removeListener?: (event: string, listener: (data: unknown) => void) => void
231
+ removeListener?: (
232
+ event: string,
233
+ listener: (data: unknown) => void
234
+ ) => void
202
235
  }
203
236
 
204
237
  socket.on?.("message", fallback)
205
238
  this.detachMessageListener = () => {
206
- const target = this.socket as unknown as typeof socket | undefined
239
+ const target = this.socket as unknown as
240
+ | typeof socket
241
+ | undefined
207
242
  if (!target) {
208
243
  return
209
244
  }
@@ -261,7 +296,10 @@ export class ServerWebsocket {
261
296
  return event.toString("utf8")
262
297
  }
263
298
 
264
- if (typeof ArrayBuffer !== "undefined" && event instanceof ArrayBuffer) {
299
+ if (
300
+ typeof ArrayBuffer !== "undefined"
301
+ && event instanceof ArrayBuffer
302
+ ) {
265
303
  if (typeof TextDecoder !== "undefined") {
266
304
  return new TextDecoder().decode(new Uint8Array(event))
267
305
  }
@@ -318,7 +356,9 @@ export class ServerWebsocket {
318
356
  }
319
357
  case SOCKET_EVENT.BACKUP_COMPLETED: {
320
358
  try {
321
- const payload = JSON.parse(message.args[0]) as BackupCompletedJson
359
+ const payload = JSON.parse(
360
+ message.args[0]
361
+ ) as BackupCompletedJson
322
362
  this.emit(SOCKET_EVENT.BACKUP_COMPLETED, payload)
323
363
  } catch (error) {
324
364
  if (this.debugLogging) {
@@ -401,7 +441,9 @@ export class ServerWebsocket {
401
441
  }
402
442
 
403
443
  private async refreshCredentials(): Promise<string> {
404
- const {data} = await this.r.get<WebsocketHandshakePayload>(`/servers/${this.serverId}/websocket`)
444
+ const {data} = await this.r.get<WebsocketHandshakePayload>(
445
+ `/servers/${this.serverId}/websocket`
446
+ )
405
447
  this.currentToken = data.data.token
406
448
  return data.data.socket
407
449
  }
@@ -415,7 +457,9 @@ export class ServerWebsocket {
415
457
  throw new Error("Missing websocket token")
416
458
  }
417
459
 
418
- this.socket.send(JSON.stringify({event: "auth", args: [this.currentToken]}))
460
+ this.socket.send(
461
+ JSON.stringify({event: "auth", args: [this.currentToken]})
462
+ )
419
463
  }
420
464
 
421
465
  public disconnect(): void {
@@ -438,7 +482,9 @@ export class ServerWebsocket {
438
482
  private send(event: string, args: unknown[]): void {
439
483
  if (!this.socket) {
440
484
  if (this.debugLogging) {
441
- console.warn(`Attempted to send "${event}" without an active websocket connection`)
485
+ console.warn(
486
+ `Attempted to send "${event}" without an active websocket connection`
487
+ )
442
488
  }
443
489
  return
444
490
  }
@@ -459,7 +505,7 @@ export class ServerWebsocket {
459
505
  reject(new Error("Timed out waiting for stats"))
460
506
  }, 5000)
461
507
 
462
- off = this.on(SOCKET_EVENT.STATS, (payload) => {
508
+ off = this.on(SOCKET_EVENT.STATS, payload => {
463
509
  clearTimeout(timeout)
464
510
  off?.()
465
511
  resolve(payload)
@@ -496,7 +542,7 @@ export class ServerWebsocket {
496
542
  finalize(lines.length > 0 ? lines : [FALLBACK_LOG_MESSAGE])
497
543
  }, 5000)
498
544
 
499
- off = this.on(SOCKET_EVENT.CONSOLE_OUTPUT, (line) => {
545
+ off = this.on(SOCKET_EVENT.CONSOLE_OUTPUT, line => {
500
546
  lines.push(line)
501
547
  if (initialTimeout) {
502
548
  clearTimeout(initialTimeout)
@@ -1,9 +1,9 @@
1
- import { GenericListResponse, GenericResponse } from "@/api/base/types"
2
- import { EggVariable } from "@/api/common/types/egg"
3
- import { ServerSubuser } from "@/api/client/types/server_subuser"
4
- import { FeatureLimits, ServerLimits } from "@/api/common/types/server_limits"
5
- import { ServerAllocation } from "@/api/client/types/server_allocation"
6
- import { Nullable } from "@/utils/types"
1
+ import {GenericListResponse, GenericResponse} from "@/api/base/types"
2
+ import {EggVariable} from "@/api/common/types/egg"
3
+ import {ServerSubuser} from "@/api/client/types/server_subuser"
4
+ import {FeatureLimits, ServerLimits} from "@/api/common/types/server_limits"
5
+ import {ServerAllocation} from "@/api/client/types/server_allocation"
6
+ import {Nullable} from "@/utils/types"
7
7
 
8
8
  export type Server = {
9
9
  server_owner: boolean
@@ -13,11 +13,7 @@ export type Server = {
13
13
  name: string
14
14
  node: string
15
15
  is_node_under_maintenance: boolean
16
- sftp_details: {
17
- ip: string
18
- alias: Nullable<string>
19
- port: number
20
- }
16
+ sftp_details: {ip: string; alias: Nullable<string>; port: number}
21
17
  description: string
22
18
  limits: ServerLimits
23
19
  invocation: string
@@ -35,13 +31,7 @@ export type Server = {
35
31
  variables: GenericListResponse<
36
32
  GenericResponse<EggVariable, "egg_variable">
37
33
  >
38
- egg?: GenericResponse<
39
- {
40
- uuid: string
41
- name: string
42
- },
43
- "egg"
44
- >
34
+ egg?: GenericResponse<{uuid: string; name: string}, "egg">
45
35
  subusers?: GenericListResponse<
46
36
  GenericResponse<ServerSubuser, "server_subuser">
47
37
  >
@@ -1,11 +1,10 @@
1
- import {Nullable} from "@/utils/types";
2
-
1
+ import {Nullable} from "@/utils/types"
3
2
 
4
3
  export type ServerAllocation = {
5
- id: number,
6
- ip: string,
7
- alias: Nullable<string>,
8
- port: number,
9
- notes: Nullable<string>,
4
+ id: number
5
+ ip: string
6
+ alias: Nullable<string>
7
+ port: number
8
+ notes: Nullable<string>
10
9
  is_default: boolean
11
- }
10
+ }
@@ -1,17 +1,16 @@
1
1
  export type ServerSubuser = {
2
- uuid: string,
3
- username: string,
4
- email: string,
5
- language: string,
6
- image: string,
7
- admin: false,
8
- root_admin: false,
9
- "2fa_enabled": boolean,
10
- created_at: string,
2
+ uuid: string
3
+ username: string
4
+ email: string
5
+ language: string
6
+ image: string
7
+ admin: false
8
+ root_admin: false
9
+ "2fa_enabled": boolean
10
+ created_at: string
11
11
  permissions: SubuserPermission[] | string[]
12
12
  }
13
13
 
14
-
15
14
  export type SubuserPermission =
16
15
  | "activity.read"
17
16
  | "allocation.create"
@@ -53,4 +52,4 @@ export type SubuserPermission =
53
52
  | "user.delete"
54
53
  | "user.read"
55
54
  | "user.update"
56
- | "websocket.connect"
55
+ | "websocket.connect"
@@ -1,4 +1,4 @@
1
- import { Nullable } from "@/utils/types"
1
+ import {Nullable} from "@/utils/types"
2
2
 
3
3
  export type User = {
4
4
  uuid: string
@@ -28,7 +28,4 @@ export type SSHKey = {
28
28
  created_at: string
29
29
  }
30
30
 
31
- export type Permission = {
32
- description: string
33
- keys: Record<string, string>
34
- }
31
+ export type Permission = {description: string; keys: Record<string, string>}