fig-tree-evaluator 2.8.0 → 2.8.4

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.
Files changed (109) hide show
  1. package/README.md +4 -2
  2. package/build/FigTreeEvaluator.d.ts +6 -16
  3. package/build/FigTreeEvaluator.js +8 -4
  4. package/build/cache.d.ts +3 -1
  5. package/build/cache.js +10 -11
  6. package/build/evaluate.js +3 -6
  7. package/build/helpers.d.ts +8 -34
  8. package/build/helpers.js +1 -10
  9. package/build/index.d.ts +2 -2
  10. package/build/operators/AND/data.d.ts +0 -1
  11. package/build/operators/AND/data.js +1 -2
  12. package/build/operators/AND/index.d.ts +1 -1
  13. package/build/operators/AND/operator.d.ts +2 -6
  14. package/build/operators/AND/operator.js +1 -2
  15. package/build/operators/BUILD_OBJECT/data.d.ts +0 -1
  16. package/build/operators/BUILD_OBJECT/data.js +1 -2
  17. package/build/operators/BUILD_OBJECT/operator.d.ts +1 -9
  18. package/build/operators/BUILD_OBJECT/operator.js +1 -2
  19. package/build/operators/CONDITIONAL/data.d.ts +0 -1
  20. package/build/operators/CONDITIONAL/data.js +1 -2
  21. package/build/operators/CONDITIONAL/operator.d.ts +1 -5
  22. package/build/operators/CONDITIONAL/operator.js +7 -2
  23. package/build/operators/COUNT/data.d.ts +0 -1
  24. package/build/operators/COUNT/data.js +1 -2
  25. package/build/operators/COUNT/operator.js +1 -2
  26. package/build/operators/CUSTOM_FUNCTIONS/data.d.ts +0 -1
  27. package/build/operators/CUSTOM_FUNCTIONS/data.js +9 -3
  28. package/build/operators/CUSTOM_FUNCTIONS/operator.d.ts +1 -7
  29. package/build/operators/CUSTOM_FUNCTIONS/operator.js +7 -6
  30. package/build/operators/DIVIDE/data.d.ts +0 -1
  31. package/build/operators/DIVIDE/data.js +2 -3
  32. package/build/operators/DIVIDE/operator.d.ts +1 -11
  33. package/build/operators/DIVIDE/operator.js +5 -4
  34. package/build/operators/EQUAL/data.d.ts +0 -1
  35. package/build/operators/EQUAL/data.js +1 -2
  36. package/build/operators/EQUAL/operator.js +1 -2
  37. package/build/operators/GET/data.d.ts +0 -1
  38. package/build/operators/GET/data.js +2 -3
  39. package/build/operators/GET/index.d.ts +1 -1
  40. package/build/operators/GET/operator.d.ts +2 -10
  41. package/build/operators/GET/operator.js +16 -14
  42. package/build/operators/GRAPHQL/data.d.ts +0 -1
  43. package/build/operators/GRAPHQL/data.js +1 -2
  44. package/build/operators/GRAPHQL/operator.d.ts +1 -10
  45. package/build/operators/GRAPHQL/operator.js +20 -9
  46. package/build/operators/GREATER_THAN/data.d.ts +0 -1
  47. package/build/operators/GREATER_THAN/data.js +1 -2
  48. package/build/operators/GREATER_THAN/operator.d.ts +0 -4
  49. package/build/operators/GREATER_THAN/operator.js +1 -2
  50. package/build/operators/LESS_THAN/data.d.ts +0 -1
  51. package/build/operators/LESS_THAN/data.js +1 -2
  52. package/build/operators/LESS_THAN/operator.js +1 -2
  53. package/build/operators/MATCH/data.d.ts +0 -1
  54. package/build/operators/MATCH/data.js +1 -2
  55. package/build/operators/MATCH/operator.d.ts +1 -5
  56. package/build/operators/MATCH/operator.js +12 -6
  57. package/build/operators/MULTIPLY/data.d.ts +0 -1
  58. package/build/operators/MULTIPLY/data.js +1 -2
  59. package/build/operators/MULTIPLY/operator.js +5 -2
  60. package/build/operators/NOT_EQUAL/data.d.ts +0 -1
  61. package/build/operators/NOT_EQUAL/data.js +1 -2
  62. package/build/operators/NOT_EQUAL/operator.js +1 -2
  63. package/build/operators/OBJECT_PROPERTIES/data.d.ts +0 -1
  64. package/build/operators/OBJECT_PROPERTIES/data.js +1 -2
  65. package/build/operators/OBJECT_PROPERTIES/operator.d.ts +1 -7
  66. package/build/operators/OBJECT_PROPERTIES/operator.js +1 -2
  67. package/build/operators/OR/data.d.ts +0 -1
  68. package/build/operators/OR/data.js +1 -2
  69. package/build/operators/OR/operator.js +1 -2
  70. package/build/operators/PASSTHRU/data.d.ts +0 -1
  71. package/build/operators/PASSTHRU/data.js +1 -2
  72. package/build/operators/PASSTHRU/operator.d.ts +1 -5
  73. package/build/operators/PASSTHRU/operator.js +2 -1
  74. package/build/operators/PG_SQL/data.d.ts +0 -1
  75. package/build/operators/PG_SQL/data.js +9 -3
  76. package/build/operators/PG_SQL/operator.d.ts +1 -23
  77. package/build/operators/PG_SQL/operator.js +22 -30
  78. package/build/operators/PLUS/data.d.ts +0 -1
  79. package/build/operators/PLUS/data.js +2 -3
  80. package/build/operators/PLUS/operator.d.ts +1 -8
  81. package/build/operators/PLUS/operator.js +5 -5
  82. package/build/operators/POST/data.d.ts +0 -1
  83. package/build/operators/POST/data.js +3 -4
  84. package/build/operators/POST/operator.js +14 -6
  85. package/build/operators/REGEX/data.d.ts +0 -1
  86. package/build/operators/REGEX/data.js +1 -2
  87. package/build/operators/REGEX/operator.d.ts +1 -5
  88. package/build/operators/REGEX/operator.js +1 -2
  89. package/build/operators/SPLIT/data.d.ts +0 -1
  90. package/build/operators/SPLIT/data.js +1 -2
  91. package/build/operators/SPLIT/operator.d.ts +1 -9
  92. package/build/operators/SPLIT/operator.js +1 -2
  93. package/build/operators/STRING_SUBSTITUTION/data.d.ts +0 -1
  94. package/build/operators/STRING_SUBSTITUTION/data.js +1 -2
  95. package/build/operators/STRING_SUBSTITUTION/operator.d.ts +1 -5
  96. package/build/operators/STRING_SUBSTITUTION/operator.js +5 -6
  97. package/build/operators/SUBTRACT/data.d.ts +0 -1
  98. package/build/operators/SUBTRACT/data.js +1 -2
  99. package/build/operators/SUBTRACT/operator.d.ts +1 -8
  100. package/build/operators/SUBTRACT/operator.js +4 -3
  101. package/build/operators/_operatorUtils.d.ts +16 -17
  102. package/build/operators/_operatorUtils.js +17 -17
  103. package/build/shorthandSyntax.js +1 -1
  104. package/build/typeCheck.d.ts +8 -4
  105. package/build/typeCheck.js +25 -20
  106. package/build/types.d.ts +32 -33
  107. package/build/version.d.ts +1 -0
  108. package/build/version.js +4 -0
  109. package/package.json +10 -3
