@meowpanel/api 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/esm/mod.d.ts +37 -16
  2. package/esm/mod.d.ts.map +1 -1
  3. package/esm/mod.js +25 -7
  4. package/esm/src/client.d.ts +48 -11
  5. package/esm/src/client.d.ts.map +1 -1
  6. package/esm/src/client.js +53 -12
  7. package/esm/src/http.d.ts +2 -2
  8. package/esm/src/http.d.ts.map +1 -1
  9. package/esm/src/http.js +5 -2
  10. package/esm/src/namespace.d.ts +1 -1
  11. package/esm/src/namespace.js +1 -1
  12. package/esm/src/resources/account.d.ts +50 -19
  13. package/esm/src/resources/account.d.ts.map +1 -1
  14. package/esm/src/resources/account.js +51 -13
  15. package/esm/src/resources/api-keys.d.ts +16 -24
  16. package/esm/src/resources/api-keys.d.ts.map +1 -1
  17. package/esm/src/resources/api-keys.js +16 -20
  18. package/esm/src/resources/auth.d.ts +70 -4
  19. package/esm/src/resources/auth.d.ts.map +1 -1
  20. package/esm/src/resources/auth.js +47 -4
  21. package/esm/src/resources/eggs.d.ts +261 -22
  22. package/esm/src/resources/eggs.d.ts.map +1 -1
  23. package/esm/src/resources/eggs.js +261 -25
  24. package/esm/src/resources/features.d.ts +35 -0
  25. package/esm/src/resources/features.d.ts.map +1 -0
  26. package/esm/src/resources/features.js +21 -0
  27. package/esm/src/resources/hosts.d.ts +151 -21
  28. package/esm/src/resources/hosts.d.ts.map +1 -1
  29. package/esm/src/resources/hosts.js +143 -10
  30. package/esm/src/resources/logs.d.ts +39 -0
  31. package/esm/src/resources/logs.d.ts.map +1 -0
  32. package/esm/src/resources/logs.js +38 -0
  33. package/esm/src/resources/nodes.d.ts +108 -33
  34. package/esm/src/resources/nodes.d.ts.map +1 -1
  35. package/esm/src/resources/nodes.js +116 -24
  36. package/esm/src/resources/permissions.d.ts +45 -0
  37. package/esm/src/resources/permissions.d.ts.map +1 -0
  38. package/esm/src/resources/permissions.js +26 -0
  39. package/esm/src/resources/request-logs.d.ts +91 -0
  40. package/esm/src/resources/request-logs.d.ts.map +1 -0
  41. package/esm/src/resources/request-logs.js +70 -0
  42. package/esm/src/resources/roles.d.ts +128 -0
  43. package/esm/src/resources/roles.d.ts.map +1 -0
  44. package/esm/src/resources/roles.js +142 -0
  45. package/esm/src/resources/server-groups.d.ts +141 -7
  46. package/esm/src/resources/server-groups.d.ts.map +1 -1
  47. package/esm/src/resources/server-groups.js +157 -8
  48. package/esm/src/resources/servers/activity.d.ts +50 -8
  49. package/esm/src/resources/servers/activity.d.ts.map +1 -1
  50. package/esm/src/resources/servers/activity.js +54 -13
  51. package/esm/src/resources/servers/allocations.d.ts +3 -3
  52. package/esm/src/resources/servers/allocations.d.ts.map +1 -1
  53. package/esm/src/resources/servers/allocations.js +7 -7
  54. package/esm/src/resources/servers/backups.d.ts +46 -0
  55. package/esm/src/resources/servers/backups.d.ts.map +1 -0
  56. package/esm/src/resources/servers/backups.js +43 -0
  57. package/esm/src/resources/servers/connection.d.ts +33 -13
  58. package/esm/src/resources/servers/connection.d.ts.map +1 -1
  59. package/esm/src/resources/servers/connection.js +32 -11
  60. package/esm/src/resources/servers/features.d.ts +81 -0
  61. package/esm/src/resources/servers/features.d.ts.map +1 -0
  62. package/esm/src/resources/servers/features.js +60 -0
  63. package/esm/src/resources/servers/files.d.ts +41 -53
  64. package/esm/src/resources/servers/files.d.ts.map +1 -1
  65. package/esm/src/resources/servers/files.js +74 -116
  66. package/esm/src/resources/servers/index.d.ts +46 -27
  67. package/esm/src/resources/servers/index.d.ts.map +1 -1
  68. package/esm/src/resources/servers/index.js +26 -12
  69. package/esm/src/resources/servers/jobs.d.ts +88 -0
  70. package/esm/src/resources/servers/jobs.d.ts.map +1 -0
  71. package/esm/src/resources/servers/jobs.js +115 -0
  72. package/esm/src/resources/servers/node-client.d.ts +33 -0
  73. package/esm/src/resources/servers/node-client.d.ts.map +1 -0
  74. package/esm/src/resources/servers/node-client.js +61 -0
  75. package/esm/src/resources/servers/profiles.d.ts +83 -18
  76. package/esm/src/resources/servers/profiles.d.ts.map +1 -1
  77. package/esm/src/resources/servers/profiles.js +78 -11
  78. package/esm/src/resources/servers/server.d.ts +13 -28
  79. package/esm/src/resources/servers/server.d.ts.map +1 -1
  80. package/esm/src/resources/servers/server.js +21 -37
  81. package/esm/src/resources/servers/sftp.d.ts +12 -19
  82. package/esm/src/resources/servers/sftp.d.ts.map +1 -1
  83. package/esm/src/resources/servers/sftp.js +10 -14
  84. package/esm/src/resources/servers/sub-users.d.ts +99 -0
  85. package/esm/src/resources/servers/sub-users.d.ts.map +1 -0
  86. package/esm/src/resources/servers/sub-users.js +94 -0
  87. package/esm/src/resources/servers/types.d.ts +30 -28
  88. package/esm/src/resources/servers/types.d.ts.map +1 -1
  89. package/esm/src/resources/systems.d.ts +124 -0
  90. package/esm/src/resources/systems.d.ts.map +1 -0
  91. package/esm/src/resources/systems.js +139 -0
  92. package/esm/src/resources/users.d.ts +330 -0
  93. package/esm/src/resources/users.d.ts.map +1 -0
  94. package/esm/src/resources/users.js +280 -0
  95. package/esm/src/types.d.ts +18 -1
  96. package/esm/src/types.d.ts.map +1 -1
  97. package/esm/src/types.js +11 -0
  98. package/package.json +1 -1
  99. package/script/mod.d.ts +37 -16
  100. package/script/mod.d.ts.map +1 -1
  101. package/script/mod.js +50 -5
  102. package/script/src/client.d.ts +48 -11
  103. package/script/src/client.d.ts.map +1 -1
  104. package/script/src/client.js +53 -12
  105. package/script/src/http.d.ts +2 -2
  106. package/script/src/http.d.ts.map +1 -1
  107. package/script/src/http.js +5 -2
  108. package/script/src/namespace.d.ts +1 -1
  109. package/script/src/namespace.js +1 -1
  110. package/script/src/resources/account.d.ts +50 -19
  111. package/script/src/resources/account.d.ts.map +1 -1
  112. package/script/src/resources/account.js +50 -12
  113. package/script/src/resources/api-keys.d.ts +16 -24
  114. package/script/src/resources/api-keys.d.ts.map +1 -1
  115. package/script/src/resources/api-keys.js +15 -19
  116. package/script/src/resources/auth.d.ts +70 -4
  117. package/script/src/resources/auth.d.ts.map +1 -1
  118. package/script/src/resources/auth.js +47 -4
  119. package/script/src/resources/eggs.d.ts +261 -22
  120. package/script/src/resources/eggs.d.ts.map +1 -1
  121. package/script/src/resources/eggs.js +267 -26
  122. package/script/src/resources/features.d.ts +35 -0
  123. package/script/src/resources/features.d.ts.map +1 -0
  124. package/script/src/resources/features.js +25 -0
  125. package/script/src/resources/hosts.d.ts +151 -21
  126. package/script/src/resources/hosts.d.ts.map +1 -1
  127. package/script/src/resources/hosts.js +144 -10
  128. package/script/src/resources/logs.d.ts +39 -0
  129. package/script/src/resources/logs.d.ts.map +1 -0
  130. package/script/src/resources/logs.js +42 -0
  131. package/script/src/resources/nodes.d.ts +108 -33
  132. package/script/src/resources/nodes.d.ts.map +1 -1
  133. package/script/src/resources/nodes.js +117 -24
  134. package/script/src/resources/permissions.d.ts +45 -0
  135. package/script/src/resources/permissions.d.ts.map +1 -0
  136. package/script/src/resources/permissions.js +31 -0
  137. package/script/src/resources/request-logs.d.ts +91 -0
  138. package/script/src/resources/request-logs.d.ts.map +1 -0
  139. package/script/src/resources/request-logs.js +75 -0
  140. package/script/src/resources/roles.d.ts +128 -0
  141. package/script/src/resources/roles.d.ts.map +1 -0
  142. package/script/src/resources/roles.js +148 -0
  143. package/script/src/resources/server-groups.d.ts +141 -7
  144. package/script/src/resources/server-groups.d.ts.map +1 -1
  145. package/script/src/resources/server-groups.js +158 -8
  146. package/script/src/resources/servers/activity.d.ts +50 -8
  147. package/script/src/resources/servers/activity.d.ts.map +1 -1
  148. package/script/src/resources/servers/activity.js +54 -12
  149. package/script/src/resources/servers/allocations.d.ts +3 -3
  150. package/script/src/resources/servers/allocations.d.ts.map +1 -1
  151. package/script/src/resources/servers/allocations.js +7 -7
  152. package/script/src/resources/servers/backups.d.ts +46 -0
  153. package/script/src/resources/servers/backups.d.ts.map +1 -0
  154. package/script/src/resources/servers/backups.js +47 -0
  155. package/script/src/resources/servers/connection.d.ts +33 -13
  156. package/script/src/resources/servers/connection.d.ts.map +1 -1
  157. package/script/src/resources/servers/connection.js +32 -11
  158. package/script/src/resources/servers/features.d.ts +81 -0
  159. package/script/src/resources/servers/features.d.ts.map +1 -0
  160. package/script/src/resources/servers/features.js +64 -0
  161. package/script/src/resources/servers/files.d.ts +41 -53
  162. package/script/src/resources/servers/files.d.ts.map +1 -1
  163. package/script/src/resources/servers/files.js +74 -116
  164. package/script/src/resources/servers/index.d.ts +46 -27
  165. package/script/src/resources/servers/index.d.ts.map +1 -1
  166. package/script/src/resources/servers/index.js +26 -12
  167. package/script/src/resources/servers/jobs.d.ts +88 -0
  168. package/script/src/resources/servers/jobs.d.ts.map +1 -0
  169. package/script/src/resources/servers/jobs.js +120 -0
  170. package/script/src/resources/servers/node-client.d.ts +33 -0
  171. package/script/src/resources/servers/node-client.d.ts.map +1 -0
  172. package/script/src/resources/servers/node-client.js +65 -0
  173. package/script/src/resources/servers/profiles.d.ts +83 -18
  174. package/script/src/resources/servers/profiles.d.ts.map +1 -1
  175. package/script/src/resources/servers/profiles.js +77 -10
  176. package/script/src/resources/servers/server.d.ts +13 -28
  177. package/script/src/resources/servers/server.d.ts.map +1 -1
  178. package/script/src/resources/servers/server.js +21 -37
  179. package/script/src/resources/servers/sftp.d.ts +12 -19
  180. package/script/src/resources/servers/sftp.d.ts.map +1 -1
  181. package/script/src/resources/servers/sftp.js +10 -14
  182. package/script/src/resources/servers/sub-users.d.ts +99 -0
  183. package/script/src/resources/servers/sub-users.d.ts.map +1 -0
  184. package/script/src/resources/servers/sub-users.js +99 -0
  185. package/script/src/resources/servers/types.d.ts +30 -28
  186. package/script/src/resources/servers/types.d.ts.map +1 -1
  187. package/script/src/resources/systems.d.ts +124 -0
  188. package/script/src/resources/systems.d.ts.map +1 -0
  189. package/script/src/resources/systems.js +145 -0
  190. package/script/src/resources/users.d.ts +330 -0
  191. package/script/src/resources/users.d.ts.map +1 -0
  192. package/script/src/resources/users.js +287 -0
  193. package/script/src/types.d.ts +18 -1
  194. package/script/src/types.d.ts.map +1 -1
  195. package/script/src/types.js +12 -0
  196. package/esm/src/resources/members.d.ts +0 -138
  197. package/esm/src/resources/members.d.ts.map +0 -1
  198. package/esm/src/resources/members.js +0 -122
  199. package/script/src/resources/members.d.ts +0 -138
  200. package/script/src/resources/members.d.ts.map +0 -1
  201. package/script/src/resources/members.js +0 -127
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGnE,gEAAgE;AAChE,UAAU,eAAe;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,kDAAkD;AAClD,UAAU,eAAgB,SAAQ,eAAe;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE;QACT,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,GAAG,IAAI,CAAC;CACT;AAED,sDAAsD;AACtD,UAAU,iBAAkB,SAAQ,eAAe;IAClD,WAAW,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,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;IAIpF,0DAA0D;IAC1D,IAAW,OAAO,IAAI,qBAAqB,CAE1C;CACD"}
@@ -1,5 +1,7 @@
1
1
  import { ReactiveResource } from '../reactive.js';
