@taphealth/kafka 1.2.37 → 1.2.38

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/README.md CHANGED
@@ -1,68 +1,68 @@
1
- # Kafka Helper Library
2
-
3
- ## Overview
4
-
5
- This repository provides a Kafka helper library designed for seamless integration of Kafka messaging in tap-health-backend. It abstracts complexities of the KafkaJS library, offering simplified interfaces for both producing and consuming messages.
6
-
7
- ## Key Features
8
-
9
- - **KafkaClient**: Manages Kafka connections and administrative operations such as topic creation.
10
- - **KafkaProducer**: Facilitates easy production of messages to Kafka topics.
11
- - **KafkaConsumer**: Simplifies consumption of messages from Kafka topics.
12
-
13
- ## Usage
14
-
15
- ### Installation
16
-
17
- Install the library using pnpm:
18
-
19
- ```bash
20
- pnpm install @taphealth/kafka
21
- ```
22
-
23
- ### Connecting to Kafka
24
-
25
- Initialize a KafkaClient instance to connect to Kafka brokers:
26
-
27
- ```typescript
28
- import { KafkaClient } from "@taphealth/kafka";
29
-
30
- const kafkaClient = new KafkaClient();
31
- await kafkaClient.connect(["localhost:9092"]);
32
- ```
33
-
34
- ### Producing Messages
35
-
36
- Use KafkaProducer to send messages to Kafka topics:
37
-
38
- ```typescript
39
- import { KafkaProducer } from "@taphealth/kafka";
40
- import { Topics } from "@taphealth/kafka";
41
- import { YourEventInterface } from "./your-event-interface";
42
-
43
- const producer = new KafkaProducer() < YourEventInterface > kafkaClient.client;
44
- await producer.send({
45
- // Your message payload
46
- });
47
- ```
48
-
49
- ### Consuming Messages
50
-
51
- Extend KafkaConsumer to implement message handling logic:
52
-
53
- ```typescript
54
- import { KafkaConsumer } from "@taphealth/kafka";
55
- import { Topics } from "@taphealth/kafka";
56
- import { YourEventInterface } from "./your-event-interface";
57
-
58
- export class YourEventConsumer extends KafkaConsumer<YourEventInterface> {
59
- topic = Topics.YourTopic;
60
-
61
- async onMessage(data: YourEventInterface["data"], message: any) {
62
- // business logic
63
- }
64
- }
65
-
66
- const consumer = new YourEventConsumer(kafkaClient.client);
67
- await consumer.consume();
68
- ```
1
+ # Kafka Helper Library
2
+
3
+ ## Overview
4
+
5
+ This repository provides a Kafka helper library designed for seamless integration of Kafka messaging in tap-health-backend. It abstracts complexities of the KafkaJS library, offering simplified interfaces for both producing and consuming messages.
6
+
7
+ ## Key Features
8
+
9
+ - **KafkaClient**: Manages Kafka connections and administrative operations such as topic creation.
10
+ - **KafkaProducer**: Facilitates easy production of messages to Kafka topics.
11
+ - **KafkaConsumer**: Simplifies consumption of messages from Kafka topics.
12
+
13
+ ## Usage
14
+
15
+ ### Installation
16
+
17
+ Install the library using pnpm:
18
+
19
+ ```bash
20
+ pnpm install @taphealth/kafka
21
+ ```
22
+
23
+ ### Connecting to Kafka
24
+
25
+ Initialize a KafkaClient instance to connect to Kafka brokers:
26
+
27
+ ```typescript
28
+ import { KafkaClient } from "@taphealth/kafka";
29
+
30
+ const kafkaClient = new KafkaClient();
31
+ await kafkaClient.connect(["localhost:9092"]);
32
+ ```
33
+
34
+ ### Producing Messages
35
+
36
+ Use KafkaProducer to send messages to Kafka topics:
37
+
38
+ ```typescript
39
+ import { KafkaProducer } from "@taphealth/kafka";
40
+ import { Topics } from "@taphealth/kafka";
41
+ import { YourEventInterface } from "./your-event-interface";
42
+
43
+ const producer = new KafkaProducer() < YourEventInterface > kafkaClient.client;
44
+ await producer.send({
45
+ // Your message payload
46
+ });
47
+ ```
48
+
49
+ ### Consuming Messages
50
+
51
+ Extend KafkaConsumer to implement message handling logic:
52
+
53
+ ```typescript
54
+ import { KafkaConsumer } from "@taphealth/kafka";
55
+ import { Topics } from "@taphealth/kafka";
56
+ import { YourEventInterface } from "./your-event-interface";
57
+
58
+ export class YourEventConsumer extends KafkaConsumer<YourEventInterface> {
59
+ topic = Topics.YourTopic;
60
+
61
+ async onMessage(data: YourEventInterface["data"], message: any) {
62
+ // business logic
63
+ }
64
+ }
65
+
66
+ const consumer = new YourEventConsumer(kafkaClient.client);
67
+ await consumer.consume();
68
+ ```
@@ -26,8 +26,6 @@ interface ProfileUpdatedData {
26
26
  preferredLanguage?: string;
27
27
  createdAt?: Date;
28
28
  updatedAt?: Date;
29
- weight?: string;
30
- height?: string;
31
29
  settings?: settings;
32
30
  }
