@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
package/dist/api/index.js CHANGED
@@ -128,29 +128,28 @@ var ServerFiles = class {
128
128
  this.id = id;
129
129
  }
130
130
  list = async (path) => {
131
- const { data } = await this.r.get(`/servers/${this.id}/files/list`, {
132
- params: { directory: path }
133
- });
131
+ const { data } = await this.r.get(`/servers/${this.id}/files/list`, { params: { directory: path } });
134
132
  return data.data.map((r) => r.attributes);
135
133
  };
136
134
  /**
137
135
  * Return the contents of a file. To read binary file (non-editable) use {@link download} instead
138
136
  */
139
137
  contents = async (path) => {
140
- const { data } = await this.r.get(`/servers/${this.id}/files/contents`, {
141
- params: { file: path }
142
- });
138
+ const { data } = await this.r.get(
139
+ `/servers/${this.id}/files/contents`,
140
+ { params: { file: path } }
141
+ );
143
142
  return data;
144
143
  };
145
144
  downloadGetUrl = async (path) => {
146
- const { data } = await this.r.get(`/servers/${this.id}/files/download`, {
147
- params: { file: path }
148
- });
145
+ const { data } = await this.r.get(`/servers/${this.id}/files/download`, { params: { file: path } });
149
146
  return data.attributes.url;
150
147
  };
151
148
  download = async (path) => {
152
149
  const url = await this.downloadGetUrl(path);
153
- const { data } = await import_axios.default.get(url, { responseType: "arraybuffer" });
150
+ const { data } = await import_axios.default.get(url, {
151
+ responseType: "arraybuffer"
152
+ });
154
153
  return data;
155
154
  };
156
155
  rename = async (root = "/", files) => {
@@ -165,7 +164,12 @@ var ServerFiles = class {
165
164
  });
166
165
  };
167
166
  compress = async (root = "/", files, archive_name, extension) => {
168
- 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
+ });
169
173
  return data.attributes;
170
174
  };
171
175
  decompress = async (root = "/", file) => {
@@ -175,13 +179,22 @@ var ServerFiles = class {
175
179
  await this.r.post(`/servers/${this.id}/files/delete`, { root, files });
176
180
  };
177
181
  createFolder = async (root = "/", name) => {
178
- 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
+ });
179
186
  };
180
187
  chmod = async (root = "/", files) => {
181
188
  await this.r.post(`/servers/${this.id}/files/chmod`, { root, files });
182
189
  };
183
190
  pullFromRemote = async (url, directory, filename, use_header = false, foreground = false) => {
184
- 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
+ });
185
198
  };
186
199
  uploadGetUrl = async () => {
187
200
  const { data } = await this.r.get(`/servers/${this.id}/files/upload`);
@@ -189,10 +202,14 @@ var ServerFiles = class {
189
202
  };
190
203
  upload = async (file, root = "/") => {
191
204
  const url = await this.uploadGetUrl();
192
- await import_axios.default.post(url, { files: file }, {
193
- headers: { "Content-Type": "multipart/form-data" },
194
- params: { directory: root }
195
- });
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
+ );
196
213
  };
197
214
  };
198
215
 
@@ -235,7 +252,9 @@ var ScheduleControl = class {
235
252
  await this.r.delete(`/servers/${this.id}/schedules/${this.sched_id}`);
236
253
  };
237
254
  execute = async () => {
238
- 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
+ );
239
258
  };
240
259
  tasks = {
241
260
  create: async (opts) => {
@@ -243,11 +262,16 @@ var ScheduleControl = class {
243
262
  return data.attributes;
244
263
  },
245
264
  update: async (task_id, opts) => {
246
- 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
+ );
247
269
  return data.attributes;
248
270
  },
249
271
  delete: async (task_id) => {
250
- 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
+ );
251
275
  }
252
276
  };
253
277
  };
@@ -277,7 +301,9 @@ var ServerAllocations = class {
277
301
  return data.attributes;
278
302
  };
279
303
  unassign = async (alloc_id) => {
280
- 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
+ );
281
307
  };
282
308
  };
283
309
 
@@ -298,11 +324,16 @@ var ServerUsers = class {
298
324
  return data.attributes;
299
325
  };
300
326
  info = async (user_uuid) => {
301
- 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
+ );
302
330
  return data.attributes;
303
331
  };
304
332
  update = async (user_uuid, permissions) => {
305
- 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
+ );
306
337
  return data.attributes;
307
338
  };
