fig-tree-evaluator 2.8.3 → 2.8.5

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/README.md CHANGED
@@ -883,7 +883,7 @@ Aliases: `get`, `api`
883
883
  #### Properties
884
884
 
885
885
  - `url` (or `endpoint`)<sup>*</sup>: (string) -- url to be queried
886
- - `parameters`: (object) -- key-value pairs for any query parameters for the request
886
+ - `parameters` (or `queryParams`, `queryParameters`, `urlQueries`): (object) -- key-value pairs for any query parameters for the request
887
887
  - `headers`: (object) -- any additional headers (such as authentication) required for the request
888
888
  - `returnProperty` (or `outputProperty`): (string) -- an object path for which property to extract from the returned data. E.g. if the API returns `{name: {first: "Bruce", last: "Banner"}, age: 35}` and you specify `returnProperty: "name.first`, the operator will return `"Bruce"` (Uses the same logic as the [objectProperties](#object_properties) internally)
889
889
 
@@ -946,7 +946,8 @@ The "POST" operator is basically structurally the same as [GET](#get).
946
946
 
947
947
  #### Properties
948
948
 
949
- - `url`/`endpoint`<sup>*</sup>,`parameters`, `headers`, `returnProperty`/`outputProperty` -- same as "GET" operator (although the `parameters` object will be passed to the Post request as body JSON rather than url query parameters)
949
+ - `url`/`endpoint`<sup>*</sup>, `headers`, `returnProperty`/`outputProperty` -- same as "GET" operator.
950
+ - `parameters` (or `bodyJson`, `data`) -- passed to the Post request as body JSON rather than url query parameters (hence the different aliases)
950
951
 
951
952
  e.g.
952
953
  ```js
@@ -1690,30 +1691,30 @@ Please open an issue: https://github.com/CarlosNZ/fig-tree-evaluator/issues
1690
1691
 
1691
1692
  *Trivial upgrades (e.g. documentation, small re-factors, types, etc.) not included*
1692
1693
 
1693
- - **v2.8.3**: Refactor types, better compliance with [ESLint](https://eslint.org/) rules, add more tests
1694
+ - **v2.8.5**: Small bug fix in [COUNT](#count) operator
1695
+ - **v2.8.4**: Refactor types, better compliance with [ESLint](https://eslint.org/) rules, add more tests
1694
1696
  - **v2.8.0**:
1695
- - [Shorthand syntax](#shorthand-syntax) (#80)
1696
- - Methods to retrieve [metadata](#metadata) about operators, fragments and functions (#82)
1697
- - **v2.7.0**: Add `excludeOperators` option to allow certain operators to be prohibited (e.g. database lookups) (#54)
1697
+ - **[Shorthand syntax](#shorthand-syntax)** (#80)
1698
+ - **Methods to retrieve [metadata](#metadata)** about operators, fragments and functions (#82)
1699
+ - **v2.7.0**: **Add `excludeOperators` option** to allow certain operators to be prohibited (e.g. database lookups) (#54)
1698
1700
  - **v2.6.0**: Resolve alias nodes that are not part of an Operator node when `evaluateFullObject` is enabled (#78)
1699
1701
  - **v2.5.0**:
1700
1702
  - Bug fixes for edge cases (mainly related to backwards compatibility)
1701
1703
  - More backwards compatibility for very old (pre-v1) syntax (undocumented)
1702
1704
  - **v2.4.1**: Small bug fix for Fragments edge case
1703
- - **v2.4.0**: Implement [Fragments](#fragments) (#74)
1705
+ - **v2.4.0**: **Implement [Fragments](#fragments)** (#74)
1704
1706
  - **v2.3.2**: Bug fix: alias nodes not working with `evaluateFullObject` (#72)
1705
- - **v2.3.0**: Implement [caching/memoization](#caching-memoization) (#68)
1707
+ - **v2.3.0**: **Implement [caching/memoization](#caching-memoization)** (#68)
1706
1708
  - **v2.2.3**: Change option `objects` name to `data` (but keep backward compatibility) (#66)
1707
- - **v2.2.2**: Option to evaluate whole object if operator nodes are deep within it (#64)
1709
+ - **v2.2.2**: **Option to evaluate whole object** if operator nodes are deep within it (#64)
1708
1710
  - **v2.2.1**: More efficient branch evaluation for condition/match operators (#63)
1709
1711
  - **v2.2.0**:
1710
- - New "[Match](#match)" operator (#61)
1712
+ - **New "[Match](#match)" operator** (#61)
1711
1713
  - Fix for regex incompatibility with Safari (#60)
1712
- - **v2.1.5**: Demo updates (no changes to core evaluator)
1713
1714
  - **v2.1.4**: Upgrade dependencies
1714
- - **v2.1.0**: [Alias nodes](#alias-nodes) (#57)
1715
+ - **v2.1.0**: **[Alias nodes](#alias-nodes)** (#57)
1715
1716
  - **v2.0.4**: Backwards compatibility for customFunctions (#53)
1716
- - **v2.0.1**: Add deep equality comparison for objects/arrays in `=`/`!=` operators
1717
+ - **v2.0.1**: **Add deep equality comparison** for objects/arrays in `=`/`!=` operators
1717
1718
  - **v2.0.0**: Re-write as stand-alone package. Major improvements include:
1718
1719
  - more [operators](#operator-reference)
1719
1720
  - operator (and property) [aliases](#operator--property-aliases)
package/build/evaluate.js CHANGED
@@ -41,7 +41,6 @@ const evaluatorFunction = (input, config) => __awaiter(void 0, void 0, void 0, f
41
41
  return (0, helpers_1.replaceAliasNodeValues)(fragmentReplacement, config);
42
42
  expression = Object.assign(Object.assign(Object.assign({}, expression), fragmentReplacement), parameters);
43
43
  delete expression.fragment;
44
- delete expression.parameters;
45
44
  }
46
45
  try {
47
46
  const operator = (0, helpers_1.getOperatorName)(expression.operator, operatorAliases);
@@ -33,7 +33,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.COUNT = void 0;
36
- const operator_1 = require("../AND/operator");
37
36
  const _operatorUtils_1 = require("../_operatorUtils");
38
37
  const data_1 = __importStar(require("./data"));
39
38
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -41,9 +40,13 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
41
40
  config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values }));
42
41
  return values.length;
43
42
  });
43
+ const parseChildren = (expression) => {
44
+ const [values] = expression.children;
45
+ return Object.assign(Object.assign({}, expression), { values });
46
+ };
44
47
  exports.COUNT = {
45
48
  propertyAliases: data_1.propertyAliases,
46
49
  operatorData: data_1.default,
47
50
  evaluate,
48
- parseChildren: operator_1.parseChildren,
51
+ parseChildren,
49
52
  };
@@ -29,7 +29,7 @@ const parameters = [
29
29
  {
30
30
  name: 'parameters',
31
31
  description: 'Query parameters (key-value)',
32
- aliases: [],
32
+ aliases: ['queryParams', 'queryParameters', 'urlQueries'],
33
33
  required: false,
34
34
  type: 'object',
35
35
  },
@@ -27,9 +27,9 @@ const parameters = [
27
27
  type: 'object',
28
28
  },
29
29
  {
30
- name: 'data',
30
+ name: 'parameters',
31
31
  description: 'JSON Body parameters (key-value)',
32
- aliases: [],
32
+ aliases: ['bodyJson', 'data'],
33
33
  required: false,
34
34
  type: 'object',
35
35
  },
@@ -1 +1 @@
1
- export declare const version = "2.8.3";
1
+ export declare const version = "2.8.5";
package/build/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '2.8.3';
4
+ exports.version = '2.8.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fig-tree-evaluator",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "description": "Module to evaluate JSON-structured expression trees",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",