@meowpanel/api 0.1.0-alpha.11 → 1.0.0-beta.2

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 (297) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +40 -0
  3. package/esm/mod.d.ts +87 -1
  4. package/esm/mod.d.ts.map +1 -1
  5. package/esm/mod.js +85 -1
  6. package/esm/src/client.d.ts +248 -0
  7. package/esm/src/client.d.ts.map +1 -0
  8. package/esm/src/client.js +235 -0
  9. package/esm/src/emitter.d.ts +53 -0
  10. package/esm/src/emitter.d.ts.map +1 -0
  11. package/esm/src/emitter.js +55 -0
  12. package/esm/src/errors.d.ts +42 -0
  13. package/esm/src/errors.d.ts.map +1 -0
  14. package/esm/src/errors.js +45 -0
  15. package/esm/src/http.d.ts +157 -0
  16. package/esm/src/http.d.ts.map +1 -0
  17. package/esm/src/http.js +317 -0
  18. package/esm/src/namespace.d.ts +59 -0
  19. package/esm/src/namespace.d.ts.map +1 -0
  20. package/esm/src/namespace.js +79 -0
  21. package/esm/src/reactive.d.ts +29 -0
  22. package/esm/src/reactive.d.ts.map +1 -0
  23. package/esm/src/reactive.js +35 -0
  24. package/esm/src/resources/account.d.ts +125 -0
  25. package/esm/src/resources/account.d.ts.map +1 -0
  26. package/esm/src/resources/account.js +151 -0
  27. package/esm/src/resources/api-keys.d.ts +116 -0
  28. package/esm/src/resources/api-keys.d.ts.map +1 -0
  29. package/esm/src/resources/api-keys.js +105 -0
  30. package/esm/src/resources/auth.d.ts +57 -0
  31. package/esm/src/resources/auth.d.ts.map +1 -0
  32. package/esm/src/resources/auth.js +39 -0
  33. package/esm/src/resources/eggs.d.ts +238 -0
  34. package/esm/src/resources/eggs.d.ts.map +1 -0
  35. package/esm/src/resources/eggs.js +187 -0
  36. package/esm/src/resources/hosts.d.ts +62 -0
  37. package/esm/src/resources/hosts.d.ts.map +1 -0
  38. package/esm/src/resources/hosts.js +62 -0
  39. package/esm/src/resources/members.d.ts +138 -0
  40. package/esm/src/resources/members.d.ts.map +1 -0
  41. package/esm/src/resources/members.js +122 -0
  42. package/esm/src/resources/nodes.d.ts +397 -0
  43. package/esm/src/resources/nodes.d.ts.map +1 -0
  44. package/esm/src/resources/nodes.js +352 -0
  45. package/esm/src/resources/server-groups.d.ts +150 -0
  46. package/esm/src/resources/server-groups.d.ts.map +1 -0
  47. package/esm/src/resources/server-groups.js +111 -0
  48. package/esm/src/resources/servers/activity.d.ts +120 -0
  49. package/esm/src/resources/servers/activity.d.ts.map +1 -0
  50. package/esm/src/resources/servers/activity.js +163 -0
  51. package/esm/src/resources/servers/allocations.d.ts +125 -0
  52. package/esm/src/resources/servers/allocations.d.ts.map +1 -0
  53. package/esm/src/resources/servers/allocations.js +137 -0
  54. package/esm/src/resources/servers/connection.d.ts +108 -0
  55. package/esm/src/resources/servers/connection.d.ts.map +1 -0
  56. package/esm/src/resources/servers/connection.js +169 -0
  57. package/esm/src/resources/servers/files.d.ts +164 -0
  58. package/esm/src/resources/servers/files.d.ts.map +1 -0
  59. package/esm/src/resources/servers/files.js +281 -0
  60. package/esm/src/resources/servers/index.d.ts +126 -0
  61. package/esm/src/resources/servers/index.d.ts.map +1 -0
  62. package/esm/src/resources/servers/index.js +135 -0
  63. package/esm/src/resources/servers/profiles.d.ts +138 -0
  64. package/esm/src/resources/servers/profiles.d.ts.map +1 -0
  65. package/esm/src/resources/servers/profiles.js +177 -0
  66. package/esm/src/resources/servers/server.d.ts +136 -0
  67. package/esm/src/resources/servers/server.d.ts.map +1 -0
  68. package/esm/src/resources/servers/server.js +202 -0
  69. package/esm/src/resources/servers/sftp.d.ts +147 -0
  70. package/esm/src/resources/servers/sftp.d.ts.map +1 -0
  71. package/esm/src/resources/servers/sftp.js +153 -0
  72. package/esm/src/resources/servers/types.d.ts +199 -0
  73. package/esm/src/resources/servers/types.d.ts.map +1 -0
  74. package/esm/src/resources/servers/types.js +1 -0
  75. package/esm/src/sse.d.ts +53 -0
  76. package/esm/src/sse.d.ts.map +1 -0
  77. package/esm/src/sse.js +133 -0
  78. package/esm/src/types.d.ts +126 -0
  79. package/esm/src/types.d.ts.map +1 -0
  80. package/esm/src/types.js +21 -0
  81. package/package.json +4 -92
  82. package/script/mod.d.ts +87 -1
  83. package/script/mod.d.ts.map +1 -1
  84. package/script/mod.js +132 -3
  85. package/script/src/client.d.ts +248 -0
  86. package/script/src/client.d.ts.map +1 -0
  87. package/script/src/client.js +239 -0
  88. package/script/src/emitter.d.ts +53 -0
  89. package/script/src/emitter.d.ts.map +1 -0
  90. package/script/src/emitter.js +59 -0
  91. package/script/src/errors.d.ts +42 -0
  92. package/script/src/errors.d.ts.map +1 -0
  93. package/script/src/errors.js +49 -0
  94. package/script/src/http.d.ts +157 -0
  95. package/script/src/http.d.ts.map +1 -0
  96. package/script/src/http.js +321 -0
  97. package/script/src/namespace.d.ts +59 -0
  98. package/script/src/namespace.d.ts.map +1 -0
  99. package/script/src/namespace.js +83 -0
  100. package/script/src/reactive.d.ts +29 -0
  101. package/script/src/reactive.d.ts.map +1 -0
  102. package/script/src/reactive.js +39 -0
  103. package/script/src/resources/account.d.ts +125 -0
  104. package/script/src/resources/account.d.ts.map +1 -0
  105. package/script/src/resources/account.js +158 -0
  106. package/script/src/resources/api-keys.d.ts +116 -0
  107. package/script/src/resources/api-keys.d.ts.map +1 -0
  108. package/script/src/resources/api-keys.js +110 -0
  109. package/script/src/resources/auth.d.ts +57 -0
  110. package/script/src/resources/auth.d.ts.map +1 -0
  111. package/script/src/resources/auth.js +43 -0
  112. package/script/src/resources/eggs.d.ts +238 -0
  113. package/script/src/resources/eggs.d.ts.map +1 -0
  114. package/script/src/resources/eggs.js +193 -0
  115. package/script/src/resources/hosts.d.ts +62 -0
  116. package/script/src/resources/hosts.d.ts.map +1 -0
  117. package/script/src/resources/hosts.js +67 -0
  118. package/script/src/resources/members.d.ts +138 -0
  119. package/script/src/resources/members.d.ts.map +1 -0
  120. package/script/src/resources/members.js +127 -0
  121. package/script/src/resources/nodes.d.ts +397 -0
  122. package/script/src/resources/nodes.d.ts.map +1 -0
  123. package/script/src/resources/nodes.js +362 -0
  124. package/script/src/resources/server-groups.d.ts +150 -0
  125. package/script/src/resources/server-groups.d.ts.map +1 -0
  126. package/script/src/resources/server-groups.js +116 -0
  127. package/script/src/resources/servers/activity.d.ts +120 -0
  128. package/script/src/resources/servers/activity.d.ts.map +1 -0
  129. package/script/src/resources/servers/activity.js +170 -0
  130. package/script/src/resources/servers/allocations.d.ts +125 -0
  131. package/script/src/resources/servers/allocations.d.ts.map +1 -0
  132. package/script/src/resources/servers/allocations.js +142 -0
  133. package/script/src/resources/servers/connection.d.ts +108 -0
  134. package/script/src/resources/servers/connection.d.ts.map +1 -0
  135. package/script/src/resources/servers/connection.js +173 -0
  136. package/script/src/resources/servers/files.d.ts +164 -0
  137. package/script/src/resources/servers/files.d.ts.map +1 -0
  138. package/script/src/resources/servers/files.js +286 -0
  139. package/script/src/resources/servers/index.d.ts +126 -0
  140. package/script/src/resources/servers/index.d.ts.map +1 -0
  141. package/script/src/resources/servers/index.js +139 -0
  142. package/script/src/resources/servers/profiles.d.ts +138 -0
  143. package/script/src/resources/servers/profiles.d.ts.map +1 -0
  144. package/script/src/resources/servers/profiles.js +182 -0
  145. package/script/src/resources/servers/server.d.ts +136 -0
  146. package/script/src/resources/servers/server.d.ts.map +1 -0
  147. package/script/src/resources/servers/server.js +206 -0
  148. package/script/src/resources/servers/sftp.d.ts +147 -0
  149. package/script/src/resources/servers/sftp.d.ts.map +1 -0
  150. package/script/src/resources/servers/sftp.js +158 -0
  151. package/script/src/resources/servers/types.d.ts +199 -0
  152. package/script/src/resources/servers/types.d.ts.map +1 -0
  153. package/script/src/resources/servers/types.js +2 -0
  154. package/script/src/sse.d.ts +53 -0
  155. package/script/src/sse.d.ts.map +1 -0
  156. package/script/src/sse.js +137 -0
  157. package/script/src/types.d.ts +126 -0
  158. package/script/src/types.d.ts.map +1 -0
  159. package/script/src/types.js +25 -0
  160. package/esm/api.d.ts +0 -76
  161. package/esm/api.d.ts.map +0 -1
  162. package/esm/api.js +0 -187
  163. package/esm/components/auth.d.ts +0 -15
  164. package/esm/components/auth.d.ts.map +0 -1
  165. package/esm/components/auth.js +0 -13
  166. package/esm/components/connection/abstract.d.ts +0 -23
  167. package/esm/components/connection/abstract.d.ts.map +0 -1
  168. package/esm/components/connection/abstract.js +0 -43
  169. package/esm/components/connection/sse.d.ts +0 -20
  170. package/esm/components/connection/sse.d.ts.map +0 -1
  171. package/esm/components/connection/sse.js +0 -65
  172. package/esm/components/egg/egg.d.ts +0 -32
  173. package/esm/components/egg/egg.d.ts.map +0 -1
  174. package/esm/components/egg/egg.js +0 -70
  175. package/esm/components/group.d.ts +0 -14
  176. package/esm/components/group.d.ts.map +0 -1
  177. package/esm/components/group.js +0 -33
  178. package/esm/components/member_2.d.ts +0 -69
  179. package/esm/components/member_2.d.ts.map +0 -1
  180. package/esm/components/member_2.js +0 -140
  181. package/esm/components/node.d.ts +0 -78
  182. package/esm/components/node.d.ts.map +0 -1
  183. package/esm/components/node.js +0 -342
  184. package/esm/components/server/activity.d.ts +0 -45
  185. package/esm/components/server/activity.d.ts.map +0 -1
  186. package/esm/components/server/activity.js +0 -158
  187. package/esm/components/server/allocations.d.ts +0 -45
  188. package/esm/components/server/allocations.d.ts.map +0 -1
  189. package/esm/components/server/allocations.js +0 -146
  190. package/esm/components/server/files.d.ts +0 -50
  191. package/esm/components/server/files.d.ts.map +0 -1
  192. package/esm/components/server/files.js +0 -90
  193. package/esm/components/server/power.d.ts +0 -21
  194. package/esm/components/server/power.d.ts.map +0 -1
  195. package/esm/components/server/power.js +0 -43
  196. package/esm/components/server/profiles.d.ts +0 -63
  197. package/esm/components/server/profiles.d.ts.map +0 -1
  198. package/esm/components/server/profiles.js +0 -163
  199. package/esm/components/server/server.d.ts +0 -141
  200. package/esm/components/server/server.d.ts.map +0 -1
  201. package/esm/components/server/server.js +0 -358
  202. package/esm/components/server/sftp.d.ts +0 -31
  203. package/esm/components/server/sftp.d.ts.map +0 -1
  204. package/esm/components/server/sftp.js +0 -84
  205. package/esm/components/server/startup.d.ts +0 -17
  206. package/esm/components/server/startup.d.ts.map +0 -1
  207. package/esm/components/server/startup.js +0 -21
  208. package/esm/components/server/stats.d.ts +0 -19
  209. package/esm/components/server/stats.d.ts.map +0 -1
  210. package/esm/components/server/stats.js +0 -46
  211. package/esm/utils/cache.d.ts +0 -20
  212. package/esm/utils/cache.d.ts.map +0 -1
  213. package/esm/utils/cache.js +0 -66
  214. package/esm/utils/event.d.ts +0 -38
  215. package/esm/utils/event.d.ts.map +0 -1
  216. package/esm/utils/event.js +0 -71
  217. package/esm/utils/object.d.ts +0 -58
  218. package/esm/utils/object.d.ts.map +0 -1
  219. package/esm/utils/object.js +0 -86
  220. package/esm/utils/subscribe.d.ts +0 -37
  221. package/esm/utils/subscribe.d.ts.map +0 -1
  222. package/esm/utils/subscribe.js +0 -29
  223. package/esm/utils/timer.d.ts +0 -13
  224. package/esm/utils/timer.d.ts.map +0 -1
  225. package/esm/utils/timer.js +0 -32
  226. package/esm/utils/units.d.ts +0 -18
  227. package/esm/utils/units.d.ts.map +0 -1
  228. package/esm/utils/units.js +0 -82
  229. package/script/api.d.ts +0 -76
  230. package/script/api.d.ts.map +0 -1
  231. package/script/api.js +0 -192
  232. package/script/components/auth.d.ts +0 -15
  233. package/script/components/auth.d.ts.map +0 -1
  234. package/script/components/auth.js +0 -17
  235. package/script/components/connection/abstract.d.ts +0 -23
  236. package/script/components/connection/abstract.d.ts.map +0 -1
  237. package/script/components/connection/abstract.js +0 -47
  238. package/script/components/connection/sse.d.ts +0 -20
  239. package/script/components/connection/sse.d.ts.map +0 -1
  240. package/script/components/connection/sse.js +0 -69
  241. package/script/components/egg/egg.d.ts +0 -32
  242. package/script/components/egg/egg.d.ts.map +0 -1
  243. package/script/components/egg/egg.js +0 -74
  244. package/script/components/group.d.ts +0 -14
  245. package/script/components/group.d.ts.map +0 -1
  246. package/script/components/group.js +0 -37
  247. package/script/components/member_2.d.ts +0 -69
  248. package/script/components/member_2.d.ts.map +0 -1
  249. package/script/components/member_2.js +0 -146
  250. package/script/components/node.d.ts +0 -78
  251. package/script/components/node.d.ts.map +0 -1
  252. package/script/components/node.js +0 -349
  253. package/script/components/server/activity.d.ts +0 -45
  254. package/script/components/server/activity.d.ts.map +0 -1
  255. package/script/components/server/activity.js +0 -164
  256. package/script/components/server/allocations.d.ts +0 -45
  257. package/script/components/server/allocations.d.ts.map +0 -1
  258. package/script/components/server/allocations.js +0 -152
  259. package/script/components/server/files.d.ts +0 -50
  260. package/script/components/server/files.d.ts.map +0 -1
  261. package/script/components/server/files.js +0 -94
  262. package/script/components/server/power.d.ts +0 -21
  263. package/script/components/server/power.d.ts.map +0 -1
  264. package/script/components/server/power.js +0 -47
  265. package/script/components/server/profiles.d.ts +0 -63
  266. package/script/components/server/profiles.d.ts.map +0 -1
  267. package/script/components/server/profiles.js +0 -168
  268. package/script/components/server/server.d.ts +0 -141
  269. package/script/components/server/server.d.ts.map +0 -1
  270. package/script/components/server/server.js +0 -362
  271. package/script/components/server/sftp.d.ts +0 -31
  272. package/script/components/server/sftp.d.ts.map +0 -1
  273. package/script/components/server/sftp.js +0 -88
  274. package/script/components/server/startup.d.ts +0 -17
  275. package/script/components/server/startup.d.ts.map +0 -1
  276. package/script/components/server/startup.js +0 -25
  277. package/script/components/server/stats.d.ts +0 -19
  278. package/script/components/server/stats.d.ts.map +0 -1
  279. package/script/components/server/stats.js +0 -50
  280. package/script/utils/cache.d.ts +0 -20
  281. package/script/utils/cache.d.ts.map +0 -1
  282. package/script/utils/cache.js +0 -70
  283. package/script/utils/event.d.ts +0 -38
  284. package/script/utils/event.d.ts.map +0 -1
  285. package/script/utils/event.js +0 -75
  286. package/script/utils/object.d.ts +0 -58
  287. package/script/utils/object.d.ts.map +0 -1
  288. package/script/utils/object.js +0 -90
  289. package/script/utils/subscribe.d.ts +0 -37
  290. package/script/utils/subscribe.d.ts.map +0 -1
  291. package/script/utils/subscribe.js +0 -32
  292. package/script/utils/timer.d.ts +0 -13
  293. package/script/utils/timer.d.ts.map +0 -1
  294. package/script/utils/timer.js +0 -36
  295. package/script/utils/units.d.ts +0 -18
  296. package/script/utils/units.d.ts.map +0 -1
  297. package/script/utils/units.js +0 -86
