@haex-space/vault-sdk 3.2.8 → 3.4.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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-DaS2fAf-.mjs';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-C9FyPkqp.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Readable } from 'svelte/store';
4
- import { A as ApplicationContext, a as ExtensionInfo, H as HaexHubConfig } from './types-Cji-mUN0.mjs';
4
+ import { A as ApplicationContext, a as ExtensionInfo, H as HaexHubConfig } from './types-fHuxbqa4.mjs';
5
5
 
6
6
  /**
7
7
  * Initialize the HaexVault SDK for Svelte
package/dist/svelte.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-BBD-YsPv.js';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client--_QYySP0.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Readable } from 'svelte/store';
4
- import { A as ApplicationContext, a as ExtensionInfo, H as HaexHubConfig } from './types-Cji-mUN0.js';
4
+ import { A as ApplicationContext, a as ExtensionInfo, H as HaexHubConfig } from './types-fHuxbqa4.js';
5
5
 
6
6
  /**
7
7
  * Initialize the HaexVault SDK for Svelte
package/dist/svelte.js CHANGED
@@ -404,6 +404,10 @@ var HAEXTENSION_EVENTS = {
404
404
  * subscribe via `client.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, ...)`. */
405
405
  PERMISSION_RESOLVED: "extension:permission-resolved"
406
406
  };
407
+ var NOTIFICATION_EVENTS = {
408
+ /** A click on one of this extension's notifications (body or action button). */
409
+ CLICK: "haextension:notification:click"
410
+ };
407
411
  var EXTERNAL_EVENTS = {
408
412
  /** External request from authorized client */
409
413
  REQUEST: "haextension:external:request",
@@ -676,6 +680,8 @@ var MAIL_COMMANDS = {
676
680
  fetchEnvelopes: "extension_mail_fetch_envelopes",
677
681
  /** Full message fetch (envelope + body + attachment metadata) */
678
682
  fetchMessage: "extension_mail_fetch_message",
683
+ /** Fetch a single attachment's bytes (base64) by part index */
684
+ fetchAttachment: "extension_mail_fetch_attachment",
679
685
  /** Set or unset IMAP flags on a UID set */
680
686
  setFlags: "extension_mail_set_flags",
681
687
  /** MOVE messages between mailboxes (COPY+EXPUNGE fallback) */
@@ -688,6 +694,14 @@ var MAIL_COMMANDS = {
688
694
  buildRfc822: "extension_mail_build_rfc822"
689
695
  };
690
696
 
697
+ // src/commands/notifications.ts
698
+ var NOTIFICATION_COMMANDS = {
699
+ /** Show an OS notification. Returns the assigned notification id. */
700
+ show: "extension_notifications_show",
701
+ /** Dismiss a previously shown notification (only own notifications). */
702
+ dismiss: "extension_notifications_dismiss"
703
+ };
704
+
691
705
  // src/api/storage.ts
692
706
  var StorageAPI = class {
693
707
  constructor(client) {
@@ -1707,6 +1721,21 @@ var MailAPI = class {
1707
1721
  uid
1708
1722
  });
1709
1723
  }
1724
+ /**
1725
+ * Fetch a single attachment's raw bytes by its `partIndex` (from the
1726
+ * `attachments` array of a fetched `MailMessage`), returned as a
1727
+ * standard-alphabet base64 string. The base64 form drops straight into
1728
+ * `OutgoingAttachment.data` when forwarding, and decodes to bytes for
1729
+ * viewing or downloading.
1730
+ */
1731
+ async fetchAttachmentAsync(imap, mailbox, uid, partIndex) {
1732
+ return this.client.request(MAIL_COMMANDS.fetchAttachment, {
1733
+ imap,
1734
+ mailbox,
1735
+ uid,
1736
+ partIndex
1737
+ });
1738
+ }
1710
1739
  /**
1711
1740
  * Set or unset IMAP flags. Use `flags=["\\Seen"]` + `add=true` to
1712
1741
  * mark messages as read; `add=false` removes the flag(s).
@@ -1762,6 +1791,38 @@ var MailAPI = class {
1762
1791
  }
1763
1792
  };
1764
1793
 
1794
+ // src/api/notifications.ts
1795
+ var NotificationsAPI = class {
1796
+ constructor(client) {
1797
+ this.client = client;
1798
+ }
1799
+ /** Show a notification. Returns its id so it can be dismissed later. */
1800
+ async show(opts) {
1801
+ return this.client.request(NOTIFICATION_COMMANDS.show, {
1802
+ options: opts
1803
+ });
1804
+ }
1805
+ /** Dismiss a previously shown notification (only own notifications). */
1806
+ async dismiss(id) {
1807
+ return this.client.request(NOTIFICATION_COMMANDS.dismiss, { id });
1808
+ }
1809
+ /**
1810
+ * Listen for clicks on this extension's notifications. Useful when the
1811
+ * extension is already open and wants to react in-app (e.g. router.push the
1812
+ * `path`) instead of relying on the host to focus the webview.
1813
+ *
1814
+ * Returns an unsubscribe function.
1815
+ */
1816
+ onClick(handler) {
1817
+ const wrapped = (event) => {
1818
+ const data = event.data;
1819
+ if (data) handler(data);
1820
+ };
1821
+ this.client.on(NOTIFICATION_EVENTS.CLICK, wrapped);
1822
+ return () => this.client.off(NOTIFICATION_EVENTS.CLICK, wrapped);
1823
+ }
1824
+ };
1825
+
1765
1826
  // src/client/tableName.ts
1766
1827
  function validatePublicKey(publicKey) {
1767
1828
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -1929,6 +1990,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1929
1990
  HAEXTENSION_EVENTS.PERMISSION_RESOLVED,
1930
1991
  EXTERNAL_EVENTS.REQUEST,
1931
1992
  EXTERNAL_EVENTS.ACTION_REQUEST,
1993
+ NOTIFICATION_EVENTS.CLICK,
1932
1994
  ...Object.values(LOCALSEND_EVENTS)
1933
1995
  ]) {
1934
1996
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);
@@ -2404,6 +2466,7 @@ var HaexVaultSdk = class {
2404
2466
  this.shell = new ShellAPI(this);
2405
2467
  this.passwords = new PasswordsAPI(this);
2406
2468
  this.mail = new MailAPI(this);
2469
+ this.notifications = new NotificationsAPI(this);
2407
2470
  installConsoleForwarding(this.config.debug);
2408
2471
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2409
2472
  const data = event.data;