dsh-home-hosted 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +12 -4
- package/lib/index.js.map +2 -2
- package/lib/types/home-hosted/panel.d.ts +5 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -3557,6 +3557,14 @@ var PanelClient = class {
|
|
|
3557
3557
|
* workspace, so `?workspace=` is what selects which one is meant; omitting it
|
|
3558
3558
|
* on a panel that predates workspaces changes nothing.
|
|
3559
3559
|
*/
|
|
3560
|
+
/**
|
|
3561
|
+
* The panel names a server's workspace `workspaceId`; the plugin's view calls it
|
|
3562
|
+
* `workspace`. One mapping, so a caller never has to know both spellings.
|
|
3563
|
+
*/
|
|
3564
|
+
view(raw, workspace) {
|
|
3565
|
+
const { workspaceId, ...rest } = raw;
|
|
3566
|
+
return { ...rest, workspace: workspaceId ?? workspace ?? this.workspace ?? "" };
|
|
3567
|
+
}
|
|
3560
3568
|
ws(path17, workspace) {
|
|
3561
3569
|
const id = workspace ?? this.workspace;
|
|
3562
3570
|
if (id === null || id === void 0 || id.length === 0)
|
|
@@ -3598,19 +3606,19 @@ var PanelClient = class {
|
|
|
3598
3606
|
}
|
|
3599
3607
|
async listServers(workspace) {
|
|
3600
3608
|
const answer2 = await this.request("GET", this.ws("/api/servers", workspace));
|
|
3601
|
-
return answer2.servers;
|
|
3609
|
+
return answer2.servers.map((server) => this.view(server, workspace));
|
|
3602
3610
|
}
|
|
3603
3611
|
async getServer(id, workspace) {
|
|
3604
3612
|
const answer2 = await this.request("GET", this.ws(`/api/servers/${encodeURIComponent(id)}`, workspace));
|
|
3605
|
-
return answer2.server;
|
|
3613
|
+
return this.view(answer2.server, workspace);
|
|
3606
3614
|
}
|
|
3607
3615
|
async createServer(entry, workspace) {
|
|
3608
3616
|
const answer2 = await this.request("POST", this.ws("/api/servers", workspace), entry);
|
|
3609
|
-
return answer2.server;
|
|
3617
|
+
return this.view(answer2.server, workspace);
|
|
3610
3618
|
}
|
|
3611
3619
|
async updateServer(id, patch, workspace) {
|
|
3612
3620
|
const answer2 = await this.request("PATCH", this.ws(`/api/servers/${encodeURIComponent(id)}`, workspace), patch);
|
|
3613
|
-
return answer2.server;
|
|
3621
|
+
return this.view(answer2.server, workspace);
|
|
3614
3622
|
}
|
|
3615
3623
|
async deleteServer(id, workspace) {
|
|
3616
3624
|
await this.request("DELETE", this.ws(`/api/servers/${encodeURIComponent(id)}`, workspace));
|