pterodactyl-api-client 2.2.0 → 2.4.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.
Files changed (30) hide show
  1. package/dist/application/application.client.d.ts +4 -0
  2. package/dist/application/application.client.d.ts.map +1 -1
  3. package/dist/application/application.client.js +6 -0
  4. package/dist/application/location/index.cjs +3 -0
  5. package/dist/application/location/index.d.ts +3 -0
  6. package/dist/application/location/index.d.ts.map +1 -0
  7. package/dist/application/location/index.js +2 -0
  8. package/dist/application/location/location.client.d.ts +54 -0
  9. package/dist/application/location/location.client.d.ts.map +1 -0
  10. package/dist/application/location/location.client.js +73 -0
  11. package/dist/application/location/location.types.d.ts +23 -0
  12. package/dist/application/location/location.types.d.ts.map +1 -0
  13. package/dist/application/location/location.types.js +1 -0
  14. package/dist/application/node/allocation/allocation.client.d.ts +10 -0
  15. package/dist/application/node/allocation/allocation.client.d.ts.map +1 -0
  16. package/dist/application/node/allocation/allocation.client.js +15 -0
  17. package/dist/application/node/allocation/allocation.types.d.ts +26 -0
  18. package/dist/application/node/allocation/allocation.types.d.ts.map +1 -0
  19. package/dist/application/node/allocation/allocation.types.js +1 -0
  20. package/dist/application/node/index.cjs +3 -0
  21. package/dist/application/node/index.d.ts +5 -0
  22. package/dist/application/node/index.d.ts.map +1 -0
  23. package/dist/application/node/index.js +4 -0
  24. package/dist/application/node/node.client.d.ts +134 -0
  25. package/dist/application/node/node.client.d.ts.map +1 -0
  26. package/dist/application/node/node.client.js +62 -0
  27. package/dist/application/node/node.types.d.ts +77 -0
  28. package/dist/application/node/node.types.d.ts.map +1 -0
  29. package/dist/application/node/node.types.js +1 -0
  30. package/package.json +10 -5
@@ -1,3 +1,5 @@
1
+ import LocationClient from "./location/location.client.js";
2
+ import NodeClient from "./node/node.client.js";
1
3
  import ServerClient from "./server/server.client.js";
2
4
  import UserClient from "./user/user.client.js";