@@ -38,11 +38,13 @@ const _operatorUtils_1 = require("../_operatorUtils");
38
38
  const data_1 = __importStar(require("./data"));
39
39
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const [values, dividend, divisor, output] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.dividend, expression.divisor, expression.output], config));
41
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, dividend, divisor, output }));
42
- const vals = values !== null && values !== void 0 ? values : [dividend, divisor];
41
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, dividend, divisor, output }));
42
+ const vals = values !== null && values !== void 0 ? values : [dividend, divisor].filter((e) => e !== undefined);
43
43
  if (vals.length < 2)
44
44
  throw new Error('- Not enough values provided');
45
- if (!vals[1])
45
+ if (vals.some((e) => typeof e !== 'number'))
46
+ throw new Error('- Not all values are numbers');
47
+ if (vals[1] === 0)
46
48
  throw new Error('Division by zero!');
47
49
  switch (output) {
48
50
  case 'quotient':
@@ -54,7 +56,6 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
54
56
  }
55
57
  });
56
58
  exports.DIVIDE = {
57
- requiredProperties: data_1.requiredProperties,
58
59
  propertyAliases: data_1.propertyAliases,
59
60
  operatorData: data_1.default,
60
61
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Test multiple values are equal';
6
6
  const aliases = ['=', 'eq', 'equal', 'equals'];
@@ -20,7 +20,6 @@ const parameters = [
20
20
  type: 'boolean',
21
21
  },
22
22
  ];
