@platformatic/kafka 1.27.0-alpha.3 → 1.28.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.
Files changed (154) hide show
  1. package/README.md +64 -0
  2. package/dist/apis/admin/create-acls-v2.d.ts +16 -0
  3. package/dist/apis/admin/create-acls-v2.js +55 -0
  4. package/dist/apis/admin/delete-acls-v2.d.ts +21 -0
  5. package/dist/apis/admin/delete-acls-v2.js +84 -0
  6. package/dist/apis/admin/describe-acls-v2.d.ts +17 -0
  7. package/dist/apis/admin/describe-acls-v2.js +66 -0
  8. package/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
  9. package/dist/apis/admin/describe-cluster-v0.js +48 -0
  10. package/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
  11. package/dist/apis/admin/describe-log-dirs-v2.js +67 -0
  12. package/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
  13. package/dist/apis/admin/describe-log-dirs-v3.js +73 -0
  14. package/dist/apis/admin/index.d.ts +7 -0
  15. package/dist/apis/admin/index.js +7 -0
  16. package/dist/apis/admin/list-transactions-v0.d.ts +18 -0
  17. package/dist/apis/admin/list-transactions-v0.js +43 -0
  18. package/dist/apis/consumer/index.d.ts +8 -0
  19. package/dist/apis/consumer/index.js +8 -0
  20. package/dist/apis/consumer/join-group-v6.d.ts +27 -0
  21. package/dist/apis/consumer/join-group-v6.js +67 -0
  22. package/dist/apis/consumer/join-group-v7.d.ts +27 -0
  23. package/dist/apis/consumer/join-group-v7.js +68 -0
  24. package/dist/apis/consumer/join-group-v8.d.ts +27 -0
  25. package/dist/apis/consumer/join-group-v8.js +70 -0
  26. package/dist/apis/consumer/leave-group-v4.d.ts +22 -0
  27. package/dist/apis/consumer/leave-group-v4.js +56 -0
  28. package/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
  29. package/dist/apis/consumer/list-offsets-v5.js +67 -0
  30. package/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
  31. package/dist/apis/consumer/list-offsets-v6.js +68 -0
  32. package/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
  33. package/dist/apis/consumer/list-offsets-v7.js +68 -0
  34. package/dist/apis/consumer/sync-group-v4.d.ts +18 -0
  35. package/dist/apis/consumer/sync-group-v4.js +43 -0
  36. package/dist/apis/enumerations.d.ts +5 -5
  37. package/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
  38. package/dist/apis/producer/add-offsets-to-txn-v1.js +33 -0
  39. package/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
  40. package/dist/apis/producer/add-offsets-to-txn-v2.js +33 -0
  41. package/dist/apis/producer/index.d.ts +3 -0
  42. package/dist/apis/producer/index.js +3 -0
  43. package/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
  44. package/dist/apis/producer/init-producer-id-v3.js +38 -0
  45. package/dist/clients/admin/options.d.ts +9 -9
  46. package/dist/clients/consumer/consumer.js +38 -2
  47. package/dist/clients/consumer/messages-stream.d.ts +2 -2
  48. package/dist/clients/consumer/messages-stream.js +105 -21
  49. package/dist/clients/consumer/options.d.ts +24 -0
  50. package/dist/clients/consumer/options.js +3 -1
  51. package/dist/clients/consumer/types.d.ts +4 -1
  52. package/dist/clients/producer/index.d.ts +1 -0
  53. package/dist/clients/producer/index.js +1 -0
  54. package/dist/clients/producer/options.d.ts +65 -18
  55. package/dist/clients/producer/options.js +21 -1
  56. package/dist/clients/producer/producer-stream.d.ts +19 -0
  57. package/dist/clients/producer/producer-stream.js +187 -0
  58. package/dist/clients/producer/producer.d.ts +6 -3
  59. package/dist/clients/producer/producer.js +137 -19
  60. package/dist/clients/producer/types.d.ts +28 -1
  61. package/dist/clients/producer/types.js +6 -1
  62. package/dist/clients/serde.d.ts +11 -6
  63. package/dist/diagnostic.d.ts +2 -2
  64. package/dist/errors.d.ts +5 -5
  65. package/dist/errors.js +8 -6
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.js +2 -0
  68. package/dist/network/connection.d.ts +7 -6
  69. package/dist/network/connection.js +1 -1
  70. package/dist/protocol/compression.d.ts +1 -1
  71. package/dist/protocol/compression.js +7 -46
  72. package/dist/protocol/crc32c.d.ts +1 -1
  73. package/dist/protocol/crc32c.js +5 -6
  74. package/dist/protocol/definitions.d.ts +1 -1
  75. package/dist/protocol/definitions.js +1 -1
  76. package/dist/protocol/index.d.ts +0 -2
  77. package/dist/protocol/index.js +0 -2
  78. package/dist/protocol/reader.d.ts +2 -2
  79. package/dist/protocol/reader.js +4 -4
  80. package/dist/protocol/records.d.ts +11 -22
  81. package/dist/protocol/records.js +3 -7
  82. package/dist/protocol/sasl/oauth-bearer.d.ts +3 -3
  83. package/dist/protocol/sasl/plain.d.ts +3 -3
  84. package/dist/protocol/sasl/scram-sha.d.ts +3 -3
  85. package/dist/protocol/sasl/utils.d.ts +3 -3
  86. package/dist/protocol/writer.d.ts +1 -1
  87. package/dist/protocol/writer.js +3 -3
  88. package/dist/registries/abstract.d.ts +22 -0
  89. package/dist/registries/abstract.js +38 -0
  90. package/dist/registries/confluent-schema-registry.d.ts +41 -0
  91. package/dist/registries/confluent-schema-registry.js +222 -0
  92. package/dist/registries/index.d.ts +2 -0
  93. package/dist/registries/index.js +2 -0
  94. package/dist/typescript-4/dist/apis/admin/create-acls-v2.d.ts +16 -0
  95. package/dist/typescript-4/dist/apis/admin/delete-acls-v2.d.ts +21 -0
  96. package/dist/typescript-4/dist/apis/admin/describe-acls-v2.d.ts +17 -0
  97. package/dist/typescript-4/dist/apis/admin/describe-cluster-v0.d.ts +23 -0
  98. package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v2.d.ts +32 -0
  99. package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v3.d.ts +32 -0
  100. package/dist/typescript-4/dist/apis/admin/index.d.ts +7 -0
  101. package/dist/typescript-4/dist/apis/admin/list-transactions-v0.d.ts +18 -0
  102. package/dist/typescript-4/dist/apis/consumer/index.d.ts +8 -0
  103. package/dist/typescript-4/dist/apis/consumer/join-group-v6.d.ts +27 -0
  104. package/dist/typescript-4/dist/apis/consumer/join-group-v7.d.ts +27 -0
  105. package/dist/typescript-4/dist/apis/consumer/join-group-v8.d.ts +27 -0
  106. package/dist/typescript-4/dist/apis/consumer/leave-group-v4.d.ts +22 -0
  107. package/dist/typescript-4/dist/apis/consumer/list-offsets-v5.d.ts +30 -0
  108. package/dist/typescript-4/dist/apis/consumer/list-offsets-v6.d.ts +30 -0
  109. package/dist/typescript-4/dist/apis/consumer/list-offsets-v7.d.ts +30 -0
  110. package/dist/typescript-4/dist/apis/consumer/sync-group-v4.d.ts +18 -0
  111. package/dist/typescript-4/dist/apis/enumerations.d.ts +5 -5
  112. package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v1.d.ts +10 -0
  113. package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v2.d.ts +10 -0
  114. package/dist/typescript-4/dist/apis/producer/index.d.ts +3 -0
  115. package/dist/typescript-4/dist/apis/producer/init-producer-id-v3.d.ts +21 -0
  116. package/dist/typescript-4/dist/clients/admin/options.d.ts +9 -9
  117. package/dist/typescript-4/dist/clients/consumer/messages-stream.d.ts +2 -2
  118. package/dist/typescript-4/dist/clients/consumer/options.d.ts +24 -0
  119. package/dist/typescript-4/dist/clients/consumer/types.d.ts +4 -1
  120. package/dist/typescript-4/dist/clients/producer/index.d.ts +1 -0
  121. package/dist/typescript-4/dist/clients/producer/options.d.ts +66 -19
  122. package/dist/typescript-4/dist/clients/producer/producer-stream.d.ts +19 -0
  123. package/dist/typescript-4/dist/clients/producer/producer.d.ts +6 -3
  124. package/dist/typescript-4/dist/clients/producer/types.d.ts +29 -2
  125. package/dist/typescript-4/dist/clients/serde.d.ts +11 -6
  126. package/dist/typescript-4/dist/diagnostic.d.ts +2 -2
  127. package/dist/typescript-4/dist/errors.d.ts +5 -5
  128. package/dist/typescript-4/dist/index.d.ts +2 -1
  129. package/dist/typescript-4/dist/network/connection.d.ts +7 -6
  130. package/dist/typescript-4/dist/protocol/compression.d.ts +1 -1
  131. package/dist/typescript-4/dist/protocol/crc32c.d.ts +1 -1
  132. package/dist/typescript-4/dist/protocol/definitions.d.ts +1 -1
  133. package/dist/typescript-4/dist/protocol/index.d.ts +0 -2
  134. package/dist/typescript-4/dist/protocol/reader.d.ts +2 -2
  135. package/dist/typescript-4/dist/protocol/records.d.ts +11 -22
  136. package/dist/typescript-4/dist/protocol/sasl/oauth-bearer.d.ts +3 -3
  137. package/dist/typescript-4/dist/protocol/sasl/plain.d.ts +3 -3
  138. package/dist/typescript-4/dist/protocol/sasl/scram-sha.d.ts +3 -3
  139. package/dist/typescript-4/dist/protocol/sasl/utils.d.ts +3 -3
  140. package/dist/typescript-4/dist/protocol/writer.d.ts +1 -1
  141. package/dist/typescript-4/dist/registries/abstract.d.ts +22 -0
  142. package/dist/typescript-4/dist/registries/confluent-schema-registry.d.ts +41 -0
  143. package/dist/typescript-4/dist/registries/index.d.ts +2 -0
  144. package/dist/typescript-4/dist/utils.d.ts +3 -2
  145. package/dist/utils.d.ts +2 -1
  146. package/dist/utils.js +3 -0
  147. package/dist/version.js +1 -1
  148. package/package.json +14 -11
  149. package/dist/protocol/dynamic-buffer.d.ts +0 -65
  150. package/dist/protocol/dynamic-buffer.js +0 -563
  151. package/dist/protocol/varint.d.ts +0 -12
  152. package/dist/protocol/varint.js +0 -36
  153. package/dist/typescript-4/dist/protocol/dynamic-buffer.d.ts +0 -65
  154. package/dist/typescript-4/dist/protocol/varint.d.ts +0 -12
