@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/.husky/pre-commit CHANGED
@@ -1,3 +1,2 @@
1
- #echo "🙄 Nonchalantly saving you from big commit deltas due to formatting..."
2
- #bun run format
3
- #git update-index --again
1
+ echo "🙄 Nonchalantly saving you from big commit deltas due to formatting..."
2
+ git-format-staged --formatter 'biome format --no-errors-on-unmatched --files-ignore-unknown=true --write .' .
package/biome.json CHANGED
@@ -1,36 +1,46 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.3.6/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "clientKind": "git",
6
- "useIgnoreFile": true
7
- },
8
- "files": {
9
- "includes": ["**", "!!**/dist"]
10
- },
2
+ "$schema": "https://biomejs.dev/schemas/2.3.6/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "includes": ["**", "!!**/dist", "!src/api/common/types/enums.ts"]
10
+ },
11
+ "formatter": {
12
+ "enabled": true,
13
+ "indentStyle": "space",
14
+ "indentWidth": 4
15
+ },
16
+ "linter": {
17
+ "enabled": true,
18
+ "rules": {
19
+ "recommended": true
20
+ }
21
+ },
22
+ "javascript": {
23
+ "formatter": {
24
+ "quoteStyle": "double",
25
+ "semicolons": "asNeeded",
26
+ "bracketSpacing": false,
27
+ "arrowParentheses": "asNeeded",
28
+ "operatorLinebreak": "before",
29
+ "expand": "never",
30
+ "trailingCommas": "none"
31
+ }
32
+ },
33
+ "json": {
11
34
  "formatter": {
12
- "enabled": true,
13
- "indentStyle": "space",
14
- "indentWidth": 4
15
- },
16
- "linter": {
17
- "enabled": true,
18
- "rules": {
19
- "recommended": true
20
- }
21
- },
22
- "javascript": {
23
- "formatter": {
24
- "quoteStyle": "double",
25
- "semicolons": "asNeeded"
26
- }
27
- },
28
- "assist": {
29
- "enabled": true,
30
- "actions": {
31
- "source": {
32
- "organizeImports": "on"
33
- }
34
- }
35
+ "indentWidth": 2
36
+ }
37
+ },
38
+ "assist": {
39
+ "enabled": true,
40
+ "actions": {
41
+ "source": {
42
+ "organizeImports": "on"
43
+ }
35
44
  }
45
+ }
36
46
  }
package/bun.lock CHANGED
@@ -14,6 +14,7 @@
14
14
  "@biomejs/biome": "2.3.6",
15
15
  "@types/node": "^22.18.12",
16
16
  "@types/strip-color": "^0.1.2",
17
+ "git-format-staged": "^3.1.1",
17
18
  "husky": "^9.1.7",
18
19
  "tsc-alias": "^1.8.16",
19
20
  "tsup": "^8.5.0",
@@ -254,6 +255,8 @@
254
255
 
255
256
  "get-tsconfig": ["get-tsconfig@4.13.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ=="],
256
257
 
258
+ "git-format-staged": ["git-format-staged@3.1.1", "", { "bin": { "git-format-staged": "git-format-staged" } }, "sha512-P749fkktaiAchFZKR7bgdvruzhvbcIDr1uRBrS9/Wdimb7wH1Twchz9gOixj8tUaHVMuXY/ckDojfOwV6AxgPA=="],
259
+
257
260
  "glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="],
258
261
 
259
262
  "glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
@@ -62,15 +62,6 @@ declare class Account {
62
62
  create: (name: string, public_key: string) => Promise<SSHKey>;
63
63
  delete: (fingerprint: string) => Promise<void>;
64
64
  };
65
- twoFactor: {
66
- info: () => Promise<{
67
- image_url_data: string;
68
- }>;
69
- enable: (code: string) => Promise<{
70
- tokens: string[];
71
- }>;
72
- disable: (password: string) => Promise<void>;
73
- };
74
65
  }
75
66
 