308
339
  delete = async (user_uuid) => {
@@ -322,9 +353,7 @@ var ServerBackups = class {
322
353
  }
323
354
  list = async (page = 1) => {
324
355
  import_zod3.default.number().positive().parse(page);
325
- const { data } = await this.r.get(`/servers/${this.id}/backups`, {
326
- params: { page }
327
- });
356
+ const { data } = await this.r.get(`/servers/${this.id}/backups`, { params: { page } });
328
357
  return data.data.map((d) => d.attributes);
329
358
  };
330
359
  create = async (args) => {
@@ -346,20 +375,27 @@ var ServerBackups = class {
346
375
  };
347
376
  download = async (backup_uuid) => {
348
377
  const url = await this.downloadGetUrl(backup_uuid);
349
- const { data } = await import_axios2.default.get(url, { responseType: "arraybuffer" });
378
+ const { data } = await import_axios2.default.get(url, {
379
+ responseType: "arraybuffer"
380
+ });
350
381
  return data;
351
382
  };
352
383
  delete = async (backup_uuid) => {
353
384
  await this.r.delete(`/servers/${this.id}/backups/${backup_uuid}`);
354
385
  };
355
386
  rename = async (backup_uuid, name) => {
356
- 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
+ });
357
390
  };
358
391
  toggleLock = async (backup_uuid) => {
359
392
  await this.r.post(`/servers/${this.id}/backups/${backup_uuid}/lock`);
360
393
  };
361
394
  restore = async (backup_uuid, truncate) => {
362
- 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
+ );
363
399
  };
364
400
  };
365
401
 
@@ -399,7 +435,9 @@ var ServerSettings = class {
399
435
  await this.r.post(`/servers/${this.id}/settings/rename`, { name });
400
436
  };
401
437
  updateDescription = async (description) => {
402
- await this.r.post(`/servers/${this.id}/settings/description`, { description });
438
+ await this.r.post(`/servers/${this.id}/settings/description`, {
439
+ description
440
+ });
403
441
  };
404
442
  reinstall = async () => {
405
443
  await this.r.post(`/servers/${this.id}/settings/reinstall`);
@@ -457,7 +495,9 @@ var ServerWebsocket = class {
457
495
  return;
458
496
  }
459
497
  const socketUrl = await this.refreshCredentials();
460
- 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
+ });
461
501
  await new Promise((resolve, reject) => {
462
502
  const socket = this.socket;
463
503
  if (!socket) {
@@ -474,13 +514,17 @@ var ServerWebsocket = class {
474
514
  } catch (error) {
475
515
  socket.onopen = null;
476
516
  socket.onerror = null;
477
- reject(error instanceof Error ? error : new Error("Websocket authentication failed"));
517
+ reject(
518
+ error instanceof Error ? error : new Error("Websocket authentication failed")
519
+ );
478
520
  }
479
521
  };
480
522
  socket.onerror = (event) => {
481
523
  socket.onopen = null;
482
524
  socket.onerror = null;
483
- reject(event instanceof Error ? event : new Error("Websocket connection error"));
525
+ reject(
526
+ event instanceof Error ? event : new Error("Websocket connection error")
527
+ );
484
528
  };
485
529
  });
