@bobfrankston/rmfmail 1.1.71 → 1.1.73

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.
@@ -6901,10 +6901,12 @@ Accept: application/json\r
6901
6901
  * as a destination folder — `POST /messages/{id}/trash` is the native
6902
6902
  * path (equivalent to setting TRASH and removing INBOX in one op).
6903
6903
  * Used by mailx's delete/trash path. */
6904
- async trashMessage(folder, uid) {
6905
- const query = `in:${this.folderToLabel(folder)}`;
6906
- const ids = await this.listMessageIds(query, 1e3);
6907
- const id = ids.find((id2) => idToUid(id2) === uid);
6904
+ async trashMessage(folder, uid, gmailId) {
6905
+ let id = gmailId;
6906
+ if (!id) {
6907
+ const ids = await this.listMessageIds(`in:${this.folderToLabel(folder)}`, 1e3);
6908
+ id = ids.find((x) => idToUid(x) === uid);
6909
+ }
6908
6910
  if (!id)
6909
6911
  throw new Error(`Gmail trashMessage: UID ${uid} not found in ${folder}`);
6910
6912
  await this.fetch(`/messages/${id}/trash`, { method: "POST" });
@@ -6912,10 +6914,12 @@ Accept: application/json\r
6912
6914
  /** Move between "folders" == swap one label for another via modifyLabels.
6913
6915
  * System labels (INBOX/SENT/TRASH/SPAM) are translated from the folder
6914
6916
  * path; user labels use the folder path verbatim as the label id. */
6915
- async moveMessage(fromFolder, uid, toFolder) {
6916
- const query = `in:${this.folderToLabel(fromFolder)}`;
6917
- const ids = await this.listMessageIds(query, 1e3);
6918
- const id = ids.find((id2) => idToUid(id2) === uid);
6917
+ async moveMessage(fromFolder, uid, toFolder, gmailId) {
6918
+ let id = gmailId;
6919
+ if (!id) {
6920
+ const ids = await this.listMessageIds(`in:${this.folderToLabel(fromFolder)}`, 1e3);
6921
+ id = ids.find((x) => idToUid(x) === uid);
6922
+ }
6919
6923
  if (!id)
6920
6924
  throw new Error(`Gmail moveMessage: UID ${uid} not found in ${fromFolder}`);
6921
6925
  const toLabel = this.folderPathToLabelId(toFolder);