not-node 6.2.22 → 6.2.24
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/package.json +1 -1
- package/src/cluster/cluster.redis.js +3 -0
- package/src/cluster/index.js +7 -2
- package/src/common.js +7 -9
- package/src/generic/logic.js +4 -4
package/package.json
CHANGED
|
@@ -2,6 +2,9 @@ const notEnv = require("../env.js");
|
|
|
2
2
|
const notCommon = require("../common");
|
|
3
3
|
const { error } = require("not-log")(module, "ClusterRedis");
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Cluster event bus driver upon Redis events
|
|
7
|
+
*/
|
|
5
8
|
module.exports = class notClusterRedisProvider {
|
|
6
9
|
static #clientGetter = null;
|
|
7
10
|
static #clientName = "db.redis";
|
package/src/cluster/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const { log } = require("not-log")(module, "notCluster");
|
|
2
2
|
const notClusterRedis = require("./cluster.redis.js");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Interface to event bus of cluster
|
|
6
|
+
*/
|
|
7
|
+
class notCluster {
|
|
5
8
|
static #provider = notClusterRedis;
|
|
6
9
|
|
|
7
10
|
static setProvider(newProvider) {
|
|
@@ -22,4 +25,6 @@ module.exports = class notCluster {
|
|
|
22
25
|
static emit() {
|
|
23
26
|
return this.#provider.emit(...arguments);
|
|
24
27
|
}
|
|
25
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = notCluster;
|
package/src/common.js
CHANGED
|
@@ -210,15 +210,13 @@ module.exports.tryFile = (filePath) => {
|
|
|
210
210
|
* @param {string} filePath full path to file
|
|
211
211
|
* @return {Promise<boolean>} true if path exists and it's a file
|
|
212
212
|
**/
|
|
213
|
-
module.exports.tryFileAsync = (filePath) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
});
|
|
213
|
+
module.exports.tryFileAsync = async (filePath) => {
|
|
214
|
+
try {
|
|
215
|
+
const stat = await fs.promises.lstat(filePath);
|
|
216
|
+
return stat && stat.isFile();
|
|
217
|
+
} catch (e) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
222
220
|
};
|
|
223
221
|
|
|
224
222
|
/**
|
package/src/generic/logic.js
CHANGED
|
@@ -245,7 +245,7 @@ module.exports = ({
|
|
|
245
245
|
if (shouldOwn) {
|
|
246
246
|
query[ownerFieldName] = activeUser?._id;
|
|
247
247
|
}
|
|
248
|
-
let populate = getPopulate(action, {
|
|
248
|
+
let populate = await getPopulate(action, {
|
|
249
249
|
targetId,
|
|
250
250
|
activeUser,
|
|
251
251
|
ip,
|
|
@@ -335,7 +335,7 @@ module.exports = ({
|
|
|
335
335
|
if (shouldOwn) {
|
|
336
336
|
query[ownerFieldName] = activeUser?._id;
|
|
337
337
|
}
|
|
338
|
-
let populate = getPopulate(action, {
|
|
338
|
+
let populate = await getPopulate(action, {
|
|
339
339
|
targetID,
|
|
340
340
|
activeUser,
|
|
341
341
|
ip,
|
|
@@ -664,7 +664,7 @@ module.exports = ({
|
|
|
664
664
|
root
|
|
665
665
|
);
|
|
666
666
|
const { skip, size, sorter, filter, search } = query;
|
|
667
|
-
let populate = getPopulate(action, {
|
|
667
|
+
let populate = await getPopulate(action, {
|
|
668
668
|
activeUser,
|
|
669
669
|
ip,
|
|
670
670
|
});
|
|
@@ -728,7 +728,7 @@ module.exports = ({
|
|
|
728
728
|
root
|
|
729
729
|
);
|
|
730
730
|
const { skip, size, sorter, filter } = query;
|
|
731
|
-
let populate = getPopulate(action, {
|
|
731
|
+
let populate = await getPopulate(action, {
|
|
732
732
|
activeUser,
|
|
733
733
|
ip,
|
|
734
734
|
});
|