2
- import { joinIncludes, toNanoID } from '../types.js';
2
+ import { joinIncludes, parseIssuerRef, toNanoID } from '../types.js';
3
+ import { listActivities } from './servers/activity.js';
4
+ import { listRequestLogs } from './request-logs.js';
3
5
  /**
4
6
  * Base class for the authenticated account.
5
7
  *
@@ -15,7 +17,7 @@ export class Account extends ReactiveResource {
15
17
  constructor(data, http) {
16
18
  super();
17
19
  this.http = http;
18
- this.id = toNanoID(data.id);
20
+ this.id = data.ref_id ? toNanoID(data.ref_id) : parseIssuerRef(data.id).id;
19
21
  this.permissions = data.permissions;
20
22
  this.createdAt = new Date(data.created_at);
21
23
  this.updatedAt = new Date(data.updated_at);
@@ -28,13 +30,13 @@ export class Account extends ReactiveResource {
28
30
  }
29
31
  /** @internal */
30
32
  static create(data, http) {
31
- switch (data.issuer_type) {
33
+ switch (data.type) {
32
34
  case 'user':
33
35
  return new UserAccount(data, http);
34
36
  case 'api_key':
35
37
  return new ApiKeyAccount(data, http);
36
38
  default:
37
- throw new Error(`Unknown account issuer type: ${data.issuer_type}`);
39
+ throw new Error(`Unknown account issuer type: ${data.type}`);
38
40
  }
39
41
  }
40
42
  }
