@meowpanel/api 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/esm/mod.d.ts +39 -18
  2. package/esm/mod.d.ts.map +1 -1
  3. package/esm/mod.js +26 -8
  4. package/esm/src/client.d.ts +48 -11
  5. package/esm/src/client.d.ts.map +1 -1
  6. package/esm/src/client.js +53 -12
  7. package/esm/src/errors.d.ts +8 -0
  8. package/esm/src/errors.d.ts.map +1 -1
  9. package/esm/src/errors.js +10 -0
  10. package/esm/src/http.d.ts +2 -2
  11. package/esm/src/http.d.ts.map +1 -1
  12. package/esm/src/http.js +5 -2
  13. package/esm/src/namespace.d.ts +1 -1
  14. package/esm/src/namespace.js +1 -1
  15. package/esm/src/resources/account.d.ts +104 -19
  16. package/esm/src/resources/account.d.ts.map +1 -1
  17. package/esm/src/resources/account.js +112 -13
  18. package/esm/src/resources/api-keys.d.ts +16 -24
  19. package/esm/src/resources/api-keys.d.ts.map +1 -1
  20. package/esm/src/resources/api-keys.js +16 -20
  21. package/esm/src/resources/auth.d.ts +70 -4
  22. package/esm/src/resources/auth.d.ts.map +1 -1
  23. package/esm/src/resources/auth.js +47 -4
  24. package/esm/src/resources/eggs.d.ts +261 -22
  25. package/esm/src/resources/eggs.d.ts.map +1 -1
  26. package/esm/src/resources/eggs.js +261 -25
  27. package/esm/src/resources/features.d.ts +35 -0
  28. package/esm/src/resources/features.d.ts.map +1 -0
  29. package/esm/src/resources/features.js +21 -0
  30. package/esm/src/resources/hosts.d.ts +143 -18
  31. package/esm/src/resources/hosts.d.ts.map +1 -1
  32. package/esm/src/resources/hosts.js +145 -10
  33. package/esm/src/resources/logs.d.ts +39 -0
  34. package/esm/src/resources/logs.d.ts.map +1 -0
  35. package/esm/src/resources/logs.js +38 -0
  36. package/esm/src/resources/nodes.d.ts +106 -41
  37. package/esm/src/resources/nodes.d.ts.map +1 -1
  38. package/esm/src/resources/nodes.js +121 -28
  39. package/esm/src/resources/permissions.d.ts +45 -0
  40. package/esm/src/resources/permissions.d.ts.map +1 -0
  41. package/esm/src/resources/permissions.js +26 -0
  42. package/esm/src/resources/request-logs.d.ts +91 -0
  43. package/esm/src/resources/request-logs.d.ts.map +1 -0
  44. package/esm/src/resources/request-logs.js +70 -0
  45. package/esm/src/resources/roles.d.ts +128 -0
  46. package/esm/src/resources/roles.d.ts.map +1 -0
  47. package/esm/src/resources/roles.js +142 -0
  48. package/esm/src/resources/server-groups.d.ts +141 -7
  49. package/esm/src/resources/server-groups.d.ts.map +1 -1
  50. package/esm/src/resources/server-groups.js +157 -8
  51. package/esm/src/resources/servers/activity.d.ts +50 -8
  52. package/esm/src/resources/servers/activity.d.ts.map +1 -1
  53. package/esm/src/resources/servers/activity.js +54 -13
  54. package/esm/src/resources/servers/allocations.d.ts +3 -3
  55. package/esm/src/resources/servers/allocations.d.ts.map +1 -1
  56. package/esm/src/resources/servers/allocations.js +7 -7
  57. package/esm/src/resources/servers/backups.d.ts +46 -0
  58. package/esm/src/resources/servers/backups.d.ts.map +1 -0
  59. package/esm/src/resources/servers/backups.js +43 -0
  60. package/esm/src/resources/servers/connection.d.ts +27 -7
  61. package/esm/src/resources/servers/connection.d.ts.map +1 -1
  62. package/esm/src/resources/servers/connection.js +28 -7
  63. package/esm/src/resources/servers/features.d.ts +81 -0
  64. package/esm/src/resources/servers/features.d.ts.map +1 -0
  65. package/esm/src/resources/servers/features.js +60 -0
  66. package/esm/src/resources/servers/files.d.ts +41 -53
  67. package/esm/src/resources/servers/files.d.ts.map +1 -1
  68. package/esm/src/resources/servers/files.js +74 -116
  69. package/esm/src/resources/servers/index.d.ts +46 -27
  70. package/esm/src/resources/servers/index.d.ts.map +1 -1
  71. package/esm/src/resources/servers/index.js +26 -12
  72. package/esm/src/resources/servers/jobs.d.ts +88 -0
  73. package/esm/src/resources/servers/jobs.d.ts.map +1 -0
  74. package/esm/src/resources/servers/jobs.js +115 -0
  75. package/esm/src/resources/servers/node-client.d.ts +33 -0
  76. package/esm/src/resources/servers/node-client.d.ts.map +1 -0
  77. package/esm/src/resources/servers/node-client.js +61 -0
  78. package/esm/src/resources/servers/profiles.d.ts +45 -1
  79. package/esm/src/resources/servers/profiles.d.ts.map +1 -1
  80. package/esm/src/resources/servers/profiles.js +55 -2
  81. package/esm/src/resources/servers/server.d.ts +10 -25
  82. package/esm/src/resources/servers/server.d.ts.map +1 -1
  83. package/esm/src/resources/servers/server.js +18 -34
  84. package/esm/src/resources/servers/sftp.d.ts +21 -19
  85. package/esm/src/resources/servers/sftp.d.ts.map +1 -1
  86. package/esm/src/resources/servers/sftp.js +22 -14
  87. package/esm/src/resources/servers/sub-users.d.ts +99 -0
  88. package/esm/src/resources/servers/sub-users.d.ts.map +1 -0
  89. package/esm/src/resources/servers/sub-users.js +94 -0
  90. package/esm/src/resources/servers/types.d.ts +27 -25
  91. package/esm/src/resources/servers/types.d.ts.map +1 -1
  92. package/esm/src/resources/systems.d.ts +124 -0
  93. package/esm/src/resources/systems.d.ts.map +1 -0
  94. package/esm/src/resources/systems.js +139 -0
  95. package/esm/src/resources/users.d.ts +330 -0
  96. package/esm/src/resources/users.d.ts.map +1 -0
  97. package/esm/src/resources/users.js +280 -0
  98. package/esm/src/types.d.ts +18 -1
  99. package/esm/src/types.d.ts.map +1 -1
  100. package/esm/src/types.js +11 -0
  101. package/package.json +1 -1
  102. package/script/mod.d.ts +39 -18
  103. package/script/mod.d.ts.map +1 -1
  104. package/script/mod.js +52 -5
  105. package/script/src/client.d.ts +48 -11
  106. package/script/src/client.d.ts.map +1 -1
  107. package/script/src/client.js +53 -12
  108. package/script/src/errors.d.ts +8 -0
  109. package/script/src/errors.d.ts.map +1 -1
  110. package/script/src/errors.js +10 -0
  111. package/script/src/http.d.ts +2 -2
  112. package/script/src/http.d.ts.map +1 -1
  113. package/script/src/http.js +5 -2
  114. package/script/src/namespace.d.ts +1 -1
  115. package/script/src/namespace.js +1 -1
  116. package/script/src/resources/account.d.ts +104 -19
  117. package/script/src/resources/account.d.ts.map +1 -1
  118. package/script/src/resources/account.js +114 -13
  119. package/script/src/resources/api-keys.d.ts +16 -24
  120. package/script/src/resources/api-keys.d.ts.map +1 -1
  121. package/script/src/resources/api-keys.js +15 -19
  122. package/script/src/resources/auth.d.ts +70 -4
  123. package/script/src/resources/auth.d.ts.map +1 -1
  124. package/script/src/resources/auth.js +47 -4
  125. package/script/src/resources/eggs.d.ts +261 -22
  126. package/script/src/resources/eggs.d.ts.map +1 -1
  127. package/script/src/resources/eggs.js +267 -26
  128. package/script/src/resources/features.d.ts +35 -0
  129. package/script/src/resources/features.d.ts.map +1 -0
  130. package/script/src/resources/features.js +25 -0
  131. package/script/src/resources/hosts.d.ts +143 -18
  132. package/script/src/resources/hosts.d.ts.map +1 -1
  133. package/script/src/resources/hosts.js +146 -10
  134. package/script/src/resources/logs.d.ts +39 -0
  135. package/script/src/resources/logs.d.ts.map +1 -0
  136. package/script/src/resources/logs.js +42 -0
  137. package/script/src/resources/nodes.d.ts +106 -41
  138. package/script/src/resources/nodes.d.ts.map +1 -1
  139. package/script/src/resources/nodes.js +122 -28
  140. package/script/src/resources/permissions.d.ts +45 -0
  141. package/script/src/resources/permissions.d.ts.map +1 -0
  142. package/script/src/resources/permissions.js +31 -0
  143. package/script/src/resources/request-logs.d.ts +91 -0
  144. package/script/src/resources/request-logs.d.ts.map +1 -0
  145. package/script/src/resources/request-logs.js +75 -0
  146. package/script/src/resources/roles.d.ts +128 -0
  147. package/script/src/resources/roles.d.ts.map +1 -0
  148. package/script/src/resources/roles.js +148 -0
  149. package/script/src/resources/server-groups.d.ts +141 -7
  150. package/script/src/resources/server-groups.d.ts.map +1 -1
  151. package/script/src/resources/server-groups.js +158 -8
  152. package/script/src/resources/servers/activity.d.ts +50 -8
  153. package/script/src/resources/servers/activity.d.ts.map +1 -1
  154. package/script/src/resources/servers/activity.js +54 -12
  155. package/script/src/resources/servers/allocations.d.ts +3 -3
  156. package/script/src/resources/servers/allocations.d.ts.map +1 -1
  157. package/script/src/resources/servers/allocations.js +7 -7
  158. package/script/src/resources/servers/backups.d.ts +46 -0
  159. package/script/src/resources/servers/backups.d.ts.map +1 -0
  160. package/script/src/resources/servers/backups.js +47 -0
  161. package/script/src/resources/servers/connection.d.ts +27 -7
  162. package/script/src/resources/servers/connection.d.ts.map +1 -1
  163. package/script/src/resources/servers/connection.js +28 -7
  164. package/script/src/resources/servers/features.d.ts +81 -0
  165. package/script/src/resources/servers/features.d.ts.map +1 -0
  166. package/script/src/resources/servers/features.js +64 -0
  167. package/script/src/resources/servers/files.d.ts +41 -53
  168. package/script/src/resources/servers/files.d.ts.map +1 -1
  169. package/script/src/resources/servers/files.js +74 -116
  170. package/script/src/resources/servers/index.d.ts +46 -27
  171. package/script/src/resources/servers/index.d.ts.map +1 -1
  172. package/script/src/resources/servers/index.js +26 -12
  173. package/script/src/resources/servers/jobs.d.ts +88 -0
  174. package/script/src/resources/servers/jobs.d.ts.map +1 -0
  175. package/script/src/resources/servers/jobs.js +120 -0
  176. package/script/src/resources/servers/node-client.d.ts +33 -0
  177. package/script/src/resources/servers/node-client.d.ts.map +1 -0
  178. package/script/src/resources/servers/node-client.js +65 -0
  179. package/script/src/resources/servers/profiles.d.ts +45 -1
  180. package/script/src/resources/servers/profiles.d.ts.map +1 -1
  181. package/script/src/resources/servers/profiles.js +55 -2
  182. package/script/src/resources/servers/server.d.ts +10 -25
  183. package/script/src/resources/servers/server.d.ts.map +1 -1
  184. package/script/src/resources/servers/server.js +18 -34
  185. package/script/src/resources/servers/sftp.d.ts +21 -19
  186. package/script/src/resources/servers/sftp.d.ts.map +1 -1
  187. package/script/src/resources/servers/sftp.js +22 -14
  188. package/script/src/resources/servers/sub-users.d.ts +99 -0
  189. package/script/src/resources/servers/sub-users.d.ts.map +1 -0
  190. package/script/src/resources/servers/sub-users.js +99 -0
  191. package/script/src/resources/servers/types.d.ts +27 -25
  192. package/script/src/resources/servers/types.d.ts.map +1 -1
  193. package/script/src/resources/systems.d.ts +124 -0
  194. package/script/src/resources/systems.d.ts.map +1 -0
  195. package/script/src/resources/systems.js +145 -0
  196. package/script/src/resources/users.d.ts +330 -0
  197. package/script/src/resources/users.d.ts.map +1 -0
  198. package/script/src/resources/users.js +287 -0
  199. package/script/src/types.d.ts +18 -1
  200. package/script/src/types.d.ts.map +1 -1
  201. package/script/src/types.js +12 -0
  202. package/esm/src/resources/members.d.ts +0 -138
  203. package/esm/src/resources/members.d.ts.map +0 -1
  204. package/esm/src/resources/members.js +0 -122
  205. package/script/src/resources/members.d.ts +0 -138
  206. package/script/src/resources/members.d.ts.map +0 -1
  207. package/script/src/resources/members.js +0 -127
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodesNamespace = exports.NodeAllocationsManager = exports.Node = exports.NodeAllocationIp = exports.NodeAllocationPort = exports.NodeType = exports.NodeLocation = void 0;
3
+ exports.NodesNamespace = exports.NodeClassifierManager = exports.NodeAllocationsManager = exports.Node = exports.NodeAllocationIp = exports.NodeAllocationPort = exports.NodeType = exports.NodeLocation = void 0;
4
4
  const namespace_js_1 = require("../namespace.js");
