@zhin.js/adapter-wechat-mp 1.1.3 → 1.1.4
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/CHANGELOG.md +13 -0
- package/lib/side-event-dispatch.js +9 -10
- package/package.json +6 -6
- package/src/side-event-dispatch.ts +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @zhin.js/adapter-wechat-mp
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 43eda99: Unify Notice and Request payloads with their public types and runtime exports. Use camelCase fields, preserve native data under metadata, and bind canonical endpoint identity and request actions to the held generation. Remove legacy data aliases and from factories.
|
|
8
|
+
|
|
9
|
+
Keep login and lifecycle signals as independent SystemEvent payloads on system.receive, without chat conversation fields or user interaction. Update built-in adapter projections and authoring guidance.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [43eda99]
|
|
12
|
+
- Updated dependencies [0de4836]
|
|
13
|
+
- @zhin.js/core@1.1.39
|
|
14
|
+
- @zhin.js/adapter@1.1.15
|
|
15
|
+
|
|
3
16
|
## 1.1.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildNotice, senderFromId } from '@zhin.js/core';
|
|
1
|
+
import { composeSideEventName, sideEventConversation, buildNotice, senderFromId } from '@zhin.js/core';
|
|
2
2
|
import { formatCompact } from '@zhin.js/logger';
|
|
3
3
|
import { formatInboundId } from './protocol.js';
|
|
4
4
|
function mapWeChatMpEventParts(eventName) {
|
|
@@ -17,15 +17,14 @@ export function receiveWeChatMpSideEvent(emit, configId, msg, logger) {
|
|
|
17
17
|
const eventName = msg.Event ?? 'unknown';
|
|
18
18
|
const parts = mapWeChatMpEventParts(eventName);
|
|
19
19
|
void emit('notice.receive', buildNotice(msg, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
$timestamp: msg.CreateTime ?? Date.now(),
|
|
20
|
+
id: `wechat-mp:${formatInboundId(msg)}`,
|
|
21
|
+
clientAdapter: 'wechat-mp',
|
|
22
|
+
endpointId: configId,
|
|
23
|
+
type: 'notice',
|
|
24
|
+
conversation: sideEventConversation('private', msg.FromUserName),
|
|
25
|
+
name: composeSideEventName('notice', parts.scene_type, parts.sub_type),
|
|
26
|
+
actor: senderFromId(msg.FromUserName),
|
|
27
|
+
timestamp: Number.isFinite(msg.CreateTime) && msg.CreateTime > 0 ? msg.CreateTime * 1000 : Date.now(),
|
|
29
28
|
})).catch((err) => {
|
|
30
29
|
logger.warn(formatCompact({
|
|
31
30
|
op: 'wechat_mp_side_event_failed',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-wechat-mp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Zhin.js WeChat Official Account adapter for Plugin Runtime (HTTP webhook)",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"axios": "^1.19.0",
|
|
10
10
|
"xml2js": "^0.6.2",
|
|
11
11
|
"@zhin.js/adapter": "1.1.15",
|
|
12
|
-
"@zhin.js/core": "1.1.
|
|
12
|
+
"@zhin.js/core": "1.1.39",
|
|
13
13
|
"@zhin.js/feature-kit": "1.1.2",
|
|
14
14
|
"@zhin.js/host-http": "1.1.2",
|
|
15
15
|
"@zhin.js/im-contract": "1.1.2",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@zhin.js/adapter": "^1.1.15",
|
|
21
|
-
"@zhin.js/command": "^1.1.
|
|
22
|
-
"@zhin.js/core": "^1.1.
|
|
21
|
+
"@zhin.js/command": "^1.1.3",
|
|
22
|
+
"@zhin.js/core": "^1.1.39",
|
|
23
23
|
"@zhin.js/host-http": "^1.1.2",
|
|
24
|
-
"zhin.js": "^1.1.
|
|
24
|
+
"zhin.js": "^1.1.4"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
27
27
|
"@zhin.js/command": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/xml2js": "^0.4.14",
|
|
37
37
|
"typescript": "^6.0.3",
|
|
38
38
|
"vitest": "^4.1.10",
|
|
39
|
-
"zhin.js": "1.1.
|
|
39
|
+
"zhin.js": "1.1.4"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"zhin",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildNotice, senderFromId } from '@zhin.js/core';
|
|
1
|
+
import { composeSideEventName, sideEventConversation, buildNotice, senderFromId } from '@zhin.js/core';
|
|
2
2
|
import type { EndpointEventEmitter } from 'zhin.js/adapter';
|
|
3
3
|
import { formatCompact, type getAdapterLogger } from '@zhin.js/logger';
|
|
4
4
|
import { formatInboundId, type WeChatMessage } from './protocol.js';
|
|
@@ -24,15 +24,14 @@ export function receiveWeChatMpSideEvent(
|
|
|
24
24
|
const eventName = msg.Event ?? 'unknown';
|
|
25
25
|
const parts = mapWeChatMpEventParts(eventName);
|
|
26
26
|
void emit('notice.receive', buildNotice(msg, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
$timestamp: msg.CreateTime ?? Date.now(),
|
|
27
|
+
id: `wechat-mp:${formatInboundId(msg)}`,
|
|
28
|
+
clientAdapter: 'wechat-mp',
|
|
29
|
+
endpointId: configId,
|
|
30
|
+
type: 'notice',
|
|
31
|
+
conversation: sideEventConversation('private', msg.FromUserName),
|
|
32
|
+
name: composeSideEventName('notice', parts.scene_type, parts.sub_type),
|
|
33
|
+
actor: senderFromId(msg.FromUserName),
|
|
34
|
+
timestamp: Number.isFinite(msg.CreateTime) && msg.CreateTime > 0 ? msg.CreateTime * 1000 : Date.now(),
|
|
36
35
|
})).catch((err) => {
|
|
37
36
|
logger.warn(formatCompact({
|
|
38
37
|
op: 'wechat_mp_side_event_failed',
|