@meowpanel/api 0.2.0 → 0.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.
- package/esm/mod.d.ts +39 -18
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +26 -8
- package/esm/src/client.d.ts +48 -11
- package/esm/src/client.d.ts.map +1 -1
- package/esm/src/client.js +53 -12
- package/esm/src/errors.d.ts +8 -0
- package/esm/src/errors.d.ts.map +1 -1
- package/esm/src/errors.js +10 -0
- package/esm/src/http.d.ts +2 -2
- package/esm/src/http.d.ts.map +1 -1
- package/esm/src/http.js +5 -2
- package/esm/src/namespace.d.ts +1 -1
- package/esm/src/namespace.js +1 -1
- package/esm/src/resources/account.d.ts +104 -19
- package/esm/src/resources/account.d.ts.map +1 -1
- package/esm/src/resources/account.js +112 -13
- package/esm/src/resources/api-keys.d.ts +16 -24
- package/esm/src/resources/api-keys.d.ts.map +1 -1
- package/esm/src/resources/api-keys.js +16 -20
- package/esm/src/resources/auth.d.ts +70 -4
- package/esm/src/resources/auth.d.ts.map +1 -1
- package/esm/src/resources/auth.js +47 -4
- package/esm/src/resources/eggs.d.ts +261 -22
- package/esm/src/resources/eggs.d.ts.map +1 -1
- package/esm/src/resources/eggs.js +261 -25
- package/esm/src/resources/features.d.ts +35 -0
- package/esm/src/resources/features.d.ts.map +1 -0
- package/esm/src/resources/features.js +21 -0
- package/esm/src/resources/hosts.d.ts +143 -18
- package/esm/src/resources/hosts.d.ts.map +1 -1
- package/esm/src/resources/hosts.js +145 -10
- package/esm/src/resources/logs.d.ts +39 -0
- package/esm/src/resources/logs.d.ts.map +1 -0
- package/esm/src/resources/logs.js +38 -0
- package/esm/src/resources/nodes.d.ts +106 -41
- package/esm/src/resources/nodes.d.ts.map +1 -1
- package/esm/src/resources/nodes.js +121 -28
- package/esm/src/resources/permissions.d.ts +45 -0
- package/esm/src/resources/permissions.d.ts.map +1 -0
- package/esm/src/resources/permissions.js +26 -0
- package/esm/src/resources/request-logs.d.ts +91 -0
- package/esm/src/resources/request-logs.d.ts.map +1 -0
- package/esm/src/resources/request-logs.js +70 -0
- package/esm/src/resources/roles.d.ts +128 -0
- package/esm/src/resources/roles.d.ts.map +1 -0
- package/esm/src/resources/roles.js +142 -0
- package/esm/src/resources/server-groups.d.ts +141 -7
- package/esm/src/resources/server-groups.d.ts.map +1 -1
- package/esm/src/resources/server-groups.js +157 -8
- package/esm/src/resources/servers/activity.d.ts +50 -8
- package/esm/src/resources/servers/activity.d.ts.map +1 -1
- package/esm/src/resources/servers/activity.js +54 -13
- package/esm/src/resources/servers/allocations.d.ts +3 -3
- package/esm/src/resources/servers/allocations.d.ts.map +1 -1
- package/esm/src/resources/servers/allocations.js +7 -7
- package/esm/src/resources/servers/backups.d.ts +46 -0
- package/esm/src/resources/servers/backups.d.ts.map +1 -0
- package/esm/src/resources/servers/backups.js +43 -0
- package/esm/src/resources/servers/connection.d.ts +27 -7
- package/esm/src/resources/servers/connection.d.ts.map +1 -1
- package/esm/src/resources/servers/connection.js +28 -7
- package/esm/src/resources/servers/features.d.ts +81 -0
- package/esm/src/resources/servers/features.d.ts.map +1 -0
- package/esm/src/resources/servers/features.js +60 -0
- package/esm/src/resources/servers/files.d.ts +41 -53
- package/esm/src/resources/servers/files.d.ts.map +1 -1
- package/esm/src/resources/servers/files.js +74 -116
- package/esm/src/resources/servers/index.d.ts +46 -27
- package/esm/src/resources/servers/index.d.ts.map +1 -1
- package/esm/src/resources/servers/index.js +26 -12
- package/esm/src/resources/servers/jobs.d.ts +88 -0
- package/esm/src/resources/servers/jobs.d.ts.map +1 -0
- package/esm/src/resources/servers/jobs.js +115 -0
- package/esm/src/resources/servers/node-client.d.ts +33 -0
- package/esm/src/resources/servers/node-client.d.ts.map +1 -0
- package/esm/src/resources/servers/node-client.js +61 -0
- package/esm/src/resources/servers/profiles.d.ts +45 -1
- package/esm/src/resources/servers/profiles.d.ts.map +1 -1
- package/esm/src/resources/servers/profiles.js +55 -2
- package/esm/src/resources/servers/server.d.ts +10 -25
- package/esm/src/resources/servers/server.d.ts.map +1 -1
- package/esm/src/resources/servers/server.js +18 -34
- package/esm/src/resources/servers/sftp.d.ts +21 -19
- package/esm/src/resources/servers/sftp.d.ts.map +1 -1
- package/esm/src/resources/servers/sftp.js +22 -14
- package/esm/src/resources/servers/sub-users.d.ts +99 -0
- package/esm/src/resources/servers/sub-users.d.ts.map +1 -0
- package/esm/src/resources/servers/sub-users.js +94 -0
- package/esm/src/resources/servers/types.d.ts +27 -25
- package/esm/src/resources/servers/types.d.ts.map +1 -1
- package/esm/src/resources/systems.d.ts +124 -0
- package/esm/src/resources/systems.d.ts.map +1 -0
- package/esm/src/resources/systems.js +139 -0
- package/esm/src/resources/users.d.ts +330 -0
- package/esm/src/resources/users.d.ts.map +1 -0
- package/esm/src/resources/users.js +280 -0
- package/esm/src/types.d.ts +18 -1
- package/esm/src/types.d.ts.map +1 -1
- package/esm/src/types.js +11 -0
- package/package.json +1 -1
- package/script/mod.d.ts +39 -18
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +52 -5
- package/script/src/client.d.ts +48 -11
- package/script/src/client.d.ts.map +1 -1
- package/script/src/client.js +53 -12
- package/script/src/errors.d.ts +8 -0
- package/script/src/errors.d.ts.map +1 -1
- package/script/src/errors.js +10 -0
- package/script/src/http.d.ts +2 -2
- package/script/src/http.d.ts.map +1 -1
- package/script/src/http.js +5 -2
- package/script/src/namespace.d.ts +1 -1
- package/script/src/namespace.js +1 -1
- package/script/src/resources/account.d.ts +104 -19
- package/script/src/resources/account.d.ts.map +1 -1
- package/script/src/resources/account.js +114 -13
- package/script/src/resources/api-keys.d.ts +16 -24
- package/script/src/resources/api-keys.d.ts.map +1 -1
- package/script/src/resources/api-keys.js +15 -19
- package/script/src/resources/auth.d.ts +70 -4
- package/script/src/resources/auth.d.ts.map +1 -1
- package/script/src/resources/auth.js +47 -4
- package/script/src/resources/eggs.d.ts +261 -22
- package/script/src/resources/eggs.d.ts.map +1 -1
- package/script/src/resources/eggs.js +267 -26
- package/script/src/resources/features.d.ts +35 -0
- package/script/src/resources/features.d.ts.map +1 -0
- package/script/src/resources/features.js +25 -0
- package/script/src/resources/hosts.d.ts +143 -18
- package/script/src/resources/hosts.d.ts.map +1 -1
- package/script/src/resources/hosts.js +146 -10
- package/script/src/resources/logs.d.ts +39 -0
- package/script/src/resources/logs.d.ts.map +1 -0
- package/script/src/resources/logs.js +42 -0
- package/script/src/resources/nodes.d.ts +106 -41
- package/script/src/resources/nodes.d.ts.map +1 -1
- package/script/src/resources/nodes.js +122 -28
- package/script/src/resources/permissions.d.ts +45 -0
- package/script/src/resources/permissions.d.ts.map +1 -0
- package/script/src/resources/permissions.js +31 -0
- package/script/src/resources/request-logs.d.ts +91 -0
- package/script/src/resources/request-logs.d.ts.map +1 -0
- package/script/src/resources/request-logs.js +75 -0
- package/script/src/resources/roles.d.ts +128 -0
- package/script/src/resources/roles.d.ts.map +1 -0
- package/script/src/resources/roles.js +148 -0
- package/script/src/resources/server-groups.d.ts +141 -7
- package/script/src/resources/server-groups.d.ts.map +1 -1
- package/script/src/resources/server-groups.js +158 -8
- package/script/src/resources/servers/activity.d.ts +50 -8
- package/script/src/resources/servers/activity.d.ts.map +1 -1
- package/script/src/resources/servers/activity.js +54 -12
- package/script/src/resources/servers/allocations.d.ts +3 -3
- package/script/src/resources/servers/allocations.d.ts.map +1 -1
- package/script/src/resources/servers/allocations.js +7 -7
- package/script/src/resources/servers/backups.d.ts +46 -0
- package/script/src/resources/servers/backups.d.ts.map +1 -0
- package/script/src/resources/servers/backups.js +47 -0
- package/script/src/resources/servers/connection.d.ts +27 -7
- package/script/src/resources/servers/connection.d.ts.map +1 -1
- package/script/src/resources/servers/connection.js +28 -7
- package/script/src/resources/servers/features.d.ts +81 -0
- package/script/src/resources/servers/features.d.ts.map +1 -0
- package/script/src/resources/servers/features.js +64 -0
- package/script/src/resources/servers/files.d.ts +41 -53
- package/script/src/resources/servers/files.d.ts.map +1 -1
- package/script/src/resources/servers/files.js +74 -116
- package/script/src/resources/servers/index.d.ts +46 -27
- package/script/src/resources/servers/index.d.ts.map +1 -1
- package/script/src/resources/servers/index.js +26 -12
- package/script/src/resources/servers/jobs.d.ts +88 -0
- package/script/src/resources/servers/jobs.d.ts.map +1 -0
- package/script/src/resources/servers/jobs.js +120 -0
- package/script/src/resources/servers/node-client.d.ts +33 -0
- package/script/src/resources/servers/node-client.d.ts.map +1 -0
- package/script/src/resources/servers/node-client.js +65 -0
- package/script/src/resources/servers/profiles.d.ts +45 -1
- package/script/src/resources/servers/profiles.d.ts.map +1 -1
- package/script/src/resources/servers/profiles.js +55 -2
- package/script/src/resources/servers/server.d.ts +10 -25
- package/script/src/resources/servers/server.d.ts.map +1 -1
- package/script/src/resources/servers/server.js +18 -34
- package/script/src/resources/servers/sftp.d.ts +21 -19
- package/script/src/resources/servers/sftp.d.ts.map +1 -1
- package/script/src/resources/servers/sftp.js +22 -14
- package/script/src/resources/servers/sub-users.d.ts +99 -0
- package/script/src/resources/servers/sub-users.d.ts.map +1 -0
- package/script/src/resources/servers/sub-users.js +99 -0
- package/script/src/resources/servers/types.d.ts +27 -25
- package/script/src/resources/servers/types.d.ts.map +1 -1
- package/script/src/resources/systems.d.ts +124 -0
- package/script/src/resources/systems.d.ts.map +1 -0
- package/script/src/resources/systems.js +145 -0
- package/script/src/resources/users.d.ts +330 -0
- package/script/src/resources/users.d.ts.map +1 -0
- package/script/src/resources/users.js +287 -0
- package/script/src/types.d.ts +18 -1
- package/script/src/types.d.ts.map +1 -1
- package/script/src/types.js +12 -0
- package/esm/src/resources/members.d.ts +0 -138
- package/esm/src/resources/members.d.ts.map +0 -1
- package/esm/src/resources/members.js +0 -122
- package/script/src/resources/members.d.ts +0 -138
- package/script/src/resources/members.d.ts.map +0 -1
- package/script/src/resources/members.js +0 -127
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EggsNamespace = exports.Egg = exports.EggNest = void 0;
|
|
3
|
+
exports.EggsNamespace = exports.EggFeaturesManager = exports.EggImagesManager = exports.EggVariablesManager = exports.EggNestsManager = exports.Egg = exports.EggVariable = exports.EggNest = void 0;
|
|
4
4
|
const namespace_js_1 = require("../namespace.js");
|
|
5
5
|
const reactive_js_1 = require("../reactive.js");
|
|
6
6
|
const types_js_1 = require("../types.js");
|
|
@@ -10,8 +10,6 @@ const types_js_1 = require("../types.js");
|
|
|
10
10
|
class EggNest extends reactive_js_1.ReactiveResource {
|
|
11
11
|
/** Unique NanoID of this nest. */
|
|
12
12
|
id;
|
|
13
|
-
/** The issuer type. */
|
|
14
|
-
issuerType;
|
|
15
13
|
/** Display name of the nest, e.g. `"Minecraft"`. */
|
|
16
14
|
name;
|
|
17
15
|
/** Description of the nest. */
|
|
@@ -24,7 +22,6 @@ class EggNest extends reactive_js_1.ReactiveResource {
|
|
|
24
22
|
constructor(data) {
|
|
25
23
|
super();
|
|
26
24
|
this.id = (0, types_js_1.toNanoID)(data.id);
|
|
27
|
-
this.issuerType = data.issuer_type;
|
|
28
25
|
this.name = data.name;
|
|
29
26
|
this.description = data.description;
|
|
30
27
|
this.createdAt = new Date(data.created_at);
|
|
@@ -32,6 +29,60 @@ class EggNest extends reactive_js_1.ReactiveResource {
|
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
exports.EggNest = EggNest;
|
|
32
|
+
function makeEggImage(data) {
|
|
33
|
+
return {
|
|
34
|
+
id: (0, types_js_1.toNanoID)(data.id),
|
|
35
|
+
name: data.name,
|
|
36
|
+
image: data.image,
|
|
37
|
+
createdAt: new Date(data.created_at),
|
|
38
|
+
updatedAt: new Date(data.updated_at),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An egg environment variable.
|
|
43
|
+
*
|
|
44
|
+
* Retrieved via {@link EggVariablesManager.list} or {@link EggVariablesManager.get}.
|
|
45
|
+
*/
|
|
46
|
+
class EggVariable extends reactive_js_1.ReactiveResource {
|
|
47
|
+
/** The variable's unique NanoID. */
|
|
48
|
+
id;
|
|
49
|
+
/** Display name, e.g. `"Server Jar File"`. */
|
|
50
|
+
name;
|
|
51
|
+
/** Description shown to the user. */
|
|
52
|
+
description;
|
|
53
|
+
/** The environment variable name, e.g. `"SERVER_JARFILE"`. */
|
|
54
|
+
envVariable;
|
|
55
|
+
/** The default value. */
|
|
56
|
+
defaultValue;
|
|
57
|
+
/** Whether the value is visible to the server user. */
|
|
58
|
+
userViewable;
|
|
59
|
+
/** Whether the server user may change the value. */
|
|
60
|
+
userEditable;
|
|
61
|
+
/** Validation rules string, e.g. `"required|string"`. */
|
|
62
|
+
rules;
|
|
63
|
+
/** When this variable was created. */
|
|
64
|
+
createdAt;
|
|
65
|
+
/** When this variable was last updated. */
|
|
66
|
+
updatedAt;
|
|
67
|
+
/** @internal */
|
|
68
|
+
constructor(data) {
|
|
69
|
+
super();
|
|
70
|
+
this.id = (0, types_js_1.toNanoID)(data.id);
|
|
71
|
+
this.name = data.name;
|
|
72
|
+
this.description = data.description;
|
|
73
|
+
this.envVariable = data.env_variable;
|
|
74
|
+
this.defaultValue = data.default_value;
|
|
75
|
+
this.userViewable = data.user_viewable;
|
|
76
|
+
this.userEditable = data.user_editable;
|
|
77
|
+
this.rules = data.rules;
|
|
78
|
+
this.createdAt = new Date(data.created_at);
|
|
79
|
+
this.updatedAt = new Date(data.updated_at);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.EggVariable = EggVariable;
|
|
83
|
+
function makeFeatureGrant(data) {
|
|
84
|
+
return { name: data.name, defaultEnabled: data.default_enabled, locked: data.locked, obsolete: data.obsolete };
|
|
85
|
+
}
|
|
35
86
|
/**
|
|
36
87
|
* An egg - a game or application configuration template that defines how a server
|
|
37
88
|
* is installed, started, and stopped.
|
|
@@ -41,8 +92,6 @@ exports.EggNest = EggNest;
|
|
|
41
92
|
class Egg extends reactive_js_1.ReactiveResource {
|
|
42
93
|
/** The egg's unique NanoID. */
|
|
43
94
|
id;
|
|
44
|
-
/** The issuer type. */
|
|
45
|
-
issuerType;
|
|
46
95
|
/** Display name of the egg, e.g. `"Vanilla Minecraft"`. */
|
|
47
96
|
name;
|
|
48
97
|
/** Description of the egg. */
|
|
@@ -63,11 +112,13 @@ class Egg extends reactive_js_1.ReactiveResource {
|
|
|
63
112
|
stopCommand;
|
|
64
113
|
/** When `true`, the server's outgoing IP is forced to match the allocation IP. */
|
|
65
114
|
forceOutgoingIp;
|
|
66
|
-
/**
|
|
115
|
+
/** URL of the egg's background image. Requires `?include=app_background_url`. */
|
|
116
|
+
appBackgroundUrl;
|
|
117
|
+
/** Installer configuration for this egg. Requires `?include=installer`. */
|
|
67
118
|
installer;
|
|
68
|
-
/** Process configuration
|
|
119
|
+
/** Process configuration. Requires `?include=process` and `egg.config.process.read`. */
|
|
69
120
|
process;
|
|
70
|
-
/** Docker image variants for this egg. */
|
|
121
|
+
/** Docker image variants for this egg. Requires `?include=images`. */
|
|
71
122
|
images;
|
|
72
123
|
/** When this egg was created. */
|
|
73
124
|
createdAt;
|
|
@@ -77,7 +128,6 @@ class Egg extends reactive_js_1.ReactiveResource {
|
|
|
77
128
|
constructor(data) {
|
|
78
129
|
super();
|
|
79
130
|
this.id = (0, types_js_1.toNanoID)(data.id);
|
|
80
|
-
this.issuerType = data.issuer_type;
|
|
81
131
|
this.name = data.name;
|
|
82
132
|
this.description = data.description;
|
|
83
133
|
this.nestId = (0, types_js_1.toNanoID)(data.nest_id);
|
|
@@ -85,6 +135,7 @@ class Egg extends reactive_js_1.ReactiveResource {
|
|
|
85
135
|
this.startupCommand = data.startup_command;
|
|
86
136
|
this.stopCommand = data.stop_command;
|
|
87
137
|
this.forceOutgoingIp = data.force_outgoing_ip;
|
|
138
|
+
this.appBackgroundUrl = data.app_background_url;
|
|
88
139
|
this.installer = data.installer
|
|
89
140
|
? {
|
|
90
141
|
image: data.installer.image,
|
|
@@ -101,18 +152,163 @@ class Egg extends reactive_js_1.ReactiveResource {
|
|
|
101
152
|
fileBlacklistRegex: data.process.file_blacklist_regex,
|
|
102
153
|
}
|
|
103
154
|
: data.process;
|
|
104
|
-
this.images = data.images?.map(
|
|
105
|
-
id: (0, types_js_1.toNanoID)(img.id),
|
|
106
|
-
name: img.name,
|
|
107
|
-
image: img.image,
|
|
108
|
-
createdAt: new Date(img.created_at),
|
|
109
|
-
updatedAt: new Date(img.updated_at),
|
|
110
|
-
}));
|
|
155
|
+
this.images = data.images?.map(makeEggImage);
|
|
111
156
|
this.createdAt = new Date(data.created_at);
|
|
112
157
|
this.updatedAt = new Date(data.updated_at);
|
|
113
158
|
}
|
|
114
159
|
}
|
|
115
160
|
exports.Egg = Egg;
|
|
161
|
+
function configStartupBody(startup) {
|
|
162
|
+
return { done: startup.done, user_interaction: startup.userInteraction, strip_ansi: startup.stripAnsi };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Manages egg nests (categories).
|
|
166
|
+
*
|
|
167
|
+
* Access via `api.eggs.nests`.
|
|
168
|
+
*/
|
|
169
|
+
class EggNestsManager {
|
|
170
|
+
http;
|
|
171
|
+
/** @internal */
|
|
172
|
+
constructor(http) {
|
|
173
|
+
this.http = http;
|
|
174
|
+
}
|
|
175
|
+
/** Fetch all nests readable by the caller. */
|
|
176
|
+
async list() {
|
|
177
|
+
const data = await this.http.get('/eggs/nests');
|
|
178
|
+
return data.map((d) => new EggNest(d));
|
|
179
|
+
}
|
|
180
|
+
/** Fetch a single nest by ID. */
|
|
181
|
+
async get(id) {
|
|
182
|
+
return new EggNest(await this.http.get(`/eggs/nests/${id}`));
|
|
183
|
+
}
|
|
184
|
+
/** Create a nest. Omit `hostId` for a global nest. */
|
|
185
|
+
async create(payload) {
|
|
186
|
+
const data = await this.http.post('/eggs/nests', {
|
|
187
|
+
name: payload.name,
|
|
188
|
+
description: payload.description,
|
|
189
|
+
host_id: payload.hostId,
|
|
190
|
+
});
|
|
191
|
+
return new EggNest(data);
|
|
192
|
+
}
|
|
193
|
+
/** Update a nest's name or description. */
|
|
194
|
+
async update(id, payload) {
|
|
195
|
+
return new EggNest(await this.http.patch(`/eggs/nests/${id}`, payload));
|
|
196
|
+
}
|
|
197
|
+
/** Delete a nest. Fails if it still contains eggs. */
|
|
198
|
+
async delete(id) {
|
|
199
|
+
await this.http.delete(`/eggs/nests/${id}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.EggNestsManager = EggNestsManager;
|
|
203
|
+
function variableBody(payload) {
|
|
204
|
+
return {
|
|
205
|
+
name: payload.name,
|
|
206
|
+
description: payload.description,
|
|
207
|
+
env_variable: payload.envVariable,
|
|
208
|
+
default_value: payload.defaultValue,
|
|
209
|
+
user_viewable: payload.userViewable,
|
|
210
|
+
user_editable: payload.userEditable,
|
|
211
|
+
rules: payload.rules,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Manages the environment variables of a specific egg.
|
|
216
|
+
*
|
|
217
|
+
* Access via `api.eggs.variables(eggId)`.
|
|
218
|
+
*/
|
|
219
|
+
class EggVariablesManager {
|
|
220
|
+
eggId;
|
|
221
|
+
http;
|
|
222
|
+
/** @internal */
|
|
223
|
+
constructor(eggId, http) {
|
|
224
|
+
this.eggId = eggId;
|
|
225
|
+
this.http = http;
|
|
226
|
+
}
|
|
227
|
+
/** List the egg's variables. */
|
|
228
|
+
async list() {
|
|
229
|
+
const data = await this.http.get(`/eggs/${this.eggId}/variables`);
|
|
230
|
+
return data.map((d) => new EggVariable(d));
|
|
231
|
+
}
|
|
232
|
+
/** Fetch a single variable by ID. */
|
|
233
|
+
async get(variableId) {
|
|
234
|
+
return new EggVariable(await this.http.get(`/eggs/${this.eggId}/variables/${variableId}`));
|
|
235
|
+
}
|
|
236
|
+
/** Create a variable. */
|
|
237
|
+
async create(payload) {
|
|
238
|
+
return new EggVariable(await this.http.post(`/eggs/${this.eggId}/variables`, variableBody(payload)));
|
|
239
|
+
}
|
|
240
|
+
/** Update a variable. */
|
|
241
|
+
async update(variableId, payload) {
|
|
242
|
+
return new EggVariable(await this.http.patch(`/eggs/${this.eggId}/variables/${variableId}`, variableBody(payload)));
|
|
243
|
+
}
|
|
244
|
+
/** Delete a variable. */
|
|
245
|
+
async delete(variableId) {
|
|
246
|
+
await this.http.delete(`/eggs/${this.eggId}/variables/${variableId}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.EggVariablesManager = EggVariablesManager;
|
|
250
|
+
/**
|
|
251
|
+
* Manages the Docker image variants of a specific egg.
|
|
252
|
+
*
|
|
253
|
+
* Access via `api.eggs.images(eggId)`.
|
|
254
|
+
*/
|
|
255
|
+
class EggImagesManager {
|
|
256
|
+
eggId;
|
|
257
|
+
http;
|
|
258
|
+
/** @internal */
|
|
259
|
+
constructor(eggId, http) {
|
|
260
|
+
this.eggId = eggId;
|
|
261
|
+
this.http = http;
|
|
262
|
+
}
|
|
263
|
+
/** List the egg's images. */
|
|
264
|
+
async list() {
|
|
265
|
+
const data = await this.http.get(`/eggs/${this.eggId}/images`);
|
|
266
|
+
return data.map(makeEggImage);
|
|
267
|
+
}
|
|
268
|
+
/** Add an image to the egg. */
|
|
269
|
+
async create(payload) {
|
|
270
|
+
return makeEggImage(await this.http.post(`/eggs/${this.eggId}/images`, payload));
|
|
271
|
+
}
|
|
272
|
+
/** Remove an image. Fails if it is in use or is the egg's last image. */
|
|
273
|
+
async delete(imageId) {
|
|
274
|
+
await this.http.delete(`/eggs/${this.eggId}/images/${imageId}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.EggImagesManager = EggImagesManager;
|
|
278
|
+
/**
|
|
279
|
+
* Manages the feature grants attached to a specific egg.
|
|
280
|
+
*
|
|
281
|
+
* Access via `api.eggs.features(eggId)`.
|
|
282
|
+
*/
|
|
283
|
+
class EggFeaturesManager {
|
|
284
|
+
eggId;
|
|
285
|
+
http;
|
|
286
|
+
/** @internal */
|
|
287
|
+
constructor(eggId, http) {
|
|
288
|
+
this.eggId = eggId;
|
|
289
|
+
this.http = http;
|
|
290
|
+
}
|
|
291
|
+
/** List the egg's feature grants. */
|
|
292
|
+
async list() {
|
|
293
|
+
const data = await this.http.get(`/eggs/${this.eggId}/features`);
|
|
294
|
+
return data.map(makeFeatureGrant);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Grant a feature on the egg, or update its policy (upsert).
|
|
298
|
+
*
|
|
299
|
+
* @param feature The feature key.
|
|
300
|
+
* @param policy Defaults to `defaultEnabled: true`, `locked: false`.
|
|
301
|
+
*/
|
|
302
|
+
async set(feature, policy = {}) {
|
|
303
|
+
const data = await this.http.put(`/eggs/${this.eggId}/features/${encodeURIComponent(feature)}`, JSON.stringify({ default_enabled: policy.defaultEnabled, locked: policy.locked }), 'application/json');
|
|
304
|
+
return makeFeatureGrant(data);
|
|
305
|
+
}
|
|
306
|
+
/** Remove a feature grant from the egg. */
|
|
307
|
+
async remove(feature) {
|
|
308
|
+
await this.http.delete(`/eggs/${this.eggId}/features/${encodeURIComponent(feature)}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.EggFeaturesManager = EggFeaturesManager;
|
|
116
312
|
/**
|
|
117
313
|
* Namespace for egg management.
|
|
118
314
|
*
|
|
@@ -123,13 +319,16 @@ exports.Egg = Egg;
|
|
|
123
319
|
* const eggs = await api.eggs.list();
|
|
124
320
|
* const egg = await api.eggs.get(id);
|
|
125
321
|
* await api.eggs.update(id, { name: 'Paper Minecraft' });
|
|
126
|
-
* await api.eggs.
|
|
322
|
+
* await api.eggs.variables(id).create({ name: 'Jar', description: '', envVariable: 'JAR', defaultValue: 'server.jar' });
|
|
127
323
|
* ```
|
|
128
324
|
*/
|
|
129
325
|
class EggsNamespace extends namespace_js_1.ResourceNamespace {
|
|
326
|
+
/** Manage egg nests (categories). */
|
|
327
|
+
nests;
|
|
130
328
|
/** @internal */
|
|
131
329
|
constructor(http) {
|
|
132
330
|
super(http);
|
|
331
|
+
this.nests = new EggNestsManager(http);
|
|
133
332
|
}
|
|
134
333
|
/**
|
|
135
334
|
* Fetch a paginated list of eggs.
|
|
@@ -160,6 +359,32 @@ class EggsNamespace extends namespace_js_1.ResourceNamespace {
|
|
|
160
359
|
const data = await this.http.get(`/eggs/${id}`, { params });
|
|
161
360
|
return new Egg(data);
|
|
162
361
|
}
|
|
362
|
+
/** Create a new egg. */
|
|
363
|
+
async create(payload) {
|
|
364
|
+
const body = {
|
|
365
|
+
nest_id: payload.nestId,
|
|
366
|
+
name: payload.name,
|
|
367
|
+
description: payload.description,
|
|
368
|
+
startup_command: payload.startupCommand,
|
|
369
|
+
stop_command: payload.stopCommand,
|
|
370
|
+
installer: {
|
|
371
|
+
image: payload.installer.image,
|
|
372
|
+
entry_command: payload.installer.entryCommand,
|
|
373
|
+
script: payload.installer.script,
|
|
374
|
+
},
|
|
375
|
+
images: payload.images,
|
|
376
|
+
force_outgoing_ip: payload.forceOutgoingIp,
|
|
377
|
+
file_blacklist_regex: payload.fileBlacklistRegex,
|
|
378
|
+
config_files: payload.configFiles,
|
|
379
|
+
config_startup: payload.configStartup ? configStartupBody(payload.configStartup) : undefined,
|
|
380
|
+
config_logs: payload.configLogs,
|
|
381
|
+
};
|
|
382
|
+
const data = await this.http.post('/eggs', body);
|
|
383
|
+
const egg = new Egg(data);
|
|
384
|
+
this.addToCache(egg);
|
|
385
|
+
this.emit('created', egg);
|
|
386
|
+
return egg;
|
|
387
|
+
}
|
|
163
388
|
/**
|
|
164
389
|
* Update an egg's configuration.
|
|
165
390
|
*
|
|
@@ -170,20 +395,16 @@ class EggsNamespace extends namespace_js_1.ResourceNamespace {
|
|
|
170
395
|
const body = {};
|
|
171
396
|
if (payload.name !== undefined)
|
|
172
397
|
body['name'] = payload.name;
|
|
173
|
-
if (payload.description !== undefined)
|
|
398
|
+
if (payload.description !== undefined)
|
|
174
399
|
body['description'] = payload.description;
|
|
175
|
-
}
|
|
176
400
|
if (payload.nestId !== undefined)
|
|
177
401
|
body['nest_id'] = payload.nestId;
|
|
178
|
-
if (payload.startupCommand !== undefined)
|
|
402
|
+
if (payload.startupCommand !== undefined)
|
|
179
403
|
body['startup_command'] = payload.startupCommand;
|
|
180
|
-
|
|
181
|
-
if (payload.stopCommand !== undefined) {
|
|
404
|
+
if (payload.stopCommand !== undefined)
|
|
182
405
|
body['stop_command'] = payload.stopCommand;
|
|
183
|
-
|
|
184
|
-
if (payload.forceOutgoingIp !== undefined) {
|
|
406
|
+
if (payload.forceOutgoingIp !== undefined)
|
|
185
407
|
body['force_outgoing_ip'] = payload.forceOutgoingIp;
|
|
186
|
-
}
|
|
187
408
|
if (payload.installer) {
|
|
188
409
|
body['installer'] = {
|
|
189
410
|
image: payload.installer.image,
|
|
@@ -191,6 +412,14 @@ class EggsNamespace extends namespace_js_1.ResourceNamespace {
|
|
|
191
412
|
script: payload.installer.script,
|
|
192
413
|
};
|
|
193
414
|
}
|
|
415
|
+
if (payload.configFiles !== undefined)
|
|
416
|
+
body['config_files'] = payload.configFiles;
|
|
417
|
+
if (payload.configStartup !== undefined)
|
|
418
|
+
body['config_startup'] = configStartupBody(payload.configStartup);
|
|
419
|
+
if (payload.configLogs !== undefined)
|
|
420
|
+
body['config_logs'] = payload.configLogs;
|
|
421
|
+
if (payload.fileBlacklistRegex !== undefined)
|
|
422
|
+
body['file_blacklist_regex'] = payload.fileBlacklistRegex;
|
|
194
423
|
const data = await this.http.patch(`/eggs/${id}`, body);
|
|
195
424
|
const egg = new Egg(data);
|
|
196
425
|
this.upsertCache(egg);
|
|
@@ -207,5 +436,17 @@ class EggsNamespace extends namespace_js_1.ResourceNamespace {
|
|
|
207
436
|
this.removeFromCache(id);
|
|
208
437
|
this.emit('deleted', id);
|
|
209
438
|
}
|
|
439
|
+
/** Manage a specific egg's variables. */
|
|
440
|
+
variables(eggId) {
|
|
441
|
+
return new EggVariablesManager(eggId, this.http);
|
|
442
|
+
}
|
|
443
|
+
/** Manage a specific egg's images. */
|
|
444
|
+
images(eggId) {
|
|
445
|
+
return new EggImagesManager(eggId, this.http);
|
|
446
|
+
}
|
|
447
|
+
/** Manage a specific egg's feature grants. */
|
|
448
|
+
features(eggId) {
|
|
449
|
+
return new EggFeaturesManager(eggId, this.http);
|
|
450
|
+
}
|
|
210
451
|
}
|
|
211
452
|
exports.EggsNamespace = EggsNamespace;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
/** The variant options a feature offers. */
|
|
3
|
+
export interface FeatureVariants {
|
|
4
|
+
/** The allowed variant values. */
|
|
5
|
+
options: string[];
|
|
6
|
+
/** The default variant. */
|
|
7
|
+
default: string;
|
|
8
|
+
}
|
|
9
|
+
/** A code-defined feature in the catalog. */
|
|
10
|
+
export interface FeatureCatalogEntry {
|
|
11
|
+
/** The feature key, e.g. `"minecraft.players"`. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The feature's settings and their default values, keyed by setting name. */
|
|
14
|
+
settings: Record<string, unknown>;
|
|
15
|
+
/** The variant options, or `null` when the feature has none. */
|
|
16
|
+
variants: FeatureVariants | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The code-defined feature catalog.
|
|
20
|
+
*
|
|
21
|
+
* Access via `api.features`. Per-server feature state is managed via `server.features`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts ignore
|
|
25
|
+
* const catalog = await api.features.list();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class FeaturesResource {
|
|
29
|
+
private readonly http;
|
|
30
|
+
/** @internal */
|
|
31
|
+
constructor(http: HttpClient);
|
|
32
|
+
/** List the available features and their defaults. */
|
|
33
|
+
list(): Promise<FeatureCatalogEntry[]>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../src/src/resources/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC/B,kCAAkC;IAClC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IACnC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,gEAAgE;IAChE,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,gBAAgB;IAET,OAAO,CAAC,QAAQ,CAAC,IAAI;IADxC,gBAAgB;gBACoB,IAAI,EAAE,UAAU;IAEpD,sDAAsD;IAC/C,IAAI,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAG7C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeaturesResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The code-defined feature catalog.
|
|
6
|
+
*
|
|
7
|
+
* Access via `api.features`. Per-server feature state is managed via `server.features`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts ignore
|
|
11
|
+
* const catalog = await api.features.list();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
class FeaturesResource {
|
|
15
|
+
http;
|
|
16
|
+
/** @internal */
|
|
17
|
+
constructor(http) {
|
|
18
|
+
this.http = http;
|
|
19
|
+
}
|
|
20
|
+
/** List the available features and their defaults. */
|
|
21
|
+
list() {
|
|
22
|
+
return this.http.get('/features');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.FeaturesResource = FeaturesResource;
|
|
@@ -1,48 +1,146 @@
|
|
|
1
1
|
import type { HttpClient } from '../http.js';
|
|
2
2
|
import { ResourceNamespace } from '../namespace.js';
|
|
3
3
|
import { ReactiveResource } from '../reactive.js';
|
|
4
|
+
import type { IncludeOptions, ResourceColor, ResourceWith } from '../types.js';
|
|
4
5
|
import { type ISODate, type NanoID, type Paginated } from '../types.js';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
6
|
+
import type { UserData } from './users.js';
|
|
7
|
+
import { User } from './users.js';
|
|
8
|
+
import { type ActivityFeedOptions, type ActivityLog } from './servers/activity.js';
|
|
7
9
|
/** Raw API shape for a physical host. @internal */
|
|
8
10
|
export interface HostData {
|
|
9
11
|
id: string;
|
|
10
12
|
hostname: string;
|
|
11
|
-
name
|
|
12
|
-
color
|
|
13
|
+
name: string;
|
|
14
|
+
color: ResourceColor | null;
|
|
13
15
|
owner_id: string;
|
|
14
|
-
owner?:
|
|
15
|
-
notes
|
|
16
|
+
owner?: UserData;
|
|
17
|
+
notes: string | null;
|
|
16
18
|
created_at: ISODate;
|
|
17
19
|
updated_at: ISODate;
|
|
20
|
+
deleted_at: ISODate | null;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* A physical host machine on which nodes are deployed.
|
|
21
24
|
*
|
|
22
|
-
* Retrieved via {@link HostsNamespace.list}.
|
|
25
|
+
* Retrieved via {@link HostsNamespace.list} or {@link HostsNamespace.get}.
|
|
23
26
|
*/
|
|
24
27
|
export declare class Host extends ReactiveResource {
|
|
25
28
|
/** The host's unique NanoID. */
|
|
26
29
|
readonly id: NanoID;
|
|
27
30
|
/** The host's hostname, e.g. `"host.example.com"`. */
|
|
28
31
|
hostname: string;
|
|
29
|
-
/**
|
|
30
|
-
name: string
|
|
31
|
-
/**
|
|
32
|
-
color:
|
|
33
|
-
/** The owner's NanoID. Always present. */
|
|
32
|
+
/** Display name for the host. */
|
|
33
|
+
name: string;
|
|
34
|
+
/** Color used in the UI for grouping, or `null`. */
|
|
35
|
+
color: ResourceColor | null;
|
|
36
|
+
/** The owner's bare NanoID (parsed from the namespaced `owner_id`). Always present. */
|
|
34
37
|
readonly ownerId: NanoID;
|
|
38
|
+
/** The owner's issuer type, e.g. `'user'` or `'system'`. */
|
|
39
|
+
readonly ownerType: string;
|
|
35
40
|
/** The full owner object. Requires `?include=owner`. */
|
|
36
|
-
owner:
|
|
41
|
+
owner: User | undefined;
|
|
37
42
|
/** Internal notes. */
|
|
38
|
-
notes: string | null
|
|
43
|
+
notes: string | null;
|
|
39
44
|
/** When this host was registered. */
|
|
40
45
|
createdAt: Date;
|
|
41
46
|
/** When this host was last updated. */
|
|
42
47
|
updatedAt: Date;
|
|
48
|
+
/** When this host was soft-deleted, or `null` if active. */
|
|
49
|
+
deletedAt: Date | null;
|
|
43
50
|
/** @internal */
|
|
44
51
|
constructor(data: HostData);
|
|
45
52
|
}
|
|
53
|
+
/** Fields accepted when creating a host. */
|
|
54
|
+
export interface CreateHostPayload {
|
|
55
|
+
name: string;
|
|
56
|
+
hostname: string;
|
|
57
|
+
color?: ResourceColor;
|
|
58
|
+
notes?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Fields accepted when updating a host. All optional. */
|
|
61
|
+
export interface UpdateHostPayload {
|
|
62
|
+
name?: string;
|
|
63
|
+
hostname?: string;
|
|
64
|
+
color?: ResourceColor;
|
|
65
|
+
notes?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Valid include keys for host endpoints. */
|
|
68
|
+
export type HostInclude = 'owner';
|
|
69
|
+
/** Maps each {@link HostInclude} key to the field(s) it guarantees on the {@link Host} instance. */
|
|
70
|
+
interface HostIncludeMap {
|
|
71
|
+
owner: {
|
|
72
|
+
owner: User;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** A {@link Host} with specific include fields guaranteed to be populated. */
|
|
76
|
+
export type HostWith<I extends readonly HostInclude[] = []> = ResourceWith<Host, HostIncludeMap, I>;
|
|
77
|
+
/** Typed events emitted by {@link HostsNamespace}. */
|
|
78
|
+
export interface HostEvents {
|
|
79
|
+
created: Host;
|
|
80
|
+
updated: Host;
|
|
81
|
+
deleted: NanoID;
|
|
82
|
+
}
|
|
83
|
+
/** A host's WHMCS billing configuration. Credentials are never returned. */
|
|
84
|
+
export interface WhmcsBillingConfig {
|
|
85
|
+
/** The WHMCS base URL. */
|
|
86
|
+
baseUrl: string;
|
|
87
|
+
/** Whether billing is enabled for this host. */
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
/** Whether a Basic-Auth header is configured. The value itself is never returned. */
|
|
90
|
+
basicAuthSet: boolean;
|
|
91
|
+
/** When the config was created. */
|
|
92
|
+
createdAt: Date;
|
|
93
|
+
/** When the config was last updated. */
|
|
94
|
+
updatedAt: Date;
|
|
95
|
+
}
|
|
96
|
+
/** Fields accepted when saving a host's WHMCS billing config. */
|
|
97
|
+
export interface SaveWhmcsBillingPayload {
|
|
98
|
+
/** The WHMCS base URL (http or https). Required on first configuration. */
|
|
99
|
+
baseUrl?: string;
|
|
100
|
+
/** WHMCS API identifier (write-only). Required on first configuration. */
|
|
101
|
+
apiIdentifier?: string;
|
|
102
|
+
/** WHMCS API secret (write-only). Required on first configuration. */
|
|
103
|
+
apiSecret?: string;
|
|
104
|
+
/** Basic-Auth header value. `null` clears it; omit to leave unchanged. */
|
|
105
|
+
basicAuthBase64?: string | null;
|
|
106
|
+
/** Enable or disable billing for this host. */
|
|
107
|
+
enabled?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Manages a host's billing provider configuration.
|
|
111
|
+
*
|
|
112
|
+
* Access via `api.hosts.billing(hostId)`.
|
|
113
|
+
*/
|
|
114
|
+
export declare class HostBillingManager {
|
|
115
|
+
private readonly hostId;
|
|
116
|
+
private readonly http;
|
|
117
|
+
/** @internal */
|
|
118
|
+
constructor(hostId: NanoID, http: HttpClient);
|
|
119
|
+
/** Fetch all configured billing providers for this host. */
|
|
120
|
+
providers(): Promise<{
|
|
121
|
+
whmcs: WhmcsBillingConfig | null;
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Fetch this host's WHMCS billing config.
|
|
125
|
+
*
|
|
126
|
+
* @throws {@link ApiError} with `isNotFound === true` if billing is not configured.
|
|
127
|
+
*/
|
|
128
|
+
getWhmcs(): Promise<WhmcsBillingConfig>;
|
|
129
|
+
/**
|
|
130
|
+
* Save this host's WHMCS billing config. Does not call WHMCS; use {@link testWhmcs} to verify.
|
|
131
|
+
*
|
|
132
|
+
* First-time configuration requires `baseUrl`, `apiIdentifier`, and `apiSecret`.
|
|
133
|
+
*/
|
|
134
|
+
saveWhmcs(payload: SaveWhmcsBillingPayload): Promise<WhmcsBillingConfig>;
|
|
135
|
+
/**
|
|
136
|
+
* Verify the stored WHMCS credentials against the live WHMCS API.
|
|
137
|
+
*
|
|
138
|
+
* @throws {@link ApiError} if billing is not configured (404) or WHMCS rejects the credentials (502).
|
|
139
|
+
*/
|
|
140
|
+
testWhmcs(): Promise<void>;
|
|
141
|
+
/** Remove this host's WHMCS billing config. */
|
|
142
|
+
deleteWhmcs(): Promise<void>;
|
|
143
|
+
}
|
|
46
144
|
/**
|
|
47
145
|
* Namespace for host management.
|
|
48
146
|
*
|
|
@@ -51,20 +149,47 @@ export declare class Host extends ReactiveResource {
|
|
|
51
149
|
* @example
|
|
52
150
|
* ```ts ignore
|
|
53
151
|
* const hosts = await api.hosts.list();
|
|
152
|
+
* const host = await api.hosts.create({ name: 'DC1', hostname: 'host.example.com' });
|
|
54
153
|
* ```
|
|
55
154
|
*/
|
|
56
|
-
export declare class HostsNamespace extends ResourceNamespace<Host> {
|
|
155
|
+
export declare class HostsNamespace extends ResourceNamespace<Host, HostEvents> {
|
|
57
156
|
/** @internal */
|
|
58
157
|
constructor(http: HttpClient);
|
|
59
158
|
/**
|
|
60
159
|
* Fetch a paginated list of physical hosts.
|
|
61
160
|
*
|
|
62
|
-
* @param opts Pagination and
|
|
161
|
+
* @param opts Pagination, search, and include options. Set `includeDeleted` to also return soft-deleted hosts.
|
|
63
162
|
*/
|
|
64
|
-
list(opts?: {
|
|
163
|
+
list<const I extends readonly HostInclude[] = []>(opts?: {
|
|
65
164
|
page?: number;
|
|
66
165
|
perPage?: number;
|
|
67
166
|
search?: string;
|
|
68
|
-
|
|
167
|
+
includeDeleted?: boolean;
|
|
168
|
+
} & IncludeOptions<HostInclude, I>): Promise<Paginated<HostWith<I>>>;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch a single host by ID.
|
|
171
|
+
*
|
|
172
|
+
* @param id The host's NanoID.
|
|
173
|
+
* @param opts Include options. Set `includeDeleted` to return a soft-deleted host.
|
|
174
|
+
*/
|
|
175
|
+
get<const I extends readonly HostInclude[] = []>(id: NanoID, opts?: IncludeOptions<HostInclude, I> & {
|
|
176
|
+
includeDeleted?: boolean;
|
|
177
|
+
}): Promise<HostWith<I>>;
|
|
178
|
+
/** Create a new host. The caller becomes its owner. */
|
|
179
|
+
create(payload: CreateHostPayload): Promise<Host>;
|
|
180
|
+
/** Update a host's name, hostname, color, or notes. */
|
|
181
|
+
update(id: NanoID, payload: UpdateHostPayload): Promise<Host>;
|
|
182
|
+
/** Soft-delete a host. Fails if it still owns nodes, locations, types, or nests. */
|
|
183
|
+
delete(id: NanoID): Promise<void>;
|
|
184
|
+
/** Manage a host's billing provider configuration. */
|
|
185
|
+
billing(hostId: NanoID): HostBillingManager;
|
|
186
|
+
/**
|
|
187
|
+
* Fetch a host's activity feed (activity on the host and its servers, groups, and nodes).
|
|
188
|
+
*
|
|
189
|
+
* @param hostId The host's NanoID.
|
|
190
|
+
* @param opts Pagination and filter options.
|
|
191
|
+
*/
|
|
192
|
+
activities(hostId: NanoID, opts?: ActivityFeedOptions): Promise<Paginated<ActivityLog>>;
|
|
69
193
|
}
|
|
194
|
+
export {};
|
|
70
195
|
//# sourceMappingURL=hosts.d.ts.map
|