@remit/account-worker 0.0.25 → 0.0.27

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/src/poller.ts CHANGED
@@ -1,8 +1,12 @@
1
- import { createLogger, startMetricsServer } from "@remit/logger-lambda";
1
+ import { createLogger } from "@remit/logger";
2
+ import { startMetricsServer } from "@remit/logger-lambda/metrics";
3
+ import { installNodeLogger } from "@remit/logger-lambda/node";
2
4
  import { runQueuePoller } from "@remit/sqs-client/poller";
3
5
  import { env } from "expect-env";
4
6
  import { fanoutHandler, finalizeHandler } from "./index.js";
5
7
 
8
+ installNodeLogger();
9
+
6
10
  /**
7
11
  * Production queue poller, and the standalone entrypoint for the dedicated
8
12
  * image. The sibling workers carry a separate `e2e-processor-shim.ts` because
@@ -1,77 +0,0 @@
1
- import assert from "node:assert";
2
- import { existsSync, readdirSync } from "node:fs";
3
- import { resolve } from "node:path";
4
- import { describe, it } from "node:test";
5
- import { COVERED_ENTITY_TYPES } from "./cascade.js";
6
-
7
- // The snapshot enumerates electrodb-service's models; that package is stripped
8
- // from the open-core tree, so the check skips there and runs where it ships.
9
- const modelsDir = resolve(
10
- import.meta.dirname,
11
- "../../remit-electrodb-service/src/models",
12
- );
13
-
14
- describe("cascade entity coverage snapshot", () => {
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", ""));
23
-
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
- };
57
-
58
- const allEntityTypes = Object.values(entityTypesByFile).flat().sort();
59
- const coveredSorted = [...COVERED_ENTITY_TYPES].sort();
60
-
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
- );
68
-
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
- });
77
- });