@@ -5,24 +5,30 @@ export * as alterPartitionV3 from "./alter-partition-v3.js";
5
5
  export * as alterReplicaLogDirsV2 from "./alter-replica-log-dirs-v2.js";
6
6
  export * as alterUserScramCredentialsV0 from "./alter-user-scram-credentials-v0.js";
7
7
  export * as consumerGroupDescribeV0 from "./consumer-group-describe-v0.js";
8
+ export * as createAclsV2 from "./create-acls-v2.js";
8
9
  export * as createAclsV3 from "./create-acls-v3.js";
9
10
  export * as createDelegationTokenV3 from "./create-delegation-token-v3.js";
10
11
  export * as createPartitionsV1 from "./create-partitions-v1.js";
11
12
  export * as createPartitionsV2 from "./create-partitions-v2.js";
12
13
  export * as createPartitionsV3 from "./create-partitions-v3.js";
13
14
  export * as createTopicsV7 from "./create-topics-v7.js";
15
+ export * as deleteAclsV2 from "./delete-acls-v2.js";
14
16
  export * as deleteAclsV3 from "./delete-acls-v3.js";
15
17
  export * as deleteGroupsV2 from "./delete-groups-v2.js";
16
18
  export * as deleteRecordsV2 from "./delete-records-v2.js";
