fig-tree-evaluator 2.6.0 → 2.8.0
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 +196 -12
- package/build/FigTreeEvaluator.d.ts +18 -0
- package/build/FigTreeEvaluator.js +26 -3
- package/build/evaluate.js +18 -10
- package/build/helpers.d.ts +29 -4
- package/build/helpers.js +16 -4
- package/build/operators/AND/data.d.ts +5 -0
- package/build/operators/AND/data.js +23 -0
- package/build/operators/AND/index.d.ts +1 -0
- package/build/operators/AND/index.js +5 -0
- package/build/operators/{logicalAnd.d.ts → AND/operator.d.ts} +2 -3
- package/build/operators/AND/operator.js +54 -0
- package/build/operators/BUILD_OBJECT/data.d.ts +5 -0
- package/build/operators/BUILD_OBJECT/data.js +23 -0
- package/build/operators/BUILD_OBJECT/index.d.ts +1 -0
- package/build/operators/BUILD_OBJECT/index.js +17 -0
- package/build/operators/{buildObject.d.ts → BUILD_OBJECT/operator.d.ts} +2 -3
- package/build/operators/{buildObject.js → BUILD_OBJECT/operator.js} +29 -12
- package/build/operators/CONDITIONAL/data.d.ts +5 -0
- package/build/operators/CONDITIONAL/data.js +37 -0
- package/build/operators/CONDITIONAL/index.d.ts +1 -0
- package/build/operators/CONDITIONAL/index.js +17 -0
- package/build/operators/{conditional.d.ts → CONDITIONAL/operator.d.ts} +2 -3
- package/build/operators/{conditional.js → CONDITIONAL/operator.js} +28 -7
- package/build/operators/COUNT/data.d.ts +5 -0
- package/build/operators/COUNT/data.js +23 -0
- package/build/operators/COUNT/index.d.ts +1 -0
- package/build/operators/COUNT/index.js +17 -0
- package/build/operators/COUNT/operator.d.ts +2 -0
- package/build/operators/COUNT/operator.js +50 -0
- package/build/operators/CUSTOM_FUNCTIONS/data.d.ts +5 -0
- package/build/operators/CUSTOM_FUNCTIONS/data.js +37 -0
- package/build/operators/CUSTOM_FUNCTIONS/index.d.ts +1 -0
- package/build/operators/CUSTOM_FUNCTIONS/index.js +17 -0
- package/build/operators/{customFunctions.d.ts → CUSTOM_FUNCTIONS/operator.d.ts} +2 -3
- package/build/operators/{customFunctions.js → CUSTOM_FUNCTIONS/operator.js} +29 -22
- package/build/operators/DIVIDE/data.d.ts +5 -0
- package/build/operators/DIVIDE/data.js +44 -0
- package/build/operators/DIVIDE/index.d.ts +1 -0
- package/build/operators/DIVIDE/index.js +17 -0
- package/build/operators/{divide.d.ts → DIVIDE/operator.d.ts} +2 -2
- package/build/operators/DIVIDE/operator.js +62 -0
- package/build/operators/EQUAL/data.d.ts +5 -0
- package/build/operators/EQUAL/data.js +30 -0
- package/build/operators/EQUAL/index.d.ts +1 -0
- package/build/operators/EQUAL/index.js +17 -0
- package/build/operators/EQUAL/operator.d.ts +2 -0
- package/build/operators/{equal.js → EQUAL/operator.js} +31 -10
- package/build/operators/GET/data.d.ts +5 -0
- package/build/operators/GET/data.js +51 -0
- package/build/operators/GET/index.d.ts +1 -0
- package/build/operators/GET/index.js +5 -0
- package/build/operators/{getRequest.d.ts → GET/operator.d.ts} +2 -3
- package/build/operators/{getRequest.js → GET/operator.js} +51 -13
- package/build/operators/GRAPHQL/data.d.ts +5 -0
- package/build/operators/GRAPHQL/data.js +58 -0
- package/build/operators/GRAPHQL/index.d.ts +1 -0
- package/build/operators/GRAPHQL/index.js +17 -0
- package/build/operators/{graphQL.d.ts → GRAPHQL/operator.d.ts} +2 -3
- package/build/operators/{graphQL.js → GRAPHQL/operator.js} +29 -8
- package/build/operators/GREATER_THAN/data.d.ts +5 -0
- package/build/operators/GREATER_THAN/data.js +30 -0
- package/build/operators/GREATER_THAN/index.d.ts +1 -0
- package/build/operators/GREATER_THAN/index.js +17 -0
- package/build/operators/{greaterThan.d.ts → GREATER_THAN/operator.d.ts} +2 -2
- package/build/operators/GREATER_THAN/operator.js +55 -0
- package/build/operators/LESS_THAN/data.d.ts +5 -0
- package/build/operators/LESS_THAN/data.js +30 -0
- package/build/operators/LESS_THAN/index.d.ts +1 -0
- package/build/operators/LESS_THAN/index.js +17 -0
- package/build/operators/{lessThan.d.ts → LESS_THAN/operator.d.ts} +1 -1
- package/build/operators/LESS_THAN/operator.js +55 -0
- package/build/operators/MATCH/data.d.ts +5 -0
- package/build/operators/MATCH/data.js +30 -0
- package/build/operators/MATCH/index.d.ts +1 -0
- package/build/operators/MATCH/index.js +17 -0
- package/build/operators/{match.d.ts → MATCH/operator.d.ts} +2 -3
- package/build/operators/{match.js → MATCH/operator.js} +31 -18
- package/build/operators/MULTIPLY/data.d.ts +5 -0
- package/build/operators/MULTIPLY/data.js +23 -0
- package/build/operators/MULTIPLY/index.d.ts +1 -0
- package/build/operators/MULTIPLY/index.js +17 -0
- package/build/operators/{multiply.d.ts → MULTIPLY/operator.d.ts} +1 -1
- package/build/operators/MULTIPLY/operator.js +50 -0
- package/build/operators/NOT_EQUAL/data.d.ts +5 -0
- package/build/operators/NOT_EQUAL/data.js +30 -0
- package/build/operators/NOT_EQUAL/index.d.ts +1 -0
- package/build/operators/NOT_EQUAL/index.js +17 -0
- package/build/operators/{notEqual.d.ts → NOT_EQUAL/operator.d.ts} +1 -1
- package/build/operators/{notEqual.js → NOT_EQUAL/operator.js} +31 -10
- package/build/operators/OBJECT_PROPERTIES/data.d.ts +5 -0
- package/build/operators/OBJECT_PROPERTIES/data.js +38 -0
- package/build/operators/OBJECT_PROPERTIES/index.d.ts +1 -0
- package/build/operators/OBJECT_PROPERTIES/index.js +17 -0
- package/build/operators/{objectProperties.d.ts → OBJECT_PROPERTIES/operator.d.ts} +2 -3
- package/build/operators/{objectProperties.js → OBJECT_PROPERTIES/operator.js} +33 -24
- package/build/operators/OR/data.d.ts +5 -0
- package/build/operators/OR/data.js +23 -0
- package/build/operators/OR/index.d.ts +1 -0
- package/build/operators/OR/index.js +17 -0
- package/build/operators/OR/operator.d.ts +2 -0
- package/build/operators/OR/operator.js +50 -0
- package/build/operators/PASSTHRU/data.d.ts +5 -0
- package/build/operators/PASSTHRU/data.js +23 -0
- package/build/operators/PASSTHRU/index.d.ts +1 -0
- package/build/operators/PASSTHRU/index.js +17 -0
- package/build/operators/{passThru.d.ts → PASSTHRU/operator.d.ts} +3 -4
- package/build/operators/PASSTHRU/operator.js +52 -0
- package/build/operators/PG_SQL/data.d.ts +5 -0
- package/build/operators/PG_SQL/data.js +37 -0
- package/build/operators/PG_SQL/index.d.ts +1 -0
- package/build/operators/PG_SQL/index.js +17 -0
- package/build/operators/{pgSQL.d.ts → PG_SQL/operator.d.ts} +2 -2
- package/build/operators/{pgSQL.js → PG_SQL/operator.js} +29 -8
- package/build/operators/PLUS/data.d.ts +5 -0
- package/build/operators/PLUS/data.js +30 -0
- package/build/operators/PLUS/index.d.ts +1 -0
- package/build/operators/PLUS/index.js +17 -0
- package/build/operators/{plus.d.ts → PLUS/operator.d.ts} +3 -4
- package/build/operators/{plus.js → PLUS/operator.js} +34 -10
- package/build/operators/POST/data.d.ts +5 -0
- package/build/operators/POST/data.js +51 -0
- package/build/operators/POST/index.d.ts +1 -0
- package/build/operators/POST/index.js +17 -0
- package/build/operators/POST/operator.d.ts +2 -0
- package/build/operators/{postRequest.js → POST/operator.js} +31 -10
- package/build/operators/REGEX/data.d.ts +5 -0
- package/build/operators/REGEX/data.js +30 -0
- package/build/operators/REGEX/index.d.ts +1 -0
- package/build/operators/REGEX/index.js +17 -0
- package/build/operators/{regex.d.ts → REGEX/operator.d.ts} +2 -3
- package/build/operators/{regex.js → REGEX/operator.js} +30 -16
- package/build/operators/SPLIT/data.d.ts +5 -0
- package/build/operators/SPLIT/data.js +44 -0
- package/build/operators/SPLIT/index.d.ts +1 -0
- package/build/operators/SPLIT/index.js +17 -0
- package/build/operators/{split.d.ts → SPLIT/operator.d.ts} +2 -3
- package/build/operators/{split.js → SPLIT/operator.js} +34 -15
- package/build/operators/STRING_SUBSTITUTION/data.d.ts +5 -0
- package/build/operators/STRING_SUBSTITUTION/data.js +30 -0
- package/build/operators/STRING_SUBSTITUTION/index.d.ts +1 -0
- package/build/operators/STRING_SUBSTITUTION/index.js +17 -0
- package/build/operators/{stringSubstitution.d.ts → STRING_SUBSTITUTION/operator.d.ts} +2 -3
- package/build/operators/{stringSubstitution.js → STRING_SUBSTITUTION/operator.js} +29 -9
- package/build/operators/SUBTRACT/data.d.ts +5 -0
- package/build/operators/SUBTRACT/data.js +37 -0
- package/build/operators/SUBTRACT/index.d.ts +1 -0
- package/build/operators/SUBTRACT/index.js +17 -0
- package/build/operators/{subtract.d.ts → SUBTRACT/operator.d.ts} +2 -2
- package/build/operators/SUBTRACT/operator.js +53 -0
- package/build/operators/_operatorAliases.json +1 -0
- package/build/operators/_operatorUtils.d.ts +9 -1
- package/build/operators/_operatorUtils.js +19 -1
- package/build/operators/index.d.ts +24 -24
- package/build/operators/index.js +24 -27
- package/build/shorthandSyntax.d.ts +2 -0
- package/build/shorthandSyntax.js +55 -0
- package/build/typeCheck.d.ts +1 -1
- package/build/typeCheck.js +1 -0
- package/build/types.d.ts +35 -15
- package/package.json +1 -1
- package/build/operators/count.d.ts +0 -2
- package/build/operators/count.js +0 -29
- package/build/operators/divide.js +0 -41
- package/build/operators/equal.d.ts +0 -2
- package/build/operators/greaterThan.js +0 -35
- package/build/operators/lessThan.js +0 -35
- package/build/operators/logicalAnd.js +0 -33
- package/build/operators/logicalOr.d.ts +0 -2
- package/build/operators/logicalOr.js +0 -29
- package/build/operators/multiply.js +0 -29
- package/build/operators/passThru.js +0 -30
- package/build/operators/postRequest.d.ts +0 -2
- package/build/operators/subtract.js +0 -32
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./operator"), exports);
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,16 +33,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.POST = void 0;
|
|
13
|
-
const _operatorUtils_1 = require("
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const operatorAliases = ['post'];
|
|
17
|
-
const propertyAliases = { endpoint: 'url', outputProperty: 'returnProperty' };
|
|
36
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
37
|
+
const operator_1 = require("../GET/operator");
|
|
38
|
+
const data_1 = __importStar(require("./data"));
|
|
18
39
|
const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
40
|
var _a, _b, _c, _d;
|
|
20
41
|
const [urlObj, data, returnProperty, headers] = (yield (0, _operatorUtils_1.evaluateArray)([expression.url, expression.parameters, expression.returnProperty, expression.headers], config));
|
|
21
42
|
const { url, headers: headersObj } = urlObj instanceof Object ? urlObj : { url: urlObj, headers: null };
|
|
22
|
-
config.typeChecker(
|
|
43
|
+
config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { url, headers, data, returnProperty }), { name: 'headers', value: headersObj, expectedType: ['object', 'null'] });
|
|
23
44
|
const baseUrl = (_a = config.options.baseEndpoint) !== null && _a !== void 0 ? _a : '';
|
|
24
45
|
const httpHeaders = Object.assign(Object.assign(Object.assign({}, (_b = config.options) === null || _b === void 0 ? void 0 : _b.headers), headersObj), headers);
|
|
25
46
|
const shouldUseCache = (_d = (_c = expression.useCache) !== null && _c !== void 0 ? _c : config.options.useCache) !== null && _d !== void 0 ? _d : true;
|
|
@@ -35,9 +56,9 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
|
|
|
35
56
|
return result;
|
|
36
57
|
});
|
|
37
58
|
exports.POST = {
|
|
38
|
-
requiredProperties,
|
|
39
|
-
|
|
40
|
-
|
|
59
|
+
requiredProperties: data_1.requiredProperties,
|
|
60
|
+
propertyAliases: data_1.propertyAliases,
|
|
61
|
+
operatorData: data_1.default,
|
|
41
62
|
evaluate,
|
|
42
|
-
parseChildren:
|
|
63
|
+
parseChildren: operator_1.parseChildrenGET,
|
|
43
64
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertyAliases = exports.requiredProperties = void 0;
|
|
4
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
5
|
+
const description = 'Compare a string against a regex pattern';
|
|
6
|
+
const aliases = ['regex', 'patternMatch', 'regexp', 'matchPattern'];
|
|
7
|
+
const parameters = [
|
|
8
|
+
{
|
|
9
|
+
name: 'testString',
|
|
10
|
+
description: 'The string to test',
|
|
11
|
+
aliases: ['string', 'value'],
|
|
12
|
+
required: true,
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'pattern',
|
|
17
|
+
description: 'The regular expression pattern',
|
|
18
|
+
aliases: ['regex', 'regexp', 'regExp', 're'],
|
|
19
|
+
required: true,
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
|
|
24
|
+
exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
|
|
25
|
+
const operatorData = {
|
|
26
|
+
description,
|
|
27
|
+
aliases,
|
|
28
|
+
parameters,
|
|
29
|
+
};
|
|
30
|
+
exports.default = operatorData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './operator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./operator"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '
|
|
2
|
-
|
|
1
|
+
import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '../../types';
|
|
2
|
+
import { requiredProperties } from './data';
|
|
3
3
|
export type RegexNode = {
|
|
4
4
|
[key in typeof requiredProperties[number]]: EvaluatorNode;
|
|
5
5
|
} & BaseOperatorNode;
|
|
6
6
|
export declare const REGEX: OperatorObject;
|
|
7
|
-
export {};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,21 +33,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.REGEX = void 0;
|
|
13
|
-
const _operatorUtils_1 = require("
|
|
14
|
-
const helpers_1 = require("
|
|
15
|
-
const
|
|
16
|
-
const operatorAliases = ['regex', 'patternMatch', 'regexp', 'matchPattern'];
|
|
17
|
-
const propertyAliases = {
|
|
18
|
-
string: 'testString',
|
|
19
|
-
value: 'testString',
|
|
20
|
-
regex: 'pattern',
|
|
21
|
-
regexp: 'pattern',
|
|
22
|
-
regExp: 'pattern',
|
|
23
|
-
re: 'pattern',
|
|
24
|
-
};
|
|
36
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
37
|
+
const helpers_1 = require("../../helpers");
|
|
38
|
+
const data_1 = __importStar(require("./data"));
|
|
25
39
|
const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
40
|
const [testString, pattern] = (yield (0, _operatorUtils_1.evaluateArray)([expression.testString, expression.pattern], config));
|
|
27
|
-
config.typeChecker(
|
|
41
|
+
config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { testString, pattern }));
|
|
28
42
|
try {
|
|
29
43
|
const re = new RegExp(pattern);
|
|
30
44
|
return re.test(testString);
|
|
@@ -38,9 +52,9 @@ const parseChildren = (expression) => {
|
|
|
38
52
|
return Object.assign(Object.assign({}, expression), { testString, pattern });
|
|
39
53
|
};
|
|
40
54
|
exports.REGEX = {
|
|
41
|
-
requiredProperties,
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
requiredProperties: data_1.requiredProperties,
|
|
56
|
+
propertyAliases: data_1.propertyAliases,
|
|
57
|
+
operatorData: data_1.default,
|
|
44
58
|
evaluate,
|
|
45
59
|
parseChildren,
|
|
46
60
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertyAliases = exports.requiredProperties = void 0;
|
|
4
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
5
|
+
const description = 'Split a string into an array';
|
|
6
|
+
const aliases = ['split', 'arraySplit'];
|
|
7
|
+
const parameters = [
|
|
8
|
+
{
|
|
9
|
+
name: 'value',
|
|
10
|
+
description: 'The string to be split',
|
|
11
|
+
aliases: ['string'],
|
|
12
|
+
required: true,
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'delimiter',
|
|
17
|
+
description: 'The value to split the string on (default is white space)',
|
|
18
|
+
aliases: ['separator'],
|
|
19
|
+
required: false,
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'trimWhiteSpace',
|
|
24
|
+
description: 'Whether to trim white space from around the resulting elements (default: true)',
|
|
25
|
+
aliases: ['trim', 'trimWhitespace'],
|
|
26
|
+
required: false,
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'excludeTrailing',
|
|
31
|
+
description: 'If the input string ends in a delimiter, there will be an additional blank element if this value is false (default: true)',
|
|
32
|
+
aliases: ['removeTrailing', 'excludeTrailingDelimiter'],
|
|
33
|
+
required: false,
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
|
|
38
|
+
exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
|
|
39
|
+
const operatorData = {
|
|
40
|
+
description,
|
|
41
|
+
aliases,
|
|
42
|
+
parameters,
|
|
43
|
+
};
|
|
44
|
+
exports.default = operatorData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './operator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./operator"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperatorObject, EvaluatorNode, BaseOperatorNode } from '
|
|
2
|
-
|
|
1
|
+
import { OperatorObject, EvaluatorNode, BaseOperatorNode } from '../../types';
|
|
2
|
+
import { requiredProperties } from './data';
|
|
3
3
|
export type SplitNode = {
|
|
4
4
|
[key in typeof requiredProperties[number]]: EvaluatorNode;
|
|
5
5
|
} & BaseOperatorNode & {
|
|
@@ -8,4 +8,3 @@ export type SplitNode = {
|
|
|
8
8
|
excludeTrailing: EvaluatorNode;
|
|
9
9
|
};
|
|
10
10
|
export declare const SPLIT: OperatorObject;
|
|
11
|
-
export {};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,17 +33,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.SPLIT = void 0;
|
|
13
|
-
const _operatorUtils_1 = require("
|
|
14
|
-
const
|
|
15
|
-
const operatorAliases = ['split', 'arraySplit'];
|
|
16
|
-
const propertyAliases = {
|
|
17
|
-
string: 'value',
|
|
18
|
-
separator: 'delimiter',
|
|
19
|
-
trim: 'trimWhiteSpace',
|
|
20
|
-
trimWhitespace: 'trimWhiteSpace',
|
|
21
|
-
removeTrailing: 'excludeTrailing',
|
|
22
|
-
excludeTrailingDelimiter: 'excludeTrailing',
|
|
23
|
-
};
|
|
36
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
37
|
+
const data_1 = __importStar(require("./data"));
|
|
24
38
|
const DEFAULT_DELIMITER = ' ';
|
|
25
39
|
const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
40
|
var _a, _b, _c;
|
|
@@ -30,7 +44,12 @@ const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, funct
|
|
|
30
44
|
(_b = expression.trimWhiteSpace) !== null && _b !== void 0 ? _b : true,
|
|
31
45
|
(_c = expression.excludeTrailing) !== null && _c !== void 0 ? _c : true,
|
|
32
46
|
], config));
|
|
33
|
-
config.typeChecker(
|
|
47
|
+
config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, {
|
|
48
|
+
value,
|
|
49
|
+
delimiter,
|
|
50
|
+
trimWhiteSpace,
|
|
51
|
+
excludeTrailing,
|
|
52
|
+
}));
|
|
34
53
|
let splitValues = value.split(delimiter);
|
|
35
54
|
if (trimWhiteSpace)
|
|
36
55
|
splitValues = splitValues.map((val) => val.trim());
|
|
@@ -43,9 +62,9 @@ const parseChildren = (expression) => {
|
|
|
43
62
|
return Object.assign(Object.assign({}, expression), { value, delimiter });
|
|
44
63
|
};
|
|
45
64
|
exports.SPLIT = {
|
|
46
|
-
requiredProperties,
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
requiredProperties: data_1.requiredProperties,
|
|
66
|
+
propertyAliases: data_1.propertyAliases,
|
|
67
|
+
operatorData: data_1.default,
|
|
49
68
|
evaluate,
|
|
50
69
|
parseChildren,
|
|
51
70
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertyAliases = exports.requiredProperties = void 0;
|
|
4
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
5
|
+
const description = 'Replace values in a string using simple parameter substitution';
|
|
6
|
+
const aliases = ['stringSubstitution', 'substitute', 'stringSub', 'replace'];
|
|
7
|
+
const parameters = [
|
|
8
|
+
{
|
|
9
|
+
name: 'string',
|
|
10
|
+
description: 'A parameterised (%1, %2) string where the parameters are to be replaced',
|
|
11
|
+
aliases: [],
|
|
12
|
+
required: true,
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'substitutions',
|
|
17
|
+
description: 'An array of substitution values for the parameterised string',
|
|
18
|
+
aliases: ['replacements'],
|
|
19
|
+
required: true,
|
|
20
|
+
type: 'array',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
|
|
24
|
+
exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
|
|
25
|
+
const operatorData = {
|
|
26
|
+
description,
|
|
27
|
+
aliases,
|
|
28
|
+
parameters,
|
|
29
|
+
};
|
|
30
|
+
exports.default = operatorData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './operator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./operator"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '
|
|
2
|
-
|
|
1
|
+
import { BaseOperatorNode, EvaluatorNode, OperatorObject } from '../../types';
|
|
2
|
+
import { requiredProperties } from './data';
|
|
3
3
|
export type StringSubNode = {
|
|
4
4
|
[key in typeof requiredProperties[number]]: EvaluatorNode;
|
|
5
5
|
} & BaseOperatorNode;
|
|
6
6
|
export declare const STRING_SUBSTITUTION: OperatorObject;
|
|
7
|
-
export {};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,14 +33,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.STRING_SUBSTITUTION = void 0;
|
|
13
|
-
const _operatorUtils_1 = require("
|
|
14
|
-
const
|
|
15
|
-
const operatorAliases = ['stringSubstitution', 'substitute', 'stringSub', 'replace'];
|
|
16
|
-
const propertyAliases = { replacements: 'substitutions' };
|
|
36
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
37
|
+
const data_1 = __importStar(require("./data"));
|
|
17
38
|
const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
39
|
const [string, ...substitutions] = (yield (0, _operatorUtils_1.evaluateArray)([expression.string, ...expression.substitutions], config));
|
|
19
|
-
config.typeChecker(
|
|
20
|
-
config.typeChecker({ name: 'substitutions', value: substitutions, expectedType: 'array' });
|
|
40
|
+
config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { string, substitutions }));
|
|
21
41
|
const regex = /(%[\d]+)/g;
|
|
22
42
|
const parameters = (string.match(regex) || []).sort((a, b) => Number(a.slice(1)) - Number(b.slice(1)));
|
|
23
43
|
const uniqueParameters = new Set(parameters);
|
|
@@ -32,9 +52,9 @@ const parseChildren = (expression) => {
|
|
|
32
52
|
return Object.assign(Object.assign({}, expression), { string, substitutions });
|
|
33
53
|
};
|
|
34
54
|
exports.STRING_SUBSTITUTION = {
|
|
35
|
-
requiredProperties,
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
requiredProperties: data_1.requiredProperties,
|
|
56
|
+
propertyAliases: data_1.propertyAliases,
|
|
57
|
+
operatorData: data_1.default,
|
|
38
58
|
evaluate,
|
|
39
59
|
parseChildren,
|
|
40
60
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertyAliases = exports.requiredProperties = void 0;
|
|
4
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
5
|
+
const description = 'Subtract one numerical value from another';
|
|
6
|
+
const aliases = ['-', 'subtract', 'minus', 'takeaway'];
|
|
7
|
+
const parameters = [
|
|
8
|
+
{
|
|
9
|
+
name: 'values',
|
|
10
|
+
description: 'Array of values - 2nd element will be subtracted from the first',
|
|
11
|
+
aliases: [],
|
|
12
|
+
required: false,
|
|
13
|
+
type: 'array',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'from',
|
|
17
|
+
description: 'Numerical value that will be subtracted from',
|
|
18
|
+
aliases: ['subtractFrom'],
|
|
19
|
+
required: false,
|
|
20
|
+
type: 'number',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'subtract',
|
|
24
|
+
description: 'Numerical value to subtract',
|
|
25
|
+
aliases: [],
|
|
26
|
+
required: false,
|
|
27
|
+
type: 'number',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
exports.requiredProperties = (0, _operatorUtils_1.getRequiredProperties)(parameters);
|
|
31
|
+
exports.propertyAliases = (0, _operatorUtils_1.getPropertyAliases)(parameters);
|
|
32
|
+
const operatorData = {
|
|
33
|
+
description,
|
|
34
|
+
aliases,
|
|
35
|
+
parameters,
|
|
36
|
+
};
|
|
37
|
+
exports.default = operatorData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './operator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./operator"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BasicExtendedNode } from '
|
|
2
|
-
import { EvaluatorNode, OperatorObject, BaseOperatorNode } from '
|
|
1
|
+
import { BasicExtendedNode } from '../AND/operator';
|
|
2
|
+
import { EvaluatorNode, OperatorObject, BaseOperatorNode } from '../../types';
|
|
3
3
|
interface SubtractionNodeWithProps extends BaseOperatorNode {
|
|
4
4
|
subtract: EvaluatorNode;
|
|
5
5
|
from: EvaluatorNode;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.SUBTRACT = void 0;
|
|
36
|
+
const operator_1 = require("../AND/operator");
|
|
37
|
+
const _operatorUtils_1 = require("../_operatorUtils");
|
|
38
|
+
const data_1 = __importStar(require("./data"));
|
|
39
|
+
const evaluate = (expression, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const [values, from, subtract] = (yield (0, _operatorUtils_1.evaluateArray)([expression.values, expression.from, expression.subtract], config));
|
|
41
|
+
config.typeChecker(...(0, _operatorUtils_1.getTypeCheckInput)(data_1.default.parameters, { values, from, subtract }));
|
|
42
|
+
const vals = values !== null && values !== void 0 ? values : [from, subtract];
|
|
43
|
+
if (vals.length < 2)
|
|
44
|
+
throw new Error('- Not enough values provided');
|
|
45
|
+
return vals[0] - vals[1];
|
|
46
|
+
});
|
|
47
|
+
exports.SUBTRACT = {
|
|
48
|
+
requiredProperties: data_1.requiredProperties,
|
|
49
|
+
propertyAliases: data_1.propertyAliases,
|
|
50
|
+
operatorData: data_1.default,
|
|
51
|
+
evaluate,
|
|
52
|
+
parseChildren: operator_1.parseChildren,
|
|
53
|
+
};
|