@remit/account-worker 0.0.29 → 0.0.30

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/account-worker",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
package/src/config.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { getClient } from "@remit/backend/client";
2
2
  import type { GroupedQueueProducer, QueueProducer } from "@remit/data-ports";
3
- import { createQueueProducer } from "@remit/sqs-client/producer";
3
+ import {
4
+ createGroupedQueueProducer,
5
+ createStandardQueueProducer,
6
+ } from "@remit/sqs-client/producer";
4
7
  import type { StorageService } from "@remit/storage-service";
5
8
  import { createStorageService } from "@remit/storage-service/s3";
6
9
  import { env } from "expect-env";
@@ -26,10 +29,10 @@ export interface FanoutQueues {
26
29
  }
27
30
 
28
31
  export const sqsFanoutQueues = (): FanoutQueues => ({
29
- accountFinalize: createQueueProducer({
32
+ accountFinalize: createStandardQueueProducer({
30
33
  queueUrl: getAccountFinalizeQueueUrl(),
31
34
  }),
32
- accountPurgeDelete: createQueueProducer({
35
+ accountPurgeDelete: createGroupedQueueProducer({
33
36
  queueUrl: getAccountPurgeDeleteQueueUrl(),
34
37
  }),
35
38
  });
@@ -6,34 +6,9 @@ import type { CascadeServices } from "../cascade.js";
6
6
  import type { AccountDeleteEvent } from "../events.js";
7
7
  import { processAccountFanout } from "./account-fanout.js";
8
8
 
9
- // A CascadeServices fake with one account and no data: enough for
10
- // enumerateCascadeEntities to yield a single Account row (so the stop-signal
11
- // loop has one accountId to iterate) without standing up a database.
12
9
  const buildServices = (): CascadeServices =>
13
10
  ({
14
- accountConfigService: {
15
- get: async () => ({ userId: "user-1" }),
16
- describe: async () => ({
17
- account: [{ accountId: "acc-1" }],
18
- address: [],
19
- }),
20
- },
21
- accountService: {
22
- describe: async () => ({ mailbox: [] }),
23
- },
24
- messageService: {
25
- listAllByMailbox: async () => [],
26
- describe: async () => ({}),
27
- },
28
- outboxMessageService: { listByAccount: async () => ({ items: [] }) },
29
- mailboxLockService: { listByAccount: async () => [] },
30
- messagePlacementMoveService: { listByAccountId: async () => [] },
31
- messageFlagPushService: { listByAccountId: async () => [] },
32
- threadMessageService: { listAllByAccount: async () => [] },
33
- accountSettingService: { listByAccountConfig: async () => [] },
34
- filterService: { listByAccountConfig: async () => [] },
35
- labelService: { listByAccountConfig: async () => [] },
36
- messageLabelService: { listByLabelId: async () => [] },
11
+ accountConfigService: { get: async () => ({ userId: "user-1" }) },
37
12
  }) as unknown as CascadeServices;
38
13
 
39
14
  const deleteEvent: AccountDeleteEvent = {
@@ -48,7 +23,7 @@ describe("processAccountFanout on account delete", () => {
48
23
  await processAccountFanout(deleteEvent, noopLogger, {
49
24
  queues: {
50
25
  accountFinalize,
51
- accountPurgeDelete: recordingQueue(),
26
+ accountPurgeDelete: recordingQueue().grouped,
52
27
  },
53
28
  services: buildServices(),
54
29
  signOut: async () => {},
@@ -33,11 +33,6 @@ export interface ProcessAccountFanoutDeps {
33
33
  signOut?: DeletionCapabilities["signOut"];
34
34
  }
35
35
 
36
- /**
37
- * Fanout step of the account-deletion cascade. Signs the user out and
38
- * enqueues the finalize step. Throws on any non-swallowable error so SQS partial batch-failure
39
- * retries the whole record.
40
- */
41
36
  export const processAccountFanout = async (
42
37
  event: AccountFanoutEvent,
43
38
  log: Logger,
@@ -42,7 +42,7 @@ const baseDeps = (queue: RecordingQueue): ProcessPurgeFanoutDeps => ({
42
42
  { threadMessageId: "tm-1", messageId: "msg-1", mailboxId: "mbx-1" },
43
43
  { threadMessageId: "tm-2", messageId: "msg-2", mailboxId: "mbx-1" },
44
44
  ]),
45
- queue,
45
+ queue: queue.grouped,
46
46
  });
47
47
 
48
48
  describe("processAccountDataPurge", () => {