@platformatic/kafka 1.27.0-alpha.2 → 1.27.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/README.md +6 -1
- package/dist/apis/admin/create-acls-v2.d.ts +16 -0
- package/dist/apis/admin/create-acls-v2.js +55 -0
- package/dist/apis/admin/delete-acls-v2.d.ts +21 -0
- package/dist/apis/admin/delete-acls-v2.js +84 -0
- package/dist/apis/admin/describe-acls-v2.d.ts +17 -0
- package/dist/apis/admin/describe-acls-v2.js +66 -0
- package/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
- package/dist/apis/admin/describe-cluster-v0.js +48 -0
- package/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs-v2.js +67 -0
- package/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs-v3.js +73 -0
- package/dist/apis/admin/index.d.ts +7 -0
- package/dist/apis/admin/index.js +7 -0
- package/dist/apis/admin/list-transactions-v0.d.ts +18 -0
- package/dist/apis/admin/list-transactions-v0.js +43 -0
- package/dist/apis/consumer/index.d.ts +8 -0
- package/dist/apis/consumer/index.js +8 -0
- package/dist/apis/consumer/join-group-v6.d.ts +27 -0
- package/dist/apis/consumer/join-group-v6.js +67 -0
- package/dist/apis/consumer/join-group-v7.d.ts +27 -0
- package/dist/apis/consumer/join-group-v7.js +68 -0
- package/dist/apis/consumer/join-group-v8.d.ts +27 -0
- package/dist/apis/consumer/join-group-v8.js +70 -0
- package/dist/apis/consumer/leave-group-v4.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v4.js +56 -0
- package/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v5.js +67 -0
- package/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v6.js +68 -0
- package/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v7.js +68 -0
- package/dist/apis/consumer/sync-group-v4.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v4.js +43 -0
- package/dist/apis/enumerations.d.ts +5 -5
- package/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn-v1.js +33 -0
- package/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn-v2.js +33 -0
- package/dist/apis/producer/index.d.ts +3 -0
- package/dist/apis/producer/index.js +3 -0
- package/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
- package/dist/apis/producer/init-producer-id-v3.js +38 -0
- package/dist/clients/admin/options.d.ts +9 -9
- package/dist/clients/base/base.js +6 -2
- package/dist/clients/base/options.d.ts +9 -2
- package/dist/clients/base/options.js +1 -1
- package/dist/clients/base/types.d.ts +2 -1
- package/dist/clients/consumer/consumer.js +14 -1
- package/dist/clients/consumer/messages-stream.d.ts +2 -2
- package/dist/clients/consumer/messages-stream.js +3 -3
- package/dist/clients/producer/producer.js +7 -1
- package/dist/errors.d.ts +0 -4
- package/dist/errors.js +0 -6
- package/dist/network/connection.js +1 -1
- package/dist/protocol/compression.d.ts +1 -1
- package/dist/protocol/compression.js +7 -46
- package/dist/protocol/crc32c.d.ts +1 -1
- package/dist/protocol/crc32c.js +5 -6
- package/dist/protocol/definitions.d.ts +1 -1
- package/dist/protocol/index.d.ts +0 -2
- package/dist/protocol/index.js +0 -2
- package/dist/protocol/reader.d.ts +2 -2
- package/dist/protocol/reader.js +3 -3
- package/dist/protocol/records.d.ts +4 -4
- package/dist/protocol/records.js +1 -1
- package/dist/protocol/writer.d.ts +1 -1
- package/dist/protocol/writer.js +2 -2
- package/dist/typescript-4/dist/apis/admin/create-acls-v2.d.ts +16 -0
- package/dist/typescript-4/dist/apis/admin/delete-acls-v2.d.ts +21 -0
- package/dist/typescript-4/dist/apis/admin/describe-acls-v2.d.ts +17 -0
- package/dist/typescript-4/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
- package/dist/typescript-4/dist/apis/admin/index.d.ts +7 -0
- package/dist/typescript-4/dist/apis/admin/list-transactions-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/index.d.ts +8 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v6.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v7.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v8.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v4.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v4.d.ts +18 -0
- package/dist/typescript-4/dist/apis/enumerations.d.ts +5 -5
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/index.d.ts +3 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
- package/dist/typescript-4/dist/clients/admin/options.d.ts +9 -9
- package/dist/typescript-4/dist/clients/base/options.d.ts +9 -2
- package/dist/typescript-4/dist/clients/base/types.d.ts +2 -1
- package/dist/typescript-4/dist/clients/consumer/messages-stream.d.ts +2 -2
- package/dist/typescript-4/dist/errors.d.ts +0 -4
- package/dist/typescript-4/dist/protocol/compression.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/crc32c.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/definitions.d.ts +1 -1
- package/dist/typescript-4/dist/protocol/index.d.ts +0 -2
- package/dist/typescript-4/dist/protocol/reader.d.ts +2 -2
- package/dist/typescript-4/dist/protocol/records.d.ts +4 -4
- package/dist/typescript-4/dist/protocol/writer.d.ts +1 -1
- package/dist/typescript-4/dist/utils.d.ts +3 -2
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +11 -9
- package/dist/protocol/dynamic-buffer.d.ts +0 -65
- package/dist/protocol/dynamic-buffer.js +0 -563
- package/dist/protocol/varint.d.ts +0 -12
- package/dist/protocol/varint.js +0 -36
- package/dist/typescript-4/dist/protocol/dynamic-buffer.d.ts +0 -65
- package/dist/typescript-4/dist/protocol/varint.d.ts +0 -12
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Reader } from '../../protocol/reader.ts';
|
|
2
|
+
import { Writer } from '../../protocol/writer.ts';
|
|
3
|
+
import { type TransactionState } from '../enumerations.ts';
|
|
4
|
+
export type ListTransactionsRequest = Parameters<typeof createRequest>;
|
|
5
|
+
export interface ListTransactionsResponseTransactionState {
|
|
6
|
+
transactionalId: string;
|
|
7
|
+
producerId: bigint;
|
|
8
|
+
transactionState: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ListTransactionsResponse {
|
|
11
|
+
throttleTimeMs: number;
|
|
12
|
+
errorCode: number;
|
|
13
|
+
unknownStateFilters: string[];
|
|
14
|
+
transactionStates: ListTransactionsResponseTransactionState[];
|
|
15
|
+
}
|
|
16
|
+
export declare function createRequest(stateFilters: TransactionState[], producerIdFilters: bigint[]): Writer;
|
|
17
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): ListTransactionsResponse;
|
|
18
|
+
export declare const api: import("../definitions.ts").API<[stateFilters: ("EMPTY" | "ONGOING" | "PREPARE_ABORT" | "COMMITTING" | "ABORTING" | "COMPLETE_COMMIT" | "COMPLETE_ABORT")[], producerIdFilters: bigint[]], ListTransactionsResponse>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
ListTransactions Request (Version: 0) => [state_filters] [producer_id_filters] TAG_BUFFER
|
|
6
|
+
state_filters => COMPACT_STRING
|
|
7
|
+
producer_id_filters => INT64
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(stateFilters, producerIdFilters) {
|
|
10
|
+
return Writer.create()
|
|
11
|
+
.appendArray(stateFilters, (w, t) => w.appendString(t), true, false)
|
|
12
|
+
.appendArray(producerIdFilters, (w, p) => w.appendInt64(p), true, false)
|
|
13
|
+
.appendTaggedFields();
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
ListTransactions Response (Version: 0) => throttle_time_ms error_code [unknown_state_filters] [transaction_states] TAG_BUFFER
|
|
17
|
+
throttle_time_ms => INT32
|
|
18
|
+
error_code => INT16
|
|
19
|
+
unknown_state_filters => COMPACT_STRING
|
|
20
|
+
transaction_states => transactional_id producer_id transaction_state TAG_BUFFER
|
|
21
|
+
transactional_id => COMPACT_STRING
|
|
22
|
+
producer_id => INT64
|
|
23
|
+
transaction_state => COMPACT_STRING
|
|
24
|
+
*/
|
|
25
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
26
|
+
const response = {
|
|
27
|
+
throttleTimeMs: reader.readInt32(),
|
|
28
|
+
errorCode: reader.readInt16(),
|
|
29
|
+
unknownStateFilters: reader.readArray(r => r.readString(), true, false),
|
|
30
|
+
transactionStates: reader.readArray(r => {
|
|
31
|
+
return {
|
|
32
|
+
transactionalId: r.readString(),
|
|
33
|
+
producerId: r.readInt64(),
|
|
34
|
+
transactionState: r.readString()
|
|
35
|
+
};
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
if (response.errorCode !== 0) {
|
|
39
|
+
throw new ResponseError(apiKey, apiVersion, { '/': [response.errorCode, null] }, response);
|
|
40
|
+
}
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
export const api = createAPI(66, 0, createRequest, parseResponse);
|
|
@@ -6,8 +6,15 @@ export * as fetchV15 from './fetch-v15.ts';
|
|
|
6
6
|
export * as fetchV16 from './fetch-v16.ts';
|
|
7
7
|
export * as fetchV17 from './fetch-v17.ts';
|
|
8
8
|
export * as heartbeatV4 from './heartbeat-v4.ts';
|
|
9
|
+
export * as joinGroupV6 from './join-group-v6.ts';
|
|
10
|
+
export * as joinGroupV7 from './join-group-v7.ts';
|
|
11
|
+
export * as joinGroupV8 from './join-group-v8.ts';
|
|
9
12
|
export * as joinGroupV9 from './join-group-v9.ts';
|
|
13
|
+
export * as leaveGroupV4 from './leave-group-v4.ts';
|
|
10
14
|
export * as leaveGroupV5 from './leave-group-v5.ts';
|
|
15
|
+
export * as listOffsetsV5 from './list-offsets-v5.ts';
|
|
16
|
+
export * as listOffsetsV6 from './list-offsets-v6.ts';
|
|
17
|
+
export * as listOffsetsV7 from './list-offsets-v7.ts';
|
|
11
18
|
export * as listOffsetsV8 from './list-offsets-v8.ts';
|
|
12
19
|
export * as listOffsetsV9 from './list-offsets-v9.ts';
|
|
13
20
|
export * as offsetCommitV8 from './offset-commit-v8.ts';
|
|
@@ -15,4 +22,5 @@ export * as offsetCommitV9 from './offset-commit-v9.ts';
|
|
|
15
22
|
export * as offsetFetchV8 from './offset-fetch-v8.ts';
|
|
16
23
|
export * as offsetFetchV9 from './offset-fetch-v9.ts';
|
|
17
24
|
export * as offsetForLeaderEpochV4 from './offset-for-leader-epoch-v4.ts';
|
|
25
|
+
export * as syncGroupV4 from './sync-group-v4.ts';
|
|
18
26
|
export * as syncGroupV5 from './sync-group-v5.ts';
|
|
@@ -6,8 +6,15 @@ export * as fetchV15 from "./fetch-v15.js";
|
|
|
6
6
|
export * as fetchV16 from "./fetch-v16.js";
|
|
7
7
|
export * as fetchV17 from "./fetch-v17.js";
|
|
8
8
|
export * as heartbeatV4 from "./heartbeat-v4.js";
|
|
9
|
+
export * as joinGroupV6 from "./join-group-v6.js";
|
|
10
|
+
export * as joinGroupV7 from "./join-group-v7.js";
|
|
11
|
+
export * as joinGroupV8 from "./join-group-v8.js";
|
|
9
12
|
export * as joinGroupV9 from "./join-group-v9.js";
|
|
13
|
+
export * as leaveGroupV4 from "./leave-group-v4.js";
|
|
10
14
|
export * as leaveGroupV5 from "./leave-group-v5.js";
|
|
15
|
+
export * as listOffsetsV5 from "./list-offsets-v5.js";
|
|
16
|
+
export * as listOffsetsV6 from "./list-offsets-v6.js";
|
|
17
|
+
export * as listOffsetsV7 from "./list-offsets-v7.js";
|
|
11
18
|
export * as listOffsetsV8 from "./list-offsets-v8.js";
|
|
12
19
|
export * as listOffsetsV9 from "./list-offsets-v9.js";
|
|
13
20
|
export * as offsetCommitV8 from "./offset-commit-v8.js";
|
|
@@ -15,4 +22,5 @@ export * as offsetCommitV9 from "./offset-commit-v9.js";
|
|
|
15
22
|
export * as offsetFetchV8 from "./offset-fetch-v8.js";
|
|
16
23
|
export * as offsetFetchV9 from "./offset-fetch-v9.js";
|
|
17
24
|
export * as offsetForLeaderEpochV4 from "./offset-for-leader-epoch-v4.js";
|
|
25
|
+
export * as syncGroupV4 from "./sync-group-v4.js";
|
|
18
26
|
export * as syncGroupV5 from "./sync-group-v5.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[]): 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[]], JoinGroupResponse>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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: 6) => group_id session_timeout_ms rebalance_timeout_ms member_id group_instance_id protocol_type [protocols] 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
|
+
*/
|
|
17
|
+
export function createRequest(groupId, sessionTimeoutMs, rebalanceTimeoutMs, memberId, groupInstanceId, protocolType, protocols) {
|
|
18
|
+
return Writer.create()
|
|
19
|
+
.appendString(groupId)
|
|
20
|
+
.appendInt32(sessionTimeoutMs)
|
|
21
|
+
.appendInt32(rebalanceTimeoutMs)
|
|
22
|
+
.appendString(memberId)
|
|
23
|
+
.appendString(groupInstanceId)
|
|
24
|
+
.appendString(protocolType)
|
|
25
|
+
.appendArray(protocols, (w, protocol) => {
|
|
26
|
+
w.appendString(protocol.name).appendBytes(protocol.metadata ? protocol.metadata : EMPTY_BUFFER);
|
|
27
|
+
})
|
|
28
|
+
.appendTaggedFields();
|
|
29
|
+
}
|
|
30
|
+
/*
|
|
31
|
+
JoinGroup Response (Version: 6) => throttle_time_ms error_code generation_id protocol_name leader member_id [members] TAG_BUFFER
|
|
32
|
+
throttle_time_ms => INT32
|
|
33
|
+
error_code => INT16
|
|
34
|
+
generation_id => INT32
|
|
35
|
+
protocol_name => COMPACT_NULLABLE_STRING
|
|
36
|
+
leader => COMPACT_STRING
|
|
37
|
+
member_id => COMPACT_STRING
|
|
38
|
+
members => member_id group_instance_id metadata TAG_BUFFER
|
|
39
|
+
member_id => COMPACT_STRING
|
|
40
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
41
|
+
metadata => COMPACT_BYTES
|
|
42
|
+
|
|
43
|
+
*/
|
|
44
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
45
|
+
const response = {
|
|
46
|
+
throttleTimeMs: reader.readInt32(),
|
|
47
|
+
errorCode: reader.readInt16(),
|
|
48
|
+
generationId: reader.readInt32(),
|
|
49
|
+
protocolType: '',
|
|
50
|
+
protocolName: reader.readNullableString(),
|
|
51
|
+
leader: reader.readString(),
|
|
52
|
+
skipAssignment: false,
|
|
53
|
+
memberId: reader.readNullableString(),
|
|
54
|
+
members: reader.readArray(r => {
|
|
55
|
+
return {
|
|
56
|
+
memberId: r.readString(),
|
|
57
|
+
groupInstanceId: r.readNullableString(),
|
|
58
|
+
metadata: r.readNullableBytes()
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
if (response.errorCode !== 0) {
|
|
63
|
+
throw new ResponseError(apiKey, apiVersion, { '/': [response.errorCode, null] }, response);
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
}
|
|
67
|
+
export const api = createAPI(11, 6, createRequest, parseResponse);
|
|
@@ -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[]): 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[]], JoinGroupResponse>;
|
|
@@ -0,0 +1,68 @@
|
|
|
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: 7) => group_id session_timeout_ms rebalance_timeout_ms member_id group_instance_id protocol_type [protocols] 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
|
+
*/
|
|
17
|
+
export function createRequest(groupId, sessionTimeoutMs, rebalanceTimeoutMs, memberId, groupInstanceId, protocolType, protocols) {
|
|
18
|
+
return Writer.create()
|
|
19
|
+
.appendString(groupId)
|
|
20
|
+
.appendInt32(sessionTimeoutMs)
|
|
21
|
+
.appendInt32(rebalanceTimeoutMs)
|
|
22
|
+
.appendString(memberId)
|
|
23
|
+
.appendString(groupInstanceId)
|
|
24
|
+
.appendString(protocolType)
|
|
25
|
+
.appendArray(protocols, (w, protocol) => {
|
|
26
|
+
w.appendString(protocol.name).appendBytes(protocol.metadata ? protocol.metadata : EMPTY_BUFFER);
|
|
27
|
+
})
|
|
28
|
+
.appendTaggedFields();
|
|
29
|
+
}
|
|
30
|
+
/*
|
|
31
|
+
JoinGroup Response (Version: 7) => throttle_time_ms error_code generation_id protocol_type protocol_name leader member_id [members] TAG_BUFFER
|
|
32
|
+
throttle_time_ms => INT32
|
|
33
|
+
error_code => INT16
|
|
34
|
+
generation_id => INT32
|
|
35
|
+
protocol_type => COMPACT_NULLABLE_STRING
|
|
36
|
+
protocol_name => COMPACT_NULLABLE_STRING
|
|
37
|
+
leader => COMPACT_STRING
|
|
38
|
+
member_id => COMPACT_STRING
|
|
39
|
+
members => member_id group_instance_id metadata TAG_BUFFER
|
|
40
|
+
member_id => COMPACT_STRING
|
|
41
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
42
|
+
metadata => COMPACT_BYTES
|
|
43
|
+
|
|
44
|
+
*/
|
|
45
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
46
|
+
const response = {
|
|
47
|
+
throttleTimeMs: reader.readInt32(),
|
|
48
|
+
errorCode: reader.readInt16(),
|
|
49
|
+
generationId: reader.readInt32(),
|
|
50
|
+
protocolType: reader.readNullableString(),
|
|
51
|
+
protocolName: reader.readNullableString(),
|
|
52
|
+
leader: reader.readString(),
|
|
53
|
+
skipAssignment: false,
|
|
54
|
+
memberId: reader.readNullableString(),
|
|
55
|
+
members: reader.readArray(r => {
|
|
56
|
+
return {
|
|
57
|
+
memberId: r.readString(),
|
|
58
|
+
groupInstanceId: r.readNullableString(),
|
|
59
|
+
metadata: r.readNullableBytes()
|
|
60
|
+
};
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
if (response.errorCode !== 0) {
|
|
64
|
+
throw new ResponseError(apiKey, apiVersion, { '/': [response.errorCode, null] }, response);
|
|
65
|
+
}
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
export const api = createAPI(11, 7, createRequest, parseResponse);
|
|
@@ -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,70 @@
|
|
|
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: 8) => 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: 8) => throttle_time_ms error_code generation_id protocol_type protocol_name leader 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
|
+
member_id => COMPACT_STRING
|
|
41
|
+
members => member_id group_instance_id metadata TAG_BUFFER
|
|
42
|
+
member_id => COMPACT_STRING
|
|
43
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
44
|
+
metadata => COMPACT_BYTES
|
|
45
|
+
|
|
46
|
+
*/
|
|
47
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
48
|
+
const response = {
|
|
49
|
+
throttleTimeMs: reader.readInt32(),
|
|
50
|
+
errorCode: reader.readInt16(),
|
|
51
|
+
generationId: reader.readInt32(),
|
|
52
|
+
protocolType: reader.readNullableString(),
|
|
53
|
+
protocolName: reader.readNullableString(),
|
|
54
|
+
leader: reader.readString(),
|
|
55
|
+
skipAssignment: false,
|
|
56
|
+
memberId: reader.readNullableString(),
|
|
57
|
+
members: reader.readArray(r => {
|
|
58
|
+
return {
|
|
59
|
+
memberId: r.readString(),
|
|
60
|
+
groupInstanceId: r.readNullableString(),
|
|
61
|
+
metadata: r.readNullableBytes()
|
|
62
|
+
};
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
if (response.errorCode !== 0) {
|
|
66
|
+
throw new ResponseError(apiKey, apiVersion, { '/': [response.errorCode, null] }, response);
|
|
67
|
+
}
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
export const api = createAPI(11, 8, 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,56 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
LeaveGroup Request (Version: 4) => group_id [members] TAG_BUFFER
|
|
6
|
+
group_id => COMPACT_STRING
|
|
7
|
+
members => member_id group_instance_id TAG_BUFFER
|
|
8
|
+
member_id => COMPACT_STRING
|
|
9
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
10
|
+
*/
|
|
11
|
+
export function createRequest(groupId, members) {
|
|
12
|
+
return Writer.create()
|
|
13
|
+
.appendString(groupId)
|
|
14
|
+
.appendArray(members, (w, m) => {
|
|
15
|
+
w.appendString(m.memberId).appendString(m.groupInstanceId);
|
|
16
|
+
})
|
|
17
|
+
.appendTaggedFields();
|
|
18
|
+
}
|
|
19
|
+
/*
|
|
20
|
+
LeaveGroup Response (Version: 4) => throttle_time_ms error_code [members] TAG_BUFFER
|
|
21
|
+
throttle_time_ms => INT32
|
|
22
|
+
error_code => INT16
|
|
23
|
+
members => member_id group_instance_id error_code TAG_BUFFER
|
|
24
|
+
member_id => COMPACT_STRING
|
|
25
|
+
group_instance_id => COMPACT_NULLABLE_STRING
|
|
26
|
+
error_code => INT16
|
|
27
|
+
|
|
28
|
+
*/
|
|
29
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
30
|
+
const errors = [];
|
|
31
|
+
const throttleTimeMs = reader.readInt32();
|
|
32
|
+
const errorCode = reader.readInt16();
|
|
33
|
+
if (errorCode !== 0) {
|
|
34
|
+
errors.push(['', [errorCode, null]]);
|
|
35
|
+
}
|
|
36
|
+
const response = {
|
|
37
|
+
throttleTimeMs,
|
|
38
|
+
errorCode,
|
|
39
|
+
members: reader.readArray((r, i) => {
|
|
40
|
+
const member = {
|
|
41
|
+
memberId: r.readNullableString(),
|
|
42
|
+
groupInstanceId: r.readNullableString(),
|
|
43
|
+
errorCode: r.readInt16()
|
|
44
|
+
};
|
|
45
|
+
if (member.errorCode !== 0) {
|
|
46
|
+
errors.push([`/members/${i}`, [member.errorCode, null]]);
|
|
47
|
+
}
|
|
48
|
+
return member;
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
if (errors.length) {
|
|
52
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
53
|
+
}
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
export const api = createAPI(13, 4, 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,67 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
ListOffsets Request (Version: 5) => replica_id isolation_level [topics]
|
|
6
|
+
replica_id => INT32
|
|
7
|
+
isolation_level => INT8
|
|
8
|
+
topics => name [partitions]
|
|
9
|
+
name => STRING
|
|
10
|
+
partitions => partition_index current_leader_epoch timestamp
|
|
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, false).appendArray(topic.partitions, (w, partition) => {
|
|
21
|
+
w.appendInt32(partition.partitionIndex)
|
|
22
|
+
.appendInt32(partition.currentLeaderEpoch)
|
|
23
|
+
.appendInt64(partition.timestamp);
|
|
24
|
+
}, false, false);
|
|
25
|
+
}, false, false);
|
|
26
|
+
}
|
|
27
|
+
/*
|
|
28
|
+
ListOffsets Response (Version: 5) => throttle_time_ms [topics]
|
|
29
|
+
throttle_time_ms => INT32
|
|
30
|
+
topics => name [partitions]
|
|
31
|
+
name => STRING
|
|
32
|
+
partitions => partition_index error_code timestamp offset leader_epoch
|
|
33
|
+
partition_index => INT32
|
|
34
|
+
error_code => INT16
|
|
35
|
+
timestamp => INT64
|
|
36
|
+
offset => INT64
|
|
37
|
+
leader_epoch => INT32
|
|
38
|
+
*/
|
|
39
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
40
|
+
const errors = [];
|
|
41
|
+
const response = {
|
|
42
|
+
throttleTimeMs: reader.readInt32(),
|
|
43
|
+
topics: reader.readArray((r, i) => {
|
|
44
|
+
return {
|
|
45
|
+
name: r.readString(false),
|
|
46
|
+
partitions: r.readArray((r, j) => {
|
|
47
|
+
const partition = {
|
|
48
|
+
partitionIndex: r.readInt32(),
|
|
49
|
+
errorCode: r.readInt16(),
|
|
50
|
+
timestamp: r.readInt64(),
|
|
51
|
+
offset: r.readInt64(),
|
|
52
|
+
leaderEpoch: r.readInt32()
|
|
53
|
+
};
|
|
54
|
+
if (partition.errorCode !== 0) {
|
|
55
|
+
errors.push([`/topics/${i}/partitions/${j}`, [partition.errorCode, null]]);
|
|
56
|
+
}
|
|
57
|
+
return partition;
|
|
58
|
+
}, false, false)
|
|
59
|
+
};
|
|
60
|
+
}, false, false)
|
|
61
|
+
};
|
|
62
|
+
if (errors.length) {
|
|
63
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
}
|
|
67
|
+
export const api = createAPI(2, 5, createRequest, parseResponse, false, false);
|
|
@@ -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>;
|