@meowpanel/api 0.1.0-alpha.10

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/esm/api.d.ts +76 -0
  3. package/esm/api.d.ts.map +1 -0
  4. package/esm/api.js +187 -0
  5. package/esm/components/auth.d.ts +15 -0
  6. package/esm/components/auth.d.ts.map +1 -0
  7. package/esm/components/auth.js +13 -0
  8. package/esm/components/connection/abstract.d.ts +23 -0
  9. package/esm/components/connection/abstract.d.ts.map +1 -0
  10. package/esm/components/connection/abstract.js +43 -0
  11. package/esm/components/connection/sse.d.ts +20 -0
  12. package/esm/components/connection/sse.d.ts.map +1 -0
  13. package/esm/components/connection/sse.js +65 -0
  14. package/esm/components/egg/egg.d.ts +32 -0
  15. package/esm/components/egg/egg.d.ts.map +1 -0
  16. package/esm/components/egg/egg.js +70 -0
  17. package/esm/components/group.d.ts +14 -0
  18. package/esm/components/group.d.ts.map +1 -0
  19. package/esm/components/group.js +33 -0
  20. package/esm/components/member_2.d.ts +69 -0
  21. package/esm/components/member_2.d.ts.map +1 -0
  22. package/esm/components/member_2.js +140 -0
  23. package/esm/components/node.d.ts +78 -0
  24. package/esm/components/node.d.ts.map +1 -0
  25. package/esm/components/node.js +342 -0
  26. package/esm/components/server/activity.d.ts +45 -0
  27. package/esm/components/server/activity.d.ts.map +1 -0
  28. package/esm/components/server/activity.js +158 -0
  29. package/esm/components/server/allocations.d.ts +45 -0
  30. package/esm/components/server/allocations.d.ts.map +1 -0
  31. package/esm/components/server/allocations.js +146 -0
  32. package/esm/components/server/files.d.ts +50 -0
  33. package/esm/components/server/files.d.ts.map +1 -0
  34. package/esm/components/server/files.js +90 -0
  35. package/esm/components/server/power.d.ts +21 -0
  36. package/esm/components/server/power.d.ts.map +1 -0
  37. package/esm/components/server/power.js +43 -0
  38. package/esm/components/server/profiles.d.ts +63 -0
  39. package/esm/components/server/profiles.d.ts.map +1 -0
  40. package/esm/components/server/profiles.js +163 -0
  41. package/esm/components/server/server.d.ts +141 -0
  42. package/esm/components/server/server.d.ts.map +1 -0
  43. package/esm/components/server/server.js +358 -0
  44. package/esm/components/server/sftp.d.ts +31 -0
  45. package/esm/components/server/sftp.d.ts.map +1 -0
  46. package/esm/components/server/sftp.js +84 -0
  47. package/esm/components/server/startup.d.ts +17 -0
  48. package/esm/components/server/startup.d.ts.map +1 -0
  49. package/esm/components/server/startup.js +21 -0
  50. package/esm/components/server/stats.d.ts +19 -0
  51. package/esm/components/server/stats.d.ts.map +1 -0
  52. package/esm/components/server/stats.js +46 -0
  53. package/esm/mod.d.ts +2 -0
  54. package/esm/mod.d.ts.map +1 -0
  55. package/esm/mod.js +1 -0
  56. package/esm/package.json +3 -0
  57. package/esm/utils/cache.d.ts +20 -0
  58. package/esm/utils/cache.d.ts.map +1 -0
  59. package/esm/utils/cache.js +66 -0
  60. package/esm/utils/event.d.ts +38 -0
  61. package/esm/utils/event.d.ts.map +1 -0
  62. package/esm/utils/event.js +71 -0
  63. package/esm/utils/object.d.ts +58 -0
  64. package/esm/utils/object.d.ts.map +1 -0
  65. package/esm/utils/object.js +86 -0
  66. package/esm/utils/subscribe.d.ts +37 -0
  67. package/esm/utils/subscribe.d.ts.map +1 -0
  68. package/esm/utils/subscribe.js +29 -0
  69. package/esm/utils/timer.d.ts +13 -0
  70. package/esm/utils/timer.d.ts.map +1 -0
  71. package/esm/utils/timer.js +32 -0
  72. package/esm/utils/units.d.ts +18 -0
  73. package/esm/utils/units.d.ts.map +1 -0
  74. package/esm/utils/units.js +82 -0
  75. package/package.json +107 -0
  76. package/script/api.d.ts +76 -0
  77. package/script/api.d.ts.map +1 -0
  78. package/script/api.js +192 -0
  79. package/script/components/auth.d.ts +15 -0
  80. package/script/components/auth.d.ts.map +1 -0
  81. package/script/components/auth.js +17 -0
  82. package/script/components/connection/abstract.d.ts +23 -0
  83. package/script/components/connection/abstract.d.ts.map +1 -0
  84. package/script/components/connection/abstract.js +47 -0
  85. package/script/components/connection/sse.d.ts +20 -0
  86. package/script/components/connection/sse.d.ts.map +1 -0
  87. package/script/components/connection/sse.js +69 -0
  88. package/script/components/egg/egg.d.ts +32 -0
  89. package/script/components/egg/egg.d.ts.map +1 -0
  90. package/script/components/egg/egg.js +74 -0
  91. package/script/components/group.d.ts +14 -0
  92. package/script/components/group.d.ts.map +1 -0
  93. package/script/components/group.js +37 -0
  94. package/script/components/member_2.d.ts +69 -0
  95. package/script/components/member_2.d.ts.map +1 -0
  96. package/script/components/member_2.js +146 -0
  97. package/script/components/node.d.ts +78 -0
  98. package/script/components/node.d.ts.map +1 -0
  99. package/script/components/node.js +349 -0
  100. package/script/components/server/activity.d.ts +45 -0
  101. package/script/components/server/activity.d.ts.map +1 -0
  102. package/script/components/server/activity.js +164 -0
  103. package/script/components/server/allocations.d.ts +45 -0
  104. package/script/components/server/allocations.d.ts.map +1 -0
  105. package/script/components/server/allocations.js +152 -0
  106. package/script/components/server/files.d.ts +50 -0
  107. package/script/components/server/files.d.ts.map +1 -0
  108. package/script/components/server/files.js +94 -0
  109. package/script/components/server/power.d.ts +21 -0
  110. package/script/components/server/power.d.ts.map +1 -0
  111. package/script/components/server/power.js +47 -0
  112. package/script/components/server/profiles.d.ts +63 -0
  113. package/script/components/server/profiles.d.ts.map +1 -0
  114. package/script/components/server/profiles.js +168 -0
  115. package/script/components/server/server.d.ts +141 -0
  116. package/script/components/server/server.d.ts.map +1 -0
  117. package/script/components/server/server.js +362 -0
  118. package/script/components/server/sftp.d.ts +31 -0
  119. package/script/components/server/sftp.d.ts.map +1 -0
  120. package/script/components/server/sftp.js +88 -0
  121. package/script/components/server/startup.d.ts +17 -0
  122. package/script/components/server/startup.d.ts.map +1 -0
  123. package/script/components/server/startup.js +25 -0
  124. package/script/components/server/stats.d.ts +19 -0
  125. package/script/components/server/stats.d.ts.map +1 -0
  126. package/script/components/server/stats.js +50 -0
  127. package/script/mod.d.ts +2 -0
  128. package/script/mod.d.ts.map +1 -0
  129. package/script/mod.js +5 -0
  130. package/script/package.json +3 -0
  131. package/script/utils/cache.d.ts +20 -0
  132. package/script/utils/cache.d.ts.map +1 -0
  133. package/script/utils/cache.js +70 -0
  134. package/script/utils/event.d.ts +38 -0
  135. package/script/utils/event.d.ts.map +1 -0
  136. package/script/utils/event.js +75 -0
  137. package/script/utils/object.d.ts +58 -0
  138. package/script/utils/object.d.ts.map +1 -0
  139. package/script/utils/object.js +90 -0
  140. package/script/utils/subscribe.d.ts +37 -0
  141. package/script/utils/subscribe.d.ts.map +1 -0
  142. package/script/utils/subscribe.js +32 -0
  143. package/script/utils/timer.d.ts +13 -0
  144. package/script/utils/timer.d.ts.map +1 -0
  145. package/script/utils/timer.js +36 -0
  146. package/script/utils/units.d.ts +18 -0
  147. package/script/utils/units.d.ts.map +1 -0
  148. package/script/utils/units.js +86 -0
