@taphealth/kafka 2.0.9 → 2.0.11
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const topics_1 = require("../topics");
|
|
4
|
+
const glucose_1 = require("../types/glucose");
|
|
5
|
+
const assert = (condition, message) => {
|
|
6
|
+
if (!condition) {
|
|
7
|
+
throw new Error(message);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const glucoseLoggedEvent = {
|
|
11
|
+
topic: topics_1.Topics.GlucoseLogged,
|
|
12
|
+
data: {
|
|
13
|
+
userId: "user-1",
|
|
14
|
+
logId: "glucose-log-1",
|
|
15
|
+
date: "2026-06-26",
|
|
16
|
+
loggedAt: "2026-06-26T10:00:00.000Z",
|
|
17
|
+
timezone: "Asia/Kolkata",
|
|
18
|
+
type: glucose_1.GlucoseType.FASTING,
|
|
19
|
+
glucoseReading: 180,
|
|
20
|
+
glucoseRange: glucose_1.GlucoseRange.HIGH,
|
|
21
|
+
isCritical: true,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const legacyGlucoseLoggedEvent = {
|
|
25
|
+
topic: topics_1.Topics.GlucoseLogged,
|
|
26
|
+
data: {
|
|
27
|
+
userId: "user-2",
|
|
28
|
+
date: "2026-06-26",
|
|
29
|
+
type: glucose_1.GlucoseType.RANDOM,
|
|
30
|
+
glucoseReading: 110,
|
|
31
|
+
glucoseRange: glucose_1.GlucoseRange.NORMAL,
|
|
32
|
+
isCritical: false,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const roundTrippedEvent = JSON.parse(JSON.stringify(glucoseLoggedEvent));
|
|
36
|
+
assert(glucoseLoggedEvent.topic === topics_1.Topics.GlucoseLogged, "Glucose-logged event topic must be glucose-logged");
|
|
37
|
+
assert(roundTrippedEvent.data.logId === "glucose-log-1", "Round-trip should preserve optional logId");
|
|
38
|
+
assert(roundTrippedEvent.data.loggedAt === "2026-06-26T10:00:00.000Z", "Round-trip should preserve loggedAt");
|
|
39
|
+
assert(!Object.prototype.hasOwnProperty.call(legacyGlucoseLoggedEvent.data, "logId"), "Legacy glucose-logged event remains valid without logId");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taphealth/kafka",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "pnpm clean && tsc",
|
|
28
28
|
"test:producer": "ts-node ./src/__tests__/producer-behavior.test.ts",
|
|
29
29
|
"test:consumer": "ts-node ./src/__tests__/consumer-behavior.test.ts",
|
|
30
|
-
"test:contracts": "ts-node ./src/__tests__/weekly-command-contract.test.ts && ts-node ./src/__tests__/daily-plan-created-contract.test.ts",
|
|
30
|
+
"test:contracts": "ts-node ./src/__tests__/weekly-command-contract.test.ts && ts-node ./src/__tests__/daily-plan-created-contract.test.ts && ts-node ./src/__tests__/glucose-logged-contract.test.ts",
|
|
31
31
|
"test": "pnpm test:contracts && pnpm test:producer && pnpm test:consumer",
|
|
32
32
|
"pub": "pnpm version patch --no-git-checks && pnpm build && pnpm publish --no-git-checks"
|
|
33
33
|
}
|