@haex-space/vault-sdk 4.6.0 → 4.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.
@@ -352,6 +352,12 @@ var MAIL_COMMANDS = {
352
352
  fetchMessage: "extension_mail_fetch_message",
353
353
  /** Fetch a single attachment's bytes (base64) by part index */
354
354
  fetchAttachment: "extension_mail_fetch_attachment",
355
+ /** Search a mailbox on the server by criteria; answers UIDs, newest first */
356
+ search: "extension_mail_search",
357
+ /** CREATE a mailbox (reports whether it was already there) */
358
+ createMailbox: "extension_mail_create_mailbox",
359
+ /** Delete messages for good: `\Deleted` plus UID EXPUNGE of exactly those UIDs */
360
+ deleteMessages: "extension_mail_delete_messages",
355
361
  /** Set or unset IMAP flags on a UID set */
356
362
  setFlags: "extension_mail_set_flags",
357
363
  /** MOVE messages between mailboxes (COPY+EXPUNGE fallback) */
@@ -1662,6 +1668,45 @@ var MailAPI = class {
1662
1668
  partIndex
1663
1669
  });
1664
1670
  }
1671
+ /**
1672
+ * Search a whole mailbox on the server. Answers the UIDs of the newest `limit` hits (1 to 1000;
1673
+ * all that fit one answer when omitted), newest first, and the number of all hits. Fetch their
1674
+ * envelopes with `fetchEnvelopesAsync` and a `uidList` range.
1675
+ */
1676
+ async searchMessagesAsync(imap, mailbox, criteria, limit) {
1677
+ return this.client.request(MAIL_COMMANDS.search, {
1678
+ imap,
1679
+ mailbox,
1680
+ criteria,
1681
+ limit
1682
+ });
1683
+ }
1684
+ /**
1685
+ * Create a mailbox. Resolves to `false`, not an error, when it already existed. The name may
1686
+ * contain the server's hierarchy delimiter; `*` and `%` are not allowed.
1687
+ */
1688
+ async createMailboxAsync(imap, mailbox) {
1689
+ const { created } = await this.client.request(
1690
+ MAIL_COMMANDS.createMailbox,
1691
+ { imap, mailbox }
1692
+ );
1693
+ return created;
1694
+ }
1695
+ /**
1696
+ * Delete messages for good: flags exactly these UIDs `\Deleted` and expunges exactly them, so
1697
+ * other messages marked `\Deleted` stay. Refused with an error on a server without UIDPLUS,
1698
+ * before anything is marked. If the expunge fails after marking, the messages stay in the
1699
+ * mailbox flagged `\Deleted` and the call rejects; do not show them as deleted. At most 1000 UIDs
1700
+ * per call. For a message that can still be recovered, use `moveMessagesAsync` into the trash
1701
+ * instead.
1702
+ */
1703
+ async deleteMessagesAsync(imap, mailbox, uids) {
1704
+ return this.client.request(MAIL_COMMANDS.deleteMessages, {
1705
+ imap,
1706
+ mailbox,
1707
+ uids
1708
+ });
1709
+ }
1665
1710
  /**
1666
1711
  * Set or unset IMAP flags. Use `flags=["\\Seen"]` + `add=true` to
1667
1712
  * mark messages as read; `add=false` removes the flag(s).