23
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
24
23
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
25
24
  const operatorData = {
26
25
  description,
@@ -40,7 +40,7 @@ const data_1 = __importStar(require("./data"));
40
40
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
41
41
  var _a;
42
42
  const [values, nullMatch] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.nullEqualsUndefined], config));
43
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, nullEqualsUndefined: nullMatch }));
43
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, nullEqualsUndefined: nullMatch }));
44
44
  const nullEqualsUndefined = nullMatch !== undefined
45
45
  ? nullMatch
46
46
  : ((_a = config.options) === null || _a === void 0 ? void 0 : _a.nullEqualsUndefined) !== undefined
@@ -51,7 +51,6 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
51
51
  return values.every((value) => (0, lite_1.dequal)(value, values[0]));
52
52
  });
53
53
  exports.EQUAL = {
54
- requiredProperties: data_1.requiredProperties,
55
54
  propertyAliases: data_1.propertyAliases,
56
55
  operatorData: data_1.default,
57
56
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'HTTP GET Request';
6
6
  const aliases = ['get', 'api'];
@@ -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
  },
@@ -41,7 +41,6 @@ const parameters = [
41
41
  type: 'boolean',
42
42
  },
43
43
  ];
44
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
45
44
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
46
45
  const operatorData = {
47
46
  description,
@@ -1 +1 @@
1
- export { GET, type APINode } from './operator';
1
+ export { GET } from './operator';
@@ -1,11 +1,3 @@
1
- import { BaseOperatorNode, EvaluatorNode, FigTreeConfig, CombinedOperatorNode, GenericObject, OperatorObject } from '../../types';
2
- import { requiredProperties } from './data';
3
- export type APINode = {
4
- [key in typeof requiredProperties[number]]: EvaluatorNode;
5
- } & BaseOperatorNode & {
6
- parameters?: EvaluatorNode;
7
- returnProperty?: EvaluatorNode;
8
- headers?: GenericObject;
9
- };
10
- export declare const parseChildrenGET: (expression: CombinedOperatorNode, config: FigTreeConfig) => Promise<APINode>;
1
+ import { OperatorObject, ParseChildrenMethod } from '../../types';
2
+ export declare const parseChildrenGET: ParseChildrenMethod;
11
3
  export declare const GET: OperatorObject;
@@ -36,7 +36,7 @@ exports.GET = exports.parseChildrenGET = void 0;
36
36
  const _operatorUtils_1 = require("../_operatorUtils");
37
37
  const data_1 = __importStar(require("./data"));
38
38
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
39
- var _a, _b, _c, _d;
39
+ var _a, _b, _c;
40
40
  const [urlObj, parameters, returnProperty, headers, useCache] = (yield (0, _operatorUtils_1.evaluateArray)([
41
41
  expression.url,
42
42
  expression.parameters,
@@ -45,20 +45,23 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
45
45
  expression.useCache,
46
46
  ], config));
47
47
  const { url, headers: headersObj } = urlObj instanceof Object ? urlObj : { url: urlObj, headers: null };
48
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, {
49
- url,
50
- returnProperty,
51
- headers,
52
- parameters,
53
- useCache,
54
- }), {
55
- name: 'headers',
56
- value: headersObj,
57
- expectedType: ['object', 'null'],
58
- });
48
+ config.typeChecker([
49
+ ...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, {
50
+ url,
51
+ returnProperty,
52
+ headers,
53
+ parameters,
54
+ useCache,
55
+ }),
56
+ {
57
+ name: 'headers',
58
+ value: headersObj,
59
+ expectedType: ['object', 'null'],
60
+ },
61
+ ]);
59
62
  const baseUrl = (_a = config.options.baseEndpoint) !== null && _a !== void 0 ? _a : '';
60
63
  const httpHeaders = Object.assign(Object.assign(Object.assign({}, (_b = config.options) === null || _b === void 0 ? void 0 : _b.headers), headersObj), headers);
