@haex-space/vault-sdk 5.4.2 → 5.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.
Files changed (49) hide show
  1. package/dist/autofill.js +1 -1
  2. package/dist/autofill.js.map +1 -1
  3. package/dist/autofill.mjs +1 -1
  4. package/dist/autofill.mjs.map +1 -1
  5. package/dist/cli/index.mjs.map +1 -1
  6. package/dist/{client-HdPYJ_9t.d.mts → client-5T310pDa.d.mts} +157 -3
  7. package/dist/{client-CgngeKPm.d.ts → client-r56Io3Ns.d.ts} +157 -3
  8. package/dist/haex_bundle_bg.wasm +0 -0
  9. package/dist/index.d.mts +15 -5
  10. package/dist/index.d.ts +15 -5
  11. package/dist/index.js +70 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +69 -2
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/node.d.mts +1 -1
  16. package/dist/node.d.ts +1 -1
  17. package/dist/node.mjs +1 -1
  18. package/dist/node.mjs.map +1 -1
  19. package/dist/nuxt.js +1 -1
  20. package/dist/nuxt.js.map +1 -1
  21. package/dist/passgen.js +1 -1
  22. package/dist/passgen.js.map +1 -1
  23. package/dist/passgen.mjs +1 -1
  24. package/dist/passgen.mjs.map +1 -1
  25. package/dist/react.d.mts +1 -1
  26. package/dist/react.d.ts +1 -1
  27. package/dist/react.js +79 -2
  28. package/dist/react.js.map +1 -1
  29. package/dist/react.mjs +78 -1
  30. package/dist/react.mjs.map +1 -1
  31. package/dist/runtime/nuxt.plugin.client.js +76 -0
  32. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  33. package/dist/runtime/nuxt.plugin.client.mjs +76 -0
  34. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  35. package/dist/svelte.d.mts +1 -1
  36. package/dist/svelte.d.ts +1 -1
  37. package/dist/svelte.js +79 -2
  38. package/dist/svelte.js.map +1 -1
  39. package/dist/svelte.mjs +78 -1
  40. package/dist/svelte.mjs.map +1 -1
  41. package/dist/{types-CNxDNQgb.d.mts → types-keveJwPq.d.mts} +3 -0
  42. package/dist/{types-CNxDNQgb.d.ts → types-keveJwPq.d.ts} +3 -0
  43. package/dist/vue.d.mts +1 -1
  44. package/dist/vue.d.ts +1 -1
  45. package/dist/vue.js +79 -2
  46. package/dist/vue.js.map +1 -1
  47. package/dist/vue.mjs +78 -1
  48. package/dist/vue.mjs.map +1 -1
  49. package/package.json +1 -1
