@aeriajs/common 0.0.27 → 0.0.29
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.
|
@@ -4,8 +4,8 @@ exports.convertConditionToQuery = void 0;
|
|
|
4
4
|
const getValueFromPath_js_1 = require("./getValueFromPath.js");
|
|
5
5
|
const convertExpression = (condition, subject) => {
|
|
6
6
|
const term2 = 'term2' in condition
|
|
7
|
-
?
|
|
8
|
-
? (0, getValueFromPath_js_1.getValueFromPath)(subject, condition.term2
|
|
7
|
+
? condition.fromState
|
|
8
|
+
? (0, getValueFromPath_js_1.getValueFromPath)(subject, condition.term2)
|
|
9
9
|
: condition.term2
|
|
10
10
|
: null;
|
|
11
11
|
switch (condition.operator) {
|
|
@@ -28,6 +28,10 @@ const convertExpression = (condition, subject) => {
|
|
|
28
28
|
case 'lte': return {
|
|
29
29
|
$lte: term2,
|
|
30
30
|
};
|
|
31
|
+
case 'regex': return {
|
|
32
|
+
$regex: term2,
|
|
33
|
+
$options: condition.regexOptions,
|
|
34
|
+
};
|
|
31
35
|
case 'in': {
|
|
32
36
|
return Array.isArray(term2)
|
|
33
37
|
? {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { getValueFromPath } from "./getValueFromPath.mjs";
|
|
3
3
|
const convertExpression = (condition, subject) => {
|
|
4
|
-
const term2 = "term2" in condition ?
|
|
4
|
+
const term2 = "term2" in condition ? condition.fromState ? getValueFromPath(subject, condition.term2) : condition.term2 : null;
|
|
5
5
|
switch (condition.operator) {
|
|
6
6
|
case "truthy":
|
|
7
7
|
return {
|
|
@@ -28,6 +28,11 @@ const convertExpression = (condition, subject) => {
|
|
|
28
28
|
return {
|
|
29
29
|
$lte: term2
|
|
30
30
|
};
|
|
31
|
+
case "regex":
|
|
32
|
+
return {
|
|
33
|
+
$regex: term2,
|
|
34
|
+
$options: condition.regexOptions
|
|
35
|
+
};
|
|
31
36
|
case "in": {
|
|
32
37
|
return Array.isArray(term2) ? {
|
|
33
38
|
$in: term2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aeriajs/types": "^0.0.
|
|
30
|
+
"@aeriajs/types": "^0.0.26",
|
|
31
31
|
"bson": "^5.4.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
+
"@aeriajs/types": "^0.0.26",
|
|
35
35
|
"bson": "^5.4.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|