@remit/mailbox-service 0.0.121 → 0.0.122

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.
@@ -249,10 +249,6 @@ export declare class MessageMoveService {
249
249
  * batch's total wait is one row's ceiling rather than the sum across it.
250
250
  */
251
251
  private settledPlacements;
252
- /**
253
- * Update ThreadMessage for move operations.
254
- * Updates mailboxId and optionally isDeleted.
255
- */
256
252
  private updateThreadMessageForMove;
257
253
  /**
258
254
  * Delete every ThreadMessage row that points at this messageId.
@@ -261,7 +261,7 @@ export class MessageMoveService {
261
261
  continue;
262
262
  }
263
263
  // Update ThreadMessage
264
- await this.updateThreadMessageForMove(accountConfigId, messageId, trashMailbox.mailboxId, true);
264
+ await this.updateThreadMessageForMove(accountConfigId, messageId, trashMailbox.mailboxId);
265
265
  await this.addressService.reconcileJunkOnlyForMessage(messageId, configJunkRoles);
266
266
  events.push({
267
267
  event: {
@@ -380,10 +380,6 @@ export class MessageMoveService {
380
380
  }
381
381
  const sourceMailbox = await this.mailboxService.get(accountId, message.mailboxId);
382
382
  const destinationMailbox = await this.mailboxService.get(accountId, destinationMailboxId);
383
- // Check if moving to/from Trash
384
- const trashMailbox = await this.mailboxSpecialUseService.findTrashMailbox(accountId);
385
- const isMovingToTrash = Boolean(trashMailbox && destinationMailboxId === trashMailbox.mailboxId);
386
- const isMovingFromTrash = Boolean(trashMailbox && message.mailboxId === trashMailbox.mailboxId);
387
383
  // The optimistic write is a transition off the row this call read
388
384
  // (imap-mutations R3). Three mailbox lookups stand between the read and
389
385
  // here, and PLACEMENT_MOVE_PUSH runs on a queue this account's FIFO group
@@ -408,12 +404,8 @@ export class MessageMoveService {
408
404
  throw new MessagePlacementUnsettledError(`Message ${messageId} was not moved: something else changed where it is while this move was being prepared`, accountId, messageId, "in_flight");
409
405
  }
410
406
  // Update ThreadMessage
411
- await this.updateThreadMessageForMove(accountConfigId, messageId, destinationMailboxId, isMovingToTrash);
407
+ await this.updateThreadMessageForMove(accountConfigId, messageId, destinationMailboxId);
412
408
  await this.addressService.reconcileJunkOnlyForMessage(messageId, await this.mailboxSpecialUseService.resolveJunkRolesForConfig(accountConfigId));
413
- // If moving FROM Trash, clear isDeleted
414
- if (isMovingFromTrash) {
415
- await this.updateThreadMessageDeleted(accountConfigId, messageId, false);
416
- }
417
409
  this.log.info({
418
410
  messageId,
419
411
  from: sourceMailbox.fullPath,
@@ -716,11 +708,7 @@ export class MessageMoveService {
716
708
  * batch's total wait is one row's ceiling rather than the sum across it.
717
709
  */
718
710
  settledPlacements = async (messages, accountId) => Promise.all(messages.map((message) => this.settledPlacement(message, accountId)));
719
- /**
720
- * Update ThreadMessage for move operations.
721
- * Updates mailboxId and optionally isDeleted.
722
- */
723
- updateThreadMessageForMove = async (accountConfigId, messageId, newMailboxId, isDeleted) => {
711
+ updateThreadMessageForMove = async (accountConfigId, messageId, newMailboxId) => {
724
712
  const threadMessage = await this.threadMessageService.getByMessageId(accountConfigId, messageId);
725
713
  this.log.info({
726
714
  messageId,
@@ -728,9 +716,8 @@ export class MessageMoveService {
728
716
  threadMessageId: threadMessage.threadMessageId,
729
717
  sentDate: threadMessage.sentDate,
730
718
  newMailboxId,
731
- isDeleted,
732
719
  }, "Updating ThreadMessage for move");
733
- await this.threadMessageService.update(threadMessage.accountConfigId, threadMessage.threadMessageId, { mailboxId: newMailboxId, isDeleted }, {
720
+ await this.threadMessageService.update(threadMessage.accountConfigId, threadMessage.threadMessageId, { mailboxId: newMailboxId, isDeleted: false }, {
734
721
  // Composites contain CURRENT values for condition checking
735
722
  // ElectroDB uses these to verify the item state before updating
736
723
  composites: {
@@ -746,7 +733,6 @@ export class MessageMoveService {
746
733
  messageId,
747
734
  threadMessageId: threadMessage.threadMessageId,
748
735
  newMailboxId,
749
- isDeleted,
750
736
  }, "Updated ThreadMessage for move");
751
737
  };
752
738
  /**
@@ -1118,7 +1118,7 @@ export class MessageSyncService {
1118
1118
  // re-point names the placement it read, writes nothing when the row has
1119
1119
  // moved since, and the UID waits for the next round.
1120
1120
  const repointed = repointable &&
1121
- (await this.messageService.repointIfPlacement(messageId, { status: item.status, mailboxId: item.mailboxId, uid: item.uid }, { mailboxId, uid: msg.uid, isDeleted: sighting === "discarded" }));
1121
+ (await this.messageService.repointIfPlacement(messageId, { status: item.status, mailboxId: item.mailboxId, uid: item.uid }, { mailboxId, uid: msg.uid, isDeleted: false }));
1122
1122
  if (repointable && !repointed)
1123
1123
  unresolvedSighting = true;
1124
1124
  owned = created || item.mailboxId === mailboxId || repointed;
@@ -16,7 +16,6 @@ export declare const buildThreadMessageTrashUpdate: (threadMessage: ThreadMessag
16
16
  set: {
17
17
  uid: number;
18
18
  mailboxId: string;
19
- isDeleted: boolean;
20
19
  };
21
20
  composites: {
22
21
  sentDate: number;
@@ -10,7 +10,6 @@ export const buildThreadMessageTrashUpdate = (threadMessage, newUid, destination
10
10
  set: {
11
11
  uid: newUid,
12
12
  mailboxId: destinationMailboxId,
13
- isDeleted: true,
14
13
  },
15
14
  composites: currentComposites(threadMessage),
16
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/mailbox-service",
3
- "version": "0.0.121",
3
+ "version": "0.0.122",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",