@pelican.ts/sdk 0.4.7 → 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 -14
  5. package/dist/api/index.d.ts +5 -14
  6. package/dist/api/index.js +167 -114
  7. package/dist/api/index.mjs +167 -114
  8. package/dist/index.d.mts +2 -18
  9. package/dist/index.d.ts +2 -18
  10. package/dist/index.js +123 -92
  11. package/dist/index.mjs +123 -92
  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 -35
  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 -15
  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
package/dist/api/index.js CHANGED
@@ -84,19 +84,6 @@ var Account = class {
84
84
  await this.r.post(`/account/ssh-keys/remove`, { fingerprint });
85
85
  }
86
86
  };
87
- twoFactor = {
88
- info: async () => {
89
- const { data } = await this.r.get("/account/two-factor");
90
- return data;
91
- },
92
- enable: async (code) => {
93
- const { data } = await this.r.post("/account/two-factor", { code });
94
- return data;
95
- },
96
- disable: async (password) => {
97
- await this.r.delete("/account/two-factor", { data: { password } });
98
- }
99
- };
100
87
  };
101
88
 
102
89
  // src/api/client/client.ts
@@ -141,29 +128,28 @@ var ServerFiles = class {
141
128
  this.id = id;
142
129
  }
143
130
  list = async (path) => {
144
- const { data } = await this.r.get(`/servers/${this.id}/files/list`, {
145
- params: { directory: path }
146
- });
131
+ const { data } = await this.r.get(`/servers/${this.id}/files/list`, { params: { directory: path } });
147
132
  return data.data.map((r) => r.attributes);
148
133
  };
149
134
  /**
150
135
  * Return the contents of a file. To read binary file (non-editable) use {@link download} instead
151
136
  */
152
137
  contents = async (path) => {
153
- const { data } = await this.r.get(`/servers/${this.id}/files/contents`, {
154
- params: { file: path }
155
- });
138
+ const { data } = await this.r.get(
139
+ `/servers/${this.id}/files/contents`,
140
+ { params: { file: path } }
141
+ );
156
142
  return data;
157
143
  };
158
144
  downloadGetUrl = async (path) => {
159
- const { data } = await this.r.get(`/servers/${this.id}/files/download`, {
160
- params: { file: path }
161
- });
145
+ const { data } = await this.r.get(`/servers/${this.id}/files/download`, { params: { file: path } });
162
146
  return data.attributes.url;
163
147
  };
164
148
  download = async (path) => {
165
149
  const url = await this.downloadGetUrl(path);
166
- const { data } = await import_axios.default.get(url, { responseType: "arraybuffer" });
150
+ const { data } = await import_axios.default.get(url, {
151
+ responseType: "arraybuffer"
152
+ });
167
153
  return data;
168
154
  };
169
155
  rename = async (root = "/", files) => {
@@ -178,7 +164,12 @@ var ServerFiles = class {
178
164
  });
179
165
  };
180
166
  compress = async (root = "/", files, archive_name, extension) => {
181
- const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
167
+ const { data } = await this.r.post(`/servers/${this.id}/files/compress`, {
168
+ root,
169
+ files,
170
+ archive_name,
171
+ extension
172
+ });
182
173
  return data.attributes;
183
174
  };
