@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.
@@ -57,6 +57,14 @@ declare const SHELL_EVENTS: {
57
57
  readonly EXIT: "shell:exit";
58
58
  };
59
59
  type ShellEvent = typeof SHELL_EVENTS[keyof typeof SHELL_EVENTS];
60
+ /**
61
+ * Events for background mail-poll watches (`mail.startWatchingAsync`).
62
+ */
63
+ declare const MAIL_EVENTS: {
64
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
65
+ readonly NEW_MESSAGES: "mail:new-messages";
66
+ };
67
+ type MailEvent = typeof MAIL_EVENTS[keyof typeof MAIL_EVENTS];
60
68
 
61
69
  declare const DEFAULT_TIMEOUT = 30000;
62
70
  declare const TABLE_SEPARATOR = "__";
@@ -407,4 +415,4 @@ declare class HaexVaultSdkError extends Error {
407
415
  };
408
416
  }
409
417
 
410
- export { isPermissionError as $, type ApplicationContext as A, type ManifestI18nEntry as B, type ClaimRequirement as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type FileChangeEvent as F, type NotificationEvent as G, type HaexHubConfig as H, type IdentityClaim as I, type PermissionDeniedError as J, type PermissionErrorBase as K, PermissionErrorCode as L, type Migration as M, NOTIFICATION_EVENTS as N, type PermissionPromptError as O, type PermissionResponse as P, PermissionStatus as Q, SHELL_EVENTS as R, type SearchResult as S, type SearchQuery as T, type SearchRequestEvent as U, type ShellEvent as V, type WebRequestOptions as W, type SyncTablesUpdatedEvent as X, TABLE_SEPARATOR as Y, getTableName as Z, isPermissionDeniedError as _, type ExtensionInfo as a, isPermissionPromptError as a0, type HaexHubEvent as b, EXTERNAL_EVENTS as c, type MigrationResult as d, type WebResponse as e, type EventCallback as f, type DatabasePermissionRequest as g, type SignedClaimPresentation as h, type ContextChangedEvent as i, DEFAULT_TIMEOUT as j, type DatabaseColumnInfo as k, type DatabaseExecuteParams as l, type DatabasePermission as m, type DatabaseQueryParams as n, type DatabaseTableInfo as o, ErrorCode as p, type ExtensionRuntimeMode as q, type ExternalEvent as r, type FileChangePayload as s, type FileChangeType as t, type FilteredSyncTablesResult as u, HAEXTENSION_EVENTS as v, type HaexHubRequest as w, type HaexHubResponse as x, HaexVaultSdkError as y, type HaextensionEvent as z };
418
+ export { getTableName as $, type ApplicationContext as A, MAIL_EVENTS as B, type ClaimRequirement as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type FileChangeEvent as F, type MailEvent as G, type HaexHubConfig as H, type IdentityClaim as I, type ManifestI18nEntry as J, type NotificationEvent as K, type PermissionDeniedError as L, type Migration as M, NOTIFICATION_EVENTS as N, type PermissionErrorBase as O, type PermissionResponse as P, PermissionErrorCode as Q, type PermissionPromptError as R, type SearchResult as S, PermissionStatus as T, SHELL_EVENTS as U, type SearchQuery as V, type WebRequestOptions as W, type SearchRequestEvent as X, type ShellEvent as Y, type SyncTablesUpdatedEvent as Z, TABLE_SEPARATOR as _, type ExtensionInfo as a, isPermissionDeniedError as a0, isPermissionError as a1, isPermissionPromptError as a2, type HaexHubEvent as b, EXTERNAL_EVENTS as c, type MigrationResult as d, type WebResponse as e, type EventCallback as f, type DatabasePermissionRequest as g, type SignedClaimPresentation as h, type ContextChangedEvent as i, DEFAULT_TIMEOUT as j, type DatabaseColumnInfo as k, type DatabaseExecuteParams as l, type DatabasePermission as m, type DatabaseQueryParams as n, type DatabaseTableInfo as o, ErrorCode as p, type ExtensionRuntimeMode as q, type ExternalEvent as r, type FileChangePayload as s, type FileChangeType as t, type FilteredSyncTablesResult as u, HAEXTENSION_EVENTS as v, type HaexHubRequest as w, type HaexHubResponse as x, HaexVaultSdkError as y, type HaextensionEvent as z };
@@ -57,6 +57,14 @@ declare const SHELL_EVENTS: {
57
57
  readonly EXIT: "shell:exit";
58
58
  };
59
59
  type ShellEvent = typeof SHELL_EVENTS[keyof typeof SHELL_EVENTS];
