pterodactyl-api-client 2.1.0 → 2.2.0
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/dist/application/server/database/database.client.d.ts +58 -0
- package/dist/application/server/database/database.client.d.ts.map +1 -0
- package/dist/application/server/database/database.client.js +48 -0
- package/dist/application/server/database/database.types.d.ts +43 -0
- package/dist/application/server/database/database.types.d.ts.map +1 -0
- package/dist/application/server/database/database.types.js +1 -0
- package/dist/application/server/database/password/password.client.d.ts +7 -0
- package/dist/application/server/database/password/password.client.d.ts.map +1 -0
- package/dist/application/server/database/password/password.client.js +9 -0
- package/dist/application/server/index.d.ts +2 -0
- package/dist/application/server/index.d.ts.map +1 -1
- package/dist/application/server/index.js +2 -0
- package/dist/application/server/server.client.d.ts +2 -0
- package/dist/application/server/server.client.d.ts.map +1 -1
- package/dist/application/server/server.client.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type HttpClient from "../../../class/HttpClient.js";
|
|
2
|
+
import type { CreateApplicationDatabase } from "./database.types.js";
|
|
3
|
+
import PasswordClient from "./password/password.client.js";
|
|
4
|
+
export default class DatabaseClient {
|
|
5
|
+
private httpClient;
|
|
6
|
+
password: PasswordClient;
|
|
7
|
+
constructor(httpClient: HttpClient);
|
|
8
|
+
list(server: number): Promise<{
|
|
9
|
+
data: {
|
|
10
|
+
attributes: {
|
|
11
|
+
created_at: Date;
|
|
12
|
+
updated_at: Date;
|
|
13
|
+
id: number;
|
|
14
|
+
server: number;
|
|
15
|
+
host: number;
|
|
16
|
+
database: string;
|
|
17
|
+
username: string;
|
|
18
|
+
remote: string | import("../../../types.js").IP | "%";
|
|
19
|
+
max_connections: number;
|
|
20
|
+
};
|
|
21
|
+
object: "server_database";
|
|
22
|
+
}[];
|
|
23
|
+
object: "list";
|
|
24
|
+
}>;
|
|
25
|
+
info(server: number, database: number): Promise<{
|
|
26
|
+
attributes: {
|
|
27
|
+
created_at: Date;
|
|
28
|
+
updated_at: Date;
|
|
29
|
+
id: number;
|
|
30
|
+
server: number;
|
|
31
|
+
host: number;
|
|
32
|
+
database: string;
|
|
33
|
+
username: string;
|
|
34
|
+
remote: string | import("../../../types.js").IP | "%";
|
|
35
|
+
max_connections: number;
|
|
36
|
+
};
|
|
37
|
+
object: "server_database";
|
|
38
|
+
}>;
|
|
39
|
+
create(server: number, args: CreateApplicationDatabase): Promise<{
|
|
40
|
+
attributes: {
|
|
41
|
+
created_at: Date;
|
|
42
|
+
updated_at: Date;
|
|
43
|
+
id: number;
|
|
44
|
+
server: number;
|
|
45
|
+
host: number;
|
|
46
|
+
database: string;
|
|
47
|
+
username: string;
|
|
48
|
+
remote: string | import("../../../types.js").IP | "%";
|
|
49
|
+
max_connections: number;
|
|
50
|
+
};
|
|
51
|
+
meta: {
|
|
52
|
+
ressource: string;
|
|
53
|
+
};
|
|
54
|
+
object: "server_database";
|
|
55
|
+
}>;
|
|
56
|
+
delete(server: number, database: number): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=database.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.client.d.ts","sourceRoot":"","sources":["../../../../src/application/server/database/database.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,cAAc;IAGrB,OAAO,CAAC,UAAU;IAFvB,QAAQ,EAAE,cAAc,CAAC;gBAEZ,UAAU,EAAE,UAAU;IAIpC,IAAI,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;IAkBnB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;IAerC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB;;;;;;;;;;;;;;;;;IAe5D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAMxC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import PasswordClient from "./password/password.client.js";
|
|
2
|
+
export default class DatabaseClient {
|
|
3
|
+
httpClient;
|
|
4
|
+
password;
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
this.password = new PasswordClient(httpClient);
|
|
8
|
+
}
|
|
9
|
+
async list(server) {
|
|
10
|
+
const res = await this.httpClient.request("GET", `/application/servers/${server}/databases`);
|
|
11
|
+
return {
|
|
12
|
+
...res,
|
|
13
|
+
data: res.data.map((db) => ({
|
|
14
|
+
...db,
|
|
15
|
+
attributes: {
|
|
16
|
+
...db.attributes,
|
|
17
|
+
created_at: new Date(db.attributes.created_at),
|
|
18
|
+
updated_at: new Date(db.attributes.updated_at),
|
|
19
|
+
},
|
|
20
|
+
})),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async info(server, database) {
|
|
24
|
+
const res = await this.httpClient.request("GET", `/application/servers/${server}/databases/${database}`);
|
|
25
|
+
return {
|
|
26
|
+
...res,
|
|
27
|
+
attributes: {
|
|
28
|
+
...res.attributes,
|
|
29
|
+
created_at: new Date(res.attributes.created_at),
|
|
30
|
+
updated_at: new Date(res.attributes.updated_at),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async create(server, args) {
|
|
35
|
+
const res = await this.httpClient.request("POST", `/application/servers/${server}/databases`, args);
|
|
36
|
+
return {
|
|
37
|
+
...res,
|
|
38
|
+
attributes: {
|
|
39
|
+
...res.attributes,
|
|
40
|
+
created_at: new Date(res.attributes.created_at),
|
|
41
|
+
updated_at: new Date(res.attributes.updated_at),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
delete(server, database) {
|
|
46
|
+
return this.httpClient.request("DELETE", `/application/servers/${server}/databases/${database}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { BaseArgs, IP, List } from "../../../types.js";
|
|
2
|
+
export interface ApplicationDatabaseAttributes<T extends string | Date> {
|
|
3
|
+
id: number;
|
|
4
|
+
server: number;
|
|
5
|
+
host: number;
|
|
6
|
+
database: string;
|
|
7
|
+
username: string;
|
|
8
|
+
remote: string | IP | "%";
|
|
9
|
+
max_connections: number;
|
|
10
|
+
created_at: T;
|
|
11
|
+
updated_at: T;
|
|
12
|
+
}
|
|
13
|
+
export interface ApplicationDatabase<T extends string | Date> {
|
|
14
|
+
object: "server_database";
|
|
15
|
+
attributes: ApplicationDatabaseAttributes<T>;
|
|
16
|
+
}
|
|
17
|
+
export interface ApplicationDatabaseList extends List {
|
|
18
|
+
data: ApplicationDatabase<string>[];
|
|
19
|
+
}
|
|
20
|
+
export interface CreateApplicationDatabase extends BaseArgs {
|
|
21
|
+
database: string;
|
|
22
|
+
remote: string | IP | "%";
|
|
23
|
+
host: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CreatedApplicationDatabase extends ApplicationDatabase<string> {
|
|
26
|
+
meta: {
|
|
27
|
+
ressource: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface ApplicationDatabaseWithPassword {
|
|
31
|
+
object: "server_database";
|
|
32
|
+
attributes: ApplicationDatabaseAttributes<string> & {
|
|
33
|
+
relationships: {
|
|
34
|
+
password: {
|
|
35
|
+
object: "database_password";
|
|
36
|
+
attributes: {
|
|
37
|
+
password: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=database.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.types.d.ts","sourceRoot":"","sources":["../../../../src/application/server/database/database.types.ts"],"names":[],"mappings":"AAAA,O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;SACH,CAAC;KACH,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type HttpClient from "../../../../class/HttpClient.js";
|
|
2
|
+
export default class PasswordClient {
|
|
3
|
+
private httpClient;
|
|
4
|
+
constructor(httpClient: HttpClient);
|
|
5
|
+
reset(server: number, database: number): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=password.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.client.d.ts","sourceRoot":"","sources":["../../../../../src/application/server/database/password/password.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,cAAc;IACrB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAMvC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default class PasswordClient {
|
|
2
|
+
httpClient;
|
|
3
|
+
constructor(httpClient) {
|
|
4
|
+
this.httpClient = httpClient;
|
|
5
|
+
}
|
|
6
|
+
reset(server, database) {
|
|
7
|
+
return this.httpClient.request("POST", `/application/servers/${server}/databases/${database}/reset-password`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type HttpClient from "../../class/HttpClient.js";
|
|
2
2
|
import type { UserServer, UserServerAttributesWithDate } from "../../client/server/server.types.js";
|
|
3
|
+
import DatabaseClient from "./database/database.client.js";
|
|
3
4
|
import type { CreateServerArgs, EditApplicationServerArgs } from "./server.types.js";
|
|
4
5
|
export default class ServerClient {
|
|
5
6
|
private httpClient;
|
|
7
|
+
database: DatabaseClient;
|
|
6
8
|
constructor(httpClient: HttpClient);
|
|
7
9
|
list(): Promise<{
|
|
8
10
|
data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.client.d.ts","sourceRoot":"","sources":["../../../src/application/server/server.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EACV,4BAA4B,EAC7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAI1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,OAAO,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"server.client.d.ts","sourceRoot":"","sources":["../../../src/application/server/server.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EACV,4BAA4B,EAC7B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAI1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,OAAO,OAAO,YAAY;IAGnB,OAAO,CAAC,UAAU;IAFvB,QAAQ,EAAE,cAAc,CAAC;gBAEZ,UAAU,EAAE,UAAU;IAIpC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAeJ,IAAI,CAAC,EACT,EAAE,EACF,WAAW,GACZ,EAAE;QACD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+BK,MAAM,CAAC,OAAO,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAehC,IAAI,CACR,MAAM,EAAE,MAAM,EACd,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2ChE,OAAO,CAAC,EAAE,EAAE,MAAM;IAMlB,SAAS,CAAC,EAAE,EAAE,MAAM;IAMpB,SAAS,CAAC,EAAE,EAAE,MAAM;IAMpB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS;CAK/C"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import DatabaseClient from "./database/database.client.js";
|
|
1
2
|
export default class ServerClient {
|
|
2
3
|
httpClient;
|
|
4
|
+
database;
|
|
3
5
|
constructor(httpClient) {
|
|
4
6
|
this.httpClient = httpClient;
|
|
7
|
+
this.database = new DatabaseClient(httpClient);
|
|
5
8
|
}
|
|
6
9
|
async list() {
|
|
7
10
|
const res = await this.httpClient.request("GET", "/application/servers");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pterodactyl-api-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "SDK TypeScript non officiel et entièrement typé pour l’API Pterodactyl.\nCouvre l’ensemble des endpoints client et application avec une architecture modulaire, orientée classes, conçue pour Node.js et les environnements TypeScript stricts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|