@@ -0,0 +1,349 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NodeType = exports.NodeHost = exports.NodeLocation = exports.Node = void 0;
4
+ const cache_js_1 = require("../utils/cache.js");
5
+ const member_2_js_1 = require("./member_2.js");
6
+ class Node {
7
+ static async getPaged(api, page, include) {
8
+ const response = await api.request('GET', `/v1/nodes`, {
9
+ pagination: { page },
10
+ params: {
11
+ include: include?.join(','),
12
+ },
13
+ });
14
+ return {
15
+ servers: response.data.map((data) => new Node(api, data)),
16
+ page: response.page,
17
+ };
18
+ }
19
+ static async get(api, id, include) {
20
+ const response = await api.request('GET', `/v1/nodes/${id}`, {
21
+ params: {
22
+ include: include?.join(','),
23
+ },
24
+ });
25
+ return new Node(api, response.data);
26
+ }
27
+ constructor(api, data) {
28
+ Object.defineProperty(this, "api", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: api
33
+ });
34
+ Object.defineProperty(this, "id", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ Object.defineProperty(this, "name", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: void 0
45
+ });
46
+ Object.defineProperty(this, "description", {
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true,
50
+ value: void 0
51
+ });
52
+ Object.defineProperty(this, "owner", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: void 0
57
+ });
58
+ Object.defineProperty(this, "location", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: void 0
63
+ });
64
+ Object.defineProperty(this, "host", {
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true,
68
+ value: void 0
69
+ });
70
+ Object.defineProperty(this, "type", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: void 0
75
+ });
76
+ Object.defineProperty(this, "num", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: void 0
81
+ });
82
+ Object.defineProperty(this, "limits", {
83
+ enumerable: true,
84
+ configurable: true,
85
+ writable: true,
86
+ value: void 0
87
+ });
88
+ Object.defineProperty(this, "connection", {
89
+ enumerable: true,
90
+ configurable: true,
91
+ writable: true,
92
+ value: void 0
93
+ });
94
+ Object.defineProperty(this, "isUnderMaintance", {
95
+ enumerable: true,
96
+ configurable: true,
97
+ writable: true,
98
+ value: void 0
99
+ });
100
+ Object.defineProperty(this, "canAutoDeploy", {
101
+ enumerable: true,
102
+ configurable: true,
103
+ writable: true,
104
+ value: void 0
105
+ });
106
+ Object.defineProperty(this, "isBehindProxy", {
107
+ enumerable: true,
108
+ configurable: true,
109
+ writable: true,
110
+ value: void 0
111
+ });
112
+ Object.defineProperty(this, "createdAt", {
113
+ enumerable: true,
114
+ configurable: true,
115
+ writable: true,
116
+ value: void 0
117
+ });
118
+ Object.defineProperty(this, "updatedAt", {
119
+ enumerable: true,
120
+ configurable: true,
121
+ writable: true,
122
+ value: void 0
123
+ });
124
+ Object.defineProperty(this, "fqdn", {
125
+ enumerable: true,
126
+ configurable: true,
127
+ writable: true,
128
+ value: void 0
129
+ });
130
+ Object.defineProperty(this, "notes", {
131
+ enumerable: true,
132
+ configurable: true,
133
+ writable: true,
134
+ value: void 0
135
+ });
136
+ this.id = data.id;
137
+ this.name = data.name;
138
+ this.description = data.description;
139
+ this.owner = new cache_js_1.CachedRelation(() => member_2_js_1.Member.get(api, data.owner_id));
140
+ this.owner.setCache(data.owner);
141
+ // TODO: Implement Node Location, Host, Type API endpoints
142
+ this.location = new cache_js_1.CachedRelation(() => {
143
+ throw new Error('Not implemented');
144
+ });
145
+ this.host = new cache_js_1.CachedRelation(() => {
146
+ throw new Error('Not implemented');
147
+ });
148
+ this.type = new cache_js_1.CachedRelation(() => {
149
+ throw new Error('Not implemented');
150
+ });
151
+ this.num = data.num;
152
+ this.limits = data.limits;
153
+ this.connection = data.connection ?? null;
154
+ this.isUnderMaintance = data.is_under_maintance;
155
+ this.canAutoDeploy = data.can_auto_deploy;
156
+ this.isBehindProxy = data.is_behind_proxy;
157
+ this.notes = data.notes;
158
+ this.createdAt = data.created_at;
159
+ this.updatedAt = data.updated_at;
160
+ }
161
+ }
162
+ exports.Node = Node;
163
+ class NodeLocation {
164
+ constructor(api, data) {
165
+ Object.defineProperty(this, "api", {
166
+ enumerable: true,
167
+ configurable: true,
168
+ writable: true,
169
+ value: api
170
+ });
171
+ Object.defineProperty(this, "id", {
172
+ enumerable: true,
173
+ configurable: true,
174
+ writable: true,
175
+ value: void 0
176
+ });
177
+ Object.defineProperty(this, "name", {
178
+ enumerable: true,
179
+ configurable: true,
180
+ writable: true,
181
+ value: void 0
182
+ });
183
+ Object.defineProperty(this, "short", {
184
+ enumerable: true,
185
+ configurable: true,
186
+ writable: true,
187
+ value: void 0
188
+ });
189
+ Object.defineProperty(this, "notes", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: void 0
194
+ });
195
+ Object.defineProperty(this, "owner", {
196
+ enumerable: true,
197
+ configurable: true,
198
+ writable: true,
199
+ value: void 0
200
+ });
201
+ Object.defineProperty(this, "createdAt", {
202
+ enumerable: true,
203
+ configurable: true,
204
+ writable: true,
205
+ value: void 0
206
+ });
207
+ Object.defineProperty(this, "updatedAt", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: void 0
212
+ });
213
+ this.id = data.id;
214
+ this.name = data.name;
215
+ this.short = data.short;
216
+ this.notes = data.notes;
217
+ this.owner = new cache_js_1.CachedRelation(() => member_2_js_1.Member.get(api, data.owner_id));
218
+ this.createdAt = new Date(data.created_at);
219
+ this.updatedAt = new Date(data.updated_at);
220
+ }
221
+ }
222
+ exports.NodeLocation = NodeLocation;
223
+ class NodeHost {
224
+ constructor(api, data) {
225
+ Object.defineProperty(this, "api", {
226
+ enumerable: true,
227
+ configurable: true,
228
+ writable: true,
229
+ value: api
230
+ });
231
+ Object.defineProperty(this, "id", {
232
+ enumerable: true,
233
+ configurable: true,
234
+ writable: true,
235
+ value: void 0
236
+ });
237
+ Object.defineProperty(this, "name", {
238
+ enumerable: true,
239
+ configurable: true,
240
+ writable: true,
241
+ value: void 0
242
+ });
243
+ Object.defineProperty(this, "hostname", {
244
+ enumerable: true,
245
+ configurable: true,
246
+ writable: true,
247
+ value: void 0
248
+ });
249
+ Object.defineProperty(this, "color", {
250
+ enumerable: true,
251
+ configurable: true,
252
+ writable: true,
253
+ value: void 0
254
+ });
255
+ Object.defineProperty(this, "notes", {
256
+ enumerable: true,
257
+ configurable: true,
258
+ writable: true,
259
+ value: void 0
260
+ });
261
+ Object.defineProperty(this, "owner", {
262
+ enumerable: true,
263
+ configurable: true,
264
+ writable: true,
265
+ value: void 0
266
+ });
267
+ Object.defineProperty(this, "createdAt", {
268
+ enumerable: true,
269
+ configurable: true,
270
+ writable: true,
271
+ value: void 0
272
+ });
273
+ Object.defineProperty(this, "updatedAt", {
274
+ enumerable: true,
275
+ configurable: true,
276
+ writable: true,
277
+ value: void 0
278
+ });
279
+ this.id = data.id;
280
+ this.name = data.name;
281
+ this.hostname = data.hostname;
282
+ this.color = data.color;
283
+ this.notes = data.notes;
284
+ this.owner = new cache_js_1.CachedRelation(() => member_2_js_1.Member.get(api, data.owner_id));
285
+ this.createdAt = new Date(data.created_at);
286
+ this.updatedAt = new Date(data.updated_at);
287
+ }
288
+ }
289
+ exports.NodeHost = NodeHost;
290
+ class NodeType {
291
+ constructor(api, data) {
292
+ Object.defineProperty(this, "api", {
293
+ enumerable: true,
294
+ configurable: true,
295
+ writable: true,
296
+ value: api
297
+ });
298
+ Object.defineProperty(this, "id", {
299
+ enumerable: true,
300
+ configurable: true,
301
+ writable: true,
302
+ value: void 0
303
+ });
304
+ Object.defineProperty(this, "name", {
305
+ enumerable: true,
306
+ configurable: true,
307
+ writable: true,
308
+ value: void 0
309
+ });
310
+ Object.defineProperty(this, "short", {
311
+ enumerable: true,
312
+ configurable: true,
313
+ writable: true,
314
+ value: void 0
315
+ });
316
+ Object.defineProperty(this, "notes", {
317
+ enumerable: true,
318
+ configurable: true,
319
+ writable: true,
320
+ value: void 0
321
+ });
322
+ Object.defineProperty(this, "owner", {
323
+ enumerable: true,
324
+ configurable: true,
325
+ writable: true,
326
+ value: void 0
327
+ });
328
+ Object.defineProperty(this, "createdAt", {
329
+ enumerable: true,
330
+ configurable: true,
331
+ writable: true,
332
+ value: void 0
333
+ });
334
+ Object.defineProperty(this, "updatedAt", {
335
+ enumerable: true,
336
+ configurable: true,
337
+ writable: true,
338
+ value: void 0
339
+ });
340
+ this.id = data.id;
341
+ this.name = data.name;
342
+ this.short = data.short;
343
+ this.notes = data.notes;
344
+ this.owner = new cache_js_1.CachedRelation(() => member_2_js_1.Member.get(api, data.owner_id));
345
+ this.createdAt = new Date(data.created_at);
346
+ this.updatedAt = new Date(data.updated_at);
347
+ }
348
+ }
349
+ exports.NodeType = NodeType;
@@ -0,0 +1,45 @@
1
+ import type { MeowPanelApi } from '../../api.js';
2
+ import { CachedRelation } from '../../utils/cache.js';
3
+ import { Member } from '../member_2.js';
4
+ import { Node } from '../node.js';
5
+ import type { ActivityJobLogResponse } from './server_2';
6
+ import type { ActivityJobResponse, ActivityLogResponse } from './server_2';
7
+ import { Server } from './server.js';
8
+ export declare class ServerActivityLog {
9
+ protected readonly api: MeowPanelApi;
10
+ protected readonly server: Server;
11
+ protected readonly response: ActivityLogResponse;
12
+ constructor(api: MeowPanelApi, server: Server, response: ActivityLogResponse);
13
+ get id(): string;
14
+ readonly issuer: CachedRelation<Member | null>;
15
+ get ip(): string | undefined;
16
+ get event(): string;
17
+ get metadata(): Record<string, unknown>;
18
+ readonly job: CachedRelation<ServerActivityJob | null>;
19
+ get created_at(): Date;
20
+ }
21
+ export declare class ServerActivityJob {
22
+ protected readonly api: MeowPanelApi;
23
+ protected readonly server: Server;
24
+ protected readonly response: ActivityJobResponse;
25
+ constructor(api: MeowPanelApi, server: Server, response: ActivityJobResponse);
26
+ get id(): string;
27
+ readonly node: CachedRelation<Node | null>;
28
+ get status(): 'in_progress' | 'completed' | 'failed';
29
+ readonly logs: ServerActivityJobLog[];
30
+ get completedAt(): Date | null;
31
+ isCompleted(): boolean;
32
+ get createdAt(): Date;
33
+ get updatedAt(): Date;
34
+ }
35
+ export declare class ServerActivityJobLog {
36
+ protected readonly api: MeowPanelApi;
37
+ protected readonly response: ActivityJobLogResponse;
38
+ constructor(api: MeowPanelApi, response: ActivityJobLogResponse);
39
+ get type(): string;
40
+ get metadata(): object;
41
+ readonly node: CachedRelation<Node | null>;
42
+ readonly server: CachedRelation<Server | null>;
43
+ get created_at(): Date;
44
+ }
45
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../src/components/server/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,IA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AQ,CAE1D;IAED,SAAgB,IAAI,EAAE,oBAAoB,EAAE,CAAC;IAE7C,IAAW,WAAW,IAAI,IAAI,GAAG,IAAI,CAEpC;IAEM,WAAW,IAAI,OAAO;IAI7B,IAAW,SAAS,IAAI,IAAI,CAE3B;IAED,IAAW,SAAS,IAAI,IAAI,CAE3B;CACD;AAED,qBAAa,oBAAoB;IAE/B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;IACpC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB;gBADhC,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,sBAAsB;IAQpD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,SAAgB,IAAI,EAAE,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,CAE/C;IAEF,SAAgB,MAAM,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAEnD;IAEF,IAAW,UAAU,IAAI,IAAI,CAE5B;CACD"}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerActivityJobLog = exports.ServerActivityJob = exports.ServerActivityLog = void 0;
4
+ const cache_js_1 = require("../../utils/cache.js");
5
+ const member_2_js_1 = require("../member_2.js");
6
+ const node_js_1 = require("../node.js");
7
+ const server_js_1 = require("./server.js");
8
+ class ServerActivityLog {
9
+ constructor(api, server, response) {
10
+ Object.defineProperty(this, "api", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: api
15
+ });
16
+ Object.defineProperty(this, "server", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: server
21
+ });
22
+ Object.defineProperty(this, "response", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: response
27
+ });
28
+ // TODO: update so it uses as a common function to parse Issuer IDs
29
+ Object.defineProperty(this, "issuer", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: new cache_js_1.CachedRelation(() => this.response.issuer_id ? this.api.members.get(this.response.issuer_id) : null)
34
+ });
35
+ Object.defineProperty(this, "job", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: new cache_js_1.CachedRelation(() => this.response.job_id ? this.server.getActivityJob(this.response.job_id) : null)
40
+ });
41
+ // this.issuer = response.issuer; TODO: Implement Activity Log Issuer (Frontend)
42
+ if (response.job) {
43
+ this.job.setCache(new ServerActivityJob(this.api, this.server, response.job));
44
+ }
45
+ if (response.issuer) {
46
+ this.issuer.setCache(new member_2_js_1.Member(this.api, response.issuer));
47
+ }
48
+ }
49
+ get id() {
50
+ return this.response.id;
51
+ }
52
+ get ip() {
53
+ return this.response.ip;
54
+ }
55
+ get event() {
56
+ return this.response.event;
57
+ }
58
+ get metadata() {
59
+ return this.response.metadata;
60
+ }
61
+ get created_at() {
62
+ return new Date(this.response.created_at);
63
+ }
64
+ }
65
+ exports.ServerActivityLog = ServerActivityLog;
66
+ class ServerActivityJob {
67
+ constructor(api, server, response) {
68
+ Object.defineProperty(this, "api", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: api
73
+ });
74
+ Object.defineProperty(this, "server", {
75
+ enumerable: true,
76
+ configurable: true,
77
+ writable: true,
78
+ value: server
79
+ });
80
+ Object.defineProperty(this, "response", {
81
+ enumerable: true,
82
+ configurable: true,
83
+ writable: true,
84
+ value: response
85
+ });
86
+ Object.defineProperty(this, "node", {
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true,
90
+ value: new cache_js_1.CachedRelation(() => this.response.node_id ? this.api.getNode(this.response.node_id) : null)
91
+ });
92
+ Object.defineProperty(this, "logs", {
93
+ enumerable: true,
94
+ configurable: true,
95
+ writable: true,
96
+ value: void 0
97
+ });
98
+ if (response.node)
99
+ this.node.setCache(new node_js_1.Node(this.api, response.node)); // TODO: Fix type check
100
+ this.logs = response.logs.map((v) => new ServerActivityJobLog(this.api, v));
101
+ }
102
+ get id() {
103
+ return this.response.id;
104
+ }
105
+ get status() {
106
+ return this.response.status;
107
+ }
108
+ get completedAt() {
109
+ return this.response.completed_at ? new Date(this.response.completed_at) : null;
110
+ }
111
+ isCompleted() {
112
+ return this.completedAt !== null;
113
+ }
114
+ get createdAt() {
115
+ return new Date(this.response.created_at);
116
+ }
117
+ get updatedAt() {
118
+ return new Date(this.response.updated_at);
119
+ }
120
+ }
121
+ exports.ServerActivityJob = ServerActivityJob;
122
+ class ServerActivityJobLog {
123
+ constructor(api, response) {
124
+ Object.defineProperty(this, "api", {
125
+ enumerable: true,
126
+ configurable: true,
127
+ writable: true,
128
+ value: api
129
+ });
130
+ Object.defineProperty(this, "response", {
131
+ enumerable: true,
132
+ configurable: true,
133
+ writable: true,
134
+ value: response
135
+ });
136
+ Object.defineProperty(this, "node", {
137
+ enumerable: true,
138
+ configurable: true,
139
+ writable: true,
140
+ value: new cache_js_1.CachedRelation(() => this.response.node_id ? this.api.getNode(this.response.node_id) : null)
141
+ });
142
+ Object.defineProperty(this, "server", {
143
+ enumerable: true,
144
+ configurable: true,
145
+ writable: true,
146
+ value: new cache_js_1.CachedRelation(() => this.response.server_id ? this.api.getServer(this.response.server_id) : null)
147
+ });
148
+ if (response.node)
149
+ this.node.setCache(new node_js_1.Node(this.api, response.node)); // TODO: Fix type check
150
+ if (response.server) {
151
+ this.server.setCache(new server_js_1.Server(this.api, response.server));
152
+ }
153
+ }
154
+ get type() {
155
+ return this.response.type;
156
+ }
157
+ get metadata() {
158
+ return this.response.metadata;
159
+ }
160
+ get created_at() {
161
+ return new Date(this.response.created_at);
162
+ }
163
+ }
164
+ exports.ServerActivityJobLog = ServerActivityJobLog;
@@ -0,0 +1,45 @@
1
+ import type { ApiResponse, MeowPanelApi, Page } from '../../api.js';
2
+ import { CachedRelation } from '../../utils/cache.js';
3
+ import type { AllocationPortResponse, AllocationsResponse, ServerAllocationPortResponse } from './server_2';
4
+ import type { Server } from './server.js';
5
+ export declare class ServerAllocations {
6
+ protected readonly api: MeowPanelApi;
7
+ protected readonly server: Server;
8
+ protected readonly response: AllocationsResponse;
9
+ static getPaged(api: MeowPanelApi, server: Server, page: number): Promise<{
10
+ groups: ServerAllocations[];
11
+ page: Page;
12
+ }>;
13
+ static get(api: MeowPanelApi, server: Server, id: string): Promise<ServerAllocations>;
14
+ constructor(api: MeowPanelApi, server: Server, response: AllocationsResponse);
15
+ get forceOutgoingIp(): boolean | undefined;
16
+ readonly ports: ServerAllocationPort[];
17
+ }
18
+ export declare class ServerAllocationPort {
19
+ protected readonly api: MeowPanelApi;
20
+ protected readonly server: Server;
21
+ protected readonly response: ServerAllocationPortResponse;
22
+ constructor(api: MeowPanelApi, server: Server, response: ServerAllocationPortResponse);
23
+ updateDescription(description: string): Promise<ApiResponse<unknown>>;
24
+ get id(): string;
25
+ get description(): string;
26
+ readonly meta: CachedRelation<AllocationPort>;
27
+ get isPrimary(): boolean;
28
+ get createdAt(): string;
29
+ get updatedAt(): string;
30
+ }
31
+ export declare class AllocationPort {
32
+ protected readonly ctx: MeowPanelApi;
33
+ protected readonly server: Server;
34
+ protected readonly response: AllocationPortResponse;
35
+ constructor(ctx: MeowPanelApi, server: Server, response: AllocationPortResponse);
36
+ get id(): string;
37
+ get ip(): string;
38
+ get port(): number;
39
+ get readyProtocols(): string[];
40
+ get is_in_use(): boolean;
41
+ get notes(): string | null | undefined;
42
+ get createdAt(): string;
43
+ get updatedAt(): string;
44
+ }
45
+ //# sourceMappingURL=allocations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocations.d.ts","sourceRoot":"","sources":["../../../src/components/server/allocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,4BAA4B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