kafka-ts 0.0.1-beta
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/.prettierrc +7 -0
- package/LICENSE +24 -0
- package/README.md +88 -0
- package/certs/ca.crt +29 -0
- package/certs/ca.key +52 -0
- package/certs/ca.srl +1 -0
- package/certs/kafka.crt +29 -0
- package/certs/kafka.csr +26 -0
- package/certs/kafka.key +52 -0
- package/certs/kafka.keystore.jks +0 -0
- package/certs/kafka.truststore.jks +0 -0
- package/dist/api/api-versions.d.ts +9 -0
- package/dist/api/api-versions.js +24 -0
- package/dist/api/create-topics.d.ts +38 -0
- package/dist/api/create-topics.js +53 -0
- package/dist/api/delete-topics.d.ts +18 -0
- package/dist/api/delete-topics.js +33 -0
- package/dist/api/fetch.d.ts +77 -0
- package/dist/api/fetch.js +106 -0
- package/dist/api/find-coordinator.d.ts +21 -0
- package/dist/api/find-coordinator.js +39 -0
- package/dist/api/heartbeat.d.ts +11 -0
- package/dist/api/heartbeat.js +27 -0
- package/dist/api/index.d.ts +573 -0
- package/dist/api/index.js +164 -0
- package/dist/api/init-producer-id.d.ts +13 -0
- package/dist/api/init-producer-id.js +29 -0
- package/dist/api/join-group.d.ts +34 -0
- package/dist/api/join-group.js +51 -0
- package/dist/api/leave-group.d.ts +19 -0
- package/dist/api/leave-group.js +39 -0
- package/dist/api/list-offsets.d.ts +29 -0
- package/dist/api/list-offsets.js +48 -0
- package/dist/api/metadata.d.ts +40 -0
- package/dist/api/metadata.js +58 -0
- package/dist/api/offset-commit.d.ts +28 -0
- package/dist/api/offset-commit.js +48 -0
- package/dist/api/offset-fetch.d.ts +33 -0
- package/dist/api/offset-fetch.js +57 -0
- package/dist/api/produce.d.ts +53 -0
- package/dist/api/produce.js +129 -0
- package/dist/api/sasl-authenticate.d.ts +11 -0
- package/dist/api/sasl-authenticate.js +23 -0
- package/dist/api/sasl-handshake.d.ts +6 -0
- package/dist/api/sasl-handshake.js +19 -0
- package/dist/api/sync-group.d.ts +24 -0
- package/dist/api/sync-group.js +36 -0
- package/dist/broker.d.ts +29 -0
- package/dist/broker.js +60 -0
- package/dist/client.d.ts +23 -0
- package/dist/client.js +36 -0
- package/dist/cluster.d.ts +24 -0
- package/dist/cluster.js +72 -0
- package/dist/connection.d.ts +25 -0
- package/dist/connection.js +155 -0
- package/dist/consumer/consumer-group.d.ts +36 -0
- package/dist/consumer/consumer-group.js +182 -0
- package/dist/consumer/consumer-metadata.d.ts +7 -0
- package/dist/consumer/consumer-metadata.js +14 -0
- package/dist/consumer/consumer.d.ts +37 -0
- package/dist/consumer/consumer.js +178 -0
- package/dist/consumer/metadata.d.ts +24 -0
- package/dist/consumer/metadata.js +64 -0
- package/dist/consumer/offset-manager.d.ts +22 -0
- package/dist/consumer/offset-manager.js +56 -0
- package/dist/distributors/assignments-to-replicas.d.ts +17 -0
- package/dist/distributors/assignments-to-replicas.js +60 -0
- package/dist/distributors/assignments-to-replicas.test.d.ts +1 -0
- package/dist/distributors/assignments-to-replicas.test.js +40 -0
- package/dist/distributors/messages-to-topic-partition-leaders.d.ts +17 -0
- package/dist/distributors/messages-to-topic-partition-leaders.js +15 -0
- package/dist/distributors/messages-to-topic-partition-leaders.test.d.ts +1 -0
- package/dist/distributors/messages-to-topic-partition-leaders.test.js +30 -0
- package/dist/examples/src/replicator.js +34 -0
- package/dist/examples/src/utils/json.js +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/metadata.d.ts +24 -0
- package/dist/metadata.js +89 -0
- package/dist/producer/producer.d.ts +19 -0
- package/dist/producer/producer.js +111 -0
- package/dist/request-handler.d.ts +16 -0
- package/dist/request-handler.js +67 -0
- package/dist/request-handler.test.d.ts +1 -0
- package/dist/request-handler.test.js +340 -0
- package/dist/src/api/api-versions.js +18 -0
- package/dist/src/api/create-topics.js +46 -0
- package/dist/src/api/delete-topics.js +26 -0
- package/dist/src/api/fetch.js +95 -0
- package/dist/src/api/find-coordinator.js +34 -0
- package/dist/src/api/heartbeat.js +22 -0
- package/dist/src/api/index.js +38 -0
- package/dist/src/api/init-producer-id.js +24 -0
- package/dist/src/api/join-group.js +48 -0
- package/dist/src/api/leave-group.js +30 -0
- package/dist/src/api/list-offsets.js +39 -0
- package/dist/src/api/metadata.js +47 -0
- package/dist/src/api/offset-commit.js +39 -0
- package/dist/src/api/offset-fetch.js +44 -0
- package/dist/src/api/produce.js +119 -0
- package/dist/src/api/sync-group.js +31 -0
- package/dist/src/broker.js +35 -0
- package/dist/src/connection.js +21 -0
- package/dist/src/consumer/consumer-group.js +131 -0
- package/dist/src/consumer/consumer.js +103 -0
- package/dist/src/consumer/metadata.js +52 -0
- package/dist/src/consumer/offset-manager.js +23 -0
- package/dist/src/index.js +19 -0
- package/dist/src/producer/producer.js +84 -0
- package/dist/src/request-handler.js +57 -0
- package/dist/src/request-handler.test.js +321 -0
- package/dist/src/types.js +2 -0
- package/dist/src/utils/api.js +5 -0
- package/dist/src/utils/decoder.js +161 -0
- package/dist/src/utils/encoder.js +137 -0
- package/dist/src/utils/error.js +10 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +2 -0
- package/dist/utils/api.d.ts +9 -0
- package/dist/utils/api.js +5 -0
- package/dist/utils/debug.d.ts +2 -0
- package/dist/utils/debug.js +11 -0
- package/dist/utils/decoder.d.ts +29 -0
- package/dist/utils/decoder.js +147 -0
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/delay.js +5 -0
- package/dist/utils/encoder.d.ts +28 -0
- package/dist/utils/encoder.js +122 -0
- package/dist/utils/error.d.ts +11 -0
- package/dist/utils/error.js +27 -0
- package/dist/utils/memo.d.ts +1 -0
- package/dist/utils/memo.js +16 -0
- package/dist/utils/retrier.d.ts +10 -0
- package/dist/utils/retrier.js +22 -0
- package/dist/utils/tracer.d.ts +1 -0
- package/dist/utils/tracer.js +26 -0
- package/docker-compose.yml +104 -0
- package/examples/node_modules/.package-lock.json +22 -0
- package/examples/package-lock.json +30 -0
- package/examples/package.json +14 -0
- package/examples/src/client.ts +9 -0
- package/examples/src/consumer.ts +17 -0
- package/examples/src/create-topic.ts +37 -0
- package/examples/src/producer.ts +24 -0
- package/examples/src/replicator.ts +25 -0
- package/examples/src/utils/json.ts +1 -0
- package/examples/tsconfig.json +7 -0
- package/log4j.properties +95 -0
- package/package.json +17 -0
- package/scripts/generate-certs.sh +24 -0
- package/src/__snapshots__/request-handler.test.ts.snap +1687 -0
- package/src/api/api-versions.ts +21 -0
- package/src/api/create-topics.ts +78 -0
- package/src/api/delete-topics.ts +42 -0
- package/src/api/fetch.ts +143 -0
- package/src/api/find-coordinator.ts +39 -0
- package/src/api/heartbeat.ts +33 -0
- package/src/api/index.ts +164 -0
- package/src/api/init-producer-id.ts +35 -0
- package/src/api/join-group.ts +67 -0
- package/src/api/leave-group.ts +48 -0
- package/src/api/list-offsets.ts +65 -0
- package/src/api/metadata.ts +66 -0
- package/src/api/offset-commit.ts +67 -0
- package/src/api/offset-fetch.ts +74 -0
- package/src/api/produce.ts +173 -0
- package/src/api/sasl-authenticate.ts +21 -0
- package/src/api/sasl-handshake.ts +16 -0
- package/src/api/sync-group.ts +54 -0
- package/src/broker.ts +74 -0
- package/src/client.ts +47 -0
- package/src/cluster.ts +87 -0
- package/src/connection.ts +141 -0
- package/src/consumer/consumer-group.ts +209 -0
- package/src/consumer/consumer-metadata.ts +14 -0
- package/src/consumer/consumer.ts +229 -0
- package/src/consumer/offset-manager.ts +93 -0
- package/src/distributors/assignments-to-replicas.test.ts +43 -0
- package/src/distributors/assignments-to-replicas.ts +85 -0
- package/src/distributors/messages-to-topic-partition-leaders.test.ts +32 -0
- package/src/distributors/messages-to-topic-partition-leaders.ts +19 -0
- package/src/index.ts +3 -0
- package/src/metadata.ts +122 -0
- package/src/producer/producer.ts +132 -0
- package/src/request-handler.test.ts +366 -0
- package/src/types.ts +9 -0
- package/src/utils/api.ts +11 -0
- package/src/utils/debug.ts +9 -0
- package/src/utils/decoder.ts +168 -0
- package/src/utils/delay.ts +1 -0
- package/src/utils/encoder.ts +141 -0
- package/src/utils/error.ts +21 -0
- package/src/utils/memo.ts +12 -0
- package/src/utils/retrier.ts +39 -0
- package/src/utils/tracer.ts +28 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_ERROR = exports.getApiName = exports.API = void 0;
|
|
4
|
+
const api_versions_1 = require("./api-versions");
|
|
5
|
+
const create_topics_1 = require("./create-topics");
|
|
6
|
+
const delete_topics_1 = require("./delete-topics");
|
|
7
|
+
const fetch_1 = require("./fetch");
|
|
8
|
+
const find_coordinator_1 = require("./find-coordinator");
|
|
9
|
+
const heartbeat_1 = require("./heartbeat");
|
|
10
|
+
const init_producer_id_1 = require("./init-producer-id");
|
|
11
|
+
const join_group_1 = require("./join-group");
|
|
12
|
+
const leave_group_1 = require("./leave-group");
|
|
13
|
+
const list_offsets_1 = require("./list-offsets");
|
|
14
|
+
const metadata_1 = require("./metadata");
|
|
15
|
+
const offset_commit_1 = require("./offset-commit");
|
|
16
|
+
const offset_fetch_1 = require("./offset-fetch");
|
|
17
|
+
const produce_1 = require("./produce");
|
|
18
|
+
const sasl_authenticate_1 = require("./sasl-authenticate");
|
|
19
|
+
const sasl_handshake_1 = require("./sasl-handshake");
|
|
20
|
+
const sync_group_1 = require("./sync-group");
|
|
21
|
+
exports.API = {
|
|
22
|
+
API_VERSIONS: api_versions_1.API_VERSIONS,
|
|
23
|
+
CREATE_TOPICS: create_topics_1.CREATE_TOPICS,
|
|
24
|
+
DELETE_TOPICS: delete_topics_1.DELETE_TOPICS,
|
|
25
|
+
FETCH: fetch_1.FETCH,
|
|
26
|
+
FIND_COORDINATOR: find_coordinator_1.FIND_COORDINATOR,
|
|
27
|
+
HEARTBEAT: heartbeat_1.HEARTBEAT,
|
|
28
|
+
INIT_PRODUCER_ID: init_producer_id_1.INIT_PRODUCER_ID,
|
|
29
|
+
JOIN_GROUP: join_group_1.JOIN_GROUP,
|
|
30
|
+
LEAVE_GROUP: leave_group_1.LEAVE_GROUP,
|
|
31
|
+
LIST_OFFSETS: list_offsets_1.LIST_OFFSETS,
|
|
32
|
+
METADATA: metadata_1.METADATA,
|
|
33
|
+
OFFSET_COMMIT: offset_commit_1.OFFSET_COMMIT,
|
|
34
|
+
OFFSET_FETCH: offset_fetch_1.OFFSET_FETCH,
|
|
35
|
+
PRODUCE: produce_1.PRODUCE,
|
|
36
|
+
SASL_AUTHENTICATE: sasl_authenticate_1.SASL_AUTHENTICATE,
|
|
37
|
+
SASL_HANDSHAKE: sasl_handshake_1.SASL_HANDSHAKE,
|
|
38
|
+
SYNC_GROUP: sync_group_1.SYNC_GROUP,
|
|
39
|
+
};
|
|
40
|
+
const getApiName = (api) => Object.entries(exports.API).find(([, v]) => v === api)?.[0];
|
|
41
|
+
exports.getApiName = getApiName;
|
|
42
|
+
exports.API_ERROR = {
|
|
43
|
+
UNKNOWN_SERVER_ERROR: -1,
|
|
44
|
+
OFFSET_OUT_OF_RANGE: 1,
|
|
45
|
+
CORRUPT_MESSAGE: 2,
|
|
46
|
+
UNKNOWN_TOPIC_OR_PARTITION: 3,
|
|
47
|
+
INVALID_FETCH_SIZE: 4,
|
|
48
|
+
LEADER_NOT_AVAILABLE: 5,
|
|
49
|
+
NOT_LEADER_OR_FOLLOWER: 6,
|
|
50
|
+
REQUEST_TIMED_OUT: 7,
|
|
51
|
+
BROKER_NOT_AVAILABLE: 8,
|
|
52
|
+
REPLICA_NOT_AVAILABLE: 9,
|
|
53
|
+
MESSAGE_TOO_LARGE: 10,
|
|
54
|
+
STALE_CONTROLLER_EPOCH: 11,
|
|
55
|
+
OFFSET_METADATA_TOO_LARGE: 12,
|
|
56
|
+
NETWORK_EXCEPTION: 13,
|
|
57
|
+
COORDINATOR_LOAD_IN_PROGRESS: 14,
|
|
58
|
+
COORDINATOR_NOT_AVAILABLE: 15,
|
|
59
|
+
NOT_COORDINATOR: 16,
|
|
60
|
+
INVALID_TOPIC_EXCEPTION: 17,
|
|
61
|
+
RECORD_LIST_TOO_LARGE: 18,
|
|
62
|
+
NOT_ENOUGH_REPLICAS: 19,
|
|
63
|
+
NOT_ENOUGH_REPLICAS_AFTER_APPEND: 20,
|
|
64
|
+
INVALID_REQUIRED_ACKS: 21,
|
|
65
|
+
ILLEGAL_GENERATION: 22,
|
|
66
|
+
INCONSISTENT_GROUP_PROTOCOL: 23,
|
|
67
|
+
INVALID_GROUP_ID: 24,
|
|
68
|
+
UNKNOWN_MEMBER_ID: 25,
|
|
69
|
+
INVALID_SESSION_TIMEOUT: 26,
|
|
70
|
+
REBALANCE_IN_PROGRESS: 27,
|
|
71
|
+
INVALID_COMMIT_OFFSET_SIZE: 28,
|
|
72
|
+
TOPIC_AUTHORIZATION_FAILED: 29,
|
|
73
|
+
GROUP_AUTHORIZATION_FAILED: 30,
|
|
74
|
+
CLUSTER_AUTHORIZATION_FAILED: 31,
|
|
75
|
+
INVALID_TIMESTAMP: 32,
|
|
76
|
+
UNSUPPORTED_SASL_MECHANISM: 33,
|
|
77
|
+
ILLEGAL_SASL_STATE: 34,
|
|
78
|
+
UNSUPPORTED_VERSION: 35,
|
|
79
|
+
TOPIC_ALREADY_EXISTS: 36,
|
|
80
|
+
INVALID_PARTITIONS: 37,
|
|
81
|
+
INVALID_REPLICATION_FACTOR: 38,
|
|
82
|
+
INVALID_REPLICA_ASSIGNMENT: 39,
|
|
83
|
+
INVALID_CONFIG: 40,
|
|
84
|
+
NOT_CONTROLLER: 41,
|
|
85
|
+
INVALID_REQUEST: 42,
|
|
86
|
+
UNSUPPORTED_FOR_MESSAGE_FORMAT: 43,
|
|
87
|
+
POLICY_VIOLATION: 44,
|
|
88
|
+
OUT_OF_ORDER_SEQUENCE_NUMBER: 45,
|
|
89
|
+
DUPLICATE_SEQUENCE_NUMBER: 46,
|
|
90
|
+
INVALID_PRODUCER_EPOCH: 47,
|
|
91
|
+
INVALID_TXN_STATE: 48,
|
|
92
|
+
INVALID_PRODUCER_ID_MAPPING: 49,
|
|
93
|
+
INVALID_TRANSACTION_TIMEOUT: 50,
|
|
94
|
+
CONCURRENT_TRANSACTIONS: 51,
|
|
95
|
+
TRANSACTION_COORDINATOR_FENCED: 52,
|
|
96
|
+
TRANSACTIONAL_ID_AUTHORIZATION_FAILED: 53,
|
|
97
|
+
SECURITY_DISABLED: 54,
|
|
98
|
+
OPERATION_NOT_ATTEMPTED: 55,
|
|
99
|
+
KAFKA_STORAGE_ERROR: 56,
|
|
100
|
+
LOG_DIR_NOT_FOUND: 57,
|
|
101
|
+
SASL_AUTHENTICATION_FAILED: 58,
|
|
102
|
+
UNKNOWN_PRODUCER_ID: 59,
|
|
103
|
+
REASSIGNMENT_IN_PROGRESS: 60,
|
|
104
|
+
DELEGATION_TOKEN_AUTH_DISABLED: 61,
|
|
105
|
+
DELEGATION_TOKEN_NOT_FOUND: 62,
|
|
106
|
+
DELEGATION_TOKEN_OWNER_MISMATCH: 63,
|
|
107
|
+
DELEGATION_TOKEN_REQUEST_NOT_ALLOWED: 64,
|
|
108
|
+
DELEGATION_TOKEN_AUTHORIZATION_FAILED: 65,
|
|
109
|
+
DELEGATION_TOKEN_EXPIRED: 66,
|
|
110
|
+
INVALID_PRINCIPAL_TYPE: 67,
|
|
111
|
+
NON_EMPTY_GROUP: 68,
|
|
112
|
+
GROUP_ID_NOT_FOUND: 69,
|
|
113
|
+
FETCH_SESSION_ID_NOT_FOUND: 70,
|
|
114
|
+
INVALID_FETCH_SESSION_EPOCH: 71,
|
|
115
|
+
LISTENER_NOT_FOUND: 72,
|
|
116
|
+
TOPIC_DELETION_DISABLED: 73,
|
|
117
|
+
FENCED_LEADER_EPOCH: 74,
|
|
118
|
+
UNKNOWN_LEADER_EPOCH: 75,
|
|
119
|
+
UNSUPPORTED_COMPRESSION_TYPE: 76,
|
|
120
|
+
STALE_BROKER_EPOCH: 77,
|
|
121
|
+
OFFSET_NOT_AVAILABLE: 78,
|
|
122
|
+
MEMBER_ID_REQUIRED: 79,
|
|
123
|
+
PREFERRED_LEADER_NOT_AVAILABLE: 80,
|
|
124
|
+
GROUP_MAX_SIZE_REACHED: 81,
|
|
125
|
+
FENCED_INSTANCE_ID: 82,
|
|
126
|
+
ELIGIBLE_LEADERS_NOT_AVAILABLE: 83,
|
|
127
|
+
ELECTION_NOT_NEEDED: 84,
|
|
128
|
+
NO_REASSIGNMENT_IN_PROGRESS: 85,
|
|
129
|
+
GROUP_SUBSCRIBED_TO_TOPIC: 86,
|
|
130
|
+
INVALID_RECORD: 87,
|
|
131
|
+
UNSTABLE_OFFSET_COMMIT: 88,
|
|
132
|
+
THROTTLING_QUOTA_EXCEEDED: 89,
|
|
133
|
+
PRODUCER_FENCED: 90,
|
|
134
|
+
RESOURCE_NOT_FOUND: 91,
|
|
135
|
+
DUPLICATE_RESOURCE: 92,
|
|
136
|
+
UNACCEPTABLE_CREDENTIAL: 93,
|
|
137
|
+
INCONSISTENT_VOTER_SET: 94,
|
|
138
|
+
INVALID_UPDATE_VERSION: 95,
|
|
139
|
+
FEATURE_UPDATE_FAILED: 96,
|
|
140
|
+
PRINCIPAL_DESERIALIZATION_FAILURE: 97,
|
|
141
|
+
SNAPSHOT_NOT_FOUND: 98,
|
|
142
|
+
POSITION_OUT_OF_RANGE: 99,
|
|
143
|
+
UNKNOWN_TOPIC_ID: 100,
|
|
144
|
+
DUPLICATE_BROKER_REGISTRATION: 101,
|
|
145
|
+
BROKER_ID_NOT_REGISTERED: 102,
|
|
146
|
+
INCONSISTENT_TOPIC_ID: 103,
|
|
147
|
+
INCONSISTENT_CLUSTER_ID: 104,
|
|
148
|
+
TRANSACTIONAL_ID_NOT_FOUND: 105,
|
|
149
|
+
FETCH_SESSION_TOPIC_ID_ERROR: 106,
|
|
150
|
+
INELIGIBLE_REPLICA: 107,
|
|
151
|
+
NEW_LEADER_ELECTED: 108,
|
|
152
|
+
OFFSET_MOVED_TO_TIERED_STORAGE: 109,
|
|
153
|
+
FENCED_MEMBER_EPOCH: 110,
|
|
154
|
+
UNRELEASED_INSTANCE_ID: 111,
|
|
155
|
+
UNSUPPORTED_ASSIGNOR: 112,
|
|
156
|
+
STALE_MEMBER_EPOCH: 113,
|
|
157
|
+
MISMATCHED_ENDPOINT_TYPE: 114,
|
|
158
|
+
UNSUPPORTED_ENDPOINT_TYPE: 115,
|
|
159
|
+
UNKNOWN_CONTROLLER_ID: 116,
|
|
160
|
+
UNKNOWN_SUBSCRIPTION_ID: 117,
|
|
161
|
+
TELEMETRY_TOO_LARGE: 118,
|
|
162
|
+
INVALID_REGISTRATION: 119,
|
|
163
|
+
TRANSACTION_ABORTABLE: 120,
|
|
164
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const INIT_PRODUCER_ID: import("../utils/api").Api<{
|
|
2
|
+
transactionalId: string | null;
|
|
3
|
+
transactionTimeoutMs: number;
|
|
4
|
+
producerId: bigint;
|
|
5
|
+
producerEpoch: number;
|
|
6
|
+
}, {
|
|
7
|
+
_tag: void;
|
|
8
|
+
throttleTimeMs: number;
|
|
9
|
+
errorCode: number;
|
|
10
|
+
producerId: bigint;
|
|
11
|
+
producerEpoch: number;
|
|
12
|
+
_tag2: void;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INIT_PRODUCER_ID = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.INIT_PRODUCER_ID = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 22,
|
|
8
|
+
apiVersion: 4,
|
|
9
|
+
request: (encoder, body) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(body.transactionalId)
|
|
12
|
+
.writeInt32(body.transactionTimeoutMs)
|
|
13
|
+
.writeInt64(body.producerId)
|
|
14
|
+
.writeInt16(body.producerEpoch)
|
|
15
|
+
.writeUVarInt(0),
|
|
16
|
+
response: (decoder) => {
|
|
17
|
+
const result = {
|
|
18
|
+
_tag: decoder.readTagBuffer(),
|
|
19
|
+
throttleTimeMs: decoder.readInt32(),
|
|
20
|
+
errorCode: decoder.readInt16(),
|
|
21
|
+
producerId: decoder.readInt64(),
|
|
22
|
+
producerEpoch: decoder.readInt16(),
|
|
23
|
+
_tag2: decoder.readTagBuffer(),
|
|
24
|
+
};
|
|
25
|
+
if (result.errorCode)
|
|
26
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
27
|
+
return result;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const JOIN_GROUP: import("../utils/api").Api<{
|
|
3
|
+
groupId: string;
|
|
4
|
+
sessionTimeoutMs: number;
|
|
5
|
+
rebalanceTimeoutMs: number;
|
|
6
|
+
memberId: string;
|
|
7
|
+
groupInstanceId: string | null;
|
|
8
|
+
protocolType: string;
|
|
9
|
+
protocols: {
|
|
10
|
+
name: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
version: number;
|
|
13
|
+
topics: string[];
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
reason: string | null;
|
|
17
|
+
}, {
|
|
18
|
+
_tag: void;
|
|
19
|
+
throttleTimeMs: number;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
generationId: number;
|
|
22
|
+
protocolType: string | null;
|
|
23
|
+
protocolName: string | null;
|
|
24
|
+
leader: string;
|
|
25
|
+
skipAssignment: boolean;
|
|
26
|
+
memberId: string;
|
|
27
|
+
members: {
|
|
28
|
+
memberId: string;
|
|
29
|
+
groupInstanceId: string | null;
|
|
30
|
+
metadata: Buffer;
|
|
31
|
+
_tag: void;
|
|
32
|
+
}[];
|
|
33
|
+
_tag2: void;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JOIN_GROUP = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const encoder_1 = require("../utils/encoder");
|
|
6
|
+
const error_1 = require("../utils/error");
|
|
7
|
+
exports.JOIN_GROUP = (0, api_1.createApi)({
|
|
8
|
+
apiKey: 11,
|
|
9
|
+
apiVersion: 9,
|
|
10
|
+
request: (encoder, data) => encoder
|
|
11
|
+
.writeUVarInt(0)
|
|
12
|
+
.writeCompactString(data.groupId)
|
|
13
|
+
.writeInt32(data.sessionTimeoutMs)
|
|
14
|
+
.writeInt32(data.rebalanceTimeoutMs)
|
|
15
|
+
.writeCompactString(data.memberId)
|
|
16
|
+
.writeCompactString(data.groupInstanceId)
|
|
17
|
+
.writeCompactString(data.protocolType)
|
|
18
|
+
.writeCompactArray(data.protocols, (encoder, protocol) => {
|
|
19
|
+
const metadata = new encoder_1.Encoder()
|
|
20
|
+
.writeInt16(protocol.metadata.version)
|
|
21
|
+
.writeArray(protocol.metadata.topics, (encoder, topic) => encoder.writeString(topic))
|
|
22
|
+
.writeBytes(Buffer.alloc(0))
|
|
23
|
+
.value();
|
|
24
|
+
return encoder.writeCompactString(protocol.name).writeCompactBytes(metadata).writeUVarInt(0);
|
|
25
|
+
})
|
|
26
|
+
.writeCompactString(data.reason)
|
|
27
|
+
.writeUVarInt(0),
|
|
28
|
+
response: (decoder) => {
|
|
29
|
+
const result = {
|
|
30
|
+
_tag: decoder.readTagBuffer(),
|
|
31
|
+
throttleTimeMs: decoder.readInt32(),
|
|
32
|
+
errorCode: decoder.readInt16(),
|
|
33
|
+
generationId: decoder.readInt32(),
|
|
34
|
+
protocolType: decoder.readCompactString(),
|
|
35
|
+
protocolName: decoder.readCompactString(),
|
|
36
|
+
leader: decoder.readCompactString(),
|
|
37
|
+
skipAssignment: decoder.readBoolean(),
|
|
38
|
+
memberId: decoder.readCompactString(),
|
|
39
|
+
members: decoder.readCompactArray((decoder) => ({
|
|
40
|
+
memberId: decoder.readCompactString(),
|
|
41
|
+
groupInstanceId: decoder.readCompactString(),
|
|
42
|
+
metadata: decoder.readCompactBytes(),
|
|
43
|
+
_tag: decoder.readTagBuffer(),
|
|
44
|
+
})),
|
|
45
|
+
_tag2: decoder.readTagBuffer(),
|
|
46
|
+
};
|
|
47
|
+
if (result.errorCode)
|
|
48
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
49
|
+
return result;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const LEAVE_GROUP: import("../utils/api").Api<{
|
|
2
|
+
groupId: string;
|
|
3
|
+
members: {
|
|
4
|
+
memberId: string;
|
|
5
|
+
groupInstanceId: string | null;
|
|
6
|
+
reason: string | null;
|
|
7
|
+
}[];
|
|
8
|
+
}, {
|
|
9
|
+
_tag: void;
|
|
10
|
+
throttleTimeMs: number;
|
|
11
|
+
errorCode: number;
|
|
12
|
+
members: {
|
|
13
|
+
memberId: string;
|
|
14
|
+
groupInstanceId: string | null;
|
|
15
|
+
errorCode: number;
|
|
16
|
+
_tag: void;
|
|
17
|
+
}[];
|
|
18
|
+
_tag2: void;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEAVE_GROUP = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.LEAVE_GROUP = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 13,
|
|
8
|
+
apiVersion: 5,
|
|
9
|
+
request: (encoder, body) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(body.groupId)
|
|
12
|
+
.writeCompactArray(body.members, (encoder, member) => encoder
|
|
13
|
+
.writeCompactString(member.memberId)
|
|
14
|
+
.writeCompactString(member.groupInstanceId)
|
|
15
|
+
.writeCompactString(member.reason)
|
|
16
|
+
.writeUVarInt(0))
|
|
17
|
+
.writeUVarInt(0),
|
|
18
|
+
response: (decoder) => {
|
|
19
|
+
const result = {
|
|
20
|
+
_tag: decoder.readTagBuffer(),
|
|
21
|
+
throttleTimeMs: decoder.readInt32(),
|
|
22
|
+
errorCode: decoder.readInt16(),
|
|
23
|
+
members: decoder.readCompactArray((decoder) => ({
|
|
24
|
+
memberId: decoder.readCompactString(),
|
|
25
|
+
groupInstanceId: decoder.readCompactString(),
|
|
26
|
+
errorCode: decoder.readInt16(),
|
|
27
|
+
_tag: decoder.readTagBuffer(),
|
|
28
|
+
})),
|
|
29
|
+
_tag2: decoder.readTagBuffer(),
|
|
30
|
+
};
|
|
31
|
+
if (result.errorCode)
|
|
32
|
+
throw new error_1.KafkaTSApiError(result.errorCode, null, result);
|
|
33
|
+
result.members.forEach((member) => {
|
|
34
|
+
if (member.errorCode)
|
|
35
|
+
throw new error_1.KafkaTSApiError(member.errorCode, null, result);
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IsolationLevel } from "./fetch";
|
|
2
|
+
export declare const LIST_OFFSETS: import("../utils/api").Api<{
|
|
3
|
+
replicaId: number;
|
|
4
|
+
isolationLevel: IsolationLevel;
|
|
5
|
+
topics: {
|
|
6
|
+
name: string;
|
|
7
|
+
partitions: {
|
|
8
|
+
partitionIndex: number;
|
|
9
|
+
currentLeaderEpoch: number;
|
|
10
|
+
timestamp: bigint;
|
|
11
|
+
}[];
|
|
12
|
+
}[];
|
|
13
|
+
}, {
|
|
14
|
+
_tag: void;
|
|
15
|
+
throttleTimeMs: number;
|
|
16
|
+
topics: {
|
|
17
|
+
name: string;
|
|
18
|
+
partitions: {
|
|
19
|
+
partitionIndex: number;
|
|
20
|
+
errorCode: number;
|
|
21
|
+
timestamp: bigint;
|
|
22
|
+
offset: bigint;
|
|
23
|
+
leaderEpoch: number;
|
|
24
|
+
_tag: void;
|
|
25
|
+
}[];
|
|
26
|
+
_tag: void;
|
|
27
|
+
}[];
|
|
28
|
+
_tag2: void;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LIST_OFFSETS = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.LIST_OFFSETS = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 2,
|
|
8
|
+
apiVersion: 8,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeInt32(data.replicaId)
|
|
12
|
+
.writeInt8(data.isolationLevel)
|
|
13
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder
|
|
14
|
+
.writeCompactString(topic.name)
|
|
15
|
+
.writeCompactArray(topic.partitions, (encoder, partition) => encoder
|
|
16
|
+
.writeInt32(partition.partitionIndex)
|
|
17
|
+
.writeInt32(partition.currentLeaderEpoch)
|
|
18
|
+
.writeInt64(partition.timestamp)
|
|
19
|
+
.writeUVarInt(0))
|
|
20
|
+
.writeUVarInt(0))
|
|
21
|
+
.writeUVarInt(0),
|
|
22
|
+
response: (decoder) => {
|
|
23
|
+
const result = {
|
|
24
|
+
_tag: decoder.readTagBuffer(),
|
|
25
|
+
throttleTimeMs: decoder.readInt32(),
|
|
26
|
+
topics: decoder.readCompactArray((decoder) => ({
|
|
27
|
+
name: decoder.readCompactString(),
|
|
28
|
+
partitions: decoder.readCompactArray((decoder) => ({
|
|
29
|
+
partitionIndex: decoder.readInt32(),
|
|
30
|
+
errorCode: decoder.readInt16(),
|
|
31
|
+
timestamp: decoder.readInt64(),
|
|
32
|
+
offset: decoder.readInt64(),
|
|
33
|
+
leaderEpoch: decoder.readInt32(),
|
|
34
|
+
_tag: decoder.readTagBuffer(),
|
|
35
|
+
})),
|
|
36
|
+
_tag: decoder.readTagBuffer(),
|
|
37
|
+
})),
|
|
38
|
+
_tag2: decoder.readTagBuffer(),
|
|
39
|
+
};
|
|
40
|
+
result.topics.forEach((topic) => {
|
|
41
|
+
topic.partitions.forEach((partition) => {
|
|
42
|
+
if (partition.errorCode)
|
|
43
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type Metadata = ReturnType<(typeof METADATA)["response"]>;
|
|
2
|
+
export declare const METADATA: import("../utils/api").Api<{
|
|
3
|
+
topics: {
|
|
4
|
+
id: string | null;
|
|
5
|
+
name: string;
|
|
6
|
+
}[] | null;
|
|
7
|
+
allowTopicAutoCreation: boolean;
|
|
8
|
+
includeTopicAuthorizedOperations: boolean;
|
|
9
|
+
}, {
|
|
10
|
+
_tag: void;
|
|
11
|
+
throttleTimeMs: number;
|
|
12
|
+
brokers: {
|
|
13
|
+
nodeId: number;
|
|
14
|
+
host: string;
|
|
15
|
+
port: number;
|
|
16
|
+
rack: string | null;
|
|
17
|
+
_tag: void;
|
|
18
|
+
}[];
|
|
19
|
+
clusterId: string | null;
|
|
20
|
+
controllerId: number;
|
|
21
|
+
topics: {
|
|
22
|
+
errorCode: number;
|
|
23
|
+
name: string;
|
|
24
|
+
topicId: string;
|
|
25
|
+
isInternal: boolean;
|
|
26
|
+
partitions: {
|
|
27
|
+
errorCode: number;
|
|
28
|
+
partitionIndex: number;
|
|
29
|
+
leaderId: number;
|
|
30
|
+
leaderEpoch: number;
|
|
31
|
+
replicaNodes: number[];
|
|
32
|
+
isrNodes: number[];
|
|
33
|
+
offlineReplicas: number[];
|
|
34
|
+
_tag: void;
|
|
35
|
+
}[];
|
|
36
|
+
topicAuthorizedOperations: number;
|
|
37
|
+
_tag: void;
|
|
38
|
+
}[];
|
|
39
|
+
_tag2: void;
|
|
40
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.METADATA = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.METADATA = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 3,
|
|
8
|
+
apiVersion: 12,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder.writeUUID(topic.id).writeCompactString(topic.name).writeUVarInt(0))
|
|
12
|
+
.writeBoolean(data.allowTopicAutoCreation)
|
|
13
|
+
.writeBoolean(data.includeTopicAuthorizedOperations)
|
|
14
|
+
.writeUVarInt(0),
|
|
15
|
+
response: (decoder) => {
|
|
16
|
+
const result = {
|
|
17
|
+
_tag: decoder.readTagBuffer(),
|
|
18
|
+
throttleTimeMs: decoder.readInt32(),
|
|
19
|
+
brokers: decoder.readCompactArray((broker) => ({
|
|
20
|
+
nodeId: broker.readInt32(),
|
|
21
|
+
host: broker.readCompactString(),
|
|
22
|
+
port: broker.readInt32(),
|
|
23
|
+
rack: broker.readCompactString(),
|
|
24
|
+
_tag: broker.readTagBuffer(),
|
|
25
|
+
})),
|
|
26
|
+
clusterId: decoder.readCompactString(),
|
|
27
|
+
controllerId: decoder.readInt32(),
|
|
28
|
+
topics: decoder.readCompactArray((topic) => ({
|
|
29
|
+
errorCode: topic.readInt16(),
|
|
30
|
+
name: topic.readCompactString(),
|
|
31
|
+
topicId: topic.readUUID(),
|
|
32
|
+
isInternal: topic.readBoolean(),
|
|
33
|
+
partitions: topic.readCompactArray((partition) => ({
|
|
34
|
+
errorCode: partition.readInt16(),
|
|
35
|
+
partitionIndex: partition.readInt32(),
|
|
36
|
+
leaderId: partition.readInt32(),
|
|
37
|
+
leaderEpoch: partition.readInt32(),
|
|
38
|
+
replicaNodes: partition.readCompactArray((node) => node.readInt32()),
|
|
39
|
+
isrNodes: partition.readCompactArray((node) => node.readInt32()),
|
|
40
|
+
offlineReplicas: partition.readCompactArray((node) => node.readInt32()),
|
|
41
|
+
_tag: partition.readTagBuffer(),
|
|
42
|
+
})),
|
|
43
|
+
topicAuthorizedOperations: topic.readInt32(),
|
|
44
|
+
_tag: topic.readTagBuffer(),
|
|
45
|
+
})),
|
|
46
|
+
_tag2: decoder.readTagBuffer(),
|
|
47
|
+
};
|
|
48
|
+
result.topics.forEach((topic) => {
|
|
49
|
+
if (topic.errorCode)
|
|
50
|
+
throw new error_1.KafkaTSApiError(topic.errorCode, null, result);
|
|
51
|
+
topic.partitions.forEach((partition) => {
|
|
52
|
+
if (partition.errorCode)
|
|
53
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return result;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const OFFSET_COMMIT: import("../utils/api").Api<{
|
|
2
|
+
groupId: string;
|
|
3
|
+
generationIdOrMemberEpoch: number;
|
|
4
|
+
memberId: string;
|
|
5
|
+
groupInstanceId: string | null;
|
|
6
|
+
topics: {
|
|
7
|
+
name: string;
|
|
8
|
+
partitions: {
|
|
9
|
+
partitionIndex: number;
|
|
10
|
+
committedOffset: bigint;
|
|
11
|
+
committedLeaderEpoch: number;
|
|
12
|
+
committedMetadata: string | null;
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
}, {
|
|
16
|
+
_tag: void;
|
|
17
|
+
throttleTimeMs: number;
|
|
18
|
+
topics: {
|
|
19
|
+
name: string | null;
|
|
20
|
+
partitions: {
|
|
21
|
+
partitionIndex: number;
|
|
22
|
+
errorCode: number;
|
|
23
|
+
_tag: void;
|
|
24
|
+
}[];
|
|
25
|
+
_tag: void;
|
|
26
|
+
}[];
|
|
27
|
+
_tag2: void;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OFFSET_COMMIT = void 0;
|
|
4
|
+
const api_1 = require("../utils/api");
|
|
5
|
+
const error_1 = require("../utils/error");
|
|
6
|
+
exports.OFFSET_COMMIT = (0, api_1.createApi)({
|
|
7
|
+
apiKey: 8,
|
|
8
|
+
apiVersion: 9,
|
|
9
|
+
request: (encoder, data) => encoder
|
|
10
|
+
.writeUVarInt(0)
|
|
11
|
+
.writeCompactString(data.groupId)
|
|
12
|
+
.writeInt32(data.generationIdOrMemberEpoch)
|
|
13
|
+
.writeCompactString(data.memberId)
|
|
14
|
+
.writeCompactString(data.groupInstanceId)
|
|
15
|
+
.writeCompactArray(data.topics, (encoder, topic) => encoder
|
|
16
|
+
.writeCompactString(topic.name)
|
|
17
|
+
.writeCompactArray(topic.partitions, (encoder, partition) => encoder
|
|
18
|
+
.writeInt32(partition.partitionIndex)
|
|
19
|
+
.writeInt64(partition.committedOffset)
|
|
20
|
+
.writeInt32(partition.committedLeaderEpoch)
|
|
21
|
+
.writeCompactString(partition.committedMetadata)
|
|
22
|
+
.writeUVarInt(0))
|
|
23
|
+
.writeUVarInt(0))
|
|
24
|
+
.writeUVarInt(0),
|
|
25
|
+
response: (decoder) => {
|
|
26
|
+
const result = {
|
|
27
|
+
_tag: decoder.readTagBuffer(),
|
|
28
|
+
throttleTimeMs: decoder.readInt32(),
|
|
29
|
+
topics: decoder.readCompactArray((decoder) => ({
|
|
30
|
+
name: decoder.readCompactString(),
|
|
31
|
+
partitions: decoder.readCompactArray((decoder) => ({
|
|
32
|
+
partitionIndex: decoder.readInt32(),
|
|
33
|
+
errorCode: decoder.readInt16(),
|
|
34
|
+
_tag: decoder.readTagBuffer(),
|
|
35
|
+
})),
|
|
36
|
+
_tag: decoder.readTagBuffer(),
|
|
37
|
+
})),
|
|
38
|
+
_tag2: decoder.readTagBuffer(),
|
|
39
|
+
};
|
|
40
|
+
result.topics.forEach((topic) => {
|
|
41
|
+
topic.partitions.forEach((partition) => {
|
|
42
|
+
if (partition.errorCode)
|
|
43
|
+
throw new error_1.KafkaTSApiError(partition.errorCode, null, result);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const OFFSET_FETCH: import("../utils/api").Api<{
|
|
2
|
+
groups: {
|
|
3
|
+
groupId: string;
|
|
4
|
+
memberId: string | null;
|
|
5
|
+
memberEpoch: number;
|
|
6
|
+
topics: {
|
|
7
|
+
name: string;
|
|
8
|
+
partitionIndexes: number[];
|
|
9
|
+
}[];
|
|
10
|
+
}[];
|
|
11
|
+
requireStable: boolean;
|
|
12
|
+
}, {
|
|
13
|
+
_tag: void;
|
|
14
|
+
throttleTimeMs: number;
|
|
15
|
+
groups: {
|
|
16
|
+
groupId: string | null;
|
|
17
|
+
topics: {
|
|
18
|
+
name: string;
|
|
19
|
+
partitions: {
|
|
20
|
+
partitionIndex: number;
|
|
21
|
+
committedOffset: bigint;
|
|
22
|
+
committedLeaderEpoch: number;
|
|
23
|
+
committedMetadata: string | null;
|
|
24
|
+
errorCode: number;
|
|
25
|
+
_tag: void;
|
|
26
|
+
}[];
|
|
27
|
+
_tag: void;
|
|
28
|
+
}[];
|
|
29
|
+
errorCode: number;
|
|
30
|
+
_tag: void;
|
|
31
|
+
}[];
|
|
32
|
+
_tag2: void;
|
|
33
|
+
}>;
|