@meowpanel/api 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/esm/mod.d.ts +37 -16
  2. package/esm/mod.d.ts.map +1 -1
  3. package/esm/mod.js +25 -7
  4. package/esm/src/client.d.ts +48 -11
  5. package/esm/src/client.d.ts.map +1 -1
  6. package/esm/src/client.js +53 -12
  7. package/esm/src/http.d.ts +2 -2
  8. package/esm/src/http.d.ts.map +1 -1
  9. package/esm/src/http.js +5 -2
  10. package/esm/src/namespace.d.ts +1 -1
  11. package/esm/src/namespace.js +1 -1
  12. package/esm/src/resources/account.d.ts +50 -19
  13. package/esm/src/resources/account.d.ts.map +1 -1
  14. package/esm/src/resources/account.js +51 -13
  15. package/esm/src/resources/api-keys.d.ts +16 -24
  16. package/esm/src/resources/api-keys.d.ts.map +1 -1
  17. package/esm/src/resources/api-keys.js +16 -20
  18. package/esm/src/resources/auth.d.ts +70 -4
  19. package/esm/src/resources/auth.d.ts.map +1 -1
  20. package/esm/src/resources/auth.js +47 -4
  21. package/esm/src/resources/eggs.d.ts +261 -22
  22. package/esm/src/resources/eggs.d.ts.map +1 -1
  23. package/esm/src/resources/eggs.js +261 -25
  24. package/esm/src/resources/features.d.ts +35 -0
  25. package/esm/src/resources/features.d.ts.map +1 -0
  26. package/esm/src/resources/features.js +21 -0
  27. package/esm/src/resources/hosts.d.ts +151 -21
  28. package/esm/src/resources/hosts.d.ts.map +1 -1
  29. package/esm/src/resources/hosts.js +143 -10
  30. package/esm/src/resources/logs.d.ts +39 -0
  31. package/esm/src/resources/logs.d.ts.map +1 -0
  32. package/esm/src/resources/logs.js +38 -0
  33. package/esm/src/resources/nodes.d.ts +108 -33
  34. package/esm/src/resources/nodes.d.ts.map +1 -1
  35. package/esm/src/resources/nodes.js +116 -24
  36. package/esm/src/resources/permissions.d.ts +45 -0
  37. package/esm/src/resources/permissions.d.ts.map +1 -0
  38. package/esm/src/resources/permissions.js +26 -0
  39. package/esm/src/resources/request-logs.d.ts +91 -0
  40. package/esm/src/resources/request-logs.d.ts.map +1 -0
  41. package/esm/src/resources/request-logs.js +70 -0
  42. package/esm/src/resources/roles.d.ts +128 -0
  43. package/esm/src/resources/roles.d.ts.map +1 -0
  44. package/esm/src/resources/roles.js +142 -0
  45. package/esm/src/resources/server-groups.d.ts +141 -7
  46. package/esm/src/resources/server-groups.d.ts.map +1 -1
  47. package/esm/src/resources/server-groups.js +157 -8
  48. package/esm/src/resources/servers/activity.d.ts +50 -8
  49. package/esm/src/resources/servers/activity.d.ts.map +1 -1
  50. package/esm/src/resources/servers/activity.js +54 -13
  51. package/esm/src/resources/servers/allocations.d.ts +3 -3
  52. package/esm/src/resources/servers/allocations.d.ts.map +1 -1
  53. package/esm/src/resources/servers/allocations.js +7 -7
  54. package/esm/src/resources/servers/backups.d.ts +46 -0
  55. package/esm/src/resources/servers/backups.d.ts.map +1 -0
  56. package/esm/src/resources/servers/backups.js +43 -0
  57. package/esm/src/resources/servers/connection.d.ts +33 -13
  58. package/esm/src/resources/servers/connection.d.ts.map +1 -1
  59. package/esm/src/resources/servers/connection.js +32 -11
  60. package/esm/src/resources/servers/features.d.ts +81 -0
  61. package/esm/src/resources/servers/features.d.ts.map +1 -0
  62. package/esm/src/resources/servers/features.js +60 -0
  63. package/esm/src/resources/servers/files.d.ts +41 -53
  64. package/esm/src/resources/servers/files.d.ts.map +1 -1
  65. package/esm/src/resources/servers/files.js +74 -116
  66. package/esm/src/resources/servers/index.d.ts +46 -27
  67. package/esm/src/resources/servers/index.d.ts.map +1 -1
  68. package/esm/src/resources/servers/index.js +26 -12
  69. package/esm/src/resources/servers/jobs.d.ts +88 -0
  70. package/esm/src/resources/servers/jobs.d.ts.map +1 -0
  71. package/esm/src/resources/servers/jobs.js +115 -0
  72. package/esm/src/resources/servers/node-client.d.ts +33 -0
  73. package/esm/src/resources/servers/node-client.d.ts.map +1 -0
  74. package/esm/src/resources/servers/node-client.js +61 -0
  75. package/esm/src/resources/servers/profiles.d.ts +83 -18
  76. package/esm/src/resources/servers/profiles.d.ts.map +1 -1
  77. package/esm/src/resources/servers/profiles.js +78 -11
  78. package/esm/src/resources/servers/server.d.ts +13 -28
  79. package/esm/src/resources/servers/server.d.ts.map +1 -1
  80. package/esm/src/resources/servers/server.js +21 -37
  81. package/esm/src/resources/servers/sftp.d.ts +12 -19
  82. package/esm/src/resources/servers/sftp.d.ts.map +1 -1
  83. package/esm/src/resources/servers/sftp.js +10 -14
  84. package/esm/src/resources/servers/sub-users.d.ts +99 -0
  85. package/esm/src/resources/servers/sub-users.d.ts.map +1 -0
  86. package/esm/src/resources/servers/sub-users.js +94 -0
  87. package/esm/src/resources/servers/types.d.ts +30 -28
  88. package/esm/src/resources/servers/types.d.ts.map +1 -1
  89. package/esm/src/resources/systems.d.ts +124 -0
  90. package/esm/src/resources/systems.d.ts.map +1 -0
  91. package/esm/src/resources/systems.js +139 -0
  92. package/esm/src/resources/users.d.ts +330 -0
  93. package/esm/src/resources/users.d.ts.map +1 -0
  94. package/esm/src/resources/users.js +280 -0
  95. package/esm/src/types.d.ts +18 -1
  96. package/esm/src/types.d.ts.map +1 -1
  97. package/esm/src/types.js +11 -0
  98. package/package.json +1 -1
  99. package/script/mod.d.ts +37 -16
  100. package/script/mod.d.ts.map +1 -1
  101. package/script/mod.js +50 -5
  102. package/script/src/client.d.ts +48 -11
  103. package/script/src/client.d.ts.map +1 -1
  104. package/script/src/client.js +53 -12
  105. package/script/src/http.d.ts +2 -2
  106. package/script/src/http.d.ts.map +1 -1
  107. package/script/src/http.js +5 -2
  108. package/script/src/namespace.d.ts +1 -1
  109. package/script/src/namespace.js +1 -1
  110. package/script/src/resources/account.d.ts +50 -19
  111. package/script/src/resources/account.d.ts.map +1 -1
  112. package/script/src/resources/account.js +50 -12
  113. package/script/src/resources/api-keys.d.ts +16 -24
  114. package/script/src/resources/api-keys.d.ts.map +1 -1
  115. package/script/src/resources/api-keys.js +15 -19
  116. package/script/src/resources/auth.d.ts +70 -4
  117. package/script/src/resources/auth.d.ts.map +1 -1
  118. package/script/src/resources/auth.js +47 -4
  119. package/script/src/resources/eggs.d.ts +261 -22
  120. package/script/src/resources/eggs.d.ts.map +1 -1
  121. package/script/src/resources/eggs.js +267 -26
  122. package/script/src/resources/features.d.ts +35 -0
  123. package/script/src/resources/features.d.ts.map +1 -0
  124. package/script/src/resources/features.js +25 -0
  125. package/script/src/resources/hosts.d.ts +151 -21
  126. package/script/src/resources/hosts.d.ts.map +1 -1
  127. package/script/src/resources/hosts.js +144 -10
  128. package/script/src/resources/logs.d.ts +39 -0
  129. package/script/src/resources/logs.d.ts.map +1 -0
  130. package/script/src/resources/logs.js +42 -0
  131. package/script/src/resources/nodes.d.ts +108 -33
  132. package/script/src/resources/nodes.d.ts.map +1 -1
  133. package/script/src/resources/nodes.js +117 -24
  134. package/script/src/resources/permissions.d.ts +45 -0
  135. package/script/src/resources/permissions.d.ts.map +1 -0
  136. package/script/src/resources/permissions.js +31 -0
  137. package/script/src/resources/request-logs.d.ts +91 -0
  138. package/script/src/resources/request-logs.d.ts.map +1 -0
  139. package/script/src/resources/request-logs.js +75 -0
  140. package/script/src/resources/roles.d.ts +128 -0
  141. package/script/src/resources/roles.d.ts.map +1 -0
  142. package/script/src/resources/roles.js +148 -0
  143. package/script/src/resources/server-groups.d.ts +141 -7
  144. package/script/src/resources/server-groups.d.ts.map +1 -1
  145. package/script/src/resources/server-groups.js +158 -8
  146. package/script/src/resources/servers/activity.d.ts +50 -8
  147. package/script/src/resources/servers/activity.d.ts.map +1 -1
  148. package/script/src/resources/servers/activity.js +54 -12
  149. package/script/src/resources/servers/allocations.d.ts +3 -3
  150. package/script/src/resources/servers/allocations.d.ts.map +1 -1
  151. package/script/src/resources/servers/allocations.js +7 -7
  152. package/script/src/resources/servers/backups.d.ts +46 -0
  153. package/script/src/resources/servers/backups.d.ts.map +1 -0
  154. package/script/src/resources/servers/backups.js +47 -0
  155. package/script/src/resources/servers/connection.d.ts +33 -13
  156. package/script/src/resources/servers/connection.d.ts.map +1 -1
  157. package/script/src/resources/servers/connection.js +32 -11
  158. package/script/src/resources/servers/features.d.ts +81 -0
  159. package/script/src/resources/servers/features.d.ts.map +1 -0
  160. package/script/src/resources/servers/features.js +64 -0
  161. package/script/src/resources/servers/files.d.ts +41 -53
  162. package/script/src/resources/servers/files.d.ts.map +1 -1
  163. package/script/src/resources/servers/files.js +74 -116
  164. package/script/src/resources/servers/index.d.ts +46 -27
  165. package/script/src/resources/servers/index.d.ts.map +1 -1
  166. package/script/src/resources/servers/index.js +26 -12
  167. package/script/src/resources/servers/jobs.d.ts +88 -0
  168. package/script/src/resources/servers/jobs.d.ts.map +1 -0
  169. package/script/src/resources/servers/jobs.js +120 -0
  170. package/script/src/resources/servers/node-client.d.ts +33 -0
  171. package/script/src/resources/servers/node-client.d.ts.map +1 -0
  172. package/script/src/resources/servers/node-client.js +65 -0
  173. package/script/src/resources/servers/profiles.d.ts +83 -18
  174. package/script/src/resources/servers/profiles.d.ts.map +1 -1
  175. package/script/src/resources/servers/profiles.js +77 -10
  176. package/script/src/resources/servers/server.d.ts +13 -28
  177. package/script/src/resources/servers/server.d.ts.map +1 -1
  178. package/script/src/resources/servers/server.js +21 -37
  179. package/script/src/resources/servers/sftp.d.ts +12 -19
  180. package/script/src/resources/servers/sftp.d.ts.map +1 -1
  181. package/script/src/resources/servers/sftp.js +10 -14
  182. package/script/src/resources/servers/sub-users.d.ts +99 -0
  183. package/script/src/resources/servers/sub-users.d.ts.map +1 -0
  184. package/script/src/resources/servers/sub-users.js +99 -0
  185. package/script/src/resources/servers/types.d.ts +30 -28
  186. package/script/src/resources/servers/types.d.ts.map +1 -1
  187. package/script/src/resources/systems.d.ts +124 -0
  188. package/script/src/resources/systems.d.ts.map +1 -0
  189. package/script/src/resources/systems.js +145 -0
  190. package/script/src/resources/users.d.ts +330 -0
  191. package/script/src/resources/users.d.ts.map +1 -0
  192. package/script/src/resources/users.js +287 -0
  193. package/script/src/types.d.ts +18 -1
  194. package/script/src/types.d.ts.map +1 -1
  195. package/script/src/types.js +12 -0
  196. package/esm/src/resources/members.d.ts +0 -138
  197. package/esm/src/resources/members.d.ts.map +0 -1
  198. package/esm/src/resources/members.js +0 -122
  199. package/script/src/resources/members.d.ts +0 -138
  200. package/script/src/resources/members.d.ts.map +0 -1
  201. package/script/src/resources/members.js +0 -127