33
31
  export interface ProfileUpdatedEvent {
@@ -1,23 +1,14 @@
1
1
  export interface settings {
2
- sleepTime: string;
3
- hasBreakfast: boolean;
4
- breakfastMealSize: string;
5
- hasBeverageInBreakfast: boolean;
6
- hasLunch: boolean;
7
- hasVegetables: boolean;
8
- vegetableIntake: string;
9
- hasPulsesInLunch: boolean;
10
- lunchPulseIntake: string;
11
- hasMeatInLunch: boolean;
12
- lunchMeatIntake: string;
13
- hasRotiInLunch: boolean;
14
- lunchRotiIntake: string;
15
- medicalConditions: string[];
16
- recentSurgery: boolean;
17
- diet: DietPreferences;
18
- diabetes: DiabetesPreferences;
2
+ personalDetails: PersonalDetails;
3
+ breakfastDetails: BreakfastSettings;
4
+ lunchDetails: LunchSettings;
5
+ dinnerDetails: DinnerSettings;
6
+ diet: DietSettings;
7
+ lifestyleRoutine: LifeStyleRoutineSettings;
8
+ medicalDetails: MedicalSettings;
9
+ diabetes: DiabetesSettings;
19
10
  }
20
- export interface DiabetesPreferences {
11
+ export interface DiabetesSettings {
21
12
  programReason: string[];
22
13
  motivation: string[];
23
14
  goal: string[];
@@ -31,20 +22,13 @@ export interface DiabetesPreferences {
31
22
  hba1cLevel: string;
32
23
  history: string[];
33
24
  diabetesInFamily: boolean;
34
- dietPreference: string;
35
- cuisinePreferences: string[];
36
- pulses: string[];
37
- grains: string[];
38
- vegetables: string[];
39
- nonVegPreferences: string[];
40
- nonVegDays: string[];
41
25
  medications: string[];
42
26
  }
43
- export interface DietPreferences {
27
+ export interface DietSettings {
44
28
  dietReason: string;
45
29
  activityLevel: string;
46
30
  allergies: string[];
47
- dietPreference: string;
31
+ dietType: string;
48
32
  cuisinePreferences: string[];
49
33
  pulses: string[];
50
34
  grains: string[];
@@ -53,3 +37,53 @@ export interface DietPreferences {
53
37
  nonVegDays: string[];
54
38
  medications: string[];
55
39
  }
40
+ export interface LunchSettings {
41
+ hasLunch: boolean;
42
+ hasVegetablesInLunch: boolean;
43
+ hasPulsesInLunch: boolean;
44
+ hasMeatInLunch: boolean;
45
+ hasRotiInLunch: boolean;
46
+ hasRiceInLunch: boolean;
47
+ lunchVegetableIntake: string;
48
+ lunchPulseIntake: string;
49
+ lunchMeatIntake: string;
50
+ lunchRotiIntake: string;
51
+ lunchRiceIntake: string;
52
+ }
53
+ export interface BreakfastSettings {
54
+ hasBreakfast: boolean;
55
+ breakfastMealSize: string;
56
+ hasMealInBreakfast: boolean;
57
+ hasBeverageInBreakfast: boolean;
58
+ }
59
+ export interface DinnerSettings {
60
+ hasDinner: boolean;
61
+ hasVegetablesInDinner: boolean;
62
+ hasPulsesInDinner: boolean;
63
+ hasMeatInDinner: boolean;
64
+ hasRotiInDinner: boolean;
65
+ hasRiceInDinner: boolean;
66
+ dinnerVegetableIntake: string;
67
+ dinnerPulseIntake: string;
68
+ dinnerMeatIntake: string;
69
+ dinnerRotiIntake: string;
70
+ dinnerRiceIntake: string;
71
+ }
72
+ export interface MedicalSettings {
73
+ medicalConditions: string[];
74
+ recentSurgery: boolean;
75
+ }
76
+ export interface LifeStyleRoutineSettings {
77
+ currentFamilyStructure: string;
78
+ employmentStatus: string;
79
+ workType: string;
80
+ workTimings: string;
81
+ postWorkRoutine: string;
82
+ sleepStartTime: string;
83
+ sleepEndTime: string;
84
+ sleepQuality: string;
85
+ }
86
+ export interface PersonalDetails {
87
+ weight: string;
88
+ height: string;
89
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taphealth/kafka",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",