rocketmq-client-remoting-nodejs 0.0.0-stage → 0.0.1

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 (137) hide show
  1. package/README.en.md +428 -0
  2. package/README.md +424 -2
  3. package/dist/client/admin.d.ts +229 -0
  4. package/dist/client/admin.js +2462 -0
  5. package/dist/client/allocate.d.ts +48 -0
  6. package/dist/client/allocate.js +365 -0
  7. package/dist/client/backpressure.d.ts +23 -0
  8. package/dist/client/backpressure.js +95 -0
  9. package/dist/client/consumer.d.ts +294 -0
  10. package/dist/client/consumer.js +3095 -0
  11. package/dist/client/consumer_result.d.ts +129 -0
  12. package/dist/client/consumer_result.js +138 -0
  13. package/dist/client/consumer_stats.d.ts +69 -0
  14. package/dist/client/consumer_stats.js +258 -0
  15. package/dist/client/exception.d.ts +39 -0
  16. package/dist/client/exception.js +36 -0
  17. package/dist/client/hook.d.ts +145 -0
  18. package/dist/client/hook.js +171 -0
  19. package/dist/client/latency.d.ts +61 -0
  20. package/dist/client/latency.js +239 -0
  21. package/dist/client/lite_pull_consumer.d.ts +151 -0
  22. package/dist/client/lite_pull_consumer.js +1096 -0
  23. package/dist/client/mq_client.d.ts +188 -0
  24. package/dist/client/mq_client.js +1678 -0
  25. package/dist/client/mq_client_manager.d.ts +21 -0
  26. package/dist/client/mq_client_manager.js +129 -0
  27. package/dist/client/offset_store.d.ts +45 -0
  28. package/dist/client/offset_store.js +389 -0
  29. package/dist/client/open_tracing_hook.d.ts +52 -0
  30. package/dist/client/open_tracing_hook.js +241 -0
  31. package/dist/client/pop_api.d.ts +28 -0
  32. package/dist/client/pop_api.js +224 -0
  33. package/dist/client/pop_consumer.d.ts +23 -0
  34. package/dist/client/pop_consumer.js +719 -0
  35. package/dist/client/pop_process_queue.d.ts +15 -0
  36. package/dist/client/pop_process_queue.js +51 -0
  37. package/dist/client/process_queue.d.ts +49 -0
  38. package/dist/client/process_queue.js +261 -0
  39. package/dist/client/produce_accumulator.d.ts +75 -0
  40. package/dist/client/produce_accumulator.js +288 -0
  41. package/dist/client/producer.d.ts +231 -0
  42. package/dist/client/producer.js +1774 -0
  43. package/dist/client/pull_api.d.ts +26 -0
  44. package/dist/client/pull_api.js +264 -0
  45. package/dist/client/pull_consumer.d.ts +119 -0
  46. package/dist/client/pull_consumer.js +876 -0
  47. package/dist/client/pull_schedule_service.d.ts +71 -0
  48. package/dist/client/pull_schedule_service.js +424 -0
  49. package/dist/client/request_reply.d.ts +61 -0
  50. package/dist/client/request_reply.js +232 -0
  51. package/dist/client/retry_message.d.ts +2 -0
  52. package/dist/client/retry_message.js +27 -0
  53. package/dist/client/send_result.d.ts +57 -0
  54. package/dist/client/send_result.js +70 -0
  55. package/dist/client/top_addressing.d.ts +20 -0
  56. package/dist/client/top_addressing.js +75 -0
  57. package/dist/client/trace_context.d.ts +61 -0
  58. package/dist/client/trace_context.js +373 -0
  59. package/dist/client/trace_dispatcher.d.ts +31 -0
  60. package/dist/client/trace_dispatcher.js +236 -0
  61. package/dist/client/trace_hook.d.ts +23 -0
  62. package/dist/client/trace_hook.js +228 -0
  63. package/dist/client/traceparent.d.ts +9 -0
  64. package/dist/client/traceparent.js +86 -0
  65. package/dist/common/boundary_type.d.ts +7 -0
  66. package/dist/common/boundary_type.js +16 -0
  67. package/dist/common/compress.d.ts +28 -0
  68. package/dist/common/compress.js +512 -0
  69. package/dist/common/message.d.ts +129 -0
  70. package/dist/common/message.js +214 -0
  71. package/dist/common/messageClientIdSetter.d.ts +7 -0
  72. package/dist/common/messageClientIdSetter.js +48 -0
  73. package/dist/common/messageConst.d.ts +68 -0
  74. package/dist/common/messageConst.js +68 -0
  75. package/dist/common/messageDecoder.d.ts +40 -0
  76. package/dist/common/messageDecoder.js +504 -0
  77. package/dist/common/messageType.d.ts +11 -0
  78. package/dist/common/messageType.js +11 -0
  79. package/dist/common/message_accessor.d.ts +39 -0
  80. package/dist/common/message_accessor.js +135 -0
  81. package/dist/common/mixAll.d.ts +106 -0
  82. package/dist/common/mixAll.js +247 -0
  83. package/dist/common/recall_message_handle.d.ts +25 -0
  84. package/dist/common/recall_message_handle.js +98 -0
  85. package/dist/common/subscriptionData.d.ts +36 -0
  86. package/dist/common/subscriptionData.js +64 -0
  87. package/dist/common/sysflag.d.ts +129 -0
  88. package/dist/common/sysflag.js +96 -0
  89. package/dist/common/topic_config.d.ts +66 -0
  90. package/dist/common/topic_config.js +106 -0
  91. package/dist/common/topic_validator.d.ts +49 -0
  92. package/dist/common/topic_validator.js +115 -0
  93. package/dist/common/utilAll.d.ts +39 -0
  94. package/dist/common/utilAll.js +154 -0
  95. package/dist/common/validators.d.ts +25 -0
  96. package/dist/common/validators.js +80 -0
  97. package/dist/index.d.ts +24 -0
  98. package/dist/index.js +36 -0
  99. package/dist/logging.d.ts +24 -0
  100. package/dist/logging.js +246 -0
  101. package/dist/remoting/acl.d.ts +16 -0
  102. package/dist/remoting/acl.js +39 -0
  103. package/dist/remoting/admin_body.d.ts +257 -0
  104. package/dist/remoting/admin_body.js +669 -0
  105. package/dist/remoting/bodies.d.ts +475 -0
  106. package/dist/remoting/bodies.js +1131 -0
  107. package/dist/remoting/client.d.ts +73 -0
  108. package/dist/remoting/client.js +591 -0
  109. package/dist/remoting/codes.d.ts +296 -0
  110. package/dist/remoting/codes.js +301 -0
  111. package/dist/remoting/exception.d.ts +45 -0
  112. package/dist/remoting/exception.js +58 -0
  113. package/dist/remoting/extra_info.d.ts +61 -0
  114. package/dist/remoting/extra_info.js +220 -0
  115. package/dist/remoting/headers.d.ts +758 -0
  116. package/dist/remoting/headers.js +1307 -0
  117. package/dist/remoting/heartbeat.d.ts +91 -0
  118. package/dist/remoting/heartbeat.js +227 -0
  119. package/dist/remoting/namespace.d.ts +14 -0
  120. package/dist/remoting/namespace.js +85 -0
  121. package/dist/remoting/pop_bodies.d.ts +58 -0
  122. package/dist/remoting/pop_bodies.js +214 -0
  123. package/dist/remoting/remotingCommand.d.ts +39 -0
  124. package/dist/remoting/remotingCommand.js +225 -0
  125. package/dist/remoting/route.d.ts +61 -0
  126. package/dist/remoting/route.js +288 -0
  127. package/dist/remoting/rpc_hooks.d.ts +31 -0
  128. package/dist/remoting/rpc_hooks.js +73 -0
  129. package/dist/remoting/serialize.d.ts +33 -0
  130. package/dist/remoting/serialize.js +372 -0
  131. package/dist/remoting/socks_proxy.d.ts +29 -0
  132. package/dist/remoting/socks_proxy.js +379 -0
  133. package/dist/remoting/static_topic.d.ts +49 -0
  134. package/dist/remoting/static_topic.js +244 -0
  135. package/dist/remoting/subscription.d.ts +65 -0
  136. package/dist/remoting/subscription.js +172 -0
  137. package/package.json +38 -4