@@ -4,11 +4,15 @@ import { AccountResource } from './resources/account.js';
4
4
  import { AuthResource } from './resources/auth.js';
5
5
  import { ApiKeysNamespace } from './resources/api-keys.js';
6
6
  import { EggsNamespace } from './resources/eggs.js';
7
+ import { FeaturesResource } from './resources/features.js';
7
8
  import { HostsNamespace } from './resources/hosts.js';
8
- import { MembersNamespace } from './resources/members.js';
9
+ import { LogsResource } from './resources/logs.js';
10
+ import { UsersNamespace } from './resources/users.js';
9
11
  import { NodesNamespace } from './resources/nodes.js';
12
+ import { RolesNamespace } from './resources/roles.js';
10
13
  import { ServerGroupsNamespace } from './resources/server-groups.js';
11
14
  import { ServersNamespace } from './resources/servers/index.js';
15
+ import { SystemsNamespace } from './resources/systems.js';
12
16
  /**
13
17
  * Configuration options for {@link MeowPanelApi}.
14
18
  */
@@ -52,13 +56,13 @@ export interface MeowPanelApiOptions {
52
56
  * // Fetch resources
53
57
  * const me = await api.account.get();
54
58
  * const servers = await api.servers.list({ include: ['status'] });
55
- * const members = await api.members.list();
59
+ * const users = await api.users.list();
56
60
  *
57
61
  * // Reactive store: {#each $api.servers as server} ... {/each}
58
62
  *
59
63
  * // Listen for mutations
60
64
  * api.servers.on('created', (server) => console.log('New server:', server.name));
61
- * api.members.on('updated', (member) => console.log('Member updated:', member.nickname));
65
+ * api.users.on('updated', (user) => console.log('User updated:', user.nickname));
62
66
  *
63
67
  * // Panel-level SSE
64
68
  * const sse = api.connectSse();
@@ -84,7 +88,7 @@ export declare class MeowPanelApi {
84
88
  * @example
85
89
  * ```ts ignore
86
90
  * const me = await api.account.get();
87
- * await api.account.update({ display: { theme: 'dark' } });
91
+ * await api.account.update({ preferences: { theme: 'dark' } });
88
92
  * await api.account.uploadAvatar(imageBlob, 'image/png');
89
93
  * ```
90
94
  */
@@ -100,18 +104,38 @@ export declare class MeowPanelApi {
100
104
  */
101
105
  readonly apiKeys: ApiKeysNamespace;
102
106
  /**
103
- * Manage member (user) accounts.
107
+ * Manage user accounts.
104
108
  *
105
- * Supports reactive subscriptions via `$api.members`.
109
+ * Supports reactive subscriptions via `$api.users`.
106
110
  *
107
111
  * @example
108
112
  * ```ts ignore
109
- * const members = await api.members.list();
110
- * const member = await api.members.get(id);
111
- * await api.members.update(id, { nickname: 'newname' });
113
+ * const users = await api.users.list();
114
+ * const user = await api.users.get(id);
115
+ * await api.users.update(id, { nickname: 'newname' });
112
116
  * ```
113
117
  */
114
- readonly members: MembersNamespace;
118
+ readonly users: UsersNamespace;
119
+ /**
120
+ * Manage roles (named permission bundles).
121
+ *
122
+ * @example
123
+ * ```ts ignore
124
+ * const roles = await api.roles.list();
125
+ * await api.roles.permissions(roleId).grant({ permission: 'server.console.read' });
126
+ * ```
127
+ */
128
+ readonly roles: RolesNamespace;
129
+ /**
130
+ * Manage systems (non-user identities) and their API keys.
131
+ *
132
+ * @example
133
+ * ```ts ignore
134
+ * const system = await api.systems.create({ name: 'CI deploy' });
135
+ * const { token } = await api.systems.keys(system.id).create({ name: 'pipeline', permissions: ['server.read'] });
136
+ * ```
137
+ */
138
+ readonly systems: SystemsNamespace;
115
139
  /**
116
140
  * Manage nodes (daemon servers).
117
141
  *
@@ -184,6 +208,19 @@ export declare class MeowPanelApi {
184
208
  * ```
185
209
  */
186
210
  readonly servers: ServersNamespace;
211
+ /**
212
+ * Browse the code-defined feature catalog. Per-server feature state is at `server.features`.
213
+ */
214
+ readonly features: FeaturesResource;
215
+ /**
216
+ * Read panel-wide activity logs.
217
+ *
218
+ * @example
219
+ * ```ts ignore
220
+ * const { data } = await api.logs.activities({ type: 'server.power.start' });
221
+ * ```
222
+ */
223
+ readonly logs: LogsResource;
187
224
  constructor(options: MeowPanelApiOptions);
188
225
  /**
189
226
  * Update the bearer token used for all subsequent API requests.
@@ -197,7 +234,7 @@ export declare class MeowPanelApi {
197
234
  * Create a panel-level Server-Sent Events connection to Nexus.
198
235
  *
199
236
  * The panel SSE stream (`GET /v1/sse`) broadcasts events for mutations
200
- * across the panel (e.g. server updates, member changes).
237
+ * across the panel (e.g. server updates, user changes).
201
238
  *
202
239
  * The connection is not opened until you call `.connect()` on the returned object.
203
240
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,UA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;;;OAQG;IACH,SAAgB,OAAO,EAAE,gBAAgB,CAAC;IAE1C;;;;;;;;;;OAUG;IACH,SAAgB,KAAK,EAAE,cAAc,CAAC;IAEtC;;;;;;;;;;;OAWG;IACH,SAAgB,IAAI,EAAE,aAAa,CAAC;IAEpC;;;;;;;;;OASG;IACH,SAAgB,KAAK,EAAE,cAAc,CAAC;IAEtC;;;;;;;;;;OAUG;IACH,SAAgB,YAAY,EAAE,qBAAqB,CAAC;IAEpD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAgB,OAAO,EAAE,gBAAgB,CAAC;IAE1C;;OAEG;IACH,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAE3C;;;;;;;OAOG;IACH,SAAgB,IAAI,EAAE,YAAY,CAAC;gBAEhB,OAAO,EAAE,mBAAmB;IA6B/C;;;;;;OAMG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,IAAI,aAAa;CAOlC"}
@@ -7,11 +7,15 @@ const account_js_1 = require("./resources/account.js");
7
7
  const auth_js_1 = require("./resources/auth.js");
8
8
  const api_keys_js_1 = require("./resources/api-keys.js");
9
9
  const eggs_js_1 = require("./resources/eggs.js");
10
+ const features_js_1 = require("./resources/features.js");
10
11
  const hosts_js_1 = require("./resources/hosts.js");
11
- const members_js_1 = require("./resources/members.js");
12
+ const logs_js_1 = require("./resources/logs.js");
13
+ const users_js_1 = require("./resources/users.js");
12
14
  const nodes_js_1 = require("./resources/nodes.js");
15
+ const roles_js_1 = require("./resources/roles.js");
13
16
  const server_groups_js_1 = require("./resources/server-groups.js");
14
17
  const index_js_1 = require("./resources/servers/index.js");
18
+ const systems_js_1 = require("./resources/systems.js");
15
19
  /**
16
20
  * The root MeowPanel API client.
17
21
  *
@@ -30,13 +34,13 @@ const index_js_1 = require("./resources/servers/index.js");
30
34
  * // Fetch resources
31
35
  * const me = await api.account.get();
32
36
  * const servers = await api.servers.list({ include: ['status'] });
33
- * const members = await api.members.list();
37
+ * const users = await api.users.list();
34
38
  *
35
39
  * // Reactive store: {#each $api.servers as server} ... {/each}
36
40
  *
37
41
  * // Listen for mutations
38
42
  * api.servers.on('created', (server) => console.log('New server:', server.name));
39
- * api.members.on('updated', (member) => console.log('Member updated:', member.nickname));
43
+ * api.users.on('updated', (user) => console.log('User updated:', user.nickname));
40
44
  *
41
45
  * // Panel-level SSE
42
46
  * const sse = api.connectSse();
@@ -62,7 +66,7 @@ class MeowPanelApi {
62
66
  * @example
63
67
  * ```ts ignore
64
68
  * const me = await api.account.get();
65
- * await api.account.update({ display: { theme: 'dark' } });
69
+ * await api.account.update({ preferences: { theme: 'dark' } });
66
70
  * await api.account.uploadAvatar(imageBlob, 'image/png');
67
71
  * ```
68
72
  */
@@ -78,18 +82,38 @@ class MeowPanelApi {
78
82
  */
79
83
  apiKeys;
80
84
  /**
81
- * Manage member (user) accounts.
85
+ * Manage user accounts.
82
86
  *
83
- * Supports reactive subscriptions via `$api.members`.
87
+ * Supports reactive subscriptions via `$api.users`.
84
88
  *
85
89
  * @example
86
90
  * ```ts ignore
87
- * const members = await api.members.list();
88
- * const member = await api.members.get(id);
89
- * await api.members.update(id, { nickname: 'newname' });
91
+ * const users = await api.users.list();
92
+ * const user = await api.users.get(id);
93
+ * await api.users.update(id, { nickname: 'newname' });
90
94
  * ```
91
95
  */
92
- members;
96
+ users;
97
+ /**
98
+ * Manage roles (named permission bundles).
99
+ *
100
+ * @example
101
+ * ```ts ignore
102
+ * const roles = await api.roles.list();
103
+ * await api.roles.permissions(roleId).grant({ permission: 'server.console.read' });
104
+ * ```
105
+ */
106
+ roles;
107
+ /**
108
+ * Manage systems (non-user identities) and their API keys.
109
+ *
110
+ * @example
111
+ * ```ts ignore
112
+ * const system = await api.systems.create({ name: 'CI deploy' });
113
+ * const { token } = await api.systems.keys(system.id).create({ name: 'pipeline', permissions: ['server.read'] });
114
+ * ```
115
+ */
116
+ systems;
93
117
  /**
94
118
  * Manage nodes (daemon servers).
95
119
  *
@@ -162,6 +186,19 @@ class MeowPanelApi {
162
186
  * ```
163
187
  */
164
188
  servers;
189
+ /**
190
+ * Browse the code-defined feature catalog. Per-server feature state is at `server.features`.
191
+ */
192
+ features;
193
+ /**
194
+ * Read panel-wide activity logs.
195
+ *
196
+ * @example
197
+ * ```ts ignore
198
+ * const { data } = await api.logs.activities({ type: 'server.power.start' });
199
+ * ```
200
+ */
201
+ logs;
165
202
  constructor(options) {
166
203
  if (!options?.url) {
167
204
  throw new Error('MeowPanelApi requires a "url" option (e.g. "https://panel.example.com").');
@@ -175,12 +212,16 @@ class MeowPanelApi {
175
212
  this.auth = new auth_js_1.AuthResource(this.http);
176
213
  this.account = new account_js_1.AccountResource(this.http);
177
214
  this.apiKeys = new api_keys_js_1.ApiKeysNamespace(this.http);
178
- this.members = new members_js_1.MembersNamespace(this.http);
215
+ this.users = new users_js_1.UsersNamespace(this.http);
216
+ this.roles = new roles_js_1.RolesNamespace(this.http);
217
+ this.systems = new systems_js_1.SystemsNamespace(this.http);
179
218
  this.nodes = new nodes_js_1.NodesNamespace(this.http);
180
219
  this.eggs = new eggs_js_1.EggsNamespace(this.http);
181
220
  this.hosts = new hosts_js_1.HostsNamespace(this.http);
182
221
  this.serverGroups = new server_groups_js_1.ServerGroupsNamespace(this.http);
183
222
  this.servers = new index_js_1.ServersNamespace(this.http);
223
+ this.features = new features_js_1.FeaturesResource(this.http);
224
+ this.logs = new logs_js_1.LogsResource(this.http);
184
225
  }
185
226
  /**
186
227
  * Update the bearer token used for all subsequent API requests.
@@ -199,7 +240,7 @@ class MeowPanelApi {
199
240
  * Create a panel-level Server-Sent Events connection to Nexus.
200
241
  *
201
242
  * The panel SSE stream (`GET /v1/sse`) broadcasts events for mutations
202
- * across the panel (e.g. server updates, member changes).
243
+ * across the panel (e.g. server updates, user changes).
203
244
  *
204
245
  * The connection is not opened until you call `.connect()` on the returned object.
205
246
  *
@@ -105,12 +105,12 @@ export declare class HttpClient {
105
105
  */
106
106
  patch<T = void>(path: string, body?: unknown, opts?: RequestOptions): Promise<T>;
107
107
  /**
108
- * DELETE a resource.
108
+ * DELETE a resource. Returns `undefined` for `204 No Content`, otherwise the parsed body.
109
109
  *
110
110
  * @param path Path relative to the API base URL.
111
111
  * @param opts Additional request options.
112
112
  */
113
- delete(path: string, opts?: RequestOptions): Promise<void>;
113
+ delete<T = void>(path: string, opts?: RequestOptions): Promise<T>;
114
114
  /**
115
115
  * PUT raw body content (e.g. for binary or multipart uploads).
116
116
  *
@@ -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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EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GACjE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAwBxB"}
@@ -188,13 +188,16 @@ class HttpClient {
188
188
  return res.json();
189
189
  }
190
190
  /**
191
- * DELETE a resource.
191
+ * DELETE a resource. Returns `undefined` for `204 No Content`, otherwise the parsed body.
192
192
  *
193
193
  * @param path Path relative to the API base URL.
194
194
  * @param opts Additional request options.
195
195
  */
196
196
  async delete(path, opts = {}) {
197
- await this.fetch(path, { method: 'DELETE', signal: opts.signal }, opts.params);
197
+ const res = await this.fetch(path, { method: 'DELETE', signal: opts.signal }, opts.params);
198
+ if (res.status === 204)
199
+ return undefined;
200
+ return res.json();
198
201
  }
199
202
  /**
200
203
  * PUT raw body content (e.g. for binary or multipart uploads).
@@ -2,7 +2,7 @@ import { TypedEmitter } from './emitter.js';
2
2
  import type { HttpClient } from './http.js';
3
3
  import type { NanoID } from './types.js';
4
4
  /**
5
- * Base class for all resource namespaces (e.g. `api.servers`, `api.members`).
5
+ * Base class for all resource namespaces (e.g. `api.servers`, `api.users`).
6
6
  *
7
7
  * Provides:
8
8
  * - A **readable store** so reactive consumers can auto-subscribe with `$api.servers`, etc.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResourceNamespace = void 0;
4
4
  const emitter_js_1 = require("./emitter.js");
5
5
  /**
6
- * Base class for all resource namespaces (e.g. `api.servers`, `api.members`).
6
+ * Base class for all resource namespaces (e.g. `api.servers`, `api.users`).
7
7
  *
8
8
  * Provides:
9
9
  * - A **readable store** so reactive consumers can auto-subscribe with `$api.servers`, etc.
@@ -1,32 +1,41 @@
1
1
  import type { HttpClient } from '../http.js';
2
2
  import { ReactiveResource } from '../reactive.js';
3
- import type { IncludeOptions, ISODate, NanoID } from '../types.js';
4
- /** Shared fields present on all account responses. @internal */
3
+ import type { IncludeOptions, ISODate, NanoID, Paginated } from '../types.js';
4
+ import type { UiTheme, UserPreferences, UserPreferencesData } from './users.js';
5
+ import { type ActivityFeedOptions, type ActivityLog } from './servers/activity.js';
6
+ import { type RequestLog, type RequestLogFeedOptions } from './request-logs.js';
7
+ /**
8
+ * Shared issuer-envelope fields present on all account responses.
9
+ *
10
+ * `id` is the namespaced `"<type>:<id>"` form and `ref_id` holds the bare id.
11
+ * @internal
12
+ */
5
13
  interface AccountDataBase {
6
14
  id: string;
7
- issuer_type: string;
15
+ type: string;
16
+ ref_id: string;
8
17
  permissions?: string[];
9
18
  created_at: ISODate;
10
19
  updated_at: ISODate;
11
20
  }
12
21
  /** Raw API shape for a user account. @internal */
13
22
  interface UserAccountData extends AccountDataBase {
14
- issuer_type: 'user';
23
+ type: 'user';
15
24
  email: string;
25
+ email_verified_at: ISODate | null;
16
26
  nickname: string | null;
17
27
  avatar_uri: string | null;
18
- display?: {
19
- language: string | null;
20
- theme: string | null;
21
- } | null;
28
+ disabled_at: ISODate | null;
29
+ preferences?: UserPreferencesData | null;
22
30
  }
23
31
  /** Raw API shape for an API key account. @internal */
24
32
  interface ApiKeyAccountData extends AccountDataBase {
25
- issuer_type: 'api_key';
33
+ type: 'api_key';
26
34
  name: string;
27
35
  description: string | null;
28
36
  owner_id: string;
29
37
  owner?: UserAccountData;
38
+ revoked_at: ISODate | null;
30
39
  }
31
40
  type AccountData = UserAccountData | ApiKeyAccountData;
32
41
  /**
@@ -52,16 +61,17 @@ export declare abstract class Account extends ReactiveResource {
52
61
  export declare class UserAccount extends Account {
53
62
  readonly issuerType: "user";
54
63
  email: string;
64
+ /** When this user verified their email, or `null` if unverified. */
65
+ emailVerifiedAt: Date | null;
55
66
  nickname: string | null;
56
67
  avatarUri: string | null;
68
+ /** When this account was disabled, or `null` if active. */
69
+ disabledAt: Date | null;
57
70
  /**
58
- * Display preferences. Populated with `include=display`.
59
- * Requires `member.display.read` permission or being the account owner.
71
+ * Display and locale preferences. Populated with `include=preferences`.
72
+ * Requires `user.preferences.read` permission or being the account owner.
60
73
  */
61
- display: {
62
- language: string | null;
63
- theme: string | null;
64
- } | undefined;
74
+ preferences: UserPreferences | undefined;
65
75
  /** @internal */
66
76
  constructor(data: UserAccountData, http: HttpClient);
67
77
  /** Update this user account in place. */
@@ -74,9 +84,14 @@ export declare class ApiKeyAccount extends Account {
74
84
  readonly issuerType: "api_key";
75
85
  name: string;
76
86
  description: string | null;
87
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). */
77
88
  readonly ownerId: NanoID;
78
- /** The owner user. */
89
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
90
+ readonly ownerType: string;
91
+ /** The owner. Requires `?include=owner`. */
79
92
  owner: UserAccount | undefined;
93
+ /** When this key was revoked, or `null` if active. */
94
+ revokedAt: Date | null;
80
95
  /** @internal */
81
96
  constructor(data: ApiKeyAccountData, http: HttpClient);
82
97
  }
@@ -133,13 +148,13 @@ export declare class AccountSshKeysManager {
133
148
  delete(id: NanoID): Promise<void>;
134
149
  }
135
150
  /** Valid include keys for the account endpoint. */
136
- export type AccountInclude = 'display' | 'permissions';
151
+ export type AccountInclude = 'preferences' | 'permissions';
137
152
  /** Fields that can be updated on a user account. */
138
153
  export interface UpdateAccountPayload {
139
154
  nickname?: string;
140
- display?: {
155
+ preferences?: {
156
+ theme?: UiTheme;
141
157
  language?: string | null;
142
- theme?: string | null;
143
158
  };
144
159
  }
145
160
  /**
@@ -172,6 +187,22 @@ export declare class AccountResource {
172
187
  fetchAvatar(): Promise<Blob>;
173
188
  /** Fetch the permission scopes available to the current account. */
174
189
  scopes(): Promise<string[]>;
190
+ /**
191
+ * Fetch the current account's activity feed (actions performed on this account).
192
+ *
193
+ * Only user accounts have an activity feed.
194
+ *
195
+ * @param opts Pagination and filter options.
196
+ */
197
+ activities(opts?: ActivityFeedOptions): Promise<Paginated<ActivityLog>>;
198
+ /**
199
+ * Fetch the current account's own HTTP request log.
200
+ *
201
+ * Scoped to the caller; no permission beyond being that account is required.
202
+ *
203
+ * @param opts Pagination, filters, and includes.
204
+ */
205
+ requestLogs(opts?: RequestLogFeedOptions): Promise<Paginated<RequestLog>>;
175
206
  /** Manage SSH public keys on the current user account. */
176
207
  get sshKeys(): AccountSshKeysManager;
177
208
  }
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGnE,gEAAgE;AAChE,UAAU,eAAe;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,kDAAkD;AAClD,UAAU,eAAgB,SAAQ,eAAe;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE;QACT,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,GAAG,IAAI,CAAC;CACT;AAED,sDAAsD;AACtD,UAAU,iBAAkB,SAAQ,eAAe;IAClD,WAAW,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;CACxB;AAED,KAAK,WAAW,GAAG,eAAe,GAAG,iBAAiB,CAAC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Module", { value: true });
3
3
  exports.AccountResource = exports.AccountSshKeysManager = exports.SshKey = exports.ApiKeyAccount = exports.UserAccount = exports.Account = void 0;
4
4
  const reactive_js_1 = require("../reactive.js");
5
5
  const types_js_1 = require("../types.js");
6
+ const activity_js_1 = require("./servers/activity.js");
7
+ const request_logs_js_1 = require("./request-logs.js");
6
8
  /**
7
9
  * Base class for the authenticated account.
8
10
  *
@@ -18,7 +20,7 @@ class Account extends reactive_js_1.ReactiveResource {
18
20
  constructor(data, http) {
19
21
  super();
20
22
  this.http = http;
21
- this.id = (0, types_js_1.toNanoID)(data.id);
23
+ this.id = data.ref_id ? (0, types_js_1.toNanoID)(data.ref_id) : (0, types_js_1.parseIssuerRef)(data.id).id;
22
24
  this.permissions = data.permissions;
23
25
  this.createdAt = new Date(data.created_at);
24
26
  this.updatedAt = new Date(data.updated_at);
@@ -31,13 +33,13 @@ class Account extends reactive_js_1.ReactiveResource {
31
33
  }
32
34
  /** @internal */
33
35
  static create(data, http) {
34
- switch (data.issuer_type) {
36
+ switch (data.type) {
35
37
  case 'user':
36
38
  return new UserAccount(data, http);
37
39
  case 'api_key':
38
40
  return new ApiKeyAccount(data, http);
39
41
  default:
40
- throw new Error(`Unknown account issuer type: ${data.issuer_type}`);
42
+ throw new Error(`Unknown account issuer type: ${data.type}`);
41
43
  }
42
44
  }
43
45
  }
@@ -46,29 +48,37 @@ exports.Account = Account;
46
48
  class UserAccount extends Account {
47
49
  issuerType = 'user';
48
50
  email;
51
+ /** When this user verified their email, or `null` if unverified. */
52
+ emailVerifiedAt;
49
53
  nickname;
50
54
  avatarUri;
55
+ /** When this account was disabled, or `null` if active. */
56
+ disabledAt;
51
57
  /**
52
- * Display preferences. Populated with `include=display`.
53
- * Requires `member.display.read` permission or being the account owner.
58
+ * Display and locale preferences. Populated with `include=preferences`.
59
+ * Requires `user.preferences.read` permission or being the account owner.
54
60
  */
55
- display;
61
+ preferences;
56
62
  /** @internal */
57
63
  constructor(data, http) {
58
64
  super(data, http);
59
65
  this.email = data.email;
66
+ this.emailVerifiedAt = data.email_verified_at ? new Date(data.email_verified_at) : null;
60
67
  this.nickname = data.nickname;
61
68
  this.avatarUri = data.avatar_uri;
62
- this.display = data.display ?? undefined;
69
+ this.disabledAt = data.disabled_at ? new Date(data.disabled_at) : null;
70
+ this.preferences = data.preferences ?? undefined;
63
71
  }
64
72
  /** Update this user account in place. */
65
73
  async update(payload) {
66
74
  await this.http.patch('/account', payload);
67
- const data = await this.http.get('/account');
75
+ const data = await this.http.get('/account', { params: { include: 'preferences,permissions' } });
68
76
  this.email = data.email;
77
+ this.emailVerifiedAt = data.email_verified_at ? new Date(data.email_verified_at) : null;
69
78
  this.nickname = data.nickname;
70
79
  this.avatarUri = data.avatar_uri;
71
- this.display = data.display ?? undefined;
80
+ this.disabledAt = data.disabled_at ? new Date(data.disabled_at) : null;
81
+ this.preferences = data.preferences ?? undefined;
72
82
  this.permissions = data.permissions;
73
83
  this.createdAt = new Date(data.created_at);
74
84
  this.updatedAt = new Date(data.updated_at);
@@ -86,16 +96,24 @@ class ApiKeyAccount extends Account {
86
96
  issuerType = 'api_key';
87
97
  name;
88
98
  description;
99
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). */
89
100
  ownerId;
90
- /** The owner user. */
101
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
102
+ ownerType;
103
+ /** The owner. Requires `?include=owner`. */
91
104
  owner;
105
+ /** When this key was revoked, or `null` if active. */
106
+ revokedAt;
92
107
  /** @internal */
93
108
  constructor(data, http) {
94
109
  super(data, http);
95
110
  this.name = data.name;
96
111
  this.description = data.description;
97
- this.ownerId = (0, types_js_1.toNanoID)(data.owner_id);
112
+ const owner = (0, types_js_1.parseIssuerRef)(data.owner_id);
113
+ this.ownerId = owner.id;
114
+ this.ownerType = owner.type;
98
115
  this.owner = data.owner ? new UserAccount(data.owner, http) : undefined;
116
+ this.revokedAt = data.revoked_at ? new Date(data.revoked_at) : null;
99
117
  }
100
118
  }
101
119
  exports.ApiKeyAccount = ApiKeyAccount;
@@ -192,7 +210,7 @@ class AccountResource {
192
210
  /** Update the current user account. Only works for user accounts. */
193
211
  async update(payload) {
194
212
  await this.http.patch('/account', payload);
195
- const data = await this.http.get('/account');
213
+ const data = await this.http.get('/account', { params: { include: 'preferences,permissions' } });
196
214
  return new UserAccount(data, this.http);
197
215
  }
198
216
  /** Upload a new avatar image. Only works for user accounts. */
@@ -213,6 +231,26 @@ class AccountResource {
213
231
  scopes() {
214
232
  return this.http.get('/account/scopes');
215
233
  }
234
+ /**
235
+ * Fetch the current account's activity feed (actions performed on this account).
236
+ *
237
+ * Only user accounts have an activity feed.
238
+ *
239
+ * @param opts Pagination and filter options.
240
+ */
241
+ activities(opts = {}) {
242
+ return (0, activity_js_1.listActivities)(this.http, '/account/activities', opts);
243
+ }
244
+ /**
245
+ * Fetch the current account's own HTTP request log.
246
+ *
247
+ * Scoped to the caller; no permission beyond being that account is required.
248
+ *
249
+ * @param opts Pagination, filters, and includes.
250
+ */
251
+ requestLogs(opts = {}) {
252
+ return (0, request_logs_js_1.listRequestLogs)(this.http, '/account/logs', opts);
253
+ }
216
254
  /** Manage SSH public keys on the current user account. */
217
255
  get sshKeys() {
218
256
  return new AccountSshKeysManager(this.http);