@meowpanel/api 0.14.0 → 0.16.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/README.md +1 -1
- package/esm/mod.d.ts +3 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/src/client.d.ts +1 -1
- package/esm/src/client.js +1 -1
- package/esm/src/http.d.ts +11 -3
- package/esm/src/http.d.ts.map +1 -1
- package/esm/src/http.js +25 -15
- package/esm/src/resources/servers/activity.d.ts +16 -1
- package/esm/src/resources/servers/activity.d.ts.map +1 -1
- package/esm/src/resources/servers/activity.js +10 -1
- package/esm/src/resources/servers/backups.d.ts +7 -7
- package/esm/src/resources/servers/backups.d.ts.map +1 -1
- package/esm/src/resources/servers/backups.js +8 -8
- package/esm/src/resources/servers/connection.d.ts +82 -40
- package/esm/src/resources/servers/connection.d.ts.map +1 -1
- package/esm/src/resources/servers/connection.js +117 -76
- package/esm/src/resources/servers/node-client.d.ts +5 -4
- package/esm/src/resources/servers/node-client.d.ts.map +1 -1
- package/esm/src/resources/servers/node-client.js +6 -10
- package/esm/src/resources/servers/server.d.ts +1 -1
- package/esm/src/resources/servers/server.js +3 -3
- package/esm/src/resources/servers/types.d.ts +6 -1
- package/esm/src/resources/servers/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/mod.d.ts +3 -3
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -1
- package/script/src/client.d.ts +1 -1
- package/script/src/client.js +1 -1
- package/script/src/http.d.ts +11 -3
- package/script/src/http.d.ts.map +1 -1
- package/script/src/http.js +25 -15
- package/script/src/resources/servers/activity.d.ts +16 -1
- package/script/src/resources/servers/activity.d.ts.map +1 -1
- package/script/src/resources/servers/activity.js +9 -0
- package/script/src/resources/servers/backups.d.ts +7 -7
- package/script/src/resources/servers/backups.d.ts.map +1 -1
- package/script/src/resources/servers/backups.js +8 -8
- package/script/src/resources/servers/connection.d.ts +82 -40
- package/script/src/resources/servers/connection.d.ts.map +1 -1
- package/script/src/resources/servers/connection.js +117 -76
- package/script/src/resources/servers/node-client.d.ts +5 -4
- package/script/src/resources/servers/node-client.d.ts.map +1 -1
- package/script/src/resources/servers/node-client.js +6 -10
- package/script/src/resources/servers/server.d.ts +1 -1
- package/script/src/resources/servers/server.js +3 -3
- package/script/src/resources/servers/types.d.ts +6 -1
- package/script/src/resources/servers/types.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ await server.files.write("/motd.txt", "Hello World");
|
|
|
26
26
|
|
|
27
27
|
// Real-time console via SSE
|
|
28
28
|
const conn = await server.createConnection();
|
|
29
|
-
conn.on("
|
|
29
|
+
conn.on("console_entry", (entry) => console.log(entry.text));
|
|
30
30
|
conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
31
31
|
await conn.open();
|
|
32
32
|
```
|
package/esm/mod.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* // Real-time console via SSE
|
|
29
29
|
* const conn = await server.createConnection();
|
|
30
|
-
* conn.on("
|
|
30
|
+
* conn.on("console_entry", (entry) => console.log(entry.text));
|
|
31
31
|
* conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
32
32
|
* await conn.open();
|
|
33
33
|
* ```
|
|
@@ -87,7 +87,7 @@ export type { CreateServerPayload, ServerEvents, ServerInclude, ServerWith, Upda
|
|
|
87
87
|
export { Server } from './src/resources/servers/server.js';
|
|
88
88
|
export type { ServerBuild, ServerStatsHistory, ServerStatus } from './src/resources/servers/server.js';
|
|
89
89
|
export { ServerConnection } from './src/resources/servers/connection.js';
|
|
90
|
-
export type { BackupCompletedEvent, JobLogEvent, JobProgressEvent, ServerConnectionEvents, ServerUtilization, } from './src/resources/servers/connection.js';
|
|
90
|
+
export type { BackupCompletedEvent, ConsoleEntry, ConsoleEntryKind, JobLogEvent, JobProgressEvent, ServerConnectionEvents, ServerUtilization, TransferStatus, } from './src/resources/servers/connection.js';
|
|
91
91
|
export { FileEntry, ServerFilesManager } from './src/resources/servers/files.js';
|
|
92
92
|
export { ServerBackupsManager } from './src/resources/servers/backups.js';
|
|
93
93
|
export type { BackupAdapter, CreateBackupOptions, RestoreBackupOptions } from './src/resources/servers/backups.js';
|
|
@@ -105,5 +105,5 @@ export type { EffectiveFeature, FeatureSetting, FeatureSettingSource, FeatureSou
|
|
|
105
105
|
export { ServerUser, ServerUserManager } from './src/resources/servers/sub-users.js';
|
|
106
106
|
export type { AddServerUserInput, ServerUserGrant, ServerUserKind } from './src/resources/servers/sub-users.js';
|
|
107
107
|
export { ActivityJob, ActivityJobLog, ActivityLog, ServerActivityManager } from './src/resources/servers/activity.js';
|
|
108
|
-
export type { ActivityFeedOptions, ActivityJobLogSource, ServerActivityFeedOptions, } from './src/resources/servers/activity.js';
|
|
108
|
+
export type { ActivityFeedOptions, ActivityInclude, ActivityJobLogSource, ServerActivityFeedOptions, } from './src/resources/servers/activity.js';
|
|
109
109
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EACX,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,WAAW,EACX,aAAa,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,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AG7C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACrF,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGhH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACtH,YAAY,EACX,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,GACzB,MAAM,qCAAqC,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* // Real-time console via SSE
|
|
29
29
|
* const conn = await server.createConnection();
|
|
30
|
-
* conn.on("
|
|
30
|
+
* conn.on("console_entry", (entry) => console.log(entry.text));
|
|
31
31
|
* conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
32
32
|
* await conn.open();
|
|
33
33
|
* ```
|
package/esm/src/client.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export declare class MeowPanelApi {
|
|
|
202
202
|
*
|
|
203
203
|
* // Real-time events
|
|
204
204
|
* const conn = await server.createConnection();
|
|
205
|
-
* conn.on('
|
|
205
|
+
* conn.on('console_entry', (entry) => console.log(entry.text));
|
|
206
206
|
* conn.on('stats', (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
207
207
|
* await conn.open();
|
|
208
208
|
* ```
|
package/esm/src/client.js
CHANGED
|
@@ -177,7 +177,7 @@ export class MeowPanelApi {
|
|
|
177
177
|
*
|
|
178
178
|
* // Real-time events
|
|
179
179
|
* const conn = await server.createConnection();
|
|
180
|
-
* conn.on('
|
|
180
|
+
* conn.on('console_entry', (entry) => console.log(entry.text));
|
|
181
181
|
* conn.on('stats', (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
182
182
|
* await conn.open();
|
|
183
183
|
* ```
|
package/esm/src/http.d.ts
CHANGED
|
@@ -81,6 +81,13 @@ export declare class HttpClient {
|
|
|
81
81
|
* @param params Query parameters to append.
|
|
82
82
|
*/
|
|
83
83
|
fetch(path: string, init?: RequestInit, params?: Record<string, string | number | boolean | undefined>): Promise<Response>;
|
|
84
|
+
/**
|
|
85
|
+
* Send a request to a URL outside the API, such as a node daemon, through the configured
|
|
86
|
+
* `fetch` with the current bearer token. Non-2xx responses are returned, not thrown.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
fetchUrl(url: string, init?: RequestInit): Promise<Response>;
|
|
84
91
|
/**
|
|
85
92
|
* GET and deserialize a JSON response body.
|
|
86
93
|
*
|
|
@@ -89,7 +96,8 @@ export declare class HttpClient {
|
|
|
89
96
|
*/
|
|
90
97
|
get<T>(path: string, opts?: RequestOptions): Promise<T>;
|
|
91
98
|
/**
|
|
92
|
-
* POST with an optional JSON body. Returns `undefined` for
|
|
99
|
+
* POST with an optional JSON body. Returns `undefined` for a response without a body, such as
|
|
100
|
+
* `204 No Content` or a bare `202 Accepted`.
|
|
93
101
|
*
|
|
94
102
|
* @param path Path relative to the API base URL.
|
|
95
103
|
* @param body Request body, serialized as JSON.
|
|
@@ -97,7 +105,7 @@ export declare class HttpClient {
|
|
|
97
105
|
*/
|
|
98
106
|
post<T = void>(path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
|
|
99
107
|
/**
|
|
100
|
-
* PATCH with an optional JSON body. Returns `undefined` for
|
|
108
|
+
* PATCH with an optional JSON body. Returns `undefined` for a response without a body.
|
|
101
109
|
*
|
|
102
110
|
* @param path Path relative to the API base URL.
|
|
103
111
|
* @param body Partial update body, serialized as JSON.
|
|
@@ -105,7 +113,7 @@ export declare class HttpClient {
|
|
|
105
113
|
*/
|
|
106
114
|
patch<T = void>(path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
|
|
107
115
|
/**
|
|
108
|
-
* DELETE a resource. Returns `undefined` for
|
|
116
|
+
* DELETE a resource. Returns `undefined` for a response without a body, otherwise the parsed body.
|
|
109
117
|
*
|
|
110
118
|
* @param path Path relative to the API base URL.
|
|
111
119
|
* @param opts Additional request options.
|
package/esm/src/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IACjC,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEhF,wDAAwD;AACxD,UAAU,gBAAgB;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC/D;AAED,oDAAoD;AACpD,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IACjE,IAAI,EAAE,eAAe,CAAC;CACtB;AAED,uDAAuD;AACvD,MAAM,WAAW,0BAA2B,SAAQ,gBAAgB;IACnE,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,sEAAsE;AACtE,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IACjE,IAAI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,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAYpH;;;;;;;OAOG;IACU,IAAI,CAAC,CAAC,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAgB,EACtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GACjE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAwBxB"}
|
package/esm/src/http.js
CHANGED
|
@@ -148,6 +148,18 @@ export class HttpClient {
|
|
|
148
148
|
headers: { ...this.defaultHeaders, ...init.headers },
|
|
149
149
|
}, params);
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Send a request to a URL outside the API, such as a node daemon, through the configured
|
|
153
|
+
* `fetch` with the current bearer token. Non-2xx responses are returned, not thrown.
|
|
154
|
+
*
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
fetchUrl(url, init = {}) {
|
|
158
|
+
const headers = new Headers(init.headers);
|
|
159
|
+
if (this.token)
|
|
160
|
+
headers.set('Authorization', `Bearer ${this.token}`);
|
|
161
|
+
return this.fetchImpl(url, { ...init, headers });
|
|
162
|
+
}
|
|
151
163
|
/**
|
|
152
164
|
* GET and deserialize a JSON response body.
|
|
153
165
|
*
|
|
@@ -159,7 +171,8 @@ export class HttpClient {
|
|
|
159
171
|
return res.json();
|
|
160
172
|
}
|
|
161
173
|
/**
|
|
162
|
-
* POST with an optional JSON body. Returns `undefined` for
|
|
174
|
+
* POST with an optional JSON body. Returns `undefined` for a response without a body, such as
|
|
175
|
+
* `204 No Content` or a bare `202 Accepted`.
|
|
163
176
|
*
|
|
164
177
|
* @param path Path relative to the API base URL.
|
|
165
178
|
* @param body Request body, serialized as JSON.
|
|
@@ -167,12 +180,10 @@ export class HttpClient {
|
|
|
167
180
|
*/
|
|
168
181
|
async post(path, body, opts = {}) {
|
|
169
182
|
const res = await this.fetch(path, { method: 'POST', body: body !== undefined ? JSON.stringify(body) : undefined, signal: opts.signal }, opts.params);
|
|
170
|
-
|
|
171
|
-
return undefined;
|
|
172
|
-
return res.json();
|
|
183
|
+
return readBody(res);
|
|
173
184
|
}
|
|
174
185
|
/**
|
|
175
|
-
* PATCH with an optional JSON body. Returns `undefined` for
|
|
186
|
+
* PATCH with an optional JSON body. Returns `undefined` for a response without a body.
|
|
176
187
|
*
|
|
177
188
|
* @param path Path relative to the API base URL.
|
|
178
189
|
* @param body Partial update body, serialized as JSON.
|
|
@@ -180,21 +191,17 @@ export class HttpClient {
|
|
|
180
191
|
*/
|
|
181
192
|
async patch(path, body, opts = {}) {
|
|
182
193
|
const res = await this.fetch(path, { method: 'PATCH', body: body !== undefined ? JSON.stringify(body) : undefined, signal: opts.signal }, opts.params);
|
|
183
|
-
|
|
184
|
-
return undefined;
|
|
185
|
-
return res.json();
|
|
194
|
+
return readBody(res);
|
|
186
195
|
}
|
|
187
196
|
/**
|
|
188
|
-
* DELETE a resource. Returns `undefined` for
|
|
197
|
+
* DELETE a resource. Returns `undefined` for a response without a body, otherwise the parsed body.
|
|
189
198
|
*
|
|
190
199
|
* @param path Path relative to the API base URL.
|
|
191
200
|
* @param opts Additional request options.
|
|
192
201
|
*/
|
|
193
202
|
async delete(path, opts = {}) {
|
|
194
203
|
const res = await this.fetch(path, { method: 'DELETE', signal: opts.signal }, opts.params);
|
|
195
|
-
|
|
196
|
-
return undefined;
|
|
197
|
-
return res.json();
|
|
204
|
+
return readBody(res);
|
|
198
205
|
}
|
|
199
206
|
/**
|
|
200
207
|
* PUT raw body content (e.g. for binary or multipart uploads).
|
|
@@ -214,9 +221,7 @@ export class HttpClient {
|
|
|
214
221
|
headers,
|
|
215
222
|
signal: opts.signal,
|
|
216
223
|
}, opts.params);
|
|
217
|
-
|
|
218
|
-
return undefined;
|
|
219
|
-
return res.json();
|
|
224
|
+
return readBody(res);
|
|
220
225
|
}
|
|
221
226
|
/**
|
|
222
227
|
* GET a paginated list, parsing the `Content-Range` header for metadata when available.
|
|
@@ -251,3 +256,8 @@ export class HttpClient {
|
|
|
251
256
|
return { data: array, total, page, perPage };
|
|
252
257
|
}
|
|
253
258
|
}
|
|
259
|
+
/** The JSON body of a response, or `undefined` when it has none. */
|
|
260
|
+
async function readBody(res) {
|
|
261
|
+
const text = await res.text();
|
|
262
|
+
return (text === '' ? undefined : JSON.parse(text));
|
|
263
|
+
}
|
|
@@ -34,7 +34,7 @@ export declare class ActivityJob extends ReactiveResource {
|
|
|
34
34
|
/** The operation the job performs, e.g. `"server.install"`. */
|
|
35
35
|
readonly kind: string;
|
|
36
36
|
/** Current job status. */
|
|
37
|
-
status: 'in_progress' | 'completed' | 'failed';
|
|
37
|
+
status: 'in_progress' | 'completed' | 'failed' | 'canceled';
|
|
38
38
|
/** Completion percentage (0-100), or `null` if the job reports none. */
|
|
39
39
|
progress: number | null;
|
|
40
40
|
/** Latest status line, or `null` if the job reports none. */
|
|
@@ -67,6 +67,12 @@ export declare class ActivityJob extends ReactiveResource {
|
|
|
67
67
|
export declare class ActivityLog extends ReactiveResource {
|
|
68
68
|
/** The activity log entry's unique NanoID. */
|
|
69
69
|
readonly id: NanoID;
|
|
70
|
+
/**
|
|
71
|
+
* The id the node daemon gave an entry it reported, which a console entry points at as its
|
|
72
|
+
* `activityId`. `null` for an entry the API recorded, and `undefined` unless the request asked
|
|
73
|
+
* for the `node_entry_id` include.
|
|
74
|
+
*/
|
|
75
|
+
readonly nodeEntryId: string | null | undefined;
|
|
70
76
|
/** The event type identifier, e.g. `"server.power.start"`. */
|
|
71
77
|
event: string;
|
|
72
78
|
/** NanoID of the server this activity is associated with, if any. */
|
|
@@ -124,7 +130,16 @@ export interface ActivityFeedOptions {
|
|
|
124
130
|
nodeId?: NanoID;
|
|
125
131
|
/** Filter by host. */
|
|
126
132
|
hostId?: NanoID;
|
|
133
|
+
/** Only the entries the node daemon reported with these ids. */
|
|
134
|
+
nodeEntryIds?: readonly string[];
|
|
135
|
+
/** Related records to embed in each entry. */
|
|
136
|
+
include?: readonly ActivityInclude[];
|
|
127
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Extra data an activity entry can carry: `issuer` and `subject` fill those users, `job` the job,
|
|
140
|
+
* and `node_entry_id` the id the node daemon gave the entry.
|
|
141
|
+
*/
|
|
142
|
+
export type ActivityInclude = 'issuer' | 'subject' | 'job' | 'node_entry_id';
|
|
128
143
|
/** Query options for a single server's activity feed. */
|
|
129
144
|
export interface ServerActivityFeedOptions extends ActivityFeedOptions {
|
|
130
145
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../src/src/resources/servers/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjH;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAE5D;;GAEG;AACH,qBAAa,cAAc;IAC1B,8DAA8D;IAC9D,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,SAAgB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,uCAAuC;IACvC,SAAgB,SAAS,EAAE,IAAI,CAAC;IAEhC,gBAAgB;gBACG,IAAI,EAAE,kBAAkB;CAK3C;AAED;;;;;GAKG;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AED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,eAAe,CAAC;AAE7E,yDAAyD;AACzD,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACrE;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,mBAAwB,EAC9B,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM,GAC5C,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAiBjC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAGhC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHtB,gBAAgB;gBAEE,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU;IAGlC;;;;;OAKG;IACI,IAAI,CAAC,IAAI,GAAE,yBAA8B,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IASlF;;;;OAIG;IACU,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAK1D;;;;OAIG;IACU,QAAQ,CAAC,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAK9E;;;;OAIG;IACU,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAIxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactiveResource } from '../../reactive.js';
|
|
2
|
-
import { parseIssuerRef, toNanoID } from '../../types.js';
|
|
2
|
+
import { joinIncludes, parseIssuerRef, toNanoID } from '../../types.js';
|
|
3
3
|
import { User } from '../users.js';
|
|
4
4
|
/**
|
|
5
5
|
* A single log entry within an {@link ActivityJob}.
|
|
@@ -81,6 +81,12 @@ export class ActivityJob extends ReactiveResource {
|
|
|
81
81
|
export class ActivityLog extends ReactiveResource {
|
|
82
82
|
/** The activity log entry's unique NanoID. */
|
|
83
83
|
id;
|
|
84
|
+
/**
|
|
85
|
+
* The id the node daemon gave an entry it reported, which a console entry points at as its
|
|
86
|
+
* `activityId`. `null` for an entry the API recorded, and `undefined` unless the request asked
|
|
87
|
+
* for the `node_entry_id` include.
|
|
88
|
+
*/
|
|
89
|
+
nodeEntryId;
|
|
84
90
|
/** The event type identifier, e.g. `"server.power.start"`. */
|
|
85
91
|
event;
|
|
86
92
|
/** NanoID of the server this activity is associated with, if any. */
|
|
@@ -117,6 +123,7 @@ export class ActivityLog extends ReactiveResource {
|
|
|
117
123
|
constructor(data) {
|
|
118
124
|
super();
|
|
119
125
|
this.id = toNanoID(data.id);
|
|
126
|
+
this.nodeEntryId = data.node_entry_id;
|
|
120
127
|
this.event = data.event;
|
|
121
128
|
this.serverId = data.server_id ? toNanoID(data.server_id) : null;
|
|
122
129
|
this.nodeId = data.node_id ? toNanoID(data.node_id) : null;
|
|
@@ -154,6 +161,8 @@ export async function listActivities(http, path, opts = {}, extra = {}) {
|
|
|
154
161
|
group_id: opts.groupId,
|
|
155
162
|
node_id: opts.nodeId,
|
|
156
163
|
host_id: opts.hostId,
|
|
164
|
+
node_entry_id: opts.nodeEntryIds?.length ? opts.nodeEntryIds.join(',') : undefined,
|
|
165
|
+
include: joinIncludes(opts),
|
|
157
166
|
...extra,
|
|
158
167
|
};
|
|
159
168
|
const result = await http.list(path, { page: opts.page, perPage: opts.perPage }, params);
|
|
@@ -6,8 +6,8 @@ export type BackupAdapter = 'whisker' | 's3';
|
|
|
6
6
|
export interface CreateBackupOptions {
|
|
7
7
|
/** Storage adapter to write the backup to. */
|
|
8
8
|
adapter: BackupAdapter;
|
|
9
|
-
/** Client-chosen
|
|
10
|
-
|
|
9
|
+
/** Client-chosen 12-character nanoid identifying the backup. */
|
|
10
|
+
id: string;
|
|
11
11
|
/** Newline- or glob-separated ignore patterns. */
|
|
12
12
|
ignore?: string;
|
|
13
13
|
}
|
|
@@ -28,7 +28,7 @@ export interface RestoreBackupOptions {
|
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts ignore
|
|
31
|
-
* const job = await server.backups.create({ adapter: 'whisker',
|
|
31
|
+
* const job = await server.backups.create({ adapter: 'whisker', id });
|
|
32
32
|
* await job.wait();
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
@@ -38,9 +38,9 @@ export declare class ServerBackupsManager {
|
|
|
38
38
|
constructor(node: NodeClient);
|
|
39
39
|
/** Start a backup. Returns the job to track. */
|
|
40
40
|
create(opts: CreateBackupOptions): Promise<ServerJob>;
|
|
41
|
-
/** Restore a backup by its
|
|
42
|
-
restore(
|
|
43
|
-
/** Delete a backup by its
|
|
44
|
-
delete(
|
|
41
|
+
/** Restore a backup by its nanoid. Returns the job to track. */
|
|
42
|
+
restore(backupId: string, opts: RestoreBackupOptions): Promise<ServerJob>;
|
|
43
|
+
/** Delete a backup by its nanoid. Treats an already-missing backup as success. */
|
|
44
|
+
delete(backupId: string): Promise<void>;
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=backups.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backups.d.ts","sourceRoot":"","sources":["../../../../src/src/resources/servers/backups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;AAE7C,qCAAqC;AACrC,MAAM,WAAW,mBAAmB;IACnC,8CAA8C;IAC9C,OAAO,EAAE,aAAa,CAAC;IACvB,
|
|
1
|
+
{"version":3,"file":"backups.d.ts","sourceRoot":"","sources":["../../../../src/src/resources/servers/backups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;AAE7C,qCAAqC;AACrC,MAAM,WAAW,mBAAmB;IACnC,8CAA8C;IAC9C,OAAO,EAAE,aAAa,CAAC;IACvB,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACpC,2CAA2C;IAC3C,OAAO,EAAE,aAAa,CAAC;IACvB,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAoB;IAEb,OAAO,CAAC,QAAQ,CAAC,IAAI;IADxC,gBAAgB;gBACoB,IAAI,EAAE,UAAU;IAEpD,gDAAgD;IACnC,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IASlE,gEAAgE;IACnD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;IAStF,kFAAkF;IACrE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
|
|
@@ -7,7 +7,7 @@ import { ServerJob } from './jobs.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts ignore
|
|
10
|
-
* const job = await server.backups.create({ adapter: 'whisker',
|
|
10
|
+
* const job = await server.backups.create({ adapter: 'whisker', id });
|
|
11
11
|
* await job.wait();
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
@@ -21,23 +21,23 @@ export class ServerBackupsManager {
|
|
|
21
21
|
async create(opts) {
|
|
22
22
|
const { data } = await this.node.postJson('/backup', {
|
|
23
23
|
adapter: opts.adapter,
|
|
24
|
-
|
|
24
|
+
id: opts.id,
|
|
25
25
|
ignore: opts.ignore ?? '',
|
|
26
26
|
});
|
|
27
27
|
return new ServerJob({ id: data.job_id }, this.node);
|
|
28
28
|
}
|
|
29
|
-
/** Restore a backup by its
|
|
30
|
-
async restore(
|
|
29
|
+
/** Restore a backup by its nanoid. Returns the job to track. */
|
|
30
|
+
async restore(backupId, opts) {
|
|
31
31
|
const body = { adapter: opts.adapter };
|
|
32
32
|
if (opts.truncateDirectory !== undefined)
|
|
33
33
|
body['truncate_directory'] = opts.truncateDirectory;
|
|
34
34
|
if (opts.downloadUrl !== undefined)
|
|
35
35
|
body['download_url'] = opts.downloadUrl;
|
|
36
|
-
const { data } = await this.node.postJson(`/backup/${
|
|
36
|
+
const { data } = await this.node.postJson(`/backup/${backupId}/restore`, body);
|
|
37
37
|
return new ServerJob({ id: data.job_id }, this.node);
|
|
38
38
|
}
|
|
39
|
-
/** Delete a backup by its
|
|
40
|
-
async delete(
|
|
41
|
-
await this.node.fetch(`/backup/${
|
|
39
|
+
/** Delete a backup by its nanoid. Treats an already-missing backup as success. */
|
|
40
|
+
async delete(backupId) {
|
|
41
|
+
await this.node.fetch(`/backup/${backupId}`, { method: 'DELETE' });
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1,7 +1,47 @@
|
|
|
1
|
+
import type { HttpClient } from '../../http.js';
|
|
1
2
|
import { ReactiveResource } from '../../reactive.js';
|
|
2
3
|
import { type SseState } from '../../sse.js';
|
|
3
|
-
import type { NanoID, PowerState } from '../../types.js';
|
|
4
|
+
import type { NanoID, PowerAction, PowerState } from '../../types.js';
|
|
4
5
|
import type { JobStatus } from './jobs.js';
|
|
6
|
+
/** What a {@link ConsoleEntry} records. */
|
|
7
|
+
export type ConsoleEntryKind = 'output' | 'command' | 'power' | 'state' | 'daemon' | 'crash';
|
|
8
|
+
declare const transferStatuses: readonly ["pending", "processing", "canceling", "canceled", "failed", "completed"];
|
|
9
|
+
/** Where a server transfer stands. `canceled`, `failed` and `completed` are final. */
|
|
10
|
+
export type TransferStatus = (typeof transferStatuses)[number];
|
|
11
|
+
/**
|
|
12
|
+
* One entry of a server's console timeline: a line of output, a command someone sent, a power
|
|
13
|
+
* action, a state change, a message from the daemon, or a crash.
|
|
14
|
+
*/
|
|
15
|
+
export interface ConsoleEntry {
|
|
16
|
+
/** Orders the server's entries. Each entry's is higher than the one before it. */
|
|
17
|
+
seq: number;
|
|
18
|
+
time: Date;
|
|
19
|
+
kind: ConsoleEntryKind;
|
|
20
|
+
/** The line of output, the command sent, or the daemon's message. */
|
|
21
|
+
text?: string;
|
|
22
|
+
/** The state a `state` entry moved to. */
|
|
23
|
+
state?: PowerState;
|
|
24
|
+
/**
|
|
25
|
+
* The action of a `power` entry. A power action is recorded twice: as it starts, with the
|
|
26
|
+
* `running` status, and as it ends.
|
|
27
|
+
*/
|
|
28
|
+
action?: PowerAction;
|
|
29
|
+
status?: JobStatus;
|
|
30
|
+
/** Why a `failed` power action failed. */
|
|
31
|
+
error?: string;
|
|
32
|
+
/** The power action's job, on its `power` entries and on the `daemon` messages it printed. */
|
|
33
|
+
jobId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The auth issuer id of whoever sent a command or power action, as in {@link ServerConnection.viewerIssuerId}.
|
|
36
|
+
* Missing when the daemon acted on its own.
|
|
37
|
+
*/
|
|
38
|
+
issuerId?: string;
|
|
39
|
+
/** The `nodeEntryId` of the activity entry a command or power action produced. */
|
|
40
|
+
activityId?: string;
|
|
41
|
+
/** How a crashed process ended. */
|
|
42
|
+
exitCode?: number;
|
|
43
|
+
outOfMemory?: boolean;
|
|
44
|
+
}
|
|
5
45
|
/** Real-time resource utilization reported by the node. */
|
|
6
46
|
export interface ServerUtilization {
|
|
7
47
|
/** CPU usage as an absolute percentage (0–100+). */
|
|
@@ -39,7 +79,7 @@ export interface JobLogEvent {
|
|
|
39
79
|
/** Payload for the `backup_completed` event. */
|
|
40
80
|
export interface BackupCompletedEvent {
|
|
41
81
|
/** The completed backup's id. */
|
|
42
|
-
|
|
82
|
+
id: string;
|
|
43
83
|
isSuccessful: boolean;
|
|
44
84
|
checksum: string;
|
|
45
85
|
checksumType: string;
|
|
@@ -47,8 +87,8 @@ export interface BackupCompletedEvent {
|
|
|
47
87
|
}
|
|
48
88
|
/** Typed events emitted by {@link ServerConnection}. */
|
|
49
89
|
export interface ServerConnectionEvents {
|
|
50
|
-
/** A
|
|
51
|
-
|
|
90
|
+
/** A new entry in the server's console timeline. */
|
|
91
|
+
console_entry: ConsoleEntry;
|
|
52
92
|
/** The server's power state changed. */
|
|
53
93
|
status: PowerState;
|
|
54
94
|
/** New resource utilization stats are available. */
|
|
@@ -66,19 +106,14 @@ export interface ServerConnectionEvents {
|
|
|
66
106
|
install_started: '';
|
|
67
107
|
/** Installation finished. */
|
|
68
108
|
install_completed: '';
|
|
69
|
-
/**
|
|
70
|
-
* A line of installation output.
|
|
71
|
-
* Gated on `server.install.log`, so it never arrives for a viewer who lacks it.
|
|
72
|
-
*/
|
|
73
|
-
install_output: string;
|
|
74
109
|
/** An out-of-band status message from the daemon. */
|
|
75
110
|
daemon_message: string;
|
|
76
|
-
/** A backup finished; the payload's `
|
|
111
|
+
/** A backup finished; the payload's `id` identifies which one. */
|
|
77
112
|
backup_completed: BackupCompletedEvent;
|
|
78
113
|
/** A backup restore finished. */
|
|
79
114
|
backup_restore_completed: '';
|
|
80
|
-
/** The transfer status changed.
|
|
81
|
-
transfer_status:
|
|
115
|
+
/** The transfer status changed. */
|
|
116
|
+
transfer_status: TransferStatus;
|
|
82
117
|
/**
|
|
83
118
|
* A line of transfer output.
|
|
84
119
|
* Gated on `server.transfer.log`, so it never arrives for a viewer who lacks it.
|
|
@@ -90,13 +125,14 @@ export interface ServerConnectionEvents {
|
|
|
90
125
|
/**
|
|
91
126
|
* A real-time SSE connection to a specific server on its Whisker node daemon.
|
|
92
127
|
*
|
|
93
|
-
* Emits typed events for console
|
|
94
|
-
* Also
|
|
95
|
-
*
|
|
128
|
+
* Emits typed events for the console timeline, power state changes, and resource utilization.
|
|
129
|
+
* Also keeps the console timeline in {@link entries}, starting with the history the node holds,
|
|
130
|
+
* fetched on {@link open}.
|
|
96
131
|
*
|
|
97
132
|
* The stream reconnects on its own after the daemon restarts or the network drops. Track it
|
|
98
|
-
* through {@link state} or the `connection_state` event. After a reconnect,
|
|
99
|
-
*
|
|
133
|
+
* through {@link state} or the `connection_state` event. After a reconnect, or when the daemon
|
|
134
|
+
* dropped entries for a viewer that fell behind, the missing entries are fetched and appended to
|
|
135
|
+
* {@link entries} in order, and emitted as `console_entry`.
|
|
100
136
|
*
|
|
101
137
|
* Obtain a connection via `Server.createConnection`.
|
|
102
138
|
*
|
|
@@ -109,8 +145,8 @@ export interface ServerConnectionEvents {
|
|
|
109
145
|
*
|
|
110
146
|
* await conn.open();
|
|
111
147
|
*
|
|
112
|
-
* // Reactive: $conn.
|
|
113
|
-
* // Live
|
|
148
|
+
* // Reactive: $conn.entries is the console timeline
|
|
149
|
+
* // Live entries are appended automatically as they arrive over SSE
|
|
114
150
|
*
|
|
115
151
|
* // Later...
|
|
116
152
|
* conn.close();
|
|
@@ -119,11 +155,9 @@ export interface ServerConnectionEvents {
|
|
|
119
155
|
export declare class ServerConnection extends ReactiveResource {
|
|
120
156
|
private readonly serverId;
|
|
121
157
|
private readonly nodeUrl;
|
|
122
|
-
private readonly
|
|
123
|
-
/**
|
|
124
|
-
private static readonly
|
|
125
|
-
/** Console history lines fetched from the node on open and after each reconnect. */
|
|
126
|
-
private static readonly historyLines;
|
|
158
|
+
private readonly http;
|
|
159
|
+
/** How many entries {@link ServerConnection.entries} keeps, the size of the daemon's timeline. */
|
|
160
|
+
private static readonly maxEntries;
|
|
127
161
|
/**
|
|
128
162
|
* Whisker sends a keepalive every 20 seconds, so a stream silent for this long is dead even
|
|
129
163
|
* if the socket never closed.
|
|
@@ -131,28 +165,32 @@ export declare class ServerConnection extends ReactiveResource {
|
|
|
131
165
|
private static readonly idleTimeoutMs;
|
|
132
166
|
private readonly listeners;
|
|
133
167
|
private sse?;
|
|
134
|
-
/** Live
|
|
135
|
-
private
|
|
168
|
+
/** Live entries held back while the post-reconnect history is merged in. */
|
|
169
|
+
private pendingEntries?;
|
|
136
170
|
/**
|
|
137
|
-
*
|
|
171
|
+
* The console timeline, oldest first, capped at the daemon's timeline size.
|
|
138
172
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
173
|
+
* Starts with the history the node holds when {@link open} is called, then grows as
|
|
174
|
+
* `console_entry` events arrive.
|
|
141
175
|
*
|
|
142
|
-
* Use as a reactive store: `$conn.
|
|
176
|
+
* Use as a reactive store: `$conn.entries`.
|
|
143
177
|
*/
|
|
144
|
-
|
|
178
|
+
entries: ConsoleEntry[];
|
|
145
179
|
/** @internal */
|
|
146
|
-
constructor(serverId: NanoID, nodeUrl: string,
|
|
180
|
+
constructor(serverId: NanoID, nodeUrl: string, http: HttpClient);
|
|
147
181
|
/** State of the stream to the daemon. */
|
|
148
182
|
get state(): SseState;
|
|
149
183
|
/** `true` if the SSE connection is currently open. */
|
|
150
184
|
get isConnected(): boolean;
|
|
151
185
|
/**
|
|
152
|
-
*
|
|
186
|
+
* The auth issuer id the connection's token belongs to, which is how {@link ConsoleEntry.issuerId}
|
|
187
|
+
* names the viewer. `undefined` if the token does not say.
|
|
188
|
+
*/
|
|
189
|
+
get viewerIssuerId(): string | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Fetch the console history and open the SSE stream.
|
|
153
192
|
*
|
|
154
|
-
*
|
|
155
|
-
* live events.
|
|
193
|
+
* Fills {@link entries} with the history the node holds, then begins streaming live events.
|
|
156
194
|
*
|
|
157
195
|
* Only one stream is maintained at a time.
|
|
158
196
|
*
|
|
@@ -179,15 +217,19 @@ export declare class ServerConnection extends ReactiveResource {
|
|
|
179
217
|
removeAllListeners(): void;
|
|
180
218
|
private fetchHistory;
|
|
181
219
|
/**
|
|
182
|
-
* Fill in the
|
|
220
|
+
* Fill in the entries missed while the stream was down, or that the daemon dropped, from the
|
|
221
|
+
* history. `first` is a live entry that came after the gap.
|
|
183
222
|
*
|
|
184
|
-
* Live
|
|
185
|
-
*
|
|
223
|
+
* Live entries are held back until the history arrives, so the gap comes before them. A
|
|
224
|
+
* daemon whose newest entry is older than the last one seen has lost its timeline, and its
|
|
225
|
+
* history is taken as new.
|
|
186
226
|
*/
|
|
187
|
-
private
|
|
188
|
-
private
|
|
227
|
+
private resyncEntries;
|
|
228
|
+
private get lastSeq();
|
|
229
|
+
private appendEntry;
|
|
189
230
|
private emit;
|
|
190
231
|
/** Parse and dispatch a raw SSE event to registered handlers. */
|
|
191
232
|
private dispatch;
|
|
192
233
|
}
|
|
234
|
+
export {};
|
|
193
235
|
//# sourceMappingURL=connection.d.ts.map
|