equipped 4.1.20 → 4.1.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.
- package/CHANGELOG.md +15 -0
- package/lib/db/mongoose/query.js +5 -7
- package/lib/logger/index.js +4 -4
- package/lib/validations/index.d.ts +8 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.1.22](https://github.com/kevinand11/equipped/compare/v4.1.21...v4.1.22) (2023-08-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* don't return db error from querying ([49642bd](https://github.com/kevinand11/equipped/commit/49642bdd9791753586bcee017c9bdea46c520907))
|
|
11
|
+
* remove space in logger ([12eddb8](https://github.com/kevinand11/equipped/commit/12eddb855f71bfe8ad335889bb5df2047e1cf6c8))
|
|
12
|
+
|
|
13
|
+
### [4.1.21](https://github.com/kevinand11/equipped/compare/v4.1.20...v4.1.21) (2023-08-16)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* logger time ([14c1bd3](https://github.com/kevinand11/equipped/commit/14c1bd350739b5cba68d8f23183301861d6aa5ee))
|
|
19
|
+
|
|
5
20
|
### [4.1.20](https://github.com/kevinand11/equipped/compare/v4.1.19...v4.1.20) (2023-08-13)
|
|
6
21
|
|
|
7
22
|
### [4.1.19](https://github.com/kevinand11/equipped/compare/v4.1.18...v4.1.19) (2023-08-13)
|
package/lib/db/mongoose/query.js
CHANGED
|
@@ -39,18 +39,16 @@ const parseMongodbQueryParams = async (model, params) => {
|
|
|
39
39
|
if (page)
|
|
40
40
|
builtQuery = builtQuery.skip((page - 1) * limit);
|
|
41
41
|
}
|
|
42
|
-
const results = await builtQuery
|
|
42
|
+
const results = await builtQuery.catch(() => {
|
|
43
|
+
throw new Error('Error querying database');
|
|
44
|
+
});
|
|
43
45
|
const start = 1;
|
|
44
46
|
const last = Math.ceil(total / limit) || 1;
|
|
45
47
|
const next = page >= last ? null : page + 1;
|
|
46
48
|
const previous = page <= start ? null : page - 1;
|
|
47
49
|
return {
|
|
48
|
-
pages: {
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
docs: {
|
|
52
|
-
limit, total, count: results.length
|
|
53
|
-
},
|
|
50
|
+
pages: { start, last, next, previous, current: page },
|
|
51
|
+
docs: { limit, total, count: results.length },
|
|
54
52
|
results: results
|
|
55
53
|
};
|
|
56
54
|
};
|
package/lib/logger/index.js
CHANGED
|
@@ -21,16 +21,16 @@ class ConsoleLogger extends Logger {
|
|
|
21
21
|
_ConsoleLogger_log.set(this, console.log);
|
|
22
22
|
}
|
|
23
23
|
async error(...args) {
|
|
24
|
-
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.red(`[ERROR] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}
|
|
24
|
+
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.red(`[ERROR] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}`, ...args));
|
|
25
25
|
}
|
|
26
26
|
async success(...args) {
|
|
27
|
-
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.greenBright(`[SUCCESS] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}
|
|
27
|
+
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.greenBright(`[SUCCESS] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}`, ...args));
|
|
28
28
|
}
|
|
29
29
|
async info(...args) {
|
|
30
|
-
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.blueBright(`[INFO] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}
|
|
30
|
+
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.blueBright(`[INFO] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}`, ...args));
|
|
31
31
|
}
|
|
32
32
|
async warn(...args) {
|
|
33
|
-
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.yellow(`[WARNING] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}
|
|
33
|
+
__classPrivateFieldGet(this, _ConsoleLogger_log, "f").call(this, chalk_1.default.yellow(`[WARNING] ${__classPrivateFieldGet(this, _ConsoleLogger_instances, "m", _ConsoleLogger_getTime).call(this)}`, ...args));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.ConsoleLogger = ConsoleLogger;
|
|
@@ -122,27 +122,28 @@ export declare const Validation: {
|
|
|
122
122
|
getPercentage: (num: number, den: number) => number;
|
|
123
123
|
getRandomSample: <Type_9>(population: Type_9[], n: number) => Type_9[];
|
|
124
124
|
shuffleArray: <Type_10>(array: Type_10[]) => Type_10[];
|
|
125
|
+
chunkArray: <T_13>(arr: T_13[], size: number) => T_13[][];
|
|
125
126
|
Geohash: typeof Validate.Geohash;
|
|
126
|
-
isValid: <
|
|
127
|
+
isValid: <T_14>(value: T_14) => {
|
|
127
128
|
valid: true;
|
|
128
129
|
errors: string[];
|
|
129
|
-
value:
|
|
130
|
+
value: T_14;
|
|
130
131
|
};
|
|
131
|
-
isInvalid: <
|
|
132
|
+
isInvalid: <T_15>(errors: string[], value: T_15) => {
|
|
132
133
|
valid: false;
|
|
133
134
|
errors: string[];
|
|
134
135
|
value: unknown;
|
|
135
136
|
};
|
|
136
|
-
makeRule: <
|
|
137
|
-
makeSanitizer: <
|
|
138
|
-
check: <
|
|
137
|
+
makeRule: <T_16>(func: Validate.Rule<T_16>) => Validate.Rule<T_16>;
|
|
138
|
+
makeSanitizer: <T_17>(func: Validate.Sanitizer<T_17>) => (val: T_17) => T_17;
|
|
139
|
+
check: <T_18>(value: T_18, rules: Validate.Rule<T_18>[], options?: Partial<Validate.Options> | undefined) => {
|
|
139
140
|
valid: false;
|
|
140
141
|
errors: string[];
|
|
141
142
|
value: unknown;
|
|
142
143
|
} | {
|
|
143
144
|
valid: true;
|
|
144
145
|
errors: string[];
|
|
145
|
-
value:
|
|
146
|
+
value: T_18;
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
149
|
export declare const validate: <T extends Record<string, Validate.VCore<any>>>(schema: T, value: Record<string, any>) => { [K in keyof T]: import("valleyed/lib/api/base").ExtractI<T[K]>; };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "equipped",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.22",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@types/express-fileupload": "^1.4.1",
|
|
26
26
|
"@types/jsonwebtoken": "^9.0.2",
|
|
27
27
|
"@types/morgan": "^1.9.4",
|
|
28
|
-
"@types/node": "^20.
|
|
28
|
+
"@types/node": "^20.5.0",
|
|
29
29
|
"@types/pug": "^2.0.6",
|
|
30
30
|
"@types/supertest": "^2.0.12",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
32
|
-
"@typescript-eslint/parser": "^6.
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
32
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
33
33
|
"eslint": "^8.47.0",
|
|
34
34
|
"eslint-plugin-promise": "^6.1.1",
|
|
35
35
|
"husky": "^8.0.3",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"redis": "^4.6.7",
|
|
67
67
|
"socket.io": "4.7.2",
|
|
68
68
|
"supertest": "^6.3.3",
|
|
69
|
-
"valleyed": "4.1
|
|
69
|
+
"valleyed": "4.2.1"
|
|
70
70
|
},
|
|
71
71
|
"repository": {
|
|
72
72
|
"url": "git://github.com/kevinand11/equipped.git"
|