@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
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ var __export = (target, all) => {
17
17
  __defProp(target, name, { get: all[name], enumerable: true });
18
18
  };
19
19
  var init_esm_shims = __esm({
20
- "node_modules/.pnpm/tsup@9.0.0_jiti@2.7.0_postcss@8.5.32_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
20
+ "node_modules/.pnpm/tsup@9.0.0_jiti@2.7.0_postcss@8.5.33_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
21
21
  }
22
22
  });
23
23
 
@@ -752,6 +752,9 @@ var HAEXTENSION_EVENTS = {
752
752
  FILE_CHANGED: "filesync:file-changed",
753
753
  /** Tables have been updated via sync (CRDT pull from server) */
754
754
  SYNC_TABLES_UPDATED: "haextension:sync:tables-updated",
755
+ /** The user used a control of this extension's header (holzi spec 090): `{ id, kind, value? }`.
756
+ * Subscribe through `client.header.onEvent`. */
757
+ HEADER_EVENT: "haextension:header:event",
755
758
  /** A runtime permission prompt was resolved (granted/denied) by the user.
756
759
  * The SDK uses this to auto-retry the original request; extensions may also
757
760
  * subscribe via `client.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, ...)`. */
@@ -1056,6 +1059,8 @@ var EXTENSION_COMMANDS = {
1056
1059
  emitSyncTables: "extension_emit_sync_tables",
1057
1060
  /** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
1058
1061
  tabAttention: "extension_tab_attention",
1062
+ /** Replace the header of this extension's own tab (holzi spec 090): `null` */
1063
+ headerSet: "extension_header_set",
1059
1064
  /** Ask the user to confirm, in a dialog the host draws over this extension's tab */
1060
1065
  dialogConfirm: "extension_dialog_confirm",
1061
1066
  /** Take the request the user gave this extension (holzi spec 063): `null` or `{ action, mail }` */
@@ -1264,6 +1269,10 @@ var MAIL_COMMANDS = {
1264
1269
  search: "extension_mail_search",
1265
1270
  /** CREATE a mailbox (reports whether it was already there) */
1266
1271
  createMailbox: "extension_mail_create_mailbox",
1272
+ /** DELETE a mailbox (never INBOX) */
1273
+ deleteMailbox: "extension_mail_delete_mailbox",
1274
+ /** RENAME a mailbox (never INBOX) */
1275
+ renameMailbox: "extension_mail_rename_mailbox",
1267
1276
  /** Delete messages for good: `\Deleted` plus UID EXPUNGE of exactly those UIDs */
1268
1277
  deleteMessages: "extension_mail_delete_messages",
1269
1278
  /** Set or unset IMAP flags on a UID set */
@@ -2819,6 +2828,25 @@ var MailAPI = class {
2819
2828
  );
2820
2829
  return created;
2821
2830
  }
2831
+ /**
2832
+ * Delete a mailbox. `mailbox` is the IMAP-encoded name (modified UTF-7), like in every other
2833
+ * call. `INBOX` can be neither deleted nor renamed; the host refuses it. Whether the mailbox's
2834
+ * messages and child mailboxes go with it, and whether a missing mailbox is an error, is up to
2835
+ * the server. Needs the same `fetch` permission as the other IMAP calls.
2836
+ */
2837
+ async deleteMailboxAsync(imap, mailbox) {
2838
+ return this.client.request(MAIL_COMMANDS.deleteMailbox, { imap, mailbox });
2839
+ }
2840
+ /**
2841
+ * Rename a mailbox from `from` to `to`, both IMAP-encoded names (modified UTF-7). `to` may
2842
+ * contain the server's hierarchy delimiter to move the mailbox in the tree; `*` and `%` are not
2843
+ * allowed. `INBOX` can be neither deleted nor renamed; the host refuses it. Whether child
2844
+ * mailboxes follow and whether an existing `to` is an error is up to the server. Needs the same
2845
+ * `fetch` permission as the other IMAP calls.
2846
+ */
2847
+ async renameMailboxAsync(imap, from, to) {
2848
+ return this.client.request(MAIL_COMMANDS.renameMailbox, { imap, from, to });
2849
+ }
2822
2850
  /**
2823
2851
  * Delete messages for good: flags exactly these UIDs `\Deleted` and expunges exactly them, so
2824
2852
  * other messages marked `\Deleted` stay. Refused with an error on a server without UIDPLUS,
@@ -2979,6 +3007,44 @@ var TabAPI = class {
2979
3007
  }
2980
3008
  };
2981
3009
 
3010
+ // src/api/header.ts
3011
+ init_esm_shims();
3012
+ var NOT_SUPPORTED2 = 8e3;
3013
+ function isUnknownMethod(error) {
3014
+ if (error?.code === NOT_SUPPORTED2) return true;
3015
+ const text = typeof error === "string" ? error : error?.message;
3016
+ return typeof text === "string" && /^Unknown method\b/.test(text);
3017
+ }
3018
+ var HeaderAPI = class {
3019
+ constructor(client) {
3020
+ this.client = client;
3021
+ }
3022
+ /**
3023
+ * Replace the header with `description`. Resolves `true` when the host applied it, and `false`
3024
+ * when the host has no header (haex-vault 2.x); the extension keeps running either way. Every
3025
+ * other error rejects, such as `3001` for a description the host refuses (the previous header
3026
+ * stays).
3027
+ */
3028
+ async set(description) {
3029
+ try {
3030
+ await this.client.request(EXTENSION_COMMANDS.headerSet, { ...description });
3031
+ return true;
3032
+ } catch (error) {
3033
+ if (isUnknownMethod(error)) return false;
3034
+ throw error;
3035
+ }
3036
+ }
3037
+ /** Listen for the user using a control of this extension's header. Returns an unsubscribe function. */
3038
+ onEvent(handler) {
3039
+ const wrapped = (event) => {
3040
+ const data = event.data;
3041
+ if (data) handler(data);
3042
+ };
3043
+ this.client.on(HAEXTENSION_EVENTS.HEADER_EVENT, wrapped);
3044
+ return () => this.client.off(HAEXTENSION_EVENTS.HEADER_EVENT, wrapped);
3045
+ }
3046
+ };
3047
+
2982
3048
  // src/api/dialog.ts
2983
3049
  init_esm_shims();
2984
3050
  var DialogAPI = class {
@@ -3929,6 +3995,7 @@ var HaexVaultSdk = class {
3929
3995
  this.mail = new MailAPI(this);
3930
3996
  this.notifications = new NotificationsAPI(this);
3931
3997
  this.tab = new TabAPI(this);
3998
+ this.header = new HeaderAPI(this);
3932
3999
  this.dialog = new DialogAPI(this);
3933
4000
  this.openers = new OpenersAPI(this);
3934
4001
  this.tools = new ToolsAPI({
@@ -4796,6 +4863,6 @@ function createHaexVaultSdk(config = {}) {
4796
4863
  return new HaexVaultSdk(config);
4797
4864
  }
4798
4865
 
4799
- export { CONTACT_COMMANDS, COSE_ALGORITHM, ContactsAPI, DEFAULT_TIMEOUT, DatabaseAPI, DialogAPI, ENCRYPTED_FOLDER_COMMANDS, EXTERNAL_EVENTS, EncryptedFoldersAPI, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, HostErrorCode, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MODEL_COMMANDS, MODEL_JOB_EVENTS, MailAPI, ModelsAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, OPENER_EVENTS, OpenersAPI, PASSWORD_COMMANDS, PEERS_EVENTS, PEER_COMMANDS, PEER_ERROR_KINDS, PasswordsAPI, PeerError, PeersAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, TabAPI, ToolsAPI, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
4866
+ export { CONTACT_COMMANDS, COSE_ALGORITHM, ContactsAPI, DEFAULT_TIMEOUT, DatabaseAPI, DialogAPI, ENCRYPTED_FOLDER_COMMANDS, EXTERNAL_EVENTS, EncryptedFoldersAPI, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, HeaderAPI, HostErrorCode, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MODEL_COMMANDS, MODEL_JOB_EVENTS, MailAPI, ModelsAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, OPENER_EVENTS, OpenersAPI, PASSWORD_COMMANDS, PEERS_EVENTS, PEER_COMMANDS, PEER_ERROR_KINDS, PasswordsAPI, PeerError, PeersAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, TabAPI, ToolsAPI, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
4800
4867
  //# sourceMappingURL=index.mjs.map
4801
4868
  //# sourceMappingURL=index.mjs.map