@taphealth/kafka 1.1.11 → 1.1.13

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/dist/kafka.js CHANGED
@@ -35,9 +35,14 @@ class KafkaClient {
35
35
  const admin = this.admin;
36
36
  await admin.connect();
37
37
  try {
38
+ const existingTopics = await admin.listTopics();
39
+ const topicsToCreate = topics.filter((topic) => !existingTopics.includes(topic));
40
+ if (topicsToCreate.length === 0) {
41
+ return;
42
+ }
38
43
  await admin.createTopics({
39
44
  topics: [
40
- ...topics.map((topic) => ({
45
+ ...topicsToCreate.map((topic) => ({
41
46
  topic,
42
47
  numPartitions: 2,
43
48
  replicationFactor: 2,
package/dist/topics.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  export declare enum Topics {
2
- AppointmentCreated = "appointment:created",
3
- AppointmentUpdated = "appointment:updated",
4
- OfflineAppointmentCreated = "offline-appointment:created",
5
- OfflineAppointmentUpdated = "offline-appointment:updated",
6
- OrderCreated = "order:created",
7
- OrderCancelled = "order:cancelled",
8
- OrderConfirmed = "order:confirmed",
9
- PaymentCaptured = "payment:captured",
10
- PaymentFailed = "payment:failed",
11
- ExpirationComplete = "expiration:complete"
2
+ AppointmentCreated = "appointment-created",
3
+ AppointmentUpdated = "appointment-updated",
4
+ OfflineAppointmentCreated = "offline-appointment-created",
5
+ OfflineAppointmentUpdated = "offline-appointment-updated",
6
+ PaymentCaptured = "payment-captured",
7
+ PaymentFailed = "payment-failed",
8
+ ExpirationComplete = "expiration-complete"
12
9
  }
package/dist/topics.js CHANGED
@@ -3,14 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Topics = void 0;
4
4
  var Topics;
5
5
  (function (Topics) {
6
- Topics["AppointmentCreated"] = "appointment:created";
7
- Topics["AppointmentUpdated"] = "appointment:updated";
8
- Topics["OfflineAppointmentCreated"] = "offline-appointment:created";
9
- Topics["OfflineAppointmentUpdated"] = "offline-appointment:updated";
10
- Topics["OrderCreated"] = "order:created";
11
- Topics["OrderCancelled"] = "order:cancelled";
12
- Topics["OrderConfirmed"] = "order:confirmed";
13
- Topics["PaymentCaptured"] = "payment:captured";
14
- Topics["PaymentFailed"] = "payment:failed";
15
- Topics["ExpirationComplete"] = "expiration:complete";
6
+ Topics["AppointmentCreated"] = "appointment-created";
7
+ Topics["AppointmentUpdated"] = "appointment-updated";
8
+ Topics["OfflineAppointmentCreated"] = "offline-appointment-created";
9
+ Topics["OfflineAppointmentUpdated"] = "offline-appointment-updated";
10
+ Topics["PaymentCaptured"] = "payment-captured";
11
+ Topics["PaymentFailed"] = "payment-failed";
12
+ Topics["ExpirationComplete"] = "expiration-complete";
16
13
  })(Topics || (exports.Topics = Topics = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taphealth/kafka",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",