61
- const shouldUseCache = (_d = (_c = expression.useCache) !== null && _c !== void 0 ? _c : config.options.useCache) !== null && _d !== void 0 ? _d : true;
64
+ const shouldUseCache = (_c = useCache !== null && useCache !== void 0 ? useCache : config.options.useCache) !== null && _c !== void 0 ? _c : true;
62
65
  const result = yield config.cache.useCache(shouldUseCache, (url, params, headers, returnProperty) => __awaiter(void 0, void 0, void 0, function* () {
63
66
  const response = yield (0, _operatorUtils_1.axiosRequest)({
64
67
  url,
@@ -81,7 +84,6 @@ const parseChildren = (expression, config) => __awaiter(void 0, void 0, void 0,
81
84
  });
82
85
  exports.parseChildrenGET = parseChildren;
83
86
  exports.GET = {
84
- requiredProperties: data_1.requiredProperties,
85
87
  propertyAliases: data_1.propertyAliases,
86
88
  operatorData: data_1.default,
87
89
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'GraphQL request';
6
6
  const aliases = ['graphQl', 'graphql', 'gql'];
@@ -48,7 +48,6 @@ const parameters = [
48
48
  type: 'boolean',
49
49
  },
50
50
  ];
51
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
52
51
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
53
52
  const operatorData = {
54
53
  description,
@@ -1,13 +1,4 @@
1
- import { BaseOperatorNode, EvaluatorNode, GenericObject, OperatorObject } from '../../types';
2
- import { requiredProperties } from './data';
3
- export type GraphQLNode = {
4
- [key in typeof requiredProperties[number]]: EvaluatorNode;
5
- } & BaseOperatorNode & {
6
- url?: EvaluatorNode;
7
- variables?: EvaluatorNode;
8
- returnNode?: EvaluatorNode;
9
- headers?: GenericObject;
10
- };
1
+ import { OperatorObject } from '../../types';
11
2
  export interface GraphQLConnection {
12
3
  endpoint: string;
13
4
  headers?: {
@@ -36,38 +36,49 @@ exports.GRAPHQL = void 0;
36
36
  const _operatorUtils_1 = require("../_operatorUtils");
37
37
  const data_1 = __importStar(require("./data"));
38
38
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
39
- var _a, _b, _c, _d, _e, _f, _g;
40
- const [query, urlObj, variables, returnNode, headers] = (yield (0, _operatorUtils_1.evaluateArray)([
39
+ var _a, _b, _c, _d, _e, _f;
40
+ const [query, urlObj, variables, returnNode, headers, useCache] = (yield (0, _operatorUtils_1.evaluateArray)([
41
41
  expression.query,
42
42
  expression.url,
43
43
  expression.variables,
44
44
  expression.returnNode,
45
45
  expression.headers,
46
+ expression.useCache,
46
47
  ], config));
47
48
  const { url, headers: headersObj } = urlObj instanceof Object ? urlObj : { url: urlObj, headers: null };
48
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { url, query, variables, returnNode, headers }), { name: 'headers', value: headersObj, expectedType: ['object', 'null'] });
49
+ config.typeChecker([
50
+ ...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, {
51
+ url,
52
+ query,
53
+ variables,
54
+ returnNode,
55
+ headers,
56
+ useCache,
57
+ }),
58
+ { name: 'headers', value: headersObj, expectedType: ['object', 'null'] },
59
+ ]);
49
60
  const endpoint = !url || url.toLowerCase() === 'graphqlendpoint' ? '' : url;
50
61
  const baseEndpoint = (_c = (_b = (_a = config.options.graphQLConnection) === null || _a === void 0 ? void 0 : _a.endpoint) !== null && _b !== void 0 ? _b : config.options.baseEndpoint) !== null && _c !== void 0 ? _c : '';
51
62
  const fullUrl = (0, _operatorUtils_1.isFullUrl)(endpoint) ? endpoint : (0, _operatorUtils_1.joinUrlParts)(baseEndpoint, endpoint);
52
63
  const data = { query, variables };
53
- const shouldUseCache = (_e = (_d = expression.useCache) !== null && _d !== void 0 ? _d : config.options.useCache) !== null && _e !== void 0 ? _e : true;
64
+ const shouldUseCache = (_d = useCache !== null && useCache !== void 0 ? useCache : config.options.useCache) !== null && _d !== void 0 ? _d : true;
54
65
  const result = yield config.cache.useCache(shouldUseCache, (url, data, headers, returnNode) => __awaiter(void 0, void 0, void 0, function* () {
55
66
  const response = yield (0, _operatorUtils_1.axiosRequest)({ url, method: 'post', data, headers });
56
67
  return (0, _operatorUtils_1.extractAndSimplify)(response.data, returnNode);
57
- }), fullUrl, data, Object.assign(Object.assign(Object.assign(Object.assign({}, (_f = config.options.graphQLConnection) === null || _f === void 0 ? void 0 : _f.headers), (_g = config.options) === null || _g === void 0 ? void 0 : _g.headers), headersObj), headers), returnNode);
68
+ }), fullUrl, data, Object.assign(Object.assign(Object.assign(Object.assign({}, (_e = config.options.graphQLConnection) === null || _e === void 0 ? void 0 : _e.headers), (_f = config.options) === null || _f === void 0 ? void 0 : _f.headers), headersObj), headers), returnNode);
58
69
  return result;
59
70
  });
60
71
  const parseChildren = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
61
72
  const [query, url = '', fieldNames, ...rest] = (yield (0, _operatorUtils_1.evaluateArray)(expression.children, config));
62
- const values = rest.slice(0, fieldNames.length);
63
- const variables = (0, _operatorUtils_1.zipArraysToObject)(fieldNames, values);
73
+ const fieldKeys = Array.isArray(fieldNames) ? fieldNames : [fieldNames];
74
+ const values = rest.slice(0, fieldKeys.length);
75
+ const variables = (0, _operatorUtils_1.zipArraysToObject)(fieldKeys, values);
64
76
  const output = Object.assign(Object.assign({}, expression), { query, url, variables });
65
- if (rest.length > fieldNames.length)
77
+ if (rest.length > fieldKeys.length)
66
78
  output.returnNode = rest.pop();
67
79
  return output;
68
80
  });
