@remit/mailbox-service 0.0.65 → 0.0.66

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/mailbox-service",
3
- "version": "0.0.65",
3
+ "version": "0.0.66",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -11,10 +11,14 @@ import type {
11
11
  IMessageRepository,
12
12
  IThreadMessageRepository,
13
13
  } from "@remit/data-ports";
14
- import { HTTPError } from "@remit/data-ports/errors";
14
+ import { FolderRoleUnresolvedError } from "@remit/data-ports/errors";
15
15
  import { NO_TRASH_FOLDER_REASON } from "@remit/data-ports/folder-role";
16
16
  import { deriveCopyMessageId } from "@remit/data-ports/id";
17
- import { MessageStatus, MessageSyncStatus } from "@remit/domain-enums";
17
+ import {
18
+ CanonicalMailboxRole,
19
+ MessageStatus,
20
+ MessageSyncStatus,
21
+ } from "@remit/domain-enums";
18
22
  import { createQueueProducer } from "@remit/sqs-client/producer";
19
23
 
20
24
  /**
@@ -112,12 +116,16 @@ export interface MessageMoveConfig {
112
116
  * verbatim: the absence of a Trash folder is a blocker the user resolves by
113
117
  * appointing one, never a licence to expunge.
114
118
  */
115
- export class NoTrashMailboxError extends HTTPError {
119
+ export class NoTrashMailboxError extends FolderRoleUnresolvedError {
116
120
  name = "NoTrashMailboxError";
117
- statusCode = 409;
118
121
 
119
- constructor() {
120
- super(NO_TRASH_FOLDER_REASON);
122
+ constructor(accountId: string) {
123
+ super(
124
+ NO_TRASH_FOLDER_REASON,
125
+ CanonicalMailboxRole.Trash,
126
+ "none",
127
+ accountId,
128
+ );
121
129
  }
122
130
  }
123
131
 
@@ -227,7 +235,7 @@ export class MessageMoveService {
227
235
  { accountId, messageCount: messages.length },
228
236
  "Refused to delete: account resolves no Trash mailbox",
229
237
  );
230
- throw new NoTrashMailboxError();
238
+ throw new NoTrashMailboxError(accountId);
231
239
  }
232
240
 
233
241
  // Group messages by operation type
@@ -667,7 +675,7 @@ export class MessageMoveService {
667
675
  await this.mailboxSpecialUseService.findConfirmedTrashMailbox(accountId);
668
676
 
669
677
  if (!trashMailbox) {
670
- throw new NoTrashMailboxError();
678
+ throw new NoTrashMailboxError(accountId);
671
679
  }
672
680
 
673
681
  // Get all messages in Trash