tmc.js 0.3.1 → 0.3.2

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/README.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Events driven and chained Taobao Message Channel(TMC) for NodeJS
4
4
 
5
+ [![release](https://img.shields.io/npm/v/tmc.js)](https://github.com/TheNorthMemory/tmc.js/releases)
6
+ [![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/tmc.js?label=snyk.io)](https://snyk.io/advisor/npm-package/tmc.js)
7
+ [![types](https://img.shields.io/badge/types-included-blue)](https://www.npmjs.com/package/tmc.js)
8
+ [![requirement](https://img.shields.io/node/v/tmc.js)](https://www.npmjs.com/package/tmc.js)
9
+ [![downloads](https://img.shields.io/npm/dm/tmc.js)](https://www.npmjs.com/package/tmc.js)
10
+ [![license](https://img.shields.io/npm/l/tmc.js)](https://www.npmjs.com/package/tmc.js)
11
+
5
12
  ## 使用
6
13
 
7
14
  `npm i tmc.js`
@@ -51,7 +58,6 @@ new Tmc('your_app_key', 'your_app_secret')
51
58
 
52
59
  | label | 说明 |
53
60
  | --- | --- |
54
- | `tmc` | 开启全部`DEBUG`日志模式
55
61
  | `tmc:onping` | 开启 `onping` 时的日志
56
62
  | `tmc:onopen` | 开启 `onopen` 时的日志
57
63
  | `tmc:onpull` | 开启 `onpull` 时的日志
@@ -61,7 +67,7 @@ new Tmc('your_app_key', 'your_app_secret')
61
67
  | `tmc:onmessage:connect` | 开启消费端发起连接 `connect` 时的日志
62
68
  | `tmc:onmessage:connectack` | 开启消费端回复连接 `connectack` 时的日志
63
69
  | `tmc:onmessage:send` | 开启消费端接收到(即`From`淘宝) `send` 的消息时的日志
64
- | `tmc:onmessage:sendack` | (暂未明确场景)
70
+ | `tmc:onmessage:sendack` | 当消费端收到(`From`淘宝)消息,消费端消息处理失败,需要服务端重发,须回复`SENDACK(3)`及`FLAG`字典值时的日志
65
71
  | `tmc:onmessage:send:confirm` | 开启消费端回复接收到的(即`From`淘宝消息),发送自动确认 `send:confirm` 时的日志
66
72
 
67
73
  </details>
package/lib/consumer.js CHANGED
@@ -83,9 +83,9 @@ class TaoMessageConsumer extends EventEmitter {
83
83
  sign(timestamp) {
84
84
  const sk = this[kAppSecret].export();
85
85
  return [
86
- ['app_key', this[kAppKey]],
87
- ['group_name', this[kGroupName]],
88
- ['timestamp', `${timestamp}`],
86
+ [APP_KEY, this[kAppKey]],
87
+ [GROUP_NAME, this[kGroupName]],
88
+ [TIMESTAMP, `${timestamp}`],
89
89
  ].reduce(
90
90
  (h, [k, v]) => h.update(k).update(v),
91
91
  createHash('md5').update(sk),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmc.js",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Events driven and chained Taobao Message Channel(TMC) for NodeJS",
5
5
  "author": "James ZHANG",
6
6
  "license": "MIT",
package/types/index.d.ts CHANGED
@@ -42,10 +42,10 @@ declare interface TaoMessageConstractor extends EventEmitter {
42
42
  }
43
43
 
44
44
  declare interface TaoMessageSubscriber {
45
- [K: string]: TopicSubscriber;
45
+ [K: string]: TaoTopicSubscriber;
46
46
  }
47
47
 
48
- declare interface TopicSubscriber {
48
+ declare interface TaoTopicSubscriber {
49
49
  (fn: TaoMessageProcessor): TaoMessageConsumer;
50
50
  }
51
51
 
@@ -1707,4 +1707,21 @@ declare interface TaoEventsListener {
1707
1707
 
1708
1708
  declare const TMC: TaoMessageConsumer;
1709
1709
 
1710
+ type internalMessage = Message;
1711
+ type internalMessageFields = MessageFields;
1712
+ type internalMessageKind = MessageKind;
1713
+ type internalMessageType = MessageType;
1714
+ type internalHeaderType = HeaderType;
1715
+ type internalValueFormat = ValueFormat;
1716
+ declare namespace TMC {
1717
+ export {
1718
+ internalMessage as Message,
1719
+ internalMessageFields as MessageFields,
1720
+ internalMessageKind as MessageKind,
1721
+ internalMessageType as MessageType,
1722
+ internalHeaderType as HeaderType,
1723
+ internalValueFormat as ValueFormat,
1724
+ };
1725
+ }
1726
+
1710
1727
  export = TMC;