@remit/account-worker 0.0.4 → 0.0.6
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 +2 -2
- package/src/cascade.test.ts +58 -61
- package/src/handlers/account-finalize.ts +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/account-worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
70
70
|
"type": "git",
|
|
71
|
-
"url": "git+https://github.com/remit-mail/
|
|
71
|
+
"url": "git+https://github.com/remit-mail/reader.git",
|
|
72
72
|
"directory": "packages/account-worker"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/cascade.test.ts
CHANGED
|
@@ -12,69 +12,66 @@ const modelsDir = resolve(
|
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
describe("cascade entity coverage snapshot", () => {
|
|
15
|
-
it(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
()
|
|
19
|
-
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
.map((f) => f.replace(".ts", ""));
|
|
15
|
+
it("covers every entity model in remit-electrodb-service", {
|
|
16
|
+
skip: !existsSync(modelsDir),
|
|
17
|
+
}, () => {
|
|
18
|
+
const modelFiles = readdirSync(modelsDir)
|
|
19
|
+
.filter(
|
|
20
|
+
(f) => f.endsWith(".ts") && !f.endsWith(".test.ts") && f !== "index.ts",
|
|
21
|
+
)
|
|
22
|
+
.map((f) => f.replace(".ts", ""));
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
24
|
+
// Map model file names to the entity types they contain
|
|
25
|
+
const entityTypesByFile: Record<string, string[]> = {
|
|
26
|
+
"account-config": ["AccountConfig"],
|
|
27
|
+
"account-export-request": [],
|
|
28
|
+
"account-setting": ["AccountSetting"],
|
|
29
|
+
"account-setting-registry": [],
|
|
30
|
+
account: ["Account"],
|
|
31
|
+
address: ["Address", "EnvelopeAddress"],
|
|
32
|
+
envelope: [
|
|
33
|
+
"Envelope",
|
|
34
|
+
"MessageReference",
|
|
35
|
+
"BodyPart",
|
|
36
|
+
"BodyPartParameter",
|
|
37
|
+
"RawMessageStorage",
|
|
38
|
+
"BodyPartStorage",
|
|
39
|
+
"BodyPartContent",
|
|
40
|
+
],
|
|
41
|
+
filter: ["Filter"],
|
|
42
|
+
"filter-anchor": ["FilterAnchor"],
|
|
43
|
+
label: ["Label"],
|
|
44
|
+
mailbox: ["Mailbox"],
|
|
45
|
+
"mailbox-lock": ["MailboxLock"],
|
|
46
|
+
"mailbox-special-use": [],
|
|
47
|
+
message: ["Message"],
|
|
48
|
+
"message-flag": ["MessageFlag"],
|
|
49
|
+
"message-flag-push": ["MessageFlagPush"],
|
|
50
|
+
"message-label": ["MessageLabel"],
|
|
51
|
+
"message-placement-move": ["MessagePlacementMove"],
|
|
52
|
+
"organize-job-request": [],
|
|
53
|
+
"outbox-message": ["OutboxMessage"],
|
|
54
|
+
"thread-message": ["ThreadMessage"],
|
|
55
|
+
"wellknown-rule": [],
|
|
56
|
+
};
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const allEntityTypes = Object.values(entityTypesByFile).flat().sort();
|
|
59
|
+
const coveredSorted = [...COVERED_ENTITY_TYPES].sort();
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
assert.deepStrictEqual(
|
|
62
|
+
coveredSorted,
|
|
63
|
+
allEntityTypes,
|
|
64
|
+
`Cascade does not cover all entity types.\n` +
|
|
65
|
+
`Missing: ${allEntityTypes.filter((t) => !(coveredSorted as readonly string[]).includes(t)).join(", ")}\n` +
|
|
66
|
+
`Extra: ${(coveredSorted as readonly string[]).filter((t) => !allEntityTypes.includes(t)).join(", ")}`,
|
|
67
|
+
);
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
69
|
+
// Verify all model files are accounted for
|
|
70
|
+
const unmappedFiles = modelFiles.filter((f) => !(f in entityTypesByFile));
|
|
71
|
+
assert.deepStrictEqual(
|
|
72
|
+
unmappedFiles,
|
|
73
|
+
[],
|
|
74
|
+
`Model files not mapped to entity types: ${unmappedFiles.join(", ")}`,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
80
77
|
});
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { inspect } from "node:util";
|
|
2
|
-
import {
|
|
3
|
-
createLogger,
|
|
4
|
-
type Logger,
|
|
5
|
-
withTelemetry,
|
|
6
|
-
} from "@remit/logger-lambda";
|
|
2
|
+
import { createLogger, type Logger, withTelemetry } from "@remit/logger-lambda";
|
|
7
3
|
import type { SQSEvent, SQSHandler } from "aws-lambda";
|
|
8
4
|
import {
|
|
9
5
|
type CascadeEntity,
|