@pelican.ts/sdk 0.4.0 → 0.4.1
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 +2 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +43 -6
- package/dist/index.mjs +34 -6
- package/dist/types.d.ts +7 -7
- package/package.json +59 -59
- 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 +33 -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
|
@@ -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
|
@@ -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/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;
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -1859,7 +1868,12 @@ var ServerFile = class {
|
|
|
1859
1868
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1860
1869
|
copy = async () => this.client.files.copy(this.path);
|
|
1861
1870
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1862
|
-
compress = async (archive_name, extension) => this.client.files.compress(
|
|
1871
|
+
compress = async (archive_name, extension) => this.client.files.compress(
|
|
1872
|
+
this.dir,
|
|
1873
|
+
[this.name],
|
|
1874
|
+
archive_name,
|
|
1875
|
+
extension
|
|
1876
|
+
);
|
|
1863
1877
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1864
1878
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
1865
1879
|
chmod = async (mode) => this.client.files.chmod(this.dir, [{ file: this.name, mode }]);
|
|
@@ -2074,10 +2088,16 @@ var Server = class {
|
|
|
2074
2088
|
this.isSuspended = server.is_suspended;
|
|
2075
2089
|
this.isInstalling = server.is_installing;
|
|
2076
2090
|
this.isTransferring = server.is_transferring;
|
|
2077
|
-
this.allocations = server.relationships.allocations.data.map(
|
|
2078
|
-
|
|
2091
|
+
this.allocations = server.relationships.allocations.data.map(
|
|
2092
|
+
(d) => new ServerAllocation(this.client, d.attributes)
|
|
2093
|
+
);
|
|
2094
|
+
this.variables = server.relationships.variables.data.map(
|
|
2095
|
+
(d) => d.attributes
|
|
2096
|
+
);
|
|
2079
2097
|
this.egg = server.relationships.egg?.attributes;
|
|
2080
|
-
this.subusers = server.relationships.subusers?.data.map(
|
|
2098
|
+
this.subusers = server.relationships.subusers?.data.map(
|
|
2099
|
+
(d) => new ServerUser(this.client, d.attributes)
|
|
2100
|
+
);
|
|
2081
2101
|
}
|
|
2082
2102
|
rename = async (name) => {
|
|
2083
2103
|
await this.client.settings.rename(name);
|
|
@@ -2097,7 +2117,10 @@ var Server = class {
|
|
|
2097
2117
|
getServerStats = async () => this.client.resources();
|
|
2098
2118
|
runCommand = async (command) => this.client.command(command);
|
|
2099
2119
|
sendPowerSignal = async (signal) => this.client.power(signal);
|
|
2100
|
-
getDatabases = async (opts = {
|
|
2120
|
+
getDatabases = async (opts = {
|
|
2121
|
+
include: [],
|
|
2122
|
+
page: 1
|
|
2123
|
+
}) => {
|
|
2101
2124
|
const data = await this.client.databases.list(opts.include, opts.page);
|
|
2102
2125
|
return data.map((d) => new ServerDatabase(this.client, d));
|
|
2103
2126
|
};
|
|
@@ -2164,7 +2187,12 @@ var Client3 = class {
|
|
|
2164
2187
|
};
|
|
2165
2188
|
listPermissions = async () => this.client.listPermissions();
|
|
2166
2189
|
listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
|
|
2167
|
-
const data = await this.client.listServers(
|
|
2190
|
+
const data = await this.client.listServers(
|
|
2191
|
+
opts.type,
|
|
2192
|
+
opts.page,
|
|
2193
|
+
opts.per_page,
|
|
2194
|
+
opts.include
|
|
2195
|
+
);
|
|
2168
2196
|
return data.map((d) => new Server(this.client.server(d.uuid), d));
|
|
2169
2197
|
};
|
|
2170
2198
|
getServer = async (uuid, include) => {
|
|
@@ -2180,6 +2208,15 @@ var createPelicanClient = (url, token, suffix = "/api") => {
|
|
|
2180
2208
|
};
|
|
2181
2209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2182
2210
|
0 && (module.exports = {
|
|
2211
|
+
Account,
|
|
2212
|
+
Client,
|
|
2213
|
+
Server,
|
|
2214
|
+
ServerAllocation,
|
|
2215
|
+
ServerBackup,
|
|
2216
|
+
ServerDatabase,
|
|
2217
|
+
ServerFile,
|
|
2218
|
+
ServerSchedule,
|
|
2219
|
+
ServerUser,
|
|
2183
2220
|
createPelicanClient
|
|
2184
2221
|
});
|
|
2185
2222
|
/*
|
package/dist/index.mjs
CHANGED
|
@@ -1823,7 +1823,12 @@ var ServerFile = class {
|
|
|
1823
1823
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1824
1824
|
copy = async () => this.client.files.copy(this.path);
|
|
1825
1825
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1826
|
-
compress = async (archive_name, extension) => this.client.files.compress(
|
|
1826
|
+
compress = async (archive_name, extension) => this.client.files.compress(
|
|
1827
|
+
this.dir,
|
|
1828
|
+
[this.name],
|
|
1829
|
+
archive_name,
|
|
1830
|
+
extension
|
|
1831
|
+
);
|
|
1827
1832
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1828
1833
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
1829
1834
|
chmod = async (mode) => this.client.files.chmod(this.dir, [{ file: this.name, mode }]);
|
|
@@ -2038,10 +2043,16 @@ var Server = class {
|
|
|
2038
2043
|
this.isSuspended = server.is_suspended;
|
|
2039
2044
|
this.isInstalling = server.is_installing;
|
|
2040
2045
|
this.isTransferring = server.is_transferring;
|
|
2041
|
-
this.allocations = server.relationships.allocations.data.map(
|
|
2042
|
-
|
|
2046
|
+
this.allocations = server.relationships.allocations.data.map(
|
|
2047
|
+
(d) => new ServerAllocation(this.client, d.attributes)
|
|
2048
|
+
);
|
|
2049
|
+
this.variables = server.relationships.variables.data.map(
|
|
2050
|
+
(d) => d.attributes
|
|
2051
|
+
);
|
|
2043
2052
|
this.egg = server.relationships.egg?.attributes;
|
|
2044
|
-
this.subusers = server.relationships.subusers?.data.map(
|
|
2053
|
+
this.subusers = server.relationships.subusers?.data.map(
|
|
2054
|
+
(d) => new ServerUser(this.client, d.attributes)
|
|
2055
|
+
);
|
|
2045
2056
|
}
|
|
2046
2057
|
rename = async (name) => {
|
|
2047
2058
|
await this.client.settings.rename(name);
|
|
@@ -2061,7 +2072,10 @@ var Server = class {
|
|
|
2061
2072
|
getServerStats = async () => this.client.resources();
|
|
2062
2073
|
runCommand = async (command) => this.client.command(command);
|
|
2063
2074
|
sendPowerSignal = async (signal) => this.client.power(signal);
|
|
2064
|
-
getDatabases = async (opts = {
|
|
2075
|
+
getDatabases = async (opts = {
|
|
2076
|
+
include: [],
|
|
2077
|
+
page: 1
|
|
2078
|
+
}) => {
|
|
2065
2079
|
const data = await this.client.databases.list(opts.include, opts.page);
|
|
2066
2080
|
return data.map((d) => new ServerDatabase(this.client, d));
|
|
2067
2081
|
};
|
|
@@ -2128,7 +2142,12 @@ var Client3 = class {
|
|
|
2128
2142
|
};
|
|
2129
2143
|
listPermissions = async () => this.client.listPermissions();
|
|
2130
2144
|
listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
|
|
2131
|
-
const data = await this.client.listServers(
|
|
2145
|
+
const data = await this.client.listServers(
|
|
2146
|
+
opts.type,
|
|
2147
|
+
opts.page,
|
|
2148
|
+
opts.per_page,
|
|
2149
|
+
opts.include
|
|
2150
|
+
);
|
|
2132
2151
|
return data.map((d) => new Server(this.client.server(d.uuid), d));
|
|
2133
2152
|
};
|
|
2134
2153
|
getServer = async (uuid, include) => {
|
|
@@ -2143,6 +2162,15 @@ var createPelicanClient = (url, token, suffix = "/api") => {
|
|
|
2143
2162
|
return new Client3(client);
|
|
2144
2163
|
};
|
|
2145
2164
|
export {
|
|
2165
|
+
Account2 as Account,
|
|
2166
|
+
Client3 as Client,
|
|
2167
|
+
Server,
|
|
2168
|
+
ServerAllocation,
|
|
2169
|
+
ServerBackup,
|
|
2170
|
+
ServerDatabase,
|
|
2171
|
+
ServerFile,
|
|
2172
|
+
ServerSchedule,
|
|
2173
|
+
ServerUser,
|
|
2146
2174
|
createPelicanClient
|
|
2147
2175
|
};
|
|
2148
2176
|
/*
|
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.1",
|
|
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
|
}
|
|
@@ -1,69 +1,82 @@
|
|
|
1
|
-
import {GenericListResponse, GenericResponse} from "@/api/base/types"
|
|
2
|
-
import {EggVariable} from "@/api/common/types/egg"
|
|
3
|
-
import {ServerSubuser} from "@/api/client/types/server_subuser"
|
|
4
|
-
import {FeatureLimits, ServerLimits} from "@/api/common/types/server_limits"
|
|
5
|
-
import {ServerAllocation} from "@/api/client/types/server_allocation"
|
|
6
|
-
import {Nullable} from "@/utils/types"
|
|
1
|
+
import { GenericListResponse, GenericResponse } from "@/api/base/types"
|
|
2
|
+
import { EggVariable } from "@/api/common/types/egg"
|
|
3
|
+
import { ServerSubuser } from "@/api/client/types/server_subuser"
|
|
4
|
+
import { FeatureLimits, ServerLimits } from "@/api/common/types/server_limits"
|
|
5
|
+
import { ServerAllocation } from "@/api/client/types/server_allocation"
|
|
6
|
+
import { Nullable } from "@/utils/types"
|
|
7
7
|
|
|
8
8
|
export type Server = {
|
|
9
|
-
server_owner: boolean
|
|
10
|
-
identifier: string
|
|
11
|
-
internal_id?: number
|
|
12
|
-
uuid: string
|
|
13
|
-
name: string
|
|
14
|
-
node: string
|
|
15
|
-
is_node_under_maintenance: boolean
|
|
9
|
+
server_owner: boolean
|
|
10
|
+
identifier: string
|
|
11
|
+
internal_id?: number
|
|
12
|
+
uuid: string
|
|
13
|
+
name: string
|
|
14
|
+
node: string
|
|
15
|
+
is_node_under_maintenance: boolean
|
|
16
16
|
sftp_details: {
|
|
17
|
-
ip: string
|
|
18
|
-
alias: Nullable<string
|
|
17
|
+
ip: string
|
|
18
|
+
alias: Nullable<string>
|
|
19
19
|
port: number
|
|
20
|
-
}
|
|
21
|
-
description: string
|
|
22
|
-
limits: ServerLimits
|
|
23
|
-
invocation: string
|
|
24
|
-
docker_image: string
|
|
25
|
-
egg_features: Nullable<string[]
|
|
26
|
-
feature_limits: FeatureLimits
|
|
27
|
-
status: Nullable<unknown
|
|
28
|
-
is_suspended: boolean
|
|
29
|
-
is_installing: boolean
|
|
30
|
-
is_transferring: boolean
|
|
20
|
+
}
|
|
21
|
+
description: string
|
|
22
|
+
limits: ServerLimits
|
|
23
|
+
invocation: string
|
|
24
|
+
docker_image: string
|
|
25
|
+
egg_features: Nullable<string[]>
|
|
26
|
+
feature_limits: FeatureLimits
|
|
27
|
+
status: Nullable<unknown>
|
|
28
|
+
is_suspended: boolean
|
|
29
|
+
is_installing: boolean
|
|
30
|
+
is_transferring: boolean
|
|
31
31
|
relationships: {
|
|
32
|
-
allocations: GenericListResponse<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
allocations: GenericListResponse<
|
|
33
|
+
GenericResponse<ServerAllocation, "allocation">
|
|
34
|
+
>
|
|
35
|
+
variables: GenericListResponse<
|
|
36
|
+
GenericResponse<EggVariable, "egg_variable">
|
|
37
|
+
>
|
|
38
|
+
egg?: GenericResponse<
|
|
39
|
+
{
|
|
40
|
+
uuid: string
|
|
41
|
+
name: string
|
|
42
|
+
},
|
|
43
|
+
"egg"
|
|
44
|
+
>
|
|
45
|
+
subusers?: GenericListResponse<
|
|
46
|
+
GenericResponse<ServerSubuser, "server_subuser">
|
|
47
|
+
>
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
|
|
43
51
|
export type ServerStats = {
|
|
44
|
-
current_state:
|
|
45
|
-
| "
|
|
46
|
-
|
|
52
|
+
current_state:
|
|
53
|
+
| "installing"
|
|
54
|
+
| "install_failed"
|
|
55
|
+
| "reinstall_failed"
|
|
56
|
+
| "suspended"
|
|
57
|
+
| "restoring_backup"
|
|
58
|
+
| "running"
|
|
59
|
+
| "stopped"
|
|
60
|
+
| "offline"
|
|
61
|
+
is_suspended: boolean
|
|
47
62
|
resources: ServerResources
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
type ServerResources = {
|
|
51
|
-
memory_bytes: number
|
|
52
|
-
cpu_absolute: number
|
|
53
|
-
disk_bytes: number
|
|
54
|
-
network_tx_bytes: number
|
|
55
|
-
network_rx_bytes: number
|
|
66
|
+
memory_bytes: number
|
|
67
|
+
cpu_absolute: number
|
|
68
|
+
disk_bytes: number
|
|
69
|
+
network_tx_bytes: number
|
|
70
|
+
network_rx_bytes: number
|
|
56
71
|
uptime: number
|
|
57
72
|
}
|
|
58
73
|
export type ServerActivityLog = {
|
|
59
|
-
id: string
|
|
60
|
-
event: string
|
|
61
|
-
is_api: boolean
|
|
62
|
-
ip: string
|
|
63
|
-
description: Nullable<string
|
|
64
|
-
properties: Record<string, string
|
|
65
|
-
has_additional_metadata: boolean
|
|
74
|
+
id: string
|
|
75
|
+
event: string
|
|
76
|
+
is_api: boolean
|
|
77
|
+
ip: string
|
|
78
|
+
description: Nullable<string>
|
|
79
|
+
properties: Record<string, string>
|
|
80
|
+
has_additional_metadata: boolean
|
|
66
81
|
timestamp: string
|
|
67
82
|
}
|
|
68
|
-
|
|
69
|
-
|