equipped 4.2.5 → 4.2.7

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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.2.7](https://github.com/kevinand11/equipped/compare/v4.2.6...v4.2.7) (2023-12-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * params.map ([fdc2ffc](https://github.com/kevinand11/equipped/commit/fdc2ffcfac6bfbda63fdd11c1585a98f85533e0c))
11
+
12
+ ### [4.2.6](https://github.com/kevinand11/equipped/compare/v4.2.5...v4.2.6) (2023-11-27)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * base entities need to include getters in toJSON ([1a3848d](https://github.com/kevinand11/equipped/commit/1a3848d6c7b64b255183f9ee12d19a080231c645))
18
+
5
19
  ### [4.2.5](https://github.com/kevinand11/equipped/compare/v4.2.4...v4.2.5) (2023-11-21)
6
20
 
7
21
  ### [4.2.4](https://github.com/kevinand11/equipped/compare/v4.2.3...v4.2.4) (2023-11-12)
@@ -56,7 +56,7 @@ const parseMongodbQueryParams = async (model, params) => {
56
56
  };
57
57
  exports.parseMongodbQueryParams = parseMongodbQueryParams;
58
58
  const buildWhereQuery = (params, key = query_1.QueryKeys.and) => {
59
- const where = params.map((param) => {
59
+ const where = (Array.isArray(params) ? params : []).map((param) => {
60
60
  if (Object.values(query_1.QueryKeys).includes(param.condition))
61
61
  return buildWhereQuery(param.value, param.condition);
62
62
  const { field } = param;
@@ -3,5 +3,5 @@ export declare class BaseEntity {
3
3
  ignoreInJSON: string[];
4
4
  __type: string;
5
5
  constructor();
6
- toJSON(): Record<string, any>;
6
+ toJSON(): this;
7
7
  }
@@ -18,6 +18,13 @@ class BaseEntity {
18
18
  }
19
19
  toJSON() {
20
20
  const json = Object.assign({}, this);
21
+ const proto = Object.getPrototypeOf(this);
22
+ Object.getOwnPropertyNames(proto)
23
+ .filter((k) => k !== 'constructor')
24
+ .forEach((key) => {
25
+ const value = this[key];
26
+ json[key] = value?.toJSON?.() ?? value;
27
+ });
21
28
  this.ignoreInJSON.forEach((k) => deleteKeyFromObject(json, k.split('.').reverse()));
22
29
  delete json.ignoreInJSON;
23
30
  return json;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "equipped",
3
- "version": "4.2.5",
3
+ "version": "4.2.7",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -25,16 +25,16 @@
25
25
  "@types/express-fileupload": "^1.4.4",
26
26
  "@types/jsonwebtoken": "^9.0.5",
27
27
  "@types/morgan": "^1.9.9",
28
- "@types/node": "^20.9.3",
28
+ "@types/node": "^20.10.4",
29
29
  "@types/pug": "^2.0.10",
30
30
  "@types/supertest": "^2.0.16",
31
- "@typescript-eslint/eslint-plugin": "^6.12.0",
32
- "@typescript-eslint/parser": "^6.12.0",
33
- "eslint": "^8.54.0",
31
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
32
+ "@typescript-eslint/parser": "^6.14.0",
33
+ "eslint": "^8.55.0",
34
34
  "eslint-plugin-promise": "^6.1.1",
35
35
  "husky": "^8.0.3",
36
36
  "standard-version": "^9.5.0",
37
- "typescript": "^5.3.2"
37
+ "typescript": "^5.3.3"
38
38
  },
39
39
  "dependencies": {
40
40
  "amqp-connection-manager": "^4.1.14",
@@ -49,13 +49,13 @@
49
49
  "dotenv": "^16.3.1",
50
50
  "express": "^4.18.2",
51
51
  "express-fileupload": "^1.4.3",
52
- "express-rate-limit": "^7.1.4",
52
+ "express-rate-limit": "^7.1.5",
53
53
  "express-slow-down": "^2.0.1",
54
54
  "helmet": "^7.1.0",
55
55
  "jsonwebtoken": "^9.0.2",
56
56
  "jwks-rsa": "^3.1.0",
57
57
  "kafkajs": "^2.2.4",
58
- "mongoose": "^8.0.1",
58
+ "mongoose": "^8.0.3",
59
59
  "mongoose-lean-defaults": "^2.2.1",
60
60
  "mongoose-lean-getters": "^1.1.0",
61
61
  "mongoose-lean-virtuals": "^0.9.1",