@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.
package/dist/svelte.mjs CHANGED
@@ -417,6 +417,10 @@ var SHELL_EVENTS = {
417
417
  /** Shell session has exited */
418
418
  EXIT: "shell:exit"
419
419
  };
420
+ var MAIL_EVENTS = {
421
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
422
+ NEW_MESSAGES: "mail:new-messages"
423
+ };
420
424
 
421
425
  // src/types.ts
422
426
  var DEFAULT_TIMEOUT = 3e4;
@@ -639,6 +643,8 @@ var SPACE_COMMANDS = {
639
643
  unassign: "extension_space_unassign",
640
644
  /** Get space assignments for a table */
641
645
  getAssignments: "extension_space_get_assignments",
646
+ /** Get members of a shared space */
647
+ getMembers: "extension_space_get_members",
642
648
  /** List all spaces the user is a member of (with decrypted names) */
643
649
  list: "extension_space_list"};
644
650
 
@@ -689,7 +695,11 @@ var MAIL_COMMANDS = {
689
695
  /** SMTP send. Returns the assigned Message-ID. */
690
696
  sendMessage: "extension_mail_send_message",
691
697
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
692
- buildRfc822: "extension_mail_build_rfc822"
698
+ buildRfc822: "extension_mail_build_rfc822",
699
+ /** Start (or replace) a background poll watch for an account/mailbox */
700
+ startWatch: "extension_mail_start_watch",
701
+ /** Stop a background poll watch */
702
+ stopWatch: "extension_mail_stop_watch"
693
703
  };
694
704
 
695
705
  // src/commands/notifications.ts
@@ -1567,6 +1577,13 @@ var SpacesAPI = class {
1567
1577
  async listSpacesAsync() {
1568
1578
  return this.client.request(SPACE_COMMANDS.list);
1569
1579
  }
1580
+ /**
1581
+ * List members of a shared space (DID + label), flagging the current user.
1582
+ * Used to resolve assignment authors to names and to detect own vs shared-in content.
1583
+ */
1584
+ async getMembersAsync(spaceId) {
1585
+ return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
1586
+ }
1570
1587
  };
1571
1588
 
1572
1589
  // src/api/shell.ts
@@ -1787,6 +1804,41 @@ var MailAPI = class {
1787
1804
  message
1788
1805
  });
1789
1806
  }
1807
+ /**
1808
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1809
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1810
+ * is passed in. Requires `mail` permission with action `poll` on the
1811
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1812
+ *
1813
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1814
+ * results via `onNewMessages`.
1815
+ */
1816
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1817
+ return this.client.request(MAIL_COMMANDS.startWatch, {
1818
+ accountId,
1819
+ mailboxName,
1820
+ intervalSeconds
1821
+ });
1822
+ }
1823
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1824
+ async stopWatchingAsync(accountId, mailboxName) {
1825
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
1826
+ accountId,
1827
+ mailboxName
1828
+ });
1829
+ }
1830
+ /**
1831
+ * Register a callback for new-mail notifications from any active watch.
1832
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1833
+ * before refreshing if watching more than one account.
1834
+ */
1835
+ onNewMessages(callback) {
1836
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
1837
+ }
1838
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1839
+ offNewMessages(callback) {
1840
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
1841
+ }
1790
1842
  };
1791
1843
 
1792
1844
  // src/api/notifications.ts
@@ -1989,6 +2041,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1989
2041
  EXTERNAL_EVENTS.REQUEST,
1990
2042
  EXTERNAL_EVENTS.ACTION_REQUEST,
1991
2043
  NOTIFICATION_EVENTS.CLICK,
2044
+ MAIL_EVENTS.NEW_MESSAGES,
1992
2045
  ...Object.values(LOCALSEND_EVENTS)
1993
2046
  ]) {
1994
2047
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);