76
67
  type GenericResponse<T, N extends string = string, M = undefined> = {
@@ -226,7 +217,7 @@ declare class ServerDatabases {
226
217
  private readonly r;
227
218
  private readonly id;
228
219
  constructor(requester: AxiosInstance, id: string);
229
- list: (include?: ("password")[], page?: number) => Promise<ServerDatabase[]>;
220
+ list: (include?: "password"[], page?: number) => Promise<ServerDatabase[]>;
230
221
  create: (database: string, remote: string) => Promise<ServerDatabase>;
231
222
  rotatePassword: (database_id: string) => Promise<ServerDatabase>;
232
223
  delete: (database_id: string) => Promise<void>;
@@ -469,7 +460,7 @@ type StatsWsJson = {
469
460
  disk_bytes: number;
470
461
  };
471
462
 
472
- type ServerSignalOption = 'start' | 'stop' | 'restart' | 'kill';
463
+ type ServerSignalOption = "start" | "stop" | "restart" | "kill";
473
464
 
474
465
  type SocketEventPayloadMap = {
475
466
  [SOCKET_EVENT.AUTH_SUCCESS]: undefined;
@@ -630,10 +621,10 @@ declare class Users {
630
621
  constructor(requester: AxiosInstance);
631
622
  list: (opts: ListType, page?: number) => Promise<ApplicationUser[]>;
632
623
  info: (id: number, { include }: {
633
- include?: ("servers")[];
624
+ include?: "servers"[];
634
625
  }) => Promise<ApplicationUser>;
635
626
  infoByExternal: (external_id: string, { include }: {
636
- include?: ("servers")[];
627
+ include?: "servers"[];
637
628
  }) => Promise<ApplicationUser>;
638
629
  create: (user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
639
630
  update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
@@ -649,7 +640,7 @@ declare class Users {
649
640
  };
650
641
  }
651
642
  type ListType = {
652
- include?: ("servers")[];
643
+ include?: "servers"[];
653
644
  filters?: ListFilters;
654
645
  sort?: ListSort;
655
646
  };
@@ -62,15 +62,6 @@ declare class Account {
62
62
  create: (name: string, public_key: string) => Promise<SSHKey>;
63
63
  delete: (fingerprint: string) => Promise<void>;
64
64
  };
65
- twoFactor: {
66
- info: () => Promise<{
67
- image_url_data: string;
68
- }>;
69
- enable: (code: string) => Promise<{
70
- tokens: string[];
71
- }>;
72
- disable: (password: string) => Promise<void>;
73
- };
74
65
  }
75
66
 
76
67
  type GenericResponse<T, N extends string = string, M = undefined> = {
@@ -226,7 +217,7 @@ declare class ServerDatabases {
226
217
  private readonly r;
227
218
  private readonly id;
228
219
  constructor(requester: AxiosInstance, id: string);
229
- list: (include?: ("password")[], page?: number) => Promise<ServerDatabase[]>;
220
+ list: (include?: "password"[], page?: number) => Promise<ServerDatabase[]>;
230
221
  create: (database: string, remote: string) => Promise<ServerDatabase>;
231
222
  rotatePassword: (database_id: string) => Promise<ServerDatabase>;
232
223
  delete: (database_id: string) => Promise<void>;
@@ -469,7 +460,7 @@ type StatsWsJson = {
469
460
  disk_bytes: number;
470
461
  };
471
462
 
472
- type ServerSignalOption = 'start' | 'stop' | 'restart' | 'kill';
463
+ type ServerSignalOption = "start" | "stop" | "restart" | "kill";
473
464
 
474
465
  type SocketEventPayloadMap = {
475
466
  [SOCKET_EVENT.AUTH_SUCCESS]: undefined;
@@ -630,10 +621,10 @@ declare class Users {
630
621
  constructor(requester: AxiosInstance);
631
622
  list: (opts: ListType, page?: number) => Promise<ApplicationUser[]>;
632
623
  info: (id: number, { include }: {
633
- include?: ("servers")[];
624
+ include?: "servers"[];
634
625
  }) => Promise<ApplicationUser>;
635
626
  infoByExternal: (external_id: string, { include }: {
636
- include?: ("servers")[];
627
+ include?: "servers"[];
637
628
  }) => Promise<ApplicationUser>;
638
629
  create: (user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
639
630
  update: (id: number, user: z.infer<typeof CreateSchema>) => Promise<ApplicationUser>;
@@ -649,7 +640,7 @@ declare class Users {
649
640
  };
650
641
  }
651
642
  type ListType = {
652
- include?: ("servers")[];
643
+ include?: "servers"[];
653
644
  filters?: ListFilters;
654
645
  sort?: ListSort;
655
646
  };