69
81
  exports.GRAPHQL = {
70
- requiredProperties: data_1.requiredProperties,
71
82
  propertyAliases: data_1.propertyAliases,
72
83
  operatorData: data_1.default,
73
84
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Test if a value is greater than (or equal to) another value';
6
6
  const aliases = ['>', 'greaterThan', 'higher', 'larger'];
@@ -20,7 +20,6 @@ const parameters = [
20
20
  type: 'boolean',
21
21
  },
22
22
  ];
23
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
24
23
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
25
24
  const operatorData = {
26
25
  description,
@@ -1,6 +1,2 @@
1
- import { BasicExtendedNode } from '../AND/operator';
2
1
  import { OperatorObject } from '../../types';
3
- export type ComparatorNode = BasicExtendedNode & {
4
- strict?: boolean;
5
- };
6
2
  export declare const GREATER_THAN: OperatorObject;
@@ -38,7 +38,7 @@ const _operatorUtils_1 = require("../_operatorUtils");
38
38
  const data_1 = __importStar(require("./data"));
39
39
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const [values, strict = true] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.strict], config));
41
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, strict }));
41
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, strict }));
42
42
  if (values.length < 2)
43
43
  throw new Error('- Not enough values provided');
44
44
  const [first, second] = values;
@@ -47,7 +47,6 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
47
47
  return first > second;
48
48
  });
49
49
  exports.GREATER_THAN = {
50
- requiredProperties: data_1.requiredProperties,
51
50
  propertyAliases: data_1.propertyAliases,
52
51
  operatorData: data_1.default,
53
52
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Test if a value is smaller than (or equal to) another value';
6
6
  const aliases = ['<', 'lessThan', 'lower', 'smaller'];
@@ -20,7 +20,6 @@ const parameters = [
20
20
  type: 'boolean',
21
21
  },
22
22
  ];
23
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
24
23
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
25
24
  const operatorData = {
26
25
  description,
@@ -38,7 +38,7 @@ const _operatorUtils_1 = require("../_operatorUtils");
38
38
  const data_1 = __importStar(require("./data"));
39
39
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const [values, strict = true] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.strict], config));
41
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, strict }));
41
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, strict }));
42
42
  if (values.length < 2)
43
43
  throw new Error('- Not enough values provided');
44
44
  const [first, second] = values;
@@ -47,7 +47,6 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
47
47
  return first < second;
48
48
  });
