@fibery/expression-utils 9.2.0 → 9.2.1

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.
@@ -269,9 +269,6 @@ const binaryOperations = new Set(["=", "!=", "<", ">", "<=", ">=", "in",
269
269
  "q/contains", "q/not-contains", "+", "-", "q/+", "q/-", "*", "/", "and", "or",
270
270
  //asc: obsolete. use q/and, q/or
271
271
  "q/and", "q/or", "q/in", "q/not-in"]);
272
-
273
- // TODO: get rid of this. Use visitors everywhere
274
- const naryOperations = new Set(["and", "or", "q/and", "q/or"]);
275
272
  const logicalOperators = new Set(["and", "or", "q/and", "q/or"]);
276
273
  const relationalOperators = new Set(["=", "!=", "<", ">", "<=", ">="]);
277
274
  const mathOperators = new Set(["+", "-", "*", "/", "q/+", "q/-", "q/concat"]);
@@ -284,7 +281,7 @@ const isCollectionFunctionExpression = expression =>
284
281
  (expression.length === 2 || expression.length === 3) && collectionOps.has(expression[0]);
285
282
  const isAccessFunctionExpression = expresion => expresion.length === 2 && expresion[0] === "q/access?" && isFieldExpression(expresion[1]);
286
283
  const isBinaryExpression = expression => expression.length === 3 && binaryOperations.has(expression[0]);
287
- const isNaryExpression = expression => expression.length > 1 && naryOperations.has(expression[0]);
284
+ const isNaryExpression = expression => expression.length > 1 && logicalOperators.has(expression[0]);
288
285
  const isVariableExpression = expression => ___default["default"].isString(expression) && expression.startsWith("$");
289
286
  const isMultiFieldAccess = expression => ___default["default"].isArray(expression) && expression.length === 2 && !isFunctionCallExpression(expression) && expression.every(x => ___default["default"].isString(x));
290
287
  const isMultiFieldExpression = expression => Array.isArray(expression) && !isFunctionCallExpression(expression) && expression.some(x => isMultiFieldAccess(x)) && expression.every(x => !isVariableExpression(x) && !binaryOperations.has(x) && (___default["default"].isString(x) || isMultiFieldAccess(x)));
package/lib/utils.js CHANGED
@@ -39,9 +39,6 @@ const binaryOperations = new Set(["=", "!=", "<", ">", "<=", ">=", "in",
39
39
  "q/contains", "q/not-contains", "+", "-", "q/+", "q/-", "*", "/", "and", "or",
40
40
  //asc: obsolete. use q/and, q/or
41
41
  "q/and", "q/or", "q/in", "q/not-in"]);
42
-
43
- // TODO: get rid of this. Use visitors everywhere
44
- const naryOperations = new Set(["and", "or", "q/and", "q/or"]);
45
42
  const logicalOperators = new Set(["and", "or", "q/and", "q/or"]);
46
43
  const relationalOperators = new Set(["=", "!=", "<", ">", "<=", ">="]);
47
44
  const mathOperators = new Set(["+", "-", "*", "/", "q/+", "q/-", "q/concat"]);
@@ -54,7 +51,7 @@ const isCollectionFunctionExpression = expression =>
54
51
  (expression.length === 2 || expression.length === 3) && collectionOps.has(expression[0]);
55
52
  const isAccessFunctionExpression = expresion => expresion.length === 2 && expresion[0] === "q/access?" && isFieldExpression(expresion[1]);
56
53
  const isBinaryExpression = expression => expression.length === 3 && binaryOperations.has(expression[0]);
57
- const isNaryExpression = expression => expression.length > 1 && naryOperations.has(expression[0]);
54
+ const isNaryExpression = expression => expression.length > 1 && logicalOperators.has(expression[0]);
58
55
  const isVariableExpression = expression => ___default["default"].isString(expression) && expression.startsWith("$");
59
56
  const isMultiFieldAccess = expression => ___default["default"].isArray(expression) && expression.length === 2 && !isFunctionCallExpression(expression) && expression.every(x => ___default["default"].isString(x));
60
57
  const isMultiFieldExpression = expression => Array.isArray(expression) && !isFunctionCallExpression(expression) && expression.some(x => isMultiFieldAccess(x)) && expression.every(x => !isVariableExpression(x) && !binaryOperations.has(x) && (___default["default"].isString(x) || isMultiFieldAccess(x)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/expression-utils",
3
- "version": "9.2.0",
3
+ "version": "9.2.1",
4
4
  "description": "utils for working with fibery api expressions",
5
5
  "exports": {
6
6
  ".": "./lib/expression-utils.js",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "lodash": "4.17.21",
28
28
  "moment": "2.29.4",
29
- "@fibery/helpers": "1.3.2"
29
+ "@fibery/helpers": "1.3.3"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@babel/core": "7.23.9",
@@ -38,7 +38,7 @@
38
38
  "@fibery/eslint-config": "8.6.1"
39
39
  },
40
40
  "peerDependencies": {
41
- "@fibery/schema": "10.2.7"
41
+ "@fibery/schema": "10.2.8"
42
42
  },
43
43
  "jest": {
44
44
  "testEnvironment": "node",