equipped 4.3.0 → 4.3.2
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 +4 -0
- package/lib/db/_instance.d.ts +2 -2
- package/lib/db/mongoose/changes.d.ts +1 -1
- package/lib/db/mongoose/index.d.ts +1 -1
- package/lib/listeners/emitter.d.ts +3 -3
- package/lib/structure/baseEntity.d.ts +5 -3
- package/lib/structure/baseEntity.js +11 -12
- package/lib/validations/index.d.ts +1 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.3.2](https://github.com/kevinand11/equipped/compare/v4.3.1...v4.3.2) (2024-02-21)
|
|
6
|
+
|
|
7
|
+
### [4.3.1](https://github.com/kevinand11/equipped/compare/v4.3.0...v4.3.1) (2024-02-17)
|
|
8
|
+
|
|
5
9
|
## [4.3.0](https://github.com/kevinand11/equipped/compare/v4.2.10...v4.3.0) (2024-02-12)
|
|
6
10
|
|
|
7
11
|
|
package/lib/db/_instance.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { DebeziumSetup } from './debezium';
|
|
|
3
3
|
import { QueryParams, QueryResults } from './query';
|
|
4
4
|
export declare abstract class Db {
|
|
5
5
|
#private;
|
|
6
|
-
abstract change<Model, Entity extends BaseEntity
|
|
6
|
+
abstract change<Model, Entity extends BaseEntity<any>>(collection: any, callbacks: DbChangeCallbacks<Model, Entity>, mapper: (model: Model | null) => Entity | null): DbChange<Model, Entity>;
|
|
7
7
|
abstract query<Model>(collection: any, params: QueryParams): Promise<QueryResults<Model>>;
|
|
8
8
|
protected _addToDbChanges(dbChange: DbChange<any, any>): this;
|
|
9
9
|
startAllDbChanges(): Promise<void>;
|
|
10
10
|
abstract start(): Promise<void>;
|
|
11
11
|
abstract close(): Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
export declare abstract class DbChange<Model, Entity extends BaseEntity
|
|
13
|
+
export declare abstract class DbChange<Model, Entity extends BaseEntity<any>> {
|
|
14
14
|
#private;
|
|
15
15
|
constructor(callbacks: DbChangeCallbacks<Model, Entity>, mapper: (model: Model | null) => Entity | null);
|
|
16
16
|
abstract start(): Promise<void>;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
26
|
import { BaseEntity } from '../../structure';
|
|
27
27
|
import { DbChange, DbChangeCallbacks } from '../_instance';
|
|
28
|
-
export declare class MongoDbChange<Model, Entity extends BaseEntity
|
|
28
|
+
export declare class MongoDbChange<Model, Entity extends BaseEntity<any>> extends DbChange<Model, Entity> {
|
|
29
29
|
#private;
|
|
30
30
|
constructor(model: mongoose.Model<Model>, callbacks: DbChangeCallbacks<Model, Entity>, mapper: (model: Model | null) => Entity | null);
|
|
31
31
|
start(): Promise<void>;
|
|
@@ -32,7 +32,7 @@ export declare class MongoDb extends Db {
|
|
|
32
32
|
get Schema(): typeof mongoose.Schema;
|
|
33
33
|
get Id(): mongoose.Types.ObjectId;
|
|
34
34
|
use(dbName?: string): mongoose.Connection;
|
|
35
|
-
change<Model, Entity extends BaseEntity
|
|
35
|
+
change<Model, Entity extends BaseEntity<any>>(model: mongoose.Model<Model>, callbacks: DbChangeCallbacks<Model, Entity>, mapper: (model: Model | null) => Entity | null): MongoDbChange<Model, Entity>;
|
|
36
36
|
query<Model>(model: mongoose.Model<Model>, params: QueryParams): Promise<QueryResults<Model>>;
|
|
37
37
|
start(): Promise<void>;
|
|
38
38
|
close(): Promise<void>;
|
|
@@ -13,9 +13,9 @@ export declare class Listener {
|
|
|
13
13
|
#private;
|
|
14
14
|
constructor(socket: io.Server, callers: SocketCallers);
|
|
15
15
|
start(): Promise<void>;
|
|
16
|
-
created(channels: string[], data: BaseEntity): Promise<void>;
|
|
17
|
-
updated(channels: string[], data: BaseEntity): Promise<void>;
|
|
18
|
-
deleted(channels: string[], data: BaseEntity): Promise<void>;
|
|
16
|
+
created(channels: string[], data: BaseEntity<any>): Promise<void>;
|
|
17
|
+
updated(channels: string[], data: BaseEntity<any>): Promise<void>;
|
|
18
|
+
deleted(channels: string[], data: BaseEntity<any>): Promise<void>;
|
|
19
19
|
set callers(callers: SocketCallers);
|
|
20
20
|
register(channel: string, onJoin?: OnJoinFn): this;
|
|
21
21
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassPropertiesWrapper } from 'valleyed';
|
|
2
|
+
export declare class BaseEntity<Keys extends Record<string, any>> extends ClassPropertiesWrapper<Keys> {
|
|
2
3
|
hash: string;
|
|
3
4
|
ignoreInJSON: string[];
|
|
4
5
|
__type: string;
|
|
5
|
-
constructor();
|
|
6
|
-
toJSON():
|
|
6
|
+
constructor(keys: Keys);
|
|
7
|
+
toJSON(includeIgnored?: boolean): Record<string, any>;
|
|
8
|
+
toString(): string;
|
|
7
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseEntity = void 0;
|
|
4
|
+
const valleyed_1 = require("valleyed");
|
|
4
5
|
const utils_1 = require("../utils/utils");
|
|
5
6
|
const deleteKeyFromObject = (obj, keys) => {
|
|
6
7
|
if (obj === undefined || obj === null)
|
|
@@ -10,24 +11,22 @@ const deleteKeyFromObject = (obj, keys) => {
|
|
|
10
11
|
const key = keys.pop() ?? '';
|
|
11
12
|
return deleteKeyFromObject(obj[key], keys);
|
|
12
13
|
};
|
|
13
|
-
class BaseEntity {
|
|
14
|
-
constructor() {
|
|
14
|
+
class BaseEntity extends valleyed_1.ClassPropertiesWrapper {
|
|
15
|
+
constructor(keys) {
|
|
16
|
+
super(keys);
|
|
15
17
|
this.ignoreInJSON = [];
|
|
16
18
|
this.__type = this.constructor.name;
|
|
17
19
|
this.hash = utils_1.Random.string();
|
|
18
20
|
}
|
|
19
|
-
toJSON() {
|
|
20
|
-
const json =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.filter((k) => k !== 'constructor')
|
|
24
|
-
.forEach((key) => {
|
|
25
|
-
const value = this[key];
|
|
26
|
-
json[key] = value?.toJSON?.() ?? value;
|
|
27
|
-
});
|
|
28
|
-
this.ignoreInJSON.forEach((k) => deleteKeyFromObject(json, k.split('.').reverse()));
|
|
21
|
+
toJSON(includeIgnored = false) {
|
|
22
|
+
const json = super.toJSON();
|
|
23
|
+
if (!includeIgnored)
|
|
24
|
+
this.ignoreInJSON.forEach((k) => deleteKeyFromObject(json, k.split('.').reverse()));
|
|
29
25
|
delete json.ignoreInJSON;
|
|
30
26
|
return json;
|
|
31
27
|
}
|
|
28
|
+
toString() {
|
|
29
|
+
return JSON.stringify(this.toJSON(true));
|
|
30
|
+
}
|
|
32
31
|
}
|
|
33
32
|
exports.BaseEntity = BaseEntity;
|
|
@@ -103,6 +103,7 @@ export declare const Validation: {
|
|
|
103
103
|
isTime: <T_9 extends Validate.Timeable>(error?: string | undefined) => Validate.Rule<T_9>;
|
|
104
104
|
isLaterThan: <T_10 extends Validate.Timeable>(compare: Validate.Timeable, error?: string | undefined) => Validate.Rule<T_10>;
|
|
105
105
|
isEarlierThan: <T_11 extends Validate.Timeable>(compare: Validate.Timeable, error?: string | undefined) => Validate.Rule<T_11>;
|
|
106
|
+
ClassPropertiesWrapper: typeof Validate.ClassPropertiesWrapper;
|
|
106
107
|
Differ: typeof Validate.Differ;
|
|
107
108
|
capitalize: (text: string) => string;
|
|
108
109
|
stripHTML: (html: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "equipped",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@commitlint/cli": "^18.6.
|
|
19
|
-
"@commitlint/config-conventional": "^18.6.
|
|
18
|
+
"@commitlint/cli": "^18.6.1",
|
|
19
|
+
"@commitlint/config-conventional": "^18.6.2",
|
|
20
20
|
"@types/amqplib": "^0.10.4",
|
|
21
21
|
"@types/bcryptjs": "^2.4.6",
|
|
22
22
|
"@types/bull": "^3.15.9",
|
|
@@ -25,14 +25,14 @@
|
|
|
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.11.
|
|
28
|
+
"@types/node": "^20.11.19",
|
|
29
29
|
"@types/pug": "^2.0.10",
|
|
30
30
|
"@types/supertest": "^6.0.2",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
32
|
-
"@typescript-eslint/parser": "^
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
32
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
33
33
|
"eslint": "^8.56.0",
|
|
34
34
|
"eslint-plugin-promise": "^6.1.1",
|
|
35
|
-
"husky": "^9.0.
|
|
35
|
+
"husky": "^9.0.11",
|
|
36
36
|
"standard-version": "^9.5.0",
|
|
37
37
|
"typescript": "^5.3.3"
|
|
38
38
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"compression": "^1.7.4",
|
|
47
47
|
"cookie-parser": "^1.4.6",
|
|
48
48
|
"cors": "^2.8.5",
|
|
49
|
-
"dotenv": "^16.4.
|
|
49
|
+
"dotenv": "^16.4.4",
|
|
50
50
|
"express": "^4.18.2",
|
|
51
51
|
"express-fileupload": "^1.4.3",
|
|
52
52
|
"express-rate-limit": "^7.1.5",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"jsonwebtoken": "^9.0.2",
|
|
56
56
|
"jwks-rsa": "^3.1.0",
|
|
57
57
|
"kafkajs": "^2.2.4",
|
|
58
|
-
"mongoose": "^8.1.
|
|
58
|
+
"mongoose": "^8.1.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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"redis": "^4.6.13",
|
|
67
67
|
"socket.io": "4.7.4",
|
|
68
68
|
"supertest": "^6.3.4",
|
|
69
|
-
"valleyed": "4.2.
|
|
69
|
+
"valleyed": "4.2.7"
|
|
70
70
|
},
|
|
71
71
|
"repository": {
|
|
72
72
|
"url": "git://github.com/kevinand11/equipped.git"
|