60
+ /**
61
+ * Events for background mail-poll watches (`mail.startWatchingAsync`).
62
+ */
63
+ declare const MAIL_EVENTS: {
64
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
65
+ readonly NEW_MESSAGES: "mail:new-messages";
66
+ };
67
+ type MailEvent = typeof MAIL_EVENTS[keyof typeof MAIL_EVENTS];
60
68
 
61
69
  declare const DEFAULT_TIMEOUT = 30000;
62
70
  declare const TABLE_SEPARATOR = "__";
@@ -407,4 +415,4 @@ declare class HaexVaultSdkError extends Error {
407
415
  };
408
416
  }
409
417
 
410
- export { isPermissionError as $, type ApplicationContext as A, type ManifestI18nEntry as B, type ClaimRequirement as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type FileChangeEvent as F, type NotificationEvent as G, type HaexHubConfig as H, type IdentityClaim as I, type PermissionDeniedError as J, type PermissionErrorBase as K, PermissionErrorCode as L, type Migration as M, NOTIFICATION_EVENTS as N, type PermissionPromptError as O, type PermissionResponse as P, PermissionStatus as Q, SHELL_EVENTS as R, type SearchResult as S, type SearchQuery as T, type SearchRequestEvent as U, type ShellEvent as V, type WebRequestOptions as W, type SyncTablesUpdatedEvent as X, TABLE_SEPARATOR as Y, getTableName as Z, isPermissionDeniedError as _, type ExtensionInfo as a, isPermissionPromptError as a0, type HaexHubEvent as b, EXTERNAL_EVENTS as c, type MigrationResult as d, type WebResponse as e, type EventCallback as f, type DatabasePermissionRequest as g, type SignedClaimPresentation as h, type ContextChangedEvent as i, DEFAULT_TIMEOUT as j, type DatabaseColumnInfo as k, type DatabaseExecuteParams as l, type DatabasePermission as m, type DatabaseQueryParams as n, type DatabaseTableInfo as o, ErrorCode as p, type ExtensionRuntimeMode as q, type ExternalEvent as r, type FileChangePayload as s, type FileChangeType as t, type FilteredSyncTablesResult as u, HAEXTENSION_EVENTS as v, type HaexHubRequest as w, type HaexHubResponse as x, HaexVaultSdkError as y, type HaextensionEvent as z };
418
+ export { getTableName as $, type ApplicationContext as A, MAIL_EVENTS as B, type ClaimRequirement as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type FileChangeEvent as F, type MailEvent as G, type HaexHubConfig as H, type IdentityClaim as I, type ManifestI18nEntry as J, type NotificationEvent as K, type PermissionDeniedError as L, type Migration as M, NOTIFICATION_EVENTS as N, type PermissionErrorBase as O, type PermissionResponse as P, PermissionErrorCode as Q, type PermissionPromptError as R, type SearchResult as S, PermissionStatus as T, SHELL_EVENTS as U, type SearchQuery as V, type WebRequestOptions as W, type SearchRequestEvent as X, type ShellEvent as Y, type SyncTablesUpdatedEvent as Z, TABLE_SEPARATOR as _, type ExtensionInfo as a, isPermissionDeniedError as a0, isPermissionError as a1, isPermissionPromptError as a2, type HaexHubEvent as b, EXTERNAL_EVENTS as c, type MigrationResult as d, type WebResponse as e, type EventCallback as f, type DatabasePermissionRequest as g, type SignedClaimPresentation as h, type ContextChangedEvent as i, DEFAULT_TIMEOUT as j, type DatabaseColumnInfo as k, type DatabaseExecuteParams as l, type DatabasePermission as m, type DatabaseQueryParams as n, type DatabaseTableInfo as o, ErrorCode as p, type ExtensionRuntimeMode as q, type ExternalEvent as r, type FileChangePayload as s, type FileChangeType as t, type FilteredSyncTablesResult as u, HAEXTENSION_EVENTS as v, type HaexHubRequest as w, type HaexHubResponse as x, HaexVaultSdkError as y, type HaextensionEvent as z };
package/dist/vue.d.mts CHANGED
@@ -1,7 +1,7 @@
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
3
  import { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-fHuxbqa4.mjs';
4
+ import { H as HaexHubConfig } from './types-DQZCRfC-.mjs';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexVault SDK
package/dist/vue.d.ts CHANGED
@@ -1,7 +1,7 @@
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
3
  import { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-fHuxbqa4.js';
4
+ import { H as HaexHubConfig } from './types-DQZCRfC-.js';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexVault SDK
package/dist/vue.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);