486
530
  if (resumable) {
@@ -526,9 +570,15 @@ var ServerWebsocket = class {
526
570
  void this.handleIncomingMessage(event);
527
571
  };
528
572
  if (typeof this.socket.addEventListener === "function") {
529
- this.socket.addEventListener("message", handler);
573
+ this.socket.addEventListener(
574
+ "message",
575
+ handler
576
+ );
530
577
  this.detachMessageListener = () => {
531
- this.socket?.removeEventListener?.("message", handler);
578
+ this.socket?.removeEventListener?.(
579
+ "message",
580
+ handler
581
+ );
532
582
  };
533
583
  } else {
534
584
  const fallback = (data) => handler({ data });
@@ -638,7 +688,9 @@ var ServerWebsocket = class {
638
688
  }
639
689
  case "backup completed" /* BACKUP_COMPLETED */: {
640
690
  try {
641
- const payload = JSON.parse(message.args[0]);
691
+ const payload = JSON.parse(
692
+ message.args[0]
693
+ );
642
694
  this.emit("backup completed" /* BACKUP_COMPLETED */, payload);
643
695
  } catch (error) {
644
696
  if (this.debugLogging) {
@@ -720,7 +772,9 @@ var ServerWebsocket = class {
720
772
  }
721
773
  }
722
774
  async refreshCredentials() {
723
- const { data } = await this.r.get(`/servers/${this.serverId}/websocket`);
775
+ const { data } = await this.r.get(
776
+ `/servers/${this.serverId}/websocket`
777
+ );
724
778
  this.currentToken = data.data.token;
725
779
  return data.data.socket;
726
780
  }
@@ -731,7 +785,9 @@ var ServerWebsocket = class {
731
785
  if (!this.currentToken) {
732
786
  throw new Error("Missing websocket token");
733
787
  }
734
- this.socket.send(JSON.stringify({ event: "auth", args: [this.currentToken] }));
788
+ this.socket.send(
789
+ JSON.stringify({ event: "auth", args: [this.currentToken] })
790
+ );
735
791
  }
736
792
  disconnect() {
737
793
  this.detachMessageListener?.();
@@ -750,7 +806,9 @@ var ServerWebsocket = class {
750
806
  send(event, args) {
751
807
  if (!this.socket) {
752
808
  if (this.debugLogging) {
753
- 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
+ );
754
812
  }
755
813
  return;
756
814
  }
@@ -831,12 +889,7 @@ var ServerActivity = class {
831
889
  this.id = id;
832
890
  }
833
891
  list = async (page = 1, per_page = 25) => {
834
- const { data } = await this.r.get(`/server/${this.id}/activity`, {
835
- params: {
836
- page,
837
- per_page
838
- }
839
- });
892
+ const { data } = await this.r.get(`/server/${this.id}/activity`, { params: { page, per_page } });
840
893
  return data.data.map((log) => log.attributes);
841
894
  };
842
895
  };
@@ -870,16 +923,19 @@ var ServerClient = class {
870
923
  this.settings = new ServerSettings(requester, id);
871
924
  }
872
925
  info = async (include) => {
873
- const { data } = await this.r.get(`/servers/${this.id}`, {
874
- params: { include: include?.join(",") }
875
- });
926
+ const { data } = await this.r.get(
927
+ `/servers/${this.id}`,
928
+ { params: { include: include?.join(",") } }
929
+ );
876
930
  return data.attributes;
877
931
  };
878
932
  websocket = (stripColors = false) => {
879
933
  return new ServerWebsocket(this.r, this.id, stripColors);
880
934
  };
881
935
  resources = async () => {
882
- const { data } = await this.r.get(`/servers/${this.id}/resources`);
936
+ const { data } = await this.r.get(
937
+ `/servers/${this.id}/resources`
938
+ );
883
939
  return data.attributes;
884
940
  };
885
941
  command = async (command) => {
@@ -907,9 +963,7 @@ var Client = class {
907
963
  };
908
964
  listServers = async (type = "accessible", page = 1, per_page = 50, include) => {
909
965
  import_zod5.default.number().positive().parse(page);
910
- const { data } = await this.r.get("/", {
911
- params: { type, page, include: include?.join(",") }
912
- });
966
+ const { data } = await this.r.get("/", { params: { type, page, include: include?.join(",") } });
913
967
  return data.data.map((s) => s.attributes);
914
968
  };
915
969
  server = (uuid) => new ServerClient(this.r, uuid);
@@ -1513,9 +1567,7 @@ var Users = class {
1513
1567
  };
1514
1568
  info = async (id, { include }) => {
1515
1569
  import_zod7.default.number().positive().parse(id);
1516
- const { data } = await this.r.get(`/users/${id}`, {
1517
- params: { include: include?.join(",") }
1518
- });
1570
+ const { data } = await this.r.get(`/users/${id}`, { params: { include: include?.join(",") } });
1519
1571
  return data.attributes;
1520
1572
  };
1521
1573
  infoByExternal = async (external_id, { include }) => {
@@ -1589,11 +1641,7 @@ var NodesAllocations = class {
1589
1641
  import_zod8.default.ipv4().parse(ip);
1590
1642
  import_zod8.default.ipv4().or(import_zod8.default.url().max(255)).optional().parse(alias);
1591
1643
  import_zod8.default.array(import_zod8.default.number()).or(import_zod8.default.string().regex(/\d+-\d+/)).parse(ports);
1592
- await this.r.post(`/nodes/${this.id}/allocations`, {
1593
- ip,
1594
- ports,
1595
- alias
1596
- });
1644
+ await this.r.post(`/nodes/${this.id}/allocations`, { ip, ports, alias });
1597
1645
  };
1598
1646
  delete = async (alloc_id) => {
1599
1647
  await this.r.delete(`/nodes/${this.id}/allocations/${alloc_id}`);
@@ -1609,9 +1657,7 @@ var Nodes = class {
1609
1657
  }
1610
1658
  list = async (include, page = 1) => {
1611
1659
  import_zod9.default.number().positive().parse(page);
1612
- const { data } = await this.r.get("/nodes", {
1613
- params: { include: include?.join(","), page }
1614
- });
1660
+ const { data } = await this.r.get("/nodes", { params: { include: include?.join(","), page } });
1615
1661
  return data.data.map((s) => s.attributes);
1616
1662
  };
1617
1663
  listDeployable = async (filters, include, page = 1) => {
@@ -1631,25 +1677,34 @@ var Nodes = class {
1631
1677
  };
1632
1678
  info = async (id, include) => {
1633
1679
  import_zod9.default.number().positive().parse(id);
1634
- const { data } = await this.r.get(`/nodes/${id}`, {
1635
- params: { include: include?.join(",") }
1636
- });
1680
+ const { data } = await this.r.get(
1681
+ `/nodes/${id}`,
1682
+ { params: { include: include?.join(",") } }
1683
+ );
1637
1684
  return data.attributes;
1638
1685
  };
1639
1686
  create = async (node) => {
1640
1687
  node = NodeCreateSchema.parse(node);
1641
- const { data } = await this.r.post("/nodes", node);
1688
+ const { data } = await this.r.post(
1689
+ "/nodes",
1690
+ node
1691
+ );
1642
1692
  return data.attributes;
1643
1693
  };
1644
1694
  get_configuration = async (id) => {
1645
1695
  import_zod9.default.number().positive().parse(id);
1646
- const { data } = await this.r.get(`/nodes/${id}/configuration`);
1696
+ const { data } = await this.r.get(
1697
+ `/nodes/${id}/configuration`
1698
+ );
1647
1699
  return data;
1648
1700
  };
1649
1701
  update = async (id, node) => {
1650
1702
  import_zod9.default.number().positive().parse(id);
1651
1703
  node = NodeCreateSchema.parse(node);
1652
- const { data } = await this.r.patch(`/nodes/${id}`, node);
1704
+ const { data } = await this.r.patch(
1705
+ `/nodes/${id}`,
1706
+ node
1707
+ );
1653
1708
  return data.attributes;
1654
1709
  };
1655
1710
  delete = async (id) => {
@@ -1710,7 +1765,9 @@ var ServersDatabases = class {
1710
1765
  await this.r.delete(`/servers/${this.id}/databases/${database_id}`);
1711
1766
  };
1712
1767
  resetPassword = async (database_id) => {
1713
- 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
+ );
1714
1771
  };
1715
1772
  };
1716
1773
 
@@ -1725,9 +1782,7 @@ var Servers = class {
1725
1782
  this.databases = new ServersDatabases(this.r, this.id);
1726
1783
  }
1727
1784
  info = async (include) => {
1728
- const { data } = await this.r.get(`/servers/${this.id}`, {
1729
- params: { include: include?.join(",") }
1730
- });
1785
+ const { data } = await this.r.get(`/servers/${this.id}`, { params: { include: include?.join(",") } });
1731
1786
  return data.attributes;
1732
1787
  };
1733
1788
  delete = async (force = false) => {
@@ -1822,9 +1877,7 @@ var UpdateStartupSchema = CreateServerSchema.pick({
1822
1877
  environment: true,
1823
1878
  egg: true,
1824
1879
  skip_scripts: true
1825
- }).extend({
1826
- image: import_zod11.default.string().optional()
1827
- });
1880
+ }).extend({ image: import_zod11.default.string().optional() });
1828
1881
 
1829
1882
  // src/api/application/database_hosts.ts
1830
1883
  var import_zod12 = __toESM(require("zod"));
@@ -1834,9 +1887,7 @@ var DatabaseHosts = class {
1834
1887
  this.r = r;
1835
1888
  }
1836
1889
  list = async (page = 1) => {
1837
- const { data } = await this.r.get("/database-hosts", {
1838
- params: { page }
1839
- });
1890
+ const { data } = await this.r.get("/database-hosts", { params: { page } });
1840
1891
  return data.data.map((d) => d.attributes);
1841
1892
  };
1842
1893
  info = async (id) => {
@@ -1846,7 +1897,10 @@ var DatabaseHosts = class {
1846
1897
  // TODO: find out why API returns 500
1847
1898
  create = async (opts) => {
1848
1899
  opts = CreateDBHostSchema.parse(opts);
1849
- await this.r.post("/database-hosts", opts).catch((e) => {
1900
+ await this.r.post(
1901
+ "/database-hosts",
1902
+ opts
1903
+ ).catch((e) => {
1850
1904
  });
1851
1905
  };
1852
1906
  update = async (id, opts) => {
@@ -1875,13 +1929,13 @@ var Roles = class {
1875
1929
  this.r = r;
1876
1930
  }
1877
1931
  list = async (page = 1) => {
1878
- const { data } = await this.r.get(`/roles`, {
1879
- params: { page }
1880
- });
1932
+ const { data } = await this.r.get(`/roles`, { params: { page } });
1881
1933
  return data.data.map((r) => r.attributes);
1882
1934
  };
1883
1935
  info = async (id) => {
1884
- const { data } = await this.r.get(`/roles/${id}`);
1936
+ const { data } = await this.r.get(
1937
+ `/roles/${id}`
1938
+ );
1885
1939
  return data.attributes;
1886
1940
  };
1887
1941
  create = async (opts) => {
@@ -1902,11 +1956,15 @@ var Eggs = class {
1902
1956
  this.r = r;
1903
1957
  }
1904
1958
  list = async () => {
1905
- const { data } = await this.r.get("/eggs");
1959
+ const { data } = await this.r.get(
1960
+ "/eggs"
1961
+ );
1906
1962
  return data.data.map((d) => d.attributes);
1907
1963
  };
1908
1964
  info = async (id) => {
1909
- const { data } = await this.r.get(`/eggs/${id}`);
1965
+ const { data } = await this.r.get(
1966
+ `/eggs/${id}`
1967
+ );
1910
1968
  return data.attributes;
1911
1969
  };
1912
1970
  export = async (id, format) => {
@@ -1917,7 +1975,9 @@ var Eggs = class {
1917
1975
  return data;
1918
1976
  };
1919
1977
  infoExportable = async (id) => {
1920
- 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
+ });
1921
1981
  return data;
1922
1982
  };
1923
1983
  };
@@ -1934,17 +1994,25 @@ var Mounts = class {
1934
1994
  return data.data.map((d) => d.attributes);
1935
1995
  };
1936
1996
  info = async (id) => {
1937
- const { data } = await this.r.get(`/mounts/${id}`);
1997
+ const { data } = await this.r.get(
1998
+ `/mounts/${id}`
1999
+ );
1938
2000
  return data.attributes;
1939
2001
  };
1940
2002
  create = async (opts) => {
1941
2003
  opts = CreateMountSchema.parse(opts);
1942
- const { data } = await this.r.post("/mounts", opts);
2004
+ const { data } = await this.r.post(
2005
+ "/mounts",
2006
+ opts
2007
+ );
1943
2008
  return data.attributes;
1944
2009
  };
1945
2010
  update = async (id, opts) => {
1946
2011
  opts = CreateMountSchema.parse(opts);
1947
- const { data } = await this.r.patch(`/mounts/${id}`, opts);
2012
+ const { data } = await this.r.patch(
2013
+ `/mounts/${id}`,
2014
+ opts
2015
+ );
1948
2016
  return data.attributes;
1949
2017
  };
1950
2018
  delete = async (id) => {
@@ -2011,9 +2079,7 @@ var Client2 = class {
2011
2079
  return this.r;
2012
2080
  }
2013
2081
  listServers = async (search, page = 1) => {
2014
- const { data } = await this.r.get("/servers", {
2015
- params: { search, page }
2016
- });
2082
+ const { data } = await this.r.get("/servers", { params: { search, page } });
2017
2083
  return data.data.map((s) => s.attributes);
2018
2084
  };
2019
2085
  createServer = async (opts) => {
@@ -2056,17 +2122,17 @@ var Agent = class {
2056
2122
  this.requester = import_axios3.default.create({
2057
2123
  baseURL: this.base_url.replace(/\/+$/, "") + `${suffix}/${type}`,
2058
2124
  timeout: 3e3,
2059
- headers: {
2060
- Authorization: `Bearer ${this.token}`
2061
- }
2125
+ headers: { Authorization: `Bearer ${this.token}` }
2062
2126
  });
2063
2127
  this.requester.interceptors.response.use(void 0, (error) => {
2064
2128
  if (error.response && error.response.status === 400) {
2065
- return Promise.reject(new PterodactylException(
2066
- "Invalid request data",
2067
- error.response.data,
2068
- error.response.status
2069
- ));
2129
+ return Promise.reject(
2130
+ new PterodactylException(
2131
+ "Invalid request data",
2132
+ error.response.data,
2133
+ error.response.status
2134
+ )
2135
+ );
2070
2136
  }
2071
2137
  return Promise.reject(error);
2072
2138
  });