@@ -0,0 +1,238 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { ResourceNamespace } from '../namespace.js';
3
+ import { ReactiveResource } from '../reactive.js';
4
+ import type { IncludeOptions, ResourceWith } from '../types.js';
5
+ import { type ISODate, type NanoID, type Paginated } from '../types.js';
6
+ /** Raw API shape for an egg nest (category). @internal */
7
+ export interface EggNestData {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ /** Raw API shape for an egg installer. @internal */
12
+ export interface EggInstallerData {
13
+ image: string | null;
14
+ entry_command: string | null;
15
+ script: string | null;
16
+ }
17
+ /** Raw API shape for an egg image. @internal */
18
+ export interface EggImageData {
19
+ id: string;
20
+ name: string;
21
+ image: string;
22
+ created_at: ISODate;
23
+ updated_at: ISODate;
24
+ }
25
+ /** Raw API shape for egg process configuration. @internal */
26
+ interface EggProcessData {
27
+ startup: Record<string, unknown>;
28
+ stop: {
29
+ type: 'signal' | 'command';
30
+ value: string;
31
+ };
32
+ logs: Record<string, unknown>;
33
+ files: unknown[];
34
+ file_blacklist_regex: string;
35
+ }
36
+ /** Raw API shape for an egg. @internal */
37
+ export interface EggData {
38
+ id: string;
39
+ name: string;
40
+ description: string | null;
41
+ nest?: EggNestData | null;
42
+ startup_command: string;
43
+ stop_command: string;
44
+ force_outgoing_ip: boolean;
45
+ installer?: EggInstallerData | null;
46
+ process?: EggProcessData | null;
47
+ images?: EggImageData[];
48
+ created_at: ISODate;
49
+ updated_at: ISODate;
50
+ }
51
+ /**
52
+ * A category (nest) that groups related eggs.
53
+ */
54
+ export declare class EggNest extends ReactiveResource {
55
+ /** Unique NanoID of this nest. */
56
+ readonly id: NanoID;
57
+ /** Display name of the nest, e.g. `"Minecraft"`. */
58
+ name: string;
59
+ /** @internal */
60
+ constructor(data: EggNestData);
61
+ }
62
+ /**
63
+ * An egg image (Docker image variant) associated with an egg.
64
+ */
65
+ export interface EggImage {
66
+ /** The egg image's unique NanoID. */
67
+ id: NanoID;
68
+ /** Display name of this image variant. */
69
+ name: string;
70
+ /** Docker image reference, e.g. `"ghcr.io/parkervcp/yolks:java_21"`. */
71
+ image: string;
72
+ /** When this image was created. */
73
+ createdAt: Date;
74
+ /** When this image was last updated. */
75
+ updatedAt: Date;
76
+ }
77
+ /**
78
+ * Process configuration for an egg (startup, stop, logging).
79
+ */
80
+ export interface EggProcess {
81
+ /** Startup configuration. */
82
+ startup: Record<string, unknown>;
83
+ /** Stop configuration. */
84
+ stop: {
85
+ type: 'signal' | 'command';
86
+ value: string;
87
+ };
88
+ /** Log configuration. */
89
+ logs: Record<string, unknown>;
90
+ /** File configuration. */
91
+ files: unknown[];
92
+ /** Regex pattern for blacklisted files. */
93
+ fileBlacklistRegex: string;
94
+ }
95
+ /**
96
+ * The installation script configuration for an egg.
97
+ */
98
+ export interface EggInstaller {
99
+ /** Docker image used to run the installer script. */
100
+ image: string | null;
101
+ /** Entry command for the installer container. */
102
+ entryCommand: string | null;
103
+ /** The install script content. */
104
+ script: string | null;
105
+ }
106
+ /**
107
+ * An egg - a game or application configuration template that defines how a server
108
+ * is installed, started, and stopped.
109
+ *
110
+ * Retrieved via {@link EggsNamespace.get} or {@link EggsNamespace.list}.
111
+ */
112
+ export declare class Egg extends ReactiveResource {
113
+ /** The egg's unique NanoID. */
114
+ readonly id: NanoID;
115
+ /** Display name of the egg, e.g. `"Vanilla Minecraft"`. */
116
+ name: string;
117
+ /** Description of the egg. */
118
+ description: string | null;
119
+ /** The nest (category) this egg belongs to. */
120
+ nest: EggNest | null | undefined;
121
+ /**
122
+ * The startup command template, e.g.
123
+ * `"java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}"`.
124
+ */
125
+ startupCommand: string;
126
+ /**
127
+ * The stop command sent to the server to shut it down gracefully,
128
+ * e.g. `"stop"` or `"^C"`.
129
+ */
130
+ stopCommand: string;
131
+ /** When `true`, the server's outgoing IP is forced to match the allocation IP. */
132
+ forceOutgoingIp: boolean;
133
+ /** Installer configuration for this egg. */
134
+ installer: EggInstaller | null | undefined;
135
+ /** Process configuration (startup, stop, logging). */
136
+ process: EggProcess | null | undefined;
137
+ /** Docker image variants for this egg. */
138
+ images: EggImage[] | undefined;
139
+ /** When this egg was created. */
140
+ createdAt: Date;
141
+ /** When this egg was last updated. */
142
+ updatedAt: Date;
143
+ /** @internal */
144
+ constructor(data: EggData);
145
+ }
146
+ /** Fields that can be updated on an egg. All fields are optional. */
147
+ export interface UpdateEggPayload {
148
+ /** New display name. */
149
+ name?: string;
150
+ /** New description. */
151
+ description?: string;
152
+ /** NanoID of a different nest to move the egg to. */
153
+ nestId?: NanoID;
154
+ /** New startup command template. */
155
+ startupCommand?: string;
156
+ /** New stop command. */
157
+ stopCommand?: string;
158
+ /** Update `force_outgoing_ip` setting. */
159
+ forceOutgoingIp?: boolean;
160
+ /** Installer configuration updates. */
161
+ installer?: {
162
+ image?: string;
163
+ entryCommand?: string;
164
+ script?: string;
165
+ };
166
+ }
167
+ /** Valid include keys for egg endpoints. */
168
+ export type EggInclude = 'installer' | 'process' | 'images';
169
+ /** Maps each {@link EggInclude} key to the field(s) it guarantees on the {@link Egg} instance. */
170
+ interface EggIncludeMap {
171
+ installer: {
172
+ installer: EggInstaller | null;
173
+ };
174
+ process: {
175
+ process: EggProcess | null;
176
+ };
177
+ images: {
178
+ images: EggImageData[];
179
+ };
180
+ }
181
+ /** A {@link Egg} with specific include fields guaranteed to be populated. */
182
+ export type EggWith<I extends readonly EggInclude[] = []> = ResourceWith<Egg, EggIncludeMap, I>;
183
+ /** Typed events emitted by {@link EggsNamespace}. */
184
+ export interface EggEvents {
185
+ /** Fired after an egg is successfully updated. */
186
+ updated: Egg;
187
+ /** Fired after an egg is deleted. Payload is the deleted egg's NanoID. */
188
+ deleted: NanoID;
189
+ }
190
+ /**
191
+ * Namespace for egg management.
192
+ *
193
+ * Access via `api.eggs`.
194
+ *
195
+ * @example
196
+ * ```ts ignore
197
+ * const eggs = await api.eggs.list();
198
+ * const egg = await api.eggs.get(id);
199
+ * await api.eggs.update(id, { name: 'Paper Minecraft' });
200
+ * await api.eggs.delete(id);
201
+ * ```
202
+ */
203
+ export declare class EggsNamespace extends ResourceNamespace<Egg, EggEvents> {
204
+ /** @internal */
205
+ constructor(http: HttpClient);
206
+ /**
207
+ * Fetch a paginated list of eggs.
208
+ *
209
+ * @param opts Pagination, search, and include options.
210
+ */
211
+ list<const I extends readonly EggInclude[] = []>(opts?: {
212
+ page?: number;
213
+ perPage?: number;
214
+ search?: string;
215
+ } & IncludeOptions<EggInclude, I>): Promise<Paginated<EggWith<I>>>;
216
+ /**
217
+ * Fetch a single egg by ID.
218
+ *
219
+ * @param id The egg's NanoID.
220
+ * @param opts Include options.
221
+ */
222
+ get<const I extends readonly EggInclude[] = []>(id: NanoID, opts?: IncludeOptions<EggInclude, I>): Promise<EggWith<I>>;
223
+ /**
224
+ * Update an egg's configuration.
225
+ *
226
+ * @param id The egg's NanoID.
227
+ * @param payload The fields to update.
228
+ */
229
+ update(id: NanoID, payload: UpdateEggPayload): Promise<Egg>;
230
+ /**
231
+ * Delete an egg permanently.
232
+ *
233
+ * @param id The egg's NanoID.
234
+ */
235
+ delete(id: NanoID): Promise<void>;
236
+ }
237
+ export {};
238
+ //# sourceMappingURL=eggs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eggs.d.ts","sourceRoot":"","sources":["../../../src/src/resources/eggs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO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,EAC1D,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,cAAc,CAAC,UAAU,EAAE,CAAC,CAAM,GACtC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAQtB;;;;;OAKG;IACU,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC;IA+BxE;;;;OAIG;IACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAK9C"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EggsNamespace = exports.Egg = exports.EggNest = void 0;
4
+ const namespace_js_1 = require("../namespace.js");
5
+ const reactive_js_1 = require("../reactive.js");
6
+ const types_js_1 = require("../types.js");
7
+ /**
8
+ * A category (nest) that groups related eggs.
9
+ */
10
+ class EggNest extends reactive_js_1.ReactiveResource {
11
+ /** Unique NanoID of this nest. */
12
+ id;
13
+ /** Display name of the nest, e.g. `"Minecraft"`. */
14
+ name;
15
+ /** @internal */
16
+ constructor(data) {
17
+ super();
18
+ this.id = (0, types_js_1.toNanoID)(data.id);
19
+ this.name = data.name;
20
+ }
21
+ }
22
+ exports.EggNest = EggNest;
23
+ /**
24
+ * An egg - a game or application configuration template that defines how a server
25
+ * is installed, started, and stopped.
26
+ *
27
+ * Retrieved via {@link EggsNamespace.get} or {@link EggsNamespace.list}.
28
+ */
29
+ class Egg extends reactive_js_1.ReactiveResource {
30
+ /** The egg's unique NanoID. */
31
+ id;
32
+ /** Display name of the egg, e.g. `"Vanilla Minecraft"`. */
33
+ name;
34
+ /** Description of the egg. */
35
+ description;
36
+ /** The nest (category) this egg belongs to. */
37
+ nest;
38
+ /**
39
+ * The startup command template, e.g.
40
+ * `"java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}"`.
41
+ */
42
+ startupCommand;
43
+ /**
44
+ * The stop command sent to the server to shut it down gracefully,
45
+ * e.g. `"stop"` or `"^C"`.
46
+ */
47
+ stopCommand;
48
+ /** When `true`, the server's outgoing IP is forced to match the allocation IP. */
49
+ forceOutgoingIp;
50
+ /** Installer configuration for this egg. */
51
+ installer;
52
+ /** Process configuration (startup, stop, logging). */
53
+ process;
54
+ /** Docker image variants for this egg. */
55
+ images;
56
+ /** When this egg was created. */
57
+ createdAt;
58
+ /** When this egg was last updated. */
59
+ updatedAt;
60
+ /** @internal */
61
+ constructor(data) {
62
+ super();
63
+ this.id = (0, types_js_1.toNanoID)(data.id);
64
+ this.name = data.name;
65
+ this.description = data.description;
66
+ this.nest = data.nest ? new EggNest(data.nest) : data.nest;
67
+ this.startupCommand = data.startup_command;
68
+ this.stopCommand = data.stop_command;
69
+ this.forceOutgoingIp = data.force_outgoing_ip;
70
+ this.installer = data.installer
71
+ ? {
72
+ image: data.installer.image,
73
+ entryCommand: data.installer.entry_command,
74
+ script: data.installer.script,
75
+ }
76
+ : data.installer;
77
+ this.process = data.process
78
+ ? {
79
+ startup: data.process.startup,
80
+ stop: data.process.stop,
81
+ logs: data.process.logs,
82
+ files: data.process.files,
83
+ fileBlacklistRegex: data.process.file_blacklist_regex,
84
+ }
85
+ : data.process;
86
+ this.images = data.images?.map((img) => ({
87
+ id: (0, types_js_1.toNanoID)(img.id),
88
+ name: img.name,
89
+ image: img.image,
90
+ createdAt: new Date(img.created_at),
91
+ updatedAt: new Date(img.updated_at),
92
+ }));
93
+ this.createdAt = new Date(data.created_at);
94
+ this.updatedAt = new Date(data.updated_at);
95
+ }
96
+ }
97
+ exports.Egg = Egg;
98
+ /**
99
+ * Namespace for egg management.
100
+ *
101
+ * Access via `api.eggs`.
102
+ *
103
+ * @example
104
+ * ```ts ignore
105
+ * const eggs = await api.eggs.list();
106
+ * const egg = await api.eggs.get(id);
107
+ * await api.eggs.update(id, { name: 'Paper Minecraft' });
108
+ * await api.eggs.delete(id);
109
+ * ```
110
+ */
111
+ class EggsNamespace extends namespace_js_1.ResourceNamespace {
112
+ /** @internal */
113
+ constructor(http) {
114
+ super(http);
115
+ }
116
+ /**
117
+ * Fetch a paginated list of eggs.
118
+ *
119
+ * @param opts Pagination, search, and include options.
120
+ */
121
+ async list(opts = {}) {
122
+ const extra = {};
123
+ const include = (0, types_js_1.joinIncludes)(opts);
124
+ if (include)
125
+ extra['include'] = include;
126
+ const result = await this.http.list('/eggs', opts, extra);
127
+ const eggs = result.data.map((d) => new Egg(d));
128
+ this.setCache(eggs);
129
+ return { ...result, data: eggs };
130
+ }
131
+ /**
132
+ * Fetch a single egg by ID.
133
+ *
134
+ * @param id The egg's NanoID.
135
+ * @param opts Include options.
136
+ */
137
+ async get(id, opts = {}) {
138
+ const params = {};
139
+ const include = (0, types_js_1.joinIncludes)(opts);
140
+ if (include)
141
+ params['include'] = include;
142
+ const data = await this.http.get(`/eggs/${id}`, { params });
143
+ return new Egg(data);
144
+ }
145
+ /**
146
+ * Update an egg's configuration.
147
+ *
148
+ * @param id The egg's NanoID.
149
+ * @param payload The fields to update.
150
+ */
151
+ async update(id, payload) {
152
+ const body = {};
153
+ if (payload.name !== undefined)
154
+ body['name'] = payload.name;
155
+ if (payload.description !== undefined) {
156
+ body['description'] = payload.description;
157
+ }
158
+ if (payload.nestId !== undefined)
159
+ body['nest_id'] = payload.nestId;
160
+ if (payload.startupCommand !== undefined) {
161
+ body['startup_command'] = payload.startupCommand;
162
+ }
163
+ if (payload.stopCommand !== undefined) {
164
+ body['stop_command'] = payload.stopCommand;
165
+ }
166
+ if (payload.forceOutgoingIp !== undefined) {
167
+ body['force_outgoing_ip'] = payload.forceOutgoingIp;
168
+ }
169
+ if (payload.installer) {
170
+ body['installer'] = {
171
+ image: payload.installer.image,
172
+ entry_command: payload.installer.entryCommand,
173
+ script: payload.installer.script,
174
+ };
175
+ }
176
+ const data = await this.http.patch(`/eggs/${id}`, body);
177
+ const egg = new Egg(data);
178
+ this.upsertCache(egg);
179
+ this.emit('updated', egg);
180
+ return egg;
181
+ }
182
+ /**
183
+ * Delete an egg permanently.
184
+ *
185
+ * @param id The egg's NanoID.
186
+ */
187
+ async delete(id) {
188
+ await this.http.delete(`/eggs/${id}`);
189
+ this.removeFromCache(id);
190
+ this.emit('deleted', id);
191
+ }
192
+ }
193
+ exports.EggsNamespace = EggsNamespace;
@@ -0,0 +1,62 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { ResourceNamespace } from '../namespace.js';
3
+ import { ReactiveResource } from '../reactive.js';
4
+ import { type ISODate, type NanoID, type Paginated } from '../types.js';
5
+ /** Raw API shape for a physical host. @internal */
6
+ export interface HostData {
7
+ id: string;
8
+ hostname: string;
9
+ name?: string | null;
10
+ color?: string | null;
11
+ notes?: string | null;
12
+ created_at: ISODate;
13
+ updated_at: ISODate;
14
+ }
15
+ /**
16
+ * A physical host machine on which nodes are deployed.
17
+ *
18
+ * Retrieved via {@link HostsNamespace.list}.
19
+ */
20
+ export declare class Host extends ReactiveResource {
21
+ /** The host's unique NanoID. */
22
+ readonly id: NanoID;
23
+ /** The host's hostname, e.g. `"host.example.com"`. */
24
+ hostname: string;
25
+ /** Optional display name for the host. */
26
+ name: string | null | undefined;
27
+ /** Optional color used in the UI for grouping. */
28
+ color: string | null | undefined;
29
+ /** Internal notes. */
30
+ notes: string | null | undefined;
31
+ /** When this host was registered. */
32
+ createdAt: Date;
33
+ /** When this host was last updated. */
34
+ updatedAt: Date;
35
+ /** @internal */
36
+ constructor(data: HostData);
37
+ }
38
+ /**
39
+ * Namespace for host management.
40
+ *
41
+ * Access via `api.hosts`.
42
+ *
43
+ * @example
44
+ * ```ts ignore
45
+ * const hosts = await api.hosts.list();
46
+ * ```
47
+ */
48
+ export declare class HostsNamespace extends ResourceNamespace<Host> {
49
+ /** @internal */
50
+ constructor(http: HttpClient);
51
+ /**
52
+ * Fetch a paginated list of physical hosts.
53
+ *
54
+ * @param opts Pagination and search options.
55
+ */
56
+ list(opts?: {
57
+ page?: number;
58
+ perPage?: number;
59
+ search?: string;
60
+ }): Promise<Paginated<Host>>;
61
+ }
62
+ //# sourceMappingURL=hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../../src/src/resources/hosts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,aAAa,CAAC;AAElF,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,gBAAgB;IACzC,gCAAgC;IAChC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACxB,0CAA0C;IACnC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,kDAAkD;IAC3C,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,sBAAsB;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,qCAAqC;IAC9B,SAAS,EAAE,IAAI,CAAC;IACvB,uCAAuC;IAChC,SAAS,EAAE,IAAI,CAAC;IAEvB,gBAAgB;gBACG,IAAI,EAAE,QAAQ;CAUjC;AAED;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,iBAAiB,CAAC,IAAI,CAAC;IAC1D,gBAAgB;gBACG,IAAI,EAAE,UAAU;IAInC;;;;OAIG;IACU,IAAI,CAAC,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;CAM5G"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HostsNamespace = exports.Host = void 0;
4
+ const namespace_js_1 = require("../namespace.js");
5
+ const reactive_js_1 = require("../reactive.js");
6
+ const types_js_1 = require("../types.js");
7
+ /**
8
+ * A physical host machine on which nodes are deployed.
9
+ *
10
+ * Retrieved via {@link HostsNamespace.list}.
11
+ */
12
+ class Host extends reactive_js_1.ReactiveResource {
13
+ /** The host's unique NanoID. */
14
+ id;
15
+ /** The host's hostname, e.g. `"host.example.com"`. */
16
+ hostname;
17
+ /** Optional display name for the host. */
18
+ name;
19
+ /** Optional color used in the UI for grouping. */
20
+ color;
21
+ /** Internal notes. */
22
+ notes;
23
+ /** When this host was registered. */
24
+ createdAt;
25
+ /** When this host was last updated. */
26
+ updatedAt;
27
+ /** @internal */
28
+ constructor(data) {
29
+ super();
30
+ this.id = (0, types_js_1.toNanoID)(data.id);
31
+ this.hostname = data.hostname;
32
+ this.name = data.name;
33
+ this.color = data.color;
34
+ this.notes = data.notes;
35
+ this.createdAt = new Date(data.created_at);
36
+ this.updatedAt = new Date(data.updated_at);
37
+ }
38
+ }
39
+ exports.Host = Host;
40
+ /**
41
+ * Namespace for host management.
42
+ *
43
+ * Access via `api.hosts`.
44
+ *
45
+ * @example
46
+ * ```ts ignore
47
+ * const hosts = await api.hosts.list();
48
+ * ```
49
+ */
50
+ class HostsNamespace extends namespace_js_1.ResourceNamespace {
51
+ /** @internal */
52
+ constructor(http) {
53
+ super(http);
54
+ }
55
+ /**
56
+ * Fetch a paginated list of physical hosts.
57
+ *
58
+ * @param opts Pagination and search options.
59
+ */
60
+ async list(opts = {}) {
61
+ const result = await this.http.list('/hosts', opts);
62
+ const hosts = result.data.map((d) => new Host(d));
63
+ this.setCache(hosts);
64
+ return { ...result, data: hosts };
65
+ }
66
+ }
67
+ exports.HostsNamespace = HostsNamespace;