kafka-ts 0.0.3-beta → 0.0.4
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 +72 -8
- package/dist/api/api-versions.d.ts +9 -0
- package/{src/api/api-versions.ts → dist/api/api-versions.js} +8 -5
- package/dist/api/create-topics.d.ts +38 -0
- package/dist/api/create-topics.js +53 -0
- package/dist/api/delete-topics.d.ts +18 -0
- package/dist/api/delete-topics.js +33 -0
- package/dist/api/fetch.d.ts +84 -0
- package/dist/api/fetch.js +142 -0
- package/dist/api/find-coordinator.d.ts +21 -0
- package/{src/api/find-coordinator.ts → dist/api/find-coordinator.js} +14 -14
- package/dist/api/heartbeat.d.ts +11 -0
- package/dist/api/heartbeat.js +27 -0
- package/dist/api/index.d.ts +576 -0
- package/{src/api/index.ts → dist/api/index.js} +42 -41
- package/dist/api/init-producer-id.d.ts +13 -0
- package/dist/api/init-producer-id.js +29 -0
- package/dist/api/join-group.d.ts +34 -0
- package/dist/api/join-group.js +51 -0
- package/dist/api/leave-group.d.ts +19 -0
- package/dist/api/leave-group.js +39 -0
- package/dist/api/list-offsets.d.ts +29 -0
- package/dist/api/list-offsets.js +48 -0
- package/dist/api/metadata.d.ts +40 -0
- package/{src/api/metadata.ts → dist/api/metadata.js} +18 -26
- package/dist/api/offset-commit.d.ts +28 -0
- package/dist/api/offset-commit.js +48 -0
- package/dist/api/offset-fetch.d.ts +31 -0
- package/dist/api/offset-fetch.js +55 -0
- package/dist/api/produce.d.ts +54 -0
- package/{src/api/produce.ts → dist/api/produce.js} +55 -102
- package/dist/api/sasl-authenticate.d.ts +11 -0
- package/dist/api/sasl-authenticate.js +23 -0
- package/dist/api/sasl-handshake.d.ts +6 -0
- package/dist/api/sasl-handshake.js +19 -0
- package/dist/api/sync-group.d.ts +24 -0
- package/dist/api/sync-group.js +36 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/plain.d.ts +5 -0
- package/dist/auth/plain.js +12 -0
- package/dist/auth/scram.d.ts +9 -0
- package/dist/auth/scram.js +40 -0
- package/dist/broker.d.ts +30 -0
- package/dist/broker.js +55 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.js +36 -0
- package/dist/cluster.d.ts +27 -0
- package/dist/cluster.js +70 -0
- package/dist/cluster.test.d.ts +1 -0
- package/{src/cluster.test.ts → dist/cluster.test.js} +87 -113
- package/dist/codecs/gzip.d.ts +2 -0
- package/dist/codecs/gzip.js +8 -0
- package/dist/codecs/index.d.ts +2 -0
- package/dist/codecs/index.js +17 -0
- package/dist/codecs/none.d.ts +2 -0
- package/dist/codecs/none.js +7 -0
- package/dist/codecs/types.d.ts +5 -0
- package/dist/codecs/types.js +2 -0
- package/dist/connection.d.ts +26 -0
- package/dist/connection.js +175 -0
- package/dist/consumer/consumer-group.d.ts +41 -0
- package/dist/consumer/consumer-group.js +215 -0
- package/dist/consumer/consumer-metadata.d.ts +7 -0
- package/dist/consumer/consumer-metadata.js +14 -0
- package/dist/consumer/consumer.d.ts +44 -0
- package/dist/consumer/consumer.js +225 -0
- package/dist/consumer/fetch-manager.d.ts +33 -0
- package/dist/consumer/fetch-manager.js +140 -0
- package/dist/consumer/fetcher.d.ts +25 -0
- package/dist/consumer/fetcher.js +64 -0
- package/dist/consumer/offset-manager.d.ts +22 -0
- package/dist/consumer/offset-manager.js +66 -0
- package/dist/consumer/processor.d.ts +19 -0
- package/dist/consumer/processor.js +59 -0
- package/dist/distributors/assignments-to-replicas.d.ts +16 -0
- package/{src/distributors/assignments-to-replicas.ts → dist/distributors/assignments-to-replicas.js} +15 -41
- package/dist/distributors/assignments-to-replicas.test.d.ts +1 -0
- package/dist/distributors/assignments-to-replicas.test.js +40 -0
- package/dist/distributors/messages-to-topic-partition-leaders.d.ts +17 -0
- package/dist/distributors/messages-to-topic-partition-leaders.js +15 -0
- package/dist/distributors/messages-to-topic-partition-leaders.test.d.ts +1 -0
- package/dist/distributors/messages-to-topic-partition-leaders.test.js +30 -0
- package/dist/distributors/partitioner.d.ts +7 -0
- package/dist/distributors/partitioner.js +23 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -0
- package/dist/metadata.d.ts +24 -0
- package/dist/metadata.js +106 -0
- package/dist/producer/producer.d.ts +24 -0
- package/dist/producer/producer.js +131 -0
- package/{src/types.ts → dist/types.d.ts} +4 -4
- package/dist/types.js +2 -0
- package/{src/utils/api.ts → dist/utils/api.d.ts} +2 -4
- package/dist/utils/api.js +5 -0
- package/dist/utils/crypto.d.ts +8 -0
- package/dist/utils/crypto.js +18 -0
- package/dist/utils/decoder.d.ts +30 -0
- package/{src/utils/decoder.ts → dist/utils/decoder.js} +41 -57
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/delay.js +5 -0
- package/dist/utils/encoder.d.ts +28 -0
- package/{src/utils/encoder.ts → dist/utils/encoder.js} +50 -66
- package/dist/utils/error.d.ts +11 -0
- package/dist/utils/error.js +27 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/memo.d.ts +1 -0
- package/{src/utils/memo.ts → dist/utils/memo.js} +7 -3
- package/dist/utils/murmur2.d.ts +3 -0
- package/dist/utils/murmur2.js +40 -0
- package/dist/utils/retrier.d.ts +10 -0
- package/dist/utils/retrier.js +22 -0
- package/dist/utils/tracer.d.ts +5 -0
- package/dist/utils/tracer.js +39 -0
- package/package.json +11 -2
- package/.github/workflows/release.yml +0 -17
- package/.prettierrc +0 -8
- package/certs/ca.crt +0 -29
- package/certs/ca.key +0 -52
- package/certs/ca.srl +0 -1
- package/certs/kafka.crt +0 -29
- package/certs/kafka.csr +0 -26
- package/certs/kafka.key +0 -52
- package/certs/kafka.keystore.jks +0 -0
- package/certs/kafka.truststore.jks +0 -0
- package/docker-compose.yml +0 -104
- package/examples/package-lock.json +0 -31
- package/examples/package.json +0 -14
- package/examples/src/client.ts +0 -9
- package/examples/src/consumer.ts +0 -18
- package/examples/src/create-topic.ts +0 -44
- package/examples/src/producer.ts +0 -24
- package/examples/src/replicator.ts +0 -25
- package/examples/src/utils/delay.ts +0 -1
- package/examples/src/utils/json.ts +0 -1
- package/examples/tsconfig.json +0 -7
- package/log4j.properties +0 -95
- package/scripts/generate-certs.sh +0 -24
- package/src/__snapshots__/request-handler.test.ts.snap +0 -978
- package/src/api/create-topics.ts +0 -78
- package/src/api/delete-topics.ts +0 -42
- package/src/api/fetch.ts +0 -143
- package/src/api/heartbeat.ts +0 -33
- package/src/api/init-producer-id.ts +0 -35
- package/src/api/join-group.ts +0 -67
- package/src/api/leave-group.ts +0 -48
- package/src/api/list-offsets.ts +0 -65
- package/src/api/offset-commit.ts +0 -67
- package/src/api/offset-fetch.ts +0 -74
- package/src/api/sasl-authenticate.ts +0 -21
- package/src/api/sasl-handshake.ts +0 -16
- package/src/api/sync-group.ts +0 -54
- package/src/broker.ts +0 -74
- package/src/client.ts +0 -47
- package/src/cluster.ts +0 -87
- package/src/connection.ts +0 -143
- package/src/consumer/consumer-group.ts +0 -209
- package/src/consumer/consumer-metadata.ts +0 -14
- package/src/consumer/consumer.ts +0 -231
- package/src/consumer/fetch-manager.ts +0 -179
- package/src/consumer/fetcher.ts +0 -57
- package/src/consumer/offset-manager.ts +0 -93
- package/src/consumer/processor.ts +0 -47
- package/src/distributors/assignments-to-replicas.test.ts +0 -43
- package/src/distributors/messages-to-topic-partition-leaders.test.ts +0 -32
- package/src/distributors/messages-to-topic-partition-leaders.ts +0 -19
- package/src/index.ts +0 -4
- package/src/metadata.ts +0 -122
- package/src/producer/producer.ts +0 -132
- package/src/utils/debug.ts +0 -9
- package/src/utils/delay.ts +0 -1
- package/src/utils/error.ts +0 -21
- package/src/utils/retrier.ts +0 -39
- package/src/utils/tracer.ts +0 -31
- package/tsconfig.json +0 -17
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INIT_PRODUCER_ID = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.INIT_PRODUCER_ID = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 22,
|
|
8
|
+
apiVersion: 4,
|
|
9
|
+
request: (encoder, body) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(body.transactionalId)
|
|
12
|
+
.writeInt32(body.transactionTimeoutMs)
|
|
13
|
+
.writeInt64(body.producerId)
|
|
14
|
+
.writeInt16(body.producerEpoch)
|
|
15
|
+
.writeUVarInt(0),
|
|
16
|
+
response: (decoder) => {
|
|
17
|
+
const result = {
|
|
18
|
+
_tag: decoder.readTagBuffer(),
|
|
19
|
+
throttleTimeMs: decoder.readInt32(),
|
|
20
|
+
errorCode: decoder.readInt16(),
|
|
21
|
+
producerId: decoder.readInt64(),
|
|
22
|
+
producerEpoch: decoder.readInt16(),
|
|
23
|
+
_tag2: decoder.readTagBuffer(),
|
|
24
|
+
};
|
|
25
|
+
if (result.errorCode)
|
|
26
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
27
|
+
return result;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const JOIN_GROUP: import("../utils/api").Api<{
|
|
3
|
+
groupId: string;
|
|
4
|
+
sessionTimeoutMs: number;
|
|
5
|
+
rebalanceTimeoutMs: number;
|
|
6
|
+
memberId: string;
|
|
7
|
+
groupInstanceId: string | null;
|
|
8
|
+
protocolType: string;
|
|
9
|
+
protocols: {
|
|
10
|
+
name: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
version: number;
|
|
13
|
+
topics: string[];
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
reason: string | null;
|
|
17
|
+
}, {
|
|
18
|
+
_tag: void;
|
|
19
|
+
throttleTimeMs: number;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
generationId: number;
|
|
22
|
+
protocolType: string | null;
|
|
23
|
+
protocolName: string | null;
|
|
24
|
+
leader: string;
|
|
25
|
+
skipAssignment: boolean;
|
|
26
|
+
memberId: string;
|
|
27
|
+
members: {
|
|
28
|
+
memberId: string;
|
|
29
|
+
groupInstanceId: string | null;
|
|
30
|
+
metadata: Buffer;
|
|
31
|
+
_tag: void;
|
|
32
|
+
}[];
|
|
33
|
+
_tag2: void;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JOIN_GROUP = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const encoder_1 = require("../utils/encoder");
|
|
6
|
+
const error_1 = require("../utils/error");
|
|
7
|
+
exports.JOIN_GROUP = (0, api_1.createApi)({
|
|
8
|
+
apiKey: 11,
|
|
9
|
+
apiVersion: 9,
|
|
10
|
+
request: (encoder, data) => encoder
|
|
11
|
+
.writeUVarInt(0)
|
|
12
|
+
.writeCompactString(data.groupId)
|
|
13
|
+
.writeInt32(data.sessionTimeoutMs)
|
|
14
|
+
.writeInt32(data.rebalanceTimeoutMs)
|
|
15
|
+
.writeCompactString(data.memberId)
|
|
16
|
+
.writeCompactString(data.groupInstanceId)
|
|
17
|
+
.writeCompactString(data.protocolType)
|
|
18
|
+
.writeCompactArray(data.protocols, (encoder, protocol) => {
|
|
19
|
+
const metadata = new encoder_1.Encoder()
|
|
20
|
+
.writeInt16(protocol.metadata.version)
|
|
21
|
+
.writeArray(protocol.metadata.topics, (encoder, topic) => encoder.writeString(topic))
|
|
22
|
+
.writeBytes(Buffer.alloc(0))
|
|
23
|
+
.value();
|
|
24
|
+
return encoder.writeCompactString(protocol.name).writeCompactBytes(metadata).writeUVarInt(0);
|
|
25
|
+
})
|
|
26
|
+
.writeCompactString(data.reason)
|
|
27
|
+
.writeUVarInt(0),
|
|
28
|
+
response: (decoder) => {
|
|
29
|
+
const result = {
|
|
30
|
+
_tag: decoder.readTagBuffer(),
|
|
31
|
+
throttleTimeMs: decoder.readInt32(),
|
|
32
|
+
errorCode: decoder.readInt16(),
|
|
33
|
+
generationId: decoder.readInt32(),
|
|
34
|
+
protocolType: decoder.readCompactString(),
|
|
35
|
+
protocolName: decoder.readCompactString(),
|
|
36
|
+
leader: decoder.readCompactString(),
|
|
37
|
+
skipAssignment: decoder.readBoolean(),
|
|
38
|
+
memberId: decoder.readCompactString(),
|
|
39
|
+
members: decoder.readCompactArray((decoder) => ({
|
|
40
|
+
memberId: decoder.readCompactString(),
|
|
41
|
+
groupInstanceId: decoder.readCompactString(),
|
|
42
|
+
metadata: decoder.readCompactBytes(),
|
|
43
|
+
_tag: decoder.readTagBuffer(),
|
|
44
|
+
})),
|
|
45
|
+
_tag2: decoder.readTagBuffer(),
|
|
46
|
+
};
|
|
47
|
+
if (result.errorCode)
|
|
48
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
49
|
+
return result;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const LEAVE_GROUP: import("../utils/api").Api<{
|
|
2
|
+
groupId: string;
|
|
3
|
+
members: {
|
|
4
|
+
memberId: string;
|
|
5
|
+
groupInstanceId: string | null;
|
|
6
|
+
reason: string | null;
|
|
7
|
+
}[];
|
|
8
|
+
}, {
|
|
9
|
+
_tag: void;
|
|
10
|
+
throttleTimeMs: number;
|
|
11
|
+
errorCode: number;
|
|
12
|
+
members: {
|
|
13
|
+
memberId: string;
|
|
14
|
+
groupInstanceId: string | null;
|
|
15
|
+
errorCode: number;
|
|
16
|
+
_tag: void;
|
|
17
|
+
}[];
|
|
18
|
+
_tag2: void;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEAVE_GROUP = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.LEAVE_GROUP = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 13,
|
|
8
|
+
apiVersion: 5,
|
|
9
|
+
request: (encoder, body) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(body.groupId)
|
|
12
|
+
.writeCompactArray(body.members, (encoder, member) => encoder
|
|
13
|
+
.writeCompactString(member.memberId)
|
|
14
|
+
.writeCompactString(member.groupInstanceId)
|
|
15
|
+
.writeCompactString(member.reason)
|
|
16
|
+
.writeUVarInt(0))
|
|
17
|
+
.writeUVarInt(0),
|
|
18
|
+
response: (decoder) => {
|
|
19
|
+
const result = {
|
|
20
|
+
_tag: decoder.readTagBuffer(),
|
|
21
|
+
throttleTimeMs: decoder.readInt32(),
|
|
22
|
+
errorCode: decoder.readInt16(),
|
|
23
|
+
members: decoder.readCompactArray((decoder) => ({
|
|
24
|
+
memberId: decoder.readCompactString(),
|
|
25
|
+
groupInstanceId: decoder.readCompactString(),
|
|
26
|
+
errorCode: decoder.readInt16(),
|
|
27
|
+
_tag: decoder.readTagBuffer(),
|
|
28
|
+
})),
|
|
29
|
+
_tag2: decoder.readTagBuffer(),
|
|
30
|
+
};
|
|
31
|
+
if (result.errorCode)
|
|
32
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
33
|
+
result.members.forEach((member) => {
|
|
34
|
+
if (member.errorCode)
|
|
35
|
+
throw new error_1.KafkaTSApiError(member.errorCode, null, result);
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IsolationLevel } from './fetch';
|
|
2
|
+
export declare const LIST_OFFSETS: import("../utils/api").Api<{
|
|
3
|
+
replicaId: number;
|
|
4
|
+
isolationLevel: IsolationLevel;
|
|
5
|
+
topics: {
|
|
6
|
+
name: string;
|
|
7
|
+
partitions: {
|
|
8
|
+
partitionIndex: number;
|
|
9
|
+
currentLeaderEpoch: number;
|
|
10
|
+
timestamp: bigint;
|
|
11
|
+
}[];
|
|
12
|
+
}[];
|
|
13
|
+
}, {
|
|
14
|
+
_tag: void;
|
|
15
|
+
throttleTimeMs: number;
|
|
16
|
+
topics: {
|
|
17
|
+
name: string;
|
|
18
|
+
partitions: {
|
|
19
|
+
partitionIndex: number;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
timestamp: bigint;
|
|
22
|
+
offset: bigint;
|
|
23
|
+
leaderEpoch: number;
|
|
24
|
+
_tag: void;
|
|
25
|
+
}[];
|
|
26
|
+
_tag: void;
|
|
27
|
+
}[];
|
|
28
|
+
_tag2: void;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LIST_OFFSETS = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.LIST_OFFSETS = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 2,
|
|
8
|
+
apiVersion: 8,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeInt32(data.replicaId)
|
|
12
|
+
.writeInt8(data.isolationLevel)
|
|
13
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder
|
|
14
|
+
.writeCompactString(topic.name)
|
|
15
|
+
.writeCompactArray(topic.partitions, (encoder, partition) => encoder
|
|
16
|
+
.writeInt32(partition.partitionIndex)
|
|
17
|
+
.writeInt32(partition.currentLeaderEpoch)
|
|
18
|
+
.writeInt64(partition.timestamp)
|
|
19
|
+
.writeUVarInt(0))
|
|
20
|
+
.writeUVarInt(0))
|
|
21
|
+
.writeUVarInt(0),
|
|
22
|
+
response: (decoder) => {
|
|
23
|
+
const result = {
|
|
24
|
+
_tag: decoder.readTagBuffer(),
|
|
25
|
+
throttleTimeMs: decoder.readInt32(),
|
|
26
|
+
topics: decoder.readCompactArray((decoder) => ({
|
|
27
|
+
name: decoder.readCompactString(),
|
|
28
|
+
partitions: decoder.readCompactArray((decoder) => ({
|
|
29
|
+
partitionIndex: decoder.readInt32(),
|
|
30
|
+
errorCode: decoder.readInt16(),
|
|
31
|
+
timestamp: decoder.readInt64(),
|
|
32
|
+
offset: decoder.readInt64(),
|
|
33
|
+
leaderEpoch: decoder.readInt32(),
|
|
34
|
+
_tag: decoder.readTagBuffer(),
|
|
35
|
+
})),
|
|
36
|
+
_tag: decoder.readTagBuffer(),
|
|
37
|
+
})),
|
|
38
|
+
_tag2: decoder.readTagBuffer(),
|
|
39
|
+
};
|
|
40
|
+
result.topics.forEach((topic) => {
|
|
41
|
+
topic.partitions.forEach((partition) => {
|
|
42
|
+
if (partition.errorCode)
|
|
43
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type Metadata = Awaited<ReturnType<(typeof METADATA)['response']>>;
|
|
2
|
+
export declare const METADATA: import("../utils/api").Api<{
|
|
3
|
+
topics: {
|
|
4
|
+
id: string | null;
|
|
5
|
+
name: string;
|
|
6
|
+
}[] | null;
|
|
7
|
+
allowTopicAutoCreation: boolean;
|
|
8
|
+
includeTopicAuthorizedOperations: boolean;
|
|
9
|
+
}, {
|
|
10
|
+
_tag: void;
|
|
11
|
+
throttleTimeMs: number;
|
|
12
|
+
brokers: {
|
|
13
|
+
nodeId: number;
|
|
14
|
+
host: string;
|
|
15
|
+
port: number;
|
|
16
|
+
rack: string | null;
|
|
17
|
+
_tag: void;
|
|
18
|
+
}[];
|
|
19
|
+
clusterId: string | null;
|
|
20
|
+
controllerId: number;
|
|
21
|
+
topics: {
|
|
22
|
+
errorCode: number;
|
|
23
|
+
name: string;
|
|
24
|
+
topicId: string;
|
|
25
|
+
isInternal: boolean;
|
|
26
|
+
partitions: {
|
|
27
|
+
errorCode: number;
|
|
28
|
+
partitionIndex: number;
|
|
29
|
+
leaderId: number;
|
|
30
|
+
leaderEpoch: number;
|
|
31
|
+
replicaNodes: number[];
|
|
32
|
+
isrNodes: number[];
|
|
33
|
+
offlineReplicas: number[];
|
|
34
|
+
_tag: void;
|
|
35
|
+
}[];
|
|
36
|
+
topicAuthorizedOperations: number;
|
|
37
|
+
_tag: void;
|
|
38
|
+
}[];
|
|
39
|
+
_tag2: void;
|
|
40
|
+
}>;
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.METADATA = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.METADATA = (0, api_1.createApi)({
|
|
7
7
|
apiKey: 3,
|
|
8
8
|
apiVersion: 12,
|
|
9
|
-
request: (
|
|
10
|
-
|
|
11
|
-
data
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
) =>
|
|
17
|
-
encoder
|
|
18
|
-
.writeUVarInt(0)
|
|
19
|
-
.writeCompactArray(data.topics, (encoder, topic) =>
|
|
20
|
-
encoder.writeUUID(topic.id).writeCompactString(topic.name).writeUVarInt(0),
|
|
21
|
-
)
|
|
22
|
-
.writeBoolean(data.allowTopicAutoCreation)
|
|
23
|
-
.writeBoolean(data.includeTopicAuthorizedOperations)
|
|
24
|
-
.writeUVarInt(0),
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder.writeUUID(topic.id).writeCompactString(topic.name).writeUVarInt(0))
|
|
12
|
+
.writeBoolean(data.allowTopicAutoCreation)
|
|
13
|
+
.writeBoolean(data.includeTopicAuthorizedOperations)
|
|
14
|
+
.writeUVarInt(0),
|
|
25
15
|
response: (decoder) => {
|
|
26
16
|
const result = {
|
|
27
17
|
_tag: decoder.readTagBuffer(),
|
|
28
18
|
throttleTimeMs: decoder.readInt32(),
|
|
29
19
|
brokers: decoder.readCompactArray((broker) => ({
|
|
30
20
|
nodeId: broker.readInt32(),
|
|
31
|
-
host: broker.readCompactString()
|
|
21
|
+
host: broker.readCompactString(),
|
|
32
22
|
port: broker.readInt32(),
|
|
33
23
|
rack: broker.readCompactString(),
|
|
34
24
|
_tag: broker.readTagBuffer(),
|
|
@@ -37,7 +27,7 @@ export const METADATA = createApi({
|
|
|
37
27
|
controllerId: decoder.readInt32(),
|
|
38
28
|
topics: decoder.readCompactArray((topic) => ({
|
|
39
29
|
errorCode: topic.readInt16(),
|
|
40
|
-
name: topic.readCompactString()
|
|
30
|
+
name: topic.readCompactString(),
|
|
41
31
|
topicId: topic.readUUID(),
|
|
42
32
|
isInternal: topic.readBoolean(),
|
|
43
33
|
partitions: topic.readCompactArray((partition) => ({
|
|
@@ -56,9 +46,11 @@ export const METADATA = createApi({
|
|
|
56
46
|
_tag2: decoder.readTagBuffer(),
|
|
57
47
|
};
|
|
58
48
|
result.topics.forEach((topic) => {
|
|
59
|
-
if (topic.errorCode)
|
|
49
|
+
if (topic.errorCode)
|
|
50
|
+
throw new error_1.KafkaTSApiError(topic.errorCode, null, result);
|
|
60
51
|
topic.partitions.forEach((partition) => {
|
|
61
|
-
if (partition.errorCode)
|
|
52
|
+
if (partition.errorCode)
|
|
53
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
62
54
|
});
|
|
63
55
|
});
|
|
64
56
|
return result;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const OFFSET_COMMIT: import("../utils/api").Api<{
|
|
2
|
+
groupId: string;
|
|
3
|
+
generationIdOrMemberEpoch: number;
|
|
4
|
+
memberId: string;
|
|
5
|
+
groupInstanceId: string | null;
|
|
6
|
+
topics: {
|
|
7
|
+
name: string;
|
|
8
|
+
partitions: {
|
|
9
|
+
partitionIndex: number;
|
|
10
|
+
committedOffset: bigint;
|
|
11
|
+
committedLeaderEpoch: number;
|
|
12
|
+
committedMetadata: string | null;
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
}, {
|
|
16
|
+
_tag: void;
|
|
17
|
+
throttleTimeMs: number;
|
|
18
|
+
topics: {
|
|
19
|
+
name: string | null;
|
|
20
|
+
partitions: {
|
|
21
|
+
partitionIndex: number;
|
|
22
|
+
errorCode: number;
|
|
23
|
+
_tag: void;
|
|
24
|
+
}[];
|
|
25
|
+
_tag: void;
|
|
26
|
+
}[];
|
|
27
|
+
_tag2: void;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OFFSET_COMMIT = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.OFFSET_COMMIT = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 8,
|
|
8
|
+
apiVersion: 8,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(data.groupId)
|
|
12
|
+
.writeInt32(data.generationIdOrMemberEpoch)
|
|
13
|
+
.writeCompactString(data.memberId)
|
|
14
|
+
.writeCompactString(data.groupInstanceId)
|
|
15
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder
|
|
16
|
+
.writeCompactString(topic.name)
|
|
17
|
+
.writeCompactArray(topic.partitions, (encoder, partition) => encoder
|
|
18
|
+
.writeInt32(partition.partitionIndex)
|
|
19
|
+
.writeInt64(partition.committedOffset)
|
|
20
|
+
.writeInt32(partition.committedLeaderEpoch)
|
|
21
|
+
.writeCompactString(partition.committedMetadata)
|
|
22
|
+
.writeUVarInt(0))
|
|
23
|
+
.writeUVarInt(0))
|
|
24
|
+
.writeUVarInt(0),
|
|
25
|
+
response: (decoder) => {
|
|
26
|
+
const result = {
|
|
27
|
+
_tag: decoder.readTagBuffer(),
|
|
28
|
+
throttleTimeMs: decoder.readInt32(),
|
|
29
|
+
topics: decoder.readCompactArray((decoder) => ({
|
|
30
|
+
name: decoder.readCompactString(),
|
|
31
|
+
partitions: decoder.readCompactArray((decoder) => ({
|
|
32
|
+
partitionIndex: decoder.readInt32(),
|
|
33
|
+
errorCode: decoder.readInt16(),
|
|
34
|
+
_tag: decoder.readTagBuffer(),
|
|
35
|
+
})),
|
|
36
|
+
_tag: decoder.readTagBuffer(),
|
|
37
|
+
})),
|
|
38
|
+
_tag2: decoder.readTagBuffer(),
|
|
39
|
+
};
|
|
40
|
+
result.topics.forEach((topic) => {
|
|
41
|
+
topic.partitions.forEach((partition) => {
|
|
42
|
+
if (partition.errorCode)
|
|
43
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const OFFSET_FETCH: import("../utils/api").Api<{
|
|
2
|
+
groups: {
|
|
3
|
+
groupId: string;
|
|
4
|
+
topics: {
|
|
5
|
+
name: string;
|
|
6
|
+
partitionIndexes: number[];
|
|
7
|
+
}[];
|
|
8
|
+
}[];
|
|
9
|
+
requireStable: boolean;
|
|
10
|
+
}, {
|
|
11
|
+
_tag: void;
|
|
12
|
+
throttleTimeMs: number;
|
|
13
|
+
groups: {
|
|
14
|
+
groupId: string | null;
|
|
15
|
+
topics: {
|
|
16
|
+
name: string;
|
|
17
|
+
partitions: {
|
|
18
|
+
partitionIndex: number;
|
|
19
|
+
committedOffset: bigint;
|
|
20
|
+
committedLeaderEpoch: number;
|
|
21
|
+
committedMetadata: string | null;
|
|
22
|
+
errorCode: number;
|
|
23
|
+
_tag: void;
|
|
24
|
+
}[];
|
|
25
|
+
_tag: void;
|
|
26
|
+
}[];
|
|
27
|
+
errorCode: number;
|
|
28
|
+
_tag: void;
|
|
29
|
+
}[];
|
|
30
|
+
_tag2: void;
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OFFSET_FETCH = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.OFFSET_FETCH = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 9,
|
|
8
|
+
apiVersion: 8,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactArray(data.groups, (encoder, group) => encoder
|
|
12
|
+
.writeCompactString(group.groupId)
|
|
13
|
+
.writeCompactArray(group.topics, (encoder, topic) => encoder
|
|
14
|
+
.writeCompactString(topic.name)
|
|
15
|
+
.writeCompactArray(topic.partitionIndexes, (encoder, partitionIndex) => encoder.writeInt32(partitionIndex))
|
|
16
|
+
.writeUVarInt(0))
|
|
17
|
+
.writeUVarInt(0))
|
|
18
|
+
.writeBoolean(data.requireStable)
|
|
19
|
+
.writeUVarInt(0),
|
|
20
|
+
response: (decoder) => {
|
|
21
|
+
const result = {
|
|
22
|
+
_tag: decoder.readTagBuffer(),
|
|
23
|
+
throttleTimeMs: decoder.readInt32(),
|
|
24
|
+
groups: decoder.readCompactArray((decoder) => ({
|
|
25
|
+
groupId: decoder.readCompactString(),
|
|
26
|
+
topics: decoder.readCompactArray((decoder) => ({
|
|
27
|
+
name: decoder.readCompactString(),
|
|
28
|
+
partitions: decoder.readCompactArray((decoder) => ({
|
|
29
|
+
partitionIndex: decoder.readInt32(),
|
|
30
|
+
committedOffset: decoder.readInt64(),
|
|
31
|
+
committedLeaderEpoch: decoder.readInt32(),
|
|
32
|
+
committedMetadata: decoder.readCompactString(),
|
|
33
|
+
errorCode: decoder.readInt16(),
|
|
34
|
+
_tag: decoder.readTagBuffer(),
|
|
35
|
+
})),
|
|
36
|
+
_tag: decoder.readTagBuffer(),
|
|
37
|
+
})),
|
|
38
|
+
errorCode: decoder.readInt16(),
|
|
39
|
+
_tag: decoder.readTagBuffer(),
|
|
40
|
+
})),
|
|
41
|
+
_tag2: decoder.readTagBuffer(),
|
|
42
|
+
};
|
|
43
|
+
result.groups.forEach((group) => {
|
|
44
|
+
if (group.errorCode)
|
|
45
|
+
throw new error_1.KafkaTSApiError(group.errorCode, null, result);
|
|
46
|
+
group.topics.forEach((topic) => {
|
|
47
|
+
topic.partitions.forEach((partition) => {
|
|
48
|
+
if (partition.errorCode)
|
|
49
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return result;
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const PRODUCE: import("../utils/api.js").Api<{
|
|
3
|
+
transactionalId: string | null;
|
|
4
|
+
acks: number;
|
|
5
|
+
timeoutMs: number;
|
|
6
|
+
topicData: {
|
|
7
|
+
name: string;
|
|
8
|
+
partitionData: {
|
|
9
|
+
index: number;
|
|
10
|
+
baseOffset: bigint;
|
|
11
|
+
partitionLeaderEpoch: number;
|
|
12
|
+
attributes: number;
|
|
13
|
+
lastOffsetDelta: number;
|
|
14
|
+
baseTimestamp: bigint;
|
|
15
|
+
maxTimestamp: bigint;
|
|
16
|
+
producerId: bigint;
|
|
17
|
+
producerEpoch: number;
|
|
18
|
+
baseSequence: number;
|
|
19
|
+
records: {
|
|
20
|
+
attributes: number;
|
|
21
|
+
timestampDelta: bigint;
|
|
22
|
+
offsetDelta: number;
|
|
23
|
+
key: Buffer | null;
|
|
24
|
+
value: Buffer | null;
|
|
25
|
+
headers: {
|
|
26
|
+
key: Buffer;
|
|
27
|
+
value: Buffer;
|
|
28
|
+
}[];
|
|
29
|
+
}[];
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
}, {
|
|
33
|
+
_tag: void;
|
|
34
|
+
responses: {
|
|
35
|
+
name: string | null;
|
|
36
|
+
partitionResponses: {
|
|
37
|
+
index: number;
|
|
38
|
+
errorCode: number;
|
|
39
|
+
baseOffset: bigint;
|
|
40
|
+
logAppendTime: bigint;
|
|
41
|
+
logStartOffset: bigint;
|
|
42
|
+
recordErrors: {
|
|
43
|
+
batchIndex: number;
|
|
44
|
+
batchIndexError: number;
|
|
45
|
+
_tag: void;
|
|
46
|
+
}[];
|
|
47
|
+
errorMessage: string | null;
|
|
48
|
+
_tag: void;
|
|
49
|
+
}[];
|
|
50
|
+
_tag: void;
|
|
51
|
+
}[];
|
|
52
|
+
throttleTimeMs: number;
|
|
53
|
+
_tag2: void;
|
|
54
|
+
}>;
|