@domain.js/main 0.3.19 → 0.3.20

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.
@@ -15,6 +15,7 @@ export interface Profile {
15
15
  userAgent: string;
16
16
  startedAt: Date;
17
17
  requestId: string;
18
+ method: string;
18
19
  /** 用户类型,例如 user, worker */
19
20
  type: string;
20
21
  /** 自由挂载信息的节点 */
@@ -42,6 +42,7 @@ const makeProfile = (client, type = "user", auth, extra = {}) => {
42
42
  clientIp: utils.clientIp(client),
43
43
  remoteIp: utils.remoteIp(client),
44
44
  realIp: utils.realIp(client),
45
+ method: "None",
45
46
  isSocket: true,
46
47
  startedAt: new Date(),
47
48
  userAgent: client.handshake.headers["user-agent"] || "Not captured",
@@ -140,7 +141,7 @@ function BridgeSocket(io, domain) {
140
141
  throw new MyError("notFound", "不存在该领域方法");
141
142
  if (!client.profile)
142
143
  throw new MyError("noAuth", "请先执行 init");
143
- const res = await method(client.profile, params);
144
+ const res = await method({ ...client.profile, method: name }, params);
144
145
  if (responseId) {
145
146
  client.emit("response", responseId, res);
146
147
  }
@@ -71,6 +71,7 @@ function Utils(cnf) {
71
71
  userAgent: req.userAgent(),
72
72
  startedAt: new Date(),
73
73
  requestId: req.id(),
74
+ method,
74
75
  type: "user",
75
76
  extra: {},
76
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {