@haex-space/vault-sdk 3.5.0 → 3.6.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/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.mjs';
2
- import { E as ExtensionManifest } from './types-fHuxbqa4.mjs';
2
+ import { E as ExtensionManifest } from './types-DQZCRfC-.mjs';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.js';
2
- import { E as ExtensionManifest } from './types-fHuxbqa4.js';
2
+ import { E as ExtensionManifest } from './types-DQZCRfC-.js';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-DCoY4f3Q.mjs';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-DnCZ3KyI.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-fHuxbqa4.mjs';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DQZCRfC-.mjs';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-mcuC3gP5.js';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-uuhuCPDu.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-fHuxbqa4.js';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DQZCRfC-.js';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.js CHANGED
@@ -419,6 +419,10 @@ var SHELL_EVENTS = {
419
419
  /** Shell session has exited */
420
420
  EXIT: "shell:exit"
421
421
  };
422
+ var MAIL_EVENTS = {
423
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
424
+ NEW_MESSAGES: "mail:new-messages"
425
+ };
422
426
 
423
427
  // src/types.ts
424
428
  var DEFAULT_TIMEOUT = 3e4;
@@ -691,7 +695,11 @@ var MAIL_COMMANDS = {
691
695
  /** SMTP send. Returns the assigned Message-ID. */
692
696
  sendMessage: "extension_mail_send_message",
693
697
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
694
- 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"
695
703
  };
696
704
 
697
705
  // src/commands/notifications.ts
@@ -1789,6 +1797,41 @@ var MailAPI = class {
1789
1797
  message
1790
1798
  });
1791
1799
  }
1800
+ /**
1801
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1802
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1803
+ * is passed in. Requires `mail` permission with action `poll` on the
1804
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1805
+ *
1806
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1807
+ * results via `onNewMessages`.
1808
+ */
1809
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1810
+ return this.client.request(MAIL_COMMANDS.startWatch, {
1811
+ accountId,
1812
+ mailboxName,
1813
+ intervalSeconds
1814
+ });
1815
+ }
1816
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1817
+ async stopWatchingAsync(accountId, mailboxName) {
1818
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
1819
+ accountId,
1820
+ mailboxName
1821
+ });
1822
+ }
1823
+ /**
1824
+ * Register a callback for new-mail notifications from any active watch.
1825
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1826
+ * before refreshing if watching more than one account.
1827
+ */
1828
+ onNewMessages(callback) {
1829
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
1830
+ }
1831
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1832
+ offNewMessages(callback) {
1833
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
1834
+ }
1792
1835
  };
1793
1836
 
1794
1837
  // src/api/notifications.ts
@@ -1991,6 +2034,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1991
2034
  EXTERNAL_EVENTS.REQUEST,
1992
2035
  EXTERNAL_EVENTS.ACTION_REQUEST,
1993
2036
  NOTIFICATION_EVENTS.CLICK,
2037
+ MAIL_EVENTS.NEW_MESSAGES,
1994
2038
  ...Object.values(LOCALSEND_EVENTS)
1995
2039
  ]) {
1996
2040
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);