@pelican.ts/sdk 0.4.0 → 0.4.2
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.
- package/.husky/pre-commit +3 -3
- package/README.md +1 -5
- package/biome.json +32 -35
- package/dist/api/index.d.mts +3 -3
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +2 -1
- package/dist/api/index.mjs +2 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +44 -8
- package/dist/index.mjs +35 -8
- package/dist/types.d.ts +7 -7
- package/package.json +59 -59
- package/src/api/client/server_files.ts +5 -2
- package/src/api/client/types/server.ts +64 -51
- package/src/api/client/types/user.ts +18 -19
- package/src/api/client/types/websocket.ts +76 -76
- package/src/api/index.ts +4 -4
- package/src/humane/Account.ts +32 -43
- package/src/humane/Client.ts +17 -16
- package/src/humane/Server.ts +86 -97
- package/src/humane/ServerAllocation.ts +11 -9
- package/src/humane/ServerBackup.ts +7 -7
- package/src/humane/ServerDatabase.ts +6 -5
- package/src/humane/ServerFile.ts +30 -18
- package/src/humane/ServerSchedule.ts +81 -47
- package/src/humane/ServerUser.ts +20 -18
- package/src/index.ts +18 -5
- package/src/utils/sized.ts +2 -3
package/.husky/pre-commit
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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
|
+
#bun run format
|
|
3
|
+
#git update-index --again
|
package/README.md
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Pelican.ts — Typescript client for Pelican panel
|
|
6
6
|
|
|
7
|
-
> [!WARNING]
|
|
8
|
-
> This is a `next` version of Pelican.ts, it is based on [Pelican-contrib](https://github.com/m41denx/pelican-contrib)
|
|
9
|
-
> fork and is not compatible with upstream Pelican panel.
|
|
10
|
-
|
|
11
7
|
## Installation
|
|
12
8
|
```shell
|
|
13
9
|
npm install @pelican.ts/sdk
|
|
@@ -44,7 +40,7 @@ What's done:
|
|
|
44
40
|
- [ ] Examples
|
|
45
41
|
- [ ] Tests
|
|
46
42
|
- [ ] Documentation
|
|
47
|
-
- [
|
|
43
|
+
- [X] Humane wrapper
|
|
48
44
|
|
|
49
45
|
## Copyright Notice
|
|
50
46
|
[Pterodactyl®](https://github.com/pterodactyl) is a registered trademark of Dane Everitt and contributors.
|
package/biome.json
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"!!**/dist"
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
"formatter": {
|
|
15
|
-
"enabled": true,
|
|
16
|
-
"indentStyle": "space",
|
|
17
|
-
"indentWidth": 4
|
|
18
|
-
},
|
|
19
|
-
"linter": {
|
|
20
|
-
"enabled": true,
|
|
21
|
-
"rules": {
|
|
22
|
-
"recommended": true
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"javascript": {
|
|
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
|
+
},
|
|
26
11
|
"formatter": {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
}
|
|
37
35
|
}
|
|
38
|
-
}
|
|
39
36
|
}
|
package/dist/api/index.d.mts
CHANGED
|
@@ -261,7 +261,7 @@ declare class ServerFiles {
|
|
|
261
261
|
}[]) => Promise<void>;
|
|
262
262
|
copy: (location: string) => Promise<void>;
|
|
263
263
|
write: (path: string, content: string) => Promise<void>;
|
|
264
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
264
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
265
265
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
266
266
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
267
267
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -447,12 +447,12 @@ declare enum SOCKET_EVENT {
|
|
|
447
447
|
}
|
|
448
448
|
type BackupCompletedJson = {
|
|
449
449
|
checksum: string;
|
|
450
|
-
checksum_type:
|
|
450
|
+
checksum_type: "sha1";
|
|
451
451
|
file_size: number;
|
|
452
452
|
is_successful: boolean;
|
|
453
453
|
uuid: string;
|
|
454
454
|
};
|
|
455
|
-
type PowerState =
|
|
455
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
456
456
|
type StatsWsJson = {
|
|
457
457
|
memory_bytes: number;
|
|
458
458
|
memory_limit_bytes: number;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -261,7 +261,7 @@ declare class ServerFiles {
|
|
|
261
261
|
}[]) => Promise<void>;
|
|
262
262
|
copy: (location: string) => Promise<void>;
|
|
263
263
|
write: (path: string, content: string) => Promise<void>;
|
|
264
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
264
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
265
265
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
266
266
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
267
267
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -447,12 +447,12 @@ declare enum SOCKET_EVENT {
|
|
|
447
447
|
}
|
|
448
448
|
type BackupCompletedJson = {
|
|
449
449
|
checksum: string;
|
|
450
|
-
checksum_type:
|
|
450
|
+
checksum_type: "sha1";
|
|
451
451
|
file_size: number;
|
|
452
452
|
is_successful: boolean;
|
|
453
453
|
uuid: string;
|
|
454
454
|
};
|
|
455
|
-
type PowerState =
|
|
455
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
456
456
|
type StatsWsJson = {
|
|
457
457
|
memory_bytes: number;
|
|
458
458
|
memory_limit_bytes: number;
|
package/dist/api/index.js
CHANGED
|
@@ -178,7 +178,8 @@ var ServerFiles = class {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
181
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
181
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
182
|
+
return data.attributes;
|
|
182
183
|
};
|
|
183
184
|
decompress = async (root = "/", file) => {
|
|
184
185
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
package/dist/api/index.mjs
CHANGED
|
@@ -141,7 +141,8 @@ var ServerFiles = class {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
144
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
144
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
145
|
+
return data.attributes;
|
|
145
146
|
};
|
|
146
147
|
decompress = async (root = "/", file) => {
|
|
147
148
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
package/dist/index.d.mts
CHANGED
|
@@ -223,12 +223,12 @@ declare enum SOCKET_EVENT {
|
|
|
223
223
|
}
|
|
224
224
|
type BackupCompletedJson = {
|
|
225
225
|
checksum: string;
|
|
226
|
-
checksum_type:
|
|
226
|
+
checksum_type: "sha1";
|
|
227
227
|
file_size: number;
|
|
228
228
|
is_successful: boolean;
|
|
229
229
|
uuid: string;
|
|
230
230
|
};
|
|
231
|
-
type PowerState =
|
|
231
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
232
232
|
type StatsWsJson = {
|
|
233
233
|
memory_bytes: number;
|
|
234
234
|
memory_limit_bytes: number;
|
|
@@ -408,7 +408,7 @@ declare class ServerFiles {
|
|
|
408
408
|
}[]) => Promise<void>;
|
|
409
409
|
copy: (location: string) => Promise<void>;
|
|
410
410
|
write: (path: string, content: string) => Promise<void>;
|
|
411
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
411
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
412
412
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
413
413
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
414
414
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -658,7 +658,7 @@ declare class ServerFile {
|
|
|
658
658
|
rename: (newName: string) => Promise<void>;
|
|
659
659
|
copy: () => Promise<void>;
|
|
660
660
|
write: (content: string) => Promise<void>;
|
|
661
|
-
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
661
|
+
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<ServerFile>;
|
|
662
662
|
decompress: () => Promise<void>;
|
|
663
663
|
delete: () => Promise<void>;
|
|
664
664
|
chmod: (mode: number) => Promise<void>;
|
|
@@ -792,7 +792,7 @@ declare class Server {
|
|
|
792
792
|
runCommand: (command: string) => Promise<void>;
|
|
793
793
|
sendPowerSignal: (signal: "start" | "stop" | "restart" | "kill") => Promise<void>;
|
|
794
794
|
getDatabases: (opts?: {
|
|
795
|
-
include?:
|
|
795
|
+
include?: "password"[];
|
|
796
796
|
page?: number;
|
|
797
797
|
}) => Promise<ServerDatabase[]>;
|
|
798
798
|
createDatabase: (database: string, remote: string) => Promise<ServerDatabase>;
|
|
@@ -830,4 +830,4 @@ declare class Client {
|
|
|
830
830
|
|
|
831
831
|
declare const createPelicanClient: (url: string, token: string, suffix?: string) => Client;
|
|
832
832
|
|
|
833
|
-
export { createPelicanClient };
|
|
833
|
+
export { Account, Client, Server, ServerAllocation, ServerBackup, ServerDatabase, ServerFile, ServerSchedule, ServerUser, createPelicanClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -223,12 +223,12 @@ declare enum SOCKET_EVENT {
|
|
|
223
223
|
}
|
|
224
224
|
type BackupCompletedJson = {
|
|
225
225
|
checksum: string;
|
|
226
|
-
checksum_type:
|
|
226
|
+
checksum_type: "sha1";
|
|
227
227
|
file_size: number;
|
|
228
228
|
is_successful: boolean;
|
|
229
229
|
uuid: string;
|
|
230
230
|
};
|
|
231
|
-
type PowerState =
|
|
231
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
232
232
|
type StatsWsJson = {
|
|
233
233
|
memory_bytes: number;
|
|
234
234
|
memory_limit_bytes: number;
|
|
@@ -408,7 +408,7 @@ declare class ServerFiles {
|
|
|
408
408
|
}[]) => Promise<void>;
|
|
409
409
|
copy: (location: string) => Promise<void>;
|
|
410
410
|
write: (path: string, content: string) => Promise<void>;
|
|
411
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
411
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
412
412
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
413
413
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
414
414
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -658,7 +658,7 @@ declare class ServerFile {
|
|
|
658
658
|
rename: (newName: string) => Promise<void>;
|
|
659
659
|
copy: () => Promise<void>;
|
|
660
660
|
write: (content: string) => Promise<void>;
|
|
661
|
-
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
661
|
+
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<ServerFile>;
|
|
662
662
|
decompress: () => Promise<void>;
|
|
663
663
|
delete: () => Promise<void>;
|
|
664
664
|
chmod: (mode: number) => Promise<void>;
|
|
@@ -792,7 +792,7 @@ declare class Server {
|
|
|
792
792
|
runCommand: (command: string) => Promise<void>;
|
|
793
793
|
sendPowerSignal: (signal: "start" | "stop" | "restart" | "kill") => Promise<void>;
|
|
794
794
|
getDatabases: (opts?: {
|
|
795
|
-
include?:
|
|
795
|
+
include?: "password"[];
|
|
796
796
|
page?: number;
|
|
797
797
|
}) => Promise<ServerDatabase[]>;
|
|
798
798
|
createDatabase: (database: string, remote: string) => Promise<ServerDatabase>;
|
|
@@ -830,4 +830,4 @@ declare class Client {
|
|
|
830
830
|
|
|
831
831
|
declare const createPelicanClient: (url: string, token: string, suffix?: string) => Client;
|
|
832
832
|
|
|
833
|
-
export { createPelicanClient };
|
|
833
|
+
export { Account, Client, Server, ServerAllocation, ServerBackup, ServerDatabase, ServerFile, ServerSchedule, ServerUser, createPelicanClient };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
Account: () => Account2,
|
|
34
|
+
Client: () => Client3,
|
|
35
|
+
Server: () => Server,
|
|
36
|
+
ServerAllocation: () => ServerAllocation,
|
|
37
|
+
ServerBackup: () => ServerBackup,
|
|
38
|
+
ServerDatabase: () => ServerDatabase,
|
|
39
|
+
ServerFile: () => ServerFile,
|
|
40
|
+
ServerSchedule: () => ServerSchedule,
|
|
41
|
+
ServerUser: () => ServerUser,
|
|
33
42
|
createPelicanClient: () => createPelicanClient
|
|
34
43
|
});
|
|
35
44
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -177,7 +186,8 @@ var ServerFiles = class {
|
|
|
177
186
|
});
|
|
178
187
|
};
|
|
179
188
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
180
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
189
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
190
|
+
return data.attributes;
|
|
181
191
|
};
|
|
182
192
|
decompress = async (root = "/", file) => {
|
|
183
193
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
|
@@ -1812,7 +1822,7 @@ var ServerDatabase = class {
|
|
|
1812
1822
|
|
|
1813
1823
|
// src/humane/ServerFile.ts
|
|
1814
1824
|
var import_node_path = __toESM(require("path"));
|
|
1815
|
-
var ServerFile = class {
|
|
1825
|
+
var ServerFile = class _ServerFile {
|
|
1816
1826
|
client;
|
|
1817
1827
|
dir;
|
|
1818
1828
|
path;
|
|
@@ -1859,7 +1869,10 @@ var ServerFile = class {
|
|
|
1859
1869
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1860
1870
|
copy = async () => this.client.files.copy(this.path);
|
|
1861
1871
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1862
|
-
compress = async (archive_name, extension) =>
|
|
1872
|
+
compress = async (archive_name, extension) => new _ServerFile(
|
|
1873
|
+
this.client,
|
|
1874
|
+
await this.client.files.compress(this.dir, [this.name], archive_name, extension)
|
|
1875
|
+
);
|
|
1863
1876
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1864
1877
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
1865
1878
|
chmod = async (mode) => this.client.files.chmod(this.dir, [{ file: this.name, mode }]);
|
|
@@ -2074,10 +2087,16 @@ var Server = class {
|
|
|
2074
2087
|
this.isSuspended = server.is_suspended;
|
|
2075
2088
|
this.isInstalling = server.is_installing;
|
|
2076
2089
|
this.isTransferring = server.is_transferring;
|
|
2077
|
-
this.allocations = server.relationships.allocations.data.map(
|
|
2078
|
-
|
|
2090
|
+
this.allocations = server.relationships.allocations.data.map(
|
|
2091
|
+
(d) => new ServerAllocation(this.client, d.attributes)
|
|
2092
|
+
);
|
|
2093
|
+
this.variables = server.relationships.variables.data.map(
|
|
2094
|
+
(d) => d.attributes
|
|
2095
|
+
);
|
|
2079
2096
|
this.egg = server.relationships.egg?.attributes;
|
|
2080
|
-
this.subusers = server.relationships.subusers?.data.map(
|
|
2097
|
+
this.subusers = server.relationships.subusers?.data.map(
|
|
2098
|
+
(d) => new ServerUser(this.client, d.attributes)
|
|
2099
|
+
);
|
|
2081
2100
|
}
|
|
2082
2101
|
rename = async (name) => {
|
|
2083
2102
|
await this.client.settings.rename(name);
|
|
@@ -2097,7 +2116,10 @@ var Server = class {
|
|
|
2097
2116
|
getServerStats = async () => this.client.resources();
|
|
2098
2117
|
runCommand = async (command) => this.client.command(command);
|
|
2099
2118
|
sendPowerSignal = async (signal) => this.client.power(signal);
|
|
2100
|
-
getDatabases = async (opts = {
|
|
2119
|
+
getDatabases = async (opts = {
|
|
2120
|
+
include: [],
|
|
2121
|
+
page: 1
|
|
2122
|
+
}) => {
|
|
2101
2123
|
const data = await this.client.databases.list(opts.include, opts.page);
|
|
2102
2124
|
return data.map((d) => new ServerDatabase(this.client, d));
|
|
2103
2125
|
};
|
|
@@ -2164,7 +2186,12 @@ var Client3 = class {
|
|
|
2164
2186
|
};
|
|
2165
2187
|
listPermissions = async () => this.client.listPermissions();
|
|
2166
2188
|
listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
|
|
2167
|
-
const data = await this.client.listServers(
|
|
2189
|
+
const data = await this.client.listServers(
|
|
2190
|
+
opts.type,
|
|
2191
|
+
opts.page,
|
|
2192
|
+
opts.per_page,
|
|
2193
|
+
opts.include
|
|
2194
|
+
);
|
|
2168
2195
|
return data.map((d) => new Server(this.client.server(d.uuid), d));
|
|
2169
2196
|
};
|
|
2170
2197
|
getServer = async (uuid, include) => {
|
|
@@ -2180,6 +2207,15 @@ var createPelicanClient = (url, token, suffix = "/api") => {
|
|
|
2180
2207
|
};
|
|
2181
2208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2182
2209
|
0 && (module.exports = {
|
|
2210
|
+
Account,
|
|
2211
|
+
Client,
|
|
2212
|
+
Server,
|
|
2213
|
+
ServerAllocation,
|
|
2214
|
+
ServerBackup,
|
|
2215
|
+
ServerDatabase,
|
|
2216
|
+
ServerFile,
|
|
2217
|
+
ServerSchedule,
|
|
2218
|
+
ServerUser,
|
|
2183
2219
|
createPelicanClient
|
|
2184
2220
|
});
|
|
2185
2221
|
/*
|
package/dist/index.mjs
CHANGED
|
@@ -141,7 +141,8 @@ var ServerFiles = class {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
144
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
144
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
145
|
+
return data.attributes;
|
|
145
146
|
};
|
|
146
147
|
decompress = async (root = "/", file) => {
|
|
147
148
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
|
@@ -1776,7 +1777,7 @@ var ServerDatabase = class {
|
|
|
1776
1777
|
|
|
1777
1778
|
// src/humane/ServerFile.ts
|
|
1778
1779
|
import path from "path";
|
|
1779
|
-
var ServerFile = class {
|
|
1780
|
+
var ServerFile = class _ServerFile {
|
|
1780
1781
|
client;
|
|
1781
1782
|
dir;
|
|
1782
1783
|
path;
|
|
@@ -1823,7 +1824,10 @@ var ServerFile = class {
|
|
|
1823
1824
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1824
1825
|
copy = async () => this.client.files.copy(this.path);
|
|
1825
1826
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1826
|
-
compress = async (archive_name, extension) =>
|
|
1827
|
+
compress = async (archive_name, extension) => new _ServerFile(
|
|
1828
|
+
this.client,
|
|
1829
|
+
await this.client.files.compress(this.dir, [this.name], archive_name, extension)
|
|
1830
|
+
);
|
|
1827
1831
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1828
1832
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
1829
1833
|
chmod = async (mode) => this.client.files.chmod(this.dir, [{ file: this.name, mode }]);
|
|
@@ -2038,10 +2042,16 @@ var Server = class {
|
|
|
2038
2042
|
this.isSuspended = server.is_suspended;
|
|
2039
2043
|
this.isInstalling = server.is_installing;
|
|
2040
2044
|
this.isTransferring = server.is_transferring;
|
|
2041
|
-
this.allocations = server.relationships.allocations.data.map(
|
|
2042
|
-
|
|
2045
|
+
this.allocations = server.relationships.allocations.data.map(
|
|
2046
|
+
(d) => new ServerAllocation(this.client, d.attributes)
|
|
2047
|
+
);
|
|
2048
|
+
this.variables = server.relationships.variables.data.map(
|
|
2049
|
+
(d) => d.attributes
|
|
2050
|
+
);
|
|
2043
2051
|
this.egg = server.relationships.egg?.attributes;
|
|
2044
|
-
this.subusers = server.relationships.subusers?.data.map(
|
|
2052
|
+
this.subusers = server.relationships.subusers?.data.map(
|
|
2053
|
+
(d) => new ServerUser(this.client, d.attributes)
|
|
2054
|
+
);
|
|
2045
2055
|
}
|
|
2046
2056
|
rename = async (name) => {
|
|
2047
2057
|
await this.client.settings.rename(name);
|
|
@@ -2061,7 +2071,10 @@ var Server = class {
|
|
|
2061
2071
|
getServerStats = async () => this.client.resources();
|
|
2062
2072
|
runCommand = async (command) => this.client.command(command);
|
|
2063
2073
|
sendPowerSignal = async (signal) => this.client.power(signal);
|
|
2064
|
-
getDatabases = async (opts = {
|
|
2074
|
+
getDatabases = async (opts = {
|
|
2075
|
+
include: [],
|
|
2076
|
+
page: 1
|
|
2077
|
+
}) => {
|
|
2065
2078
|
const data = await this.client.databases.list(opts.include, opts.page);
|
|
2066
2079
|
return data.map((d) => new ServerDatabase(this.client, d));
|
|
2067
2080
|
};
|
|
@@ -2128,7 +2141,12 @@ var Client3 = class {
|
|
|
2128
2141
|
};
|
|
2129
2142
|
listPermissions = async () => this.client.listPermissions();
|
|
2130
2143
|
listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
|
|
2131
|
-
const data = await this.client.listServers(
|
|
2144
|
+
const data = await this.client.listServers(
|
|
2145
|
+
opts.type,
|
|
2146
|
+
opts.page,
|
|
2147
|
+
opts.per_page,
|
|
2148
|
+
opts.include
|
|
2149
|
+
);
|
|
2132
2150
|
return data.map((d) => new Server(this.client.server(d.uuid), d));
|
|
2133
2151
|
};
|
|
2134
2152
|
getServer = async (uuid, include) => {
|
|
@@ -2143,6 +2161,15 @@ var createPelicanClient = (url, token, suffix = "/api") => {
|
|
|
2143
2161
|
return new Client3(client);
|
|
2144
2162
|
};
|
|
2145
2163
|
export {
|
|
2164
|
+
Account2 as Account,
|
|
2165
|
+
Client3 as Client,
|
|
2166
|
+
Server,
|
|
2167
|
+
ServerAllocation,
|
|
2168
|
+
ServerBackup,
|
|
2169
|
+
ServerDatabase,
|
|
2170
|
+
ServerFile,
|
|
2171
|
+
ServerSchedule,
|
|
2172
|
+
ServerUser,
|
|
2146
2173
|
createPelicanClient
|
|
2147
2174
|
};
|
|
2148
2175
|
/*
|
package/dist/types.d.ts
CHANGED
|
@@ -995,12 +995,12 @@ declare class ServerWebsocket {
|
|
|
995
995
|
sendCommand(cmd: string): void;
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
type ServerStatus =
|
|
998
|
+
type ServerStatus = "starting" | "stopping" | "online" | "offline";
|
|
999
999
|
declare enum SERVER_SIGNAL {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1000
|
+
START = "start",
|
|
1001
|
+
STOP = "stop",
|
|
1002
|
+
RESTART = "restart",
|
|
1003
|
+
KILL = "kill"
|
|
1004
1004
|
}
|
|
1005
1005
|
type WebsocketEvent = AuthSuccessWsEvent | StatusWsEvent | ConsoleLogWsEvent | StatsWsEvent | TokenExpiringWsEvent | TokenExpiredWsEvent | DaemonErrorEvent | DaemonMessageEvent | InstallOutputEvent | InstallStartedEvent | InstallCompletedEvent | TransferLogsEvent | TransferStatusEvent | BackupCompletedEvent | BackupRestoreCompletedEvent | JwtErrorEvent;
|
|
1006
1006
|
/**
|
|
@@ -1048,7 +1048,7 @@ type BackupCompletedEvent = {
|
|
|
1048
1048
|
};
|
|
1049
1049
|
type BackupCompletedJson = {
|
|
1050
1050
|
checksum: string;
|
|
1051
|
-
checksum_type:
|
|
1051
|
+
checksum_type: "sha1";
|
|
1052
1052
|
file_size: number;
|
|
1053
1053
|
is_successful: boolean;
|
|
1054
1054
|
uuid: string;
|
|
@@ -1063,7 +1063,7 @@ type StatusWsEvent = {
|
|
|
1063
1063
|
event: SOCKET_EVENT.STATUS;
|
|
1064
1064
|
args: [PowerState];
|
|
1065
1065
|
};
|
|
1066
|
-
type PowerState =
|
|
1066
|
+
type PowerState = "starting" | "stopping" | "running" | "offline";
|
|
1067
1067
|
type ConsoleLogWsEvent = {
|
|
1068
1068
|
event: SOCKET_EVENT.CONSOLE_OUTPUT;
|
|
1069
1069
|
args: [string];
|
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "@pelican.ts/sdk",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Pelican panel SDK for TypeScript",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./api": {
|
|
15
|
+
"types": "./dist/api/index.d.ts",
|
|
16
|
+
"require": "./dist/api/index.js",
|
|
17
|
+
"import": "./dist/api/index.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./types": {
|
|
20
|
+
"types": "./dist/types.d.ts"
|
|
21
|
+
}
|
|
13
22
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:api": "tsup src/api/index.ts --format esm,cjs --dts --target esnext -d dist/api",
|
|
25
|
+
"build:humane": "tsup src/index.ts --format esm,cjs --dts --target esnext",
|
|
26
|
+
"build:types": "tsup src/types.ts --dts-only --target esnext",
|
|
27
|
+
"build": "rm -rf ./dist && npm run build:api && npm run build:humane && npm run build:types",
|
|
28
|
+
"pub": "npm publish --access=public",
|
|
29
|
+
"pub:next": "npm publish --access=public --tag=next",
|
|
30
|
+
"generate-types": "bun run scripts/create-types.ts",
|
|
31
|
+
"pipeline:next": "bun run generate-types && bun run build && bun run pub:next",
|
|
32
|
+
"pipeline": "bun run generate-types && bun run build && bun run pub",
|
|
33
|
+
"format": "biome format --no-errors-on-unmatched --files-ignore-unknown=true --write .",
|
|
34
|
+
"prepare": "husky"
|
|
18
35
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
36
|
+
"keywords": [
|
|
37
|
+
"pterodactyl",
|
|
38
|
+
"pterodactyl.ts",
|
|
39
|
+
"pterodactyl.js",
|
|
40
|
+
"pelican",
|
|
41
|
+
"pelican.ts",
|
|
42
|
+
"pelican.js"
|
|
43
|
+
],
|
|
44
|
+
"author": "M41den",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"url": "git+https://github.com/m41denx/Pelican.ts"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@biomejs/biome": "2.3.6",
|
|
51
|
+
"@types/node": "^22.18.12",
|
|
52
|
+
"@types/strip-color": "^0.1.2",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"tsc-alias": "^1.8.16",
|
|
55
|
+
"tsup": "^8.5.0",
|
|
56
|
+
"typescript": "^5.9.3"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"axios": "^1.12.2",
|
|
60
|
+
"isomorphic-ws": "^5.0.0",
|
|
61
|
+
"strip-color": "^0.1.0",
|
|
62
|
+
"zod": "^4.1.12"
|
|
21
63
|
}
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build:api": "tsup src/api/index.ts --format esm,cjs --dts --target esnext -d dist/api",
|
|
25
|
-
"build:humane": "tsup src/index.ts --format esm,cjs --dts --target esnext",
|
|
26
|
-
"build:types": "tsup src/types.ts --dts-only --target esnext",
|
|
27
|
-
"build": "rm -rf ./dist && npm run build:api && npm run build:humane && npm run build:types",
|
|
28
|
-
"pub": "npm publish --access=public",
|
|
29
|
-
"pub:next": "npm publish --access=public --tag=next",
|
|
30
|
-
"generate-types": "bun run scripts/create-types.ts",
|
|
31
|
-
"pipeline:next": "bun run generate-types && bun run build && bun run pub:next",
|
|
32
|
-
"pipeline": "bun run generate-types && bun run build && bun run pub",
|
|
33
|
-
"format": "biome format --no-errors-on-unmatched --files-ignore-unknown=true --write .",
|
|
34
|
-
"prepare": "husky"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
"pterodactyl",
|
|
38
|
-
"pterodactyl.ts",
|
|
39
|
-
"pterodactyl.js",
|
|
40
|
-
"pelican",
|
|
41
|
-
"pelican.ts",
|
|
42
|
-
"pelican.js"
|
|
43
|
-
],
|
|
44
|
-
"author": "M41den",
|
|
45
|
-
"license": "MIT",
|
|
46
|
-
"repository": {
|
|
47
|
-
"url": "git+https://github.com/m41denx/Pelican.ts"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@biomejs/biome": "2.3.6",
|
|
51
|
-
"@types/node": "^22.18.12",
|
|
52
|
-
"@types/strip-color": "^0.1.2",
|
|
53
|
-
"husky": "^9.1.7",
|
|
54
|
-
"tsc-alias": "^1.8.16",
|
|
55
|
-
"tsup": "^8.5.0",
|
|
56
|
-
"typescript": "^5.9.3"
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"axios": "^1.12.2",
|
|
60
|
-
"isomorphic-ws": "^5.0.0",
|
|
61
|
-
"strip-color": "^0.1.0",
|
|
62
|
-
"zod": "^4.1.12"
|
|
63
|
-
}
|
|
64
64
|
}
|
|
@@ -69,8 +69,11 @@ export class ServerFiles {
|
|
|
69
69
|
files: string[],
|
|
70
70
|
archive_name?: string,
|
|
71
71
|
extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2"
|
|
72
|
-
): Promise<
|
|
73
|
-
await this.r.post
|
|
72
|
+
): Promise<FileObject> => {
|
|
73
|
+
const {data} = await this.r.post<
|
|
74
|
+
GenericResponse<FileObject, "file_object">
|
|
75
|
+
>(`/servers/${this.id}/files/compress`, {root, files, archive_name, extension})
|
|
76
|
+
return data.attributes
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
decompress = async (
|