@domain.js/main 0.3.19 → 0.3.22
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.
|
@@ -24,6 +24,16 @@ export interface ModelSort<Fields extends string> {
|
|
|
24
24
|
allow: Fields[];
|
|
25
25
|
defaultDirection?: "DESC" | "ASC";
|
|
26
26
|
}
|
|
27
|
+
/** Model 上的 stats 设定类型 */
|
|
28
|
+
export interface ModelStats<Fields extends string> {
|
|
29
|
+
dimensions?: Record<string, Fields>;
|
|
30
|
+
metrics: Record<string, string>;
|
|
31
|
+
pagination?: {
|
|
32
|
+
maxResults: number;
|
|
33
|
+
maxStartIndex: number;
|
|
34
|
+
maxResultsLimit: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
27
37
|
/**
|
|
28
38
|
* Model 基类
|
|
29
39
|
*/
|
package/dist/http/defines.d.ts
CHANGED
package/dist/http/socket.js
CHANGED
|
@@ -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
|
}
|
package/dist/http/utils.js
CHANGED
|
@@ -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
|
};
|
|
@@ -121,6 +122,8 @@ function Utils(cnf) {
|
|
|
121
122
|
if (params[k] && lodash_1.default.isString(params[k]))
|
|
122
123
|
params[k] = params[k].split(",");
|
|
123
124
|
}
|
|
125
|
+
if (params.__files)
|
|
126
|
+
throw Error("Params.__files disallow assignment");
|
|
124
127
|
if (lodash_1.default.size(req.files))
|
|
125
128
|
params.__files = req.files;
|
|
126
129
|
return params;
|