49
49
  exports.LESS_THAN = {
50
- requiredProperties: data_1.requiredProperties,
51
50
  propertyAliases: data_1.propertyAliases,
52
51
  operatorData: data_1.default,
53
52
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Return different values depending on a matching expression';
6
6
  const aliases = ['match', 'switch'];
@@ -20,7 +20,6 @@ const parameters = [
20
20
  type: ['object', 'array'],
21
21
  },
22
22
  ];
23
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
24
23
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
25
24
  const operatorData = {
26
25
  description,
@@ -1,6 +1,2 @@
1
- import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '../../types';
2
- import { requiredProperties } from './data';
3
- export type MatchNode = {
4
- [key in typeof requiredProperties[number]]: EvaluatorNode;
5
- } & BaseOperatorNode;
1
+ import { OperatorObject } from '../../types';
6
2
  export declare const MATCH: OperatorObject;
@@ -38,12 +38,19 @@ const evaluate_1 = require("../../evaluate");
38
38
  const helpers_1 = require("../../helpers");
39
39
  const data_1 = __importStar(require("./data"));
40
40
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _a;
41
42
  const matchExpression = (yield (0, evaluate_1.evaluatorFunction)(expression.matchExpression, config));
42
- const branches = expression.branches;
43
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { matchExpression, branches }));
44
- let branchObject = Array.isArray(branches) ? (0, _operatorUtils_1.singleArrayToObject)(branches) : branches !== null && branches !== void 0 ? branches : {};
45
- if ((0, helpers_1.isOperatorNode)(branchObject))
46
- branchObject = yield (0, evaluate_1.evaluatorFunction)(branchObject, config);
43
+ config.typeChecker({
44
+ name: 'matchExpression',
45
+ value: matchExpression,
46
+ expectedType: ['string', 'number', 'boolean'],
47
+ });
48
+ const branches = Array.isArray(expression.branches)
49
+ ? (0, _operatorUtils_1.singleArrayToObject)(expression.branches)
50
+ : (_a = expression.branches) !== null && _a !== void 0 ? _a : {};
51
+ const branchObject = ((0, helpers_1.isOperatorNode)(branches) ? yield (0, evaluate_1.evaluatorFunction)(branches, config) : branches);
52
+ if (!(0, helpers_1.isObject)(branchObject))
53
+ throw new Error("Branches don't evaluate to an object");
47
54
  if (matchExpression in branchObject)
48
55
  return yield (0, evaluate_1.evaluatorFunction)(branchObject[matchExpression], config);
49
56
  if ('fallback' in branchObject)
@@ -58,7 +65,6 @@ const parseChildren = (expression, config) => __awaiter(void 0, void 0, void 0,
58
65
  return Object.assign(Object.assign({}, expression), { matchExpression, branches });
59
66
  });
60
67
  exports.MATCH = {
61
- requiredProperties: data_1.requiredProperties,
62
68
  propertyAliases: data_1.propertyAliases,
63
69
  operatorData: data_1.default,
64
70
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Multiply several numerical values together';
6
6
  const aliases = ['*', 'x', 'multiply', 'times'];
@@ -13,7 +13,6 @@ const parameters = [
13
13
  type: 'array',
14
14
  },
15
15
  ];
16
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
17
16
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
18
17
  const operatorData = {
19
18
  description,
@@ -38,11 +38,14 @@ const _operatorUtils_1 = require("../_operatorUtils");
38
38
  const data_1 = __importStar(require("./data"));
39
39
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const values = (yield (0, _operatorUtils_1.evaluateArray)(expression.values, config));
41
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values }));
41
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values }));
42
+ if (values.length === 0)
43
+ return 0;
44
+ if (values.some((e) => typeof e !== 'number'))
45
+ throw new Error('- Not all values are numbers');
42
46
  return values.reduce((acc, number) => acc * number);
43
47
  });
44
48
  exports.MULTIPLY = {
45
- requiredProperties: data_1.requiredProperties,
46
49
  propertyAliases: data_1.propertyAliases,
47
50
  operatorData: data_1.default,
48
51
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Test if any values are different';
6
6
  const aliases = ['!=', '!', 'ne', 'notEqual'];
@@ -20,7 +20,6 @@ const parameters = [
20
20
  type: 'boolean',
21
21
  },
22
22
  ];