@@ -0,0 +1,669 @@
1
+ import { RemotingSerializable } from "./serialize.js";
2
+ import { messageQueueKey, parseMessageQueueKey, decodeMessageQueueMap, TopicConfig, TopicConfigSerializeWrapper, OffsetWrapper, ConsumeStats, ConsumerRunningInfo, } from "./bodies.js";
3
+ // Re-export shared admin bodies so a single import covers all admin body types.
4
+ export { messageQueueKey, parseMessageQueueKey, decodeMessageQueueMap, TopicConfig, TopicConfigSerializeWrapper, OffsetWrapper, ConsumeStats, ConsumerRunningInfo, };
5
+ // ---------------------------------------------------------------- TopicOffset
6
+ export class TopicOffset {
7
+ minOffset = 0;
8
+ maxOffset = 0;
9
+ lastUpdateTimestamp = 0;
10
+ constructor(minOffset = 0, maxOffset = 0, lastUpdateTimestamp = 0) {
11
+ this.minOffset = minOffset;
12
+ this.maxOffset = maxOffset;
13
+ this.lastUpdateTimestamp = lastUpdateTimestamp;
14
+ }
15
+ toDict() {
16
+ return {
17
+ minOffset: this.minOffset,
18
+ maxOffset: this.maxOffset,
19
+ lastUpdateTimestamp: this.lastUpdateTimestamp,
20
+ };
21
+ }
22
+ static fromDict(d) {
23
+ return new TopicOffset(d['minOffset'] != null ? d['minOffset'] : 0, d['maxOffset'] != null ? d['maxOffset'] : 0, d['lastUpdateTimestamp'] != null ? d['lastUpdateTimestamp'] : 0);
24
+ }
25
+ encode() {
26
+ return RemotingSerializable.encode(this.toDict());
27
+ }
28
+ static decode(data) {
29
+ return TopicOffset.fromDict(RemotingSerializable.decode(data));
30
+ }
31
+ toString() {
32
+ return `TopicOffset[min=${this.minOffset}, max=${this.maxOffset}, ts=${this.lastUpdateTimestamp}]`;
33
+ }
34
+ }
35
+ // ---------------------------------------------------------------- TopicStatsTable
36
+ export class TopicStatsTable {
37
+ offsetTable = new Map();
38
+ topicPutTps = 0.0;
39
+ toDict() {
40
+ const offsetTable = {};
41
+ for (const [k, v] of this.offsetTable)
42
+ offsetTable[messageQueueKey(k)] = v.toDict();
43
+ return {
44
+ offsetTable,
45
+ topicPutTps: this.topicPutTps,
46
+ };
47
+ }
48
+ static fromDict(d) {
49
+ const t = new TopicStatsTable();
50
+ const decoded = decodeMessageQueueMap(d['offsetTable']);
51
+ for (const [mq, v] of decoded)
52
+ t.offsetTable.set(mq, TopicOffset.fromDict(v));
53
+ t.topicPutTps = d['topicPutTps'] != null ? d['topicPutTps'] : 0.0;
54
+ return t;
55
+ }
56
+ encode() {
57
+ return RemotingSerializable.encode(this.toDict());
58
+ }
59
+ static decode(data) {
60
+ return TopicStatsTable.fromDict(RemotingSerializable.decode(data));
61
+ }
62
+ }
63
+ // ---------------------------------------------------------------- ConsumeQueueData
64
+ export class ConsumeQueueData {
65
+ physicOffset = 0;
66
+ physicSize = 0;
67
+ tagsCode = 0;
68
+ extendDataJson = null;
69
+ bitMap = null;
70
+ eval = false;
71
+ msg = null;
72
+ constructor(physicOffset = 0, physicSize = 0, tagsCode = 0, extendDataJson = null, bitMap = null, eval_ = false, msg = null) {
73
+ this.physicOffset = physicOffset;
74
+ this.physicSize = physicSize;
75
+ this.tagsCode = tagsCode;
76
+ this.extendDataJson = extendDataJson;
77
+ this.bitMap = bitMap;
78
+ this.eval = eval_;
79
+ this.msg = msg;
80
+ }
81
+ toDict() {
82
+ const d = {
83
+ physicOffset: this.physicOffset,
84
+ physicSize: this.physicSize,
85
+ tagsCode: this.tagsCode,
86
+ eval: this.eval,
87
+ bitMap: this.bitMap,
88
+ };
89
+ // null fields are not serialized
90
+ if (this.extendDataJson != null)
91
+ d['extendDataJson'] = this.extendDataJson;
92
+ if (this.msg != null)
93
+ d['msg'] = this.msg;
94
+ return d;
95
+ }
96
+ static fromDict(d) {
97
+ return new ConsumeQueueData(d['physicOffset'] != null ? d['physicOffset'] : 0, d['physicSize'] != null ? d['physicSize'] : 0, d['tagsCode'] != null ? d['tagsCode'] : 0, d['extendDataJson'] != null ? d['extendDataJson'] : null, d['bitMap'] != null ? d['bitMap'] : null, d['eval'] != null ? d['eval'] : false, d['msg'] != null ? d['msg'] : null);
98
+ }
99
+ }
100
+ // ---------------------------------------------------------------- QueryConsumeQueueResponseBody
101
+ export class QueryConsumeQueueResponseBody {
102
+ subscriptionData = null;
103
+ filterData = null;
104
+ queueData = null;
105
+ maxQueueIndex = 0;
106
+ minQueueIndex = 0;
107
+ toDict() {
108
+ const d = {
109
+ maxQueueIndex: this.maxQueueIndex,
110
+ minQueueIndex: this.minQueueIndex,
111
+ };
112
+ if (this.subscriptionData != null)
113
+ d['subscriptionData'] = this.subscriptionData;
114
+ if (this.filterData != null)
115
+ d['filterData'] = this.filterData;
116
+ if (this.queueData != null)
117
+ d['queueData'] = this.queueData.map((q) => q.toDict());
118
+ return d;
119
+ }
120
+ static fromDict(d) {
121
+ const b = new QueryConsumeQueueResponseBody();
122
+ b.subscriptionData = d['subscriptionData'] != null ? d['subscriptionData'] : null;
123
+ b.filterData = d['filterData'] != null ? d['filterData'] : null;
124
+ const raw = d['queueData'];
125
+ b.queueData = Array.isArray(raw) ? raw.map((x) => ConsumeQueueData.fromDict(x)) : null;
126
+ b.maxQueueIndex = d['maxQueueIndex'] != null ? d['maxQueueIndex'] : 0;
127
+ b.minQueueIndex = d['minQueueIndex'] != null ? d['minQueueIndex'] : 0;
128
+ return b;
129
+ }
130
+ encode() {
131
+ return RemotingSerializable.encode(this.toDict());
132
+ }
133
+ static decode(data) {
134
+ return QueryConsumeQueueResponseBody.fromDict(RemotingSerializable.decode(data));
135
+ }
136
+ }
137
+ // ---------------------------------------------------------------- GroupForbidden
138
+ export class GroupForbidden {
139
+ topic = null;
140
+ group = null;
141
+ readable = null;
142
+ toDict() {
143
+ const d = {};
144
+ if (this.topic != null)
145
+ d['topic'] = this.topic;
146
+ if (this.group != null)
147
+ d['group'] = this.group;
148
+ if (this.readable != null)
149
+ d['readable'] = this.readable;
150
+ return d;
151
+ }
152
+ static fromDict(d) {
153
+ const g = new GroupForbidden();
154
+ g.topic = d['topic'] != null ? d['topic'] : null;
155
+ g.group = d['group'] != null ? d['group'] : null;
156
+ g.readable = d['readable'] != null ? !!d['readable'] : null;
157
+ return g;
158
+ }
159
+ encode() { return RemotingSerializable.encode(this.toDict()); }
160
+ static decode(data) {
161
+ return GroupForbidden.fromDict(RemotingSerializable.decode(data));
162
+ }
163
+ }
164
+ // ---------------------------------------------------------------------------
165
+ // Auth user / ACL management bodies.
166
+ //
167
+ // Two rules decide the whole encoding:
168
+ // * a field with no value is ABSENT from the JSON object, never present with
169
+ // a null/empty value — the auth layer reads a present field as an explicit
170
+ // change, so an unset one must not appear at all;
171
+ // * the enum spellings are wire values and are case-exact. They are NOT
172
+ // mutually consistent (`Super`/`Normal` vs `enable`/`disable`), so each is
173
+ // written out verbatim rather than derived from a shared convention.
174
+ // ---------------------------------------------------------------------------
175
+ export const UserType = { SUPER: 'Super', NORMAL: 'Normal' };
176
+ export const UserStatus = { ENABLE: 'enable', DISABLE: 'disable' };
177
+ export const PolicyType = { CUSTOM: 'Custom', DEFAULT: 'Default' };
178
+ export const Decision = { ALLOW: 'Allow', DENY: 'Deny' };
179
+ function _put(d, key, value) {
180
+ if (value !== null && value !== undefined)
181
+ d[key] = value;
182
+ }
183
+ export class UserInfo {
184
+ username;
185
+ password;
186
+ userType;
187
+ userStatus;
188
+ constructor(username = null, password = null, userType = null, userStatus = null) {
189
+ this.username = username;
190
+ this.password = password;
191
+ this.userType = userType;
192
+ this.userStatus = userStatus;
193
+ }
194
+ toDict() {
195
+ const d = {};
196
+ _put(d, 'username', this.username);
197
+ _put(d, 'password', this.password);
198
+ _put(d, 'userType', this.userType);
199
+ _put(d, 'userStatus', this.userStatus);
200
+ return d;
201
+ }
202
+ static fromDict(d) {
203
+ return new UserInfo(d['username'] != null ? d['username'] : null, d['password'] != null ? d['password'] : null, d['userType'] != null ? d['userType'] : null, d['userStatus'] != null ? d['userStatus'] : null);
204
+ }
205
+ encode() { return RemotingSerializable.encode(this.toDict()); }
206
+ static decode(data) {
207
+ return UserInfo.fromDict(RemotingSerializable.decode(data));
208
+ }
209
+ static decodeList(data) {
210
+ const arr = RemotingSerializable.decode(data);
211
+ if (!Array.isArray(arr))
212
+ return [];
213
+ return arr.map((d) => UserInfo.fromDict(d));
214
+ }
215
+ toString() {
216
+ return `UserInfo[username=${this.username}, userType=${this.userType}, userStatus=${this.userStatus}]`;
217
+ }
218
+ }
219
+ export class AclEntry {
220
+ resource;
221
+ actions;
222
+ sourceIps;
223
+ decision;
224
+ constructor(resource = null, actions = null, sourceIps = null, decision = null) {
225
+ this.resource = resource;
226
+ this.actions = actions;
227
+ this.sourceIps = sourceIps;
228
+ this.decision = decision;
229
+ }
230
+ toDict() {
231
+ const d = {};
232
+ _put(d, 'resource', this.resource);
233
+ _put(d, 'actions', this.actions);
234
+ _put(d, 'sourceIps', this.sourceIps);
235
+ _put(d, 'decision', this.decision);
236
+ return d;
237
+ }
238
+ static fromDict(d) {
239
+ return new AclEntry(d['resource'] != null ? d['resource'] : null, Array.isArray(d['actions']) ? d['actions'].map((a) => String(a)) : null, Array.isArray(d['sourceIps']) ? d['sourceIps'].map((s) => String(s)) : null, d['decision'] != null ? d['decision'] : null);
240
+ }
241
+ }
242
+ export class AclPolicy {
243
+ policyType;
244
+ entries;
245
+ constructor(policyType = null, entries = []) {
246
+ this.policyType = policyType;
247
+ this.entries = entries;
248
+ }
249
+ toDict() {
250
+ const d = {};
251
+ _put(d, 'policyType', this.policyType);
252
+ d['entries'] = this.entries.map((e) => e.toDict());
253
+ return d;
254
+ }
255
+ static fromDict(d) {
256
+ const raw = Array.isArray(d['entries']) ? d['entries'] : [];
257
+ return new AclPolicy(d['policyType'] != null ? d['policyType'] : null, raw.map((e) => AclEntry.fromDict(e)));
258
+ }
259
+ }
260
+ export class AclInfo {
261
+ subject;
262
+ policies;
263
+ constructor(subject = null, policies = []) {
264
+ this.subject = subject;
265
+ this.policies = policies;
266
+ }
267
+ // One policy whose policyType stays unset, one entry per resource repeating
268
+ // the same actions / sourceIps / decision.
269
+ static fromResources(subject, resources, actions, sourceIps, decision) {
270
+ const entries = (resources != null ? resources : []).map((r) => new AclEntry(r, actions, sourceIps, decision));
271
+ return new AclInfo(subject, [new AclPolicy(null, entries)]);
272
+ }
273
+ toDict() {
274
+ const d = {};
275
+ _put(d, 'subject', this.subject);
276
+ d['policies'] = this.policies.map((p) => p.toDict());
277
+ return d;
278
+ }
279
+ static fromDict(d) {
280
+ const raw = Array.isArray(d['policies']) ? d['policies'] : [];
281
+ return new AclInfo(d['subject'] != null ? d['subject'] : null, raw.map((p) => AclPolicy.fromDict(p)));
282
+ }
283
+ encode() { return RemotingSerializable.encode(this.toDict()); }
284
+ static decode(data) {
285
+ return AclInfo.fromDict(RemotingSerializable.decode(data));
286
+ }
287
+ static decodeList(data) {
288
+ const arr = RemotingSerializable.decode(data);
289
+ if (!Array.isArray(arr))
290
+ return [];
291
+ return arr.map((d) => AclInfo.fromDict(d));
292
+ }
293
+ toString() {
294
+ return `AclInfo[subject=${this.subject}, policies=${this.policies.length}]`;
295
+ }
296
+ }
297
+ // ---------------------------------------------------------------- Controller replica state
298
+ //
299
+ // The controller's replica-state answer: one ReplicasInfo per broker name, each
300
+ // carrying the master identity plus the in-sync / not-in-sync replica sets.
301
+ export class ReplicaIdentity {
302
+ brokerName = null;
303
+ brokerId = null;
304
+ brokerAddress = null;
305
+ alive = null;
306
+ toDict() {
307
+ const d = {};
308
+ _put(d, 'brokerName', this.brokerName);
309
+ _put(d, 'brokerId', this.brokerId);
310
+ _put(d, 'brokerAddress', this.brokerAddress);
311
+ _put(d, 'alive', this.alive);
312
+ return d;
313
+ }
314
+ static fromDict(d) {
315
+ const r = new ReplicaIdentity();
316
+ r.brokerName = d['brokerName'] != null ? String(d['brokerName']) : null;
317
+ r.brokerId = d['brokerId'] != null ? parseInt(d['brokerId'], 10) : null;
318
+ r.brokerAddress = d['brokerAddress'] != null ? String(d['brokerAddress']) : null;
319
+ r.alive = d['alive'] != null ? !!d['alive'] : null;
320
+ return r;
321
+ }
322
+ toString() {
323
+ return `ReplicaIdentity[brokerName=${this.brokerName}, brokerId=${this.brokerId}, `
324
+ + `brokerAddress=${this.brokerAddress}, alive=${this.alive}]`;
325
+ }
326
+ }
327
+ export class ReplicasInfo {
328
+ masterBrokerId = null;
329
+ masterAddress = null;
330
+ masterEpoch = null;
331
+ syncStateSetEpoch = null;
332
+ inSyncReplicas = null;
333
+ notInSyncReplicas = null;
334
+ toDict() {
335
+ const d = {};
336
+ _put(d, 'masterBrokerId', this.masterBrokerId);
337
+ _put(d, 'masterAddress', this.masterAddress);
338
+ _put(d, 'masterEpoch', this.masterEpoch);
339
+ _put(d, 'syncStateSetEpoch', this.syncStateSetEpoch);
340
+ if (this.inSyncReplicas != null)
341
+ d['inSyncReplicas'] = this.inSyncReplicas.map((r) => r.toDict());
342
+ if (this.notInSyncReplicas != null)
343
+ d['notInSyncReplicas'] = this.notInSyncReplicas.map((r) => r.toDict());
344
+ return d;
345
+ }
346
+ static fromDict(d) {
347
+ const r = new ReplicasInfo();
348
+ r.masterBrokerId = d['masterBrokerId'] != null ? parseInt(d['masterBrokerId'], 10) : null;
349
+ r.masterAddress = d['masterAddress'] != null ? String(d['masterAddress']) : null;
350
+ r.masterEpoch = d['masterEpoch'] != null ? parseInt(d['masterEpoch'], 10) : null;
351
+ r.syncStateSetEpoch = d['syncStateSetEpoch'] != null ? parseInt(d['syncStateSetEpoch'], 10) : null;
352
+ r.inSyncReplicas = Array.isArray(d['inSyncReplicas'])
353
+ ? d['inSyncReplicas'].map((x) => ReplicaIdentity.fromDict(x)) : null;
354
+ r.notInSyncReplicas = Array.isArray(d['notInSyncReplicas'])
355
+ ? d['notInSyncReplicas'].map((x) => ReplicaIdentity.fromDict(x)) : null;
356
+ return r;
357
+ }
358
+ }
359
+ export class BrokerReplicasInfo {
360
+ replicasInfoTable = {};
361
+ toDict() {
362
+ const table = {};
363
+ for (const [k, v] of Object.entries(this.replicasInfoTable))
364
+ table[k] = v.toDict();
365
+ return { replicasInfoTable: table };
366
+ }
367
+ static fromDict(d) {
368
+ const b = new BrokerReplicasInfo();
369
+ const raw = d['replicasInfoTable'];
370
+ if (raw != null && typeof raw === 'object') {
371
+ for (const [k, v] of Object.entries(raw)) {
372
+ b.replicasInfoTable[k] = ReplicasInfo.fromDict(v);
373
+ }
374
+ }
375
+ return b;
376
+ }
377
+ encode() { return RemotingSerializable.encode(this.toDict()); }
378
+ static decode(data) {
379
+ return BrokerReplicasInfo.fromDict(RemotingSerializable.decode(data));
380
+ }
381
+ }
382
+ // CONTROLLER_GET_METADATA_INFO's answer rides the response extFields, where
383
+ // every value arrives as a string — "true"/"false" is the wire rendering of
384
+ // the boolean.
385
+ export class GetMetaDataResponseHeader {
386
+ group = null;
387
+ controllerLeaderId = null;
388
+ controllerLeaderAddress = null;
389
+ isLeader = false;
390
+ peers = null;
391
+ static fromDict(d) {
392
+ const h = new GetMetaDataResponseHeader();
393
+ h.group = d['group'] != null ? String(d['group']) : null;
394
+ h.controllerLeaderId = d['controllerLeaderId'] != null ? String(d['controllerLeaderId']) : null;
395
+ h.controllerLeaderAddress = d['controllerLeaderAddress'] != null ? String(d['controllerLeaderAddress']) : null;
396
+ h.isLeader = d['isLeader'] === true || d['isLeader'] === 'true';
397
+ h.peers = d['peers'] != null ? String(d['peers']) : null;
398
+ return h;
399
+ }
400
+ toString() {
401
+ return `GetMetaDataResponseHeader[group=${this.group}, leaderId=${this.controllerLeaderId}, `
402
+ + `leaderAddress=${this.controllerLeaderAddress}, isLeader=${this.isLeader}]`;
403
+ }
404
+ }
405
+ // ---------------------------------------------------------------- RocksDB consume-queue check
406
+ export const CheckRocksdbCqWriteStatus = {
407
+ CHECK_OK: 0,
408
+ CHECK_NOT_OK: 1,
409
+ CHECK_IN_PROGRESS: 2,
410
+ CHECK_ERROR: 3,
411
+ };
412
+ export class CheckRocksdbCqWriteResult {
413
+ checkResult = null;
414
+ checkStatus = CheckRocksdbCqWriteStatus.CHECK_OK;
415
+ toDict() {
416
+ const d = { checkStatus: this.checkStatus };
417
+ _put(d, 'checkResult', this.checkResult);
418
+ return d;
419
+ }
420
+ static fromDict(d) {
421
+ const r = new CheckRocksdbCqWriteResult();
422
+ r.checkResult = d['checkResult'] != null ? String(d['checkResult']) : null;
423
+ r.checkStatus = d['checkStatus'] != null ? parseInt(d['checkStatus'], 10) : CheckRocksdbCqWriteStatus.CHECK_OK;
424
+ return r;
425
+ }
426
+ encode() { return RemotingSerializable.encode(this.toDict()); }
427
+ static decode(data) {
428
+ return CheckRocksdbCqWriteResult.fromDict(RemotingSerializable.decode(data));
429
+ }
430
+ toString() {
431
+ return `CheckRocksdbCqWriteResult[checkResult=${this.checkResult}, checkStatus=${this.checkStatus}]`;
432
+ }
433
+ }
434
+ // ---------------------------------------------------------------- Lite (LMQ) admin bodies
435
+ export class GetBrokerLiteInfoResponseBody {
436
+ storeType = null;
437
+ maxLmqNum = 0;
438
+ currentLmqNum = 0;
439
+ liteSubscriptionCount = 0;
440
+ orderInfoCount = 0;
441
+ cqTableSize = 0;
442
+ offsetTableSize = 0;
443
+ eventMapSize = 0;
444
+ topicMeta = null;
445
+ groupMeta = null;
446
+ static fromDict(d) {
447
+ const b = new GetBrokerLiteInfoResponseBody();
448
+ b.storeType = d['storeType'] != null ? String(d['storeType']) : null;
449
+ b.maxLmqNum = d['maxLmqNum'] != null ? parseInt(d['maxLmqNum'], 10) : 0;
450
+ b.currentLmqNum = d['currentLmqNum'] != null ? parseInt(d['currentLmqNum'], 10) : 0;
451
+ b.liteSubscriptionCount = d['liteSubscriptionCount'] != null ? parseInt(d['liteSubscriptionCount'], 10) : 0;
452
+ b.orderInfoCount = d['orderInfoCount'] != null ? parseInt(d['orderInfoCount'], 10) : 0;
453
+ b.cqTableSize = d['cqTableSize'] != null ? parseInt(d['cqTableSize'], 10) : 0;
454
+ b.offsetTableSize = d['offsetTableSize'] != null ? parseInt(d['offsetTableSize'], 10) : 0;
455
+ b.eventMapSize = d['eventMapSize'] != null ? parseInt(d['eventMapSize'], 10) : 0;
456
+ b.topicMeta = d['topicMeta'] != null && typeof d['topicMeta'] === 'object' ? d['topicMeta'] : null;
457
+ b.groupMeta = d['groupMeta'] != null && typeof d['groupMeta'] === 'object' ? d['groupMeta'] : null;
458
+ return b;
459
+ }
460
+ encode() { return RemotingSerializable.encode(this); }
461
+ static decode(data) {
462
+ return GetBrokerLiteInfoResponseBody.fromDict(RemotingSerializable.decode(data));
463
+ }
464
+ }
465
+ export class GetParentTopicInfoResponseBody {
466
+ topic = null;
467
+ ttl = 0;
468
+ groups = null;
469
+ lmqNum = 0;
470
+ liteTopicCount = 0;
471
+ static fromDict(d) {
472
+ const b = new GetParentTopicInfoResponseBody();
473
+ b.topic = d['topic'] != null ? String(d['topic']) : null;
474
+ b.ttl = d['ttl'] != null ? parseInt(d['ttl'], 10) : 0;
475
+ b.groups = Array.isArray(d['groups']) ? d['groups'].map((g) => String(g)) : null;
476
+ b.lmqNum = d['lmqNum'] != null ? parseInt(d['lmqNum'], 10) : 0;
477
+ b.liteTopicCount = d['liteTopicCount'] != null ? parseInt(d['liteTopicCount'], 10) : 0;
478
+ return b;
479
+ }
480
+ encode() { return RemotingSerializable.encode(this); }
481
+ static decode(data) {
482
+ return GetParentTopicInfoResponseBody.fromDict(RemotingSerializable.decode(data));
483
+ }
484
+ }
485
+ export class GetLiteTopicInfoResponseBody {
486
+ parentTopic = null;
487
+ liteTopic = null;
488
+ subscriber = null;
489
+ topicOffset = null;
490
+ shardingToBroker = false;
491
+ static fromDict(d) {
492
+ const b = new GetLiteTopicInfoResponseBody();
493
+ b.parentTopic = d['parentTopic'] != null ? String(d['parentTopic']) : null;
494
+ b.liteTopic = d['liteTopic'] != null ? String(d['liteTopic']) : null;
495
+ b.subscriber = Array.isArray(d['subscriber']) ? d['subscriber'] : null;
496
+ b.topicOffset = d['topicOffset'] != null && typeof d['topicOffset'] === 'object' ? d['topicOffset'] : null;
497
+ b.shardingToBroker = d['shardingToBroker'] != null ? !!d['shardingToBroker'] : false;
498
+ return b;
499
+ }
500
+ encode() { return RemotingSerializable.encode(this); }
501
+ static decode(data) {
502
+ return GetLiteTopicInfoResponseBody.fromDict(RemotingSerializable.decode(data));
503
+ }
504
+ }
505
+ export class GetLiteClientInfoResponseBody {
506
+ parentTopic = null;
507
+ group = null;
508
+ clientId = null;
509
+ lastAccessTime = 0;
510
+ lastConsumeTime = 0;
511
+ liteTopicCount = 0;
512
+ liteTopicSet = null;
513
+ static fromDict(d) {
514
+ const b = new GetLiteClientInfoResponseBody();
515
+ b.parentTopic = d['parentTopic'] != null ? String(d['parentTopic']) : null;
516
+ b.group = d['group'] != null ? String(d['group']) : null;
517
+ b.clientId = d['clientId'] != null ? String(d['clientId']) : null;
518
+ b.lastAccessTime = d['lastAccessTime'] != null ? parseInt(d['lastAccessTime'], 10) : 0;
519
+ b.lastConsumeTime = d['lastConsumeTime'] != null ? parseInt(d['lastConsumeTime'], 10) : 0;
520
+ b.liteTopicCount = d['liteTopicCount'] != null ? parseInt(d['liteTopicCount'], 10) : 0;
521
+ b.liteTopicSet = Array.isArray(d['liteTopicSet']) ? d['liteTopicSet'].map((t) => String(t)) : null;
522
+ return b;
523
+ }
524
+ encode() { return RemotingSerializable.encode(this); }
525
+ static decode(data) {
526
+ return GetLiteClientInfoResponseBody.fromDict(RemotingSerializable.decode(data));
527
+ }
528
+ }
529
+ export class LiteLagInfo {
530
+ liteTopic = null;
531
+ lagCount = 0;
532
+ earliestUnconsumedTimestamp = -1;
533
+ consumerOffset = -1;
534
+ static fromDict(d) {
535
+ const l = new LiteLagInfo();
536
+ l.liteTopic = d['liteTopic'] != null ? String(d['liteTopic']) : null;
537
+ l.lagCount = d['lagCount'] != null ? parseInt(d['lagCount'], 10) : 0;
538
+ l.earliestUnconsumedTimestamp = d['earliestUnconsumedTimestamp'] != null
539
+ ? parseInt(d['earliestUnconsumedTimestamp'], 10) : -1;
540
+ l.consumerOffset = d['consumerOffset'] != null ? parseInt(d['consumerOffset'], 10) : -1;
541
+ return l;
542
+ }
543
+ }
544
+ export class GetLiteGroupInfoResponseBody {
545
+ group = null;
546
+ parentTopic = null;
547
+ liteTopic = null;
548
+ earliestUnconsumedTimestamp = -1;
549
+ totalLagCount = 0;
550
+ liteTopicOffsetWrapper = null;
551
+ lagCountTopK = null;
552
+ lagTimestampTopK = null;
553
+ static fromDict(d) {
554
+ const b = new GetLiteGroupInfoResponseBody();
555
+ b.group = d['group'] != null ? String(d['group']) : null;
556
+ b.parentTopic = d['parentTopic'] != null ? String(d['parentTopic']) : null;
557
+ b.liteTopic = d['liteTopic'] != null ? String(d['liteTopic']) : null;
558
+ b.earliestUnconsumedTimestamp = d['earliestUnconsumedTimestamp'] != null
559
+ ? parseInt(d['earliestUnconsumedTimestamp'], 10) : -1;
560
+ b.totalLagCount = d['totalLagCount'] != null ? parseInt(d['totalLagCount'], 10) : 0;
561
+ b.liteTopicOffsetWrapper = d['liteTopicOffsetWrapper'] != null
562
+ && typeof d['liteTopicOffsetWrapper'] === 'object' ? d['liteTopicOffsetWrapper'] : null;
563
+ b.lagCountTopK = Array.isArray(d['lagCountTopK'])
564
+ ? d['lagCountTopK'].map((x) => LiteLagInfo.fromDict(x)) : null;
565
+ b.lagTimestampTopK = Array.isArray(d['lagTimestampTopK'])
566
+ ? d['lagTimestampTopK'].map((x) => LiteLagInfo.fromDict(x)) : null;
567
+ return b;
568
+ }
569
+ encode() { return RemotingSerializable.encode(this); }
570
+ static decode(data) {
571
+ return GetLiteGroupInfoResponseBody.fromDict(RemotingSerializable.decode(data));
572
+ }
573
+ }
574
+ // ---------------------------------------------------------------- Concurrent admin tooling results
575
+ export class BrokerOperatorResult {
576
+ successList = [];
577
+ failureList = [];
578
+ toDict() {
579
+ return { successList: this.successList.slice(), failureList: this.failureList.slice() };
580
+ }
581
+ static fromDict(d) {
582
+ const r = new BrokerOperatorResult();
583
+ r.successList = Array.isArray(d['successList']) ? d['successList'].map((s) => String(s)) : [];
584
+ r.failureList = Array.isArray(d['failureList']) ? d['failureList'].map((s) => String(s)) : [];
585
+ return r;
586
+ }
587
+ toString() {
588
+ return `BrokerOperatorResult{successList=${JSON.stringify(this.successList)}, `
589
+ + `failureList=${JSON.stringify(this.failureList)}}`;
590
+ }
591
+ }
592
+ export const AdminToolsResultCodeEnum = {
593
+ SUCCESS: 200,
594
+ REMOTING_ERROR: -1001,
595
+ MQ_BROKER_ERROR: -1002,
596
+ MQ_CLIENT_ERROR: -1003,
597
+ INTERRUPT_ERROR: -1004,
598
+ TOPIC_ROUTE_INFO_NOT_EXIST: -2001,
599
+ CONSUMER_NOT_ONLINE: -2002,
600
+ BROADCAST_CONSUMPTION: -2003,
601
+ };
602
+ export class AdminToolResult {
603
+ success;
604
+ code;
605
+ errorMsg;
606
+ data;
607
+ constructor(success, code, errorMsg = null, data = null) {
608
+ this.success = success;
609
+ this.code = code;
610
+ this.errorMsg = errorMsg;
611
+ this.data = data;
612
+ }
613
+ static success(data) {
614
+ return new AdminToolResult(true, AdminToolsResultCodeEnum.SUCCESS, 'success', data);
615
+ }
616
+ static failure(code, errorMsg, data = null) {
617
+ return new AdminToolResult(false, code, errorMsg, data);
618
+ }
619
+ toDict() {
620
+ const d = { success: this.success, code: this.code };
621
+ if (this.errorMsg != null)
622
+ d['errorMsg'] = this.errorMsg;
623
+ if (this.data != null)
624
+ d['data'] = this.data;
625
+ return d;
626
+ }
627
+ toString() {
628
+ return `AdminToolResult{success=${this.success}, code=${this.code}, `
629
+ + `errorMsg=${this.errorMsg}, data=${this.data != null ? JSON.stringify(this.data.toDict ? this.data.toDict() : this.data) : 'null'}}`;
630
+ }
631
+ }
632
+ export const __all__ = [
633
+ 'messageQueueKey',
634
+ 'parseMessageQueueKey',
635
+ 'decodeMessageQueueMap',
636
+ 'TopicConfig',
637
+ 'TopicConfigSerializeWrapper',
638
+ 'OffsetWrapper',
639
+ 'ConsumeStats',
640
+ 'ConsumerRunningInfo',
641
+ 'TopicOffset',
642
+ 'TopicStatsTable',
643
+ 'ConsumeQueueData',
644
+ 'QueryConsumeQueueResponseBody',
645
+ 'GroupForbidden',
646
+ 'UserType',
647
+ 'UserStatus',
648
+ 'PolicyType',
649
+ 'Decision',
650
+ 'UserInfo',
651
+ 'AclEntry',
652
+ 'AclPolicy',
653
+ 'AclInfo',
654
+ 'ReplicaIdentity',
655
+ 'ReplicasInfo',
656
+ 'BrokerReplicasInfo',
657
+ 'GetMetaDataResponseHeader',
658
+ 'CheckRocksdbCqWriteStatus',
659
+ 'CheckRocksdbCqWriteResult',
660
+ 'GetBrokerLiteInfoResponseBody',
661
+ 'GetParentTopicInfoResponseBody',
662
+ 'GetLiteTopicInfoResponseBody',
663
+ 'GetLiteClientInfoResponseBody',
664
+ 'LiteLagInfo',
665
+ 'GetLiteGroupInfoResponseBody',
666
+ 'BrokerOperatorResult',
667
+ 'AdminToolsResultCodeEnum',
668
+ 'AdminToolResult',
669
+ ];