@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.
@@ -27,6 +27,14 @@ declare const HAEXTENSION_EVENTS: {
27
27
  readonly PERMISSION_RESOLVED: "extension:permission-resolved";
28
28
  };
29
29
  type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENTS];
30
+ /**
31
+ * Events for the generic notifications API.
32
+ */
33
+ declare const NOTIFICATION_EVENTS: {
34
+ /** A click on one of this extension's notifications (body or action button). */
35
+ readonly CLICK: "haextension:notification:click";
36
+ };
37
+ type NotificationEvent = typeof NOTIFICATION_EVENTS[keyof typeof NOTIFICATION_EVENTS];
30
38
  /**
31
39
  * Events for external client communication (browser extensions, CLI tools, servers, etc.)
32
40
  */
@@ -399,4 +407,4 @@ declare class HaexVaultSdkError extends Error {
399
407
  };
400
408
  }
401
409
 
402
- export { 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 PermissionDeniedError as G, type HaexHubConfig as H, type IdentityClaim as I, type PermissionErrorBase as J, PermissionErrorCode as K, type PermissionPromptError as L, type Migration as M, PermissionStatus as N, SHELL_EVENTS as O, type PermissionResponse as P, type SearchQuery as Q, type SearchRequestEvent as R, type SearchResult as S, type ShellEvent as T, type SyncTablesUpdatedEvent as U, TABLE_SEPARATOR as V, type WebRequestOptions as W, getTableName as X, isPermissionDeniedError as Y, isPermissionError as Z, isPermissionPromptError as _, type ExtensionInfo as a, 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 };
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 };
@@ -27,6 +27,14 @@ declare const HAEXTENSION_EVENTS: {
27
27
  readonly PERMISSION_RESOLVED: "extension:permission-resolved";
28
28
  };
29
29
  type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENTS];
30
+ /**
31
+ * Events for the generic notifications API.
32
+ */
33
+ declare const NOTIFICATION_EVENTS: {
34
+ /** A click on one of this extension's notifications (body or action button). */
35
+ readonly CLICK: "haextension:notification:click";
36
+ };
37
+ type NotificationEvent = typeof NOTIFICATION_EVENTS[keyof typeof NOTIFICATION_EVENTS];
30
38
  /**
31
39
  * Events for external client communication (browser extensions, CLI tools, servers, etc.)
32
40
  */
@@ -399,4 +407,4 @@ declare class HaexVaultSdkError extends Error {
399
407
  };
400
408
  }
401
409
 
402
- export { 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 PermissionDeniedError as G, type HaexHubConfig as H, type IdentityClaim as I, type PermissionErrorBase as J, PermissionErrorCode as K, type PermissionPromptError as L, type Migration as M, PermissionStatus as N, SHELL_EVENTS as O, type PermissionResponse as P, type SearchQuery as Q, type SearchRequestEvent as R, type SearchResult as S, type ShellEvent as T, type SyncTablesUpdatedEvent as U, TABLE_SEPARATOR as V, type WebRequestOptions as W, getTableName as X, isPermissionDeniedError as Y, isPermissionError as Z, isPermissionPromptError as _, type ExtensionInfo as a, 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 };
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 };
package/dist/vue.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 { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-Cji-mUN0.mjs';
4
+ import { H as HaexHubConfig } from './types-fHuxbqa4.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-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 { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-Cji-mUN0.js';
4
+ import { H as HaexHubConfig } from './types-fHuxbqa4.js';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexVault SDK
package/dist/vue.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;