@platformatic/kafka 0.1.0
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/LICENSE +201 -0
- package/README.md +270 -0
- package/dist/apis/admin/alter-client-quotas.d.ts +33 -0
- package/dist/apis/admin/alter-client-quotas.js +64 -0
- package/dist/apis/admin/alter-configs.d.ts +26 -0
- package/dist/apis/admin/alter-configs.js +57 -0
- package/dist/apis/admin/alter-partition-reassignments.d.ts +30 -0
- package/dist/apis/admin/alter-partition-reassignments.js +68 -0
- package/dist/apis/admin/alter-partition.d.ts +39 -0
- package/dist/apis/admin/alter-partition.js +87 -0
- package/dist/apis/admin/alter-replica-log-dirs.d.ts +26 -0
- package/dist/apis/admin/alter-replica-log-dirs.js +55 -0
- package/dist/apis/admin/alter-user-scram-credentials.d.ts +27 -0
- package/dist/apis/admin/alter-user-scram-credentials.js +60 -0
- package/dist/apis/admin/consumer-group-describe.d.ts +41 -0
- package/dist/apis/admin/consumer-group-describe.js +103 -0
- package/dist/apis/admin/create-acls.d.ts +24 -0
- package/dist/apis/admin/create-acls.js +55 -0
- package/dist/apis/admin/create-delegation-token.d.ts +24 -0
- package/dist/apis/admin/create-delegation-token.js +54 -0
- package/dist/apis/admin/create-partitions.d.ts +24 -0
- package/dist/apis/admin/create-partitions.js +54 -0
- package/dist/apis/admin/create-topics.d.ts +42 -0
- package/dist/apis/admin/create-topics.js +86 -0
- package/dist/apis/admin/delete-acls.d.ts +36 -0
- package/dist/apis/admin/delete-acls.js +82 -0
- package/dist/apis/admin/delete-groups.d.ts +14 -0
- package/dist/apis/admin/delete-groups.js +40 -0
- package/dist/apis/admin/delete-records.d.ts +27 -0
- package/dist/apis/admin/delete-records.js +59 -0
- package/dist/apis/admin/delete-topics.d.ts +21 -0
- package/dist/apis/admin/delete-topics.js +50 -0
- package/dist/apis/admin/describe-acls.d.ts +25 -0
- package/dist/apis/admin/describe-acls.js +66 -0
- package/dist/apis/admin/describe-client-quotas.d.ts +30 -0
- package/dist/apis/admin/describe-client-quotas.js +57 -0
- package/dist/apis/admin/describe-cluster.d.ts +23 -0
- package/dist/apis/admin/describe-cluster.js +50 -0
- package/dist/apis/admin/describe-configs.d.ts +38 -0
- package/dist/apis/admin/describe-configs.js +85 -0
- package/dist/apis/admin/describe-delegation-token.d.ts +31 -0
- package/dist/apis/admin/describe-delegation-token.js +62 -0
- package/dist/apis/admin/describe-groups.d.ts +28 -0
- package/dist/apis/admin/describe-groups.js +67 -0
- package/dist/apis/admin/describe-log-dirs.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs.js +75 -0
- package/dist/apis/admin/describe-producers.d.ts +33 -0
- package/dist/apis/admin/describe-producers.js +70 -0
- package/dist/apis/admin/describe-quorum.d.ts +50 -0
- package/dist/apis/admin/describe-quorum.js +116 -0
- package/dist/apis/admin/describe-topic-partitions.d.ts +42 -0
- package/dist/apis/admin/describe-topic-partitions.js +94 -0
- package/dist/apis/admin/describe-transactions.d.ts +24 -0
- package/dist/apis/admin/describe-transactions.js +59 -0
- package/dist/apis/admin/describe-user-scram-credentials.d.ts +26 -0
- package/dist/apis/admin/describe-user-scram-credentials.js +62 -0
- package/dist/apis/admin/envelope.d.ts +10 -0
- package/dist/apis/admin/envelope.js +32 -0
- package/dist/apis/admin/expire-delegation-token.d.ts +11 -0
- package/dist/apis/admin/expire-delegation-token.js +29 -0
- package/dist/apis/admin/incremental-alter-configs.d.ts +27 -0
- package/dist/apis/admin/incremental-alter-configs.js +58 -0
- package/dist/apis/admin/index.d.ts +37 -0
- package/dist/apis/admin/index.js +37 -0
- package/dist/apis/admin/list-groups.d.ts +18 -0
- package/dist/apis/admin/list-groups.js +43 -0
- package/dist/apis/admin/list-partition-reassignments.d.ts +27 -0
- package/dist/apis/admin/list-partition-reassignments.js +56 -0
- package/dist/apis/admin/list-transactions.d.ts +18 -0
- package/dist/apis/admin/list-transactions.js +45 -0
- package/dist/apis/admin/offset-delete.d.ts +26 -0
- package/dist/apis/admin/offset-delete.js +59 -0
- package/dist/apis/admin/renew-delegation-token.d.ts +11 -0
- package/dist/apis/admin/renew-delegation-token.js +29 -0
- package/dist/apis/admin/unregister-broker.d.ts +12 -0
- package/dist/apis/admin/unregister-broker.js +28 -0
- package/dist/apis/admin/update-features.d.ts +23 -0
- package/dist/apis/admin/update-features.js +60 -0
- package/dist/apis/consumer/consumer-group-heartbeat.d.ts +27 -0
- package/dist/apis/consumer/consumer-group-heartbeat.js +70 -0
- package/dist/apis/consumer/fetch.d.ts +46 -0
- package/dist/apis/consumer/fetch.js +121 -0
- package/dist/apis/consumer/heartbeat.d.ts +11 -0
- package/dist/apis/consumer/heartbeat.js +34 -0
- package/dist/apis/consumer/index.d.ts +9 -0
- package/dist/apis/consumer/index.js +9 -0
- package/dist/apis/consumer/join-group.d.ts +27 -0
- package/dist/apis/consumer/join-group.js +71 -0
- package/dist/apis/consumer/leave-group.d.ts +22 -0
- package/dist/apis/consumer/leave-group.js +57 -0
- package/dist/apis/consumer/list-offsets.d.ts +30 -0
- package/dist/apis/consumer/list-offsets.js +68 -0
- package/dist/apis/consumer/offset-commit.d.ts +29 -0
- package/dist/apis/consumer/offset-commit.js +68 -0
- package/dist/apis/consumer/offset-fetch.d.ts +37 -0
- package/dist/apis/consumer/offset-fetch.js +81 -0
- package/dist/apis/consumer/sync-group.d.ts +18 -0
- package/dist/apis/consumer/sync-group.js +49 -0
- package/dist/apis/definitions.d.ts +16 -0
- package/dist/apis/definitions.js +12 -0
- package/dist/apis/enumerations.d.ts +114 -0
- package/dist/apis/enumerations.js +78 -0
- package/dist/apis/index.d.ts +8 -0
- package/dist/apis/index.js +10 -0
- package/dist/apis/metadata/api-versions.d.ts +17 -0
- package/dist/apis/metadata/api-versions.js +41 -0
- package/dist/apis/metadata/find-coordinator.d.ts +19 -0
- package/dist/apis/metadata/find-coordinator.js +50 -0
- package/dist/apis/metadata/index.d.ts +3 -0
- package/dist/apis/metadata/index.js +3 -0
- package/dist/apis/metadata/metadata.d.ts +37 -0
- package/dist/apis/metadata/metadata.js +92 -0
- package/dist/apis/producer/add-offsets-to-txn.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn.js +34 -0
- package/dist/apis/producer/add-partitions-to-txn.d.ts +34 -0
- package/dist/apis/producer/add-partitions-to-txn.js +79 -0
- package/dist/apis/producer/end-txn.d.ts +10 -0
- package/dist/apis/producer/end-txn.js +34 -0
- package/dist/apis/producer/index.d.ts +6 -0
- package/dist/apis/producer/index.js +6 -0
- package/dist/apis/producer/init-producer-id.d.ts +21 -0
- package/dist/apis/producer/init-producer-id.js +38 -0
- package/dist/apis/producer/produce.d.ts +29 -0
- package/dist/apis/producer/produce.js +104 -0
- package/dist/apis/producer/txn-offset-commit.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit.js +77 -0
- package/dist/apis/security/index.d.ts +2 -0
- package/dist/apis/security/index.js +2 -0
- package/dist/apis/security/sasl-authenticate.d.ts +15 -0
- package/dist/apis/security/sasl-authenticate.js +30 -0
- package/dist/apis/security/sasl-handshake.d.ts +10 -0
- package/dist/apis/security/sasl-handshake.js +28 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.d.ts +18 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.js +46 -0
- package/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/apis/telemetry/index.js +3 -0
- package/dist/apis/telemetry/list-client-metrics-resources.d.ts +14 -0
- package/dist/apis/telemetry/list-client-metrics-resources.js +32 -0
- package/dist/apis/telemetry/push-telemetry.d.ts +10 -0
- package/dist/apis/telemetry/push-telemetry.js +36 -0
- package/dist/clients/admin/admin.d.ts +18 -0
- package/dist/clients/admin/admin.js +322 -0
- package/dist/clients/admin/index.d.ts +3 -0
- package/dist/clients/admin/index.js +3 -0
- package/dist/clients/admin/options.d.ts +135 -0
- package/dist/clients/admin/options.js +81 -0
- package/dist/clients/admin/types.d.ts +56 -0
- package/dist/clients/admin/types.js +1 -0
- package/dist/clients/base/base.d.ts +48 -0
- package/dist/clients/base/base.js +242 -0
- package/dist/clients/base/index.d.ts +3 -0
- package/dist/clients/base/index.js +3 -0
- package/dist/clients/base/options.d.ts +115 -0
- package/dist/clients/base/options.js +59 -0
- package/dist/clients/base/types.d.ts +38 -0
- package/dist/clients/base/types.js +1 -0
- package/dist/clients/callbacks.d.ts +8 -0
- package/dist/clients/callbacks.js +42 -0
- package/dist/clients/consumer/consumer.d.ts +33 -0
- package/dist/clients/consumer/consumer.js +767 -0
- package/dist/clients/consumer/index.d.ts +5 -0
- package/dist/clients/consumer/index.js +5 -0
- package/dist/clients/consumer/messages-stream.d.ts +56 -0
- package/dist/clients/consumer/messages-stream.js +404 -0
- package/dist/clients/consumer/options.d.ts +521 -0
- package/dist/clients/consumer/options.js +177 -0
- package/dist/clients/consumer/topics-map.d.ts +8 -0
- package/dist/clients/consumer/topics-map.js +48 -0
- package/dist/clients/consumer/types.d.ts +74 -0
- package/dist/clients/consumer/types.js +11 -0
- package/dist/clients/index.d.ts +6 -0
- package/dist/clients/index.js +6 -0
- package/dist/clients/producer/index.d.ts +3 -0
- package/dist/clients/producer/index.js +3 -0
- package/dist/clients/producer/options.d.ts +122 -0
- package/dist/clients/producer/options.js +47 -0
- package/dist/clients/producer/producer.d.ts +13 -0
- package/dist/clients/producer/producer.js +272 -0
- package/dist/clients/producer/types.d.ts +29 -0
- package/dist/clients/producer/types.js +1 -0
- package/dist/clients/serde.d.ts +40 -0
- package/dist/clients/serde.js +49 -0
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +160 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/network/connection-pool.d.ts +11 -0
- package/dist/network/connection-pool.js +101 -0
- package/dist/network/connection.d.ts +49 -0
- package/dist/network/connection.js +319 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +2 -0
- package/dist/protocol/apis.d.ts +2 -0
- package/dist/protocol/apis.js +191 -0
- package/dist/protocol/compression.d.ts +70 -0
- package/dist/protocol/compression.js +114 -0
- package/dist/protocol/crc32c.d.ts +2 -0
- package/dist/protocol/crc32c.js +83 -0
- package/dist/protocol/definitions.d.ts +12 -0
- package/dist/protocol/definitions.js +11 -0
- package/dist/protocol/dynamic-buffer.d.ts +65 -0
- package/dist/protocol/dynamic-buffer.js +557 -0
- package/dist/protocol/errors.d.ts +8 -0
- package/dist/protocol/errors.js +908 -0
- package/dist/protocol/index.d.ts +14 -0
- package/dist/protocol/index.js +14 -0
- package/dist/protocol/murmur2.d.ts +1 -0
- package/dist/protocol/murmur2.js +55 -0
- package/dist/protocol/reader.d.ts +58 -0
- package/dist/protocol/reader.js +296 -0
- package/dist/protocol/records.d.ts +110 -0
- package/dist/protocol/records.js +149 -0
- package/dist/protocol/sasl/plain.d.ts +3 -0
- package/dist/protocol/sasl/plain.js +3 -0
- package/dist/protocol/sasl/scram-sha.d.ts +28 -0
- package/dist/protocol/sasl/scram-sha.js +104 -0
- package/dist/protocol/varint.d.ts +12 -0
- package/dist/protocol/varint.js +36 -0
- package/dist/protocol/writer.d.ts +48 -0
- package/dist/protocol/writer.js +223 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +127 -0
- package/package.json +75 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { type RecordsBatch } from '../../protocol/records.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface FetchRequestPartition {
|
|
5
|
+
partition: number;
|
|
6
|
+
currentLeaderEpoch: number;
|
|
7
|
+
fetchOffset: bigint;
|
|
8
|
+
lastFetchedEpoch: number;
|
|
9
|
+
partitionMaxBytes: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FetchRequestTopic {
|
|
12
|
+
topicId: string;
|
|
13
|
+
partitions: FetchRequestPartition[];
|
|
14
|
+
}
|
|
15
|
+
export interface FetchRequestForgottenTopicsData {
|
|
16
|
+
topic: string;
|
|
17
|
+
partitions: number[];
|
|
18
|
+
}
|
|
19
|
+
export type FetchRequest = Parameters<typeof createRequest>;
|
|
20
|
+
export interface FetchResponsePartitionAbortedTransaction {
|
|
21
|
+
producerId: bigint;
|
|
22
|
+
firstOffset: bigint;
|
|
23
|
+
}
|
|
24
|
+
export interface FetchResponsePartition {
|
|
25
|
+
partitionIndex: number;
|
|
26
|
+
errorCode: number;
|
|
27
|
+
highWatermark: bigint;
|
|
28
|
+
lastStableOffset: bigint;
|
|
29
|
+
logStartOffset: bigint;
|
|
30
|
+
abortedTransactions: FetchResponsePartitionAbortedTransaction[];
|
|
31
|
+
preferredReadReplica: number;
|
|
32
|
+
records?: RecordsBatch;
|
|
33
|
+
}
|
|
34
|
+
export interface FetchResponseTopic {
|
|
35
|
+
topicId: string;
|
|
36
|
+
partitions: FetchResponsePartition[];
|
|
37
|
+
}
|
|
38
|
+
export type FetchResponse = {
|
|
39
|
+
throttleTimeMs: number;
|
|
40
|
+
errorCode: number;
|
|
41
|
+
sessionId: number;
|
|
42
|
+
responses: FetchResponseTopic[];
|
|
43
|
+
};
|
|
44
|
+
export declare function createRequest(maxWaitMs: number, minBytes: number, maxBytes: number, isolationLevel: number, sessionId: number, sessionEpoch: number, topics: FetchRequestTopic[], forgottenTopicsData: FetchRequestForgottenTopicsData[], rackId: string): Writer;
|
|
45
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): FetchResponse;
|
|
46
|
+
export declare const api: import("../definitions.ts").API<[maxWaitMs: number, minBytes: number, maxBytes: number, isolationLevel: number, sessionId: number, sessionEpoch: number, topics: FetchRequestTopic[], forgottenTopicsData: FetchRequestForgottenTopicsData[], rackId: string], FetchResponse>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Reader } from "../../protocol/reader.js";
|
|
3
|
+
import { readRecordsBatch } from "../../protocol/records.js";
|
|
4
|
+
import { Writer } from "../../protocol/writer.js";
|
|
5
|
+
import { createAPI } from "../definitions.js";
|
|
6
|
+
/*
|
|
7
|
+
Fetch Request (Version: 17) => max_wait_ms min_bytes max_bytes isolation_level session_id session_epoch [topics] [forgotten_topics_data] rack_id TAG_BUFFER
|
|
8
|
+
max_wait_ms => INT32
|
|
9
|
+
min_bytes => INT32
|
|
10
|
+
max_bytes => INT32
|
|
11
|
+
isolation_level => INT8
|
|
12
|
+
session_id => INT32
|
|
13
|
+
session_epoch => INT32
|
|
14
|
+
topics => topic_id [partitions] TAG_BUFFER
|
|
15
|
+
topic_id => UUID
|
|
16
|
+
partitions => partition current_leader_epoch fetch_offset last_fetched_epoch log_start_offset partition_max_bytes TAG_BUFFER
|
|
17
|
+
partition => INT32
|
|
18
|
+
current_leader_epoch => INT32
|
|
19
|
+
fetch_offset => INT64
|
|
20
|
+
last_fetched_epoch => INT32
|
|
21
|
+
log_start_offset => INT64
|
|
22
|
+
partition_max_bytes => INT32
|
|
23
|
+
forgotten_topics_data => topic_id [partitions] TAG_BUFFER
|
|
24
|
+
topic_id => UUID
|
|
25
|
+
partitions => INT32
|
|
26
|
+
rack_id => COMPACT_STRING
|
|
27
|
+
*/
|
|
28
|
+
export function createRequest(maxWaitMs, minBytes, maxBytes, isolationLevel, sessionId, sessionEpoch, topics, forgottenTopicsData, rackId) {
|
|
29
|
+
return Writer.create()
|
|
30
|
+
.appendInt32(maxWaitMs)
|
|
31
|
+
.appendInt32(minBytes)
|
|
32
|
+
.appendInt32(maxBytes)
|
|
33
|
+
.appendInt8(isolationLevel)
|
|
34
|
+
.appendInt32(sessionId)
|
|
35
|
+
.appendInt32(sessionEpoch)
|
|
36
|
+
.appendArray(topics, (w, t) => {
|
|
37
|
+
w.appendUUID(t.topicId).appendArray(t.partitions, (w, p) => {
|
|
38
|
+
w.appendInt32(p.partition)
|
|
39
|
+
.appendInt32(p.currentLeaderEpoch)
|
|
40
|
+
.appendInt64(p.fetchOffset)
|
|
41
|
+
.appendInt32(p.lastFetchedEpoch)
|
|
42
|
+
.appendInt64(-1n)
|
|
43
|
+
.appendInt32(p.partitionMaxBytes);
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.appendArray(forgottenTopicsData, (w, t) => {
|
|
47
|
+
w.appendUUID(t.topic).appendArray(t.partitions, (w, p) => {
|
|
48
|
+
w.appendInt32(p);
|
|
49
|
+
}, true, false);
|
|
50
|
+
})
|
|
51
|
+
.appendString(rackId)
|
|
52
|
+
.appendTaggedFields();
|
|
53
|
+
}
|
|
54
|
+
/*
|
|
55
|
+
Fetch Response (Version: 17) => throttle_time_ms error_code session_id [responses] TAG_BUFFER
|
|
56
|
+
throttle_time_ms => INT32
|
|
57
|
+
error_code => INT16
|
|
58
|
+
session_id => INT32
|
|
59
|
+
responses => topic_id [partitions] TAG_BUFFER
|
|
60
|
+
topic_id => UUID
|
|
61
|
+
partitions => partition_index error_code high_watermark last_stable_offset log_start_offset [aborted_transactions] preferred_read_replica records TAG_BUFFER
|
|
62
|
+
partition_index => INT32
|
|
63
|
+
error_code => INT16
|
|
64
|
+
high_watermark => INT64
|
|
65
|
+
last_stable_offset => INT64
|
|
66
|
+
log_start_offset => INT64
|
|
67
|
+
aborted_transactions => producer_id first_offset TAG_BUFFER
|
|
68
|
+
producer_id => INT64
|
|
69
|
+
first_offset => INT64
|
|
70
|
+
preferred_read_replica => INT32
|
|
71
|
+
records => COMPACT_RECORDS
|
|
72
|
+
*/
|
|
73
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
74
|
+
const errors = [];
|
|
75
|
+
const throttleTimeMs = reader.readInt32();
|
|
76
|
+
const errorCode = reader.readInt16();
|
|
77
|
+
if (errorCode !== 0) {
|
|
78
|
+
errors.push(['', errorCode]);
|
|
79
|
+
}
|
|
80
|
+
const response = {
|
|
81
|
+
throttleTimeMs,
|
|
82
|
+
errorCode,
|
|
83
|
+
sessionId: reader.readInt32(),
|
|
84
|
+
responses: reader.readArray((r, i) => {
|
|
85
|
+
return {
|
|
86
|
+
topicId: r.readUUID(),
|
|
87
|
+
partitions: r.readArray((r, j) => {
|
|
88
|
+
const partition = {
|
|
89
|
+
partitionIndex: r.readInt32(),
|
|
90
|
+
errorCode: r.readInt16(),
|
|
91
|
+
highWatermark: r.readInt64(),
|
|
92
|
+
lastStableOffset: r.readInt64(),
|
|
93
|
+
logStartOffset: r.readInt64(),
|
|
94
|
+
abortedTransactions: r.readArray(r => {
|
|
95
|
+
return {
|
|
96
|
+
producerId: r.readInt64(),
|
|
97
|
+
firstOffset: r.readInt64()
|
|
98
|
+
};
|
|
99
|
+
}),
|
|
100
|
+
preferredReadReplica: r.readInt32()
|
|
101
|
+
};
|
|
102
|
+
let recordsSize = r.readUnsignedVarInt();
|
|
103
|
+
if (partition.errorCode !== 0) {
|
|
104
|
+
errors.push([`/responses/${i}/partitions/${j}`, partition.errorCode]);
|
|
105
|
+
}
|
|
106
|
+
if (recordsSize > 1) {
|
|
107
|
+
recordsSize--;
|
|
108
|
+
partition.records = readRecordsBatch(Reader.from(r.buffer.subarray(r.position, r.position + recordsSize)));
|
|
109
|
+
r.skip(recordsSize);
|
|
110
|
+
}
|
|
111
|
+
return partition;
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
if (errors.length) {
|
|
117
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
118
|
+
}
|
|
119
|
+
return response;
|
|
120
|
+
}
|
|
121
|
+
export const api = createAPI(1, 17, createRequest, parseResponse);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export type HeartbeatRequest = Parameters<typeof createRequest>;
|
|
5
|
+
export interface HeartbeatResponse {
|
|
6
|
+
throttleTimeMs: number;
|
|
7
|
+
errorCode: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createRequest(groupId: string, generationId: number, memberId: string, groupInstanceId?: NullableString): Writer;
|
|
10
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): HeartbeatResponse;
|
|
11
|
+
export declare const api: import("../definitions.ts").API<[groupId: string, generationId: number, memberId: string, groupInstanceId?: NullableString], HeartbeatResponse>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
Heartbeat Request (Version: 4) => group_id generation_id member_id group_instance_id TAG_BUFFER
|
|
6
|
+
group_id => COMPACT_STRING
|
|
7
|
+
generation_id => INT32
|
|
8
|
+
member_id => COMPACT_STRING
|
|
9
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
10
|
+
*/
|
|
11
|
+
export function createRequest(groupId, generationId, memberId, groupInstanceId) {
|
|
12
|
+
return Writer.create()
|
|
13
|
+
.appendString(groupId)
|
|
14
|
+
.appendInt32(generationId)
|
|
15
|
+
.appendString(memberId)
|
|
16
|
+
.appendString(groupInstanceId)
|
|
17
|
+
.appendTaggedFields();
|
|
18
|
+
}
|
|
19
|
+
/*
|
|
20
|
+
Heartbeat Response (Version: 4) => throttle_time_ms error_code TAG_BUFFER
|
|
21
|
+
throttle_time_ms => INT32
|
|
22
|
+
error_code => INT16
|
|
23
|
+
*/
|
|
24
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
25
|
+
const response = {
|
|
26
|
+
throttleTimeMs: reader.readInt32(),
|
|
27
|
+
errorCode: reader.readInt16()
|
|
28
|
+
};
|
|
29
|
+
if (response.errorCode !== 0) {
|
|
30
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
31
|
+
}
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
export const api = createAPI(12, 4, createRequest, parseResponse);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as consumerGroupHeartbeatV0 from './consumer-group-heartbeat.ts';
|
|
2
|
+
export * as fetchV17 from './fetch.ts';
|
|
3
|
+
export * as heartbeatV4 from './heartbeat.ts';
|
|
4
|
+
export * as joinGroupV9 from './join-group.ts';
|
|
5
|
+
export * as leaveGroupV5 from './leave-group.ts';
|
|
6
|
+
export * as listOffsetsV9 from './list-offsets.ts';
|
|
7
|
+
export * as offsetCommitV9 from './offset-commit.ts';
|
|
8
|
+
export * as offsetFetchV9 from './offset-fetch.ts';
|
|
9
|
+
export * as syncGroupV5 from './sync-group.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as consumerGroupHeartbeatV0 from "./consumer-group-heartbeat.js";
|
|
2
|
+
export * as fetchV17 from "./fetch.js";
|
|
3
|
+
export * as heartbeatV4 from "./heartbeat.js";
|
|
4
|
+
export * as joinGroupV9 from "./join-group.js";
|
|
5
|
+
export * as leaveGroupV5 from "./leave-group.js";
|
|
6
|
+
export * as listOffsetsV9 from "./list-offsets.js";
|
|
7
|
+
export * as offsetCommitV9 from "./offset-commit.js";
|
|
8
|
+
export * as offsetFetchV9 from "./offset-fetch.js";
|
|
9
|
+
export * as syncGroupV5 from "./sync-group.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface JoinGroupRequestProtocol {
|
|
5
|
+
name: string;
|
|
6
|
+
metadata?: Buffer | null;
|
|
7
|
+
}
|
|
8
|
+
export type JoinGroupRequest = Parameters<typeof createRequest>;
|
|
9
|
+
export interface JoinGroupResponseMember {
|
|
10
|
+
memberId: string;
|
|
11
|
+
groupInstanceId?: NullableString;
|
|
12
|
+
metadata: Buffer | null;
|
|
13
|
+
}
|
|
14
|
+
export interface JoinGroupResponse {
|
|
15
|
+
throttleTimeMs: number;
|
|
16
|
+
errorCode: number;
|
|
17
|
+
generationId: number;
|
|
18
|
+
protocolType: NullableString;
|
|
19
|
+
protocolName: NullableString;
|
|
20
|
+
leader: string;
|
|
21
|
+
skipAssignment: boolean;
|
|
22
|
+
memberId: NullableString;
|
|
23
|
+
members: JoinGroupResponseMember[];
|
|
24
|
+
}
|
|
25
|
+
export declare function createRequest(groupId: string, sessionTimeoutMs: number, rebalanceTimeoutMs: number, memberId: string, groupInstanceId: NullableString, protocolType: string, protocols: JoinGroupRequestProtocol[], reason?: NullableString): Writer;
|
|
26
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): JoinGroupResponse;
|
|
27
|
+
export declare const api: import("../definitions.ts").API<[groupId: string, sessionTimeoutMs: number, rebalanceTimeoutMs: number, memberId: string, groupInstanceId: NullableString, protocolType: string, protocols: JoinGroupRequestProtocol[], reason?: NullableString], JoinGroupResponse>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { EMPTY_BUFFER } from "../../protocol/definitions.js";
|
|
3
|
+
import { Writer } from "../../protocol/writer.js";
|
|
4
|
+
import { createAPI } from "../definitions.js";
|
|
5
|
+
/*
|
|
6
|
+
JoinGroup Request (Version: 9) => group_id session_timeout_ms rebalance_timeout_ms member_id group_instance_id protocol_type [protocols] reason TAG_BUFFER
|
|
7
|
+
group_id => COMPACT_STRING
|
|
8
|
+
session_timeout_ms => INT32
|
|
9
|
+
rebalance_timeout_ms => INT32
|
|
10
|
+
member_id => COMPACT_STRING
|
|
11
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
12
|
+
protocol_type => COMPACT_STRING
|
|
13
|
+
protocols => name metadata TAG_BUFFER
|
|
14
|
+
name => COMPACT_STRING
|
|
15
|
+
metadata => COMPACT_BYTES
|
|
16
|
+
reason => COMPACT_NULLABLE_STRING
|
|
17
|
+
*/
|
|
18
|
+
export function createRequest(groupId, sessionTimeoutMs, rebalanceTimeoutMs, memberId, groupInstanceId, protocolType, protocols, reason) {
|
|
19
|
+
return Writer.create()
|
|
20
|
+
.appendString(groupId)
|
|
21
|
+
.appendInt32(sessionTimeoutMs)
|
|
22
|
+
.appendInt32(rebalanceTimeoutMs)
|
|
23
|
+
.appendString(memberId)
|
|
24
|
+
.appendString(groupInstanceId)
|
|
25
|
+
.appendString(protocolType)
|
|
26
|
+
.appendArray(protocols, (w, protocol) => {
|
|
27
|
+
w.appendString(protocol.name).appendBytes(protocol.metadata ? protocol.metadata : EMPTY_BUFFER);
|
|
28
|
+
})
|
|
29
|
+
.appendString(reason)
|
|
30
|
+
.appendTaggedFields();
|
|
31
|
+
}
|
|
32
|
+
/*
|
|
33
|
+
JoinGroup Response (Version: 9) => throttle_time_ms error_code generation_id protocol_type protocol_name leader skip_assignment member_id [members] TAG_BUFFER
|
|
34
|
+
throttle_time_ms => INT32
|
|
35
|
+
error_code => INT16
|
|
36
|
+
generation_id => INT32
|
|
37
|
+
protocol_type => COMPACT_NULLABLE_STRING
|
|
38
|
+
protocol_name => COMPACT_NULLABLE_STRING
|
|
39
|
+
leader => COMPACT_STRING
|
|
40
|
+
skip_assignment => BOOLEAN
|
|
41
|
+
member_id => COMPACT_STRING
|
|
42
|
+
members => member_id group_instance_id metadata TAG_BUFFER
|
|
43
|
+
member_id => COMPACT_STRING
|
|
44
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
45
|
+
metadata => COMPACT_BYTES
|
|
46
|
+
|
|
47
|
+
*/
|
|
48
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
49
|
+
const response = {
|
|
50
|
+
throttleTimeMs: reader.readInt32(),
|
|
51
|
+
errorCode: reader.readInt16(),
|
|
52
|
+
generationId: reader.readInt32(),
|
|
53
|
+
protocolType: reader.readNullableString(),
|
|
54
|
+
protocolName: reader.readNullableString(),
|
|
55
|
+
leader: reader.readString(),
|
|
56
|
+
skipAssignment: reader.readBoolean(),
|
|
57
|
+
memberId: reader.readNullableString(),
|
|
58
|
+
members: reader.readArray(r => {
|
|
59
|
+
return {
|
|
60
|
+
memberId: r.readString(),
|
|
61
|
+
groupInstanceId: r.readNullableString(),
|
|
62
|
+
metadata: r.readNullableBytes()
|
|
63
|
+
};
|
|
64
|
+
})
|
|
65
|
+
};
|
|
66
|
+
if (response.errorCode !== 0) {
|
|
67
|
+
throw new ResponseError(apiKey, apiVersion, { '': response.errorCode }, response);
|
|
68
|
+
}
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
export const api = createAPI(11, 9, createRequest, parseResponse);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface LeaveGroupRequestMember {
|
|
5
|
+
memberId: string;
|
|
6
|
+
groupInstanceId?: NullableString;
|
|
7
|
+
reason?: NullableString;
|
|
8
|
+
}
|
|
9
|
+
export type LeaveGroupRequest = Parameters<typeof createRequest>;
|
|
10
|
+
export interface LeaveGroupResponseMember {
|
|
11
|
+
memberId: NullableString;
|
|
12
|
+
groupInstanceId: NullableString;
|
|
13
|
+
errorCode: number;
|
|
14
|
+
}
|
|
15
|
+
export interface LeaveGroupResponse {
|
|
16
|
+
throttleTimeMs: number;
|
|
17
|
+
errorCode: number;
|
|
18
|
+
members: LeaveGroupResponseMember[];
|
|
19
|
+
}
|
|
20
|
+
export declare function createRequest(groupId: string, members: LeaveGroupRequestMember[]): Writer;
|
|
21
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): LeaveGroupResponse;
|
|
22
|
+
export declare const api: import("../definitions.ts").API<[groupId: string, members: LeaveGroupRequestMember[]], LeaveGroupResponse>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
LeaveGroup Request (Version: 5) => group_id [members] TAG_BUFFER
|
|
6
|
+
group_id => COMPACT_STRING
|
|
7
|
+
members => member_id group_instance_id reason TAG_BUFFER
|
|
8
|
+
member_id => COMPACT_STRING
|
|
9
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
10
|
+
reason => COMPACT_NULLABLE_STRING
|
|
11
|
+
*/
|
|
12
|
+
export function createRequest(groupId, members) {
|
|
13
|
+
return Writer.create()
|
|
14
|
+
.appendString(groupId)
|
|
15
|
+
.appendArray(members, (w, m) => {
|
|
16
|
+
w.appendString(m.memberId).appendString(m.groupInstanceId).appendString(m.reason);
|
|
17
|
+
})
|
|
18
|
+
.appendTaggedFields();
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
LeaveGroup Response (Version: 5) => throttle_time_ms error_code [members] TAG_BUFFER
|
|
22
|
+
throttle_time_ms => INT32
|
|
23
|
+
error_code => INT16
|
|
24
|
+
members => member_id group_instance_id error_code TAG_BUFFER
|
|
25
|
+
member_id => COMPACT_STRING
|
|
26
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
27
|
+
error_code => INT16
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
31
|
+
const errors = [];
|
|
32
|
+
const throttleTimeMs = reader.readInt32();
|
|
33
|
+
const errorCode = reader.readInt16();
|
|
34
|
+
if (errorCode !== 0) {
|
|
35
|
+
errors.push(['', errorCode]);
|
|
36
|
+
}
|
|
37
|
+
const response = {
|
|
38
|
+
throttleTimeMs,
|
|
39
|
+
errorCode,
|
|
40
|
+
members: reader.readArray((r, i) => {
|
|
41
|
+
const member = {
|
|
42
|
+
memberId: r.readNullableString(),
|
|
43
|
+
groupInstanceId: r.readNullableString(),
|
|
44
|
+
errorCode: r.readInt16()
|
|
45
|
+
};
|
|
46
|
+
if (member.errorCode !== 0) {
|
|
47
|
+
errors.push([`/members/${i}`, member.errorCode]);
|
|
48
|
+
}
|
|
49
|
+
return member;
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
if (errors.length) {
|
|
53
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
export const api = createAPI(13, 5, createRequest, parseResponse);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
export interface ListOffsetsRequestPartition {
|
|
4
|
+
partitionIndex: number;
|
|
5
|
+
currentLeaderEpoch: number;
|
|
6
|
+
timestamp: bigint;
|
|
7
|
+
}
|
|
8
|
+
export interface ListOffsetsRequestTopic {
|
|
9
|
+
name: string;
|
|
10
|
+
partitions: ListOffsetsRequestPartition[];
|
|
11
|
+
}
|
|
12
|
+
export type ListOffsetsRequest = Parameters<typeof createRequest>;
|
|
13
|
+
export interface ListOffsetResponsePartition {
|
|
14
|
+
partitionIndex: number;
|
|
15
|
+
errorCode: number;
|
|
16
|
+
timestamp: bigint;
|
|
17
|
+
offset: bigint;
|
|
18
|
+
leaderEpoch: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ListOffsetResponseTopic {
|
|
21
|
+
name: string;
|
|
22
|
+
partitions: ListOffsetResponsePartition[];
|
|
23
|
+
}
|
|
24
|
+
export interface ListOffsetsResponse {
|
|
25
|
+
throttleTimeMs: number;
|
|
26
|
+
topics: ListOffsetResponseTopic[];
|
|
27
|
+
}
|
|
28
|
+
export declare function createRequest(replica: number, isolationLevel: number, topics: ListOffsetsRequestTopic[]): Writer;
|
|
29
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): ListOffsetsResponse;
|
|
30
|
+
export declare const api: import("../definitions.ts").API<[replica: number, isolationLevel: number, topics: ListOffsetsRequestTopic[]], ListOffsetsResponse>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
ListOffsets Request (Version: 9) => replica_id isolation_level [topics] TAG_BUFFER
|
|
6
|
+
replica_id => INT32
|
|
7
|
+
isolation_level => INT8
|
|
8
|
+
topics => name [partitions] TAG_BUFFER
|
|
9
|
+
name => COMPACT_STRING
|
|
10
|
+
partitions => partition_index current_leader_epoch timestamp TAG_BUFFER
|
|
11
|
+
partition_index => INT32
|
|
12
|
+
current_leader_epoch => INT32
|
|
13
|
+
timestamp => INT64
|
|
14
|
+
*/
|
|
15
|
+
export function createRequest(replica, isolationLevel, topics) {
|
|
16
|
+
return Writer.create()
|
|
17
|
+
.appendInt32(replica)
|
|
18
|
+
.appendInt8(isolationLevel)
|
|
19
|
+
.appendArray(topics, (w, topic) => {
|
|
20
|
+
w.appendString(topic.name).appendArray(topic.partitions, (w, partition) => {
|
|
21
|
+
w.appendInt32(partition.partitionIndex)
|
|
22
|
+
.appendInt32(partition.currentLeaderEpoch)
|
|
23
|
+
.appendInt64(partition.timestamp);
|
|
24
|
+
});
|
|
25
|
+
})
|
|
26
|
+
.appendTaggedFields();
|
|
27
|
+
}
|
|
28
|
+
/*
|
|
29
|
+
ListOffsets Response (Version: 9) => throttle_time_ms [topics] TAG_BUFFER
|
|
30
|
+
throttle_time_ms => INT32
|
|
31
|
+
topics => name [partitions] TAG_BUFFER
|
|
32
|
+
name => COMPACT_STRING
|
|
33
|
+
partitions => partition_index error_code timestamp offset leader_epoch TAG_BUFFER
|
|
34
|
+
partition_index => INT32
|
|
35
|
+
error_code => INT16
|
|
36
|
+
timestamp => INT64
|
|
37
|
+
offset => INT64
|
|
38
|
+
leader_epoch => INT32
|
|
39
|
+
*/
|
|
40
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
const response = {
|
|
43
|
+
throttleTimeMs: reader.readInt32(),
|
|
44
|
+
topics: reader.readArray((r, i) => {
|
|
45
|
+
return {
|
|
46
|
+
name: r.readString(),
|
|
47
|
+
partitions: r.readArray((r, j) => {
|
|
48
|
+
const partition = {
|
|
49
|
+
partitionIndex: r.readInt32(),
|
|
50
|
+
errorCode: r.readInt16(),
|
|
51
|
+
timestamp: r.readInt64(),
|
|
52
|
+
offset: r.readInt64(),
|
|
53
|
+
leaderEpoch: r.readInt32()
|
|
54
|
+
};
|
|
55
|
+
if (partition.errorCode !== 0) {
|
|
56
|
+
errors.push([`/topics/${i}/partitions/${j}`, partition.errorCode]);
|
|
57
|
+
}
|
|
58
|
+
return partition;
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
if (errors.length) {
|
|
64
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
65
|
+
}
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
export const api = createAPI(2, 9, createRequest, parseResponse);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface OffsetCommitRequestPartition {
|
|
5
|
+
partitionIndex: number;
|
|
6
|
+
committedOffset: bigint;
|
|
7
|
+
committedLeaderEpoch: number;
|
|
8
|
+
committedMetadata?: NullableString;
|
|
9
|
+
}
|
|
10
|
+
export interface OffsetCommitRequestTopic {
|
|
11
|
+
name: string;
|
|
12
|
+
partitions: OffsetCommitRequestPartition[];
|
|
13
|
+
}
|
|
14
|
+
export type OffsetCommitRequest = Parameters<typeof createRequest>;
|
|
15
|
+
export interface OffsetCommitResponsePartition {
|
|
16
|
+
partitionIndex: number;
|
|
17
|
+
errorCode: number;
|
|
18
|
+
}
|
|
19
|
+
export interface OffsetCommitResponseTopic {
|
|
20
|
+
name: string;
|
|
21
|
+
partitions: OffsetCommitResponsePartition[];
|
|
22
|
+
}
|
|
23
|
+
export interface OffsetCommitResponse {
|
|
24
|
+
throttleTimeMs: number;
|
|
25
|
+
topics: OffsetCommitResponseTopic[];
|
|
26
|
+
}
|
|
27
|
+
export declare function createRequest(groupId: string, generationIdOrMemberEpoch: number, memberId: string, groupInstanceId: NullableString, topics: OffsetCommitRequestTopic[]): Writer;
|
|
28
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): OffsetCommitResponse;
|
|
29
|
+
export declare const api: import("../definitions.ts").API<[groupId: string, generationIdOrMemberEpoch: number, memberId: string, groupInstanceId: NullableString, topics: OffsetCommitRequestTopic[]], OffsetCommitResponse>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
OffsetCommit Request (Version: 9) => group_id generation_id_or_member_epoch member_id group_instance_id [topics] TAG_BUFFER
|
|
6
|
+
group_id => COMPACT_STRING
|
|
7
|
+
generation_id_or_member_epoch => INT32
|
|
8
|
+
member_id => COMPACT_STRING
|
|
9
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
10
|
+
topics => name [partitions] TAG_BUFFER
|
|
11
|
+
name => COMPACT_STRING
|
|
12
|
+
partitions => partition_index committed_offset committed_leader_epoch committed_metadata TAG_BUFFER
|
|
13
|
+
partition_index => INT32
|
|
14
|
+
committed_offset => INT64
|
|
15
|
+
committed_leader_epoch => INT32
|
|
16
|
+
committed_metadata => COMPACT_NULLABLE_STRING
|
|
17
|
+
*/
|
|
18
|
+
export function createRequest(groupId, generationIdOrMemberEpoch, memberId, groupInstanceId, topics) {
|
|
19
|
+
return Writer.create()
|
|
20
|
+
.appendString(groupId)
|
|
21
|
+
.appendInt32(generationIdOrMemberEpoch)
|
|
22
|
+
.appendString(memberId)
|
|
23
|
+
.appendString(groupInstanceId)
|
|
24
|
+
.appendArray(topics, (w, t) => {
|
|
25
|
+
w.appendString(t.name).appendArray(t.partitions, (w, p) => {
|
|
26
|
+
w.appendInt32(p.partitionIndex)
|
|
27
|
+
.appendInt64(p.committedOffset)
|
|
28
|
+
.appendInt32(p.committedLeaderEpoch)
|
|
29
|
+
.appendString(p.committedMetadata);
|
|
30
|
+
});
|
|
31
|
+
})
|
|
32
|
+
.appendTaggedFields();
|
|
33
|
+
}
|
|
34
|
+
/*
|
|
35
|
+
OffsetCommit Response (Version: 9) => throttle_time_ms [topics] TAG_BUFFER
|
|
36
|
+
throttle_time_ms => INT32
|
|
37
|
+
topics => name [partitions] TAG_BUFFER
|
|
38
|
+
name => COMPACT_STRING
|
|
39
|
+
partitions => partition_index error_code TAG_BUFFER
|
|
40
|
+
partition_index => INT32
|
|
41
|
+
error_code => INT16
|
|
42
|
+
*/
|
|
43
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
44
|
+
const errors = [];
|
|
45
|
+
const response = {
|
|
46
|
+
throttleTimeMs: reader.readInt32(),
|
|
47
|
+
topics: reader.readArray((r, i) => {
|
|
48
|
+
return {
|
|
49
|
+
name: r.readString(),
|
|
50
|
+
partitions: r.readArray((r, j) => {
|
|
51
|
+
const partition = {
|
|
52
|
+
partitionIndex: r.readInt32(),
|
|
53
|
+
errorCode: r.readInt16()
|
|
54
|
+
};
|
|
55
|
+
if (partition.errorCode !== 0) {
|
|
56
|
+
errors.push([`/topics/${i}/partitions/${j}`, partition.errorCode]);
|
|
57
|
+
}
|
|
58
|
+
return partition;
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
if (errors.length) {
|
|
64
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
65
|
+
}
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
export const api = createAPI(8, 9, createRequest, parseResponse);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type NullableString } from '../../protocol/definitions.ts';
|
|
2
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
3
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
4
|
+
export interface OffsetFetchRequestTopic {
|
|
5
|
+
name: string;
|
|
6
|
+
partitionIndexes: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface OffsetFetchRequestGroup {
|
|
9
|
+
groupId: string;
|
|
10
|
+
memberId?: NullableString;
|
|
11
|
+
memberEpoch: number;
|
|
12
|
+
topics: OffsetFetchRequestTopic[];
|
|
13
|
+
}
|
|
14
|
+
export type OffsetFetchRequest = Parameters<typeof createRequest>;
|
|
15
|
+
export interface OffsetFetchResponsePartition {
|
|
16
|
+
partitionIndex: number;
|
|
17
|
+
committedOffset: bigint;
|
|
18
|
+
committedLeaderEpoch: number;
|
|
19
|
+
metadata: NullableString;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
}
|
|
22
|
+
export interface OffsetFetchResponseTopic {
|
|
23
|
+
name: string;
|
|
24
|
+
partitions: OffsetFetchResponsePartition[];
|
|
25
|
+
}
|
|
26
|
+
export interface OffsetFetchResponseGroup {
|
|
27
|
+
groupId: string;
|
|
28
|
+
topics: OffsetFetchResponseTopic[];
|
|
29
|
+
errorCode: number;
|
|
30
|
+
}
|
|
31
|
+
export interface OffsetFetchResponse {
|
|
32
|
+
throttleTimeMs: number;
|
|
33
|
+
groups: OffsetFetchResponseGroup[];
|
|
34
|
+
}
|
|
35
|
+
export declare function createRequest(groups: OffsetFetchRequestGroup[], requireStable: boolean): Writer;
|
|
36
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): OffsetFetchResponse;
|
|
37
|
+
export declare const api: import("../definitions.ts").API<[groups: OffsetFetchRequestGroup[], requireStable: boolean], OffsetFetchResponse>;
|