@platformatic/kafka 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +270 -0
- package/dist/apis/admin/alter-client-quotas.d.ts +33 -0
- package/dist/apis/admin/alter-client-quotas.js +64 -0
- package/dist/apis/admin/alter-configs.d.ts +26 -0
- package/dist/apis/admin/alter-configs.js +57 -0
- package/dist/apis/admin/alter-partition-reassignments.d.ts +30 -0
- package/dist/apis/admin/alter-partition-reassignments.js +68 -0
- package/dist/apis/admin/alter-partition.d.ts +39 -0
- package/dist/apis/admin/alter-partition.js +87 -0
- package/dist/apis/admin/alter-replica-log-dirs.d.ts +26 -0
- package/dist/apis/admin/alter-replica-log-dirs.js +55 -0
- package/dist/apis/admin/alter-user-scram-credentials.d.ts +27 -0
- package/dist/apis/admin/alter-user-scram-credentials.js +60 -0
- package/dist/apis/admin/consumer-group-describe.d.ts +41 -0
- package/dist/apis/admin/consumer-group-describe.js +103 -0
- package/dist/apis/admin/create-acls.d.ts +24 -0
- package/dist/apis/admin/create-acls.js +55 -0
- package/dist/apis/admin/create-delegation-token.d.ts +24 -0
- package/dist/apis/admin/create-delegation-token.js +54 -0
- package/dist/apis/admin/create-partitions.d.ts +24 -0
- package/dist/apis/admin/create-partitions.js +54 -0
- package/dist/apis/admin/create-topics.d.ts +42 -0
- package/dist/apis/admin/create-topics.js +86 -0
- package/dist/apis/admin/delete-acls.d.ts +36 -0
- package/dist/apis/admin/delete-acls.js +82 -0
- package/dist/apis/admin/delete-groups.d.ts +14 -0
- package/dist/apis/admin/delete-groups.js +40 -0
- package/dist/apis/admin/delete-records.d.ts +27 -0
- package/dist/apis/admin/delete-records.js +59 -0
- package/dist/apis/admin/delete-topics.d.ts +21 -0
- package/dist/apis/admin/delete-topics.js +50 -0
- package/dist/apis/admin/describe-acls.d.ts +25 -0
- package/dist/apis/admin/describe-acls.js +66 -0
- package/dist/apis/admin/describe-client-quotas.d.ts +30 -0
- package/dist/apis/admin/describe-client-quotas.js +57 -0
- package/dist/apis/admin/describe-cluster.d.ts +23 -0
- package/dist/apis/admin/describe-cluster.js +50 -0
- package/dist/apis/admin/describe-configs.d.ts +38 -0
- package/dist/apis/admin/describe-configs.js +85 -0
- package/dist/apis/admin/describe-delegation-token.d.ts +31 -0
- package/dist/apis/admin/describe-delegation-token.js +62 -0
- package/dist/apis/admin/describe-groups.d.ts +28 -0
- package/dist/apis/admin/describe-groups.js +67 -0
- package/dist/apis/admin/describe-log-dirs.d.ts +32 -0
- package/dist/apis/admin/describe-log-dirs.js +75 -0
- package/dist/apis/admin/describe-producers.d.ts +33 -0
- package/dist/apis/admin/describe-producers.js +70 -0
- package/dist/apis/admin/describe-quorum.d.ts +50 -0
- package/dist/apis/admin/describe-quorum.js +116 -0
- package/dist/apis/admin/describe-topic-partitions.d.ts +42 -0
- package/dist/apis/admin/describe-topic-partitions.js +94 -0
- package/dist/apis/admin/describe-transactions.d.ts +24 -0
- package/dist/apis/admin/describe-transactions.js +59 -0
- package/dist/apis/admin/describe-user-scram-credentials.d.ts +26 -0
- package/dist/apis/admin/describe-user-scram-credentials.js +62 -0
- package/dist/apis/admin/envelope.d.ts +10 -0
- package/dist/apis/admin/envelope.js +32 -0
- package/dist/apis/admin/expire-delegation-token.d.ts +11 -0
- package/dist/apis/admin/expire-delegation-token.js +29 -0
- package/dist/apis/admin/incremental-alter-configs.d.ts +27 -0
- package/dist/apis/admin/incremental-alter-configs.js +58 -0
- package/dist/apis/admin/index.d.ts +37 -0
- package/dist/apis/admin/index.js +37 -0
- package/dist/apis/admin/list-groups.d.ts +18 -0
- package/dist/apis/admin/list-groups.js +43 -0
- package/dist/apis/admin/list-partition-reassignments.d.ts +27 -0
- package/dist/apis/admin/list-partition-reassignments.js +56 -0
- package/dist/apis/admin/list-transactions.d.ts +18 -0
- package/dist/apis/admin/list-transactions.js +45 -0
- package/dist/apis/admin/offset-delete.d.ts +26 -0
- package/dist/apis/admin/offset-delete.js +59 -0
- package/dist/apis/admin/renew-delegation-token.d.ts +11 -0
- package/dist/apis/admin/renew-delegation-token.js +29 -0
- package/dist/apis/admin/unregister-broker.d.ts +12 -0
- package/dist/apis/admin/unregister-broker.js +28 -0
- package/dist/apis/admin/update-features.d.ts +23 -0
- package/dist/apis/admin/update-features.js +60 -0
- package/dist/apis/consumer/consumer-group-heartbeat.d.ts +27 -0
- package/dist/apis/consumer/consumer-group-heartbeat.js +70 -0
- package/dist/apis/consumer/fetch.d.ts +46 -0
- package/dist/apis/consumer/fetch.js +121 -0
- package/dist/apis/consumer/heartbeat.d.ts +11 -0
- package/dist/apis/consumer/heartbeat.js +34 -0
- package/dist/apis/consumer/index.d.ts +9 -0
- package/dist/apis/consumer/index.js +9 -0
- package/dist/apis/consumer/join-group.d.ts +27 -0
- package/dist/apis/consumer/join-group.js +71 -0
- package/dist/apis/consumer/leave-group.d.ts +22 -0
- package/dist/apis/consumer/leave-group.js +57 -0
- package/dist/apis/consumer/list-offsets.d.ts +30 -0
- package/dist/apis/consumer/list-offsets.js +68 -0
- package/dist/apis/consumer/offset-commit.d.ts +29 -0
- package/dist/apis/consumer/offset-commit.js +68 -0
- package/dist/apis/consumer/offset-fetch.d.ts +37 -0
- package/dist/apis/consumer/offset-fetch.js +81 -0
- package/dist/apis/consumer/sync-group.d.ts +18 -0
- package/dist/apis/consumer/sync-group.js +49 -0
- package/dist/apis/definitions.d.ts +16 -0
- package/dist/apis/definitions.js +12 -0
- package/dist/apis/enumerations.d.ts +114 -0
- package/dist/apis/enumerations.js +78 -0
- package/dist/apis/index.d.ts +8 -0
- package/dist/apis/index.js +10 -0
- package/dist/apis/metadata/api-versions.d.ts +17 -0
- package/dist/apis/metadata/api-versions.js +41 -0
- package/dist/apis/metadata/find-coordinator.d.ts +19 -0
- package/dist/apis/metadata/find-coordinator.js +50 -0
- package/dist/apis/metadata/index.d.ts +3 -0
- package/dist/apis/metadata/index.js +3 -0
- package/dist/apis/metadata/metadata.d.ts +37 -0
- package/dist/apis/metadata/metadata.js +92 -0
- package/dist/apis/producer/add-offsets-to-txn.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn.js +34 -0
- package/dist/apis/producer/add-partitions-to-txn.d.ts +34 -0
- package/dist/apis/producer/add-partitions-to-txn.js +79 -0
- package/dist/apis/producer/end-txn.d.ts +10 -0
- package/dist/apis/producer/end-txn.js +34 -0
- package/dist/apis/producer/index.d.ts +6 -0
- package/dist/apis/producer/index.js +6 -0
- package/dist/apis/producer/init-producer-id.d.ts +21 -0
- package/dist/apis/producer/init-producer-id.js +38 -0
- package/dist/apis/producer/produce.d.ts +29 -0
- package/dist/apis/producer/produce.js +104 -0
- package/dist/apis/producer/txn-offset-commit.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit.js +77 -0
- package/dist/apis/security/index.d.ts +2 -0
- package/dist/apis/security/index.js +2 -0
- package/dist/apis/security/sasl-authenticate.d.ts +15 -0
- package/dist/apis/security/sasl-authenticate.js +30 -0
- package/dist/apis/security/sasl-handshake.d.ts +10 -0
- package/dist/apis/security/sasl-handshake.js +28 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.d.ts +18 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions.js +46 -0
- package/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/apis/telemetry/index.js +3 -0
- package/dist/apis/telemetry/list-client-metrics-resources.d.ts +14 -0
- package/dist/apis/telemetry/list-client-metrics-resources.js +32 -0
- package/dist/apis/telemetry/push-telemetry.d.ts +10 -0
- package/dist/apis/telemetry/push-telemetry.js +36 -0
- package/dist/clients/admin/admin.d.ts +18 -0
- package/dist/clients/admin/admin.js +322 -0
- package/dist/clients/admin/index.d.ts +3 -0
- package/dist/clients/admin/index.js +3 -0
- package/dist/clients/admin/options.d.ts +135 -0
- package/dist/clients/admin/options.js +81 -0
- package/dist/clients/admin/types.d.ts +56 -0
- package/dist/clients/admin/types.js +1 -0
- package/dist/clients/base/base.d.ts +48 -0
- package/dist/clients/base/base.js +242 -0
- package/dist/clients/base/index.d.ts +3 -0
- package/dist/clients/base/index.js +3 -0
- package/dist/clients/base/options.d.ts +115 -0
- package/dist/clients/base/options.js +59 -0
- package/dist/clients/base/types.d.ts +38 -0
- package/dist/clients/base/types.js +1 -0
- package/dist/clients/callbacks.d.ts +8 -0
- package/dist/clients/callbacks.js +42 -0
- package/dist/clients/consumer/consumer.d.ts +33 -0
- package/dist/clients/consumer/consumer.js +767 -0
- package/dist/clients/consumer/index.d.ts +5 -0
- package/dist/clients/consumer/index.js +5 -0
- package/dist/clients/consumer/messages-stream.d.ts +56 -0
- package/dist/clients/consumer/messages-stream.js +404 -0
- package/dist/clients/consumer/options.d.ts +521 -0
- package/dist/clients/consumer/options.js +177 -0
- package/dist/clients/consumer/topics-map.d.ts +8 -0
- package/dist/clients/consumer/topics-map.js +48 -0
- package/dist/clients/consumer/types.d.ts +74 -0
- package/dist/clients/consumer/types.js +11 -0
- package/dist/clients/index.d.ts +6 -0
- package/dist/clients/index.js +6 -0
- package/dist/clients/producer/index.d.ts +3 -0
- package/dist/clients/producer/index.js +3 -0
- package/dist/clients/producer/options.d.ts +122 -0
- package/dist/clients/producer/options.js +47 -0
- package/dist/clients/producer/producer.d.ts +13 -0
- package/dist/clients/producer/producer.js +272 -0
- package/dist/clients/producer/types.d.ts +29 -0
- package/dist/clients/producer/types.js +1 -0
- package/dist/clients/serde.d.ts +40 -0
- package/dist/clients/serde.js +49 -0
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +160 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/network/connection-pool.d.ts +11 -0
- package/dist/network/connection-pool.js +101 -0
- package/dist/network/connection.d.ts +49 -0
- package/dist/network/connection.js +319 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +2 -0
- package/dist/protocol/apis.d.ts +2 -0
- package/dist/protocol/apis.js +191 -0
- package/dist/protocol/compression.d.ts +70 -0
- package/dist/protocol/compression.js +114 -0
- package/dist/protocol/crc32c.d.ts +2 -0
- package/dist/protocol/crc32c.js +83 -0
- package/dist/protocol/definitions.d.ts +12 -0
- package/dist/protocol/definitions.js +11 -0
- package/dist/protocol/dynamic-buffer.d.ts +65 -0
- package/dist/protocol/dynamic-buffer.js +557 -0
- package/dist/protocol/errors.d.ts +8 -0
- package/dist/protocol/errors.js +908 -0
- package/dist/protocol/index.d.ts +14 -0
- package/dist/protocol/index.js +14 -0
- package/dist/protocol/murmur2.d.ts +1 -0
- package/dist/protocol/murmur2.js +55 -0
- package/dist/protocol/reader.d.ts +58 -0
- package/dist/protocol/reader.js +296 -0
- package/dist/protocol/records.d.ts +110 -0
- package/dist/protocol/records.js +149 -0
- package/dist/protocol/sasl/plain.d.ts +3 -0
- package/dist/protocol/sasl/plain.js +3 -0
- package/dist/protocol/sasl/scram-sha.d.ts +28 -0
- package/dist/protocol/sasl/scram-sha.js +104 -0
- package/dist/protocol/varint.d.ts +12 -0
- package/dist/protocol/varint.js +36 -0
- package/dist/protocol/writer.d.ts +48 -0
- package/dist/protocol/writer.js +223 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +127 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# @platformatic/kafka
|
|
2
|
+
|
|
3
|
+
A modern, high-performance, pure TypeScript/JavaScript type safe client for Apache Kafka.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **High Performance**: Optimised for speed.
|
|
8
|
+
- **Pure Modern JavaScript**: Built with the latest ECMAScript features, no native addon needed.
|
|
9
|
+
- **Type Safety**: Full TypeScript support with strong typing.
|
|
10
|
+
- **Flexible API**: You can use promises or callbacks on all APIs.
|
|
11
|
+
- **Streaming or Event-based Consumers**: Thanks to Node.js streams, you can choose your preferred consuming method.
|
|
12
|
+
- **Flexible Serialisation**: Pluggable serialisers and deserialisers.
|
|
13
|
+
- **Connection Management**: Automatic connection pooling and recovery.
|
|
14
|
+
- **Low Dependencies**: Minimal external dependencies.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @platformatic/kafka
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Getting Started
|
|
23
|
+
|
|
24
|
+
### Producer
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { Producer, stringSerializer } from '@platformatic/kafka'
|
|
28
|
+
|
|
29
|
+
// Create a producer with string serialisers
|
|
30
|
+
const producer = new Producer({
|
|
31
|
+
clientId: 'my-producer',
|
|
32
|
+
bootstrapBrokers: ['localhost:9092'],
|
|
33
|
+
serializers: stringSerializer
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Send messages
|
|
37
|
+
await producer.send({
|
|
38
|
+
messages: [
|
|
39
|
+
{
|
|
40
|
+
topic: 'events',
|
|
41
|
+
key: 'user-123',
|
|
42
|
+
value: JSON.stringify({ name: 'John', action: 'login' }),
|
|
43
|
+
headers: { source: 'web-app' }
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
// Close the producer when done
|
|
49
|
+
await producer.close()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Consumer
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { Consumer, stringDeserializer } from '@platformatic/kafka'
|
|
56
|
+
import { forEach } from 'hwp'
|
|
57
|
+
|
|
58
|
+
// Create a consumer with string deserialisers
|
|
59
|
+
const consumer = new Consumer({
|
|
60
|
+
groupId: 'my-consumer-group',
|
|
61
|
+
clientId: 'my-consumer',
|
|
62
|
+
bootstrapBrokers: ['localhost:9092'],
|
|
63
|
+
deserializers: stringDeserializer
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// Create a consumer stream
|
|
67
|
+
const stream = await consumer.consume({
|
|
68
|
+
autocommit: true,
|
|
69
|
+
topics: ['my-topic'],
|
|
70
|
+
sessionTimeout: 10000,
|
|
71
|
+
heartbeatInterval: 500
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
// Option 1: Event-based consumption
|
|
75
|
+
stream.on('data', message => {
|
|
76
|
+
console.log(`Received: ${message.key} -> ${message.value}`)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Option 2: Async iterator consumption
|
|
80
|
+
for await (const message of stream) {
|
|
81
|
+
console.log(`Received: ${message.key} -> ${message.value}`)
|
|
82
|
+
// Process message...
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Option 3: Concurrent processing
|
|
86
|
+
await forEach(stream, async message => {
|
|
87
|
+
console.log(`Received: ${message.key} -> ${message.value}`)
|
|
88
|
+
// Process message...
|
|
89
|
+
}, 16) // 16 is the concurrency level
|
|
90
|
+
|
|
91
|
+
// Close the consumer when done
|
|
92
|
+
await consumer.close()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Admin
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { Admin } from '@platformatic/kafka'
|
|
99
|
+
|
|
100
|
+
// Create an admin client
|
|
101
|
+
const admin = new Admin({
|
|
102
|
+
clientId: 'my-admin',
|
|
103
|
+
bootstrapBrokers: ['localhost:9092']
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// Create topics
|
|
107
|
+
await admin.createTopics({
|
|
108
|
+
topics: ['my-topic'],
|
|
109
|
+
partitions: 3,
|
|
110
|
+
replicas: 1
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// Create topics with custom assignments
|
|
114
|
+
await admin.createTopics({
|
|
115
|
+
topics: ['my-custom-topic'],
|
|
116
|
+
partitions: -1, // Use assignments instead
|
|
117
|
+
replicas: -1, // Use assignments instead
|
|
118
|
+
assignments: [
|
|
119
|
+
{ partition: 0, brokers: [1] },
|
|
120
|
+
{ partition: 1, brokers: [2] },
|
|
121
|
+
{ partition: 2, brokers: [3] }
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
// Get metadata
|
|
126
|
+
const metadata = await admin.metadata({ topics: ['my-topic'] })
|
|
127
|
+
console.log(metadata)
|
|
128
|
+
|
|
129
|
+
// Delete topics
|
|
130
|
+
await admin.deleteTopics({ topics: ['my-topic'] })
|
|
131
|
+
|
|
132
|
+
// Close the admin client when done
|
|
133
|
+
await admin.close()
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Serialisation/Deserialisation
|
|
137
|
+
|
|
138
|
+
`@platformatic/kafka` supports customisation of serialisation out of the box.
|
|
139
|
+
|
|
140
|
+
You can provide a different serialiser or deserialiser for each part of a message:
|
|
141
|
+
|
|
142
|
+
- Key
|
|
143
|
+
- Value
|
|
144
|
+
- Header Key
|
|
145
|
+
- Header Value
|
|
146
|
+
|
|
147
|
+
By default, it will use no-operation serialisers and deserialisers, which means that all the parts above must be `Buffer`s.
|
|
148
|
+
|
|
149
|
+
To provide a different serialiser, simply pass in the `serializers` option of the producer or the `deserializers` option of the consumer.
|
|
150
|
+
Both options accept an object with any of the `key`, `value`, `headerKey` and `headerValue` properties.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
Consumer,
|
|
155
|
+
jsonDeserializer,
|
|
156
|
+
jsonSerializer,
|
|
157
|
+
ProduceAcks,
|
|
158
|
+
Producer,
|
|
159
|
+
stringDeserializer,
|
|
160
|
+
stringSerializer
|
|
161
|
+
} from '@platformatic/kafka'
|
|
162
|
+
|
|
163
|
+
type Strings = string[]
|
|
164
|
+
|
|
165
|
+
const producer = new Producer({
|
|
166
|
+
clientId: 'my-producer',
|
|
167
|
+
bootstrapBrokers: ['localhost:29092'],
|
|
168
|
+
serializers: {
|
|
169
|
+
key: stringSerializer,
|
|
170
|
+
value: jsonSerializer<Strings>
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const consumer = new Consumer({
|
|
175
|
+
groupId: 'my-consumer-group',
|
|
176
|
+
clientId: 'my-consumer',
|
|
177
|
+
bootstrapBrokers: ['localhost:29092'],
|
|
178
|
+
deserializers: {
|
|
179
|
+
key: stringDeserializer,
|
|
180
|
+
value: jsonDeserializer<Strings>
|
|
181
|
+
},
|
|
182
|
+
maxWaitTime: 1000,
|
|
183
|
+
autocommit: 100
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// Produce some messages
|
|
187
|
+
let i = 0
|
|
188
|
+
const timer = setTimeout(() => {
|
|
189
|
+
producer.send({
|
|
190
|
+
messages: [{ topic: 'temp', key: `key-${i++}`, value: ['first', 'second'] }],
|
|
191
|
+
acks: ProduceAcks.LEADER
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
if (i < 3) {
|
|
195
|
+
timer.refresh()
|
|
196
|
+
}
|
|
197
|
+
}, 1000)
|
|
198
|
+
|
|
199
|
+
const stream = await consumer.consume({ topics: ['temp'] })
|
|
200
|
+
|
|
201
|
+
// Notice in your editor that the message below is properly typed as Message<string, Strings, ...>
|
|
202
|
+
for await (const message of stream) {
|
|
203
|
+
console.log(message)
|
|
204
|
+
|
|
205
|
+
if (message.key === 'key-2') {
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
await stream.close()
|
|
211
|
+
await consumer.close()
|
|
212
|
+
await producer.close()
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Error Handling
|
|
216
|
+
|
|
217
|
+
`@platformatic/kafka` defines its hierarchy of errors.
|
|
218
|
+
All errors inherit from `GenericError` and have a `code` property starting with `PLT_KFK`.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
try {
|
|
222
|
+
await producer.send({
|
|
223
|
+
messages: [{ topic: 'my-topic', value: 'test' }]
|
|
224
|
+
})
|
|
225
|
+
} catch (error) {
|
|
226
|
+
if (error.code === 'PLT_KFK_PRODUCER_ERROR') {
|
|
227
|
+
// Handle producer-specific errors
|
|
228
|
+
} else if (error.code === 'PLT_KFK_CONNECTION_ERROR') {
|
|
229
|
+
// Handle connection errors
|
|
230
|
+
} else {
|
|
231
|
+
// Handle other errors
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Performance
|
|
237
|
+
|
|
238
|
+
`@platformatic/kafka` is built with performance in mind, optimising for high throughput and low latency.
|
|
239
|
+
|
|
240
|
+
Internally, it does not use a single promise to minimise event loop overheads.
|
|
241
|
+
|
|
242
|
+
It also uses a higher watermark for consumer streams. This improves the throughput but also impacts the memory usage.
|
|
243
|
+
By default, it uses a value of `1024` (while Node.js default value is `16`). This means that potentially each stream can put more than a thousand objects in memory.
|
|
244
|
+
If each object is 1MB, this means 1GB of RAM per stream. Tune this accordingly.
|
|
245
|
+
|
|
246
|
+
This value can be changed using the `highWaterMark` option of the `Consumer`.
|
|
247
|
+
|
|
248
|
+
## API Reference
|
|
249
|
+
|
|
250
|
+
All the APIs support an optional Node.js style `callback` argument as the last argument.
|
|
251
|
+
|
|
252
|
+
If the callback is provided, then it will be invoked; otherwise, the method will behave as an `async function` and will resolve or reject when finished.
|
|
253
|
+
|
|
254
|
+
In all the documentation below, when discussing a function accepting an optional `callback` parameter, the "return value" is considered to be either the resolved value or the result passed to the callback.
|
|
255
|
+
|
|
256
|
+
Many of the methods accept the same options as the client's constructors. The constructor's options should be considered as defaults for the respective options in the various methods.
|
|
257
|
+
|
|
258
|
+
- [Producer API](./docs/producer.md)
|
|
259
|
+
- [Consumer API](./docs/consumer.md)
|
|
260
|
+
- [Admin API](./docs/admin.md)
|
|
261
|
+
- [Base Client](./docs/base.md)
|
|
262
|
+
- [Other APIs and Types](./docs/other.md)
|
|
263
|
+
|
|
264
|
+
## Requirements
|
|
265
|
+
|
|
266
|
+
- Node.js >= 22.14.0
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
Apache-2.0 - See [LICENSE](LICENSE) for more information.
|
|
@@ -0,0 +1,33 @@
|
|
|
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 AlterClientQuotasRequestEntity {
|
|
5
|
+
entityType: string;
|
|
6
|
+
entityName: NullableString;
|
|
7
|
+
}
|
|
8
|
+
export interface AlterClientQuotasRequestOp {
|
|
9
|
+
key: string;
|
|
10
|
+
value: number;
|
|
11
|
+
remove: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface AlterClientQuotasRequestEntry {
|
|
14
|
+
entities: AlterClientQuotasRequestEntity[];
|
|
15
|
+
ops: AlterClientQuotasRequestOp[];
|
|
16
|
+
}
|
|
17
|
+
export type AlterClientQuotasRequest = Parameters<typeof createRequest>;
|
|
18
|
+
export interface AlterClientQuotasResponseEntity {
|
|
19
|
+
entityType: string;
|
|
20
|
+
entityName: NullableString;
|
|
21
|
+
}
|
|
22
|
+
export interface AlterClientQuotasResponseEntries {
|
|
23
|
+
errorCode: number;
|
|
24
|
+
errorMessage: NullableString;
|
|
25
|
+
entity: AlterClientQuotasResponseEntity[];
|
|
26
|
+
}
|
|
27
|
+
export interface AlterClientQuotasResponse {
|
|
28
|
+
throttleTimeMs: number;
|
|
29
|
+
entries: AlterClientQuotasResponseEntries[];
|
|
30
|
+
}
|
|
31
|
+
export declare function createRequest(entries: AlterClientQuotasRequestEntry[], validateOnly: boolean): Writer;
|
|
32
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): AlterClientQuotasResponse;
|
|
33
|
+
export declare const api: import("../definitions.ts").API<[entries: AlterClientQuotasRequestEntry[], validateOnly: boolean], AlterClientQuotasResponse>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
AlterClientQuotas Request (Version: 1) => [entries] validate_only TAG_BUFFER
|
|
6
|
+
entries => [entity] [ops] TAG_BUFFER
|
|
7
|
+
entity => entity_type entity_name TAG_BUFFER
|
|
8
|
+
entity_type => COMPACT_STRING
|
|
9
|
+
entity_name => COMPACT_NULLABLE_STRING
|
|
10
|
+
ops => key value remove TAG_BUFFER
|
|
11
|
+
key => COMPACT_STRING
|
|
12
|
+
value => FLOAT64
|
|
13
|
+
remove => BOOLEAN
|
|
14
|
+
validate_only => BOOLEAN
|
|
15
|
+
*/
|
|
16
|
+
export function createRequest(entries, validateOnly) {
|
|
17
|
+
return Writer.create()
|
|
18
|
+
.appendArray(entries, (w, e) => {
|
|
19
|
+
w.appendArray(e.entities, (w, e) => {
|
|
20
|
+
w.appendString(e.entityType).appendString(e.entityName);
|
|
21
|
+
}).appendArray(e.ops, (w, o) => {
|
|
22
|
+
w.appendString(o.key).appendFloat64(o.value).appendBoolean(o.remove);
|
|
23
|
+
});
|
|
24
|
+
})
|
|
25
|
+
.appendBoolean(validateOnly)
|
|
26
|
+
.appendTaggedFields();
|
|
27
|
+
}
|
|
28
|
+
/*
|
|
29
|
+
AlterClientQuotas Response (Version: 1) => throttle_time_ms [entries] TAG_BUFFER
|
|
30
|
+
throttle_time_ms => INT32
|
|
31
|
+
entries => error_code error_message [entity] TAG_BUFFER
|
|
32
|
+
error_code => INT16
|
|
33
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
34
|
+
entity => entity_type entity_name TAG_BUFFER
|
|
35
|
+
entity_type => COMPACT_STRING
|
|
36
|
+
entity_name => COMPACT_NULLABLE_STRING
|
|
37
|
+
*/
|
|
38
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
39
|
+
const errors = [];
|
|
40
|
+
const response = {
|
|
41
|
+
throttleTimeMs: reader.readInt32(),
|
|
42
|
+
entries: reader.readArray((r, i) => {
|
|
43
|
+
const entry = {
|
|
44
|
+
errorCode: r.readInt16(),
|
|
45
|
+
errorMessage: r.readNullableString(),
|
|
46
|
+
entity: r.readArray(r => {
|
|
47
|
+
return {
|
|
48
|
+
entityType: r.readString(),
|
|
49
|
+
entityName: r.readNullableString()
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
if (entry.errorCode !== 0) {
|
|
54
|
+
errors.push([`/entries/${i}`, entry.errorCode]);
|
|
55
|
+
}
|
|
56
|
+
return entry;
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
if (errors.length) {
|
|
60
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
61
|
+
}
|
|
62
|
+
return response;
|
|
63
|
+
}
|
|
64
|
+
export const api = createAPI(49, 1, createRequest, parseResponse);
|
|
@@ -0,0 +1,26 @@
|
|
|
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 AlterConfigsRequestConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
value?: NullableString;
|
|
7
|
+
}
|
|
8
|
+
export interface AlterConfigsRequestResource {
|
|
9
|
+
resourceType: number;
|
|
10
|
+
resourceName: string;
|
|
11
|
+
configs: AlterConfigsRequestConfig[];
|
|
12
|
+
}
|
|
13
|
+
export type AlterConfigsRequest = Parameters<typeof createRequest>;
|
|
14
|
+
export interface AlterConfigsResponseResult {
|
|
15
|
+
errorCode: number;
|
|
16
|
+
errorMessage: NullableString;
|
|
17
|
+
resourceType: number;
|
|
18
|
+
resourceName: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AlterConfigsResponse {
|
|
21
|
+
throttleTimeMs: number;
|
|
22
|
+
responses: AlterConfigsResponseResult[];
|
|
23
|
+
}
|
|
24
|
+
export declare function createRequest(resources: AlterConfigsRequestResource[], validateOnly: boolean): Writer;
|
|
25
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): AlterConfigsResponse;
|
|
26
|
+
export declare const api: import("../definitions.ts").API<[resources: AlterConfigsRequestResource[], validateOnly: boolean], AlterConfigsResponse>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ResponseError } from "../../errors.js";
|
|
2
|
+
import { Writer } from "../../protocol/writer.js";
|
|
3
|
+
import { createAPI } from "../definitions.js";
|
|
4
|
+
/*
|
|
5
|
+
AlterConfigs Request (Version: 2) => [resources] validate_only TAG_BUFFER
|
|
6
|
+
resources => resource_type resource_name [configs] TAG_BUFFER
|
|
7
|
+
resource_type => INT8
|
|
8
|
+
resource_name => COMPACT_STRING
|
|
9
|
+
configs => name value TAG_BUFFER
|
|
10
|
+
name => COMPACT_STRING
|
|
11
|
+
value => COMPACT_NULLABLE_STRING
|
|
12
|
+
validate_only => BOOLEAN
|
|
13
|
+
*/
|
|
14
|
+
export function createRequest(resources, validateOnly) {
|
|
15
|
+
return Writer.create()
|
|
16
|
+
.appendArray(resources, (w, r) => {
|
|
17
|
+
w.appendInt8(r.resourceType)
|
|
18
|
+
.appendString(r.resourceName)
|
|
19
|
+
.appendArray(r.configs, (w, r) => {
|
|
20
|
+
w.appendString(r.name).appendString(r.value);
|
|
21
|
+
});
|
|
22
|
+
})
|
|
23
|
+
.appendBoolean(validateOnly)
|
|
24
|
+
.appendTaggedFields();
|
|
25
|
+
}
|
|
26
|
+
/*
|
|
27
|
+
AlterConfigs Response (Version: 2) => throttle_time_ms [responses] TAG_BUFFER
|
|
28
|
+
throttle_time_ms => INT32
|
|
29
|
+
responses => error_code error_message resource_type resource_name TAG_BUFFER
|
|
30
|
+
error_code => INT16
|
|
31
|
+
error_message => COMPACT_NULLABLE_STRING
|
|
32
|
+
resource_type => INT8
|
|
33
|
+
resource_name => COMPACT_STRING
|
|
34
|
+
*/
|
|
35
|
+
export function parseResponse(_correlationId, apiKey, apiVersion, reader) {
|
|
36
|
+
const errors = [];
|
|
37
|
+
const response = {
|
|
38
|
+
throttleTimeMs: reader.readInt32(),
|
|
39
|
+
responses: reader.readArray((r, i) => {
|
|
40
|
+
const errorCode = r.readInt16();
|
|
41
|
+
if (errorCode !== 0) {
|
|
42
|
+
errors.push([`/responses/${i}`, errorCode]);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
errorCode,
|
|
46
|
+
errorMessage: r.readNullableString(),
|
|
47
|
+
resourceType: r.readInt8(),
|
|
48
|
+
resourceName: r.readString()
|
|
49
|
+
};
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
if (errors.length) {
|
|
53
|
+
throw new ResponseError(apiKey, apiVersion, Object.fromEntries(errors), response);
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
export const api = createAPI(33, 2, createRequest, parseResponse);
|
|
@@ -0,0 +1,30 @@
|
|
|
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 AlterPartitionReassignmentsRequestPartition {
|
|
5
|
+
partitionIndex: number;
|
|
6
|
+
replicas: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface AlterPartitionReassignmentsRequestTopic {
|
|
9
|
+
name: string;
|
|
10
|
+
partitions: AlterPartitionReassignmentsRequestPartition[];
|
|
11
|
+
}
|
|
12
|
+
export type AlterPartitionReassignmentsRequest = Parameters<typeof createRequest>;
|
|
13
|
+
export interface AlterPartitionReassignmentsResponsePartition {
|
|
14
|
+
partitionIndex: number;
|
|
15
|
+
errorCode: number;
|
|
16
|
+
errorMessage: NullableString;
|
|
17
|
+
}
|
|
18
|
+
export interface AlterPartitionReassignmentsResponseResponse {
|
|
19
|
+
name: string;
|
|
20
|
+
partitions: AlterPartitionReassignmentsResponsePartition[];
|
|
21
|
+
}
|
|
22
|
+
export interface AlterPartitionReassignmentsResponse {
|
|
23
|
+
throttleTimeMs: number;
|
|
24
|
+
errorCode: number;
|
|
25
|
+
errorMessage: NullableString;
|
|
26
|
+
responses: AlterPartitionReassignmentsResponseResponse[];
|
|
27
|
+
}
|
|
28
|
+
export declare function createRequest(timeoutMs: number, topics: AlterPartitionReassignmentsRequestTopic[]): Writer;
|
|
29
|
+
export declare function parseResponse(_correlationId: number, apiKey: number, apiVersion: number, reader: Reader): AlterPartitionReassignmentsResponse;
|
|
30
|
+
export declare const api: import("../definitions.ts").API<[timeoutMs: number, topics: AlterPartitionReassignmentsRequestTopic[]], AlterPartitionReassignmentsResponse>;
|