@pelican.ts/sdk 0.4.16-next.3 → 0.5.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/CHANGELOG.md +15 -0
- package/bun.lock +47 -57
- package/dist/api/index.d.mts +115 -66
- package/dist/api/index.d.ts +115 -66
- package/dist/api/index.js +22 -1
- package/dist/api/index.mjs +22 -1
- package/dist/index.d.mts +357 -144
- package/dist/index.d.ts +357 -144
- package/dist/index.js +105 -3
- package/dist/index.mjs +105 -3
- package/dist/types.d.ts +294 -249
- package/package.json +6 -6
package/dist/api/index.d.ts
CHANGED
|
@@ -43,7 +43,17 @@ declare const CreateDBHostSchema: z.ZodObject<{
|
|
|
43
43
|
max_databases: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
|
|
46
|
-
type
|
|
46
|
+
type FileObject = {
|
|
47
|
+
name: string;
|
|
48
|
+
mode: string;
|
|
49
|
+
mode_bits: string;
|
|
50
|
+
size: number;
|
|
51
|
+
is_file: boolean;
|
|
52
|
+
is_symlink: boolean;
|
|
53
|
+
mimetype: string;
|
|
54
|
+
created_at: string;
|
|
55
|
+
modified_at: string;
|
|
56
|
+
};
|
|
47
57
|
|
|
48
58
|
type GenericResponse<T, N extends string = string, M = undefined> = {
|
|
49
59
|
object: N;
|
|
@@ -88,16 +98,74 @@ type ServerDatabase = {
|
|
|
88
98
|
};
|
|
89
99
|
};
|
|
90
100
|
|
|
101
|
+
type ServerBackup = {
|
|
102
|
+
uuid: string;
|
|
103
|
+
is_successful: boolean;
|
|
104
|
+
is_locked: boolean;
|
|
105
|
+
name: string;
|
|
106
|
+
ignored_files: string[];
|
|
107
|
+
checksum: Nullable<string>;
|
|
108
|
+
bytes: number;
|
|
109
|
+
created_at: string;
|
|
110
|
+
completed_at: Nullable<string>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
type ServerSignalOption = "start" | "stop" | "restart" | "kill";
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Server limits indicate how many resources can be used by the server
|
|
117
|
+
*/
|
|
91
118
|
type ServerLimits = {
|
|
119
|
+
/**
|
|
120
|
+
* Memory limit in megabytes, 0 = unlimited
|
|
121
|
+
* @remarks
|
|
122
|
+
* This is not a pterodactyl's MiB, it's a MB (multiple of 1000).
|
|
123
|
+
* That means to set 8GB RAM, you should set 8000 instead of 8192
|
|
124
|
+
*/
|
|
92
125
|
memory: number;
|
|
126
|
+
/**
|
|
127
|
+
* Swap limit in megabytes, 0 = disabled, -1 = unlimited
|
|
128
|
+
* @see memory
|
|
129
|
+
*/
|
|
93
130
|
swap: number;
|
|
131
|
+
/**
|
|
132
|
+
* Disk limit in megabytes, 0 = unlimited
|
|
133
|
+
* @see memory
|
|
134
|
+
*/
|
|
94
135
|
disk: number;
|
|
136
|
+
/**
|
|
137
|
+
* IO is an arbitrary value indicating IO importance relative to other servers
|
|
138
|
+
*/
|
|
95
139
|
io: number;
|
|
140
|
+
/**
|
|
141
|
+
* CPU limit in percentage, 0 = unlimited (1 core = 100%)
|
|
142
|
+
*/
|
|
96
143
|
cpu: number;
|
|
144
|
+
/**
|
|
145
|
+
* CPU pinning (Optional)
|
|
146
|
+
* @usage
|
|
147
|
+
* ```
|
|
148
|
+
* 1 or 1,2,4 or 1-4
|
|
149
|
+
* ```
|
|
150
|
+
* @remarks
|
|
151
|
+
* Can be useful to pin workloads to P-cores and avoid E-cores or HT/SMT cores
|
|
152
|
+
* @see https://superuser.com/questions/122536/what-is-hyper-threading-and-how-does-it-work
|
|
153
|
+
*/
|
|
97
154
|
threads: Nullable<number | string>;
|
|
155
|
+
/**
|
|
156
|
+
* If OOM killer should be disabled, opposite of {@link oom_killer}
|
|
157
|
+
* @deprecated use {@link oom_killer}
|
|
158
|
+
*/
|
|
98
159
|
oom_disabled: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* If OOM killer should be enabled, opposite of {@link oom_disabled}
|
|
162
|
+
*/
|
|
99
163
|
oom_killer: boolean;
|
|
100
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Feature limits indicate how many features can user enable by themselves. It doesn't include features assigned
|
|
167
|
+
* by admins
|
|
168
|
+
*/
|
|
101
169
|
type FeatureLimits = {
|
|
102
170
|
databases: number;
|
|
103
171
|
allocations: number;
|
|
@@ -118,40 +186,6 @@ type StartupMeta = {
|
|
|
118
186
|
raw_startup_command: string;
|
|
119
187
|
};
|
|
120
188
|
|
|
121
|
-
type ServerBackup = {
|
|
122
|
-
uuid: string;
|
|
123
|
-
is_successful: boolean;
|
|
124
|
-
is_locked: boolean;
|
|
125
|
-
name: string;
|
|
126
|
-
ignored_files: string[];
|
|
127
|
-
checksum: Nullable<string>;
|
|
128
|
-
bytes: number;
|
|
129
|
-
created_at: string;
|
|
130
|
-
completed_at: Nullable<string>;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
type EggVariable = {
|
|
134
|
-
name: string;
|
|
135
|
-
description: string;
|
|
136
|
-
env_variable: string;
|
|
137
|
-
default_value: string;
|
|
138
|
-
server_value: string;
|
|
139
|
-
is_editable: boolean;
|
|
140
|
-
rules: string;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
type FileObject = {
|
|
144
|
-
name: string;
|
|
145
|
-
mode: string;
|
|
146
|
-
mode_bits: string;
|
|
147
|
-
size: number;
|
|
148
|
-
is_file: boolean;
|
|
149
|
-
is_symlink: boolean;
|
|
150
|
-
mimetype: string;
|
|
151
|
-
created_at: string;
|
|
152
|
-
modified_at: string;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
189
|
type Schedule = {
|
|
156
190
|
id: number;
|
|
157
191
|
name: string;
|
|
@@ -184,6 +218,16 @@ type ScheduleTask = {
|
|
|
184
218
|
updated_at: Nullable<string>;
|
|
185
219
|
};
|
|
186
220
|
|
|
221
|
+
type EggVariable = {
|
|
222
|
+
name: string;
|
|
223
|
+
description: string;
|
|
224
|
+
env_variable: string;
|
|
225
|
+
default_value: string;
|
|
226
|
+
server_value: string;
|
|
227
|
+
is_editable: boolean;
|
|
228
|
+
rules: string;
|
|
229
|
+
};
|
|
230
|
+
|
|
187
231
|
type Egg = {
|
|
188
232
|
id: number;
|
|
189
233
|
uuid: string;
|
|
@@ -258,8 +302,22 @@ declare class Eggs {
|
|
|
258
302
|
info: (id: number) => Promise<Egg>;
|
|
259
303
|
export: (id: number, format: "json" | "yaml") => Promise<string>;
|
|
260
304
|
infoExportable: (id: number) => Promise<ExportedEgg>;
|
|
305
|
+
import: (egg: ExportedEgg | string, format?: "json" | "yaml") => Promise<ExportedEgg>;
|
|
306
|
+
delete: (id: number) => Promise<void>;
|
|
307
|
+
deleteByUUID: (uuid: string) => Promise<void>;
|
|
261
308
|
}
|
|
262
309
|
|
|
310
|
+
type Mount = {
|
|
311
|
+
id: number;
|
|
312
|
+
uuid: string;
|
|
313
|
+
name: string;
|
|
314
|
+
description: Nullable<string>;
|
|
315
|
+
source: string;
|
|
316
|
+
target: string;
|
|
317
|
+
read_only: boolean;
|
|
318
|
+
user_mountable: boolean;
|
|
319
|
+
};
|
|
320
|
+
|
|
263
321
|
type Container = {
|
|
264
322
|
startup_command: string;
|
|
265
323
|
image: string;
|
|
@@ -291,21 +349,6 @@ type ApplicationServer = {
|
|
|
291
349
|
updated_at: Nullable<string>;
|
|
292
350
|
};
|
|
293
351
|
|
|
294
|
-
type Allocation = {
|
|
295
|
-
id: number;
|
|
296
|
-
ip: string;
|
|
297
|
-
alias: Nullable<string>;
|
|
298
|
-
port: number;
|
|
299
|
-
notes: Nullable<string>;
|
|
300
|
-
assigned: boolean;
|
|
301
|
-
};
|
|
302
|
-
type AllocationRel = Allocation & {
|
|
303
|
-
relationships?: {
|
|
304
|
-
node?: GenericResponse<Node$1, "node">;
|
|
305
|
-
server?: GenericResponse<ApplicationServer, "server">;
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
|
|
309
352
|
type Node$1 = {
|
|
310
353
|
id: number;
|
|
311
354
|
uuid: string;
|
|
@@ -366,27 +409,25 @@ type NodeConfiguration = {
|
|
|
366
409
|
remote: string;
|
|
367
410
|
};
|
|
368
411
|
|
|
369
|
-
type
|
|
412
|
+
type Allocation = {
|
|
370
413
|
id: number;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
read_only: boolean;
|
|
377
|
-
user_mountable: boolean;
|
|
414
|
+
ip: string;
|
|
415
|
+
alias: Nullable<string>;
|
|
416
|
+
port: number;
|
|
417
|
+
notes: Nullable<string>;
|
|
418
|
+
assigned: boolean;
|
|
378
419
|
};
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
updated_at: string;
|
|
420
|
+
type AllocationRel = Allocation & {
|
|
421
|
+
relationships?: {
|
|
422
|
+
node?: GenericResponse<Node$1, "node">;
|
|
423
|
+
server?: GenericResponse<ApplicationServer, "server">;
|
|
424
|
+
};
|
|
385
425
|
};
|
|
386
426
|
|
|
387
427
|
type ApplicationUser = {
|
|
388
428
|
id: number;
|
|
389
429
|
external_id: Nullable<string>;
|
|
430
|
+
is_managed_externally: boolean;
|
|
390
431
|
uuid: string;
|
|
391
432
|
username: string;
|
|
392
433
|
email: string;
|
|
@@ -414,6 +455,13 @@ type ApplicationUserApiKey = {
|
|
|
414
455
|
updated_at: string;
|
|
415
456
|
};
|
|
416
457
|
|
|
458
|
+
type Role = {
|
|
459
|
+
id: number;
|
|
460
|
+
name: string;
|
|
461
|
+
created_at: string;
|
|
462
|
+
updated_at: string;
|
|
463
|
+
};
|
|
464
|
+
|
|
417
465
|
declare class Mounts {
|
|
418
466
|
private readonly r;
|
|
419
467
|
constructor(r: AxiosInstance);
|
|
@@ -639,6 +687,7 @@ type ListSort = ExactlyOneKey<"id" | "uuid", "asc" | "desc">;
|
|
|
639
687
|
declare const CreateSchema: z.ZodObject<{
|
|
640
688
|
email: z.ZodEmail;
|
|
641
689
|
external_id: z.ZodOptional<z.ZodString>;
|
|
690
|
+
is_managed_externally: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
642
691
|
username: z.ZodString;
|
|
643
692
|
password: z.ZodOptional<z.ZodString>;
|
|
644
693
|
language: z.ZodEnum<{
|
|
@@ -1251,7 +1300,7 @@ declare class Account {
|
|
|
1251
1300
|
constructor(requester: AxiosInstance);
|
|
1252
1301
|
info: () => Promise<User>;
|
|
1253
1302
|
updateEmail: (newEmail: string, password: string) => Promise<void>;
|
|
1254
|
-
updatePassword: (newPassword: string) => Promise<void>;
|
|
1303
|
+
updatePassword: (currentPassword: string, newPassword: string) => Promise<void>;
|
|
1255
1304
|
apiKeys: {
|
|
1256
1305
|
list: () => Promise<APIKey[]>;
|
|
1257
1306
|
create: (description: string, allowed_ips?: string[]) => Promise<APIKey & {
|
|
@@ -1308,7 +1357,7 @@ type Server = {
|
|
|
1308
1357
|
docker_image: string;
|
|
1309
1358
|
egg_features: Nullable<string[]>;
|
|
1310
1359
|
feature_limits: FeatureLimits;
|
|
1311
|
-
status: Nullable<
|
|
1360
|
+
status: Nullable<ServerStats["current_state"]>;
|
|
1312
1361
|
is_suspended: boolean;
|
|
1313
1362
|
is_installing: boolean;
|
|
1314
1363
|
is_transferring: boolean;
|
package/dist/api/index.js
CHANGED
|
@@ -109,6 +109,25 @@ var Eggs = class {
|
|
|
109
109
|
});
|
|
110
110
|
return data;
|
|
111
111
|
};
|
|
112
|
+
import = async (egg, format = "json") => {
|
|
113
|
+
let body;
|
|
114
|
+
if (format === "yaml" && typeof egg === "string") {
|
|
115
|
+
throw new Error("YAML import is not supported yet");
|
|
116
|
+
} else if (format === "json" && typeof egg === "object")
|
|
117
|
+
body = egg;
|
|
118
|
+
else
|
|
119
|
+
throw new Error("Invalid format or egg type");
|
|
120
|
+
const { data } = await this.r.post(`/eggs/import`, body, {
|
|
121
|
+
params: { format }
|
|
122
|
+
});
|
|
123
|
+
return data;
|
|
124
|
+
};
|
|
125
|
+
delete = async (id) => {
|
|
126
|
+
await this.r.delete(`/eggs/${id}`);
|
|
127
|
+
};
|
|
128
|
+
deleteByUUID = async (uuid) => {
|
|
129
|
+
await this.r.delete(`/eggs/uuid/${uuid}`);
|
|
130
|
+
};
|
|
112
131
|
};
|
|
113
132
|
|
|
114
133
|
// src/api/application/mounts.ts
|
|
@@ -1122,6 +1141,7 @@ var Users = class {
|
|
|
1122
1141
|
var CreateSchema = import_zod8.default.object({
|
|
1123
1142
|
email: import_zod8.default.email(),
|
|
1124
1143
|
external_id: import_zod8.default.string().max(255).optional(),
|
|
1144
|
+
is_managed_externally: import_zod8.default.boolean().optional().default(false),
|
|
1125
1145
|
username: import_zod8.default.string().min(1).max(255),
|
|
1126
1146
|
password: import_zod8.default.string().optional(),
|
|
1127
1147
|
language: languagesSchema,
|
|
@@ -1228,9 +1248,10 @@ var Account = class {
|
|
|
1228
1248
|
newEmail = import_zod10.default.email().parse(newEmail);
|
|
1229
1249
|
await this.r.put("/account/email", { email: newEmail, password });
|
|
1230
1250
|
};
|
|
1231
|
-
updatePassword = async (newPassword) => {
|
|
1251
|
+
updatePassword = async (currentPassword, newPassword) => {
|
|
1232
1252
|
newPassword = import_zod10.default.string().min(8).parse(newPassword);
|
|
1233
1253
|
await this.r.put("/account/password", {
|
|
1254
|
+
current_password: currentPassword,
|
|
1234
1255
|
password: newPassword,
|
|
1235
1256
|
password_confirmation: newPassword
|
|
1236
1257
|
});
|
package/dist/api/index.mjs
CHANGED
|
@@ -72,6 +72,25 @@ var Eggs = class {
|
|
|
72
72
|
});
|
|
73
73
|
return data;
|
|
74
74
|
};
|
|
75
|
+
import = async (egg, format = "json") => {
|
|
76
|
+
let body;
|
|
77
|
+
if (format === "yaml" && typeof egg === "string") {
|
|
78
|
+
throw new Error("YAML import is not supported yet");
|
|
79
|
+
} else if (format === "json" && typeof egg === "object")
|
|
80
|
+
body = egg;
|
|
81
|
+
else
|
|
82
|
+
throw new Error("Invalid format or egg type");
|
|
83
|
+
const { data } = await this.r.post(`/eggs/import`, body, {
|
|
84
|
+
params: { format }
|
|
85
|
+
});
|
|
86
|
+
return data;
|
|
87
|
+
};
|
|
88
|
+
delete = async (id) => {
|
|
89
|
+
await this.r.delete(`/eggs/${id}`);
|
|
90
|
+
};
|
|
91
|
+
deleteByUUID = async (uuid) => {
|
|
92
|
+
await this.r.delete(`/eggs/uuid/${uuid}`);
|
|
93
|
+
};
|
|
75
94
|
};
|
|
76
95
|
|
|
77
96
|
// src/api/application/mounts.ts
|
|
@@ -1085,6 +1104,7 @@ var Users = class {
|
|
|
1085
1104
|
var CreateSchema = z8.object({
|
|
1086
1105
|
email: z8.email(),
|
|
1087
1106
|
external_id: z8.string().max(255).optional(),
|
|
1107
|
+
is_managed_externally: z8.boolean().optional().default(false),
|
|
1088
1108
|
username: z8.string().min(1).max(255),
|
|
1089
1109
|
password: z8.string().optional(),
|
|
1090
1110
|
language: languagesSchema,
|
|
@@ -1191,9 +1211,10 @@ var Account = class {
|
|
|
1191
1211
|
newEmail = z10.email().parse(newEmail);
|
|
1192
1212
|
await this.r.put("/account/email", { email: newEmail, password });
|
|
1193
1213
|
};
|
|
1194
|
-
updatePassword = async (newPassword) => {
|
|
1214
|
+
updatePassword = async (currentPassword, newPassword) => {
|
|
1195
1215
|
newPassword = z10.string().min(8).parse(newPassword);
|
|
1196
1216
|
await this.r.put("/account/password", {
|
|
1217
|
+
current_password: currentPassword,
|
|
1197
1218
|
password: newPassword,
|
|
1198
1219
|
password_confirmation: newPassword
|
|
1199
1220
|
});
|