kafka-ts 0.0.1-beta → 0.0.2-beta

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.
Files changed (138) hide show
  1. package/.github/workflows/release.yml +17 -0
  2. package/LICENSE +1 -1
  3. package/README.md +12 -9
  4. package/examples/package-lock.json +4 -3
  5. package/examples/package.json +1 -1
  6. package/examples/src/client.ts +1 -1
  7. package/examples/src/create-topic.ts +1 -1
  8. package/package.json +5 -1
  9. package/src/__snapshots__/request-handler.test.ts.snap +9 -718
  10. package/src/{request-handler.test.ts → cluster.test.ts} +16 -13
  11. package/src/utils/debug.ts +1 -1
  12. package/src/utils/tracer.ts +1 -1
  13. package/dist/api/api-versions.d.ts +0 -9
  14. package/dist/api/api-versions.js +0 -24
  15. package/dist/api/create-topics.d.ts +0 -38
  16. package/dist/api/create-topics.js +0 -53
  17. package/dist/api/delete-topics.d.ts +0 -18
  18. package/dist/api/delete-topics.js +0 -33
  19. package/dist/api/fetch.d.ts +0 -77
  20. package/dist/api/fetch.js +0 -106
  21. package/dist/api/find-coordinator.d.ts +0 -21
  22. package/dist/api/find-coordinator.js +0 -39
  23. package/dist/api/heartbeat.d.ts +0 -11
  24. package/dist/api/heartbeat.js +0 -27
  25. package/dist/api/index.d.ts +0 -573
  26. package/dist/api/index.js +0 -164
  27. package/dist/api/init-producer-id.d.ts +0 -13
  28. package/dist/api/init-producer-id.js +0 -29
  29. package/dist/api/join-group.d.ts +0 -34
  30. package/dist/api/join-group.js +0 -51
  31. package/dist/api/leave-group.d.ts +0 -19
  32. package/dist/api/leave-group.js +0 -39
  33. package/dist/api/list-offsets.d.ts +0 -29
  34. package/dist/api/list-offsets.js +0 -48
  35. package/dist/api/metadata.d.ts +0 -40
  36. package/dist/api/metadata.js +0 -58
  37. package/dist/api/offset-commit.d.ts +0 -28
  38. package/dist/api/offset-commit.js +0 -48
  39. package/dist/api/offset-fetch.d.ts +0 -33
  40. package/dist/api/offset-fetch.js +0 -57
  41. package/dist/api/produce.d.ts +0 -53
  42. package/dist/api/produce.js +0 -129
  43. package/dist/api/sasl-authenticate.d.ts +0 -11
  44. package/dist/api/sasl-authenticate.js +0 -23
  45. package/dist/api/sasl-handshake.d.ts +0 -6
  46. package/dist/api/sasl-handshake.js +0 -19
  47. package/dist/api/sync-group.d.ts +0 -24
  48. package/dist/api/sync-group.js +0 -36
  49. package/dist/broker.d.ts +0 -29
  50. package/dist/broker.js +0 -60
  51. package/dist/client.d.ts +0 -23
  52. package/dist/client.js +0 -36
  53. package/dist/cluster.d.ts +0 -24
  54. package/dist/cluster.js +0 -72
  55. package/dist/connection.d.ts +0 -25
  56. package/dist/connection.js +0 -155
  57. package/dist/consumer/consumer-group.d.ts +0 -36
  58. package/dist/consumer/consumer-group.js +0 -182
  59. package/dist/consumer/consumer-metadata.d.ts +0 -7
  60. package/dist/consumer/consumer-metadata.js +0 -14
  61. package/dist/consumer/consumer.d.ts +0 -37
  62. package/dist/consumer/consumer.js +0 -178
  63. package/dist/consumer/metadata.d.ts +0 -24
  64. package/dist/consumer/metadata.js +0 -64
  65. package/dist/consumer/offset-manager.d.ts +0 -22
  66. package/dist/consumer/offset-manager.js +0 -56
  67. package/dist/distributors/assignments-to-replicas.d.ts +0 -17
  68. package/dist/distributors/assignments-to-replicas.js +0 -60
  69. package/dist/distributors/assignments-to-replicas.test.d.ts +0 -1
  70. package/dist/distributors/assignments-to-replicas.test.js +0 -40
  71. package/dist/distributors/messages-to-topic-partition-leaders.d.ts +0 -17
  72. package/dist/distributors/messages-to-topic-partition-leaders.js +0 -15
  73. package/dist/distributors/messages-to-topic-partition-leaders.test.d.ts +0 -1
  74. package/dist/distributors/messages-to-topic-partition-leaders.test.js +0 -30
  75. package/dist/examples/src/replicator.js +0 -34
  76. package/dist/examples/src/utils/json.js +0 -5
  77. package/dist/index.d.ts +0 -3
  78. package/dist/index.js +0 -19
  79. package/dist/metadata.d.ts +0 -24
  80. package/dist/metadata.js +0 -89
  81. package/dist/producer/producer.d.ts +0 -19
  82. package/dist/producer/producer.js +0 -111
  83. package/dist/request-handler.d.ts +0 -16
  84. package/dist/request-handler.js +0 -67
  85. package/dist/request-handler.test.d.ts +0 -1
  86. package/dist/request-handler.test.js +0 -340
  87. package/dist/src/api/api-versions.js +0 -18
  88. package/dist/src/api/create-topics.js +0 -46
  89. package/dist/src/api/delete-topics.js +0 -26
  90. package/dist/src/api/fetch.js +0 -95
  91. package/dist/src/api/find-coordinator.js +0 -34
  92. package/dist/src/api/heartbeat.js +0 -22
  93. package/dist/src/api/index.js +0 -38
  94. package/dist/src/api/init-producer-id.js +0 -24
  95. package/dist/src/api/join-group.js +0 -48
  96. package/dist/src/api/leave-group.js +0 -30
  97. package/dist/src/api/list-offsets.js +0 -39
  98. package/dist/src/api/metadata.js +0 -47
  99. package/dist/src/api/offset-commit.js +0 -39
  100. package/dist/src/api/offset-fetch.js +0 -44
  101. package/dist/src/api/produce.js +0 -119
  102. package/dist/src/api/sync-group.js +0 -31
  103. package/dist/src/broker.js +0 -35
  104. package/dist/src/connection.js +0 -21
  105. package/dist/src/consumer/consumer-group.js +0 -131
  106. package/dist/src/consumer/consumer.js +0 -103
  107. package/dist/src/consumer/metadata.js +0 -52
  108. package/dist/src/consumer/offset-manager.js +0 -23
  109. package/dist/src/index.js +0 -19
  110. package/dist/src/producer/producer.js +0 -84
  111. package/dist/src/request-handler.js +0 -57
  112. package/dist/src/request-handler.test.js +0 -321
  113. package/dist/src/types.js +0 -2
  114. package/dist/src/utils/api.js +0 -5
  115. package/dist/src/utils/decoder.js +0 -161
  116. package/dist/src/utils/encoder.js +0 -137
  117. package/dist/src/utils/error.js +0 -10
  118. package/dist/types.d.ts +0 -9
  119. package/dist/types.js +0 -2
  120. package/dist/utils/api.d.ts +0 -9
  121. package/dist/utils/api.js +0 -5
  122. package/dist/utils/debug.d.ts +0 -2
  123. package/dist/utils/debug.js +0 -11
  124. package/dist/utils/decoder.d.ts +0 -29
  125. package/dist/utils/decoder.js +0 -147
  126. package/dist/utils/delay.d.ts +0 -1
  127. package/dist/utils/delay.js +0 -5
  128. package/dist/utils/encoder.d.ts +0 -28
  129. package/dist/utils/encoder.js +0 -122
  130. package/dist/utils/error.d.ts +0 -11
  131. package/dist/utils/error.js +0 -27
  132. package/dist/utils/memo.d.ts +0 -1
  133. package/dist/utils/memo.js +0 -16
  134. package/dist/utils/retrier.d.ts +0 -10
  135. package/dist/utils/retrier.js +0 -22
  136. package/dist/utils/tracer.d.ts +0 -1
  137. package/dist/utils/tracer.js +0 -26
  138. package/examples/node_modules/.package-lock.json +0 -22
