@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,69 @@
1
+ import type { MeowPanelApi, Page, Pagination } from '../api.js';
2
+ import { CachedRelation } from '../utils/cache.js';
3
+ import { type EventFunction, EventManager, type EventManagerListener } from '../utils/event.js';
4
+ import { UpdatableObject } from '../utils/object.js';
5
+ import type { Extended } from '../utils/types';
6
+ interface AdjustedResponse {
7
+ display: CachedRelation<Display | null>;
8
+ permissions: CachedRelation<PermissionsList>;
9
+ }
10
+ export type MemberInclude = 'display' | 'permissions';
11
+ export declare class Member extends UpdatableObject<MemberResponse, AdjustedResponse, MemberInclude> implements EventManagerListener<MemberEvents> {
12
+ static list(api: MeowPanelApi, pagination: Pagination): Promise<{
13
+ data: Member[];
14
+ page: Page | undefined;
15
+ }>;
16
+ static get(api: MeowPanelApi, id: string): Promise<Member>;
17
+ constructor(api: MeowPanelApi, data: MemberResponse);
18
+ protected applyResponse(oldData: Extended<MemberResponse, AdjustedResponse> | undefined, newData: MemberResponse): AdjustedResponse;
19
+ protected readonly eventManager: EventManager<MemberEvents>;
20
+ on<K extends keyof MemberEvents>(event: K, func: EventFunction<MemberEvents, K>): number;
21
+ off<K extends keyof MemberEvents>(event: K | number, func?: EventFunction<MemberEvents, K> | number): boolean;
22
+ get name(): string;
23
+ update(data: {
24
+ email?: string;
25
+ firstName?: string;
26
+ lastName?: string;
27
+ nickname?: string;
28
+ display?: {
29
+ language?: string | null;
30
+ theme?: string | null;
31
+ };
32
+ }): Promise<void>;
33
+ get id(): string;
34
+ get email(): string;
35
+ get firstName(): string;
36
+ get lastName(): string;
37
+ get nickname(): string;
38
+ get avatarUri(): string;
39
+ get createdAt(): Date;
40
+ get updatedAt(): Date;
41
+ get display(): CachedRelation<Display | null>;
42
+ get permissions(): CachedRelation<PermissionsList>;
43
+ }
44
+ interface DisplayResponse {
45
+ language: string | null;
46
+ theme: string | null;
47
+ }
48
+ export declare class Display {
49
+ protected readonly api: MeowPanelApi;
50
+ protected readonly member: Member;
51
+ protected response: DisplayResponse;
52
+ get language(): string | null;
53
+ get theme(): string | null;
54
+ constructor(api: MeowPanelApi, member: Member, response: DisplayResponse);
55
+ update(data: {
56
+ language?: string | null;
57
+ theme?: string | null;
58
+ }): Promise<void>;
59
+ }
60
+ export declare class PermissionsList {
61
+ protected readonly permissions: string[];
62
+ constructor(permissions: string[]);
63
+ has(permission: string): boolean;
64
+ }
65
+ interface MemberEvents {
66
+ update: Member;
67
+ }
68
+ export {};
69
+ //# sourceMappingURL=member_2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member_2.d.ts","sourceRoot":"","sources":["../../src/components/member_2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBA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D;AAED,qBAAa,eAAe;IACR,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE;gBAArB,WAAW,EAAE,MAAM,EAAE;IAEpD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,UAAU,YAAY;IACrB,MAAM,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,140 @@
1
+ import { CachedRelation } from '../utils/cache.js';
2
+ import { EventManager } from '../utils/event.js';
3
+ import { UpdatableObject } from '../utils/object.js';
4
+ export class Member extends UpdatableObject {
5
+ static async list(api, pagination) {
6
+ const response = await api.request('GET', '/v1/members', {
7
+ pagination,
8
+ });
9
+ return {
10
+ data: response.data.map((v) => new Member(api, v)),
11
+ page: response.page,
12
+ };
13
+ }
14
+ static async get(api, id) {
15
+ const response = await api.request('GET', `/v1/members/${id}`);
16
+ return new Member(api, response.data);
17
+ }
18
+ constructor(api, data) {
19
+ super(api, data, `/v1/members/${data.id}`);
20
+ Object.defineProperty(this, "eventManager", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: new EventManager()
25
+ });
26
+ }
27
+ applyResponse(oldData, newData) {
28
+ const response = {
29
+ // TODO: CachedRelation should fetch data on access if undefined
30
+ display: oldData?.display ??
31
+ new CachedRelation(() => new Display(this.api, this, newData.display)),
32
+ permissions: oldData?.permissions ??
33
+ new CachedRelation(() => new PermissionsList(newData.permissions)),
34
+ };
35
+ if (newData.display) {
36
+ response.display.setCache(new Display(this.api, this, newData.display));
37
+ }
38
+ if (newData.permissions) {
39
+ response.permissions.setCache(new PermissionsList(newData.permissions));
40
+ }
41
+ return response;
42
+ }
43
+ on(event, func) {
44
+ return this.eventManager.on(event, func);
45
+ }
46
+ off(event, func) {
47
+ return this.eventManager.off(event, func);
48
+ }
49
+ get name() {
50
+ return this.nickname || `${this.firstName} ${this.lastName}`;
51
+ }
52
+ async update(data) {
53
+ const response = await this.api.request('PATCH', `/v1/members/${this.id}`, {
54
+ body: {
55
+ email: data.email,
56
+ first_name: data.firstName,
57
+ last_name: data.lastName,
58
+ nickname: data.nickname,
59
+ display: data.display,
60
+ },
61
+ });
62
+ this.updateSelf(response.data);
63
+ this.eventManager.dispatch('update', this);
64
+ }
65
+ //> Accessors
66
+ get id() {
67
+ return this.response.id;
68
+ }
69
+ get email() {
70
+ return this.response.email;
71
+ }
72
+ get firstName() {
73
+ return this.response.first_name;
74
+ }
75
+ get lastName() {
76
+ return this.response.last_name;
77
+ }
78
+ get nickname() {
79
+ return this.response.nickname;
80
+ }
81
+ get avatarUri() {
82
+ return this.response.avatar_uri;
83
+ }
84
+ get createdAt() {
85
+ return new Date(this.response.created_at);
86
+ }
87
+ get updatedAt() {
88
+ return new Date(this.response.created_at);
89
+ }
90
+ get display() {
91
+ return this.response.display;
92
+ }
93
+ get permissions() {
94
+ return this.response.permissions;
95
+ }
96
+ }
97
+ export class Display {
98
+ get language() {
99
+ return this.response.language;
100
+ }
101
+ get theme() {
102
+ return this.response.theme;
103
+ }
104
+ constructor(api, member, response) {
105
+ Object.defineProperty(this, "api", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: api
110
+ });
111
+ Object.defineProperty(this, "member", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: member
116
+ });
117
+ Object.defineProperty(this, "response", {
118
+ enumerable: true,
119
+ configurable: true,
120
+ writable: true,
121
+ value: response
122
+ });
123
+ }
124
+ async update(data) {
125
+ await this.member.update({ display: data });
126
+ }
127
+ }
128
+ export class PermissionsList {
129
+ constructor(permissions) {
130
+ Object.defineProperty(this, "permissions", {
131
+ enumerable: true,
132
+ configurable: true,
133
+ writable: true,
134
+ value: permissions
135
+ });
136
+ }
137
+ has(permission) {
138
+ return this.permissions.includes(permission);
139
+ }
140
+ }
@@ -0,0 +1,78 @@
1
+ import type { MeowPanelApi, Page } from '../api.js';
2
+ import { CachedRelation } from '../utils/cache.js';
3
+ import { Member } from './member_2.js';
4
+ export type NodeInclude = 'location' | 'type' | 'connection';
5
+ export declare class Node {
6
+ protected readonly api: MeowPanelApi;
7
+ static getPaged(api: MeowPanelApi, page: number, include?: NodeInclude[]): Promise<{
8
+ servers: Node[];
9
+ page: Page;
10
+ }>;
11
+ static get(api: MeowPanelApi, id: string, include?: NodeInclude[]): Promise<Node>;
12
+ constructor(api: MeowPanelApi, data: Record<string, never>);
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly owner: CachedRelation<Member>;
17
+ readonly location: CachedRelation<NodeLocation>;
18
+ readonly host: CachedRelation<NodeHost>;
19
+ readonly type: CachedRelation<NodeType>;
20
+ readonly num: number;
21
+ readonly limits: Limits;
22
+ readonly connection: {
23
+ url: string;
24
+ scheme: string;
25
+ fqdn: string;
26
+ port: string;
27
+ };
28
+ readonly isUnderMaintance: boolean;
29
+ readonly canAutoDeploy: boolean;
30
+ readonly isBehindProxy: boolean;
31
+ readonly createdAt: Date;
32
+ readonly updatedAt: Date;
33
+ readonly fqdn: string | undefined;
34
+ readonly notes: string | undefined;
35
+ }
36
+ interface Limits {
37
+ memory_mb: number;
38
+ memory_overallocate_mb: number;
39
+ disk_mb: number;
40
+ disk_overallocate_mb: number;
41
+ upload_size_mb: number;
42
+ }
43
+ export declare class NodeLocation {
44
+ protected readonly api: MeowPanelApi;
45
+ constructor(api: MeowPanelApi, data: Record<string, never>);
46
+ readonly id: string;
47
+ readonly name: string;
48
+ readonly short: string;
49
+ readonly notes: string | null | undefined;
50
+ readonly owner: CachedRelation<Member>;
51
+ readonly createdAt: Date;
52
+ readonly updatedAt: Date;
53
+ }
54
+ export declare class NodeHost {
55
+ protected readonly api: MeowPanelApi;
56
+ constructor(api: MeowPanelApi, data: Record<string, never>);
57
+ readonly id: string;
58
+ readonly name: string;
59
+ readonly hostname: string;
60
+ readonly color: string;
61
+ readonly notes: string | null | undefined;
62
+ readonly owner: CachedRelation<Member>;
63
+ readonly createdAt: Date;
64
+ readonly updatedAt: Date;
65
+ }
66
+ export declare class NodeType {
67
+ protected readonly api: MeowPanelApi;
68
+ constructor(api: MeowPanelApi, data: Record<string, never>);
69
+ readonly id: string;
70
+ readonly name: string;
71
+ readonly short: string;
72
+ readonly notes: string | null | undefined;
73
+ readonly owner: CachedRelation<Member>;
74
+ readonly createdAt: Date;
75
+ readonly updatedAt: Date;
76
+ }
77
+ export {};
78
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/components/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC;AAE7D,qBAAa,IAAI;IA0Cf,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;WAzCjB,QAAQ,CAC3B,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,EAAE,GACrB,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;WAkBvB,GAAG,CACtB,GAAG,EAAE,YAAY,EACjB,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,WAAW,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC;gBAeI,GAAG,EAAE,YAAY,EACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IA8B5B,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,SA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AC,MAAM,CAAC,CAAC;IAC9C,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;CAChC;AAED,qBAAa,QAAQ;IAEnB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;gBAAjB,GAAG,EAAE,YAAY,EACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAY5B,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,SAAgB,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;CAChC;AAED,qBAAa,QAAQ;IAEnB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY;gBAAjB,GAAG,EAAE,YAAY,EACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAW5B,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,SAAgB,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;CAChC"}
@@ -0,0 +1,342 @@
1
+ import { CachedRelation } from '../utils/cache.js';
2
+ import { Member } from './member_2.js';
3
+ export class Node {
4
+ static async getPaged(api, page, include) {
5
+ const response = await api.request('GET', `/v1/nodes`, {
6
+ pagination: { page },
7
+ params: {
8
+ include: include?.join(','),
9
+ },
10
+ });
11
+ return {
12
+ servers: response.data.map((data) => new Node(api, data)),
13
+ page: response.page,
14
+ };
15
+ }
16
+ static async get(api, id, include) {
17
+ const response = await api.request('GET', `/v1/nodes/${id}`, {
18
+ params: {
19
+ include: include?.join(','),
20
+ },
21
+ });
22
+ return new Node(api, response.data);
23
+ }
24
+ constructor(api, data) {
25
+ Object.defineProperty(this, "api", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: api
30
+ });
31
+ Object.defineProperty(this, "id", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "name", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ Object.defineProperty(this, "description", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: void 0
48
+ });
49
+ Object.defineProperty(this, "owner", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: void 0
54
+ });
55
+ Object.defineProperty(this, "location", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
61
+ Object.defineProperty(this, "host", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: void 0
66
+ });
67
+ Object.defineProperty(this, "type", {
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true,
71
+ value: void 0
72
+ });
73
+ Object.defineProperty(this, "num", {
74
+ enumerable: true,
75
+ configurable: true,
76
+ writable: true,
77
+ value: void 0
78
+ });
79
+ Object.defineProperty(this, "limits", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: void 0
84
+ });
85
+ Object.defineProperty(this, "connection", {
86
+ enumerable: true,
87
+ configurable: true,
88
+ writable: true,
89
+ value: void 0
90
+ });
91
+ Object.defineProperty(this, "isUnderMaintance", {
92
+ enumerable: true,
93
+ configurable: true,
94
+ writable: true,
95
+ value: void 0
96
+ });
97
+ Object.defineProperty(this, "canAutoDeploy", {
98
+ enumerable: true,
99
+ configurable: true,
100
+ writable: true,
101
+ value: void 0
102
+ });
103
+ Object.defineProperty(this, "isBehindProxy", {
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true,
107
+ value: void 0
108
+ });
109
+ Object.defineProperty(this, "createdAt", {
110
+ enumerable: true,
111
+ configurable: true,
112
+ writable: true,
113
+ value: void 0
114
+ });
115
+ Object.defineProperty(this, "updatedAt", {
116
+ enumerable: true,
117
+ configurable: true,
118
+ writable: true,
119
+ value: void 0
120
+ });
121
+ Object.defineProperty(this, "fqdn", {
122
+ enumerable: true,
123
+ configurable: true,
124
+ writable: true,
125
+ value: void 0
126
+ });
127
+ Object.defineProperty(this, "notes", {
128
+ enumerable: true,
129
+ configurable: true,
130
+ writable: true,
131
+ value: void 0
132
+ });
133
+ this.id = data.id;
134
+ this.name = data.name;
135
+ this.description = data.description;
136
+ this.owner = new CachedRelation(() => Member.get(api, data.owner_id));
137
+ this.owner.setCache(data.owner);
138
+ // TODO: Implement Node Location, Host, Type API endpoints
139
+ this.location = new CachedRelation(() => {
140
+ throw new Error('Not implemented');
141
+ });
142
+ this.host = new CachedRelation(() => {
143
+ throw new Error('Not implemented');
144
+ });
145
+ this.type = new CachedRelation(() => {
146
+ throw new Error('Not implemented');
147
+ });
148
+ this.num = data.num;
149
+ this.limits = data.limits;
150
+ this.connection = data.connection ?? null;
151
+ this.isUnderMaintance = data.is_under_maintance;
152
+ this.canAutoDeploy = data.can_auto_deploy;
153
+ this.isBehindProxy = data.is_behind_proxy;
154
+ this.notes = data.notes;
155
+ this.createdAt = data.created_at;
156
+ this.updatedAt = data.updated_at;
157
+ }
158
+ }
159
+ export class NodeLocation {
160
+ constructor(api, data) {
161
+ Object.defineProperty(this, "api", {
162
+ enumerable: true,
163
+ configurable: true,
164
+ writable: true,
165
+ value: api
166
+ });
167
+ Object.defineProperty(this, "id", {
168
+ enumerable: true,
169
+ configurable: true,
170
+ writable: true,
171
+ value: void 0
172
+ });
173
+ Object.defineProperty(this, "name", {
174
+ enumerable: true,
175
+ configurable: true,
176
+ writable: true,
177
+ value: void 0
178
+ });
179
+ Object.defineProperty(this, "short", {
180
+ enumerable: true,
181
+ configurable: true,
182
+ writable: true,
183
+ value: void 0
184
+ });
185
+ Object.defineProperty(this, "notes", {
186
+ enumerable: true,
187
+ configurable: true,
188
+ writable: true,
189
+ value: void 0
190
+ });
191
+ Object.defineProperty(this, "owner", {
192
+ enumerable: true,
193
+ configurable: true,
194
+ writable: true,
195
+ value: void 0
196
+ });
197
+ Object.defineProperty(this, "createdAt", {
198
+ enumerable: true,
199
+ configurable: true,
200
+ writable: true,
201
+ value: void 0
202
+ });
203
+ Object.defineProperty(this, "updatedAt", {
204
+ enumerable: true,
205
+ configurable: true,
206
+ writable: true,
207
+ value: void 0
208
+ });
209
+ this.id = data.id;
210
+ this.name = data.name;
211
+ this.short = data.short;
212
+ this.notes = data.notes;
213
+ this.owner = new CachedRelation(() => Member.get(api, data.owner_id));
214
+ this.createdAt = new Date(data.created_at);
215
+ this.updatedAt = new Date(data.updated_at);
216
+ }
217
+ }
218
+ export class NodeHost {
219
+ constructor(api, data) {
220
+ Object.defineProperty(this, "api", {
221
+ enumerable: true,
222
+ configurable: true,
223
+ writable: true,
224
+ value: api
225
+ });
226
+ Object.defineProperty(this, "id", {
227
+ enumerable: true,
228
+ configurable: true,
229
+ writable: true,
230
+ value: void 0
231
+ });
232
+ Object.defineProperty(this, "name", {
233
+ enumerable: true,
234
+ configurable: true,
235
+ writable: true,
236
+ value: void 0
237
+ });
238
+ Object.defineProperty(this, "hostname", {
239
+ enumerable: true,
240
+ configurable: true,
241
+ writable: true,
242
+ value: void 0
243
+ });
244
+ Object.defineProperty(this, "color", {
245
+ enumerable: true,
246
+ configurable: true,
247
+ writable: true,
248
+ value: void 0
249
+ });
250
+ Object.defineProperty(this, "notes", {
251
+ enumerable: true,
252
+ configurable: true,
253
+ writable: true,
254
+ value: void 0
255
+ });
256
+ Object.defineProperty(this, "owner", {
257
+ enumerable: true,
258
+ configurable: true,
259
+ writable: true,
260
+ value: void 0
261
+ });
262
+ Object.defineProperty(this, "createdAt", {
263
+ enumerable: true,
264
+ configurable: true,
265
+ writable: true,
266
+ value: void 0
267
+ });
268
+ Object.defineProperty(this, "updatedAt", {
269
+ enumerable: true,
270
+ configurable: true,
271
+ writable: true,
272
+ value: void 0
273
+ });
274
+ this.id = data.id;
275
+ this.name = data.name;
276
+ this.hostname = data.hostname;
277
+ this.color = data.color;
278
+ this.notes = data.notes;
279
+ this.owner = new CachedRelation(() => Member.get(api, data.owner_id));
280
+ this.createdAt = new Date(data.created_at);
281
+ this.updatedAt = new Date(data.updated_at);
282
+ }
283
+ }
284
+ export class NodeType {
285
+ constructor(api, data) {
286
+ Object.defineProperty(this, "api", {
287
+ enumerable: true,
288
+ configurable: true,
289
+ writable: true,
290
+ value: api
291
+ });
292
+ Object.defineProperty(this, "id", {
293
+ enumerable: true,
294
+ configurable: true,
295
+ writable: true,
296
+ value: void 0
297
+ });
298
+ Object.defineProperty(this, "name", {
299
+ enumerable: true,
300
+ configurable: true,
301
+ writable: true,
302
+ value: void 0
303
+ });
304
+ Object.defineProperty(this, "short", {
305
+ enumerable: true,
306
+ configurable: true,
307
+ writable: true,
308
+ value: void 0
309
+ });
310
+ Object.defineProperty(this, "notes", {
311
+ enumerable: true,
312
+ configurable: true,
313
+ writable: true,
314
+ value: void 0
315
+ });
316
+ Object.defineProperty(this, "owner", {
317
+ enumerable: true,
318
+ configurable: true,
319
+ writable: true,
320
+ value: void 0
321
+ });
322
+ Object.defineProperty(this, "createdAt", {
323
+ enumerable: true,
324
+ configurable: true,
325
+ writable: true,
326
+ value: void 0
327
+ });
328
+ Object.defineProperty(this, "updatedAt", {
329
+ enumerable: true,
330
+ configurable: true,
331
+ writable: true,
332
+ value: void 0
333
+ });
334
+ this.id = data.id;
335
+ this.name = data.name;
336
+ this.short = data.short;
337
+ this.notes = data.notes;
338
+ this.owner = new CachedRelation(() => Member.get(api, data.owner_id));
339
+ this.createdAt = new Date(data.created_at);
340
+ this.updatedAt = new Date(data.updated_at);
341
+ }
342
+ }
@@ -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 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