oak-domain 5.0.10 → 5.0.11
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/lib/timers/oper.js +20 -13
- package/lib/utils/uuid.js +7 -7
- package/package.json +1 -1
package/lib/timers/oper.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaccumOper = void 0;
|
|
4
|
+
const Entity_1 = require("../types/Entity");
|
|
4
5
|
const vaccum_1 = require("./vaccum");
|
|
5
6
|
const filter_1 = require("../store/filter");
|
|
6
7
|
/**
|
|
@@ -11,9 +12,14 @@ const filter_1 = require("../store/filter");
|
|
|
11
12
|
*/
|
|
12
13
|
async function vaccumOper(option, context) {
|
|
13
14
|
const { aliveLine, excludeOpers, ...rest } = option;
|
|
14
|
-
const
|
|
15
|
+
const notFilters = [
|
|
16
|
+
{
|
|
17
|
+
[Entity_1.TriggerUuidAttribute]: {
|
|
18
|
+
$exists: false,
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
];
|
|
15
22
|
if (excludeOpers) {
|
|
16
|
-
const notFilters = [];
|
|
17
23
|
for (const key in excludeOpers) {
|
|
18
24
|
if (excludeOpers[key].length > 0) {
|
|
19
25
|
notFilters.push({
|
|
@@ -29,27 +35,28 @@ async function vaccumOper(option, context) {
|
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
|
-
if (notFilters.length > 0) {
|
|
33
|
-
operFilter.$not = {
|
|
34
|
-
$or: notFilters,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
38
|
}
|
|
38
39
|
return (0, vaccum_1.vaccumEntities)({
|
|
39
40
|
entities: [{
|
|
40
41
|
entity: 'operEntity',
|
|
41
42
|
aliveLine: aliveLine + 10000,
|
|
42
43
|
filter: {
|
|
43
|
-
oper:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
oper: {
|
|
45
|
+
$$createAt$$: {
|
|
46
|
+
$lt: aliveLine,
|
|
47
|
+
},
|
|
48
|
+
$not: (0, filter_1.combineFilters)('oper', context.getSchema(), notFilters),
|
|
49
|
+
},
|
|
48
50
|
},
|
|
49
51
|
}, {
|
|
50
52
|
entity: 'oper',
|
|
51
53
|
aliveLine,
|
|
52
|
-
filter:
|
|
54
|
+
filter: {
|
|
55
|
+
$$createAt$$: {
|
|
56
|
+
$lt: aliveLine,
|
|
57
|
+
},
|
|
58
|
+
$not: (0, filter_1.combineFilters)('oper', context.getSchema(), notFilters),
|
|
59
|
+
},
|
|
53
60
|
}],
|
|
54
61
|
...rest,
|
|
55
62
|
}, context);
|
package/lib/utils/uuid.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decompressFrom32 = exports.compressTo32 = exports.formUuid = exports.generateNewId = exports.setGenerateIdOption = exports.produceIds = exports.generateNewIdAsync = exports.expandUuidTo36Bytes = exports.shrinkUuidTo32Bytes = exports.sequentialUuid = void 0;
|
|
4
|
-
|
|
4
|
+
// import { v4 } from 'uuid';
|
|
5
5
|
const random_1 = require("./random/random");
|
|
6
6
|
let _nodeId;
|
|
7
7
|
let _clockseq;
|
|
@@ -112,9 +112,9 @@ exports.expandUuidTo36Bytes = expandUuidTo36Bytes;
|
|
|
112
112
|
// 直接生成uuid的接口,为了适配各种环境,写成异步
|
|
113
113
|
async function generateNewIdAsync(option) {
|
|
114
114
|
const option2 = option || ID_OPTION;
|
|
115
|
-
if (option2?.shuffle || process.env.NODE_ENV === 'development') {
|
|
116
|
-
return
|
|
117
|
-
}
|
|
115
|
+
/* if (option2?.shuffle || process.env.NODE_ENV === 'development') {
|
|
116
|
+
return v4({ random: await getRandomValues(16) });
|
|
117
|
+
} */
|
|
118
118
|
return sequentialUuid({ random: await (0, random_1.getRandomValues)(16) });
|
|
119
119
|
}
|
|
120
120
|
exports.generateNewIdAsync = generateNewIdAsync;
|
|
@@ -150,9 +150,9 @@ function generateNewId() {
|
|
|
150
150
|
do {
|
|
151
151
|
random[iter] = Math.ceil(Math.random() * 1000) % 128;
|
|
152
152
|
} while (++iter < 16);
|
|
153
|
-
if (ID_OPTION?.shuffle || process.env.NODE_ENV === 'development') {
|
|
154
|
-
return
|
|
155
|
-
}
|
|
153
|
+
/* if (ID_OPTION?.shuffle || process.env.NODE_ENV === 'development') {
|
|
154
|
+
return v4({ random });
|
|
155
|
+
} */
|
|
156
156
|
return sequentialUuid({ random });
|
|
157
157
|
}
|
|
158
158
|
}
|