kafka-crab-js 1.0.1 → 1.0.2

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/index.d.ts CHANGED
@@ -1,45 +1,4 @@
1
- /**
2
- * KafkaClient class
3
- */
4
- export class KafkaClient {
5
- /**
6
- * Creates a KafkaClient instance
7
- * @param {KafkaConfiguration} config - The Kafka configuration object
8
- * @throws {Error} If the configuration is invalid
9
- */
10
- constructor(config: KafkaConfiguration);
11
- kafkaConfiguration: KafkaConfiguration;
12
- kafkaClientConfig: KafkaClientConfig;
13
- /**
14
- * Creates a KafkaProducer instance
15
- * @param {ProducerConfiguration} [producerConfiguration] - Optional producer configuration
16
- * @returns {KafkaProducer} A KafkaProducer instance
17
- */
18
- createProducer(producerConfiguration?: ProducerConfiguration | undefined): KafkaProducer;
19
- /**
20
- * Creates a KafkaConsumer instance
21
- * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
22
- * @returns {KafkaConsumer} A KafkaConsumer instance
23
- * @throws {Error} If the configuration is invalid
24
- */
25
- createConsumer(consumerConfiguration: ConsumerConfiguration): KafkaConsumer;
26
- /**
27
- * Creates a KafkaStreamReadable instance
28
- * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
29
- * @returns {KafkaStreamReadable} A KafkaStreamReadable instance
30
- * @throws {Error} If the configuration is invalid
31
- */
32
- createStreamConsumer(consumerConfiguration: ConsumerConfiguration): KafkaStreamReadable;
33
- }
34
- import { KafkaStreamReadable } from "./kafka-stream-readable";
35
- import { ProducerConfiguration } from "./js-binding";
36
- import { ConsumerConfiguration } from "./js-binding";
37
- import { KafkaConfiguration } from "./js-binding";
38
- import { KafkaConsumer } from "./js-binding";
39
- import { CommitMode } from "./js-binding";
40
- import { PartitionPosition } from "./js-binding";
41
- import { SecurityProtocol } from "./js-binding";
42
- import { KafkaClientConfig } from "./js-binding";
43
- import { TopicPartitionConfig } from "./js-binding";
44
- import { KafkaProducer } from "./js-binding";
45
- export { KafkaStreamReadable, ProducerConfiguration, ConsumerConfiguration, KafkaConfiguration, KafkaConsumer, CommitMode, PartitionPosition, SecurityProtocol, KafkaClientConfig, TopicPartitionConfig, KafkaProducer };
1
+ export type { ConsumerConfiguration, KafkaConfiguration, KafkaCrabError, Message, MessageProducer, OffsetModel, PartitionOffset, ProducerConfiguration, ProducerRecord, RecordMetadata, RetryStrategy, TopicPartitionConfig, } from './js-binding';
2
+ export { CommitMode, KafkaClientConfig, KafkaConsumer, KafkaProducer, PartitionPosition, SecurityProtocol, } from './js-binding';
3
+ export { KafkaClient } from './kafka-client';
4
+ export { KafkaStreamReadable } from './kafka-stream-readable';
package/index.js CHANGED
@@ -1,78 +1,14 @@
1
- const { Readable } = require('stream')
2
-
3
- const {
4
- ProducerConfiguration,
5
- ConsumerConfiguration,
6
- KafkaConfiguration,
7
- KafkaConsumer,
8
- CommitMode,
9
- PartitionPosition,
10
- SecurityProtocol,
11
- KafkaClientConfig,
12
- TopicPartitionConfig,
13
- KafkaProducer,
14
- } = require('./js-binding')
15
-
16
- const { KafkaStreamReadable } = require('./kafka-stream-readable')
17
-
18
- /**
19
- * KafkaClient class
20
- */
21
- class KafkaClient {
22
- /**
23
- * Creates a KafkaClient instance
24
- * @param {KafkaConfiguration} config - The Kafka configuration object
25
- * @throws {Error} If the configuration is invalid
26
- */
27
- constructor(config) {
28
- this.kafkaConfiguration = config
29
- this.kafkaClientConfig = new KafkaClientConfig(config)
30
- }
31
-
32
- /**
33
- * Creates a KafkaProducer instance
34
- * @param {ProducerConfiguration} [producerConfiguration] - Optional producer configuration
35
- * @returns {KafkaProducer} A KafkaProducer instance
36
- */
37
- createProducer(producerConfiguration) {
38
- if (producerConfiguration) {
39
- return this.kafkaClientConfig.createProducer(producerConfiguration)
40
- }
41
- return this.kafkaClientConfig.createProducer({})
42
- }
43
-
44
- /**
45
- * Creates a KafkaConsumer instance
46
- * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
47
- * @returns {KafkaConsumer} A KafkaConsumer instance
48
- * @throws {Error} If the configuration is invalid
49
- */
50
- createConsumer(consumerConfiguration) {
51
- return this.kafkaClientConfig.createConsumer(consumerConfiguration)
52
- }
53
-
54
- /**
55
- * Creates a KafkaStreamReadable instance
56
- * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
57
- * @returns {KafkaStreamReadable} A KafkaStreamReadable instance
58
- * @throws {Error} If the configuration is invalid
59
- */
60
- createStreamConsumer(consumerConfiguration) {
61
- return new KafkaStreamReadable(this.kafkaClientConfig.createConsumer(consumerConfiguration))
62
- }
63
- }
64
-
65
- module.exports = {
66
- KafkaClient,
67
- KafkaStreamReadable,
68
- ProducerConfiguration,
69
- ConsumerConfiguration,
70
- KafkaConfiguration,
71
- KafkaConsumer,
72
- CommitMode,
73
- PartitionPosition,
74
- SecurityProtocol,
75
- KafkaClientConfig,
76
- TopicPartitionConfig,
77
- KafkaProducer,
78
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KafkaStreamReadable = exports.KafkaClient = exports.SecurityProtocol = exports.PartitionPosition = exports.KafkaProducer = exports.KafkaConsumer = exports.KafkaClientConfig = exports.CommitMode = void 0;
4
+ var js_binding_1 = require("./js-binding");
5
+ Object.defineProperty(exports, "CommitMode", { enumerable: true, get: function () { return js_binding_1.CommitMode; } });
6
+ Object.defineProperty(exports, "KafkaClientConfig", { enumerable: true, get: function () { return js_binding_1.KafkaClientConfig; } });
7
+ Object.defineProperty(exports, "KafkaConsumer", { enumerable: true, get: function () { return js_binding_1.KafkaConsumer; } });
8
+ Object.defineProperty(exports, "KafkaProducer", { enumerable: true, get: function () { return js_binding_1.KafkaProducer; } });
9
+ Object.defineProperty(exports, "PartitionPosition", { enumerable: true, get: function () { return js_binding_1.PartitionPosition; } });
10
+ Object.defineProperty(exports, "SecurityProtocol", { enumerable: true, get: function () { return js_binding_1.SecurityProtocol; } });
11
+ var kafka_client_1 = require("./kafka-client");
12
+ Object.defineProperty(exports, "KafkaClient", { enumerable: true, get: function () { return kafka_client_1.KafkaClient; } });
13
+ var kafka_stream_readable_1 = require("./kafka-stream-readable");
14
+ Object.defineProperty(exports, "KafkaStreamReadable", { enumerable: true, get: function () { return kafka_stream_readable_1.KafkaStreamReadable; } });
package/js-binding.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface RetryStrategy {
13
13
  }
14
14
  export enum CommitMode {
15
15
  Sync = 0,
16
- Async = 1
16
+ Async = 1,
17
17
  }
18
18
  export interface ConsumerConfiguration {
19
19
  groupId: string
@@ -25,7 +25,7 @@ export interface ConsumerConfiguration {
25
25
  export enum PartitionPosition {
26
26
  Beginning = 'Beginning',
27
27
  End = 'End',
28
- Stored = 'Stored'
28
+ Stored = 'Stored',
29
29
  }
30
30
  export interface OffsetModel {
31
31
  offset?: number
@@ -44,7 +44,7 @@ export enum SecurityProtocol {
44
44
  Plaintext = 'Plaintext',
45
45
  Ssl = 'Ssl',
46
46
  SaslPlaintext = 'SaslPlaintext',
47
- SaslSsl = 'SaslSsl'
47
+ SaslSsl = 'SaslSsl',
48
48
  }
49
49
  export interface KafkaConfiguration {
50
50
  brokers: string
package/js-binding.js CHANGED
@@ -63,7 +63,7 @@ switch (platform) {
63
63
  switch (arch) {
64
64
  case 'x64':
65
65
  localFileExisted = existsSync(
66
- join(__dirname, 'kafka-crab-js.win32-x64-msvc.node')
66
+ join(__dirname, 'kafka-crab-js.win32-x64-msvc.node'),
67
67
  )
68
68
  try {
69
69
  if (localFileExisted) {
@@ -77,7 +77,7 @@ switch (platform) {
77
77
  break
78
78
  case 'ia32':
79
79
  localFileExisted = existsSync(
80
- join(__dirname, 'kafka-crab-js.win32-ia32-msvc.node')
80
+ join(__dirname, 'kafka-crab-js.win32-ia32-msvc.node'),
81
81
  )
82
82
  try {
83
83
  if (localFileExisted) {
@@ -91,7 +91,7 @@ switch (platform) {
91
91
  break
92
92
  case 'arm64':
93
93
  localFileExisted = existsSync(
94
- join(__dirname, 'kafka-crab-js.win32-arm64-msvc.node')
94
+ join(__dirname, 'kafka-crab-js.win32-arm64-msvc.node'),
95
95
  )
96
96
  try {
97
97
  if (localFileExisted) {
@@ -132,7 +132,7 @@ switch (platform) {
132
132
  break
133
133
  case 'arm64':
134
134
  localFileExisted = existsSync(
135
- join(__dirname, 'kafka-crab-js.darwin-arm64.node')
135
+ join(__dirname, 'kafka-crab-js.darwin-arm64.node'),
136
136
  )
137
137
  try {
138
138
  if (localFileExisted) {
@@ -168,7 +168,7 @@ switch (platform) {
168
168
  case 'x64':
169
169
  if (isMusl()) {
170
170
  localFileExisted = existsSync(
171
- join(__dirname, 'kafka-crab-js.linux-x64-musl.node')
171
+ join(__dirname, 'kafka-crab-js.linux-x64-musl.node'),
172
172
  )
173
173
  try {
174
174
  if (localFileExisted) {
@@ -181,7 +181,7 @@ switch (platform) {
181
181
  }
182
182
  } else {
183
183
  localFileExisted = existsSync(
184
- join(__dirname, 'kafka-crab-js.linux-x64-gnu.node')
184
+ join(__dirname, 'kafka-crab-js.linux-x64-gnu.node'),
185
185
  )
186
186
  try {
187
187
  if (localFileExisted) {
@@ -197,7 +197,7 @@ switch (platform) {
197
197
  case 'arm64':
198
198
  if (isMusl()) {
199
199
  localFileExisted = existsSync(
200
- join(__dirname, 'kafka-crab-js.linux-arm64-musl.node')
200
+ join(__dirname, 'kafka-crab-js.linux-arm64-musl.node'),
201
201
  )
202
202
  try {
203
203
  if (localFileExisted) {
@@ -210,7 +210,7 @@ switch (platform) {
210
210
  }
211
211
  } else {
212
212
  localFileExisted = existsSync(
213
- join(__dirname, 'kafka-crab-js.linux-arm64-gnu.node')
213
+ join(__dirname, 'kafka-crab-js.linux-arm64-gnu.node'),
214
214
  )
215
215
  try {
216
216
  if (localFileExisted) {
@@ -226,7 +226,7 @@ switch (platform) {
226
226
  case 'arm':
227
227
  if (isMusl()) {
228
228
  localFileExisted = existsSync(
229
- join(__dirname, 'kafka-crab-js.linux-arm-musleabihf.node')
229
+ join(__dirname, 'kafka-crab-js.linux-arm-musleabihf.node'),
230
230
  )
231
231
  try {
232
232
  if (localFileExisted) {
@@ -239,7 +239,7 @@ switch (platform) {
239
239
  }
240
240
  } else {
241
241
  localFileExisted = existsSync(
242
- join(__dirname, 'kafka-crab-js.linux-arm-gnueabihf.node')
242
+ join(__dirname, 'kafka-crab-js.linux-arm-gnueabihf.node'),
243
243
  )
244
244
  try {
245
245
  if (localFileExisted) {
@@ -255,7 +255,7 @@ switch (platform) {
255
255
  case 'riscv64':
256
256
  if (isMusl()) {
257
257
  localFileExisted = existsSync(
258
- join(__dirname, 'kafka-crab-js.linux-riscv64-musl.node')
258
+ join(__dirname, 'kafka-crab-js.linux-riscv64-musl.node'),
259
259
  )
260
260
  try {
261
261
  if (localFileExisted) {
@@ -268,7 +268,7 @@ switch (platform) {
268
268
  }
269
269
  } else {
270
270
  localFileExisted = existsSync(
271
- join(__dirname, 'kafka-crab-js.linux-riscv64-gnu.node')
271
+ join(__dirname, 'kafka-crab-js.linux-riscv64-gnu.node'),
272
272
  )
273
273
  try {
274
274
  if (localFileExisted) {
@@ -283,7 +283,7 @@ switch (platform) {
283
283
  break
284
284
  case 's390x':
285
285
  localFileExisted = existsSync(
286
- join(__dirname, 'kafka-crab-js.linux-s390x-gnu.node')
286
+ join(__dirname, 'kafka-crab-js.linux-s390x-gnu.node'),
287
287
  )
288
288
  try {
289
289
  if (localFileExisted) {
@@ -310,7 +310,8 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { KafkaConsumer, CommitMode, PartitionPosition, SecurityProtocol, KafkaClientConfig, KafkaProducer } = nativeBinding
313
+ const { KafkaConsumer, CommitMode, PartitionPosition, SecurityProtocol, KafkaClientConfig, KafkaProducer } =
314
+ nativeBinding
314
315
 
315
316
  module.exports.KafkaConsumer = KafkaConsumer
316
317
  module.exports.CommitMode = CommitMode
@@ -0,0 +1,34 @@
1
+ import { ConsumerConfiguration, KafkaConfiguration, ProducerConfiguration } from './js-binding.js';
2
+ import { KafkaStreamReadable } from './kafka-stream-readable';
3
+ /**
4
+ * KafkaClient class
5
+ */
6
+ export declare class KafkaClient {
7
+ private readonly kafkaConfiguration;
8
+ private readonly kafkaClientConfig;
9
+ /**
10
+ * Creates a KafkaClient instance
11
+ * @throws {Error} If the configuration is invalid
12
+ */
13
+ constructor(kafkaConfiguration: KafkaConfiguration);
14
+ /**
15
+ * Creates a KafkaProducer instance
16
+ * @param {ProducerConfiguration} [producerConfiguration] - Optional producer configuration
17
+ * @returns {KafkaProducer} A KafkaProducer instance
18
+ */
19
+ createProducer(producerConfiguration: ProducerConfiguration): import("./js-binding.js").KafkaProducer;
20
+ /**
21
+ * Creates a KafkaConsumer instance
22
+ * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
23
+ * @returns {KafkaConsumer} A KafkaConsumer instance
24
+ * @throws {Error} If the configuration is invalid
25
+ */
26
+ createConsumer(consumerConfiguration: ConsumerConfiguration): import("./js-binding.js").KafkaConsumer;
27
+ /**
28
+ * Creates a KafkaStreamReadable instance
29
+ * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
30
+ * @returns {KafkaStreamReadable} A KafkaStreamReadable instance
31
+ * @throws {Error} If the configuration is invalid
32
+ */
33
+ createStreamConsumer(consumerConfiguration: ConsumerConfiguration): KafkaStreamReadable;
34
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KafkaClient = void 0;
4
+ const js_binding_js_1 = require("./js-binding.js");
5
+ const kafka_stream_readable_1 = require("./kafka-stream-readable");
6
+ /**
7
+ * KafkaClient class
8
+ */
9
+ class KafkaClient {
10
+ /**
11
+ * Creates a KafkaClient instance
12
+ * @throws {Error} If the configuration is invalid
13
+ */
14
+ constructor(kafkaConfiguration) {
15
+ this.kafkaConfiguration = kafkaConfiguration;
16
+ this.kafkaClientConfig = new js_binding_js_1.KafkaClientConfig(kafkaConfiguration);
17
+ }
18
+ /**
19
+ * Creates a KafkaProducer instance
20
+ * @param {ProducerConfiguration} [producerConfiguration] - Optional producer configuration
21
+ * @returns {KafkaProducer} A KafkaProducer instance
22
+ */
23
+ createProducer(producerConfiguration) {
24
+ if (producerConfiguration) {
25
+ return this.kafkaClientConfig.createProducer(producerConfiguration);
26
+ }
27
+ return this.kafkaClientConfig.createProducer({});
28
+ }
29
+ /**
30
+ * Creates a KafkaConsumer instance
31
+ * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
32
+ * @returns {KafkaConsumer} A KafkaConsumer instance
33
+ * @throws {Error} If the configuration is invalid
34
+ */
35
+ createConsumer(consumerConfiguration) {
36
+ return this.kafkaClientConfig.createConsumer(consumerConfiguration);
37
+ }
38
+ /**
39
+ * Creates a KafkaStreamReadable instance
40
+ * @param {ConsumerConfiguration} consumerConfiguration - Consumer configuration
41
+ * @returns {KafkaStreamReadable} A KafkaStreamReadable instance
42
+ * @throws {Error} If the configuration is invalid
43
+ */
44
+ createStreamConsumer(consumerConfiguration) {
45
+ return new kafka_stream_readable_1.KafkaStreamReadable(this.kafkaClientConfig.createConsumer(consumerConfiguration));
46
+ }
47
+ }
48
+ exports.KafkaClient = KafkaClient;
@@ -0,0 +1,31 @@
1
+ import { Readable } from 'stream';
2
+ import { KafkaConsumer, TopicPartitionConfig } from './js-binding';
3
+ /**
4
+ * KafkaStreamReadable class
5
+ * @extends Readable
6
+ */
7
+ export declare class KafkaStreamReadable extends Readable {
8
+ private readonly kafkaConsumer;
9
+ /**
10
+ * Creates a KafkaStreamReadable instance
11
+ */
12
+ constructor(kafkaConsumer: KafkaConsumer);
13
+ /**
14
+ * Subscribes to topics
15
+ */
16
+ subscribe(topics: string | Array<TopicPartitionConfig>): Promise<void>;
17
+ /**
18
+ * Unsubscribe from topics
19
+ */
20
+ unsubscribe(): void;
21
+ /**
22
+ * Returns the raw Kafka consumer
23
+ * @returns {KafkaConsumer} The Kafka consumer instance
24
+ */
25
+ rawConsumer(): KafkaConsumer;
26
+ /**
27
+ * Internal method called by the Readable stream to fetch data
28
+ * @private
29
+ */
30
+ _read(): Promise<void>;
31
+ }
@@ -1,73 +1,67 @@
1
- const { Readable } = require('stream')
2
-
3
- const {
4
- KafkaConsumer,
5
- TopicPartitionConfig,
6
- } = require('./js-binding')
7
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KafkaStreamReadable = void 0;
4
+ const stream_1 = require("stream");
8
5
  /**
9
6
  * KafkaStreamReadable class
10
7
  * @extends Readable
11
8
  */
12
- class KafkaStreamReadable extends Readable {
13
- /**
14
- * Creates a KafkaStreamReadable instance
15
- * @param { KafkaConsumer } kafkaConsumer - The Kafka consumer instance
16
- */
17
- constructor(kafkaConsumer) {
18
- super({ objectMode: true })
19
- if (!kafkaConsumer) {
20
- throw new Error('A valid KafkaConsumer instance is required.')
9
+ class KafkaStreamReadable extends stream_1.Readable {
10
+ /**
11
+ * Creates a KafkaStreamReadable instance
12
+ */
13
+ constructor(kafkaConsumer) {
14
+ super({ objectMode: true });
15
+ this.kafkaConsumer = kafkaConsumer;
16
+ if (!kafkaConsumer) {
17
+ throw new Error('A valid KafkaConsumer instance is required.');
18
+ }
19
+ this.kafkaConsumer = kafkaConsumer;
21
20
  }
22
- this.kafkaConsumer = kafkaConsumer
23
- }
24
-
25
- /**
26
- * Subscribes to topics
27
- * @param {string | Array<TopicPartitionConfig>} topics - Topics to subscribe to
28
- * @returns {Promise<void>} - A promise that resolves when the subscription is successful
29
- */
30
- async subscribe(topics) {
31
- if (!topics || (Array.isArray(topics) && topics.length === 0)) {
32
- throw new Error('Topics must be a non-empty string or array.')
21
+ /**
22
+ * Subscribes to topics
23
+ */
24
+ async subscribe(topics) {
25
+ if (!topics || (Array.isArray(topics) && topics.length === 0)) {
26
+ throw new Error('Topics must be a non-empty string or array.');
27
+ }
28
+ await this.kafkaConsumer.subscribe(topics);
33
29
  }
34
- await this.kafkaConsumer.subscribe(topics)
35
- }
36
-
37
- /**
38
- * Unsubscribe from topics
39
- * @returns {void}
40
- */
41
- unsubscribe() {
42
- this.kafkaConsumer.unsubscribe()
43
- }
44
-
45
- /**
46
- * Returns the raw Kafka consumer
47
- * @returns {KafkaConsumer} The Kafka consumer instance
48
- */
49
- rawConsumer() {
50
- return this.kafkaConsumer
51
- }
52
-
53
- /**
54
- * Internal method called by the Readable stream to fetch data
55
- * @private
56
- */
57
- async _read() {
58
- try {
59
- const message = await this.kafkaConsumer.recv() // Call the napi-rs method
60
- if (message) {
61
- this.push(message) // Push message into the stream
62
- } else {
63
- this.push(null) // No more data, end of stream
64
- }
65
- } catch (error) {
66
- this.destroy(error)
30
+ /**
31
+ * Unsubscribe from topics
32
+ */
33
+ unsubscribe() {
34
+ this.kafkaConsumer.unsubscribe();
35
+ }
36
+ /**
37
+ * Returns the raw Kafka consumer
38
+ * @returns {KafkaConsumer} The Kafka consumer instance
39
+ */
40
+ rawConsumer() {
41
+ return this.kafkaConsumer;
42
+ }
43
+ /**
44
+ * Internal method called by the Readable stream to fetch data
45
+ * @private
46
+ */
47
+ async _read() {
48
+ try {
49
+ const message = await this.kafkaConsumer.recv(); // Call the napi-rs method
50
+ if (message) {
51
+ this.push(message); // Push message into the stream
52
+ }
53
+ else {
54
+ this.push(null); // No more data, end of stream
55
+ }
56
+ }
57
+ catch (error) {
58
+ if (error instanceof Error) {
59
+ this.destroy(error);
60
+ }
61
+ else {
62
+ this.destroy();
63
+ }
64
+ }
67
65
  }
68
- }
69
- }
70
-
71
- module.exports = {
72
- KafkaStreamReadable,
73
66
  }
67
+ exports.KafkaStreamReadable = KafkaStreamReadable;
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "kafka-crab-js",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "module": "commonjs",
7
7
  "files": [
8
8
  "index.d.ts",
9
9
  "index.js",
10
+ "kafka-client.js",
11
+ "kafka-client.d.ts",
10
12
  "kafka-stream-readable.js",
13
+ "kafka-stream-readable.d.ts",
11
14
  "js-binding.js",
12
15
  "js-binding.d.ts"
13
16
  ],
@@ -43,15 +46,18 @@
43
46
  "ava": "6.2.0",
44
47
  "dprint": "^0.47.5",
45
48
  "nanoid": "5.0.8",
46
- "typescript": "5.6.3"
49
+ "typescript": "5.6.3",
50
+ "copyfiles": "^2.4.1",
51
+ "@types/copyfiles": "^2.4.4",
52
+ "rimraf": "^6.0.1"
47
53
  },
48
54
  "ava": {
49
55
  "timeout": "3m"
50
56
  },
51
57
  "scripts": {
52
58
  "artifacts": "napi artifacts",
53
- "build": "napi build --js js-binding.js --dts js-binding.d.ts --no-const-enum --platform --release",
54
- "postbuild": "tsc",
59
+ "build": "napi build --js js-src/js-binding.js --dts js-src/js-binding.d.ts --no-const-enum --platform --release",
60
+ "postbuild": "rimraf dist && tsc && copyfiles -f js-src/js-binding.d.ts js-src/js-binding.js ./dist/*.js ./dist/*.d.ts .",
55
61
  "build:debug": "napi build --platform",
56
62
  "prepublishOnly": "napi prepublish -t npm",
57
63
  "test": "ava",
@@ -61,8 +67,8 @@
61
67
  },
62
68
  "packageManager": "pnpm@9.14.2",
63
69
  "optionalDependencies": {
64
- "kafka-crab-js-darwin-arm64": "1.0.1",
65
- "kafka-crab-js-darwin-x64": "1.0.1",
66
- "kafka-crab-js-linux-x64-gnu": "1.0.1"
70
+ "kafka-crab-js-darwin-arm64": "1.0.2",
71
+ "kafka-crab-js-darwin-x64": "1.0.2",
72
+ "kafka-crab-js-linux-x64-gnu": "1.0.2"
67
73
  }
68
74
  }