@haex-space/vault-sdk 3.5.1 → 3.7.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/index.mjs CHANGED
@@ -733,6 +733,10 @@ var SHELL_EVENTS = {
733
733
  /** Shell session has exited */
734
734
  EXIT: "shell:exit"
735
735
  };
736
+ var MAIL_EVENTS = {
737
+ /** A watched mailbox's UID high-water mark advanced — new mail arrived. */
738
+ NEW_MESSAGES: "mail:new-messages"
739
+ };
736
740
 
737
741
  // src/types.ts
738
742
  var DEFAULT_TIMEOUT = 3e4;
@@ -1033,6 +1037,8 @@ var SPACE_COMMANDS = {
1033
1037
  unassign: "extension_space_unassign",
1034
1038
  /** Get space assignments for a table */
1035
1039
  getAssignments: "extension_space_get_assignments",
1040
+ /** Get members of a shared space */
1041
+ getMembers: "extension_space_get_members",
1036
1042
  /** List all spaces the user is a member of (with decrypted names) */
1037
1043
  list: "extension_space_list",
1038
1044
  /** Create a new shared space */
@@ -1088,7 +1094,11 @@ var MAIL_COMMANDS = {
1088
1094
  /** SMTP send. Returns the assigned Message-ID. */
1089
1095
  sendMessage: "extension_mail_send_message",
1090
1096
  /** Build RFC822 bytes without sending (for Drafts via APPEND) */
1091
- buildRfc822: "extension_mail_build_rfc822"
1097
+ buildRfc822: "extension_mail_build_rfc822",
1098
+ /** Start (or replace) a background poll watch for an account/mailbox */
1099
+ startWatch: "extension_mail_start_watch",
1100
+ /** Stop a background poll watch */
1101
+ stopWatch: "extension_mail_stop_watch"
1092
1102
  };
1093
1103
 
1094
1104
  // src/commands/notifications.ts
@@ -1993,6 +2003,13 @@ var SpacesAPI = class {
1993
2003
  async listSpacesAsync() {
1994
2004
  return this.client.request(SPACE_COMMANDS.list);
1995
2005
  }
2006
+ /**
2007
+ * List members of a shared space (DID + label), flagging the current user.
2008
+ * Used to resolve assignment authors to names and to detect own vs shared-in content.
2009
+ */
2010
+ async getMembersAsync(spaceId) {
2011
+ return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
2012
+ }
1996
2013
  };
1997
2014
 
1998
2015
  // src/api/shell.ts
@@ -2213,6 +2230,41 @@ var MailAPI = class {
2213
2230
  message
2214
2231
  });
2215
2232
  }
2233
+ /**
2234
+ * Start (or replace) a background poll watch for `accountId`/`mailboxName`.
2235
+ * The host resolves credentials itself from `accountId` — no `ImapConfig`
2236
+ * is passed in. Requires `mail` permission with action `poll` on the
2237
+ * account's IMAP host (prompted on first call, same as `fetch`/`send`).
2238
+ *
2239
+ * `intervalSeconds` is clamped host-side to [30, 3600]. Listen for
2240
+ * results via `onNewMessages`.
2241
+ */
2242
+ async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
2243
+ return this.client.request(MAIL_COMMANDS.startWatch, {
2244
+ accountId,
2245
+ mailboxName,
2246
+ intervalSeconds
2247
+ });
2248
+ }
2249
+ /** Stop a background poll watch previously started with `startWatchingAsync`. */
2250
+ async stopWatchingAsync(accountId, mailboxName) {
2251
+ return this.client.request(MAIL_COMMANDS.stopWatch, {
2252
+ accountId,
2253
+ mailboxName
2254
+ });
2255
+ }
2256
+ /**
2257
+ * Register a callback for new-mail notifications from any active watch.
2258
+ * `event.data` is a `MailNewMessagesEvent` — check `accountId`/`mailboxName`
2259
+ * before refreshing if watching more than one account.
2260
+ */
2261
+ onNewMessages(callback) {
2262
+ this.client.on(MAIL_EVENTS.NEW_MESSAGES, callback);
2263
+ }
2264
+ /** Remove a new-mail callback registered with `onNewMessages`. */
2265
+ offNewMessages(callback) {
2266
+ this.client.off(MAIL_EVENTS.NEW_MESSAGES, callback);
2267
+ }
2216
2268
  };
2217
2269
 
2218
2270
  // src/api/notifications.ts
@@ -2415,6 +2467,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
2415
2467
  EXTERNAL_EVENTS.REQUEST,
2416
2468
  EXTERNAL_EVENTS.ACTION_REQUEST,
2417
2469
  NOTIFICATION_EVENTS.CLICK,
2470
+ MAIL_EVENTS.NEW_MESSAGES,
2418
2471
  ...Object.values(LOCALSEND_EVENTS)
2419
2472
  ]) {
2420
2473
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);
@@ -3829,6 +3882,6 @@ function createHaexVaultSdk(config = {}) {
3829
3882
  return new HaexVaultSdk(config);
3830
3883
  }
3831
3884
 
3832
- export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, 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, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3885
+ export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, KnownPath, LOCALSEND_EVENTS, LocalSendAPI, MAIL_COMMANDS, MAIL_EVENTS, MailAPI, NOTIFICATION_COMMANDS, NOTIFICATION_EVENTS, NotificationsAPI, PASSWORD_COMMANDS, PasswordsAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, 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, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3833
3886
  //# sourceMappingURL=index.mjs.map
3834
3887
  //# sourceMappingURL=index.mjs.map