kafka-crab-js 1.0.5 → 1.2.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 +1 -1
- package/index.d.ts +1 -1
- package/js-binding.d.ts +17 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ A lightweight, flexible, and reliable Kafka client for JavaScript/TypeScript. It
|
|
|
24
24
|
|
|
25
25
|
1. [Installation](#installation)
|
|
26
26
|
2. [Quick Start](#quick-start)
|
|
27
|
-
3. [Consumer Examples](#consumer-
|
|
27
|
+
3. [Consumer Examples](#basic-consumer-setup)
|
|
28
28
|
4. [Producer Examples](#producer-examples)
|
|
29
29
|
5. [Stream Processing](#stream-processing)
|
|
30
30
|
6. [Configuration](#configuration)
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ConsumerConfiguration, KafkaConfiguration, KafkaCrabError, Message, MessageProducer, OffsetModel, PartitionOffset, ProducerConfiguration, ProducerRecord, RecordMetadata, RetryStrategy, TopicPartitionConfig, } from './js-binding';
|
|
1
|
+
export type { ConsumerConfiguration, KafkaConfiguration, KafkaCrabError, KafkaEvent, KafkaEventPayload, Message, MessageProducer, OffsetModel, PartitionOffset, ProducerConfiguration, ProducerRecord, RecordMetadata, RetryStrategy, TopicPartition, TopicPartitionConfig, } from './js-binding';
|
|
2
2
|
export { CommitMode, KafkaClientConfig, KafkaConsumer, KafkaProducer, PartitionPosition, SecurityProtocol, } from './js-binding';
|
|
3
3
|
export { KafkaClient } from './kafka-client';
|
|
4
4
|
export { KafkaStreamReadable } from './kafka-stream-readable';
|
package/js-binding.d.ts
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
export interface KafkaEventPayload {
|
|
7
|
+
action?: string
|
|
8
|
+
tpl: Array<TopicPartition>
|
|
9
|
+
error?: string
|
|
10
|
+
}
|
|
11
|
+
export interface KafkaEvent {
|
|
12
|
+
name: string
|
|
13
|
+
payload: KafkaEventPayload
|
|
14
|
+
}
|
|
6
15
|
export interface RetryStrategy {
|
|
7
16
|
retries: number
|
|
8
17
|
retryTopic?: string
|
|
@@ -25,7 +34,8 @@ export interface ConsumerConfiguration {
|
|
|
25
34
|
export enum PartitionPosition {
|
|
26
35
|
Beginning = 'Beginning',
|
|
27
36
|
End = 'End',
|
|
28
|
-
Stored = 'Stored'
|
|
37
|
+
Stored = 'Stored',
|
|
38
|
+
Invalid = 'Invalid'
|
|
29
39
|
}
|
|
30
40
|
export interface OffsetModel {
|
|
31
41
|
offset?: number
|
|
@@ -40,6 +50,10 @@ export interface TopicPartitionConfig {
|
|
|
40
50
|
allOffsets?: OffsetModel
|
|
41
51
|
partitionOffset?: Array<PartitionOffset>
|
|
42
52
|
}
|
|
53
|
+
export interface TopicPartition {
|
|
54
|
+
topic: string
|
|
55
|
+
partitionOffset: Array<PartitionOffset>
|
|
56
|
+
}
|
|
43
57
|
export enum SecurityProtocol {
|
|
44
58
|
Plaintext = 'Plaintext',
|
|
45
59
|
Ssl = 'Ssl',
|
|
@@ -88,12 +102,14 @@ export interface ProducerConfiguration {
|
|
|
88
102
|
configuration?: Record<string, string>
|
|
89
103
|
}
|
|
90
104
|
export declare class KafkaConsumer {
|
|
105
|
+
onEvents(callback: (error: Error | undefined, event: KafkaEvent) => void): void
|
|
91
106
|
subscribe(topicConfigs: string | Array<TopicPartitionConfig>): Promise<void>
|
|
92
107
|
pause(): void
|
|
93
108
|
resume(): void
|
|
94
109
|
unsubscribe(): void
|
|
95
110
|
shutdownConsumer(): Promise<void>
|
|
96
111
|
seek(topic: string, partition: number, offsetModel: OffsetModel, timeout?: number | undefined | null): void
|
|
112
|
+
assignment(): Array<TopicPartition>
|
|
97
113
|
recv(): Promise<Message | null>
|
|
98
114
|
commit(topic: string, partition: number, offset: number, commit: CommitMode): void
|
|
99
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kafka-crab-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"module": "commonjs",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@faker-js/faker": "9.3.0",
|
|
44
44
|
"@napi-rs/cli": "^2.18.4",
|
|
45
|
-
"@types/node": "22.10.
|
|
45
|
+
"@types/node": "22.10.5",
|
|
46
46
|
"ava": "6.2.0",
|
|
47
47
|
"dprint": "^0.48.0",
|
|
48
48
|
"nanoid": "5.0.9",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"version": "napi version",
|
|
66
66
|
"fmt": "dprint fmt"
|
|
67
67
|
},
|
|
68
|
-
"packageManager": "pnpm@9.15.
|
|
68
|
+
"packageManager": "pnpm@9.15.3",
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"kafka-crab-js-darwin-arm64": "1.
|
|
71
|
-
"kafka-crab-js-darwin-x64": "1.
|
|
72
|
-
"kafka-crab-js-linux-x64-gnu": "1.
|
|
70
|
+
"kafka-crab-js-darwin-arm64": "1.2.1",
|
|
71
|
+
"kafka-crab-js-darwin-x64": "1.2.1",
|
|
72
|
+
"kafka-crab-js-linux-x64-gnu": "1.2.1"
|
|
73
73
|
}
|
|
74
74
|
}
|