equipped 4.1.21 → 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 +8 -0
- package/lib/db/mongoose/query.js +5 -7
- package/lib/logger/index.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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
|
+
|
|
5
13
|
### [4.1.21](https://github.com/kevinand11/equipped/compare/v4.1.20...v4.1.21) (2023-08-16)
|
|
6
14
|
|
|
7
15
|
|
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;
|