23
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
24
23
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
25
24
  const operatorData = {
26
25
  description,
@@ -40,7 +40,7 @@ const data_1 = __importStar(require("./data"));
40
40
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
41
41
  var _a;
42
42
  const [values, nullMatch] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.nullEqualsUndefined], config));
43
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, nullEqualsUndefined: nullMatch }));
43
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, nullEqualsUndefined: nullMatch }));
44
44
  const nullEqualsUndefined = nullMatch !== undefined
45
45
  ? nullMatch
46
46
  : ((_a = config.options) === null || _a === void 0 ? void 0 : _a.nullEqualsUndefined) !== undefined
@@ -51,7 +51,6 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
51
51
  return values.some((val) => !(0, lite_1.dequal)(val, values[0]));
52
52
  });
53
53
  exports.NOT_EQUAL = {
54
- requiredProperties: data_1.requiredProperties,
55
54
  propertyAliases: data_1.propertyAliases,
56
55
  operatorData: data_1.default,
57
56
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Extract values from data objects';
6
6
  const aliases = [
@@ -28,7 +28,6 @@ const parameters = [
28
28
  type: 'object',
29
29
  },
30
30
  ];
31
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
32
31
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
33
32
  const operatorData = {
34
33
  description,
@@ -1,8 +1,2 @@
1
- import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '../../types';
2
- import { requiredProperties } from './data';
3
- export type ObjPropNode = {
4
- [key in typeof requiredProperties[number]]: EvaluatorNode;
5
- } & BaseOperatorNode & {
6
- additionalData: object;
7
- };
1
+ import { OperatorObject } from '../../types';
8
2
  export declare const OBJECT_PROPERTIES: OperatorObject;
@@ -42,7 +42,7 @@ const data_1 = __importStar(require("./data"));
42
42
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
43
43
  var _a, _b, _c, _d;
44
44
  const [property, additionalData] = (yield (0, _operatorUtils_1.evaluateArray)([expression.property, expression.additionalData], config));
45
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { property, additionalData }));
45
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { property, additionalData }));
46
46
  const inputObject = additionalData
47
47
  ? Object.assign(Object.assign({}, ((_b = (_a = config.options) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {})), additionalData) : (_d = (_c = config.options) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : {};
48
48
  return (0, object_property_extractor_1.default)(inputObject, property);
@@ -55,7 +55,6 @@ const parseChildren = (expression) => {
55
55
  return returnValue;
56
56
  };
57
57
  exports.OBJECT_PROPERTIES = {
58
- requiredProperties: data_1.requiredProperties,
59
58
  propertyAliases: data_1.propertyAliases,
60
59
  operatorData: data_1.default,
61
60
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Logical OR';
6
6
  const aliases = ['or', '|', '||'];
@@ -13,7 +13,6 @@ const parameters = [
13
13
  type: 'array',
14
14
  },
15
15
  ];
16
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
17
16
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
18
17
  const operatorData = {
19
18
  description,
@@ -38,11 +38,10 @@ const _operatorUtils_1 = require("../_operatorUtils");
38
38
  const data_1 = __importStar(require("./data"));
39
39
  const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const values = (yield (0, _operatorUtils_1.evaluateArray)(expression.values, config));
41
- config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values }));
41
+ config.typeChecker((0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values }));
42
42
  return values.reduce((acc, val) => acc || !!val, false);
43
43
  });
44
44
  exports.OR = {
45
- requiredProperties: data_1.requiredProperties,
46
45
  propertyAliases: data_1.propertyAliases,
47
46
  operatorData: data_1.default,
48
47
  evaluate,
@@ -1,5 +1,4 @@
1
1
  import { OperatorData } from '../../types';
2
- export declare const requiredProperties: string[];
3
2
  export declare const propertyAliases: Record<string, string>;
4
3
  declare const operatorData: OperatorData;
5
4
  export default operatorData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyAliases = exports.requiredProperties = void 0;
3
+ exports.propertyAliases = void 0;
4
4
  const _operatorUtils_1 = require("../_operatorUtils");
5
5
  const description = 'Pass through a value unchanged (or change its type)';
6
6
  const aliases = ['_', 'passThru', 'passthru', 'pass', 'ignore', 'coerce', 'convert'];
@@ -13,7 +13,6 @@ const parameters = [
13
13
  type: 'any',
14
14
  },
15
15
  ];
16
- exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
17
16
  exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
18
17
  const operatorData = {
19
18
  description,