3
5
  export default class ApplicationAPI {
@@ -5,6 +7,8 @@ export default class ApplicationAPI {
5
7
  readonly panelUrl: URL;
6
8
  user: UserClient;
7
9
  server: ServerClient;
10
+ location: LocationClient;
11
+ node: NodeClient;
8
12
  constructor({ apiKey, panelUrl }: {
9
13
  apiKey: string;
10
14
  panelUrl: URL;
@@ -1 +1 @@
1
- {"version":3,"file":"application.client.d.ts","sourceRoot":"","sources":["../../src/application/application.client.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;gBAEhB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAE;CAMpE"}
1
+ {"version":3,"file":"application.client.d.ts","sourceRoot":"","sources":["../../src/application/application.client.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;gBAEZ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAE;CAQpE"}
@@ -1,4 +1,6 @@
1
1
  import HttpClient from "../class/HttpClient.js";
2
+ import LocationClient from "./location/location.client.js";
3
+ import NodeClient from "./node/node.client.js";
2
4
  import ServerClient from "./server/server.client.js";
3
5
  import UserClient from "./user/user.client.js";
4
6
  export default class ApplicationAPI {
@@ -6,10 +8,14 @@ export default class ApplicationAPI {
6
8
  panelUrl;
7
9
  user;
8
10
  server;
11
+ location;
12
+ node;
9
13
  constructor({ apiKey, panelUrl }) {
10
14
  this.panelUrl = panelUrl;
11
15
  this.httpClient = new HttpClient(panelUrl, apiKey);
12
16
  this.user = new UserClient(this.httpClient);
13
17
  this.server = new ServerClient(this.httpClient);
18
+ this.location = new LocationClient(this.httpClient);
19
+ this.node = new NodeClient(this.httpClient);
14
20
  }
15
21
  }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ const pkg = require("./index.js");
3
+ module.exports = pkg;
@@ -0,0 +1,3 @@
1
+ export { default as Location } from "./location.client.js";
2
+ export * from "./location.types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/location/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as Location } from "./location.client.js";
2
+ export * from "./location.types.js";
@@ -0,0 +1,54 @@
1
+ import type HttpClient from "../../class/HttpClient.js";
2
+ import type { CreateLocationArgs, EditLocationArgs } from "./location.types.js";
3
+ export default class LocationClient {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ list(): Promise<{
7
+ data: {
8
+ attributes: {
9
+ created_at: Date;
10
+ updated_at: Date;
11
+ id: number;
12
+ short: string;
13
+ long: string;
14
+ };
15
+ object: "location";
16
+ }[];
17
+ meta: {
18
+ pagination: import("../../types.js").Pagination;
19
+ };
20
+ object: "list";
21
+ }>;
22
+ info(id: number): Promise<{
23
+ attributes: {
24
+ created_at: Date;
25
+ updated_at: Date;
26
+ id: number;
27
+ short: string;
28
+ long: string;
29
+ };
30
+ object: "location";
31
+ }>;
32
+ create(options: CreateLocationArgs): Promise<{
33
+ attributes: {
34
+ created_at: Date;
35
+ updated_at: Date;
36
+ id: number;
37
+ short: string;
38
+ long: string;
39
+ };
40
+ object: "location";
41
+ }>;
42
+ edit(id: number, options: EditLocationArgs): Promise<{
43
+ attributes: {
44
+ created_at: Date;
45
+ updated_at: Date;
46
+ id: number;
47
+ short: string;
48
+ long: string;
49
+ };
50
+ object: "location";
51
+ }>;
52
+ delete(id: number): Promise<void>;
53
+ }
54
+ //# sourceMappingURL=location.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.client.d.ts","sourceRoot":"","sources":["../../../src/application/location/location.client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,cAAc;IACrB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEpC,IAAI;;;;;;;;;;;;;;;;IAkBJ,IAAI,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAgBf,MAAM,CAAC,OAAO,EAAE,kBAAkB;;;;;;;;;;IAoBlC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB;;;;;;;;;;IAyBhD,MAAM,CAAC,EAAE,EAAE,MAAM;CAMlB"}
@@ -0,0 +1,73 @@
1
+ import z from "zod";
2
+ export default class LocationClient {
3
+ httpClient;
4
+ constructor(httpClient) {
5
+ this.httpClient = httpClient;
6
+ }
7
+ async list() {
8
+ const res = await this.httpClient.request("GET", "/application/locations");
9
+ return {
10
+ ...res,
11
+ data: res.data.map((location) => ({
12
+ ...location,
13
+ attributes: {
14
+ ...location.attributes,
15
+ created_at: new Date(location.attributes.created_at),
16
+ updated_at: new Date(location.attributes.updated_at),
17
+ },
18
+ })),
19
+ };
20
+ }
21
+ async info(id) {
22
+ const res = await this.httpClient.request("GET", `/application/locations/${id}`);
23
+ return {
24
+ ...res,
25
+ ...res,
26
+ attributes: {
27
+ ...res.attributes,
28
+ created_at: new Date(res.attributes.created_at),
29
+ updated_at: new Date(res.attributes.updated_at),
30
+ },
31
+ };
32
+ }
33
+ async create(options) {
34
+ const schema = z.object({
35
+ short: z.string().min(3).max(60),
36
+ long: z.string().min(3).max(191),
37
+ });
38
+ const res = await this.httpClient.request("POST", `/application/locations`, schema.parse(options));
39
+ return {
40
+ ...res,
41
+ ...res,
42
+ attributes: {
43
+ ...res.attributes,
44
+ created_at: new Date(res.attributes.created_at),
45
+ updated_at: new Date(res.attributes.updated_at),
46
+ },
47
+ };
48
+ }
49
+ async edit(id, options) {
50
+ const schema = z
51
+ .object({
52
+ short: z.string().min(3).max(60).optional(),
53
+ long: z.string().min(3).max(191).optional(),
54
+ })
55
+ .refine((data) => data.short || data.long, {
56
+ message: "Either short or long must be provided",
57
+ path: ["short"],
58
+ });
59
+ const res = await this.httpClient.request("PATCH", `/application/locations/${id}`, schema.parse(options));
60
+ return {
61
+ ...res,
62
+ ...res,
63
+ attributes: {
64
+ ...res.attributes,
65
+ created_at: new Date(res.attributes.created_at),
66
+ updated_at: new Date(res.attributes.updated_at),
67
+ },
68
+ };
69
+ }
70
+ delete(id) {
71
+ return this.httpClient.request("POST", `/application/locations/${id}`);
72
+ }
73
+ }
@@ -0,0 +1,23 @@
1
+ import type { BaseArgs, ListwithPagination } from "../../types.js";
2
+ export interface Location<T extends Date | string> {
3
+ object: "location";
4
+ attributes: {
5
+ id: number;
6
+ short: string;
7
+ long: string;
8
+ updated_at: T;
9
+ created_at: T;
10
+ };
11
+ }
12
+ export interface LocationList extends ListwithPagination {
13
+ data: Location<string>[];
14
+ }
15
+ export interface CreateLocationArgs extends BaseArgs {
16
+ short: string;
17
+ long: string;
18
+ }
19
+ export interface EditLocationArgs extends BaseArgs {
20
+ short?: string | undefined;
21
+ long?: string | undefined;
22
+ }
23
+ //# sourceMappingURL=location.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.types.d.ts","sourceRoot":"","sources":["../../../src/application/location/location.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,IAAI,GAAG,MAAM;IAC/C,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,CAAC,CAAC;QACd,UAAU,EAAE,CAAC,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type HttpClient from "../../../class/HttpClient.js";
2
+ import type { ApplicationAllocationList, ApplicationAllocationListWithDate, CreateApplicationAllocationArgs } from "./allocation.types.js";
3
+ export default class AllocationClient {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ list(id: number): Promise<ApplicationAllocationListWithDate>;
7
+ create(id: number, options: CreateApplicationAllocationArgs): Promise<ApplicationAllocationList>;
8
+ delete(id: number, allocation: number): Promise<ApplicationAllocationList>;
9
+ }
10
+ //# sourceMappingURL=allocation.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocation.client.d.ts","sourceRoot":"","sources":["../../../../src/application/node/allocation/allocation.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAEV,yBAAyB,EACzB,iCAAiC,EACjC,+BAA+B,EAChC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACvB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C,IAAI,CAAC,EAAE,EAAE,MAAM;IAOf,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,+BAA+B;IAO3D,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAMtC"}
@@ -0,0 +1,15 @@
1
+ export default class AllocationClient {
2
+ httpClient;
3
+ constructor(httpClient) {
4
+ this.httpClient = httpClient;
5
+ }
6
+ list(id) {
7
+ return this.httpClient.request("GET", `/application/nodes/${id}/allocations`);
8
+ }
9
+ create(id, options) {
10
+ return this.httpClient.request("POST", `/application/nodes/${id}/allocations`, options);
11
+ }
12
+ delete(id, allocation) {
13
+ return this.httpClient.request("DELETE", `/application/nodes/${id}/allocations/${allocation}`);
14
+ }
15
+ }
@@ -0,0 +1,26 @@
1
+ import type { BaseArgs, IP, List, ListwithPagination } from "../../../types.js";
2
+ export type Port = `${number}`;
3
+ export type PortRange = `${number}-${number}`;
4
+ export interface ApplicationAllocation {
5
+ object: "allocation";
6
+ attributes: {
7
+ id: number;
8
+ ip: IP;
9
+ alias: string | null;
10
+ port: number;
11
+ notes: string | null;
12
+ assigned: boolean;
13
+ };
14
+ }
15
+ export interface ApplicationAllocationListWithDate extends ListwithPagination {
16
+ data: ApplicationAllocation[];
17
+ }
18
+ export interface CreateApplicationAllocationArgs extends BaseArgs {
19
+ ip: IP;
20
+ ports: (Port | PortRange)[];
21
+ alias: string;
22
+ }
23
+ export interface ApplicationAllocationList extends List {
24
+ data: ApplicationAllocation[];
25
+ }
26
+ //# sourceMappingURL=allocation.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocation.types.d.ts","sourceRoot":"","sources":["../../../../src/application/node/allocation/allocation.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,MAAM,MAAM,IAAI,GAAG,GAAG,MAAM,EAAE,CAAC;AAC/B,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,EAAE,CAAC;QACP,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,iCAAkC,SAAQ,kBAAkB;IAC3E,IAAI,EAAE,qBAAqB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,+BAAgC,SAAQ,QAAQ;IAC/D,EAAE,EAAE,EAAE,CAAC;IACP,KAAK,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI;IACrD,IAAI,EAAE,qBAAqB,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ const pkg = require("./index.js");
3
+ module.exports = pkg;
@@ -0,0 +1,5 @@
1
+ export { default as Node } from "./node.client.js";
2
+ export { default as AllocationClient } from "./allocation/allocation.client.js";
3
+ export * from "./node.types.js";
4
+ export * from "./allocation/allocation.types.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,cAAc,iBAAiB,CAAC;AAChC,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { default as Node } from "./node.client.js";
2
+ export { default as AllocationClient } from "./allocation/allocation.client.js";
3
+ export * from "./node.types.js";
4
+ export * from "./allocation/allocation.types.js";
@@ -0,0 +1,134 @@
1
+ import type HttpClient from "../../class/HttpClient.js";
2
+ import AllocationClient from "./allocation/allocation.client.js";
3
+ import type { CreateNodeArgs, Node, NodeConfiguration } from "./node.types.js";
4
+ export default class NodeClient {
5
+ private httpClient;
6
+ allocation: AllocationClient;
7
+ constructor(httpClient: HttpClient);
8
+ list(): Promise<{
9
+ date: {
10
+ attributes: {
11
+ created_at: Date;
12
+ updated_at: Date;
13
+ id: number;
14
+ uuid: string;
15
+ public: boolean;
16
+ name: string;
17
+ description: string;
18
+ location_id: number;
19
+ fqdn: string;
20
+ scheme: import("./node.types.js").Scheme;
21
+ behind_proxy: boolean;
22
+ maintenance_mode: boolean;
23
+ memory: number;
24
+ memory_overallocate: number;
25
+ disk: number;
26
+ disk_overallocate: number;
27
+ upload_size: number;
28
+ daemon_listen: number;
29
+ daemon_sftp: number;
30
+ daemon_base: string;
31
+ allocated_resources: {
32
+ memory: number;
33
+ disk: number;
34
+ };
35
+ };
36
+ object: "node";
37
+ }[];
38
+ data: Node<string>[];
39
+ meta: {
40
+ pagination: import("../../types.js").Pagination;
41
+ };
42
+ object: "list";
43
+ }>;
44
+ info(id: number): Promise<{
45
+ attributes: {
46
+ created_at: Date;
47
+ updated_at: Date;
48
+ id: number;
49
+ uuid: string;
50
+ public: boolean;
51
+ name: string;
52
+ description: string;
53
+ location_id: number;
54
+ fqdn: string;
55
+ scheme: import("./node.types.js").Scheme;
56
+ behind_proxy: boolean;
57
+ maintenance_mode: boolean;
58
+ memory: number;
59
+ memory_overallocate: number;
60
+ disk: number;
61
+ disk_overallocate: number;
62
+ upload_size: number;
63
+ daemon_listen: number;
64
+ daemon_sftp: number;
65
+ daemon_base: string;
66
+ allocated_resources: {
67
+ memory: number;
68
+ disk: number;
69
+ };
70
+ };
71
+ object: "node";
72
+ }>;
73
+ create(options: CreateNodeArgs): Promise<{
74
+ attributes: {
75
+ created_at: Date;
76
+ updated_at: Date;
77
+ id: number;
78
+ uuid: string;
79
+ public: boolean;
80
+ name: string;
81
+ description: string;
82
+ location_id: number;
83
+ fqdn: string;
84
+ scheme: import("./node.types.js").Scheme;
85
+ behind_proxy: boolean;
86
+ maintenance_mode: boolean;
87
+ memory: number;
88
+ memory_overallocate: number;
89
+ disk: number;
90
+ disk_overallocate: number;
91
+ upload_size: number;
92
+ daemon_listen: number;
93
+ daemon_sftp: number;
94
+ daemon_base: string;
95
+ allocated_resources: {
96
+ memory: number;
97
+ disk: number;
98
+ };
99
+ };
100
+ object: "node";
101
+ }>;
102
+ edit(id: number, options: CreateNodeArgs): Promise<{
103
+ attributes: {
104
+ created_at: Date;
105
+ updated_at: Date;
106
+ id: number;
107
+ uuid: string;
108
+ public: boolean;
109
+ name: string;
110
+ description: string;
111
+ location_id: number;
112
+ fqdn: string;
113
+ scheme: import("./node.types.js").Scheme;
114
+ behind_proxy: boolean;
115
+ maintenance_mode: boolean;
116
+ memory: number;
117
+ memory_overallocate: number;
118
+ disk: number;
119
+ disk_overallocate: number;
120
+ upload_size: number;
121
+ daemon_listen: number;
122
+ daemon_sftp: number;
123
+ daemon_base: string;
124
+ allocated_resources: {
125
+ memory: number;
126
+ disk: number;
127
+ };
128
+ };
129
+ object: "node";
130
+ }>;
131
+ configuration(id: number): Promise<NodeConfiguration>;
132
+ delete(id: number): Promise<NodeConfiguration>;
133
+ }
134
+ //# sourceMappingURL=node.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.client.d.ts","sourceRoot":"","sources":["../../../src/application/node/node.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,gBAAgB,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,IAAI,EACJ,iBAAiB,EAElB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,OAAO,OAAO,UAAU;IAGjB,OAAO,CAAC,UAAU;IAFvB,UAAU,EAAE,gBAAgB,CAAC;gBAEhB,UAAU,EAAE,UAAU;IAIpC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBJ,IAAI,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAef,MAAM,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgB9B,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgB9C,aAAa,CAAC,EAAE,EAAE,MAAM;IAOxB,MAAM,CAAC,EAAE,EAAE,MAAM;CAMlB"}
@@ -0,0 +1,62 @@
1
+ import AllocationClient from "./allocation/allocation.client.js";
2
+ export default class NodeClient {
3
+ httpClient;
4
+ allocation;
5
+ constructor(httpClient) {
6
+ this.httpClient = httpClient;
7
+ this.allocation = new AllocationClient(httpClient);
8
+ }
9
+ async list() {
10
+ const res = await this.httpClient.request("GET", "/application/nodes");
11
+ return {
12
+ ...res,
13
+ date: res.data.map((node) => ({
14
+ ...node,
15
+ attributes: {
16
+ ...node.attributes,
17
+ created_at: new Date(node.attributes.created_at),
18
+ updated_at: new Date(node.attributes.updated_at),
19
+ },
20
+ })),
21
+ };
22
+ }
23
+ async info(id) {
24
+ const res = await this.httpClient.request("GET", `/application/nodes/${id}`);
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(options) {
35
+ const res = await this.httpClient.request("POST", "/application/nodes", options);
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
+ async edit(id, options) {
46
+ const res = await this.httpClient.request("PATCH", `/application/nodes/${id}`, options);
47
+ return {
48
+ ...res,
49
+ attributes: {
50
+ ...res.attributes,
51
+ created_at: new Date(res.attributes.created_at),
52
+ updated_at: new Date(res.attributes.updated_at),
53
+ },
54
+ };
55
+ }
56
+ configuration(id) {
57
+ return this.httpClient.request("GET", `/application/nodes/${id}/configuration`);
58
+ }
59
+ delete(id) {
60
+ return this.httpClient.request("DELETE", `/application/nodes/${id}`);
61
+ }
62
+ }
@@ -0,0 +1,77 @@
1
+ import type { BaseArgs, IP, ListwithPagination } from "../../types.js";
2
+ export type Scheme = "https" | "http";
3
+ export interface Node<T extends string | Date> {
4
+ object: "node";
5
+ attributes: {
6
+ id: number;
7
+ uuid: string;
8
+ public: boolean;
9
+ name: string;
10
+ description: string;
11
+ location_id: number;
12
+ fqdn: string;
13
+ scheme: Scheme;
14
+ behind_proxy: boolean;
15
+ maintenance_mode: boolean;
16
+ memory: number;
17
+ memory_overallocate: number;
18
+ disk: number;
19
+ disk_overallocate: number;
20
+ upload_size: number;
21
+ daemon_listen: number;
22
+ daemon_sftp: number;
23
+ daemon_base: string;
24
+ created_at: T;
25
+ updated_at: T;
26
+ allocated_resources: {
27
+ memory: number;
28
+ disk: number;
29
+ };
30
+ };
31
+ }
32
+ export interface NodeList extends ListwithPagination {
33
+ data: Node<string>[];
34
+ }
35
+ export interface CreateNodeArgs extends BaseArgs {
36
+ name: string;
37
+ description?: string | undefined;
38
+ location_id: number;
39
+ fqdn: string;
40
+ scheme: Scheme;
41
+ behind_proxy?: boolean | undefined;
42
+ public?: boolean | undefined;
43
+ daemon_base?: string | undefined;
44
+ daemon_sftp: number;
45
+ daemon_listen: number;
46
+ memory: number;
47
+ memory_overallocate: number;
48
+ disk: number;
49
+ disk_overallocate: number;
50
+ upload_size?: number | undefined;
51
+ maintenance_mode?: boolean | undefined;
52
+ }
53
+ export interface NodeConfiguration {
54
+ debug: boolean;
55
+ uuid: string;
56
+ token_id: string;
57
+ token: string;
58
+ api: {
59
+ host: IP;
60
+ port: number;
61
+ ssl: {
62
+ enabled: boolean;
63
+ cert: string;
64
+ key: string;
65
+ };
66
+ upload_limit: number;
67
+ };
68
+ system: {
69
+ data: string;
70
+ sftp: {
71
+ bind_port: number;
72
+ };
73
+ };
74
+ allowed_mounts: [];
75
+ remote: string;
76
+ }
77
+ //# sourceMappingURL=node.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.types.d.ts","sourceRoot":"","sources":["../../../src/application/node/node.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,OAAO,CAAC;QACtB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB,EAAE,MAAM,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,CAAC,CAAC;QACd,UAAU,EAAE,CAAC,CAAC;QACd,mBAAmB,EAAE;YACnB,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,QAAS,SAAQ,kBAAkB;IAClD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE;QACH,IAAI,EAAE,EAAE,CAAC;QACT,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE;YACH,OAAO,EAAE,OAAO,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC;YACb,GAAG,EAAE,MAAM,CAAC;SACb,CAAC;QACF,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE;YACJ,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;IACF,cAAc,EAAE,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pterodactyl-api-client",
3
- "version": "2.2.0",
3
+ "version": "2.4.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",
@@ -40,10 +40,15 @@
40
40
  "import": "./dist/application/user/index.js",
41
41
  "require": "./dist/application/user/index.cjs"
42
42
  },
43
- "./application/server": {
44
- "types": "./dist/application/server/index.d.ts",
45
- "import": "./dist/application/server/index.js",
46
- "require": "./dist/application/server/index.cjs"
43
+ "./application/location": {
44
+ "types": "./dist/application/location/index.d.ts",
45
+ "import": "./dist/application/location/index.js",
46
+ "req,uire": "./dist/application/location/index.cjs"
47
+ },
48
+ "./application/node": {
49
+ "types": "./dist/application/node/index.d.ts",
50
+ "import": "./dist/application/node/index.js",
51
+ "require": "./dist/application/node/index.cjs"
47
52
  }
48
53
  },
49
54
  "scripts": {