@@ -0,0 +1,17 @@
1
+ name: Publish package
2
+ on:
3
+ release:
4
+ types: [published]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: actions/setup-node@v4
11
+ with:
12
+ node-version: '20.x'
13
+ registry-url: 'https://registry.npmjs.org'
14
+ - run: npm ci
15
+ - run: npm publish
16
+ env:
17
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2018 Túlio Ornelas (ornelas.tulio@gmail.com)
3
+ Copyright (c) 2024 Priit Käärd (priit@hashtatic.com)
4
4
 
5
5
  Permission is hereby granted, free of charge,
6
6
  to any person obtaining a copy of this software and
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # KafkaTS
2
2
 
3
- **Please note that this project is still in early development and is not yet ready for production use. The interface before stable release is subject to change.**
4
-
5
3
  **KafkaTS** is a Apache Kafka client library for Node.js. It provides both a low-level API for communicating directly with the Apache Kafka cluster and high-level APIs for publishing and subscribing to Kafka topics.
6
4
 
5
+ **Please note that this project is still in early development and is not yet ready for production use. The interface before stable release is subject to change.**
6
+
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
- npm install kafkats
10
+ npm install kafka-ts
11
11
  ```
12
12
 
13
13
  ## Quick start
@@ -77,12 +77,15 @@ The existing high-level libraries (e.g. kafkajs) are missing a few crucial featu
77
77
 
78
78
  ### New features compared to kafkajs
79
79
 
80
- * **Static consumer membership** - Rebalancing during rolling deployments cause delays. Using `groupInstanceId` in addition to `groupId` can avoid rebalancing and continue processing based on the existing assignment.
81
- * **Consuming messages without consumer groups** - When you don't need for the consumer to track the partition offsets, you can simply create a consumer without groupId and always either start consuming messages from the beginning or from the latest partition offset.
80
+ * **Static consumer membership** - Rebalancing during rolling deployments causes delays. Using `groupInstanceId` in addition to `groupId` can avoid rebalancing and continue consuming partitions in the existing assignment.
81
+ * **Consuming messages without consumer groups** - When you don't need the consumer to track the partition offsets, you can simply create a consumer without groupId and always either start consuming messages from the beginning or from the latest partition offset.
82
+ * **Low-level API requests** - It's possible to communicate directly with the Kafka cluster using the kafka api protocol.
82
83
 
83
84
  ## Backlog
84
85
 
85
- - [ ] Consumer concurrency control
86
- - [ ] Partitioner
87
- - [ ] API versioning
88
- - [ ] SCRAM support
86
+ Minimal set of features required before a stable release:
87
+
88
+ - Consumer concurrency control (Currently each relevant broker is polled in sequence)
89
+ - Partitioner (Currently have to specify the partition on producer.send())
90
+ - API versioning (Currently only tested against Kafka 3.7+)
91
+ - SASL SCRAM support (+ pluggable authentication providers)
@@ -9,11 +9,12 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "kafkats": "file:../"
12
+ "kafka-ts": "file:../"
13
13
  }
14
14
  },
15
15
  "..": {
16
- "version": "1.0.0",
16
+ "name": "kafka-ts",
17
+ "version": "0.0.1-beta",
17
18
  "license": "MIT",
18
19
  "devDependencies": {
19
20
  "@types/node": "^20.12.12",
@@ -22,7 +23,7 @@
22
23
  "vitest": "^1.6.0"
23
24
  }
24
25
  },
25
- "node_modules/kafkats": {
26
+ "node_modules/kafka-ts": {
26
27
  "resolved": "..",
27
28
  "link": true
28
29
  }
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "kafkats": "file:../"
10
+ "kafka-ts": "file:../"
11
11
  },
12
12
  "author": "",
13
13
  "license": "ISC"
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from "fs";
2
- import { createKafkaClient } from "kafkats";
2
+ import { createKafkaClient } from "kafka-ts";
3
3
 
4
4
  export const kafka = createKafkaClient({
5
5
  clientId: "examples",
@@ -1,5 +1,5 @@
1
1
  import { kafka } from "./client";
2
- import { API } from "kafkats";
2
+ import { API } from "kafka-ts";
3
3
 
4
4
  (async () => {
5
5
  const cluster = kafka.createCluster();
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "kafka-ts",
3
- "version": "0.0.1-beta",
3
+ "version": "0.0.2-beta",
4
4
  "main": "dist/index.js",
5
5
  "author": "Priit Käärd",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/priitkaard/kafka-ts.git"
10
+ },
7
11
  "scripts": {
8
12
  "build": "tsc",
9
13
  "test": "vitest --testTimeout 60000 --bail 1"