17
19
  export * as deleteTopicsV6 from "./delete-topics-v6.js";
20
+ export * as describeAclsV2 from "./describe-acls-v2.js";
18
21
  export * as describeAclsV3 from "./describe-acls-v3.js";
19
22
  export * as describeClientQuotasV0 from "./describe-client-quotas-v0.js";
23
+ export * as describeClusterV0 from "./describe-cluster-v0.js";
20
24
  export * as describeClusterV1 from "./describe-cluster-v1.js";
21
25
  export * as describeConfigsV2 from "./describe-configs-v2.js";
22
26
  export * as describeConfigsV3 from "./describe-configs-v3.js";
23
27
  export * as describeConfigsV4 from "./describe-configs-v4.js";
24
28
  export * as describeDelegationTokenV3 from "./describe-delegation-token-v3.js";
25
29
  export * as describeGroupsV5 from "./describe-groups-v5.js";
30
+ export * as describeLogDirsV2 from "./describe-log-dirs-v2.js";
31
+ export * as describeLogDirsV3 from "./describe-log-dirs-v3.js";
26
32
  export * as describeLogDirsV4 from "./describe-log-dirs-v4.js";
27
33
  export * as describeProducersV0 from "./describe-producers-v0.js";
28
34
  export * as describeQuorumV2 from "./describe-quorum-v2.js";
@@ -35,6 +41,7 @@ export * as incrementalAlterConfigsV1 from "./incremental-alter-configs-v1.js";
35
41
  export * as listGroupsV4 from "./list-groups-v4.js";
36
42
  export * as listGroupsV5 from "./list-groups-v5.js";
37
43
  export * as listPartitionReassignmentsV0 from "./list-partition-reassignments-v0.js";
44
+ export * as listTransactionsV0 from "./list-transactions-v0.js";
38
45
  export * as listTransactionsV1 from "./list-transactions-v1.js";
39
46
  export * as offsetDeleteV0 from "./offset-delete-v0.js";
40
47
  export * as renewDelegationTokenV2 from "./renew-delegation-token-v2.js";
@@ -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>;