@taphealth/kafka 1.1.5 → 1.1.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.
@@ -1,7 +1,7 @@
1
1
  import { Topics } from "../topics";
2
2
  import { AppointmentType } from "../types/appointment";
3
3
  export interface AppointmentCreatedEvent {
4
- subject: Topics.AppointmentCreated;
4
+ topic: Topics.AppointmentCreated;
5
5
  data: {
6
6
  id: string;
7
7
  type: AppointmentType;
@@ -1,7 +1,7 @@
1
1
  import { Topics } from "../topics";
2
2
  import { AppointmentType } from "../types/appointment";
3
3
  export interface ExpirationCompleteEvent {
4
- subject: Topics.ExpirationComplete;
4
+ topic: Topics.ExpirationComplete;
5
5
  data: {
6
6
  appointmentId: string;
7
7
  type: AppointmentType;
@@ -1,7 +1,7 @@
1
1
  import { Topics } from "../topics";
2
2
  import { AppointmentType } from "../types/appointment";
3
3
  export interface PaymentCapturedEvent {
4
- subject: Topics.PaymentCaptured;
4
+ topic: Topics.PaymentCaptured;
5
5
  data: {
6
6
  type: AppointmentType;
7
7
  razorpayPaymentId: string;
@@ -1,7 +1,7 @@
1
1
  import { Topics } from "../topics";
2
2
  import { AppointmentType } from "../types/appointment";
3
3
  export interface PaymentFailedEvent {
4
- subject: Topics.PaymentFailed;
4
+ topic: Topics.PaymentFailed;
5
5
  data: {
6
6
  type: AppointmentType;
7
7
  razorpayPaymentId: string;
package/dist/kafka.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { Admin } from "kafkajs";
1
+ import { Admin, Kafka } from "kafkajs";
2
2
  export declare class KafkaClient {
3
3
  private _client?;
4
4
  private _admin?;
5
5
  get admin(): Admin;
6
+ get client(): Kafka;
6
7
  connect(brokers: string[]): Promise<void>;
7
8
  createTopics(topics: string[]): Promise<void>;
8
9
  disconnect(): Promise<void>;
package/dist/kafka.js CHANGED
@@ -10,6 +10,12 @@ class KafkaClient {
10
10
  }
11
11
  return this._admin;
12
12
  }
13
+ get client() {
14
+ if (!this._client) {
15
+ throw new Error("Cannot access client before connecting");
16
+ }
17
+ return this._client;
18
+ }
13
19
  async connect(brokers) {
14
20
  try {
15
21
  this._client = new kafkajs_1.Kafka({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taphealth/kafka",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",