@haex-space/vault-sdk 3.5.1 → 3.7.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.
@@ -34,6 +34,10 @@ var SHELL_EVENTS = {
34
34
  /** Shell session has exited */
35
35
  EXIT: "shell:exit"
36
36
  };
37
+ var MAIL_EVENTS = {
38
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
39
+ NEW_MESSAGES: "mail:new-messages"
40
+ };
37
41
 
38
42
  // src/types.ts
39
43
  var DEFAULT_TIMEOUT = 3e4;
@@ -256,6 +260,8 @@ var SPACE_COMMANDS = {
256
260
  unassign: "extension_space_unassign",
257
261
  /** Get space assignments for a table */
258
262
  getAssignments: "extension_space_get_assignments",
263
+ /** Get members of a shared space */
264
+ getMembers: "extension_space_get_members",
259
265
  /** List all spaces the user is a member of (with decrypted names) */
260
266
  list: "extension_space_list"};
261
267
 
@@ -306,7 +312,11 @@ var MAIL_COMMANDS = {
306
312
  /** SMTP send. Returns the assigned Message-ID. */
307
313
  sendMessage: "extension_mail_send_message",
308
314
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
309
- buildRfc822: "extension_mail_build_rfc822"
315
+ buildRfc822: "extension_mail_build_rfc822",
316
+ /** Start (or replace) a background poll watch for an account/mailbox */
317
+ startWatch: "extension_mail_start_watch",
318
+ /** Stop a background poll watch */
319
+ stopWatch: "extension_mail_stop_watch"
310
320
  };
311
321
 
312
322
  // src/commands/notifications.ts
@@ -1209,6 +1219,13 @@ var SpacesAPI = class {
1209
1219
  async listSpacesAsync() {
1210
1220
  return this.client.request(SPACE_COMMANDS.list);
1211
1221
  }
1222
+ /**
1223
+ * List members of a shared space (DID + label), flagging the current user.
1224
+ * Used to resolve assignment authors to names and to detect own vs shared-in content.
1225
+ */
1226
+ async getMembersAsync(spaceId) {
1227
+ return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
1228
+ }
1212
1229
  };
1213
1230
 
1214
1231
  // src/api/shell.ts
@@ -1429,6 +1446,41 @@ var MailAPI = class {
1429
1446
  message
1430
1447
  });
1431
1448
  }
1449
+ /**
1450
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1451
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1452
+ * is passed in. Requires `mail` permission with action `poll` on the
1453
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1454
+ *
1455
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1456
+ * results via `onNewMessages`.
1457
+ */
1458
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1459
+ return this.client.request(MAIL_COMMANDS.startWatch, {
1460
+ accountId,
1461
+ mailboxName,
1462
+ intervalSeconds
1463
+ });
1464
+ }
1465
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1466
+ async stopWatchingAsync(accountId, mailboxName) {
1467
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
1468
+ accountId,
1469
+ mailboxName
1470
+ });
1471
+ }
1472
+ /**
1473
+ * Register a callback for new-mail notifications from any active watch.
1474
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1475
+ * before refreshing if watching more than one account.
1476
+ */
1477
+ onNewMessages(callback) {
1478
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
1479
+ }
1480
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1481
+ offNewMessages(callback) {
1482
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
1483
+ }
1432
1484
  };
1433
1485
 
1434
1486
  // src/api/notifications.ts
@@ -1722,6 +1774,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1722
1774
  EXTERNAL_EVENTS.REQUEST,
1723
1775
  EXTERNAL_EVENTS.ACTION_REQUEST,
1724
1776
  NOTIFICATION_EVENTS.CLICK,
1777
+ MAIL_EVENTS.NEW_MESSAGES,
1725
1778
  ...Object.values(LOCALSEND_EVENTS)
1726
1779
  ]) {
1727
1780
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);