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,65 @@
1
+ export declare const GroupRetryPolicyType: {
2
+ EXPONENTIAL: string;
3
+ CUSTOMIZED: string;
4
+ };
5
+ export declare class GroupRetryPolicy {
6
+ type: string;
7
+ exponentialRetryPolicy: Record<string, any> | null;
8
+ customizedRetryPolicy: Record<string, any> | null;
9
+ constructor(policyType?: string, exponentialRetryPolicy?: Record<string, any> | null, customizedRetryPolicy?: Record<string, any> | null);
10
+ toDict(): Record<string, any>;
11
+ static fromDict(d: Record<string, any> | null | undefined): GroupRetryPolicy;
12
+ }
13
+ export declare class SimpleSubscriptionData {
14
+ topic: string;
15
+ expressionType: string;
16
+ expression: string;
17
+ version: number;
18
+ constructor(topic?: string, expressionType?: string, expression?: string, version?: number);
19
+ toDict(): Record<string, any>;
20
+ static fromDict(d: Record<string, any>): SimpleSubscriptionData;
21
+ }
22
+ export declare class SubscriptionGroupConfig {
23
+ groupName: string;
24
+ consumeEnable: boolean;
25
+ consumeFromMinEnable: boolean;
26
+ consumeBroadcastEnable: boolean;
27
+ consumeMessageOrderly: boolean;
28
+ retryQueueNums: number;
29
+ retryMaxTimes: number;
30
+ groupRetryPolicy: GroupRetryPolicy;
31
+ brokerId: number;
32
+ whichBrokerWhenConsumeSlowly: number;
33
+ notifyConsumerIdsChangedEnable: boolean;
34
+ groupSysFlag: number;
35
+ consumeTimeoutMinute: number;
36
+ subscriptionDataSet: SimpleSubscriptionData[] | null;
37
+ attributes: Record<string, string>;
38
+ constructor(groupName?: string);
39
+ toDict(): Record<string, any>;
40
+ static fromDict(d: Record<string, any>): SubscriptionGroupConfig;
41
+ encode(): Buffer;
42
+ static decode(data: Buffer): SubscriptionGroupConfig;
43
+ }
44
+ export declare class SubscriptionGroupWrapper {
45
+ subscriptionGroupTable: Record<string, SubscriptionGroupConfig>;
46
+ forbiddenTable: Record<string, any>;
47
+ dataVersion: Record<string, any>;
48
+ constructor();
49
+ toDict(): Record<string, any>;
50
+ static fromDict(d: Record<string, any>): SubscriptionGroupWrapper;
51
+ encode(): Buffer;
52
+ static decode(data: Buffer): SubscriptionGroupWrapper;
53
+ }
54
+ declare const _default: {
55
+ SubscriptionGroupConfig: typeof SubscriptionGroupConfig;
56
+ SubscriptionGroupWrapper: typeof SubscriptionGroupWrapper;
57
+ GroupRetryPolicy: typeof GroupRetryPolicy;
58
+ GroupRetryPolicyType: {
59
+ EXPONENTIAL: string;
60
+ CUSTOMIZED: string;
61
+ };
62
+ SimpleSubscriptionData: typeof SimpleSubscriptionData;
63
+ MASTER_ID: number;
64
+ };
65
+ export default _default;
@@ -0,0 +1,172 @@
1
+ // -*- coding: utf-8 -*-
2
+ // Subscription group model (subscription-related subscription structures).
3
+ // Field names and defaults are derived from the server's actual JSON serialization of SubscriptionGroupConfig.
4
+ import { RemotingSerializable } from "./serialize.js";
5
+ const MASTER_ID = 0;
6
+ export const GroupRetryPolicyType = {
7
+ EXPONENTIAL: 'EXPONENTIAL',
8
+ CUSTOMIZED: 'CUSTOMIZED',
9
+ };
10
+ export class GroupRetryPolicy {
11
+ type;
12
+ exponentialRetryPolicy;
13
+ customizedRetryPolicy;
14
+ constructor(policyType = GroupRetryPolicyType.CUSTOMIZED, exponentialRetryPolicy = null, customizedRetryPolicy = null) {
15
+ this.type = policyType;
16
+ this.exponentialRetryPolicy = exponentialRetryPolicy;
17
+ this.customizedRetryPolicy = customizedRetryPolicy;
18
+ }
19
+ toDict() {
20
+ const d = { type: this.type };
21
+ if (this.exponentialRetryPolicy != null)
22
+ d['exponentialRetryPolicy'] = this.exponentialRetryPolicy;
23
+ if (this.customizedRetryPolicy != null)
24
+ d['customizedRetryPolicy'] = this.customizedRetryPolicy;
25
+ return d;
26
+ }
27
+ static fromDict(d) {
28
+ const dd = d || {};
29
+ return new GroupRetryPolicy(dd['type'] != null ? dd['type'] : GroupRetryPolicyType.CUSTOMIZED, dd['exponentialRetryPolicy'] != null ? dd['exponentialRetryPolicy'] : null, dd['customizedRetryPolicy'] != null ? dd['customizedRetryPolicy'] : null);
30
+ }
31
+ }
32
+ export class SimpleSubscriptionData {
33
+ topic;
34
+ expressionType;
35
+ expression;
36
+ version;
37
+ constructor(topic = '', expressionType = 'TAG', expression = '*', version = 0) {
38
+ this.topic = topic;
39
+ this.expressionType = expressionType;
40
+ this.expression = expression;
41
+ this.version = version;
42
+ }
43
+ toDict() {
44
+ return {
45
+ topic: this.topic,
46
+ expressionType: this.expressionType,
47
+ expression: this.expression,
48
+ version: this.version,
49
+ };
50
+ }
51
+ static fromDict(d) {
52
+ return new SimpleSubscriptionData(d['topic'] != null ? d['topic'] : '', d['expressionType'] != null ? d['expressionType'] : 'TAG', d['expression'] != null ? d['expression'] : '*', d['version'] != null ? d['version'] : 0);
53
+ }
54
+ }
55
+ export class SubscriptionGroupConfig {
56
+ groupName;
57
+ consumeEnable;
58
+ consumeFromMinEnable;
59
+ consumeBroadcastEnable;
60
+ consumeMessageOrderly;
61
+ retryQueueNums;
62
+ retryMaxTimes;
63
+ groupRetryPolicy;
64
+ brokerId;
65
+ whichBrokerWhenConsumeSlowly;
66
+ notifyConsumerIdsChangedEnable;
67
+ groupSysFlag;
68
+ consumeTimeoutMinute;
69
+ subscriptionDataSet;
70
+ attributes;
71
+ constructor(groupName = '') {
72
+ this.groupName = groupName;
73
+ this.consumeEnable = true;
74
+ this.consumeFromMinEnable = true;
75
+ this.consumeBroadcastEnable = true;
76
+ this.consumeMessageOrderly = false;
77
+ this.retryQueueNums = 1;
78
+ this.retryMaxTimes = 16;
79
+ this.groupRetryPolicy = new GroupRetryPolicy();
80
+ this.brokerId = MASTER_ID;
81
+ this.whichBrokerWhenConsumeSlowly = 1;
82
+ this.notifyConsumerIdsChangedEnable = true;
83
+ this.groupSysFlag = 0;
84
+ this.consumeTimeoutMinute = 15;
85
+ this.subscriptionDataSet = null;
86
+ this.attributes = {};
87
+ }
88
+ toDict() {
89
+ const d = {
90
+ groupName: this.groupName,
91
+ consumeEnable: this.consumeEnable,
92
+ consumeFromMinEnable: this.consumeFromMinEnable,
93
+ consumeBroadcastEnable: this.consumeBroadcastEnable,
94
+ consumeMessageOrderly: this.consumeMessageOrderly,
95
+ retryQueueNums: this.retryQueueNums,
96
+ retryMaxTimes: this.retryMaxTimes,
97
+ groupRetryPolicy: this.groupRetryPolicy.toDict(),
98
+ brokerId: this.brokerId,
99
+ whichBrokerWhenConsumeSlowly: this.whichBrokerWhenConsumeSlowly,
100
+ notifyConsumerIdsChangedEnable: this.notifyConsumerIdsChangedEnable,
101
+ groupSysFlag: this.groupSysFlag,
102
+ consumeTimeoutMinute: this.consumeTimeoutMinute,
103
+ attributes: this.attributes,
104
+ };
105
+ if (this.subscriptionDataSet != null) {
106
+ d['subscriptionDataSet'] = this.subscriptionDataSet.map((s) => s.toDict());
107
+ }
108
+ return d;
109
+ }
110
+ static fromDict(d) {
111
+ const cfg = new SubscriptionGroupConfig(d['groupName'] != null ? d['groupName'] : '');
112
+ cfg.consumeEnable = d['consumeEnable'] !== false;
113
+ cfg.consumeFromMinEnable = d['consumeFromMinEnable'] !== false;
114
+ cfg.consumeBroadcastEnable = d['consumeBroadcastEnable'] !== false;
115
+ cfg.consumeMessageOrderly = d['consumeMessageOrderly'] === true;
116
+ cfg.retryQueueNums = d['retryQueueNums'] != null ? d['retryQueueNums'] : 1;
117
+ cfg.retryMaxTimes = d['retryMaxTimes'] != null ? d['retryMaxTimes'] : 16;
118
+ cfg.groupRetryPolicy = GroupRetryPolicy.fromDict(d['groupRetryPolicy']);
119
+ cfg.brokerId = d['brokerId'] != null ? d['brokerId'] : MASTER_ID;
120
+ cfg.whichBrokerWhenConsumeSlowly = d['whichBrokerWhenConsumeSlowly'] != null ? d['whichBrokerWhenConsumeSlowly'] : 1;
121
+ cfg.notifyConsumerIdsChangedEnable = d['notifyConsumerIdsChangedEnable'] !== false;
122
+ cfg.groupSysFlag = d['groupSysFlag'] != null ? d['groupSysFlag'] : 0;
123
+ cfg.consumeTimeoutMinute = d['consumeTimeoutMinute'] != null ? d['consumeTimeoutMinute'] : 15;
124
+ const rawSub = d['subscriptionDataSet'];
125
+ cfg.subscriptionDataSet = rawSub ? rawSub.map((x) => SimpleSubscriptionData.fromDict(x)) : null;
126
+ cfg.attributes = Object.assign({}, d['attributes'] || {});
127
+ return cfg;
128
+ }
129
+ encode() {
130
+ return RemotingSerializable.encode(this.toDict());
131
+ }
132
+ static decode(data) {
133
+ return SubscriptionGroupConfig.fromDict(RemotingSerializable.decode(data));
134
+ }
135
+ }
136
+ export class SubscriptionGroupWrapper {
137
+ subscriptionGroupTable;
138
+ forbiddenTable;
139
+ dataVersion;
140
+ constructor() {
141
+ this.subscriptionGroupTable = {};
142
+ this.forbiddenTable = {};
143
+ this.dataVersion = {};
144
+ }
145
+ toDict() {
146
+ const table = {};
147
+ for (const [k, v] of Object.entries(this.subscriptionGroupTable))
148
+ table[k] = v.toDict();
149
+ return {
150
+ dataVersion: this.dataVersion,
151
+ forbiddenTable: this.forbiddenTable,
152
+ subscriptionGroupTable: table,
153
+ };
154
+ }
155
+ static fromDict(d) {
156
+ const w = new SubscriptionGroupWrapper();
157
+ const table = d['subscriptionGroupTable'] || {};
158
+ for (const [k, v] of Object.entries(table)) {
159
+ w.subscriptionGroupTable[k] = SubscriptionGroupConfig.fromDict(v);
160
+ }
161
+ w.forbiddenTable = Object.assign({}, d['forbiddenTable'] || {});
162
+ w.dataVersion = Object.assign({}, d['dataVersion'] || {});
163
+ return w;
164
+ }
165
+ encode() {
166
+ return RemotingSerializable.encode(this.toDict());
167
+ }
168
+ static decode(data) {
169
+ return SubscriptionGroupWrapper.fromDict(RemotingSerializable.decode(data));
170
+ }
171
+ }
172
+ export default { SubscriptionGroupConfig, SubscriptionGroupWrapper, GroupRetryPolicy, GroupRetryPolicyType, SimpleSubscriptionData, MASTER_ID };
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "rocketmq-client-remoting-nodejs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "Apache RocketMQ classic remoting protocol client for Node.js.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "README.en.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.build.json --noCheck && node fix-dts-imports.mjs",
22
+ "prepare": "npm run build",
23
+ "pack": "npm run build && npm pack",
24
+ "test": "node --experimental-strip-types --test",
25
+ "typecheck": "tsc --noEmit",
26
+ "selfcheck": "node --experimental-strip-types selfcheck.ts",
27
+ "smoke:dist": "node smoke_dist.mjs",
28
+ "live:producer": "node --experimental-strip-types examples/live_producer.ts",
29
+ "live:consumer": "node --experimental-strip-types examples/live_consumer.ts",
30
+ "live:pull": "node --experimental-strip-types examples/live_pull.ts",
31
+ "live:lite_pull": "node --experimental-strip-types examples/live_lite_pull.ts",
32
+ "live:admin": "node --experimental-strip-types examples/live_admin.ts"
33
+ },
34
+ "engines": {
35
+ "node": ">=22"
36
+ },
37
+ "devDependencies": {
38
+ "typescript": "^5.9.3"
39
+ }
40
+ }