@@ -14,6 +14,9 @@ var HAEXTENSION_EVENTS = {
14
14
  FILE_CHANGED: "filesync:file-changed",
15
15
  /** Tables have been updated via sync (CRDT pull from server) */
16
16
  SYNC_TABLES_UPDATED: "haextension:sync:tables-updated",
17
+ /** The user used a control of this extension's header (holzi spec 090): `{ id, kind, value? }`.
18
+ * Subscribe through `client.header.onEvent`. */
19
+ HEADER_EVENT: "haextension:header:event",
17
20
  /** A runtime permission prompt was resolved (granted/denied) by the user.
18
21
  * The SDK uses this to auto-retry the original request; extensions may also
19
22
  * subscribe via `client.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, ...)`. */
@@ -201,8 +204,20 @@ var EXTENSION_COMMANDS = {
201
204
  getInfo: "extension_get_info",
202
205
  /** Get application context (theme, locale, etc.) */
203
206
  getContext: "extension_context_get",
207
+ /** Set application context (host-only, updates stored context for extensions) */
208
+ setContext: "extension_context_set",
209
+ /** Broadcast event to ALL extension webview windows (host-only, desktop only) */
210
+ webviewBroadcast: "extension_webview_broadcast",
211
+ /** Emit event to all webviews of a SPECIFIC extension (host-only, desktop only) */
212
+ webviewEmit: "extension_webview_emit",
213
+ /** Filter sync tables by extension permissions (returns filtered map) */
214
+ filterSyncTables: "extension_filter_sync_tables",
215
+ /** Emit sync tables to webviews (host-only, desktop only) */
216
+ emitSyncTables: "extension_emit_sync_tables",
204
217
  /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
205
218
  tabAttention: "extension_tab_attention",
219
+ /** Replace the header of this extension's own tab (holzi spec 090): `null` */
220
+ headerSet: "extension_header_set",
206
221
  /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
207
222
  dialogConfirm: "extension_dialog_confirm",
208
223
  /** Take the request the user gave this extension (holzi spec 063): `null` or `{ action, mail }` */
@@ -396,6 +411,10 @@ var MAIL_COMMANDS = {
396
411
  search: "extension_mail_search",
397
412
  /** CREATE a mailbox (reports whether it was already there) */
398
413
  createMailbox: "extension_mail_create_mailbox",
414
+ /** DELETE a mailbox (never INBOX) */
415
+ deleteMailbox: "extension_mail_delete_mailbox",
416
+ /** RENAME a mailbox (never INBOX) */
417
+ renameMailbox: "extension_mail_rename_mailbox",
399
418
  /** Delete messages for good: `\Deleted` plus UID EXPUNGE of exactly those UIDs */
400
419
  deleteMessages: "extension_mail_delete_messages",
401
420
  /** Set or unset IMAP flags on a UID set */
@@ -1927,6 +1946,25 @@ var MailAPI = class {
1927
1946
  );
1928
1947
  return created;
1929
1948
  }
1949
+ /**
1950
+ * Delete a mailbox. `mailbox` is the IMAP-encoded name (modified UTF-7), like in every other
1951
+ * call. `INBOX` can be neither deleted nor renamed; the host refuses it. Whether the mailbox's
1952
+ * messages and child mailboxes go with it, and whether a missing mailbox is an error, is up to
1953
+ * the server. Needs the same `fetch` permission as the other IMAP calls.
1954
+ */
1955
+ async deleteMailboxAsync(imap, mailbox) {
1956
+ return this.client.request(MAIL_COMMANDS.deleteMailbox, { imap, mailbox });
1957
+ }
1958
+ /**
1959
+ * Rename a mailbox from `from` to `to`, both IMAP-encoded names (modified UTF-7). `to` may
1960
+ * contain the server's hierarchy delimiter to move the mailbox in the tree; `*` and `%` are not
1961
+ * allowed. `INBOX` can be neither deleted nor renamed; the host refuses it. Whether child
1962
+ * mailboxes follow and whether an existing `to` is an error is up to the server. Needs the same
1963
+ * `fetch` permission as the other IMAP calls.
1964
+ */
1965
+ async renameMailboxAsync(imap, from, to) {
1966
+ return this.client.request(MAIL_COMMANDS.renameMailbox, { imap, from, to });
1967
+ }
1930
1968
  /**
1931
1969
  * Delete messages for good: flags exactly these UIDs `\Deleted` and expunges exactly them, so
1932
1970
  * other messages marked `\Deleted` stay. Refused with an error on a server without UIDPLUS,
@@ -2085,6 +2123,43 @@ var TabAPI = class {
2085
2123
  }
2086
2124
  };
2087
2125
 
2126
+ // src/api/header.ts
2127
+ var NOT_SUPPORTED2 = 8e3;
2128
+ function isUnknownMethod(error) {
2129
+ if (error?.code === NOT_SUPPORTED2) return true;
2130
+ const text = typeof error === "string" ? error : error?.message;
2131
+ return typeof text === "string" && /^Unknown method\b/.test(text);
2132
+ }
2133
+ var HeaderAPI = class {
2134
+ constructor(client) {
2135
+ this.client = client;
2136
+ }
2137
+ /**
2138
+ * Replace the header with `description`. Resolves `true` when the host applied it, and `false`
2139
+ * when the host has no header (haex-vault 2.x); the extension keeps running either way. Every
2140
+ * other error rejects, such as `3001` for a description the host refuses (the previous header
2141
+ * stays).
2142
+ */
2143
+ async set(description) {
2144
+ try {
2145
+ await this.client.request(EXTENSION_COMMANDS.headerSet, { ...description });
2146
+ return true;
2147
+ } catch (error) {
2148
+ if (isUnknownMethod(error)) return false;
2149
+ throw error;
2150
+ }
2151
+ }
2152
+ /** Listen for the user using a control of this extension's header. Returns an unsubscribe function. */
2153
+ onEvent(handler) {
2154
+ const wrapped = (event) => {
2155
+ const data = event.data;
2156
+ if (data) handler(data);
2157
+ };
2158
+ this.client.on(HAEXTENSION_EVENTS.HEADER_EVENT, wrapped);
2159
+ return () => this.client.off(HAEXTENSION_EVENTS.HEADER_EVENT, wrapped);
2160
+ }
2161
+ };
2162
+
2088
2163
  // src/api/dialog.ts
2089
2164
  var DialogAPI = class {
2090
2165
  constructor(client) {
@@ -3114,6 +3189,7 @@ var HaexVaultSdk = class {
3114
3189
  this.mail = new MailAPI(this);
3115
3190
  this.notifications = new NotificationsAPI(this);
3116
3191
  this.tab = new TabAPI(this);
3192
+ this.header = new HeaderAPI(this);
3117
3193
  this.dialog = new DialogAPI(this);
3118
3194
  this.openers = new OpenersAPI(this);
3119
3195
  this.tools = new ToolsAPI({