184
175
  decompress = async (root = "/", file) => {
@@ -188,13 +179,22 @@ var ServerFiles = class {
188
179
  await this.r.post(`/servers/${this.id}/files/delete`, { root, files });
189
180
  };
190
181
  createFolder = async (root = "/", name) => {
191
- await this.r.post(`/servers/${this.id}/files/create-folder`, { root, name });
182
+ await this.r.post(`/servers/${this.id}/files/create-folder`, {
183
+ root,
184
+ name
185
+ });
192
186
  };
193
187
  chmod = async (root = "/", files) => {
194
188
  await this.r.post(`/servers/${this.id}/files/chmod`, { root, files });
195
189
  };
196
190
  pullFromRemote = async (url, directory, filename, use_header = false, foreground = false) => {
197
- await this.r.post(`/servers/${this.id}/files/pull`, { url, directory, filename, use_header, foreground });
191
+ await this.r.post(`/servers/${this.id}/files/pull`, {
192
+ url,
193
+ directory,
194
+ filename,
195
+ use_header,
196
+ foreground
197
+ });
198
198
  };
199
199
  uploadGetUrl = async () => {
200
200
  const { data } = await this.r.get(`/servers/${this.id}/files/upload`);
@@ -202,10 +202,14 @@ var ServerFiles = class {
202
202
  };
203
203
  upload = async (file, root = "/") => {
204
204
  const url = await this.uploadGetUrl();
205
- await import_axios.default.post(url, { files: file }, {
206
- headers: { "Content-Type": "multipart/form-data" },
207
- params: { directory: root }
208
- });
205
+ await import_axios.default.post(
206
+ url,
207
+ { files: file },
208
+ {
209
+ headers: { "Content-Type": "multipart/form-data" },
210
+ params: { directory: root }
211
+ }
212
+ );
209
213
  };
210
214
  };
211
215
 
@@ -248,7 +252,9 @@ var ScheduleControl = class {
248
252
  await this.r.delete(`/servers/${this.id}/schedules/${this.sched_id}`);
249
253
  };
250
254
  execute = async () => {
251
- await this.r.post(`/servers/${this.id}/schedules/${this.sched_id}/execute`);
255
+ await this.r.post(
256
+ `/servers/${this.id}/schedules/${this.sched_id}/execute`
257
+ );
252
258
  };
253
259
  tasks = {
254
260
  create: async (opts) => {
@@ -256,11 +262,16 @@ var ScheduleControl = class {
256
262
  return data.attributes;
257
263
  },
258
264
  update: async (task_id, opts) => {
259
- const { data } = await this.r.post(`/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`, opts);
265
+ const { data } = await this.r.post(
266
+ `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`,
267
+ opts
268
+ );
260
269
  return data.attributes;
261
270
  },
262
271
  delete: async (task_id) => {
263
- await this.r.delete(`/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`);
272
+ await this.r.delete(
273
+ `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`
274
+ );
264
275
  }
265
276
  };
266
277
  };
@@ -290,7 +301,9 @@ var ServerAllocations = class {
290
301
  return data.attributes;
291
302
  };
292
303
  unassign = async (alloc_id) => {
293
- await this.r.delete(`/servers/${this.id}/network/allocations/${alloc_id}`);
304
+ await this.r.delete(
305
+ `/servers/${this.id}/network/allocations/${alloc_id}`
306
+ );
294
307
  };
295
308
  };
296
309
 
@@ -311,11 +324,16 @@ var ServerUsers = class {
311
324
  return data.attributes;
312
325
  };
313
326
  info = async (user_uuid) => {
314
- const { data } = await this.r.get(`/servers/${this.id}/users/${user_uuid}`);
327
+ const { data } = await this.r.get(
328
+ `/servers/${this.id}/users/${user_uuid}`
329
+ );
315
330
  return data.attributes;
316
331
  };
317
332
  update = async (user_uuid, permissions) => {
318
- const { data } = await this.r.put(`/servers/${this.id}/users/${user_uuid}`, { permissions });
333
+ const { data } = await this.r.put(
334
+ `/servers/${this.id}/users/${user_uuid}`,
335
+ { permissions }
336
+ );
319
337
  return data.attributes;
320
338
  };
