@remit/account-worker 0.0.35 → 0.0.36

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.35",
3
+ "version": "0.0.36",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -17,11 +17,10 @@ const messageWithChildren = {
17
17
  bodyPart: [{ bodyPartId: "bp-1" }],
18
18
  bodyPartParameter: [{ bodyPartParameterId: "bpp-1" }],
19
19
  rawMessageStorage: [{ rawStorageId: "rms-1" }],
20
- bodyPartStorage: [{ bodyPartStorageId: "bps-1" }],
21
20
  } as unknown as MessageDescription;
22
21
 
23
22
  describe("collectMessageChildEntities", () => {
24
- it("expands the eight child entities of one message", () => {
23
+ it("expands the seven child entities of one message", () => {
25
24
  const entities: CascadeEntity[] = [];
26
25
  collectMessageChildEntities(entities, messageWithChildren);
27
26
 
@@ -34,7 +33,6 @@ describe("collectMessageChildEntities", () => {
34
33
  "BodyPart",
35
34
  "BodyPartParameter",
36
35
  "RawMessageStorage",
37
- "BodyPartStorage",
38
36
  ]);
39
37
  });
40
38
 
@@ -48,7 +46,6 @@ describe("collectMessageChildEntities", () => {
48
46
  bodyPart: [],
49
47
  bodyPartParameter: [],
50
48
  rawMessageStorage: [],
51
- bodyPartStorage: [],
52
49
  } as unknown as MessageDescription);
53
50
  assert.equal(entities.length, 0);
54
51
  });
package/src/cascade.ts CHANGED
@@ -94,13 +94,6 @@ export interface CascadeResult {
94
94
  messageIds: string[];
95
95
  }
96
96
 
97
- /**
98
- * Expand one message's 9 child entities (flags, envelope, addresses, body
99
- * parts, references, raw/body storage) into the cascade plan. The Message row
100
- * itself is pushed by the caller — this only collects the children that a
101
- * `describe()` reveals. Shared by the tenant cascade enumerator and the
102
- * per-account purge worker.
103
- */
104
97
  export const collectMessageChildEntities = (
105
98
  entities: CascadeEntity[],
106
99
  messageData: MessageDescription,
@@ -147,12 +140,6 @@ export const collectMessageChildEntities = (
147
140
  key: { rawStorageId: rms.rawStorageId },
148
141
  });
149
142
  }
150
- for (const bps of messageData.bodyPartStorage) {
151
- entities.push({
152
- entityType: "BodyPartStorage",
153
- key: { bodyPartStorageId: bps.bodyPartStorageId },
154
- });
155
- }
156
143
  };
157
144
 
158
145
  export const enumerateCascadeEntities = async (
@@ -203,63 +190,10 @@ export const enumerateCascadeEntities = async (
203
190
  key: { messageId: message.messageId },
204
191
  });
205
192
 
206
- const messageData = await messageService.describe(message.messageId);
207
-
208
- for (const flag of messageData.messageFlag) {
209
- entities.push({
210
- entityType: "MessageFlag",
211
- key: { messageFlagId: flag.messageFlagId },
212
- });
213
- }
214
-
215
- for (const envelope of messageData.envelope) {
216
- entities.push({
217
- entityType: "Envelope",
218
- key: { envelopeId: envelope.envelopeId },
219
- });
220
- }
221
-
222
- for (const ref of messageData.messageReference) {
223
- entities.push({
224
- entityType: "MessageReference",
225
- key: { messageReferenceId: ref.messageReferenceId },
226
- });
227
- }
228
-
229
- for (const addr of messageData.envelopeAddress) {
230
- entities.push({
231
- entityType: "EnvelopeAddress",
232
- key: { envelopeAddressId: addr.envelopeAddressId },
233
- });
234
- }
235
-
236
- for (const bp of messageData.bodyPart) {
237
- entities.push({
238
- entityType: "BodyPart",
239
- key: { bodyPartId: bp.bodyPartId },
240
- });
241
- }
242
-
243
- for (const bpp of messageData.bodyPartParameter) {
244
- entities.push({
245
- entityType: "BodyPartParameter",
246
- key: { bodyPartParameterId: bpp.bodyPartParameterId },
247
- });
248
- }
249
-
250
- for (const rms of messageData.rawMessageStorage) {
251
- entities.push({
252
- entityType: "RawMessageStorage",
253
- key: { rawStorageId: rms.rawStorageId },
254
- });
255
- }
256
-
257
- for (const bps of messageData.bodyPartStorage) {
258
- entities.push({
259
- entityType: "BodyPartStorage",
260
- key: { bodyPartStorageId: bps.bodyPartStorageId },
261
- });
262
- }
193
+ collectMessageChildEntities(
194
+ entities,
195
+ await messageService.describe(message.messageId),
196
+ );
263
197
  }
264
198
  }
265
199
 
package/src/events.ts CHANGED
@@ -28,7 +28,7 @@ export type AccountDataPurgeSubtreeItem = {
28
28
  * S3-delete, CloudFront, and DDB batch-write grants.
29
29
  *
30
30
  * - `subtrees`: delete each `{ threadMessageId, messageId }` subtree (the
31
- * Message, its 9 child entities, and the manifest row). Idempotent.
31
+ * Message, its child entities, and the manifest row). Idempotent.
32
32
  * - `container`: the last message — delete the account-keyed container rows
33
33
  * (mailboxes, outbox, locks), the S3 prefix, and the CloudFront cache. The
34
34
  * tenant-shared Address is never deleted.
@@ -17,7 +17,6 @@ const messageDescription = {
17
17
  bodyPart: [],
18
18
  bodyPartParameter: [],
19
19
  rawMessageStorage: [],
20
- bodyPartStorage: [],
21
20
  };
22
21
 
23
22
  const fakeClient = (accountGone = false): RemitClient =>
@@ -37,7 +37,7 @@ export const processAccountDataPurgeFinalize = async (
37
37
  /**
38
38
  * Delete a batch of message subtrees. For each `{ threadMessageId, messageId }`
39
39
  * the manifest row is deleted UNCONDITIONALLY — there are ghost ThreadMessages
40
- * whose Message is already gone — and the Message + its 9 child entities are
40
+ * whose Message is already gone — and the Message + its child entities are
41
41
  * deleted only when `describe()` resolves. A `describe()` 404 means the subtree
42
42
  * is already gone: skip the children, still drop the manifest row.
43
43
  */