@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.
@@ -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-DaS2fAf-.mjs';
4
- import { A as ApplicationContext } from '../types-Cji-mUN0.mjs';
3
+ import { H as HaexVaultSdk } from '../client-C9FyPkqp.mjs';
4
+ import { A as ApplicationContext } from '../types-fHuxbqa4.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-BBD-YsPv.js';
4
- import { A as ApplicationContext } from '../types-Cji-mUN0.js';
3
+ import { H as HaexVaultSdk } from '../client--_QYySP0.js';
4
+ import { A as ApplicationContext } from '../types-fHuxbqa4.js';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
7
7
  declare const _default: nuxt_app.Plugin<{
@@ -21,6 +21,10 @@ var HAEXTENSION_EVENTS = {
21
21
  * subscribe via `client.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, ...)`. */
22
22
  PERMISSION_RESOLVED: "extension:permission-resolved"
23
23
  };
24
+ var NOTIFICATION_EVENTS = {
25
+ /** A click on one of this extension's notifications (body or action button). */
26
+ CLICK: "haextension:notification:click"
27
+ };
24
28
  var EXTERNAL_EVENTS = {
25
29
  /** External request from authorized client */
26
30
  REQUEST: "haextension:external:request",
@@ -293,6 +297,8 @@ var MAIL_COMMANDS = {
293
297
  fetchEnvelopes: "extension_mail_fetch_envelopes",
294
298
  /** Full message fetch (envelope + body + attachment metadata) */
295
299
  fetchMessage: "extension_mail_fetch_message",
300
+ /** Fetch a single attachment's bytes (base64) by part index */
301
+ fetchAttachment: "extension_mail_fetch_attachment",
296
302
  /** Set or unset IMAP flags on a UID set */
297
303
  setFlags: "extension_mail_set_flags",
298
304
  /** MOVE messages between mailboxes (COPY+EXPUNGE fallback) */
@@ -305,6 +311,14 @@ var MAIL_COMMANDS = {
305
311
  buildRfc822: "extension_mail_build_rfc822"
306
312
  };
307
313
 
314
+ // src/commands/notifications.ts
315
+ var NOTIFICATION_COMMANDS = {
316
+ /** Show an OS notification. Returns the assigned notification id. */
317
+ show: "extension_notifications_show",
318
+ /** Dismiss a previously shown notification (only own notifications). */
319
+ dismiss: "extension_notifications_dismiss"
320
+ };
321
+
308
322
  // src/api/storage.ts
309
323
  var StorageAPI = class {
310
324
  constructor(client) {
@@ -1349,6 +1363,21 @@ var MailAPI = class {
1349
1363
  uid
1350
1364
  });
1351
1365
  }
1366
+ /**
1367
+ * Fetch a single attachment's raw bytes by its `partIndex` (from the
1368
+ * `attachments` array of a fetched `MailMessage`), returned as a
1369
+ * standard-alphabet base64 string. The base64 form drops straight into
1370
+ * `OutgoingAttachment.data` when forwarding, and decodes to bytes for
1371
+ * viewing or downloading.
1372
+ */
1373
+ async fetchAttachmentAsync(imap, mailbox, uid, partIndex) {
1374
+ return this.client.request(MAIL_COMMANDS.fetchAttachment, {
1375
+ imap,
1376
+ mailbox,
1377
+ uid,
1378
+ partIndex
1379
+ });
1380
+ }
1352
1381
  /**
1353
1382
  * Set or unset IMAP flags. Use `flags=["\\Seen"]` + `add=true` to
1354
1383
  * mark messages as read; `add=false` removes the flag(s).
@@ -1404,6 +1433,38 @@ var MailAPI = class {
1404
1433
  }
1405
1434
  };
1406
1435
 
1436
+ // src/api/notifications.ts
1437
+ var NotificationsAPI = class {
1438
+ constructor(client) {
1439
+ this.client = client;
1440
+ }
1441
+ /** Show a notification. Returns its id so it can be dismissed later. */
1442
+ async show(opts) {
1443
+ return this.client.request(NOTIFICATION_COMMANDS.show, {
1444
+ options: opts
1445
+ });
1446
+ }
1447
+ /** Dismiss a previously shown notification (only own notifications). */
1448
+ async dismiss(id) {
1449
+ return this.client.request(NOTIFICATION_COMMANDS.dismiss, { id });
1450
+ }
1451
+ /**
1452
+ * Listen for clicks on this extension's notifications. Useful when the
1453
+ * extension is already open and wants to react in-app (e.g. router.push the
1454
+ * `path`) instead of relying on the host to focus the webview.
1455
+ *
1456
+ * Returns an unsubscribe function.
1457
+ */
1458
+ onClick(handler) {
1459
+ const wrapped = (event) => {
1460
+ const data = event.data;
1461
+ if (data) handler(data);
1462
+ };
1463
+ this.client.on(NOTIFICATION_EVENTS.CLICK, wrapped);
1464
+ return () => this.client.off(NOTIFICATION_EVENTS.CLICK, wrapped);
1465
+ }
1466
+ };
1467
+
1407
1468
  // src/messages.ts
1408
1469
  var HAEXSPACE_MESSAGE_TYPES = {
1409
1470
  /** Debug message for development/troubleshooting */
@@ -1662,6 +1723,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1662
1723
  HAEXTENSION_EVENTS.PERMISSION_RESOLVED,
1663
1724
  EXTERNAL_EVENTS.REQUEST,
1664
1725
  EXTERNAL_EVENTS.ACTION_REQUEST,
1726
+ NOTIFICATION_EVENTS.CLICK,
1665
1727
  ...Object.values(LOCALSEND_EVENTS)
1666
1728
  ]) {
1667
1729
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);
@@ -2137,6 +2199,7 @@ var HaexVaultSdk = class {
2137
2199
  this.shell = new ShellAPI(this);
2138
2200
  this.passwords = new PasswordsAPI(this);
2139
2201
  this.mail = new MailAPI(this);
2202
+ this.notifications = new NotificationsAPI(this);
2140
2203
  installConsoleForwarding(this.config.debug);
2141
2204
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2142
2205
  const data = event.data;