321
339
  delete = async (user_uuid) => {
@@ -335,9 +353,7 @@ var ServerBackups = class {
335
353
  }
336
354
  list = async (page = 1) => {
337
355
  import_zod3.default.number().positive().parse(page);
338
- const { data } = await this.r.get(`/servers/${this.id}/backups`, {
339
- params: { page }
340
- });
356
+ const { data } = await this.r.get(`/servers/${this.id}/backups`, { params: { page } });
341
357
  return data.data.map((d) => d.attributes);
342
358
  };
343
359
  create = async (args) => {
@@ -359,20 +375,27 @@ var ServerBackups = class {
359
375
  };
360
376
  download = async (backup_uuid) => {
361
377
  const url = await this.downloadGetUrl(backup_uuid);
362
- const { data } = await import_axios2.default.get(url, { responseType: "arraybuffer" });
378
+ const { data } = await import_axios2.default.get(url, {
379
+ responseType: "arraybuffer"
380
+ });
363
381
  return data;
364
382
  };
365
383
  delete = async (backup_uuid) => {
366
384
  await this.r.delete(`/servers/${this.id}/backups/${backup_uuid}`);
367
385
  };
368
386
  rename = async (backup_uuid, name) => {
369
- await this.r.put(`/servers/${this.id}/backups/${backup_uuid}/rename`, { name });
387
+ await this.r.put(`/servers/${this.id}/backups/${backup_uuid}/rename`, {
388
+ name
389
+ });
370
390
  };
371
391
  toggleLock = async (backup_uuid) => {
372
392
  await this.r.post(`/servers/${this.id}/backups/${backup_uuid}/lock`);
373
393
  };
374
394
  restore = async (backup_uuid, truncate) => {
375
- await this.r.post(`/servers/${this.id}/backups/${backup_uuid}/restore`, { truncate });
395
+ await this.r.post(
396
+ `/servers/${this.id}/backups/${backup_uuid}/restore`,
397
+ { truncate }
398
+ );
376
399
  };
377
400
  };
378
401
 
@@ -412,7 +435,9 @@ var ServerSettings = class {
412
435
  await this.r.post(`/servers/${this.id}/settings/rename`, { name });
413
436
  };
414
437
  updateDescription = async (description) => {
415
- await this.r.post(`/servers/${this.id}/settings/description`, { description });
438
+ await this.r.post(`/servers/${this.id}/settings/description`, {
439
+ description
440
+ });
416
441
  };
417
442
  reinstall = async () => {
418
443
  await this.r.post(`/servers/${this.id}/settings/reinstall`);
@@ -470,7 +495,9 @@ var ServerWebsocket = class {
470
495
  return;
471
496
  }
472
497
  const socketUrl = await this.refreshCredentials();
473
- this.socket = isBrowser ? new import_isomorphic_ws.default(socketUrl) : new import_isomorphic_ws.default(socketUrl, void 0, { origin: new URL(socketUrl).origin });
498
+ this.socket = isBrowser ? new import_isomorphic_ws.default(socketUrl) : new import_isomorphic_ws.default(socketUrl, void 0, {
499
+ origin: new URL(socketUrl).origin
500
+ });
474
501
  await new Promise((resolve, reject) => {
475
502
  const socket = this.socket;
476
503
  if (!socket) {
@@ -487,13 +514,17 @@ var ServerWebsocket = class {
487
514
  } catch (error) {
488
515
  socket.onopen = null;
489
516
  socket.onerror = null;
490
- reject(error instanceof Error ? error : new Error("Websocket authentication failed"));
517
+ reject(
518
+ error instanceof Error ? error : new Error("Websocket authentication failed")
519
+ );
491
520
  }
492
521
  };
493
522
  socket.onerror = (event) => {
494
523
  socket.onopen = null;
495
524
  socket.onerror = null;
496
- reject(event instanceof Error ? event : new Error("Websocket connection error"));
525
+ reject(
526
+ event instanceof Error ? event : new Error("Websocket connection error")
527
+ );
497
528
  };
498
529
  });
499
530
  if (resumable) {
@@ -539,9 +570,15 @@ var ServerWebsocket = class {
539
570
  void this.handleIncomingMessage(event);
540
571
  };
541
572
  if (typeof this.socket.addEventListener === "function") {
542
- this.socket.addEventListener("message", handler);
573
+ this.socket.addEventListener(
574
+ "message",
575
+ handler
576
+ );
543
577
  this.detachMessageListener = () => {
544
- this.socket?.removeEventListener?.("message", handler);
578
+ this.socket?.removeEventListener?.(
579
+ "message",
580
+ handler
581
+ );
545
582
  };
546
583
  } else {
547
584
  const fallback = (data) => handler({ data });
@@ -651,7 +688,9 @@ var ServerWebsocket = class {
651
688
  }
652
689
  case "backup completed" /* BACKUP_COMPLETED */: {
653
690
  try {
654
- const payload = JSON.parse(message.args[0]);
691
+ const payload = JSON.parse(
692
+ message.args[0]
693
+ );
655
694
  this.emit("backup completed" /* BACKUP_COMPLETED */, payload);
656
695
  } catch (error) {
657
696
  if (this.debugLogging) {
@@ -733,7 +772,9 @@ var ServerWebsocket = class {
733
772
  }
734
773
  }
735
774
  async refreshCredentials() {
736
- const { data } = await this.r.get(`/servers/${this.serverId}/websocket`);
775
+ const { data } = await this.r.get(
776
+ `/servers/${this.serverId}/websocket`
777
+ );
737
778
  this.currentToken = data.data.token;
738
779
  return data.data.socket;
739
780
  }
@@ -744,7 +785,9 @@ var ServerWebsocket = class {
744
785
  if (!this.currentToken) {
745
786
  throw new Error("Missing websocket token");
746
787
  }
747
- this.socket.send(JSON.stringify({ event: "auth", args: [this.currentToken] }));
788
+ this.socket.send(
789
+ JSON.stringify({ event: "auth", args: [this.currentToken] })
790
+ );
748
791
  }
749
792
  disconnect() {
750
793
  this.detachMessageListener?.();
@@ -763,7 +806,9 @@ var ServerWebsocket = class {
763
806
  send(event, args) {
764
807
  if (!this.socket) {
765
808
  if (this.debugLogging) {
766
- console.warn(`Attempted to send "${event}" without an active websocket connection`);
809
+ console.warn(
810
+ `Attempted to send "${event}" without an active websocket connection`
811
+ );
767
812
  }
768
813
  return;
769
814
  }
@@ -844,12 +889,7 @@ var ServerActivity = class {
844
889
  this.id = id;
845
890
  }
846
891
  list = async (page = 1, per_page = 25) => {
847
- const { data } = await this.r.get(`/server/${this.id}/activity`, {
848
- params: {
849
- page,
850
- per_page
851
- }
852
- });
892
+ const { data } = await this.r.get(`/server/${this.id}/activity`, { params: { page, per_page } });
853
893
  return data.data.map((log) => log.attributes);
854
894
  };
855
895
  };
@@ -883,16 +923,19 @@ var ServerClient = class {
883
923
  this.settings = new ServerSettings(requester, id);
884
924
  }
885
925
  info = async (include) => {
886
- const { data } = await this.r.get(`/servers/${this.id}`, {
887
- params: { include: include?.join(",") }
888
- });
926
+ const { data } = await this.r.get(
927
+ `/servers/${this.id}`,
928
+ { params: { include: include?.join(",") } }
929
+ );
889
930
  return data.attributes;
890
931
  };
891
932
  websocket = (stripColors = false) => {
892
933
  return new ServerWebsocket(this.r, this.id, stripColors);
893
934
  };
894
935
  resources = async () => {
895
- const { data } = await this.r.get(`/servers/${this.id}/resources`);
936
+ const { data } = await this.r.get(
937
+ `/servers/${this.id}/resources`
938
+ );
896
939
  return data.attributes;
897
940
  };
898
941
  command = async (command) => {
@@ -920,9 +963,7 @@ var Client = class {
920
963
  };
921
964
  listServers = async (type = "accessible", page = 1, per_page = 50, include) => {
922
965
  import_zod5.default.number().positive().parse(page);
923
- const { data } = await this.r.get("/", {
924
- params: { type, page, include: include?.join(",") }
925
- });
966
+ const { data } = await this.r.get("/", { params: { type, page, include: include?.join(",") } });
926
967
  return data.data.map((s) => s.attributes);
927
968
  };
928
969
  server = (uuid) => new ServerClient(this.r, uuid);
@@ -1526,9 +1567,7 @@ var Users = class {
1526
1567
  };
1527
1568
  info = async (id, { include }) => {
1528
1569
  import_zod7.default.number().positive().parse(id);
1529
- const { data } = await this.r.get(`/users/${id}`, {
1530
- params: { include: include?.join(",") }
1531
- });
1570
+ const { data } = await this.r.get(`/users/${id}`, { params: { include: include?.join(",") } });
1532
1571
  return data.attributes;
1533
1572
  };
1534
1573
  infoByExternal = async (external_id, { include }) => {
@@ -1602,11 +1641,7 @@ var NodesAllocations = class {
1602
1641
  import_zod8.default.ipv4().parse(ip);
1603
1642
  import_zod8.default.ipv4().or(import_zod8.default.url().max(255)).optional().parse(alias);
1604
1643
  import_zod8.default.array(import_zod8.default.number()).or(import_zod8.default.string().regex(/\d+-\d+/)).parse(ports);
1605
- await this.r.post(`/nodes/${this.id}/allocations`, {
1606
- ip,
1607
- ports,
1608
- alias
1609
- });
1644
+ await this.r.post(`/nodes/${this.id}/allocations`, { ip, ports, alias });
1610
1645
  };
1611
1646
  delete = async (alloc_id) => {
1612
1647
  await this.r.delete(`/nodes/${this.id}/allocations/${alloc_id}`);
@@ -1622,9 +1657,7 @@ var Nodes = class {
1622
1657
  }
1623
1658
  list = async (include, page = 1) => {
1624
1659
  import_zod9.default.number().positive().parse(page);
1625
- const { data } = await this.r.get("/nodes", {
1626
- params: { include: include?.join(","), page }
1627
- });
1660
+ const { data } = await this.r.get("/nodes", { params: { include: include?.join(","), page } });
1628
1661
  return data.data.map((s) => s.attributes);
1629
1662
  };
1630
1663
  listDeployable = async (filters, include, page = 1) => {
@@ -1644,25 +1677,34 @@ var Nodes = class {
1644
1677
  };
1645
1678
  info = async (id, include) => {
1646
1679
  import_zod9.default.number().positive().parse(id);
1647
- const { data } = await this.r.get(`/nodes/${id}`, {
1648
- params: { include: include?.join(",") }
1649
- });
1680
+ const { data } = await this.r.get(
1681
+ `/nodes/${id}`,
1682
+ { params: { include: include?.join(",") } }
1683
+ );
1650
1684
  return data.attributes;
1651
1685
  };
1652
1686
  create = async (node) => {
1653
1687
  node = NodeCreateSchema.parse(node);
1654
- const { data } = await this.r.post("/nodes", node);
1688
+ const { data } = await this.r.post(
1689
+ "/nodes",
1690
+ node
1691
+ );
1655
1692
  return data.attributes;
1656
1693
  };
1657
1694
  get_configuration = async (id) => {
1658
1695
  import_zod9.default.number().positive().parse(id);
1659
- const { data } = await this.r.get(`/nodes/${id}/configuration`);
1696
+ const { data } = await this.r.get(
1697
+ `/nodes/${id}/configuration`
1698
+ );
1660
1699
  return data;
1661
1700
  };
1662
1701
  update = async (id, node) => {
1663
1702
  import_zod9.default.number().positive().parse(id);
1664
1703
  node = NodeCreateSchema.parse(node);
1665
- const { data } = await this.r.patch(`/nodes/${id}`, node);
1704
+ const { data } = await this.r.patch(
1705
+ `/nodes/${id}`,
1706
+ node
1707
+ );
1666
1708
  return data.attributes;
1667
1709
  };
1668
1710
  delete = async (id) => {
@@ -1723,7 +1765,9 @@ var ServersDatabases = class {
1723
1765
  await this.r.delete(`/servers/${this.id}/databases/${database_id}`);
1724
1766
  };
1725
1767
  resetPassword = async (database_id) => {
1726
- await this.r.post(`/servers/${this.id}/databases/${database_id}/reset-password`);
1768
+ await this.r.post(
1769
+ `/servers/${this.id}/databases/${database_id}/reset-password`
1770
+ );
1727
1771
  };
1728
1772
  };
1729
1773
 
@@ -1738,9 +1782,7 @@ var Servers = class {
1738
1782
  this.databases = new ServersDatabases(this.r, this.id);
1739
1783
  }
1740
1784
  info = async (include) => {
1741
- const { data } = await this.r.get(`/servers/${this.id}`, {
1742
- params: { include: include?.join(",") }
1743
- });
1785
+ const { data } = await this.r.get(`/servers/${this.id}`, { params: { include: include?.join(",") } });
1744
1786
  return data.attributes;
1745
1787
  };
1746
1788
  delete = async (force = false) => {
@@ -1835,9 +1877,7 @@ var UpdateStartupSchema = CreateServerSchema.pick({
1835
1877
  environment: true,
1836
1878
  egg: true,
1837
1879
  skip_scripts: true
1838
- }).extend({
1839
- image: import_zod11.default.string().optional()
1840
- });
1880
+ }).extend({ image: import_zod11.default.string().optional() });
1841
1881
 
1842
1882
  // src/api/application/database_hosts.ts
1843
1883
  var import_zod12 = __toESM(require("zod"));
@@ -1847,9 +1887,7 @@ var DatabaseHosts = class {
1847
1887
  this.r = r;
1848
1888
  }
1849
1889
  list = async (page = 1) => {
1850
- const { data } = await this.r.get("/database-hosts", {
1851
- params: { page }
1852
- });
1890
+ const { data } = await this.r.get("/database-hosts", { params: { page } });
1853
1891
  return data.data.map((d) => d.attributes);
1854
1892
  };
1855
1893
  info = async (id) => {
@@ -1859,7 +1897,10 @@ var DatabaseHosts = class {
1859
1897
  // TODO: find out why API returns 500
1860
1898
  create = async (opts) => {
1861
1899
  opts = CreateDBHostSchema.parse(opts);
1862
- await this.r.post("/database-hosts", opts).catch((e) => {
1900
+ await this.r.post(
1901
+ "/database-hosts",
1902
+ opts
1903
+ ).catch((e) => {
1863
1904
  });
1864
1905
  };
1865
1906
  update = async (id, opts) => {
@@ -1888,13 +1929,13 @@ var Roles = class {
1888
1929
  this.r = r;
1889
1930
  }
1890
1931
  list = async (page = 1) => {
1891
- const { data } = await this.r.get(`/roles`, {
1892
- params: { page }
1893
- });
1932
+ const { data } = await this.r.get(`/roles`, { params: { page } });
1894
1933
  return data.data.map((r) => r.attributes);
1895
1934
  };
1896
1935
  info = async (id) => {
1897
- const { data } = await this.r.get(`/roles/${id}`);
1936
+ const { data } = await this.r.get(
1937
+ `/roles/${id}`
1938
+ );
1898
1939
  return data.attributes;
1899
1940
  };
1900
1941
  create = async (opts) => {
@@ -1915,11 +1956,15 @@ var Eggs = class {
1915
1956
  this.r = r;
1916
1957
  }
1917
1958
  list = async () => {
1918
- const { data } = await this.r.get("/eggs");
1959
+ const { data } = await this.r.get(
1960
+ "/eggs"
1961
+ );
1919
1962
  return data.data.map((d) => d.attributes);
1920
1963
  };
1921
1964
  info = async (id) => {
1922
- const { data } = await this.r.get(`/eggs/${id}`);
1965
+ const { data } = await this.r.get(
1966
+ `/eggs/${id}`
1967
+ );
1923
1968
  return data.attributes;
1924
1969
  };
1925
1970
  export = async (id, format) => {
@@ -1930,7 +1975,9 @@ var Eggs = class {
1930
1975
  return data;
1931
1976
  };
1932
1977
  infoExportable = async (id) => {
1933
- const { data } = await this.r.get(`/eggs/${id}/export`, { params: { format: "json" } });
1978
+ const { data } = await this.r.get(`/eggs/${id}/export`, {
1979
+ params: { format: "json" }
1980
+ });
1934
1981
  return data;
1935
1982
  };
1936
1983
  };
@@ -1947,17 +1994,25 @@ var Mounts = class {
1947
1994
  return data.data.map((d) => d.attributes);
1948
1995
  };
1949
1996
  info = async (id) => {
1950
- const { data } = await this.r.get(`/mounts/${id}`);
1997
+ const { data } = await this.r.get(
1998
+ `/mounts/${id}`
1999
+ );
1951
2000
  return data.attributes;
1952
2001
  };
1953
2002
  create = async (opts) => {
1954
2003
  opts = CreateMountSchema.parse(opts);
1955
- const { data } = await this.r.post("/mounts", opts);
2004
+ const { data } = await this.r.post(
2005
+ "/mounts",
2006
+ opts
2007
+ );
1956
2008
  return data.attributes;
1957
2009
  };
1958
2010
  update = async (id, opts) => {
1959
2011
  opts = CreateMountSchema.parse(opts);
1960
- const { data } = await this.r.patch(`/mounts/${id}`, opts);
2012
+ const { data } = await this.r.patch(
2013
+ `/mounts/${id}`,
2014
+ opts
2015
+ );
1961
2016
  return data.attributes;
1962
2017
  };
1963
2018
  delete = async (id) => {
@@ -2024,9 +2079,7 @@ var Client2 = class {
2024
2079
  return this.r;
2025
2080
  }
2026
2081
  listServers = async (search, page = 1) => {
2027
- const { data } = await this.r.get("/servers", {
2028
- params: { search, page }
2029
- });
2082
+ const { data } = await this.r.get("/servers", { params: { search, page } });
2030
2083
  return data.data.map((s) => s.attributes);
2031
2084
  };
2032
2085
  createServer = async (opts) => {
@@ -2069,17 +2122,17 @@ var Agent = class {
2069
2122
  this.requester = import_axios3.default.create({
2070
2123
  baseURL: this.base_url.replace(/\/+$/, "") + `${suffix}/${type}`,
2071
2124
  timeout: 3e3,
2072
- headers: {
2073
- Authorization: `Bearer ${this.token}`
2074
- }
2125
+ headers: { Authorization: `Bearer ${this.token}` }
2075
2126
  });
2076
2127
  this.requester.interceptors.response.use(void 0, (error) => {
2077
2128
  if (error.response && error.response.status === 400) {
2078
- return Promise.reject(new PterodactylException(
2079
- "Invalid request data",
2080
- error.response.data,
2081
- error.response.status
2082
- ));
2129
+ return Promise.reject(
2130
+ new PterodactylException(
2131
+ "Invalid request data",
2132
+ error.response.data,
2133
+ error.response.status
2134
+ )
2135
+ );
2083
2136
  }
2084
2137
  return Promise.reject(error);
2085
2138
  });