@meowpanel/api 0.1.0-alpha.10 → 1.0.0-beta.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/LICENSE +1 -1
- package/README.md +40 -0
- package/esm/mod.d.ts +87 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +85 -1
- package/esm/src/client.d.ts +233 -0
- package/esm/src/client.d.ts.map +1 -0
- package/esm/src/client.js +216 -0
- package/esm/src/emitter.d.ts +53 -0
- package/esm/src/emitter.d.ts.map +1 -0
- package/esm/src/emitter.js +55 -0
- package/esm/src/errors.d.ts +42 -0
- package/esm/src/errors.d.ts.map +1 -0
- package/esm/src/errors.js +45 -0
- package/esm/src/http.d.ts +144 -0
- package/esm/src/http.d.ts.map +1 -0
- package/esm/src/http.js +246 -0
- package/esm/src/namespace.d.ts +59 -0
- package/esm/src/namespace.d.ts.map +1 -0
- package/esm/src/namespace.js +79 -0
- package/esm/src/reactive.d.ts +29 -0
- package/esm/src/reactive.d.ts.map +1 -0
- package/esm/src/reactive.js +35 -0
- package/esm/src/resources/account.d.ts +125 -0
- package/esm/src/resources/account.d.ts.map +1 -0
- package/esm/src/resources/account.js +151 -0
- package/esm/src/resources/api-keys.d.ts +116 -0
- package/esm/src/resources/api-keys.d.ts.map +1 -0
- package/esm/src/resources/api-keys.js +105 -0
- package/esm/src/resources/auth.d.ts +39 -0
- package/esm/src/resources/auth.d.ts.map +1 -0
- package/esm/src/resources/auth.js +27 -0
- package/esm/src/resources/eggs.d.ts +238 -0
- package/esm/src/resources/eggs.d.ts.map +1 -0
- package/esm/src/resources/eggs.js +187 -0
- package/esm/src/resources/hosts.d.ts +62 -0
- package/esm/src/resources/hosts.d.ts.map +1 -0
- package/esm/src/resources/hosts.js +62 -0
- package/esm/src/resources/members.d.ts +138 -0
- package/esm/src/resources/members.d.ts.map +1 -0
- package/esm/src/resources/members.js +122 -0
- package/esm/src/resources/nodes.d.ts +397 -0
- package/esm/src/resources/nodes.d.ts.map +1 -0
- package/esm/src/resources/nodes.js +352 -0
- package/esm/src/resources/server-groups.d.ts +150 -0
- package/esm/src/resources/server-groups.d.ts.map +1 -0
- package/esm/src/resources/server-groups.js +111 -0
- package/esm/src/resources/servers/activity.d.ts +120 -0
- package/esm/src/resources/servers/activity.d.ts.map +1 -0
- package/esm/src/resources/servers/activity.js +163 -0
- package/esm/src/resources/servers/allocations.d.ts +125 -0
- package/esm/src/resources/servers/allocations.d.ts.map +1 -0
- package/esm/src/resources/servers/allocations.js +137 -0
- package/esm/src/resources/servers/connection.d.ts +108 -0
- package/esm/src/resources/servers/connection.d.ts.map +1 -0
- package/esm/src/resources/servers/connection.js +169 -0
- package/esm/src/resources/servers/files.d.ts +164 -0
- package/esm/src/resources/servers/files.d.ts.map +1 -0
- package/esm/src/resources/servers/files.js +281 -0
- package/esm/src/resources/servers/index.d.ts +126 -0
- package/esm/src/resources/servers/index.d.ts.map +1 -0
- package/esm/src/resources/servers/index.js +135 -0
- package/esm/src/resources/servers/profiles.d.ts +138 -0
- package/esm/src/resources/servers/profiles.d.ts.map +1 -0
- package/esm/src/resources/servers/profiles.js +177 -0
- package/esm/src/resources/servers/server.d.ts +136 -0
- package/esm/src/resources/servers/server.d.ts.map +1 -0
- package/esm/src/resources/servers/server.js +202 -0
- package/esm/src/resources/servers/sftp.d.ts +147 -0
- package/esm/src/resources/servers/sftp.d.ts.map +1 -0
- package/esm/src/resources/servers/sftp.js +153 -0
- package/esm/src/resources/servers/types.d.ts +199 -0
- package/esm/src/resources/servers/types.d.ts.map +1 -0
- package/esm/src/resources/servers/types.js +1 -0
- package/esm/src/sse.d.ts +51 -0
- package/esm/src/sse.d.ts.map +1 -0
- package/esm/src/sse.js +129 -0
- package/esm/src/types.d.ts +126 -0
- package/esm/src/types.d.ts.map +1 -0
- package/esm/src/types.js +21 -0
- package/package.json +4 -92
- package/script/mod.d.ts +87 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +132 -3
- package/script/src/client.d.ts +233 -0
- package/script/src/client.d.ts.map +1 -0
- package/script/src/client.js +220 -0
- package/script/src/emitter.d.ts +53 -0
- package/script/src/emitter.d.ts.map +1 -0
- package/script/src/emitter.js +59 -0
- package/script/src/errors.d.ts +42 -0
- package/script/src/errors.d.ts.map +1 -0
- package/script/src/errors.js +49 -0
- package/script/src/http.d.ts +144 -0
- package/script/src/http.d.ts.map +1 -0
- package/script/src/http.js +250 -0
- package/script/src/namespace.d.ts +59 -0
- package/script/src/namespace.d.ts.map +1 -0
- package/script/src/namespace.js +83 -0
- package/script/src/reactive.d.ts +29 -0
- package/script/src/reactive.d.ts.map +1 -0
- package/script/src/reactive.js +39 -0
- package/script/src/resources/account.d.ts +125 -0
- package/script/src/resources/account.d.ts.map +1 -0
- package/script/src/resources/account.js +158 -0
- package/script/src/resources/api-keys.d.ts +116 -0
- package/script/src/resources/api-keys.d.ts.map +1 -0
- package/script/src/resources/api-keys.js +110 -0
- package/script/src/resources/auth.d.ts +39 -0
- package/script/src/resources/auth.d.ts.map +1 -0
- package/script/src/resources/auth.js +31 -0
- package/script/src/resources/eggs.d.ts +238 -0
- package/script/src/resources/eggs.d.ts.map +1 -0
- package/script/src/resources/eggs.js +193 -0
- package/script/src/resources/hosts.d.ts +62 -0
- package/script/src/resources/hosts.d.ts.map +1 -0
- package/script/src/resources/hosts.js +67 -0
- package/script/src/resources/members.d.ts +138 -0
- package/script/src/resources/members.d.ts.map +1 -0
- package/script/src/resources/members.js +127 -0
- package/script/src/resources/nodes.d.ts +397 -0
- package/script/src/resources/nodes.d.ts.map +1 -0
- package/script/src/resources/nodes.js +362 -0
- package/script/src/resources/server-groups.d.ts +150 -0
- package/script/src/resources/server-groups.d.ts.map +1 -0
- package/script/src/resources/server-groups.js +116 -0
- package/script/src/resources/servers/activity.d.ts +120 -0
- package/script/src/resources/servers/activity.d.ts.map +1 -0
- package/script/src/resources/servers/activity.js +170 -0
- package/script/src/resources/servers/allocations.d.ts +125 -0
- package/script/src/resources/servers/allocations.d.ts.map +1 -0
- package/script/src/resources/servers/allocations.js +142 -0
- package/script/src/resources/servers/connection.d.ts +108 -0
- package/script/src/resources/servers/connection.d.ts.map +1 -0
- package/script/src/resources/servers/connection.js +173 -0
- package/script/src/resources/servers/files.d.ts +164 -0
- package/script/src/resources/servers/files.d.ts.map +1 -0
- package/script/src/resources/servers/files.js +286 -0
- package/script/src/resources/servers/index.d.ts +126 -0
- package/script/src/resources/servers/index.d.ts.map +1 -0
- package/script/src/resources/servers/index.js +139 -0
- package/script/src/resources/servers/profiles.d.ts +138 -0
- package/script/src/resources/servers/profiles.d.ts.map +1 -0
- package/script/src/resources/servers/profiles.js +182 -0
- package/script/src/resources/servers/server.d.ts +136 -0
- package/script/src/resources/servers/server.d.ts.map +1 -0
- package/script/src/resources/servers/server.js +206 -0
- package/script/src/resources/servers/sftp.d.ts +147 -0
- package/script/src/resources/servers/sftp.d.ts.map +1 -0
- package/script/src/resources/servers/sftp.js +158 -0
- package/script/src/resources/servers/types.d.ts +199 -0
- package/script/src/resources/servers/types.d.ts.map +1 -0
- package/script/src/resources/servers/types.js +2 -0
- package/script/src/sse.d.ts +51 -0
- package/script/src/sse.d.ts.map +1 -0
- package/script/src/sse.js +133 -0
- package/script/src/types.d.ts +126 -0
- package/script/src/types.d.ts.map +1 -0
- package/script/src/types.js +25 -0
- package/esm/api.d.ts +0 -76
- package/esm/api.d.ts.map +0 -1
- package/esm/api.js +0 -187
- package/esm/components/auth.d.ts +0 -15
- package/esm/components/auth.d.ts.map +0 -1
- package/esm/components/auth.js +0 -13
- package/esm/components/connection/abstract.d.ts +0 -23
- package/esm/components/connection/abstract.d.ts.map +0 -1
- package/esm/components/connection/abstract.js +0 -43
- package/esm/components/connection/sse.d.ts +0 -20
- package/esm/components/connection/sse.d.ts.map +0 -1
- package/esm/components/connection/sse.js +0 -65
- package/esm/components/egg/egg.d.ts +0 -32
- package/esm/components/egg/egg.d.ts.map +0 -1
- package/esm/components/egg/egg.js +0 -70
- package/esm/components/group.d.ts +0 -14
- package/esm/components/group.d.ts.map +0 -1
- package/esm/components/group.js +0 -33
- package/esm/components/member_2.d.ts +0 -69
- package/esm/components/member_2.d.ts.map +0 -1
- package/esm/components/member_2.js +0 -140
- package/esm/components/node.d.ts +0 -78
- package/esm/components/node.d.ts.map +0 -1
- package/esm/components/node.js +0 -342
- package/esm/components/server/activity.d.ts +0 -45
- package/esm/components/server/activity.d.ts.map +0 -1
- package/esm/components/server/activity.js +0 -158
- package/esm/components/server/allocations.d.ts +0 -45
- package/esm/components/server/allocations.d.ts.map +0 -1
- package/esm/components/server/allocations.js +0 -146
- package/esm/components/server/files.d.ts +0 -50
- package/esm/components/server/files.d.ts.map +0 -1
- package/esm/components/server/files.js +0 -90
- package/esm/components/server/power.d.ts +0 -21
- package/esm/components/server/power.d.ts.map +0 -1
- package/esm/components/server/power.js +0 -43
- package/esm/components/server/profiles.d.ts +0 -63
- package/esm/components/server/profiles.d.ts.map +0 -1
- package/esm/components/server/profiles.js +0 -163
- package/esm/components/server/server.d.ts +0 -141
- package/esm/components/server/server.d.ts.map +0 -1
- package/esm/components/server/server.js +0 -358
- package/esm/components/server/sftp.d.ts +0 -31
- package/esm/components/server/sftp.d.ts.map +0 -1
- package/esm/components/server/sftp.js +0 -84
- package/esm/components/server/startup.d.ts +0 -17
- package/esm/components/server/startup.d.ts.map +0 -1
- package/esm/components/server/startup.js +0 -21
- package/esm/components/server/stats.d.ts +0 -19
- package/esm/components/server/stats.d.ts.map +0 -1
- package/esm/components/server/stats.js +0 -46
- package/esm/utils/cache.d.ts +0 -20
- package/esm/utils/cache.d.ts.map +0 -1
- package/esm/utils/cache.js +0 -66
- package/esm/utils/event.d.ts +0 -38
- package/esm/utils/event.d.ts.map +0 -1
- package/esm/utils/event.js +0 -71
- package/esm/utils/object.d.ts +0 -58
- package/esm/utils/object.d.ts.map +0 -1
- package/esm/utils/object.js +0 -86
- package/esm/utils/subscribe.d.ts +0 -37
- package/esm/utils/subscribe.d.ts.map +0 -1
- package/esm/utils/subscribe.js +0 -29
- package/esm/utils/timer.d.ts +0 -13
- package/esm/utils/timer.d.ts.map +0 -1
- package/esm/utils/timer.js +0 -32
- package/esm/utils/units.d.ts +0 -18
- package/esm/utils/units.d.ts.map +0 -1
- package/esm/utils/units.js +0 -82
- package/script/api.d.ts +0 -76
- package/script/api.d.ts.map +0 -1
- package/script/api.js +0 -192
- package/script/components/auth.d.ts +0 -15
- package/script/components/auth.d.ts.map +0 -1
- package/script/components/auth.js +0 -17
- package/script/components/connection/abstract.d.ts +0 -23
- package/script/components/connection/abstract.d.ts.map +0 -1
- package/script/components/connection/abstract.js +0 -47
- package/script/components/connection/sse.d.ts +0 -20
- package/script/components/connection/sse.d.ts.map +0 -1
- package/script/components/connection/sse.js +0 -69
- package/script/components/egg/egg.d.ts +0 -32
- package/script/components/egg/egg.d.ts.map +0 -1
- package/script/components/egg/egg.js +0 -74
- package/script/components/group.d.ts +0 -14
- package/script/components/group.d.ts.map +0 -1
- package/script/components/group.js +0 -37
- package/script/components/member_2.d.ts +0 -69
- package/script/components/member_2.d.ts.map +0 -1
- package/script/components/member_2.js +0 -146
- package/script/components/node.d.ts +0 -78
- package/script/components/node.d.ts.map +0 -1
- package/script/components/node.js +0 -349
- package/script/components/server/activity.d.ts +0 -45
- package/script/components/server/activity.d.ts.map +0 -1
- package/script/components/server/activity.js +0 -164
- package/script/components/server/allocations.d.ts +0 -45
- package/script/components/server/allocations.d.ts.map +0 -1
- package/script/components/server/allocations.js +0 -152
- package/script/components/server/files.d.ts +0 -50
- package/script/components/server/files.d.ts.map +0 -1
- package/script/components/server/files.js +0 -94
- package/script/components/server/power.d.ts +0 -21
- package/script/components/server/power.d.ts.map +0 -1
- package/script/components/server/power.js +0 -47
- package/script/components/server/profiles.d.ts +0 -63
- package/script/components/server/profiles.d.ts.map +0 -1
- package/script/components/server/profiles.js +0 -168
- package/script/components/server/server.d.ts +0 -141
- package/script/components/server/server.d.ts.map +0 -1
- package/script/components/server/server.js +0 -362
- package/script/components/server/sftp.d.ts +0 -31
- package/script/components/server/sftp.d.ts.map +0 -1
- package/script/components/server/sftp.js +0 -88
- package/script/components/server/startup.d.ts +0 -17
- package/script/components/server/startup.d.ts.map +0 -1
- package/script/components/server/startup.js +0 -25
- package/script/components/server/stats.d.ts +0 -19
- package/script/components/server/stats.d.ts.map +0 -1
- package/script/components/server/stats.js +0 -50
- package/script/utils/cache.d.ts +0 -20
- package/script/utils/cache.d.ts.map +0 -1
- package/script/utils/cache.js +0 -70
- package/script/utils/event.d.ts +0 -38
- package/script/utils/event.d.ts.map +0 -1
- package/script/utils/event.js +0 -75
- package/script/utils/object.d.ts +0 -58
- package/script/utils/object.d.ts.map +0 -1
- package/script/utils/object.js +0 -90
- package/script/utils/subscribe.d.ts +0 -37
- package/script/utils/subscribe.d.ts.map +0 -1
- package/script/utils/subscribe.js +0 -32
- package/script/utils/timer.d.ts +0 -13
- package/script/utils/timer.d.ts.map +0 -1
- package/script/utils/timer.js +0 -36
- package/script/utils/units.d.ts +0 -18
- package/script/utils/units.d.ts.map +0 -1
- package/script/utils/units.js +0 -86
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 - Present
|
|
3
|
+
Copyright (c) 2024 - Present WinterNode
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @meowpanel/api
|
|
2
|
+
|
|
3
|
+
TypeScript client library for the MeowPanel platform.
|
|
4
|
+
Provides typed access to MeowPanel API endpoints.
|
|
5
|
+
|
|
6
|
+
## Quick start
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import { MeowPanelApi } from "@meowpanel/api";
|
|
10
|
+
|
|
11
|
+
const api = new MeowPanelApi({
|
|
12
|
+
url: "https://panel.example.com",
|
|
13
|
+
token: "your-api-key",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// List servers with type-safe includes
|
|
17
|
+
const { data: servers } = await api.servers.list({ include: ["group", "status"] });
|
|
18
|
+
for (const server of servers) {
|
|
19
|
+
console.log(server.name, server.group.nodeId, server.status.state);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Manage files on a server
|
|
23
|
+
const server = await api.servers.get(servers[0].id);
|
|
24
|
+
const entries = await server.files.list("/");
|
|
25
|
+
await server.files.write("/motd.txt", "Hello World");
|
|
26
|
+
|
|
27
|
+
// Real-time console via SSE
|
|
28
|
+
const conn = await server.createConnection();
|
|
29
|
+
conn.on("console_output", (line) => console.log(line));
|
|
30
|
+
conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
31
|
+
await conn.open();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Type-safe includes** - `list({ include: ["group"] })` narrows the return type so included fields are guaranteed non-undefined.
|
|
37
|
+
- **Reactive stores** - All namespaces and resources implement a `subscribe()` contract for use in Svelte or other reactive frameworks.
|
|
38
|
+
- **Typed events** - Listen for mutations with `api.servers.on("created", (server) => ...)`.
|
|
39
|
+
- **File management** - Full CRUD, compression, chmod, and multipart upload via the node daemon.
|
|
40
|
+
- **SSE connections** - Real-time console output, power state, and resource utilization streaming.
|
package/esm/mod.d.ts
CHANGED
|
@@ -1,2 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* # @meowpanel/api
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client library for the MeowPanel platform.
|
|
5
|
+
* Provides typed access to MeowPanel API endpoints.
|
|
6
|
+
*
|
|
7
|
+
* ## Quick start
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { MeowPanelApi } from "@meowpanel/api";
|
|
11
|
+
*
|
|
12
|
+
* const api = new MeowPanelApi({
|
|
13
|
+
* url: "https://panel.example.com",
|
|
14
|
+
* token: "your-api-key",
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // List servers with type-safe includes
|
|
18
|
+
* const { data: servers } = await api.servers.list({ include: ["group", "status"] });
|
|
19
|
+
* for (const server of servers) {
|
|
20
|
+
* console.log(server.name, server.group.nodeId, server.status.state);
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Manage files on a server
|
|
24
|
+
* const server = await api.servers.get(servers[0].id);
|
|
25
|
+
* const entries = await server.files.list("/");
|
|
26
|
+
* await server.files.write("/motd.txt", "Hello World");
|
|
27
|
+
*
|
|
28
|
+
* // Real-time console via SSE
|
|
29
|
+
* const conn = await server.createConnection();
|
|
30
|
+
* conn.on("console_output", (line) => console.log(line));
|
|
31
|
+
* conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
32
|
+
* await conn.open();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* ## Features
|
|
36
|
+
*
|
|
37
|
+
* - **Type-safe includes** - `list({ include: ["group"] })` narrows the return type so included fields are guaranteed non-undefined.
|
|
38
|
+
* - **Reactive stores** - All namespaces and resources implement a `subscribe()` contract for use in Svelte or other reactive frameworks.
|
|
39
|
+
* - **Typed events** - Listen for mutations with `api.servers.on("created", (server) => ...)`.
|
|
40
|
+
* - **File management** - Full CRUD, compression, chmod, and multipart upload via the node daemon.
|
|
41
|
+
* - **SSE connections** - Real-time console output, power state, and resource utilization streaming.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
export { MeowPanelApi } from './src/client.js';
|
|
46
|
+
export type { MeowPanelApiOptions } from './src/client.js';
|
|
47
|
+
export { AuthResource } from './src/resources/auth.js';
|
|
48
|
+
export type { AuthMeta, AuthProvider } from './src/resources/auth.js';
|
|
49
|
+
export { ReactiveResource } from './src/reactive.js';
|
|
50
|
+
export { ApiError } from './src/errors.js';
|
|
51
|
+
export type { ApiErrorOptions } from './src/errors.js';
|
|
52
|
+
export { HttpClient } from './src/http.js';
|
|
53
|
+
export type { HttpClientOptions, HttpLogCode, HttpLogEvent, HttpLogger, HttpRequestErrorLogEvent, HttpRequestStartLogEvent, HttpRequestSuccessLogEvent, RequestOptions, } from './src/http.js';
|
|
54
|
+
export { TypedEmitter } from './src/emitter.js';
|
|
55
|
+
export type { EventHandler } from './src/emitter.js';
|
|
56
|
+
export { SseConnection } from './src/sse.js';
|
|
57
|
+
export type { SseState } from './src/sse.js';
|
|
58
|
+
export { joinIncludes, toNanoID } from './src/types.js';
|
|
59
|
+
export type { IncludeOptions, ISODate, ListOptions, NanoID, Paginated, PowerSignal, PowerState, ResourceWith, ServerRestrictedState, SftpPermission, UnionToIntersection, } from './src/types.js';
|
|
60
|
+
export { Account, AccountResource, ApiKeyAccount, UserAccount } from './src/resources/account.js';
|
|
61
|
+
export type { AccountInclude, UpdateAccountPayload } from './src/resources/account.js';
|
|
62
|
+
export { ApiKey, ApiKeysNamespace } from './src/resources/api-keys.js';
|
|
63
|
+
export type { ApiKeyEvents, CreateApiKeyPayload, CreateApiKeyResult } from './src/resources/api-keys.js';
|
|
64
|
+
export { Member, MembersNamespace } from './src/resources/members.js';
|
|
65
|
+
export type { MemberData, MemberDisplay, MemberEvents, MemberInclude, MemberWith, UpdateMemberPayload, } from './src/resources/members.js';
|
|
66
|
+
export { Node, NodeAllocationIp, NodeAllocationPort, NodeAllocationsManager, NodeLocation, NodesNamespace, NodeType, } from './src/resources/nodes.js';
|
|
67
|
+
export type { CreateNodeAllocationIpPayload, CreateNodeAllocationPortsPayload, CreateNodePayload, LogNodeActivityPayload, NodeAllocationIpData, NodeAllocationPortData, NodeConnection, NodeData, NodeEvents, NodeHostData, NodeInclude, NodeLimits, NodeLocationData, NodeTypeData, NodeWith, UpdateNodeAllocationIpPayload, UpdateNodeAllocationPortPayload, } from './src/resources/nodes.js';
|
|
68
|
+
export { Egg, EggNest, EggsNamespace } from './src/resources/eggs.js';
|
|
69
|
+
export type { EggData, EggEvents, EggImage, EggImageData, EggInclude, EggInstaller, EggInstallerData, EggNestData, EggProcess, EggWith, UpdateEggPayload, } from './src/resources/eggs.js';
|
|
70
|
+
export { Host, HostsNamespace } from './src/resources/hosts.js';
|
|
71
|
+
export type { HostData } from './src/resources/hosts.js';
|
|
72
|
+
export { ServerGroup, ServerGroupsNamespace } from './src/resources/server-groups.js';
|
|
73
|
+
export type { CreateServerGroupPayload, ServerGroupData, ServerGroupEvents, ServerGroupLimits, ServerGroupLimitsData, } from './src/resources/server-groups.js';
|
|
74
|
+
export { ServersNamespace } from './src/resources/servers/index.js';
|
|
75
|
+
export type { CreateServerPayload, ServerEvents, ServerInclude, ServerWith, UpdateServerPayload, } from './src/resources/servers/index.js';
|
|
76
|
+
export { Server } from './src/resources/servers/server.js';
|
|
77
|
+
export type { ServerBuild, ServerStartup, ServerStatus, StartupVariable } from './src/resources/servers/server.js';
|
|
78
|
+
export { ServerConnection } from './src/resources/servers/connection.js';
|
|
79
|
+
export type { ServerConnectionEvents, ServerUtilization } from './src/resources/servers/connection.js';
|
|
80
|
+
export { FileEntry, ServerFilesManager } from './src/resources/servers/files.js';
|
|
81
|
+
export { ServerSftpManager, SftpUser } from './src/resources/servers/sftp.js';
|
|
82
|
+
export type { AddAllocationEntry } from './src/resources/servers/allocations.js';
|
|
83
|
+
export type { SftpConnection, SftpDetails, SftpUserInclude, SftpUserWith } from './src/resources/servers/sftp.js';
|
|
84
|
+
export { ServerAllocationPort, ServerAllocationsManager } from './src/resources/servers/allocations.js';
|
|
85
|
+
export type { AllocationPortMeta } from './src/resources/servers/allocations.js';
|
|
86
|
+
export { ServerProfile, ServerProfilesManager } from './src/resources/servers/profiles.js';
|
|
87
|
+
export { ActivityJob, ActivityJobLog, ActivityLog, ServerActivityManager } from './src/resources/servers/activity.js';
|
|
2
88
|
//# 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,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
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,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACX,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,cAAc,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,MAAM,EACN,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,mBAAm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
|
2
|
+
* # @meowpanel/api
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client library for the MeowPanel platform.
|
|
5
|
+
* Provides typed access to MeowPanel API endpoints.
|
|
6
|
+
*
|
|
7
|
+
* ## Quick start
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { MeowPanelApi } from "@meowpanel/api";
|
|
11
|
+
*
|
|
12
|
+
* const api = new MeowPanelApi({
|
|
13
|
+
* url: "https://panel.example.com",
|
|
14
|
+
* token: "your-api-key",
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // List servers with type-safe includes
|
|
18
|
+
* const { data: servers } = await api.servers.list({ include: ["group", "status"] });
|
|
19
|
+
* for (const server of servers) {
|
|
20
|
+
* console.log(server.name, server.group.nodeId, server.status.state);
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Manage files on a server
|
|
24
|
+
* const server = await api.servers.get(servers[0].id);
|
|
25
|
+
* const entries = await server.files.list("/");
|
|
26
|
+
* await server.files.write("/motd.txt", "Hello World");
|
|
27
|
+
*
|
|
28
|
+
* // Real-time console via SSE
|
|
29
|
+
* const conn = await server.createConnection();
|
|
30
|
+
* conn.on("console_output", (line) => console.log(line));
|
|
31
|
+
* conn.on("stats", (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
32
|
+
* await conn.open();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* ## Features
|
|
36
|
+
*
|
|
37
|
+
* - **Type-safe includes** - `list({ include: ["group"] })` narrows the return type so included fields are guaranteed non-undefined.
|
|
38
|
+
* - **Reactive stores** - All namespaces and resources implement a `subscribe()` contract for use in Svelte or other reactive frameworks.
|
|
39
|
+
* - **Typed events** - Listen for mutations with `api.servers.on("created", (server) => ...)`.
|
|
40
|
+
* - **File management** - Full CRUD, compression, chmod, and multipart upload via the node daemon.
|
|
41
|
+
* - **SSE connections** - Real-time console output, power state, and resource utilization streaming.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
// Main client
|
|
46
|
+
export { MeowPanelApi } from './src/client.js';
|
|
47
|
+
// Auth
|
|
48
|
+
export { AuthResource } from './src/resources/auth.js';
|
|
49
|
+
export { ReactiveResource } from './src/reactive.js';
|
|
50
|
+
// Core primitives
|
|
51
|
+
export { ApiError } from './src/errors.js';
|
|
52
|
+
export { HttpClient } from './src/http.js';
|
|
53
|
+
export { TypedEmitter } from './src/emitter.js';
|
|
54
|
+
export { SseConnection } from './src/sse.js';
|
|
55
|
+
// Common types
|
|
56
|
+
export { joinIncludes, toNanoID } from './src/types.js';
|
|
57
|
+
// Account
|
|
58
|
+
export { Account, AccountResource, ApiKeyAccount, UserAccount } from './src/resources/account.js';
|
|
59
|
+
// API Keys
|
|
60
|
+
export { ApiKey, ApiKeysNamespace } from './src/resources/api-keys.js';
|
|
61
|
+
// Members
|
|
62
|
+
export { Member, MembersNamespace } from './src/resources/members.js';
|
|
63
|
+
// Nodes
|
|
64
|
+
export { Node, NodeAllocationIp, NodeAllocationPort, NodeAllocationsManager, NodeLocation, NodesNamespace, NodeType, } from './src/resources/nodes.js';
|
|
65
|
+
// Eggs
|
|
66
|
+
export { Egg, EggNest, EggsNamespace } from './src/resources/eggs.js';
|
|
67
|
+
// Hosts
|
|
68
|
+
export { Host, HostsNamespace } from './src/resources/hosts.js';
|
|
69
|
+
// Server Groups
|
|
70
|
+
export { ServerGroup, ServerGroupsNamespace } from './src/resources/server-groups.js';
|
|
71
|
+
// Servers
|
|
72
|
+
export { ServersNamespace } from './src/resources/servers/index.js';
|
|
73
|
+
export { Server } from './src/resources/servers/server.js';
|
|
74
|
+
// Server connection (SSE)
|
|
75
|
+
export { ServerConnection } from './src/resources/servers/connection.js';
|
|
76
|
+
// Server files
|
|
77
|
+
export { FileEntry, ServerFilesManager } from './src/resources/servers/files.js';
|
|
78
|
+
// Server SFTP
|
|
79
|
+
export { ServerSftpManager, SftpUser } from './src/resources/servers/sftp.js';
|
|
80
|
+
// Server allocations
|
|
81
|
+
export { ServerAllocationPort, ServerAllocationsManager } from './src/resources/servers/allocations.js';
|
|
82
|
+
// Server profiles
|
|
83
|
+
export { ServerProfile, ServerProfilesManager } from './src/resources/servers/profiles.js';
|
|
84
|
+
// Server activity
|
|
85
|
+
export { ActivityJob, ActivityJobLog, ActivityLog, ServerActivityManager } from './src/resources/servers/activity.js';
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { HttpLogger } from './http.js';
|
|
2
|
+
import { SseConnection } from './sse.js';
|
|
3
|
+
import { AccountResource } from './resources/account.js';
|
|
4
|
+
import { AuthResource } from './resources/auth.js';
|
|
5
|
+
import { ApiKeysNamespace } from './resources/api-keys.js';
|
|
6
|
+
import { EggsNamespace } from './resources/eggs.js';
|
|
7
|
+
import { HostsNamespace } from './resources/hosts.js';
|
|
8
|
+
import { MembersNamespace } from './resources/members.js';
|
|
9
|
+
import { NodesNamespace } from './resources/nodes.js';
|
|
10
|
+
import { ServerGroupsNamespace } from './resources/server-groups.js';
|
|
11
|
+
import { ServersNamespace } from './resources/servers/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for {@link MeowPanelApi}.
|
|
14
|
+
*/
|
|
15
|
+
export interface MeowPanelApiOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Base URL of the MeowPanel Nexus API.
|
|
18
|
+
*
|
|
19
|
+
* Should not include `/v1` - that is appended automatically.
|
|
20
|
+
*
|
|
21
|
+
* @example `"https://panel.example.com"`
|
|
22
|
+
*/
|
|
23
|
+
url: string | URL;
|
|
24
|
+
/**
|
|
25
|
+
* Bearer token for authentication.
|
|
26
|
+
*
|
|
27
|
+
* Can be a user session token or an API key token.
|
|
28
|
+
*/
|
|
29
|
+
token?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Custom fetch implementation to use for all HTTP requests.
|
|
32
|
+
*
|
|
33
|
+
* Defaults to `globalThis.fetch`.
|
|
34
|
+
*/
|
|
35
|
+
fetch?: typeof globalThis.fetch;
|
|
36
|
+
/**
|
|
37
|
+
* Optional callback invoked for every outgoing request.
|
|
38
|
+
*
|
|
39
|
+
* Useful for integrating API request visibility into your app's debug/info logger.
|
|
40
|
+
*/
|
|
41
|
+
logger?: HttpLogger;
|
|
42
|
+
/**
|
|
43
|
+
* The `credentials` mode for all fetch requests.
|
|
44
|
+
*
|
|
45
|
+
* Set to `'include'` for browser apps that rely on cookie-based authentication.
|
|
46
|
+
* Defaults to `undefined` (browser default is `'same-origin'`).
|
|
47
|
+
*/
|
|
48
|
+
credentials?: RequestCredentials;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The root MeowPanel API client.
|
|
52
|
+
*
|
|
53
|
+
* Instantiate once and reuse across your application. All namespaces implement the
|
|
54
|
+
* readable store contract so they can be used directly in reactive templates.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts ignore
|
|
58
|
+
* import { MeowPanelApi } from '@meowpanel/api';
|
|
59
|
+
*
|
|
60
|
+
* const api = new MeowPanelApi({
|
|
61
|
+
* url: 'https://panel.example.com',
|
|
62
|
+
* token: 'your-bearer-token',
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Fetch resources
|
|
66
|
+
* const me = await api.account.get();
|
|
67
|
+
* const servers = await api.servers.list({ include: ['status'] });
|
|
68
|
+
* const members = await api.members.list();
|
|
69
|
+
*
|
|
70
|
+
* // Reactive store: {#each $api.servers as server} ... {/each}
|
|
71
|
+
*
|
|
72
|
+
* // Listen for mutations
|
|
73
|
+
* api.servers.on('created', (server) => console.log('New server:', server.name));
|
|
74
|
+
* api.members.on('updated', (member) => console.log('Member updated:', member.nickname));
|
|
75
|
+
*
|
|
76
|
+
* // Panel-level SSE
|
|
77
|
+
* const sse = api.connectSse();
|
|
78
|
+
* sse.connect((event, data) => console.log('Panel event:', event, data));
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare class MeowPanelApi {
|
|
82
|
+
private readonly http;
|
|
83
|
+
/**
|
|
84
|
+
* Fetch authentication configuration (available login providers).
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts ignore
|
|
88
|
+
* const { providers } = await api.auth.getMeta();
|
|
89
|
+
* if (providers.whmcs) console.log(providers.whmcs.fields.display_name);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
readonly auth: AuthResource;
|
|
93
|
+
/**
|
|
94
|
+
* Access and update the currently authenticated account (me).
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts ignore
|
|
98
|
+
* const me = await api.account.get();
|
|
99
|
+
* await api.account.update({ display: { theme: 'dark' } });
|
|
100
|
+
* await api.account.uploadAvatar(imageBlob, 'image/png');
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
readonly account: AccountResource;
|
|
104
|
+
/**
|
|
105
|
+
* Manage API keys for the current account.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts ignore
|
|
109
|
+
* const key = await api.apiKeys.create('CI/CD Pipeline');
|
|
110
|
+
* console.log(key.token); // Save this!
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
readonly apiKeys: ApiKeysNamespace;
|
|
114
|
+
/**
|
|
115
|
+
* Manage member (user) accounts.
|
|
116
|
+
*
|
|
117
|
+
* Supports reactive subscriptions via `$api.members`.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts ignore
|
|
121
|
+
* const members = await api.members.list();
|
|
122
|
+
* const member = await api.members.get(id);
|
|
123
|
+
* await api.members.update(id, { nickname: 'newname' });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
readonly members: MembersNamespace;
|
|
127
|
+
/**
|
|
128
|
+
* Manage nodes (daemon servers).
|
|
129
|
+
*
|
|
130
|
+
* Supports reactive subscriptions via `$api.nodes`.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts ignore
|
|
134
|
+
* const nodes = await api.nodes.list();
|
|
135
|
+
* const node = await api.nodes.get(id, { includeConnection: true });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
readonly nodes: NodesNamespace;
|
|
139
|
+
/**
|
|
140
|
+
* Manage eggs (game/application configuration templates).
|
|
141
|
+
*
|
|
142
|
+
* Supports reactive subscriptions via `$api.eggs`.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts ignore
|
|
146
|
+
* const eggs = await api.eggs.list();
|
|
147
|
+
* await api.eggs.update(id, { name: 'Paper Minecraft' });
|
|
148
|
+
* await api.eggs.delete(id);
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
readonly eggs: EggsNamespace;
|
|
152
|
+
/**
|
|
153
|
+
* View physical host machines.
|
|
154
|
+
*
|
|
155
|
+
* Supports reactive subscriptions via `$api.hosts`.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts ignore
|
|
159
|
+
* const hosts = await api.hosts.list();
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
readonly hosts: HostsNamespace;
|
|
163
|
+
/**
|
|
164
|
+
* Manage server groups (node + resource limits containers).
|
|
165
|
+
*
|
|
166
|
+
* Supports reactive subscriptions via `$api.serverGroups`.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts ignore
|
|
170
|
+
* const groups = await api.serverGroups.list();
|
|
171
|
+
* const group = await api.serverGroups.create({ nodeId, limits: { ramMb: 1024 } });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
readonly serverGroups: ServerGroupsNamespace;
|
|
175
|
+
/**
|
|
176
|
+
* Manage game servers.
|
|
177
|
+
*
|
|
178
|
+
* Supports reactive subscriptions via `$api.servers`.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts ignore
|
|
182
|
+
* const servers = await api.servers.list({ include: ['status'] });
|
|
183
|
+
* const server = await api.servers.get(id);
|
|
184
|
+
* await server.sendPower('start');
|
|
185
|
+
* await server.sendCommand('say Hello!');
|
|
186
|
+
*
|
|
187
|
+
* // File management
|
|
188
|
+
* const entries = await server.files.list('/');
|
|
189
|
+
* await server.files.write('/motd.txt', 'Hello World');
|
|
190
|
+
*
|
|
191
|
+
* // Real-time events
|
|
192
|
+
* const conn = await server.createConnection();
|
|
193
|
+
* conn.on('console_output', (line) => console.log(line));
|
|
194
|
+
* conn.on('stats', (stats) => console.log(`CPU: ${stats.cpuAbsolute}%`));
|
|
195
|
+
* await conn.open();
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
readonly servers: ServersNamespace;
|
|
199
|
+
constructor(options: MeowPanelApiOptions);
|
|
200
|
+
/**
|
|
201
|
+
* Update the bearer token used for all subsequent API requests.
|
|
202
|
+
*
|
|
203
|
+
* Useful when a session token is refreshed.
|
|
204
|
+
*
|
|
205
|
+
* @param token The new bearer token.
|
|
206
|
+
*/
|
|
207
|
+
setToken(token: string): void;
|
|
208
|
+
/**
|
|
209
|
+
* Create a panel-level Server-Sent Events connection to Nexus.
|
|
210
|
+
*
|
|
211
|
+
* The panel SSE stream (`GET /v1/sse`) broadcasts events for mutations
|
|
212
|
+
* across the panel (e.g. server updates, member changes).
|
|
213
|
+
*
|
|
214
|
+
* The connection is not opened until you call `.connect()` on the returned object.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts ignore
|
|
218
|
+
* const sse = api.connectSse();
|
|
219
|
+
* sse.connect(
|
|
220
|
+
* (event, data) => {
|
|
221
|
+
* const payload = JSON.parse(data);
|
|
222
|
+
* console.log('Panel event:', event, payload);
|
|
223
|
+
* },
|
|
224
|
+
* (err) => console.error('SSE error:', err),
|
|
225
|
+
* );
|
|
226
|
+
*
|
|
227
|
+
* // Later...
|
|
228
|
+
* sse.disconnect();
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
connectSse(): SseConnection;
|
|
232
|
+
}
|
|
233
|
+
//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