@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.
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-fHuxbqa4.js';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-DQZCRfC-.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -1318,6 +1318,12 @@ interface MailAccount {
1318
1318
  imap: ImapConfig;
1319
1319
  smtp?: SmtpConfig;
1320
1320
  }
1321
+ /** Payload of `MAIL_EVENTS.NEW_MESSAGES`, emitted by a background poll watch. */
1322
+ interface MailNewMessagesEvent {
1323
+ accountId: string;
1324
+ mailboxName: string;
1325
+ newCount: number;
1326
+ }
1321
1327
  interface MailAddress {
1322
1328
  name?: string;
1323
1329
  email: string;
@@ -1404,6 +1410,8 @@ interface OutgoingMessage {
1404
1410
  * - All IMAP operations require `mail` permission with action `fetch`
1405
1411
  * on `imap.host`.
1406
1412
  * - SMTP send requires `mail` permission with action `send` on `smtp.host`.
1413
+ * - Background watching requires `mail` permission with action `poll`
1414
+ * on the account's IMAP host.
1407
1415
  * - target="gmail.com" matches "imap.gmail.com" / "smtp.gmail.com".
1408
1416
  *
1409
1417
  * Credentials live with the caller (typically loaded from
@@ -1457,6 +1465,26 @@ declare class MailAPI {
1457
1465
  * this is a fetch operation (no SMTP host involved).
1458
1466
  */
1459
1467
  buildRfc822Async(imapHost: string, message: OutgoingMessage): Promise<string>;
1468
+ /**
1469
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1470
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1471
+ * is passed in. Requires `mail` permission with action `poll` on the
1472
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1473
+ *
1474
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1475
+ * results via `onNewMessages`.
1476
+ */
1477
+ startWatchingAsync(accountId: string, mailboxName: string, intervalSeconds: number): Promise<void>;
1478
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1479
+ stopWatchingAsync(accountId: string, mailboxName: string): Promise<void>;
1480
+ /**
1481
+ * Register a callback for new-mail notifications from any active watch.
1482
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1483
+ * before refreshing if watching more than one account.
1484
+ */
1485
+ onNewMessages(callback: EventCallback): void;
1486
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1487
+ offNewMessages(callback: EventCallback): void;
1460
1488
  }
1461
1489
 
1462
1490
  /**
@@ -1632,4 +1660,4 @@ declare class HaexVaultSdk {
1632
1660
  private log;
1633
1661
  }
1634
1662
 
1635
- export { PermissionsAPI as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type MessageEnvelope as G, HaexVaultSdk as H, type ImapConfig as I, type NotificationClickEvent as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type NotificationAction as N, type NotificationOptions as O, NotificationsAPI as P, type OutgoingAttachment as Q, type OutgoingMessage as R, StorageAPI as S, type PasswordInput as T, type PasswordItemFull as U, type PasswordItemSummary as V, type PasswordKeyValue as W, type PasswordKeyValueInput as X, PasswordsAPI as Y, type PendingAuthorization as Z, type PendingTransfer as _, type DecryptedSpace as a, type AddBackendRequest as a0, type S3Config as a1, type S3PublicConfig as a2, RemoteStorageAPI as a3, type StorageBackendInfo as a4, type StorageObjectInfo as a5, type UpdateBackendRequest as a6, type RequestedExtension as a7, type SelectFileOptions as a8, type SelectFolderOptions as a9, type ServerInfo as aa, type ServerStatus as ab, type SessionAuthorization as ac, type SharedSpace as ad, ShellAPI as ae, type ShellCreateOptions as af, type ShellCreateResponse as ag, type ShellExitEvent as ah, type ShellOutputEvent as ai, type SmtpConfig as aj, type SpaceAccessTokenInfo as ak, type SpaceAssignment as al, type SpaceInvite as am, type SpaceKeyGrantInfo as an, type SpaceMemberInfo as ao, SpacesAPI as ap, type SyncBackendInfo as aq, type TransferDirection as ar, type TransferProgress as as, type TransferState as at, WebAPI as au, canExternalClientSendRequests as av, isExternalClientConnected as aw, type DeepLink as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, type KnownPaths as p, LocalSendAPI as q, type LocalSendEvent as r, type FileInfo as s, type LocalSendSettings as t, type MailAccount as u, type MailAddress as v, type Attachment as w, type FetchRange as x, type MailMessage as y, type MailboxInfo as z };
1663
+ export { type PendingTransfer as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type MailboxInfo as G, HaexVaultSdk as H, type ImapConfig as I, type MessageEnvelope as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type NotificationAction as N, type NotificationClickEvent as O, type NotificationOptions as P, NotificationsAPI as Q, type OutgoingAttachment as R, StorageAPI as S, type OutgoingMessage as T, type PasswordInput as U, type PasswordItemFull as V, type PasswordItemSummary as W, type PasswordKeyValue as X, type PasswordKeyValueInput as Y, PasswordsAPI as Z, type PendingAuthorization as _, type DecryptedSpace as a, PermissionsAPI as a0, type AddBackendRequest as a1, type S3Config as a2, type S3PublicConfig as a3, RemoteStorageAPI as a4, type StorageBackendInfo as a5, type StorageObjectInfo as a6, type UpdateBackendRequest as a7, type RequestedExtension as a8, type SelectFileOptions as a9, type SelectFolderOptions as aa, type ServerInfo as ab, type ServerStatus as ac, type SessionAuthorization as ad, type SharedSpace as ae, ShellAPI as af, type ShellCreateOptions as ag, type ShellCreateResponse as ah, type ShellExitEvent as ai, type ShellOutputEvent as aj, type SmtpConfig as ak, type SpaceAccessTokenInfo as al, type SpaceAssignment as am, type SpaceInvite as an, type SpaceKeyGrantInfo as ao, type SpaceMemberInfo as ap, SpacesAPI as aq, type SyncBackendInfo as ar, type TransferDirection as as, type TransferProgress as at, type TransferState as au, WebAPI as av, canExternalClientSendRequests as aw, isExternalClientConnected as ax, type DeepLink as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, type KnownPaths as p, LocalSendAPI as q, type LocalSendEvent as r, type FileInfo as s, type LocalSendSettings as t, type MailAccount as u, type MailAddress as v, type Attachment as w, type FetchRange as x, type MailMessage as y, type MailNewMessagesEvent as z };
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-fHuxbqa4.mjs';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult } from './types-DQZCRfC-.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -1318,6 +1318,12 @@ interface MailAccount {
1318
1318
  imap: ImapConfig;
1319
1319
  smtp?: SmtpConfig;
1320
1320
  }
1321
+ /** Payload of `MAIL_EVENTS.NEW_MESSAGES`, emitted by a background poll watch. */
1322
+ interface MailNewMessagesEvent {
1323
+ accountId: string;
1324
+ mailboxName: string;
1325
+ newCount: number;
1326
+ }
1321
1327
  interface MailAddress {
1322
1328
  name?: string;
1323
1329
  email: string;
@@ -1404,6 +1410,8 @@ interface OutgoingMessage {
1404
1410
  * - All IMAP operations require `mail` permission with action `fetch`
1405
1411
  * on `imap.host`.
1406
1412
  * - SMTP send requires `mail` permission with action `send` on `smtp.host`.
1413
+ * - Background watching requires `mail` permission with action `poll`
1414
+ * on the account's IMAP host.
1407
1415
  * - target="gmail.com" matches "imap.gmail.com" / "smtp.gmail.com".
1408
1416
  *
1409
1417
  * Credentials live with the caller (typically loaded from
@@ -1457,6 +1465,26 @@ declare class MailAPI {
1457
1465
  * this is a fetch operation (no SMTP host involved).
1458
1466
  */
1459
1467
  buildRfc822Async(imapHost: string, message: OutgoingMessage): Promise<string>;
1468
+ /**
1469
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1470
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1471
+ * is passed in. Requires `mail` permission with action `poll` on the
1472
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1473
+ *
1474
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1475
+ * results via `onNewMessages`.
1476
+ */
1477
+ startWatchingAsync(accountId: string, mailboxName: string, intervalSeconds: number): Promise<void>;
1478
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1479
+ stopWatchingAsync(accountId: string, mailboxName: string): Promise<void>;
1480
+ /**
1481
+ * Register a callback for new-mail notifications from any active watch.
1482
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1483
+ * before refreshing if watching more than one account.
1484
+ */
1485
+ onNewMessages(callback: EventCallback): void;
1486
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1487
+ offNewMessages(callback: EventCallback): void;
1460
1488
  }
1461
1489
 
1462
1490
  /**
@@ -1632,4 +1660,4 @@ declare class HaexVaultSdk {
1632
1660
  private log;
1633
1661
  }
1634
1662
 
1635
- export { PermissionsAPI as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type MessageEnvelope as G, HaexVaultSdk as H, type ImapConfig as I, type NotificationClickEvent as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type NotificationAction as N, type NotificationOptions as O, NotificationsAPI as P, type OutgoingAttachment as Q, type OutgoingMessage as R, StorageAPI as S, type PasswordInput as T, type PasswordItemFull as U, type PasswordItemSummary as V, type PasswordKeyValue as W, type PasswordKeyValueInput as X, PasswordsAPI as Y, type PendingAuthorization as Z, type PendingTransfer as _, type DecryptedSpace as a, type AddBackendRequest as a0, type S3Config as a1, type S3PublicConfig as a2, RemoteStorageAPI as a3, type StorageBackendInfo as a4, type StorageObjectInfo as a5, type UpdateBackendRequest as a6, type RequestedExtension as a7, type SelectFileOptions as a8, type SelectFolderOptions as a9, type ServerInfo as aa, type ServerStatus as ab, type SessionAuthorization as ac, type SharedSpace as ad, ShellAPI as ae, type ShellCreateOptions as af, type ShellCreateResponse as ag, type ShellExitEvent as ah, type ShellOutputEvent as ai, type SmtpConfig as aj, type SpaceAccessTokenInfo as ak, type SpaceAssignment as al, type SpaceInvite as am, type SpaceKeyGrantInfo as an, type SpaceMemberInfo as ao, SpacesAPI as ap, type SyncBackendInfo as aq, type TransferDirection as ar, type TransferProgress as as, type TransferState as at, WebAPI as au, canExternalClientSendRequests as av, isExternalClientConnected as aw, type DeepLink as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, type KnownPaths as p, LocalSendAPI as q, type LocalSendEvent as r, type FileInfo as s, type LocalSendSettings as t, type MailAccount as u, type MailAddress as v, type Attachment as w, type FetchRange as x, type MailMessage as y, type MailboxInfo as z };
1663
+ export { type PendingTransfer as $, type AuthorizedClient as A, type BlockedClient as B, type ConnectionSecurity as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type MailboxInfo as G, HaexVaultSdk as H, type ImapConfig as I, type MessageEnvelope as J, KnownPath as K, LOCALSEND_EVENTS as L, MailAPI as M, type NotificationAction as N, type NotificationClickEvent as O, type NotificationOptions as P, NotificationsAPI as Q, type OutgoingAttachment as R, StorageAPI as S, type OutgoingMessage as T, type PasswordInput as U, type PasswordItemFull as V, type PasswordItemSummary as W, type PasswordKeyValue as X, type PasswordKeyValueInput as Y, PasswordsAPI as Z, type PendingAuthorization as _, type DecryptedSpace as a, PermissionsAPI as a0, type AddBackendRequest as a1, type S3Config as a2, type S3PublicConfig as a3, RemoteStorageAPI as a4, type StorageBackendInfo as a5, type StorageObjectInfo as a6, type UpdateBackendRequest as a7, type RequestedExtension as a8, type SelectFileOptions as a9, type SelectFolderOptions as aa, type ServerInfo as ab, type ServerStatus as ac, type SessionAuthorization as ad, type SharedSpace as ae, ShellAPI as af, type ShellCreateOptions as ag, type ShellCreateResponse as ah, type ShellExitEvent as ai, type ShellOutputEvent as aj, type SmtpConfig as ak, type SpaceAccessTokenInfo as al, type SpaceAssignment as am, type SpaceInvite as an, type SpaceKeyGrantInfo as ao, type SpaceMemberInfo as ap, SpacesAPI as aq, type SyncBackendInfo as ar, type TransferDirection as as, type TransferProgress as at, type TransferState as au, WebAPI as av, canExternalClientSendRequests as aw, isExternalClientConnected as ax, type DeepLink as b, type Device as c, type DeviceInfo as d, type DeviceType as e, type DirEntry as f, type ExternalConnection as g, ExternalConnectionErrorCode as h, ExternalConnectionState as i, type ExternalRequest as j, type ExternalRequestEvent as k, type ExternalRequestHandler as l, type ExternalRequestPayload as m, type ExternalResponse as n, FilesystemAPI as o, type KnownPaths as p, LocalSendAPI as q, type LocalSendEvent as r, type FileInfo as s, type LocalSendSettings as t, type MailAccount as u, type MailAddress as v, type Attachment as w, type FetchRange as x, type MailMessage as y, type MailNewMessagesEvent as z };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-DCoY4f3Q.mjs';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConnectionSecurity, D as DatabaseAPI, a as DecryptedSpace, b as DeepLink, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, I as ImapConfig, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, M as MailAPI, u as MailAccount, v as MailAddress, w as MailAttachment, x as MailFetchRange, y as MailMessage, z as MailboxInfo, G as MessageEnvelope, N as NotificationAction, J as NotificationClickEvent, O as NotificationOptions, P as NotificationsAPI, Q as OutgoingAttachment, R as OutgoingMessage, T as PasswordInput, U as PasswordItemFull, V as PasswordItemSummary, W as PasswordKeyValue, X as PasswordKeyValueInput, Y as PasswordsAPI, Z as PendingAuthorization, _ as PendingTransfer, $ as PermissionsAPI, a0 as RemoteAddBackendRequest, a1 as RemoteS3Config, a2 as RemoteS3PublicConfig, a3 as RemoteStorageAPI, a4 as RemoteStorageBackendInfo, a5 as RemoteStorageObjectInfo, a6 as RemoteUpdateBackendRequest, a7 as RequestedExtension, a8 as SelectFileOptions, a9 as SelectFolderOptions, aa as ServerInfo, ab as ServerStatus, ac as SessionAuthorization, ad as SharedSpace, ae as ShellAPI, af as ShellCreateOptions, ag as ShellCreateResponse, ah as ShellExitEvent, ai as ShellOutputEvent, aj as SmtpConfig, ak as SpaceAccessTokenInfo, al as SpaceAssignment, am as SpaceInvite, an as SpaceKeyGrantInfo, ao as SpaceMemberInfo, ap as SpacesAPI, aq as SyncBackendInfo, ar as TransferDirection, as as TransferProgress, at as TransferState, au as WebAPI, av as canExternalClientSendRequests, aw as isExternalClientConnected } from './client-DCoY4f3Q.mjs';
3
- import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-fHuxbqa4.mjs';
4
- export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, a as ExtensionInfo, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, I as IdentityClaim, B as ManifestI18nEntry, N as NOTIFICATION_EVENTS, G as NotificationEvent, J as PermissionDeniedError, K as PermissionErrorBase, L as PermissionErrorCode, O as PermissionPromptError, P as PermissionResponse, Q as PermissionStatus, R as SHELL_EVENTS, T as SearchQuery, U as SearchRequestEvent, S as SearchResult, V as ShellEvent, X as SyncTablesUpdatedEvent, Y as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, Z as getTableName, _ as isPermissionDeniedError, $ as isPermissionError, a0 as isPermissionPromptError } from './types-fHuxbqa4.mjs';
1
+ import { H as HaexVaultSdk } from './client-DnCZ3KyI.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConnectionSecurity, D as DatabaseAPI, a as DecryptedSpace, b as DeepLink, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, I as ImapConfig, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, M as MailAPI, u as MailAccount, v as MailAddress, w as MailAttachment, x as MailFetchRange, y as MailMessage, z as MailNewMessagesEvent, G as MailboxInfo, J as MessageEnvelope, N as NotificationAction, O as NotificationClickEvent, P as NotificationOptions, Q as NotificationsAPI, R as OutgoingAttachment, T as OutgoingMessage, U as PasswordInput, V as PasswordItemFull, W as PasswordItemSummary, X as PasswordKeyValue, Y as PasswordKeyValueInput, Z as PasswordsAPI, _ as PendingAuthorization, $ as PendingTransfer, a0 as PermissionsAPI, a1 as RemoteAddBackendRequest, a2 as RemoteS3Config, a3 as RemoteS3PublicConfig, a4 as RemoteStorageAPI, a5 as RemoteStorageBackendInfo, a6 as RemoteStorageObjectInfo, a7 as RemoteUpdateBackendRequest, a8 as RequestedExtension, a9 as SelectFileOptions, aa as SelectFolderOptions, ab as ServerInfo, ac as ServerStatus, ad as SessionAuthorization, ae as SharedSpace, af as ShellAPI, ag as ShellCreateOptions, ah as ShellCreateResponse, ai as ShellExitEvent, aj as ShellOutputEvent, ak as SmtpConfig, al as SpaceAccessTokenInfo, am as SpaceAssignment, an as SpaceInvite, ao as SpaceKeyGrantInfo, ap as SpaceMemberInfo, aq as SpacesAPI, ar as SyncBackendInfo, as as TransferDirection, at as TransferProgress, au as TransferState, av as WebAPI, aw as canExternalClientSendRequests, ax as isExternalClientConnected } from './client-DnCZ3KyI.mjs';
3
+ import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-DQZCRfC-.mjs';
4
+ export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, a as ExtensionInfo, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, I as IdentityClaim, B as MAIL_EVENTS, G as MailEvent, J as ManifestI18nEntry, N as NOTIFICATION_EVENTS, K as NotificationEvent, L as PermissionDeniedError, O as PermissionErrorBase, Q as PermissionErrorCode, R as PermissionPromptError, P as PermissionResponse, T as PermissionStatus, U as SHELL_EVENTS, V as SearchQuery, X as SearchRequestEvent, S as SearchResult, Y as ShellEvent, Z as SyncTablesUpdatedEvent, _ as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, $ as getTableName, a0 as isPermissionDeniedError, a1 as isPermissionError, a2 as isPermissionPromptError } from './types-DQZCRfC-.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -108,7 +108,8 @@ type PasswordCommand = (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS
108
108
  * Mail Commands (IMAP fetch + SMTP send).
109
109
  *
110
110
  * Permissions are split protocol-wise: `fetch` covers all IMAP
111
- * operations (list/read/flag/move/append), `send` covers SMTP. Target
111
+ * operations (list/read/flag/move/append), `send` covers SMTP, `poll`
112
+ * covers background new-mail watching (startWatch/stopWatch). Target
112
113
  * matches mail-server hostnames; subdomain match is supported, so
113
114
  * target="gmail.com" grants access to "imap.gmail.com" and
114
115
  * "smtp.gmail.com".
@@ -134,6 +135,10 @@ declare const MAIL_COMMANDS: {
134
135
  readonly sendMessage: "extension_mail_send_message";
135
136
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
136
137
  readonly buildRfc822: "extension_mail_build_rfc822";
138
+ /** Start (or replace) a background poll watch for an account/mailbox */
139
+ readonly startWatch: "extension_mail_start_watch";
140
+ /** Stop a background poll watch */
141
+ readonly stopWatch: "extension_mail_stop_watch";
137
142
  };
138
143
  type MailCommand = (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS];
139
144
 
@@ -793,6 +798,8 @@ declare const TAURI_COMMANDS: {
793
798
  readonly appendMessage: "extension_mail_append_message";
794
799
  readonly sendMessage: "extension_mail_send_message";
795
800
  readonly buildRfc822: "extension_mail_build_rfc822";
801
+ readonly startWatch: "extension_mail_start_watch";
802
+ readonly stopWatch: "extension_mail_stop_watch";
796
803
  };
797
804
  readonly notifications: {
798
805
  readonly show: "extension_notifications_show";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-mcuC3gP5.js';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConnectionSecurity, D as DatabaseAPI, a as DecryptedSpace, b as DeepLink, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, I as ImapConfig, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, M as MailAPI, u as MailAccount, v as MailAddress, w as MailAttachment, x as MailFetchRange, y as MailMessage, z as MailboxInfo, G as MessageEnvelope, N as NotificationAction, J as NotificationClickEvent, O as NotificationOptions, P as NotificationsAPI, Q as OutgoingAttachment, R as OutgoingMessage, T as PasswordInput, U as PasswordItemFull, V as PasswordItemSummary, W as PasswordKeyValue, X as PasswordKeyValueInput, Y as PasswordsAPI, Z as PendingAuthorization, _ as PendingTransfer, $ as PermissionsAPI, a0 as RemoteAddBackendRequest, a1 as RemoteS3Config, a2 as RemoteS3PublicConfig, a3 as RemoteStorageAPI, a4 as RemoteStorageBackendInfo, a5 as RemoteStorageObjectInfo, a6 as RemoteUpdateBackendRequest, a7 as RequestedExtension, a8 as SelectFileOptions, a9 as SelectFolderOptions, aa as ServerInfo, ab as ServerStatus, ac as SessionAuthorization, ad as SharedSpace, ae as ShellAPI, af as ShellCreateOptions, ag as ShellCreateResponse, ah as ShellExitEvent, ai as ShellOutputEvent, aj as SmtpConfig, ak as SpaceAccessTokenInfo, al as SpaceAssignment, am as SpaceInvite, an as SpaceKeyGrantInfo, ao as SpaceMemberInfo, ap as SpacesAPI, aq as SyncBackendInfo, ar as TransferDirection, as as TransferProgress, at as TransferState, au as WebAPI, av as canExternalClientSendRequests, aw as isExternalClientConnected } from './client-mcuC3gP5.js';
3
- import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-fHuxbqa4.js';
4
- export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, a as ExtensionInfo, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, I as IdentityClaim, B as ManifestI18nEntry, N as NOTIFICATION_EVENTS, G as NotificationEvent, J as PermissionDeniedError, K as PermissionErrorBase, L as PermissionErrorCode, O as PermissionPromptError, P as PermissionResponse, Q as PermissionStatus, R as SHELL_EVENTS, T as SearchQuery, U as SearchRequestEvent, S as SearchResult, V as ShellEvent, X as SyncTablesUpdatedEvent, Y as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, Z as getTableName, _ as isPermissionDeniedError, $ as isPermissionError, a0 as isPermissionPromptError } from './types-fHuxbqa4.js';
1
+ import { H as HaexVaultSdk } from './client-uuhuCPDu.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConnectionSecurity, D as DatabaseAPI, a as DecryptedSpace, b as DeepLink, c as Device, d as DeviceInfo, e as DeviceType, f as DirEntry, E as ExternalAuthDecision, g as ExternalConnection, h as ExternalConnectionErrorCode, i as ExternalConnectionState, j as ExternalRequest, k as ExternalRequestEvent, l as ExternalRequestHandler, m as ExternalRequestPayload, n as ExternalResponse, F as FileStat, o as FilesystemAPI, I as ImapConfig, K as KnownPath, p as KnownPaths, L as LOCALSEND_EVENTS, q as LocalSendAPI, r as LocalSendEvent, s as LocalSendFileInfo, t as LocalSendSettings, M as MailAPI, u as MailAccount, v as MailAddress, w as MailAttachment, x as MailFetchRange, y as MailMessage, z as MailNewMessagesEvent, G as MailboxInfo, J as MessageEnvelope, N as NotificationAction, O as NotificationClickEvent, P as NotificationOptions, Q as NotificationsAPI, R as OutgoingAttachment, T as OutgoingMessage, U as PasswordInput, V as PasswordItemFull, W as PasswordItemSummary, X as PasswordKeyValue, Y as PasswordKeyValueInput, Z as PasswordsAPI, _ as PendingAuthorization, $ as PendingTransfer, a0 as PermissionsAPI, a1 as RemoteAddBackendRequest, a2 as RemoteS3Config, a3 as RemoteS3PublicConfig, a4 as RemoteStorageAPI, a5 as RemoteStorageBackendInfo, a6 as RemoteStorageObjectInfo, a7 as RemoteUpdateBackendRequest, a8 as RequestedExtension, a9 as SelectFileOptions, aa as SelectFolderOptions, ab as ServerInfo, ac as ServerStatus, ad as SessionAuthorization, ae as SharedSpace, af as ShellAPI, ag as ShellCreateOptions, ah as ShellCreateResponse, ai as ShellExitEvent, aj as ShellOutputEvent, ak as SmtpConfig, al as SpaceAccessTokenInfo, am as SpaceAssignment, an as SpaceInvite, ao as SpaceKeyGrantInfo, ap as SpaceMemberInfo, aq as SpacesAPI, ar as SyncBackendInfo, as as TransferDirection, at as TransferProgress, au as TransferState, av as WebAPI, aw as canExternalClientSendRequests, ax as isExternalClientConnected } from './client-uuhuCPDu.js';
3
+ import { E as ExtensionManifest, h as SignedClaimPresentation, H as HaexHubConfig } from './types-DQZCRfC-.js';
4
+ export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, a as ExtensionInfo, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, I as IdentityClaim, B as MAIL_EVENTS, G as MailEvent, J as ManifestI18nEntry, N as NOTIFICATION_EVENTS, K as NotificationEvent, L as PermissionDeniedError, O as PermissionErrorBase, Q as PermissionErrorCode, R as PermissionPromptError, P as PermissionResponse, T as PermissionStatus, U as SHELL_EVENTS, V as SearchQuery, X as SearchRequestEvent, S as SearchResult, Y as ShellEvent, Z as SyncTablesUpdatedEvent, _ as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, $ as getTableName, a0 as isPermissionDeniedError, a1 as isPermissionError, a2 as isPermissionPromptError } from './types-DQZCRfC-.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -108,7 +108,8 @@ type PasswordCommand = (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS
108
108
  * Mail Commands (IMAP fetch + SMTP send).
109
109
  *
110
110
  * Permissions are split protocol-wise: `fetch` covers all IMAP
111
- * operations (list/read/flag/move/append), `send` covers SMTP. Target
111
+ * operations (list/read/flag/move/append), `send` covers SMTP, `poll`
112
+ * covers background new-mail watching (startWatch/stopWatch). Target
112
113
  * matches mail-server hostnames; subdomain match is supported, so
113
114
  * target="gmail.com" grants access to "imap.gmail.com" and
114
115
  * "smtp.gmail.com".
@@ -134,6 +135,10 @@ declare const MAIL_COMMANDS: {
134
135
  readonly sendMessage: "extension_mail_send_message";
135
136
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
136
137
  readonly buildRfc822: "extension_mail_build_rfc822";
138
+ /** Start (or replace) a background poll watch for an account/mailbox */
139
+ readonly startWatch: "extension_mail_start_watch";
140
+ /** Stop a background poll watch */
141
+ readonly stopWatch: "extension_mail_stop_watch";
137
142
  };
138
143
  type MailCommand = (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS];
139
144
 
@@ -793,6 +798,8 @@ declare const TAURI_COMMANDS: {
793
798
  readonly appendMessage: "extension_mail_append_message";
794
799
  readonly sendMessage: "extension_mail_send_message";
795
800
  readonly buildRfc822: "extension_mail_build_rfc822";
801
+ readonly startWatch: "extension_mail_start_watch";
802
+ readonly stopWatch: "extension_mail_stop_watch";
796
803
  };
797
804
  readonly notifications: {
798
805
  readonly show: "extension_notifications_show";
package/dist/index.js CHANGED
@@ -735,6 +735,10 @@ var SHELL_EVENTS = {
735
735
  /** Shell session has exited */
736
736
  EXIT: "shell:exit"
737
737
  };
738
+ var MAIL_EVENTS = {
739
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
740
+ NEW_MESSAGES: "mail:new-messages"
741
+ };
738
742
 
739
743
  // src/types.ts
740
744
  var DEFAULT_TIMEOUT = 3e4;
@@ -1090,7 +1094,11 @@ var MAIL_COMMANDS = {
1090
1094
  /** SMTP send. Returns the assigned Message-ID. */
1091
1095
  sendMessage: "extension_mail_send_message",
1092
1096
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
1093
- buildRfc822: "extension_mail_build_rfc822"
1097
+ buildRfc822: "extension_mail_build_rfc822",
1098
+ /** Start (or replace) a background poll watch for an account/mailbox */
1099
+ startWatch: "extension_mail_start_watch",
1100
+ /** Stop a background poll watch */
1101
+ stopWatch: "extension_mail_stop_watch"
1094
1102
  };
1095
1103
 
1096
1104
  // src/commands/notifications.ts
@@ -2215,6 +2223,41 @@ var MailAPI = class {
2215
2223
  message
2216
2224
  });
2217
2225
  }
2226
+ /**
2227
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
2228
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
2229
+ * is passed in. Requires `mail` permission with action `poll` on the
2230
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
2231
+ *
2232
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
2233
+ * results via `onNewMessages`.
2234
+ */
2235
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
2236
+ return this.client.request(MAIL_COMMANDS.startWatch, {
2237
+ accountId,
2238
+ mailboxName,
2239
+ intervalSeconds
2240
+ });
2241
+ }
2242
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
2243
+ async stopWatchingAsync(accountId, mailboxName) {
2244
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
2245
+ accountId,
2246
+ mailboxName
2247
+ });
2248
+ }
2249
+ /**
2250
+ * Register a callback for new-mail notifications from any active watch.
2251
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
2252
+ * before refreshing if watching more than one account.
2253
+ */
2254
+ onNewMessages(callback) {
2255
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
2256
+ }
2257
+ /** Remove a new-mail callback registered with `onNewMessages`. */
2258
+ offNewMessages(callback) {
2259
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
2260
+ }
2218
2261
  };
2219
2262
 
2220
2263
  // src/api/notifications.ts
@@ -2417,6 +2460,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
2417
2460
  EXTERNAL_EVENTS.REQUEST,
2418
2461
  EXTERNAL_EVENTS.ACTION_REQUEST,
2419
2462
  NOTIFICATION_EVENTS.CLICK,
2463
+ MAIL_EVENTS.NEW_MESSAGES,
2420
2464
  ...Object.values(LOCALSEND_EVENTS)
2421
2465
  ]) {
2422
2466
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);
@@ -3847,6 +3891,7 @@ exports.KnownPath = KnownPath;
3847
3891
  exports.LOCALSEND_EVENTS = LOCALSEND_EVENTS;
3848
3892
  exports.LocalSendAPI = LocalSendAPI;
3849
3893
  exports.MAIL_COMMANDS = MAIL_COMMANDS;
3894
+ exports.MAIL_EVENTS = MAIL_EVENTS;
3850
3895
  exports.MailAPI = MailAPI;
3851
3896
  exports.NOTIFICATION_COMMANDS = NOTIFICATION_COMMANDS;
3852
3897
  exports.NOTIFICATION_EVENTS = NOTIFICATION_EVENTS;