5
5
  const reactive_js_1 = require("../reactive.js");
6
6
  const types_js_1 = require("../types.js");
7
- const members_js_1 = require("./members.js");
7
+ const users_js_1 = require("./users.js");
8
+ const hosts_js_1 = require("./hosts.js");
8
9
  const activity_js_1 = require("./servers/activity.js");
9
10
  /**
10
11
  * A geographic location associated with one or more nodes.
@@ -16,10 +17,10 @@ class NodeLocation extends reactive_js_1.ReactiveResource {
16
17
  name;
17
18
  /** Short code used in node name generation, e.g. `"use"`. */
18
19
  short;
19
- /** The owner's NanoID. Always present. */
20
- ownerId;
21
- /** The full owner object. Requires `?include=owner`. */
22
- owner;
20
+ /** The host's NanoID. Always present. */
21
+ hostId;
22
+ /** The full host object. Requires `?include=host`. */
23
+ host;
23
24
  /** Internal notes. */
24
25
  notes;
25
26
  /** When this location was created. */
@@ -32,8 +33,8 @@ class NodeLocation extends reactive_js_1.ReactiveResource {
32
33
  this.id = (0, types_js_1.toNanoID)(data.id);
33
34
  this.name = data.name;
34
35
  this.short = data.short;
35
- this.ownerId = (0, types_js_1.toNanoID)(data.owner_id);
36
- this.owner = data.owner ? new members_js_1.Member(data.owner) : undefined;
36
+ this.hostId = (0, types_js_1.toNanoID)(data.host_id);
37
+ this.host = data.host ? new hosts_js_1.Host(data.host) : undefined;
37
38
  this.notes = data.notes;
38
39
  this.createdAt = new Date(data.created_at);
39
40
  this.updatedAt = new Date(data.updated_at);
@@ -50,10 +51,10 @@ class NodeType extends reactive_js_1.ReactiveResource {
50
51
  name;
51
52
  /** Short code used in node name generation, e.g. `"a"`. */
52
53
  short;
53
- /** The owner's NanoID. Always present. */
54
- ownerId;
55
- /** The full owner object. Requires `?include=owner`. */
56
- owner;
54
+ /** The host's NanoID. Always present. */
55
+ hostId;
56
+ /** The full host object. Requires `?include=host`. */
57
+ host;
57
58
  /** Internal notes. */
58
59
  notes;
59
60
  /** When this type was created. */
@@ -66,8 +67,8 @@ class NodeType extends reactive_js_1.ReactiveResource {
66
67
  this.id = (0, types_js_1.toNanoID)(data.id);
67
68
  this.name = data.name;
68
69
  this.short = data.short;
69
- this.ownerId = (0, types_js_1.toNanoID)(data.owner_id);
70
- this.owner = data.owner ? new members_js_1.Member(data.owner) : undefined;
70
+ this.hostId = (0, types_js_1.toNanoID)(data.host_id);
71
+ this.host = data.host ? new hosts_js_1.Host(data.host) : undefined;
71
72
  this.notes = data.notes;
72
73
  this.createdAt = new Date(data.created_at);
73
74
  this.updatedAt = new Date(data.updated_at);
@@ -118,7 +119,7 @@ class NodeAllocationIp extends reactive_js_1.ReactiveResource {
118
119
  super();
119
120
  this.id = (0, types_js_1.toNanoID)(data.id);
120
121
  this.ip = data.ip;
121
- this.ipAlias = data.ipAlias;
122
+ this.ipAlias = data.ip_alias;
122
123
  this.ports = data.ports.map((port) => new NodeAllocationPort(port));
123
124
  this.nodeId = (0, types_js_1.toNanoID)(data.node_id);
124
125
  this.node = data.node ? new Node(data.node) : undefined;
@@ -136,8 +137,6 @@ exports.NodeAllocationIp = NodeAllocationIp;
136
137
  class Node extends reactive_js_1.ReactiveResource {
137
138
  /** The node's unique NanoID. */
138
139
  id;
139
- /** The issuer type, always `'node'`. */
140
- issuerType;
141
140
  /**
142
141
  * Auto-generated display name in the format `{type}{num}{location}.{hostname}`,
143
142
  * e.g. `"a001use.host.example.com"`.
@@ -145,8 +144,10 @@ class Node extends reactive_js_1.ReactiveResource {
145
144
  name;
146
145
  /** Optional description of the node. */
147
146
  description;
148
- /** The owner's NanoID. Always present. */
147
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). Always present. */
149
148
  ownerId;
149
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
150
+ ownerType;
150
151
  /** The full owner object. Requires `?include=owner`. */
151
152
  owner;
152
153
  /** The location's NanoID. Always present. */
@@ -161,11 +162,6 @@ class Node extends reactive_js_1.ReactiveResource {
161
162
  num;
162
163
  /** Resource limits configured for this node. */
163
164
  limits;
164
- /**
165
- * Daemon authentication token row id. `null` while the node is unclaimed,
166
- * populated once a daemon redeems its install token.
167
- */
168
- authToken;
169
165
  /** Lifecycle state. See {@link NodeStatus}. */
170
166
  status;
171
167
  /** Timestamp of the first successful claim. `null` until claimed. */
@@ -184,21 +180,24 @@ class Node extends reactive_js_1.ReactiveResource {
184
180
  canAutoDeploy;
185
181
  /** `true` when the node is behind a reverse proxy. */
186
182
  isBehindProxy;
187
- /** Internal notes visible to administrators. */
183
+ /** Internal notes. Requires `node.notes.read`. */
188
184
  notes;
189
185
  /** When this node was registered. */
190
186
  createdAt;
191
187
  /** When this node was last updated. */
192
188
  updatedAt;
189
+ /** When this node was soft-deleted, or `null` if active. */
190
+ deletedAt;
193
191
  /** @internal */
194
192
  constructor(data) {
195
193
  super();
196
194
  this.id = (0, types_js_1.toNanoID)(data.id);
197
- this.issuerType = data.issuer_type;
198
195
  this.name = data.name;
199
196
  this.description = data.description;
200
- this.ownerId = (0, types_js_1.toNanoID)(data.owner_id);
201
- this.owner = data.owner ? new members_js_1.Member(data.owner) : undefined;
197
+ const owner = (0, types_js_1.parseIssuerRef)(data.owner_id);
198
+ this.ownerId = owner.id;
199
+ this.ownerType = owner.type;
200
+ this.owner = data.owner ? new users_js_1.User(data.owner) : undefined;
202
201
  this.locationId = (0, types_js_1.toNanoID)(data.location_id);
203
202
  this.location = data.location ? new NodeLocation(data.location) : undefined;
204
203
  this.typeId = (0, types_js_1.toNanoID)(data.type_id);
@@ -211,7 +210,6 @@ class Node extends reactive_js_1.ReactiveResource {
211
210
  diskOverallocateMb: data.limits.disk_overallocate_mb,
212
211
  uploadSizeMb: data.limits.upload_size_mb,
213
212
  };
214
- this.authToken = data.auth_token;
215
213
  this.status = data.status;
216
214
  this.claimedAt = data.claimed_at ? new Date(data.claimed_at) : null;
217
215
  this.installTokenExpiresAt = data.install_token_expires_at === undefined
@@ -226,6 +224,7 @@ class Node extends reactive_js_1.ReactiveResource {
226
224
  this.notes = data.notes;
227
225
  this.createdAt = new Date(data.created_at);
228
226
  this.updatedAt = new Date(data.updated_at);
227
+ this.deletedAt = data.deleted_at ? new Date(data.deleted_at) : null;
229
228
  }
230
229
  }
231
230
  exports.Node = Node;
@@ -279,6 +278,49 @@ class NodeAllocationsManager {
279
278
  }
280
279
  }
281
280
  exports.NodeAllocationsManager = NodeAllocationsManager;
281
+ /**
282
+ * CRUD for a node classifier (location or type).
283
+ *
284
+ * Access via `api.nodes.locations` or `api.nodes.types`.
285
+ */
286
+ class NodeClassifierManager {
287
+ http;
288
+ path;
289
+ make;
290
+ /** @internal */
291
+ constructor(http, path, make) {
292
+ this.http = http;
293
+ this.path = path;
294
+ this.make = make;
295
+ }
296
+ /** Fetch a paginated list. */
297
+ async list(opts = {}) {
298
+ const result = await this.http.list(this.path, opts);
299
+ return { ...result, data: result.data.map((d) => this.make(d)) };
300
+ }
301
+ /** Fetch a single entry by ID. */
302
+ async get(id) {
303
+ return this.make(await this.http.get(`${this.path}/${id}`));
304
+ }
305
+ /** Create a new entry. */
306
+ async create(payload) {
307
+ return this.make(await this.http.post(this.path, {
308
+ name: payload.name,
309
+ short: payload.short,
310
+ host_id: payload.hostId,
311
+ notes: payload.notes,
312
+ }));
313
+ }
314
+ /** Update an entry's name, short code, or notes. */
315
+ async update(id, payload) {
316
+ return this.make(await this.http.patch(`${this.path}/${id}`, payload));
317
+ }
318
+ /** Delete an entry. */
319
+ async delete(id) {
320
+ await this.http.delete(`${this.path}/${id}`);
321
+ }
322
+ }
323
+ exports.NodeClassifierManager = NodeClassifierManager;
282
324
  /**
283
325
  * Namespace for node management.
284
326
  *
@@ -292,9 +334,15 @@ exports.NodeAllocationsManager = NodeAllocationsManager;
292
334
  * ```
293
335
  */
294
336
  class NodesNamespace extends namespace_js_1.ResourceNamespace {
337
+ /** Manage node locations. */
338
+ locations;
339
+ /** Manage node types. */
340
+ types;
295
341
  /** @internal */
296
342
  constructor(http) {
297
343
  super(http);
344
+ this.locations = new NodeClassifierManager(http, '/nodes/locations', (d) => new NodeLocation(d));
345
+ this.types = new NodeClassifierManager(http, '/nodes/types', (d) => new NodeType(d));
298
346
  }
299
347
  /**
300
348
  * Fetch a paginated list of nodes.
@@ -363,6 +411,52 @@ class NodesNamespace extends namespace_js_1.ResourceNamespace {
363
411
  installTokenExpiresAt: new Date(data.install_token_expires_at),
364
412
  };
365
413
  }
414
+ /** Update a node's connection details, placement, limits, or flags. */
415
+ async update(id, payload) {
416
+ const body = {};
417
+ if (payload.fqdn !== undefined)
418
+ body['fqdn'] = payload.fqdn;
419
+ if (payload.scheme !== undefined)
420
+ body['scheme'] = payload.scheme;
421
+ if (payload.apiPort !== undefined)
422
+ body['api_port'] = payload.apiPort;
423
+ if (payload.sftpPort !== undefined)
424
+ body['sftp_port'] = payload.sftpPort;
425
+ if (payload.locationId !== undefined)
426
+ body['location_id'] = payload.locationId;
427
+ if (payload.typeId !== undefined)
428
+ body['type_id'] = payload.typeId;
429
+ if (payload.num !== undefined)
430
+ body['num'] = payload.num;
431
+ if (payload.description !== undefined)
432
+ body['description'] = payload.description;
433
+ if (payload.notes !== undefined)
434
+ body['notes'] = payload.notes;
435
+ if (payload.isMaintenanceMode !== undefined)
436
+ body['is_maintenance_mode'] = payload.isMaintenanceMode;
437
+ if (payload.canAutoDeploy !== undefined)
438
+ body['can_auto_deploy'] = payload.canAutoDeploy;
439
+ if (payload.isBehindProxy !== undefined)
440
+ body['is_behind_proxy'] = payload.isBehindProxy;
441
+ if (payload.limits) {
442
+ body['limits'] = {
443
+ memory_mb: payload.limits.memoryMb,
444
+ memory_overallocate_mb: payload.limits.memoryOverallocateMb,
445
+ disk_mb: payload.limits.diskMb,
446
+ disk_overallocate_mb: payload.limits.diskOverallocateMb,
447
+ upload_size_mb: payload.limits.uploadSizeMb,
448
+ };
449
+ }
450
+ const data = await this.http.patch(`/nodes/${id}`, body);
451
+ const node = new Node(data);
452
+ this.upsertCache(node);
453
+ return node;
454
+ }
455
+ /** Delete a node. */
456
+ async delete(id) {
457
+ await this.http.delete(`/nodes/${id}`);
458
+ this.removeFromCache(id);
459
+ }
366
460
  /**
367
461
  * Claim a node by redeeming its install token. Public endpoint, no
368
462
  * Authorization header. Returns a permanent daemon token; the install
@@ -0,0 +1,45 @@
1
+ import type { ISODate } from '../types.js';
2
+ /** Raw API shape for a permission grant. @internal */
3
+ export interface PermissionGrantData {
4
+ permission: string;
5
+ is_allow: boolean;
6
+ scope: string | null;
7
+ expires_at: ISODate | null;
8
+ granted_at: ISODate;
9
+ }
10
+ /**
11
+ * A permission grant as returned by a grants endpoint.
12
+ *
13
+ * These are direct grants on the actor only, not role-derived and not expanded to
14
+ * ancestor scopes.
15
+ */
16
+ export interface PermissionGrant {
17
+ /** The permission name, e.g. `"server.console.read"`. */
18
+ permission: string;
19
+ /** `true` for an allow grant, `false` for a deny. */
20
+ isAllow: boolean;
21
+ /** The namespaced scope (`"<type>:<id>"`), or `null` for a global grant. */
22
+ scope: string | null;
23
+ /** When the grant expires, or `null` if it never expires. */
24
+ expiresAt: Date | null;
25
+ /** When the grant was created. */
26
+ grantedAt: Date;
27
+ }
28
+ /** A permission grant to apply. */
29
+ export interface PermissionGrantInput {
30
+ /** The permission name, e.g. `"server.console.read"`. */
31
+ permission: string;
32
+ /** Namespaced scope (`"<type>:<id>"`). Omit for a global grant. */
33
+ scope?: string;
34
+ /** `false` to create a deny grant. Defaults to allow. */
35
+ isAllow?: boolean;
36
+ /** Expiry. `null` clears an existing expiry; omit to leave it unchanged. */
37
+ expiresAt?: Date | null;
38
+ }
39
+ /** Map a raw grant to its client shape. @internal */
40
+ export declare function parseGrant(data: PermissionGrantData): PermissionGrant;
41
+ /** Serialize a grant input to its request body. @internal */
42
+ export declare function grantToBody(input: PermissionGrantInput): Record<string, unknown>;
43
+ /** Normalize one-or-many grant inputs to the array body the grant endpoints accept. @internal */
44
+ export declare function grantsToBody(grants: PermissionGrantInput | PermissionGrantInput[]): Record<string, unknown>[];
45
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/src/resources/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6DAA6D;IAC7D,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,kCAAkC;IAClC,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,mCAAmC;AACnC,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAQrE;AAED,6DAA6D;AAC7D,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQhF;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAE7G"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseGrant = parseGrant;
4
+ exports.grantToBody = grantToBody;
5
+ exports.grantsToBody = grantsToBody;
6
+ /** Map a raw grant to its client shape. @internal */
7
+ function parseGrant(data) {
8
+ return {
9
+ permission: data.permission,
10
+ isAllow: data.is_allow,
11
+ scope: data.scope,
12
+ expiresAt: data.expires_at ? new Date(data.expires_at) : null,
13
+ grantedAt: new Date(data.granted_at),
14
+ };
15
+ }
16
+ /** Serialize a grant input to its request body. @internal */
17
+ function grantToBody(input) {
18
+ const body = { permission: input.permission };
19
+ if (input.scope !== undefined)
20
+ body['scope'] = input.scope;
21
+ if (input.isAllow !== undefined)
22
+ body['is_allow'] = input.isAllow;
23
+ if (input.expiresAt !== undefined) {
24
+ body['expires_at'] = input.expiresAt === null ? null : input.expiresAt.toISOString();
25
+ }
26
+ return body;
27
+ }
28
+ /** Normalize one-or-many grant inputs to the array body the grant endpoints accept. @internal */
29
+ function grantsToBody(grants) {
30
+ return (Array.isArray(grants) ? grants : [grants]).map(grantToBody);
31
+ }
@@ -0,0 +1,91 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import { type ISODate, type NanoID, type Paginated } from '../types.js';
3
+ import { User, type UserData } from './users.js';
4
+ /** Raw API shape for a request-log line. @internal */
5
+ interface RequestLogLineData {
6
+ id: string;
7
+ level: string;
8
+ message: string;
9
+ elapsed_time: number;
10
+ metadata?: Record<string, unknown>;
11
+ created_at: ISODate;
12
+ }
13
+ /** Raw API shape for a request log. @internal */
14
+ export interface RequestLogData {
15
+ id: string;
16
+ method: string;
17
+ path: string;
18
+ issuer_id?: string;
19
+ issuer?: UserData;
20
+ ip?: string | null;
21
+ client_request_id: string | null;
22
+ logs?: RequestLogLineData[];
23
+ created_at: ISODate;
24
+ }
25
+ /** One log line emitted while handling a request. */
26
+ export interface RequestLogLine {
27
+ id: NanoID;
28
+ /** Log level, e.g. `"info"`, `"error"`. */
29
+ level: string;
30
+ message: string;
31
+ /** Time elapsed at this line, in milliseconds. */
32
+ elapsedTime: number;
33
+ /** Structured metadata. Requires `application.logs.sensitive.read`. */
34
+ metadata: Record<string, unknown> | undefined;
35
+ createdAt: Date;
36
+ }
37
+ /**
38
+ * A logged HTTP request.
39
+ *
40
+ * The `clientRequestId` matches the `x-request-id` response header, so a client can
41
+ * correlate a response with its server-side log.
42
+ *
43
+ * Retrieved via `api.logs.requests` or `api.account.requestLogs`.
44
+ */
45
+ export declare class RequestLog {
46
+ /** The request log's unique NanoID. */
47
+ readonly id: NanoID;
48
+ /** HTTP method, e.g. `"GET"`. */
49
+ readonly method: string;
50
+ /** Request path. */
51
+ readonly path: string;
52
+ /** The issuer's bare NanoID (parsed from the namespaced `issuer_id`), or `null` for an unauthenticated request. */
53
+ readonly issuerId: NanoID | null;
54
+ /** The issuer's type, e.g. `'user'`, `'system'`, or `null`. */
55
+ readonly issuerType: string | null;
56
+ /** The expanded issuer. Requires `?include=issuer`. */
57
+ readonly issuer: User | undefined;
58
+ /** The source IP. Requires `application.logs.sensitive.read`. */
59
+ readonly ip: string | null | undefined;
60
+ /** The client-supplied correlation id (matches the `x-request-id` header). */
61
+ readonly clientRequestId: string | null;
62
+ /** The request's log lines. Requires `?include=logs`. */
63
+ readonly logs: RequestLogLine[] | undefined;
64
+ /** When the request was received. */
65
+ readonly createdAt: Date;
66
+ /** @internal */
67
+ constructor(data: RequestLogData);
68
+ }
69
+ /** Which related data to include in a request-log response. */
70
+ export type RequestLogInclude = 'logs' | 'issuer';
71
+ /** Query options for a request-log feed. */
72
+ export interface RequestLogFeedOptions {
73
+ page?: number;
74
+ perPage?: number;
75
+ /** Sort order by creation time. Defaults to oldest-first. */
76
+ sort?: 'created_at_asc' | 'created_at_desc';
77
+ /** Filter by HTTP method. */
78
+ method?: string;
79
+ /** Filter by request path. */
80
+ path?: string;
81
+ /** Filter by the issuer's auth-issuer id. */
82
+ issuerId?: string;
83
+ /** Filter by the client correlation id. */
84
+ clientRequestId?: string;
85
+ /** Related data to include. */
86
+ include?: RequestLogInclude[];
87
+ }
88
+ /** Fetch a request-log feed and map the entries to {@link RequestLog} instances. @internal */
89
+ export declare function listRequestLogs(http: HttpClient, path: string, opts?: RequestLogFeedOptions): Promise<Paginated<RequestLog>>;
90
+ export {};
91
+ //# sourceMappingURL=request-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-logs.d.ts","sourceRoot":"","sources":["../../../src/src/resources/request-logs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,SAAS,EAA4B,MAAM,aAAa,CAAC;AAChH,OAAO,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;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,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,uDAAuD;IACvD,SAAgB,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC;IACzC,iEAAiE;IACjE,SAAgB,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,8EAA8E;IAC9E,SAAgB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,yDAAyD;IACzD,SAAgB,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnD,qCAAqC;IACrC,SAAgB,SAAS,EAAE,IAAI,CAAC;IAEhC,gBAAgB;gBACG,IAAI,EAAE,cAAc;CAavC;AAED,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElD,4CAA4C;AAC5C,MAAM,WAAW,qBAAqB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IAC5C,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,8FAA8F;AAC9F,wBAAsB,eAAe,CACpC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,qBAA0B,GAC9B,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAYhC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestLog = void 0;
4
+ exports.listRequestLogs = listRequestLogs;
5
+ const types_js_1 = require("../types.js");
6
+ const users_js_1 = require("./users.js");
7
+ function makeRequestLogLine(data) {
8
+ return {
9
+ id: (0, types_js_1.toNanoID)(data.id),
10
+ level: data.level,
11
+ message: data.message,
12
+ elapsedTime: data.elapsed_time,
13
+ metadata: data.metadata,
14
+ createdAt: new Date(data.created_at),
15
+ };
16
+ }
17
+ /**
18
+ * A logged HTTP request.
19
+ *
20
+ * The `clientRequestId` matches the `x-request-id` response header, so a client can
21
+ * correlate a response with its server-side log.
22
+ *
23
+ * Retrieved via `api.logs.requests` or `api.account.requestLogs`.
24
+ */
25
+ class RequestLog {
26
+ /** The request log's unique NanoID. */
27
+ id;
28
+ /** HTTP method, e.g. `"GET"`. */
29
+ method;
30
+ /** Request path. */
31
+ path;
32
+ /** The issuer's bare NanoID (parsed from the namespaced `issuer_id`), or `null` for an unauthenticated request. */
33
+ issuerId;
34
+ /** The issuer's type, e.g. `'user'`, `'system'`, or `null`. */
35
+ issuerType;
36
+ /** The expanded issuer. Requires `?include=issuer`. */
37
+ issuer;
38
+ /** The source IP. Requires `application.logs.sensitive.read`. */
39
+ ip;
40
+ /** The client-supplied correlation id (matches the `x-request-id` header). */
41
+ clientRequestId;
42
+ /** The request's log lines. Requires `?include=logs`. */
43
+ logs;
44
+ /** When the request was received. */
45
+ createdAt;
46
+ /** @internal */
47
+ constructor(data) {
48
+ this.id = (0, types_js_1.toNanoID)(data.id);
49
+ this.method = data.method;
50
+ this.path = data.path;
51
+ const issuer = data.issuer_id ? (0, types_js_1.parseIssuerRef)(data.issuer_id) : null;
52
+ this.issuerId = issuer ? issuer.id : null;
53
+ this.issuerType = issuer ? issuer.type : null;
54
+ this.issuer = data.issuer ? new users_js_1.User(data.issuer) : undefined;
55
+ this.ip = data.ip;
56
+ this.clientRequestId = data.client_request_id;
57
+ this.logs = data.logs?.map(makeRequestLogLine);
58
+ this.createdAt = new Date(data.created_at);
59
+ }
60
+ }
61
+ exports.RequestLog = RequestLog;
62
+ /** Fetch a request-log feed and map the entries to {@link RequestLog} instances. @internal */
63
+ async function listRequestLogs(http, path, opts = {}) {
64
+ const include = (0, types_js_1.joinIncludes)(opts);
65
+ const params = {
66
+ sort: opts.sort,
67
+ method: opts.method,
68
+ path: opts.path,
69
+ issuer_id: opts.issuerId,
70
+ client_request_id: opts.clientRequestId,
71
+ include,
72
+ };
73
+ const result = await http.list(path, { page: opts.page, perPage: opts.perPage }, params);
74
+ return { ...result, data: result.data.map((d) => new RequestLog(d)) };
75
+ }
@@ -0,0 +1,128 @@
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, type ResourceColor } from '../types.js';
5
+ import { type PermissionGrant, type PermissionGrantInput } from './permissions.js';
6
+ /** Raw API shape for a role. @internal */
7
+ export interface RoleData {
8
+ id: string;
9
+ title: string;
10
+ description: string | null;
11
+ color: ResourceColor | null;
12
+ /** Requires `permissions.roles.notes.read`. */
13
+ notes?: string | null;
14
+ created_at: ISODate;
15
+ updated_at: ISODate;
16
+ }
17
+ /**
18
+ * A named bundle of permissions that can be assigned to users.
19
+ *
20
+ * A role carries no permissions inline; fetch them via {@link RolesNamespace.permissions}.
21
+ * Its assignment scope and order live on the user-role link.
22
+ *
23
+ * Retrieved via {@link RolesNamespace.get} or {@link RolesNamespace.list}.
24
+ */
25
+ export declare class Role extends ReactiveResource {
26
+ /** The role's unique NanoID. */
27
+ readonly id: NanoID;
28
+ /** Display title, e.g. `"Support"`. */
29
+ title: string;
30
+ /** Optional description. */
31
+ description: string | null;
32
+ /** Color used in the UI for grouping, or `null`. */
33
+ color: ResourceColor | null;
34
+ /** Internal notes. Requires `permissions.roles.notes.read`. */
35
+ notes: string | null | undefined;
36
+ /** When this role was created. */
37
+ createdAt: Date;
38
+ /** When this role was last updated. */
39
+ updatedAt: Date;
40
+ /** @internal */
41
+ constructor(data: RoleData);
42
+ /** Apply raw API data to this role instance, updating all mutable fields. */
43
+ applyData(data: RoleData): void;
44
+ }
45
+ /** Fields accepted when creating a role. */
46
+ export interface CreateRolePayload {
47
+ title: string;
48
+ description?: string;
49
+ color?: ResourceColor;
50
+ notes?: string;
51
+ }
52
+ /** Fields accepted when updating a role. All optional. */
53
+ export interface UpdateRolePayload {
54
+ title?: string;
55
+ description?: string;
56
+ color?: ResourceColor;
57
+ notes?: string;
58
+ }
59
+ /** Typed events emitted by {@link RolesNamespace}. */
60
+ export interface RoleEvents {
61
+ created: Role;
62
+ updated: Role;
63
+ deleted: NanoID;
64
+ }
65
+ /**
66
+ * Manages the permission grants attached to a specific role.
67
+ *
68
+ * Access via `api.roles.permissions(roleId)`.
69
+ */
70
+ export declare class RolePermissionsManager {
71
+ private readonly roleId;
72
+ private readonly http;
73
+ /** @internal */
74
+ constructor(roleId: NanoID, http: HttpClient);
75
+ /** List the role's direct permission grants. */
76
+ list(): Promise<PermissionGrant[]>;
77
+ /**
78
+ * Grant one or more permissions to the role.
79
+ *
80
+ * Re-granting an existing `(permission, scope)` updates it. You cannot grant a
81
+ * permission you do not hold yourself at the target scope.
82
+ */
83
+ grant(grants: PermissionGrantInput | PermissionGrantInput[]): Promise<void>;
84
+ /**
85
+ * Revoke a permission from the role.
86
+ *
87
+ * @param permission The permission name to revoke.
88
+ * @param scope The namespaced scope (`"<type>:<id>"`) to revoke at, or omit for the global grant.
89
+ */
90
+ revoke(permission: string, scope?: string): Promise<void>;
91
+ }
92
+ /**
93
+ * Namespace for role management.
94
+ *
95
+ * Access via `api.roles`.
96
+ *
97
+ * @example
98
+ * ```ts ignore
99
+ * const roles = await api.roles.list();
100
+ * const role = await api.roles.create({ title: 'Support', color: 'blue' });
101
+ * await api.roles.permissions(role.id).grant({ permission: 'server.console.read' });
102
+ * ```
103
+ */
104
+ export declare class RolesNamespace extends ResourceNamespace<Role, RoleEvents> {
105
+ /** @internal */
106
+ constructor(http: HttpClient);
107
+ /**
108
+ * Fetch a paginated list of roles.
109
+ *
110
+ * @param opts Pagination and search options.
111
+ */
112
+ list(opts?: {
113
+ page?: number;
114
+ perPage?: number;
115
+ search?: string;
116
+ }): Promise<Paginated<Role>>;
117
+ /** Fetch a single role by ID. */
118
+ get(id: NanoID): Promise<Role>;
119
+ /** Create a new role. */
120
+ create(payload: CreateRolePayload): Promise<Role>;
121
+ /** Update a role's title, description, color, or notes. */
122
+ update(id: NanoID, payload: UpdateRolePayload): Promise<Role>;
123
+ /** Delete a role. Fails if the role is still assigned to any actor. */
124
+ delete(id: NanoID): Promise<void>;
125
+ /** Manage the permission grants attached to a role. */
126
+ permissions(roleId: NanoID): RolePermissionsManager;
127
+ }
128
+ //# sourceMappingURL=roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/src/resources/roles.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,EAAE,KAAK,aAAa,EAAY,MAAM,aAAa,CAAC;AACtG,OAAO,EAGN,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,MAAM,kBAAkB,CAAC;AAE1B,0CAA0C;AAC1C,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,IAAK,SAAQ,gBA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