@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,7 +1,7 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-DCoY4f3Q.mjs';
4
- import { A as ApplicationContext } from '../types-fHuxbqa4.mjs';
3
+ import { H as HaexVaultSdk } from '../client-DnCZ3KyI.mjs';
4
+ import { A as ApplicationContext } from '../types-DQZCRfC-.mjs';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
7
7
  declare const _default: nuxt_app.Plugin<{
@@ -1,7 +1,7 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-mcuC3gP5.js';
4
- import { A as ApplicationContext } from '../types-fHuxbqa4.js';
3
+ import { H as HaexVaultSdk } from '../client-uuhuCPDu.js';
4
+ import { A as ApplicationContext } from '../types-DQZCRfC-.js';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
7
7
  declare const _default: nuxt_app.Plugin<{
@@ -36,6 +36,10 @@ var SHELL_EVENTS = {
36
36
  /** Shell session has exited */
37
37
  EXIT: "shell:exit"
38
38
  };
39
+ var MAIL_EVENTS = {
40
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
41
+ NEW_MESSAGES: "mail:new-messages"
42
+ };
39
43
 
40
44
  // src/types.ts
41
45
  var DEFAULT_TIMEOUT = 3e4;
@@ -308,7 +312,11 @@ var MAIL_COMMANDS = {
308
312
  /** SMTP send. Returns the assigned Message-ID. */
309
313
  sendMessage: "extension_mail_send_message",
310
314
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
311
- 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"
312
320
  };
313
321
 
314
322
  // src/commands/notifications.ts
@@ -1431,6 +1439,41 @@ var MailAPI = class {
1431
1439
  message
1432
1440
  });
1433
1441
  }
1442
+ /**
1443
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
1444
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
1445
+ * is passed in. Requires `mail` permission with action `poll` on the
1446
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
1447
+ *
1448
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
1449
+ * results via `onNewMessages`.
1450
+ */
1451
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
1452
+ return this.client.request(MAIL_COMMANDS.startWatch, {
1453
+ accountId,
1454
+ mailboxName,
1455
+ intervalSeconds
1456
+ });
1457
+ }
1458
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
1459
+ async stopWatchingAsync(accountId, mailboxName) {
1460
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
1461
+ accountId,
1462
+ mailboxName
1463
+ });
1464
+ }
1465
+ /**
1466
+ * Register a callback for new-mail notifications from any active watch.
1467
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
1468
+ * before refreshing if watching more than one account.
1469
+ */
1470
+ onNewMessages(callback) {
1471
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
1472
+ }
1473
+ /** Remove a new-mail callback registered with `onNewMessages`. */
1474
+ offNewMessages(callback) {
1475
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
1476
+ }
1434
1477
  };
1435
1478
 
1436
1479
  // src/api/notifications.ts
@@ -1724,6 +1767,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1724
1767
  EXTERNAL_EVENTS.REQUEST,
1725
1768
  EXTERNAL_EVENTS.ACTION_REQUEST,
1726
1769
  NOTIFICATION_EVENTS.CLICK,
1770
+ MAIL_EVENTS.NEW_MESSAGES,
1727
1771
  ...Object.values(LOCALSEND_EVENTS)
1728
1772
  ]) {
1729
1773
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);