@domain.js/main 0.3.6 → 0.3.9

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.
@@ -1,6 +1,6 @@
1
1
  import axios, { AxiosInstance } from "axios";
2
- import { Main as Logger } from "../logger";
3
2
  import * as utils from "../../utils";
3
+ import { Main as Logger } from "../logger";
4
4
  interface Cnf {
5
5
  /** axios config */
6
6
  axios?: {
@@ -80,7 +80,7 @@ function Main(cnf, deps, utils) {
80
80
  Object.assign(model, attr);
81
81
  return model.save();
82
82
  };
83
- const TRASH_OPT = Object.freeze({ fields: ["isDeleted", "deletorId"] });
83
+ const TRASH_OPT = Object.freeze({ fields: ["isDeleted", "deletorId", "deletedAt"] });
84
84
  /**
85
85
  * Restful remove (D of CRUD) for delete a resource
86
86
  * @param model the resources will be removed
@@ -94,6 +94,7 @@ function Main(cnf, deps, utils) {
94
94
  // 这里不做字段是否存在的判断,无所谓
95
95
  model.deletorId = deletorId;
96
96
  model.isDeleted = "yes";
97
+ model.deletedAt = new Date();
97
98
  // 丢进垃圾桶
98
99
  return model.save(TRASH_OPT);
99
100
  };
@@ -68,15 +68,15 @@ const makeProfile = (client, type = "user", auth, extra = {}) => {
68
68
  return obj;
69
69
  };
70
70
  function BridgeSocket(io, domain) {
71
- const { method: subscribe } = domain["message.subscribe"];
72
- const { method: unsubscribe } = domain["message.unsubscribe"];
73
- const { method: entrance } = domain["message.entrance"];
71
+ const { method: subscribe } = domain["socket.subscribe"];
72
+ const { method: unsubscribe } = domain["socket.unsubscribe"];
73
+ const { method: entrance } = domain["socket.entrance"];
74
74
  if (!subscribe)
75
- throw Error("要启用 socket 服务,必须要要有 message.subscribe 方法,用来处理 socket 订阅");
75
+ throw Error("要启用 socket 服务,必须要要有 socket.subscribe 方法,用来处理 socket 订阅");
76
76
  if (!unsubscribe)
77
- throw Error("要启用 socket 服务,必须要要有 message.unsubscribe 方法,用来处理 socket 退订");
77
+ throw Error("要启用 socket 服务,必须要要有 socket.unsubscribe 方法,用来处理 socket 退订");
78
78
  if (!entrance)
79
- throw Error("要启用 socket 服务,必须要要有 message.entrance 方法,用来处理 加入某个房间");
79
+ throw Error("要启用 socket 服务,必须要要有 socket.entrance 方法,用来处理 加入某个房间");
80
80
  io.on("connection", (client) => {
81
81
  // 定义toJSON 避免 schema 验证报错
82
82
  Object.assign(client, {
@@ -17,6 +17,6 @@ export interface ParamsSchema<Params extends {}, Keys extends string | number |
17
17
  /** 当前参数的描述信息 */
18
18
  description: string;
19
19
  /** 当前参数的类型 */
20
- type: "string" | "number" | "integer" | "object" | "array";
20
+ type: "string" | "number" | "integer" | "object" | "array" | "boolean";
21
21
  }>;
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.3.6",
3
+ "version": "0.3.9",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {