@remit/queue-sidecar 0.0.5 → 0.0.7
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/main.ts +21 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/queue-sidecar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"start": "node --import tsx src/main.ts",
|
|
18
18
|
"test:typecheck": "tsgo --noEmit",
|
|
19
|
-
"test:run": "node --import tsx --experimental-test-coverage --test-coverage-include='src/**' --test-coverage-exclude='src/**/*.test.ts' --test-coverage-exclude='src/**/*.test.tsx' --test-coverage-lines=
|
|
19
|
+
"test:run": "node --import tsx --experimental-test-coverage --test-coverage-include='src/**' --test-coverage-exclude='src/**/*.test.ts' --test-coverage-exclude='src/**/*.test.tsx' --test-coverage-lines=93 --test 'src/**/*.test.ts'",
|
|
20
20
|
"test": "npm run test:typecheck && npm run test:run"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
package/src/main.ts
CHANGED
|
@@ -4,15 +4,30 @@ import { bootstrapQueues, loadQueuesConfig } from "./queues-config.js";
|
|
|
4
4
|
import { createSidecarServer, type SidecarLog } from "./server.js";
|
|
5
5
|
import { QueueStore } from "./store.js";
|
|
6
6
|
|
|
7
|
+
// The same field names @remit/logger-lambda writes — see deploy/vps/README.md
|
|
8
|
+
// ("Logs"), which is the contract an operator's log pipeline parses. Written by
|
|
9
|
+
// hand rather than through that package: the sidecar depends on nothing but its
|
|
10
|
+
// SQLite driver, and a logger is not the reason to change that.
|
|
11
|
+
const service = process.env.REMIT_SERVICE_NAME ?? "queue-sidecar";
|
|
12
|
+
|
|
13
|
+
const line = (
|
|
14
|
+
level: "info" | "error",
|
|
15
|
+
fields: Record<string, unknown>,
|
|
16
|
+
msg: string,
|
|
17
|
+
) =>
|
|
18
|
+
`${JSON.stringify({
|
|
19
|
+
level,
|
|
20
|
+
time: new Date().toISOString(),
|
|
21
|
+
service,
|
|
22
|
+
...fields,
|
|
23
|
+
msg,
|
|
24
|
+
})}\n`;
|
|
25
|
+
|
|
7
26
|
const log: SidecarLog = {
|
|
8
27
|
info: (fields, message) =>
|
|
9
|
-
process.stdout.write(
|
|
10
|
-
`${JSON.stringify({ level: "info", message, ...fields })}\n`,
|
|
11
|
-
),
|
|
28
|
+
process.stdout.write(line("info", fields, message)),
|
|
12
29
|
error: (fields, message) =>
|
|
13
|
-
process.stderr.write(
|
|
14
|
-
`${JSON.stringify({ level: "error", message, ...fields })}\n`,
|
|
15
|
-
),
|
|
30
|
+
process.stderr.write(line("error", fields, message)),
|
|
16
31
|
};
|
|
17
32
|
|
|
18
33
|
const port = Number(process.env.QUEUE_SIDECAR_PORT ?? "9324");
|