@@ -42,29 +44,37 @@ export class Account extends ReactiveResource {
42
44
  export class UserAccount extends Account {
43
45
  issuerType = 'user';
44
46
  email;
47
+ /** When this user verified their email, or `null` if unverified. */
48
+ emailVerifiedAt;
45
49
  nickname;
46
50
  avatarUri;
51
+ /** When this account was disabled, or `null` if active. */
52
+ disabledAt;
47
53
  /**
48
- * Display preferences. Populated with `include=display`.
49
- * Requires `member.display.read` permission or being the account owner.
54
+ * Display and locale preferences. Populated with `include=preferences`.
55
+ * Requires `user.preferences.read` permission or being the account owner.
50
56
  */
51
- display;
57
+ preferences;
52
58
  /** @internal */
53
59
  constructor(data, http) {
54
60
  super(data, http);
55
61
  this.email = data.email;
62
+ this.emailVerifiedAt = data.email_verified_at ? new Date(data.email_verified_at) : null;
56
63
  this.nickname = data.nickname;
57
64
  this.avatarUri = data.avatar_uri;
58
- this.display = data.display ?? undefined;
65
+ this.disabledAt = data.disabled_at ? new Date(data.disabled_at) : null;
66
+ this.preferences = data.preferences ?? undefined;
59
67
  }
60
68
  /** Update this user account in place. */
61
69
  async update(payload) {
62
70
  await this.http.patch('/account', payload);
63
- const data = await this.http.get('/account');
71
+ const data = await this.http.get('/account', { params: { include: 'preferences,permissions' } });
64
72
  this.email = data.email;
73
+ this.emailVerifiedAt = data.email_verified_at ? new Date(data.email_verified_at) : null;
65
74
  this.nickname = data.nickname;
66
75
  this.avatarUri = data.avatar_uri;
67
- this.display = data.display ?? undefined;
76
+ this.disabledAt = data.disabled_at ? new Date(data.disabled_at) : null;
77
+ this.preferences = data.preferences ?? undefined;
68
78
  this.permissions = data.permissions;
69
79
  this.createdAt = new Date(data.created_at);
70
80
  this.updatedAt = new Date(data.updated_at);
@@ -81,16 +91,24 @@ export class ApiKeyAccount extends Account {
81
91
  issuerType = 'api_key';
82
92
  name;
83
93
  description;
94
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). */
84
95
  ownerId;
85
- /** The owner user. */
96
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
97
+ ownerType;
98
+ /** The owner. Requires `?include=owner`. */
86
99
  owner;
100
+ /** When this key was revoked, or `null` if active. */
101
+ revokedAt;
87
102
  /** @internal */
88
103
  constructor(data, http) {
89
104
  super(data, http);
90
105
  this.name = data.name;
91
106
  this.description = data.description;
92
- this.ownerId = toNanoID(data.owner_id);
107
+ const owner = parseIssuerRef(data.owner_id);
108
+ this.ownerId = owner.id;
109
+ this.ownerType = owner.type;
93
110
  this.owner = data.owner ? new UserAccount(data.owner, http) : undefined;
111
+ this.revokedAt = data.revoked_at ? new Date(data.revoked_at) : null;
94
112
  }
95
113
  }
96
114
  /**
@@ -184,7 +202,7 @@ export class AccountResource {
184
202
  /** Update the current user account. Only works for user accounts. */
185
203
  async update(payload) {
186
204
  await this.http.patch('/account', payload);
187
- const data = await this.http.get('/account');
205
+ const data = await this.http.get('/account', { params: { include: 'preferences,permissions' } });
188
206
  return new UserAccount(data, this.http);
189
207
  }
190
208
  /** Upload a new avatar image. Only works for user accounts. */
@@ -205,6 +223,26 @@ export class AccountResource {
205
223
  scopes() {
206
224
  return this.http.get('/account/scopes');
207
225
  }
226
+ /**
227
+ * Fetch the current account's activity feed (actions performed on this account).
228
+ *
229
+ * Only user accounts have an activity feed.
230
+ *
231
+ * @param opts Pagination and filter options.
232
+ */
233
+ activities(opts = {}) {
234
+ return listActivities(this.http, '/account/activities', opts);
235
+ }
236
+ /**
237
+ * Fetch the current account's own HTTP request log.
238
+ *
239
+ * Scoped to the caller; no permission beyond being that account is required.
240
+ *
241
+ * @param opts Pagination, filters, and includes.
242
+ */
243
+ requestLogs(opts = {}) {
244
+ return listRequestLogs(this.http, '/account/logs', opts);
245
+ }
208
246
  /** Manage SSH public keys on the current user account. */
209
247
  get sshKeys() {
210
248
  return new AccountSshKeysManager(this.http);
@@ -2,19 +2,17 @@ import type { HttpClient } from '../http.js';
2
2
  import { ResourceNamespace } from '../namespace.js';
3
3
  import { ReactiveResource } from '../reactive.js';
4
4
  import { type ISODate, type NanoID, type Paginated } from '../types.js';
5
- import type { MemberData } from './members.js';
6
- import { Member } from './members.js';
5
+ import type { UserData } from './users.js';
6
+ import { User } from './users.js';
7
7
  /** Raw API shape for an API key. @internal */
8
- interface ApiKeyData {
8
+ export interface ApiKeyData {
9
9
  id: string;
10
- issuer_type: string;
11
10
  name: string;
12
11
  description: string | null;
13
- owner?: MemberData;
14
- /** Only returned once, at creation time. */
15
- token?: string;
12
+ owner_id: string;
13
+ owner?: UserData;
16
14
  permissions?: string[];
17
- last_used_at?: ISODate | null;
15
+ revoked_at: ISODate | null;
18
16
  created_at: ISODate;
19
17
  updated_at: ISODate;
20
18
  }
@@ -23,31 +21,26 @@ interface ApiKeyData {
23
21
  *
24
22
  * Retrieved via {@link ApiKeysNamespace.list} or {@link ApiKeysNamespace.create}.
25
23
  *
26
- * > **Note:** The `token` field is only populated when the key is first created.
27
- * > It cannot be retrieved again after that. Store it securely.
24
+ * The bearer token is returned only once, by {@link ApiKeysNamespace.create}. It
25
+ * is never part of this resource. Store it securely when first received.
28
26
  */
29
27
  export declare class ApiKey extends ReactiveResource {
30
28
  /** The API key's unique NanoID. */
31
29
  readonly id: NanoID;
32
- /** The issuer type, always `'api_key'`. */
33
- readonly issuerType: string;
34
30
  /** Display name for this API key. */
35
31
  name: string;
36
32
  /** Description for this API key. */
37
33
  description: string | null;
38
- /** The owner of this API key. Always present as full object. */
39
- owner: Member | undefined;
40
- /**
41
- * The bearer token value.
42
- *
43
- * Only populated immediately after creation via {@link ApiKeysNamespace.create}.
44
- * `undefined` on all subsequent fetches - store it securely when first received.
45
- */
46
- token: string | undefined;
34
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). */
35
+ readonly ownerId: NanoID;
36
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
37
+ readonly ownerType: string;
38
+ /** The owner of this API key. Requires `?include=owner`. */
39
+ owner: User | undefined;
47
40
  /** Permissions assigned to this API key. Requires `?include=permissions`. */
48
41
  permissions: string[] | undefined;
49
- /** When this key was last used to authenticate a request, or `null` if never used. */
50
- lastUsedAt: Date | null;
42
+ /** When this key was revoked, or `null` if active. */
43
+ revokedAt: Date | null;
51
44
  /** When this API key was created. */
52
45
  createdAt: Date;
53
46
  /** When this API key was last updated. */
@@ -123,5 +116,4 @@ export declare class ApiKeysNamespace extends ResourceNamespace<ApiKey, ApiKeyEv
123
116
  */
124
117
  create(payload: CreateApiKeyPayload): Promise<CreateApiKeyResult>;
125
118
  }
126
- export {};
127
119
  //# sourceMappingURL=api-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../src/src/resources/api-keys.ts"],"names":[],"mappings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,MAAM,WAAW,mBAAmB;IACnC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,mDAAmD;AACnD,MAAM,WAAW,kBAAkB;IAClC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC5B,iFAAiF;IACjF,OAAO,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC;IAC5E,gBAAgB;gBACG,IAAI,EAAE,UAAU;IAInC;;;;;;OAMG;IACU,IAAI,CAChB,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GAC5C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAO7B;;;;;;;OAOG;IACU,MAAM,CAClB,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;CAuB9B"}
@@ -1,37 +1,32 @@
1
1
  import { ResourceNamespace } from '../namespace.js';
2
2
  import { ReactiveResource } from '../reactive.js';
3
- import { toNanoID } from '../types.js';
4
- import { Member } from './members.js';
3
+ import { parseIssuerRef, toNanoID } from '../types.js';
4
+ import { User } from './users.js';
5
5
  /**
6
6
  * An API key credential for authenticating programmatic access to the MeowPanel API.
7
7
  *
8
8
  * Retrieved via {@link ApiKeysNamespace.list} or {@link ApiKeysNamespace.create}.
9
9
  *
10
- * > **Note:** The `token` field is only populated when the key is first created.
11
- * > It cannot be retrieved again after that. Store it securely.
10
+ * The bearer token is returned only once, by {@link ApiKeysNamespace.create}. It
11
+ * is never part of this resource. Store it securely when first received.
12
12
  */
13
13
  export class ApiKey extends ReactiveResource {
14
14
  /** The API key's unique NanoID. */
15
15
  id;
16
- /** The issuer type, always `'api_key'`. */
17
- issuerType;
18
16
  /** Display name for this API key. */
19
17
  name;
20
18
  /** Description for this API key. */
21
19
  description;
22
- /** The owner of this API key. Always present as full object. */
20
+ /** The owner's bare NanoID (parsed from the namespaced `owner_id`). */
21
+ ownerId;
22
+ /** The owner's issuer type, e.g. `'user'` or `'system'`. */
23
+ ownerType;
24
+ /** The owner of this API key. Requires `?include=owner`. */
23
25
  owner;
24
- /**
25
- * The bearer token value.
26
- *
27
- * Only populated immediately after creation via {@link ApiKeysNamespace.create}.
28
- * `undefined` on all subsequent fetches - store it securely when first received.
29
- */
30
- token;
31
26
  /** Permissions assigned to this API key. Requires `?include=permissions`. */
32
27
  permissions;
33
- /** When this key was last used to authenticate a request, or `null` if never used. */
34
- lastUsedAt;
28
+ /** When this key was revoked, or `null` if active. */
29
+ revokedAt;
35
30
  /** When this API key was created. */
36
31
  createdAt;
37
32
  /** When this API key was last updated. */
@@ -40,13 +35,14 @@ export class ApiKey extends ReactiveResource {
40
35
  constructor(data) {
41
36
  super();
42
37
  this.id = toNanoID(data.id);
43
- this.issuerType = data.issuer_type;
44
38
  this.name = data.name;
45
39
  this.description = data.description;
46
- this.owner = data.owner ? new Member(data.owner) : undefined;
47
- this.token = data.token;
40
+ const owner = parseIssuerRef(data.owner_id);
41
+ this.ownerId = owner.id;
42
+ this.ownerType = owner.type;
43
+ this.owner = data.owner ? new User(data.owner) : undefined;
48
44
  this.permissions = data.permissions;
49
- this.lastUsedAt = data.last_used_at ? new Date(data.last_used_at) : null;
45
+ this.revokedAt = data.revoked_at ? new Date(data.revoked_at) : null;
50
46
  this.createdAt = new Date(data.created_at);
51
47
  this.updatedAt = new Date(data.updated_at);
52
48
  }
@@ -1,28 +1,69 @@
1
1
  import type { HttpClient } from '../http.js';
2
+ import { type ApiKeyAccount, type UserAccount } from './account.js';
2
3
  /**
3
4
  * A single authentication provider and its display configuration.
4
5
  */
5
6
  export interface AuthProvider {
7
+ /** Relative submission URL for this provider, e.g. `"/v1/auth/email"`. */
8
+ url: string;
6
9
  /** Provider-specific display fields, e.g. `{ display_name: 'WHMCS' }`. */
7
10
  fields: Record<string, string>;
8
11
  }
12
+ /** Email-verification policy for the panel. `'off'` when email is unavailable. */
13
+ export type EmailVerificationMode = 'off' | 'optional' | 'required';
9
14
  /**
10
15
  * Metadata about the panel's authentication configuration.
11
16
  */
12
17
  export interface AuthMeta {
13
18
  /** Available auth providers keyed by provider ID (e.g. `'email'`, `'whmcs'`). */
14
19
  providers: Record<string, AuthProvider>;
20
+ /** Email capability and verification policy. */
21
+ email: {
22
+ /** `true` when an email transport is configured. */
23
+ available: boolean;
24
+ /** The verification policy in effect. */
25
+ verification: EmailVerificationMode;
26
+ };
27
+ }
28
+ /** The opaque session token returned by a login or exchange. */
29
+ export interface LoginResult {
30
+ /**
31
+ * The opaque session token. Usable only on `/auth/*` routes; call
32
+ * {@link AuthResource.refresh} with it set as the bearer token to obtain an access token.
33
+ */
34
+ token: string;
35
+ }
36
+ /** The result of redeeming an exchange code. */
37
+ export interface ExchangeResult extends LoginResult {
38
+ /** The post-login redirect path, or `null`. */
39
+ redirect: string | null;
40
+ }
41
+ /** The access token (and optional account) from a refresh. */
42
+ export interface RefreshResult {
43
+ /** Always `"Bearer"`. */
44
+ tokenType: string;
45
+ /** Lifetime of the access token, in seconds. */
46
+ expiresInSeconds: number;
47
+ /** The JWT access token to use on all non-auth routes. */
48
+ accessToken: string;
49
+ /** The authenticated account. Present only when requested with `includeAccount`. */
50
+ account?: UserAccount | ApiKeyAccount;
15
51
  }
16
52
  /**
17
- * Resource for authentication configuration.
53
+ * Resource for authentication configuration and login flows.
18
54
  *
19
55
  * Access via `api.auth`.
20
56
  *
57
+ * The flow: submit credentials ({@link login}) or redeem a code ({@link exchange}) to get an
58
+ * opaque session token, set it as the client token, then call {@link refresh} to obtain the
59
+ * short-lived access token used for all other requests.
60
+ *
21
61
  * @example
22
62
  * ```ts ignore
23
- * const { providers } = await api.auth.getMeta();
24
- * if (providers.email) console.log('Email login available');
25
- * if (providers.whmcs) console.log('WHMCS:', providers.whmcs.fields.display_name);
63
+ * const { token } = await api.auth.loginWithEmail('me@example.com', 'hunter2');
64
+ * api.setToken(token);
65
+ * const { accessToken } = await api.auth.refresh();
66
+ * api.setToken(accessToken);
26
67
  * ```
27
68
  */
28
69
  export declare class AuthResource {
@@ -35,5 +76,30 @@ export declare class AuthResource {
35
76
  * Returns the available login providers and their display fields.
36
77
  */
37
78
  getMeta(): Promise<AuthMeta>;
79
+ /**
80
+ * Submit credentials to a login provider.
81
+ *
82
+ * @param provider The provider id, e.g. `"email"`.
83
+ * @param credentials The provider's fields (for `email`: `{ email, password }`).
84
+ */
85
+ login(provider: string, credentials: Record<string, unknown>): Promise<LoginResult>;
86
+ /** Log in with email and password. */
87
+ loginWithEmail(email: string, password: string): Promise<LoginResult>;
88
+ /**
89
+ * Redeem a single-use exchange code (e.g. from a WHMCS SSO redirect) for a session token.
90
+ *
91
+ * @param code The exchange code.
92
+ */
93
+ exchange(code: string): Promise<ExchangeResult>;
94
+ /**
95
+ * Exchange the current (opaque session) token for a short-lived access token.
96
+ *
97
+ * Call this with the session token set as the client's bearer token.
98
+ *
99
+ * @param opts `includeAccount` also returns the authenticated account.
100
+ */
101
+ refresh(opts?: {
102
+ includeAccount?: boolean;
103
+ }): Promise<RefreshResult>;
38
104
  }
39
105
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/src/resources/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAS7C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B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MAAM,WAAW,aAAa;IAC7B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,YAAY;IAEL,OAAO,CAAC,QAAQ,CAAC,IAAI;IADxC,gBAAgB;gBACoB,IAAI,EAAE,UAAU;IAEpD;;;;OAIG;IACI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;IAInC;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1F,sCAAsC;IAC/B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI5E;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAItD;;;;;;OAMG;IACU,OAAO,CAAC,IAAI,GAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,aAAa,CAAC;CAcrF"}
@@ -1,13 +1,19 @@
1
+ import { Account } from './account.js';
1
2
  /**
2
- * Resource for authentication configuration.
3
+ * Resource for authentication configuration and login flows.
3
4
  *
4
5
  * Access via `api.auth`.
5
6
  *
7
+ * The flow: submit credentials ({@link login}) or redeem a code ({@link exchange}) to get an
8
+ * opaque session token, set it as the client token, then call {@link refresh} to obtain the
9
+ * short-lived access token used for all other requests.
10
+ *
6
11
  * @example
7
12
  * ```ts ignore
8
- * const { providers } = await api.auth.getMeta();
9
- * if (providers.email) console.log('Email login available');
10
- * if (providers.whmcs) console.log('WHMCS:', providers.whmcs.fields.display_name);
13
+ * const { token } = await api.auth.loginWithEmail('me@example.com', 'hunter2');
14
+ * api.setToken(token);
15
+ * const { accessToken } = await api.auth.refresh();
16
+ * api.setToken(accessToken);
11
17
  * ```
12
18
  */
13
19
  export class AuthResource {
@@ -24,4 +30,41 @@ export class AuthResource {
24
30
  getMeta() {
25
31
  return this.http.get('/auth');
26
32
  }
33
+ /**
34
+ * Submit credentials to a login provider.
35
+ *
36
+ * @param provider The provider id, e.g. `"email"`.
37
+ * @param credentials The provider's fields (for `email`: `{ email, password }`).
38
+ */
39
+ login(provider, credentials) {
40
+ return this.http.post(`/auth/${encodeURIComponent(provider)}`, credentials);
41
+ }
42
+ /** Log in with email and password. */
43
+ loginWithEmail(email, password) {
44
+ return this.login('email', { email, password });
45
+ }
46
+ /**
47
+ * Redeem a single-use exchange code (e.g. from a WHMCS SSO redirect) for a session token.
48
+ *
49
+ * @param code The exchange code.
50
+ */
51
+ exchange(code) {
52
+ return this.http.post('/auth/exchange', { code });
53
+ }
54
+ /**
55
+ * Exchange the current (opaque session) token for a short-lived access token.
56
+ *
57
+ * Call this with the session token set as the client's bearer token.
58
+ *
59
+ * @param opts `includeAccount` also returns the authenticated account.
60
+ */
61
+ async refresh(opts = {}) {
62
+ const raw = await this.http.post('/auth/refresh', undefined, opts.includeAccount ? { params: { include: 'account' } } : {});
63
+ return {
64
+ tokenType: raw.token_type,
65
+ expiresInSeconds: raw.expires_in_seconds,
66
+ accessToken: raw.access_token,
67
+ account: raw.account ? Account.create(raw.account, this.http) : undefined,
68
+ };
69
+ }
27
70
  }