kafka-crab-js 2.0.0-beta.1 → 2.0.1
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 +35 -42
- package/js-binding.cjs +100 -51
- package/js-binding.js +100 -51
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -43,17 +43,6 @@ This major version includes important breaking changes that improve API consiste
|
|
|
43
43
|
- Better TypeScript typing throughout the codebase
|
|
44
44
|
- Removed redundant validation functions for cleaner code
|
|
45
45
|
|
|
46
|
-
### Migration Guide
|
|
47
|
-
|
|
48
|
-
- **No API changes required** - all public interfaces remain the same
|
|
49
|
-
- **Stream memory management** - streams now automatically clean up resources
|
|
50
|
-
- **Error handling** - streams will properly terminate on errors (existing error handling code still works)
|
|
51
|
-
- **Performance** - simplified timeout logic may provide marginal performance improvements
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## What's New in Version 1.10.0
|
|
56
|
-
|
|
57
46
|
### Major Updates:
|
|
58
47
|
|
|
59
48
|
1. **Performance Benchmark Suite**:
|
|
@@ -73,7 +62,7 @@ This major version includes important breaking changes that improve API consiste
|
|
|
73
62
|
- Better support for advanced librdkafka configuration options
|
|
74
63
|
|
|
75
64
|
4. **Enhanced Topic Management**:
|
|
76
|
-
- Added `createTopic` and `
|
|
65
|
+
- Added `createTopic`, `numPartitions`, and `replicas` options to `TopicPartitionConfig`
|
|
77
66
|
- Improved topic creation control during consumer subscription
|
|
78
67
|
- Better handling of partition assignment and topic setup
|
|
79
68
|
|
|
@@ -88,24 +77,29 @@ This major version includes important breaking changes that improve API consiste
|
|
|
88
77
|
- Added support for benchmark directory linting and formatting
|
|
89
78
|
- Improved development workflow with better error handling rules
|
|
90
79
|
|
|
91
|
-
|
|
92
|
-
7. **Consumer Topic Creation Control**:
|
|
80
|
+
7. **Consumer Topic Creation Control** (v1.9.0):
|
|
93
81
|
- Added fine-grained control over consumer topic creation behavior
|
|
94
82
|
- Enhanced consistency in topic management and cleanup processes
|
|
95
83
|
- Improved handling of topic creation inconsistencies during consumer operations
|
|
96
84
|
|
|
97
|
-
8. **Enhanced Manual Commit Testing
|
|
85
|
+
8. **Enhanced Manual Commit Testing** (v1.9.0):
|
|
98
86
|
- Consolidated manual commit tests for better reliability and coverage
|
|
99
87
|
- Added comprehensive integration tests with PostRebalance event handling
|
|
100
88
|
- Tests now verify offset persistence across consumer restarts and batch processing
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
9. **Async Consumer Commit**:
|
|
90
|
+
9. **Async Consumer Commit** (v1.8.0 - BREAKING):
|
|
104
91
|
- **BREAKING**: The `consumer.commit()` method is now async and must be awaited
|
|
105
92
|
- **Before**: `consumer.commit(topic, partition, offset, 'Sync')`
|
|
106
93
|
- **After**: `await consumer.commit(topic, partition, offset, 'Sync')`
|
|
107
94
|
- This change improves performance by using `spawn_blocking` for non-blocking operations
|
|
108
95
|
|
|
96
|
+
### Migration Guide
|
|
97
|
+
|
|
98
|
+
- **No API changes required** - all public interfaces remain the same
|
|
99
|
+
- **Stream memory management** - streams now automatically clean up resources
|
|
100
|
+
- **Error handling** - streams will properly terminate on errors (existing error handling code still works)
|
|
101
|
+
- **Performance** - simplified timeout logic may provide marginal performance improvements
|
|
102
|
+
|
|
109
103
|
---
|
|
110
104
|
|
|
111
105
|
## Features
|
|
@@ -169,7 +163,7 @@ async function run() {
|
|
|
169
163
|
});
|
|
170
164
|
|
|
171
165
|
// Subscribe with topic creation options
|
|
172
|
-
await consumer.subscribe([{
|
|
166
|
+
await consumer.subscribe([{
|
|
173
167
|
topic: 'foo',
|
|
174
168
|
createTopic: true,
|
|
175
169
|
numPartitions: 3
|
|
@@ -206,12 +200,12 @@ const kafkaClient = new KafkaClient({
|
|
|
206
200
|
});
|
|
207
201
|
|
|
208
202
|
// Producer configuration is now optional with sensible defaults
|
|
209
|
-
const producer = kafkaClient.createProducer({
|
|
210
|
-
configuration: {
|
|
203
|
+
const producer = kafkaClient.createProducer({
|
|
204
|
+
configuration: {
|
|
211
205
|
'message.timeout.ms': 5000, // Now supports number values
|
|
212
206
|
'batch.size': 16384,
|
|
213
207
|
'compression.type': 'snappy'
|
|
214
|
-
}
|
|
208
|
+
}
|
|
215
209
|
});
|
|
216
210
|
|
|
217
211
|
const message = {
|
|
@@ -249,29 +243,29 @@ const kafkaClient = new KafkaClient({
|
|
|
249
243
|
brokerAddressFamily: 'v4',
|
|
250
244
|
});
|
|
251
245
|
|
|
252
|
-
// Stream consumer with custom ReadableOptions (
|
|
246
|
+
// Stream consumer with custom ReadableOptions (v2.0.0+)
|
|
253
247
|
const kafkaStream = kafkaClient.createStreamConsumer({
|
|
254
248
|
groupId: `my-group-id`,
|
|
255
249
|
enableAutoCommit: true,
|
|
256
250
|
}, {
|
|
257
|
-
objectMode: true, // Default in
|
|
251
|
+
objectMode: true, // Default in v2.0.0+
|
|
258
252
|
highWaterMark: 1024,
|
|
259
253
|
encoding: null
|
|
260
254
|
});
|
|
261
255
|
|
|
262
256
|
await kafkaStream.subscribe([
|
|
263
|
-
{ topic: 'foo', createTopic: true },
|
|
257
|
+
{ topic: 'foo', createTopic: true },
|
|
264
258
|
{ topic: 'bar', createTopic: true }
|
|
265
259
|
]);
|
|
266
260
|
|
|
267
261
|
kafkaStream.on('data', (message) => {
|
|
268
|
-
console.log('>>> Message received:', {
|
|
269
|
-
payload: message.payload.toString(),
|
|
270
|
-
offset: message.offset,
|
|
271
|
-
partition: message.partition,
|
|
272
|
-
topic: message.topic
|
|
262
|
+
console.log('>>> Message received:', {
|
|
263
|
+
payload: message.payload.toString(),
|
|
264
|
+
offset: message.offset,
|
|
265
|
+
partition: message.partition,
|
|
266
|
+
topic: message.topic
|
|
273
267
|
});
|
|
274
|
-
|
|
268
|
+
|
|
275
269
|
if (message.offset > 10) {
|
|
276
270
|
kafkaStream.destroy();
|
|
277
271
|
}
|
|
@@ -298,7 +292,7 @@ const kafkaClient = new KafkaClient({
|
|
|
298
292
|
const producer = kafkaClient.createProducer({
|
|
299
293
|
configuration: {
|
|
300
294
|
'batch.size': 50000, // Number value supported
|
|
301
|
-
'linger.ms': 10, // Number value supported
|
|
295
|
+
'linger.ms': 10, // Number value supported
|
|
302
296
|
'compression.type': 'lz4',
|
|
303
297
|
'enable.idempotence': true // Boolean value supported
|
|
304
298
|
}
|
|
@@ -385,7 +379,7 @@ async function createConsumer() {
|
|
|
385
379
|
highWaterMark: 100,
|
|
386
380
|
objectMode: true
|
|
387
381
|
})
|
|
388
|
-
|
|
382
|
+
|
|
389
383
|
await kafkaStream.subscribe([
|
|
390
384
|
{ topic: 'foo', createTopic: true },
|
|
391
385
|
{ topic: 'bar', createTopic: true },
|
|
@@ -464,8 +458,6 @@ You can find some examples on the [example](https://github.com/flash-tecnologia/
|
|
|
464
458
|
|
|
465
459
|
## Configuration
|
|
466
460
|
|
|
467
|
-
### Configuration properties
|
|
468
|
-
|
|
469
461
|
### KafkaConfiguration
|
|
470
462
|
|
|
471
463
|
| Property | Type | Default | Description |
|
|
@@ -475,7 +467,7 @@ You can find some examples on the [example](https://github.com/flash-tecnologia/
|
|
|
475
467
|
| `securityProtocol` | `SecurityProtocol` || Security protocol to use (PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL) |
|
|
476
468
|
| `logLevel` | `string` | `info` | Log level for the client |
|
|
477
469
|
| `brokerAddressFamily` | `string` | `"v4"` | Address family to use for the connection (v4, v6) |
|
|
478
|
-
| `configuration` | `Record<string, any>` | `{}` | Additional configuration options for the client. **
|
|
470
|
+
| `configuration` | `Record<string, any>` | `{}` | Additional configuration options for the client. **v2.0.0+**: Now supports any value type (string, number, boolean, object) |
|
|
479
471
|
|
|
480
472
|
### ConsumerConfiguration
|
|
481
473
|
|
|
@@ -502,8 +494,9 @@ You can find some examples on the [example](https://github.com/flash-tecnologia/
|
|
|
502
494
|
| `topic` | `string` || Topic name |
|
|
503
495
|
| `allOffsets` | `OffsetModel` || Offset configuration for all partitions |
|
|
504
496
|
| `partitionOffset` | `Array<PartitionOffset>` || Per-partition offset configuration |
|
|
505
|
-
| `createTopic` | `boolean` | `false` | **
|
|
506
|
-
| `numPartitions` | `number` | `1` | **
|
|
497
|
+
| `createTopic` | `boolean` | `false` | **v2.0.0+**: Create topic if it doesn't exist |
|
|
498
|
+
| `numPartitions` | `number` | `1` | **v2.0.0+**: Number of partitions when creating topic |
|
|
499
|
+
| `replicas` | `number` | `1` | **v2.0.0+**: Number of replicas when creating topic |
|
|
507
500
|
|
|
508
501
|
You can see the available options here: [librdkafka](https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html).
|
|
509
502
|
|
|
@@ -511,7 +504,7 @@ You can see the available options here: [librdkafka](https://docs.confluent.io/p
|
|
|
511
504
|
|
|
512
505
|
### Running Benchmarks
|
|
513
506
|
|
|
514
|
-
kafka-crab-js
|
|
507
|
+
kafka-crab-js v2.0.0+ includes a comprehensive benchmark suite to compare performance against other popular Kafka clients:
|
|
515
508
|
|
|
516
509
|
```bash
|
|
517
510
|
# Set up benchmark environment (requires Kafka running locally)
|
|
@@ -581,12 +574,12 @@ const maxBytes = 200 // Maximum message size
|
|
|
581
574
|
- Monitor and tune consumer group performance
|
|
582
575
|
- Leverage the benchmark suite to optimize your specific use case
|
|
583
576
|
|
|
584
|
-
### Configuration (
|
|
577
|
+
### Configuration (v2.0.0+)
|
|
585
578
|
- Use the flexible configuration system with proper data types:
|
|
586
579
|
```javascript
|
|
587
580
|
const config = {
|
|
588
581
|
'batch.size': 16384, // number
|
|
589
|
-
'compression.type': 'snappy', // string
|
|
582
|
+
'compression.type': 'snappy', // string
|
|
590
583
|
'enable.idempotence': true, // boolean
|
|
591
584
|
'retries': 5 // number
|
|
592
585
|
}
|
|
@@ -598,7 +591,7 @@ const maxBytes = 200 // Maximum message size
|
|
|
598
591
|
- Handle message ordering when required
|
|
599
592
|
- Use topic creation options for better topic management
|
|
600
593
|
|
|
601
|
-
### Stream Processing (
|
|
594
|
+
### Stream Processing (v2.0.0+)
|
|
602
595
|
- Configure appropriate `ReadableOptions` for your use case
|
|
603
596
|
- Use `objectMode: true` for structured message processing
|
|
604
597
|
- Set appropriate `highWaterMark` based on memory constraints
|
|
@@ -642,4 +635,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
642
635
|
|
|
643
636
|
[](https://www.rust-lang.org/)
|
|
644
637
|
|
|
645
|
-
</div>
|
|
638
|
+
</div>
|
package/js-binding.cjs
CHANGED
|
@@ -66,7 +66,7 @@ const isMuslFromChildProcess = () => {
|
|
|
66
66
|
function requireNative() {
|
|
67
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
70
|
} catch (err) {
|
|
71
71
|
loadErrors.push(err)
|
|
72
72
|
}
|
|
@@ -80,8 +80,8 @@ function requireNative() {
|
|
|
80
80
|
try {
|
|
81
81
|
const binding = require('kafka-crab-js-android-arm64')
|
|
82
82
|
const bindingPackageVersion = require('kafka-crab-js-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '2.0.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
83
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
85
|
}
|
|
86
86
|
return binding
|
|
87
87
|
} catch (e) {
|
|
@@ -96,8 +96,8 @@ function requireNative() {
|
|
|
96
96
|
try {
|
|
97
97
|
const binding = require('kafka-crab-js-android-arm-eabi')
|
|
98
98
|
const bindingPackageVersion = require('kafka-crab-js-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '2.0.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
99
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
101
|
}
|
|
102
102
|
return binding
|
|
103
103
|
} catch (e) {
|
|
@@ -116,8 +116,8 @@ function requireNative() {
|
|
|
116
116
|
try {
|
|
117
117
|
const binding = require('kafka-crab-js-win32-x64-msvc')
|
|
118
118
|
const bindingPackageVersion = require('kafka-crab-js-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '2.0.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
119
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
120
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
121
|
}
|
|
122
122
|
return binding
|
|
123
123
|
} catch (e) {
|
|
@@ -132,8 +132,8 @@ function requireNative() {
|
|
|
132
132
|
try {
|
|
133
133
|
const binding = require('kafka-crab-js-win32-ia32-msvc')
|
|
134
134
|
const bindingPackageVersion = require('kafka-crab-js-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '2.0.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
135
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
136
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
137
|
}
|
|
138
138
|
return binding
|
|
139
139
|
} catch (e) {
|
|
@@ -148,8 +148,8 @@ function requireNative() {
|
|
|
148
148
|
try {
|
|
149
149
|
const binding = require('kafka-crab-js-win32-arm64-msvc')
|
|
150
150
|
const bindingPackageVersion = require('kafka-crab-js-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '2.0.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
151
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
152
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
153
|
}
|
|
154
154
|
return binding
|
|
155
155
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('kafka-crab-js-darwin-universal')
|
|
169
169
|
const bindingPackageVersion = require('kafka-crab-js-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '2.0.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
170
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -183,8 +183,8 @@ function requireNative() {
|
|
|
183
183
|
try {
|
|
184
184
|
const binding = require('kafka-crab-js-darwin-x64')
|
|
185
185
|
const bindingPackageVersion = require('kafka-crab-js-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '2.0.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
186
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
187
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
188
|
}
|
|
189
189
|
return binding
|
|
190
190
|
} catch (e) {
|
|
@@ -199,8 +199,8 @@ function requireNative() {
|
|
|
199
199
|
try {
|
|
200
200
|
const binding = require('kafka-crab-js-darwin-arm64')
|
|
201
201
|
const bindingPackageVersion = require('kafka-crab-js-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '2.0.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
202
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
204
|
}
|
|
205
205
|
return binding
|
|
206
206
|
} catch (e) {
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('kafka-crab-js-freebsd-x64')
|
|
221
221
|
const bindingPackageVersion = require('kafka-crab-js-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '2.0.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
222
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
224
|
}
|
|
225
225
|
return binding
|
|
226
226
|
} catch (e) {
|
|
@@ -235,8 +235,8 @@ function requireNative() {
|
|
|
235
235
|
try {
|
|
236
236
|
const binding = require('kafka-crab-js-freebsd-arm64')
|
|
237
237
|
const bindingPackageVersion = require('kafka-crab-js-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '2.0.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
238
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
239
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
240
|
}
|
|
241
241
|
return binding
|
|
242
242
|
} catch (e) {
|
|
@@ -256,8 +256,8 @@ function requireNative() {
|
|
|
256
256
|
try {
|
|
257
257
|
const binding = require('kafka-crab-js-linux-x64-musl')
|
|
258
258
|
const bindingPackageVersion = require('kafka-crab-js-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '2.0.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
259
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
260
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
261
|
}
|
|
262
262
|
return binding
|
|
263
263
|
} catch (e) {
|
|
@@ -272,8 +272,8 @@ function requireNative() {
|
|
|
272
272
|
try {
|
|
273
273
|
const binding = require('kafka-crab-js-linux-x64-gnu')
|
|
274
274
|
const bindingPackageVersion = require('kafka-crab-js-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '2.0.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
275
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
276
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
277
|
}
|
|
278
278
|
return binding
|
|
279
279
|
} catch (e) {
|
|
@@ -290,8 +290,8 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require('kafka-crab-js-linux-arm64-musl')
|
|
292
292
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '2.0.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
293
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
295
|
}
|
|
296
296
|
return binding
|
|
297
297
|
} catch (e) {
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('kafka-crab-js-linux-arm64-gnu')
|
|
308
308
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '2.0.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
309
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
311
|
}
|
|
312
312
|
return binding
|
|
313
313
|
} catch (e) {
|
|
@@ -324,8 +324,8 @@ function requireNative() {
|
|
|
324
324
|
try {
|
|
325
325
|
const binding = require('kafka-crab-js-linux-arm-musleabihf')
|
|
326
326
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '2.0.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
327
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
329
|
}
|
|
330
330
|
return binding
|
|
331
331
|
} catch (e) {
|
|
@@ -340,8 +340,42 @@ function requireNative() {
|
|
|
340
340
|
try {
|
|
341
341
|
const binding = require('kafka-crab-js-linux-arm-gnueabihf')
|
|
342
342
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '2.0.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
343
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
344
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
|
+
}
|
|
346
|
+
return binding
|
|
347
|
+
} catch (e) {
|
|
348
|
+
loadErrors.push(e)
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
} else if (process.arch === 'loong64') {
|
|
352
|
+
if (isMusl()) {
|
|
353
|
+
try {
|
|
354
|
+
return require('./kafka-crab-js.linux-loong64-musl.node')
|
|
355
|
+
} catch (e) {
|
|
356
|
+
loadErrors.push(e)
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const binding = require('kafka-crab-js-linux-loong64-musl')
|
|
360
|
+
const bindingPackageVersion = require('kafka-crab-js-linux-loong64-musl/package.json').version
|
|
361
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
|
+
}
|
|
364
|
+
return binding
|
|
365
|
+
} catch (e) {
|
|
366
|
+
loadErrors.push(e)
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
try {
|
|
370
|
+
return require('./kafka-crab-js.linux-loong64-gnu.node')
|
|
371
|
+
} catch (e) {
|
|
372
|
+
loadErrors.push(e)
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const binding = require('kafka-crab-js-linux-loong64-gnu')
|
|
376
|
+
const bindingPackageVersion = require('kafka-crab-js-linux-loong64-gnu/package.json').version
|
|
377
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
378
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
379
|
}
|
|
346
380
|
return binding
|
|
347
381
|
} catch (e) {
|
|
@@ -358,8 +392,8 @@ function requireNative() {
|
|
|
358
392
|
try {
|
|
359
393
|
const binding = require('kafka-crab-js-linux-riscv64-musl')
|
|
360
394
|
const bindingPackageVersion = require('kafka-crab-js-linux-riscv64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '2.0.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
395
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
397
|
}
|
|
364
398
|
return binding
|
|
365
399
|
} catch (e) {
|
|
@@ -374,8 +408,8 @@ function requireNative() {
|
|
|
374
408
|
try {
|
|
375
409
|
const binding = require('kafka-crab-js-linux-riscv64-gnu')
|
|
376
410
|
const bindingPackageVersion = require('kafka-crab-js-linux-riscv64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '2.0.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
411
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
412
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
413
|
}
|
|
380
414
|
return binding
|
|
381
415
|
} catch (e) {
|
|
@@ -391,8 +425,8 @@ function requireNative() {
|
|
|
391
425
|
try {
|
|
392
426
|
const binding = require('kafka-crab-js-linux-ppc64-gnu')
|
|
393
427
|
const bindingPackageVersion = require('kafka-crab-js-linux-ppc64-gnu/package.json').version
|
|
394
|
-
if (bindingPackageVersion !== '2.0.
|
|
395
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
428
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
429
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
396
430
|
}
|
|
397
431
|
return binding
|
|
398
432
|
} catch (e) {
|
|
@@ -407,8 +441,8 @@ function requireNative() {
|
|
|
407
441
|
try {
|
|
408
442
|
const binding = require('kafka-crab-js-linux-s390x-gnu')
|
|
409
443
|
const bindingPackageVersion = require('kafka-crab-js-linux-s390x-gnu/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '2.0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
444
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
445
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
446
|
}
|
|
413
447
|
return binding
|
|
414
448
|
} catch (e) {
|
|
@@ -427,8 +461,8 @@ function requireNative() {
|
|
|
427
461
|
try {
|
|
428
462
|
const binding = require('kafka-crab-js-openharmony-arm64')
|
|
429
463
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-arm64/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '2.0.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
464
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
465
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
466
|
}
|
|
433
467
|
return binding
|
|
434
468
|
} catch (e) {
|
|
@@ -443,8 +477,8 @@ function requireNative() {
|
|
|
443
477
|
try {
|
|
444
478
|
const binding = require('kafka-crab-js-openharmony-x64')
|
|
445
479
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-x64/package.json').version
|
|
446
|
-
if (bindingPackageVersion !== '2.0.
|
|
447
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
480
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
481
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
448
482
|
}
|
|
449
483
|
return binding
|
|
450
484
|
} catch (e) {
|
|
@@ -459,8 +493,8 @@ function requireNative() {
|
|
|
459
493
|
try {
|
|
460
494
|
const binding = require('kafka-crab-js-openharmony-arm')
|
|
461
495
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-arm/package.json').version
|
|
462
|
-
if (bindingPackageVersion !== '2.0.
|
|
463
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
496
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
497
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
464
498
|
}
|
|
465
499
|
return binding
|
|
466
500
|
} catch (e) {
|
|
@@ -477,22 +511,32 @@ function requireNative() {
|
|
|
477
511
|
nativeBinding = requireNative()
|
|
478
512
|
|
|
479
513
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
514
|
+
let wasiBinding = null
|
|
515
|
+
let wasiBindingError = null
|
|
480
516
|
try {
|
|
481
|
-
|
|
517
|
+
wasiBinding = require('./kafka-crab-js.wasi.cjs')
|
|
518
|
+
nativeBinding = wasiBinding
|
|
482
519
|
} catch (err) {
|
|
483
520
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
484
|
-
|
|
521
|
+
wasiBindingError = err
|
|
485
522
|
}
|
|
486
523
|
}
|
|
487
524
|
if (!nativeBinding) {
|
|
488
525
|
try {
|
|
489
|
-
|
|
526
|
+
wasiBinding = require('kafka-crab-js-wasm32-wasi')
|
|
527
|
+
nativeBinding = wasiBinding
|
|
490
528
|
} catch (err) {
|
|
491
529
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
530
|
+
wasiBindingError.cause = err
|
|
492
531
|
loadErrors.push(err)
|
|
493
532
|
}
|
|
494
533
|
}
|
|
495
534
|
}
|
|
535
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
536
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
537
|
+
error.cause = wasiBindingError
|
|
538
|
+
throw error
|
|
539
|
+
}
|
|
496
540
|
}
|
|
497
541
|
|
|
498
542
|
if (!nativeBinding) {
|
|
@@ -501,7 +545,12 @@ if (!nativeBinding) {
|
|
|
501
545
|
`Cannot find native binding. ` +
|
|
502
546
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
503
547
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
504
|
-
{
|
|
548
|
+
{
|
|
549
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
550
|
+
cur.cause = err
|
|
551
|
+
return cur
|
|
552
|
+
}),
|
|
553
|
+
},
|
|
505
554
|
)
|
|
506
555
|
}
|
|
507
556
|
throw new Error(`Failed to load native binding`)
|
package/js-binding.js
CHANGED
|
@@ -67,7 +67,7 @@ const isMuslFromChildProcess = () => {
|
|
|
67
67
|
function requireNative() {
|
|
68
68
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
69
69
|
try {
|
|
70
|
-
|
|
70
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
71
71
|
} catch (err) {
|
|
72
72
|
loadErrors.push(err)
|
|
73
73
|
}
|
|
@@ -81,8 +81,8 @@ function requireNative() {
|
|
|
81
81
|
try {
|
|
82
82
|
const binding = require('kafka-crab-js-android-arm64')
|
|
83
83
|
const bindingPackageVersion = require('kafka-crab-js-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '2.0.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
84
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
86
|
}
|
|
87
87
|
return binding
|
|
88
88
|
} catch (e) {
|
|
@@ -97,8 +97,8 @@ function requireNative() {
|
|
|
97
97
|
try {
|
|
98
98
|
const binding = require('kafka-crab-js-android-arm-eabi')
|
|
99
99
|
const bindingPackageVersion = require('kafka-crab-js-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '2.0.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
100
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -117,8 +117,8 @@ function requireNative() {
|
|
|
117
117
|
try {
|
|
118
118
|
const binding = require('kafka-crab-js-win32-x64-msvc')
|
|
119
119
|
const bindingPackageVersion = require('kafka-crab-js-win32-x64-msvc/package.json').version
|
|
120
|
-
if (bindingPackageVersion !== '2.0.
|
|
121
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
120
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
121
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
122
122
|
}
|
|
123
123
|
return binding
|
|
124
124
|
} catch (e) {
|
|
@@ -133,8 +133,8 @@ function requireNative() {
|
|
|
133
133
|
try {
|
|
134
134
|
const binding = require('kafka-crab-js-win32-ia32-msvc')
|
|
135
135
|
const bindingPackageVersion = require('kafka-crab-js-win32-ia32-msvc/package.json').version
|
|
136
|
-
if (bindingPackageVersion !== '2.0.
|
|
137
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
136
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
137
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
138
138
|
}
|
|
139
139
|
return binding
|
|
140
140
|
} catch (e) {
|
|
@@ -149,8 +149,8 @@ function requireNative() {
|
|
|
149
149
|
try {
|
|
150
150
|
const binding = require('kafka-crab-js-win32-arm64-msvc')
|
|
151
151
|
const bindingPackageVersion = require('kafka-crab-js-win32-arm64-msvc/package.json').version
|
|
152
|
-
if (bindingPackageVersion !== '2.0.
|
|
153
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
152
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
153
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
154
154
|
}
|
|
155
155
|
return binding
|
|
156
156
|
} catch (e) {
|
|
@@ -168,8 +168,8 @@ function requireNative() {
|
|
|
168
168
|
try {
|
|
169
169
|
const binding = require('kafka-crab-js-darwin-universal')
|
|
170
170
|
const bindingPackageVersion = require('kafka-crab-js-darwin-universal/package.json').version
|
|
171
|
-
if (bindingPackageVersion !== '2.0.
|
|
172
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
171
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
172
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
173
173
|
}
|
|
174
174
|
return binding
|
|
175
175
|
} catch (e) {
|
|
@@ -184,8 +184,8 @@ function requireNative() {
|
|
|
184
184
|
try {
|
|
185
185
|
const binding = require('kafka-crab-js-darwin-x64')
|
|
186
186
|
const bindingPackageVersion = require('kafka-crab-js-darwin-x64/package.json').version
|
|
187
|
-
if (bindingPackageVersion !== '2.0.
|
|
188
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
187
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
188
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
189
189
|
}
|
|
190
190
|
return binding
|
|
191
191
|
} catch (e) {
|
|
@@ -200,8 +200,8 @@ function requireNative() {
|
|
|
200
200
|
try {
|
|
201
201
|
const binding = require('kafka-crab-js-darwin-arm64')
|
|
202
202
|
const bindingPackageVersion = require('kafka-crab-js-darwin-arm64/package.json').version
|
|
203
|
-
if (bindingPackageVersion !== '2.0.
|
|
204
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
203
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
204
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
205
205
|
}
|
|
206
206
|
return binding
|
|
207
207
|
} catch (e) {
|
|
@@ -220,8 +220,8 @@ function requireNative() {
|
|
|
220
220
|
try {
|
|
221
221
|
const binding = require('kafka-crab-js-freebsd-x64')
|
|
222
222
|
const bindingPackageVersion = require('kafka-crab-js-freebsd-x64/package.json').version
|
|
223
|
-
if (bindingPackageVersion !== '2.0.
|
|
224
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
223
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
224
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
225
225
|
}
|
|
226
226
|
return binding
|
|
227
227
|
} catch (e) {
|
|
@@ -236,8 +236,8 @@ function requireNative() {
|
|
|
236
236
|
try {
|
|
237
237
|
const binding = require('kafka-crab-js-freebsd-arm64')
|
|
238
238
|
const bindingPackageVersion = require('kafka-crab-js-freebsd-arm64/package.json').version
|
|
239
|
-
if (bindingPackageVersion !== '2.0.
|
|
240
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
239
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
240
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
241
241
|
}
|
|
242
242
|
return binding
|
|
243
243
|
} catch (e) {
|
|
@@ -257,8 +257,8 @@ function requireNative() {
|
|
|
257
257
|
try {
|
|
258
258
|
const binding = require('kafka-crab-js-linux-x64-musl')
|
|
259
259
|
const bindingPackageVersion = require('kafka-crab-js-linux-x64-musl/package.json').version
|
|
260
|
-
if (bindingPackageVersion !== '2.0.
|
|
261
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
260
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
261
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
262
262
|
}
|
|
263
263
|
return binding
|
|
264
264
|
} catch (e) {
|
|
@@ -273,8 +273,8 @@ function requireNative() {
|
|
|
273
273
|
try {
|
|
274
274
|
const binding = require('kafka-crab-js-linux-x64-gnu')
|
|
275
275
|
const bindingPackageVersion = require('kafka-crab-js-linux-x64-gnu/package.json').version
|
|
276
|
-
if (bindingPackageVersion !== '2.0.
|
|
277
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
276
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
277
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
278
278
|
}
|
|
279
279
|
return binding
|
|
280
280
|
} catch (e) {
|
|
@@ -291,8 +291,8 @@ function requireNative() {
|
|
|
291
291
|
try {
|
|
292
292
|
const binding = require('kafka-crab-js-linux-arm64-musl')
|
|
293
293
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm64-musl/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '2.0.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
294
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
296
|
}
|
|
297
297
|
return binding
|
|
298
298
|
} catch (e) {
|
|
@@ -307,8 +307,8 @@ function requireNative() {
|
|
|
307
307
|
try {
|
|
308
308
|
const binding = require('kafka-crab-js-linux-arm64-gnu')
|
|
309
309
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm64-gnu/package.json').version
|
|
310
|
-
if (bindingPackageVersion !== '2.0.
|
|
311
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
310
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
311
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
312
312
|
}
|
|
313
313
|
return binding
|
|
314
314
|
} catch (e) {
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('kafka-crab-js-linux-arm-musleabihf')
|
|
327
327
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm-musleabihf/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '2.0.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
328
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
330
|
}
|
|
331
331
|
return binding
|
|
332
332
|
} catch (e) {
|
|
@@ -341,8 +341,42 @@ function requireNative() {
|
|
|
341
341
|
try {
|
|
342
342
|
const binding = require('kafka-crab-js-linux-arm-gnueabihf')
|
|
343
343
|
const bindingPackageVersion = require('kafka-crab-js-linux-arm-gnueabihf/package.json').version
|
|
344
|
-
if (bindingPackageVersion !== '2.0.
|
|
345
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
344
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
345
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
346
|
+
}
|
|
347
|
+
return binding
|
|
348
|
+
} catch (e) {
|
|
349
|
+
loadErrors.push(e)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
} else if (process.arch === 'loong64') {
|
|
353
|
+
if (isMusl()) {
|
|
354
|
+
try {
|
|
355
|
+
return require('./kafka-crab-js.linux-loong64-musl.node')
|
|
356
|
+
} catch (e) {
|
|
357
|
+
loadErrors.push(e)
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const binding = require('kafka-crab-js-linux-loong64-musl')
|
|
361
|
+
const bindingPackageVersion = require('kafka-crab-js-linux-loong64-musl/package.json').version
|
|
362
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
|
+
}
|
|
365
|
+
return binding
|
|
366
|
+
} catch (e) {
|
|
367
|
+
loadErrors.push(e)
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
try {
|
|
371
|
+
return require('./kafka-crab-js.linux-loong64-gnu.node')
|
|
372
|
+
} catch (e) {
|
|
373
|
+
loadErrors.push(e)
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
const binding = require('kafka-crab-js-linux-loong64-gnu')
|
|
377
|
+
const bindingPackageVersion = require('kafka-crab-js-linux-loong64-gnu/package.json').version
|
|
378
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
379
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
346
380
|
}
|
|
347
381
|
return binding
|
|
348
382
|
} catch (e) {
|
|
@@ -359,8 +393,8 @@ function requireNative() {
|
|
|
359
393
|
try {
|
|
360
394
|
const binding = require('kafka-crab-js-linux-riscv64-musl')
|
|
361
395
|
const bindingPackageVersion = require('kafka-crab-js-linux-riscv64-musl/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '2.0.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
396
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
398
|
}
|
|
365
399
|
return binding
|
|
366
400
|
} catch (e) {
|
|
@@ -375,8 +409,8 @@ function requireNative() {
|
|
|
375
409
|
try {
|
|
376
410
|
const binding = require('kafka-crab-js-linux-riscv64-gnu')
|
|
377
411
|
const bindingPackageVersion = require('kafka-crab-js-linux-riscv64-gnu/package.json').version
|
|
378
|
-
if (bindingPackageVersion !== '2.0.
|
|
379
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
412
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
413
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
380
414
|
}
|
|
381
415
|
return binding
|
|
382
416
|
} catch (e) {
|
|
@@ -392,8 +426,8 @@ function requireNative() {
|
|
|
392
426
|
try {
|
|
393
427
|
const binding = require('kafka-crab-js-linux-ppc64-gnu')
|
|
394
428
|
const bindingPackageVersion = require('kafka-crab-js-linux-ppc64-gnu/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '2.0.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
429
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
431
|
}
|
|
398
432
|
return binding
|
|
399
433
|
} catch (e) {
|
|
@@ -408,8 +442,8 @@ function requireNative() {
|
|
|
408
442
|
try {
|
|
409
443
|
const binding = require('kafka-crab-js-linux-s390x-gnu')
|
|
410
444
|
const bindingPackageVersion = require('kafka-crab-js-linux-s390x-gnu/package.json').version
|
|
411
|
-
if (bindingPackageVersion !== '2.0.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
445
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
446
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
413
447
|
}
|
|
414
448
|
return binding
|
|
415
449
|
} catch (e) {
|
|
@@ -428,8 +462,8 @@ function requireNative() {
|
|
|
428
462
|
try {
|
|
429
463
|
const binding = require('kafka-crab-js-openharmony-arm64')
|
|
430
464
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-arm64/package.json').version
|
|
431
|
-
if (bindingPackageVersion !== '2.0.
|
|
432
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
465
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
466
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
433
467
|
}
|
|
434
468
|
return binding
|
|
435
469
|
} catch (e) {
|
|
@@ -444,8 +478,8 @@ function requireNative() {
|
|
|
444
478
|
try {
|
|
445
479
|
const binding = require('kafka-crab-js-openharmony-x64')
|
|
446
480
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-x64/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '2.0.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
481
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
482
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
483
|
}
|
|
450
484
|
return binding
|
|
451
485
|
} catch (e) {
|
|
@@ -460,8 +494,8 @@ function requireNative() {
|
|
|
460
494
|
try {
|
|
461
495
|
const binding = require('kafka-crab-js-openharmony-arm')
|
|
462
496
|
const bindingPackageVersion = require('kafka-crab-js-openharmony-arm/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '2.0.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.
|
|
497
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
498
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
499
|
}
|
|
466
500
|
return binding
|
|
467
501
|
} catch (e) {
|
|
@@ -478,22 +512,32 @@ function requireNative() {
|
|
|
478
512
|
nativeBinding = requireNative()
|
|
479
513
|
|
|
480
514
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
515
|
+
let wasiBinding = null
|
|
516
|
+
let wasiBindingError = null
|
|
481
517
|
try {
|
|
482
|
-
|
|
518
|
+
wasiBinding = require('./kafka-crab-js.wasi.cjs')
|
|
519
|
+
nativeBinding = wasiBinding
|
|
483
520
|
} catch (err) {
|
|
484
521
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
485
|
-
|
|
522
|
+
wasiBindingError = err
|
|
486
523
|
}
|
|
487
524
|
}
|
|
488
525
|
if (!nativeBinding) {
|
|
489
526
|
try {
|
|
490
|
-
|
|
527
|
+
wasiBinding = require('kafka-crab-js-wasm32-wasi')
|
|
528
|
+
nativeBinding = wasiBinding
|
|
491
529
|
} catch (err) {
|
|
492
530
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
531
|
+
wasiBindingError.cause = err
|
|
493
532
|
loadErrors.push(err)
|
|
494
533
|
}
|
|
495
534
|
}
|
|
496
535
|
}
|
|
536
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
537
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
538
|
+
error.cause = wasiBindingError
|
|
539
|
+
throw error
|
|
540
|
+
}
|
|
497
541
|
}
|
|
498
542
|
|
|
499
543
|
if (!nativeBinding) {
|
|
@@ -502,7 +546,12 @@ if (!nativeBinding) {
|
|
|
502
546
|
`Cannot find native binding. ` +
|
|
503
547
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
504
548
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
505
|
-
{
|
|
549
|
+
{
|
|
550
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
551
|
+
cur.cause = err
|
|
552
|
+
return cur
|
|
553
|
+
}),
|
|
554
|
+
},
|
|
506
555
|
)
|
|
507
556
|
}
|
|
508
557
|
throw new Error(`Failed to load native binding`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kafka-crab-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -71,23 +71,24 @@
|
|
|
71
71
|
},
|
|
72
72
|
"packageManager": "pnpm@10.15.1",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@napi-rs/cli": "^3.
|
|
74
|
+
"@napi-rs/cli": "^3.2.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@
|
|
77
|
+
"@faker-js/faker": "^10.0.0",
|
|
78
|
+
"@types/node": "^24.3.1",
|
|
78
79
|
"dprint": "^0.50.1",
|
|
79
80
|
"esbuild": "^0.25.9",
|
|
80
81
|
"nanoid": "^5.1.5",
|
|
81
|
-
"oxlint": "^1.
|
|
82
|
+
"oxlint": "^1.15.0",
|
|
82
83
|
"rimraf": "^6.0.1",
|
|
83
84
|
"typescript": "^5.9.2"
|
|
84
85
|
},
|
|
85
86
|
"optionalDependencies": {
|
|
86
|
-
"kafka-crab-js-darwin-x64": "2.0.
|
|
87
|
-
"kafka-crab-js-darwin-arm64": "2.0.
|
|
88
|
-
"kafka-crab-js-linux-x64-gnu": "2.0.
|
|
89
|
-
"kafka-crab-js-linux-x64-musl": "2.0.
|
|
90
|
-
"kafka-crab-js-linux-arm64-gnu": "2.0.
|
|
91
|
-
"kafka-crab-js-linux-arm64-musl": "2.0.
|
|
87
|
+
"kafka-crab-js-darwin-x64": "2.0.1",
|
|
88
|
+
"kafka-crab-js-darwin-arm64": "2.0.1",
|
|
89
|
+
"kafka-crab-js-linux-x64-gnu": "2.0.1",
|
|
90
|
+
"kafka-crab-js-linux-x64-musl": "2.0.1",
|
|
91
|
+
"kafka-crab-js-linux-arm64-gnu": "2.0.1",
|
|
92
|
+
"kafka-crab-js-linux-arm64-musl": "2.0.1"
|
|
92
93
|
}
|
|
93
94
|
}
|