@qrvey/formula-lang 0.11.1 → 0.11.3
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/CHANGELOG.md +10 -0
- package/dist/cjs/constants/interfaces.d.ts +15 -6
- package/dist/cjs/errors/definitions.d.ts +19 -17
- package/dist/cjs/errors/definitions.js +31 -26
- package/dist/cjs/errors/definitions.js.map +1 -1
- package/dist/cjs/errors/dictionary.d.ts +1 -4
- package/dist/cjs/errors/dictionary.js +4 -19
- package/dist/cjs/errors/dictionary.js.map +1 -1
- package/dist/cjs/errors/mismatch.d.ts +12 -11
- package/dist/cjs/errors/mismatch.js +33 -15
- package/dist/cjs/errors/mismatch.js.map +1 -1
- package/dist/cjs/functions/datedif.js +3 -3
- package/dist/cjs/functions/datedif.js.map +1 -1
- package/dist/cjs/functions/if.js +26 -3
- package/dist/cjs/functions/if.js.map +1 -1
- package/dist/cjs/functions/ifs.js +35 -9
- package/dist/cjs/functions/ifs.js.map +1 -1
- package/dist/cjs/functions/isNull.js +56 -4
- package/dist/cjs/functions/isNull.js.map +1 -1
- package/dist/cjs/functions/mid.js +33 -1
- package/dist/cjs/functions/mid.js.map +1 -1
- package/dist/cjs/grammar/generated/qformula.lang.js +14 -12
- package/dist/cjs/grammar/generated/qformula.lang.js.map +1 -1
- package/dist/cjs/grammar/generated/qformula.lang.terms.d.ts +20 -20
- package/dist/cjs/grammar/generated/qformula.lang.terms.js +1 -1
- package/dist/cjs/grammar/generated/qformula.lang.terms.js.map +1 -1
- package/dist/cjs/parser/json-parser.js +7 -5
- package/dist/cjs/parser/json-parser.js.map +1 -1
- package/dist/cjs/transpiler/validateFuncStructure.d.ts +1 -1
- package/dist/cjs/transpiler/validateFuncStructure.js +54 -58
- package/dist/cjs/transpiler/validateFuncStructure.js.map +1 -1
- package/dist/cjs/utils/isAColumn.d.ts +2 -3
- package/dist/cjs/utils/isAColumn.js +2 -6
- package/dist/cjs/utils/isAColumn.js.map +1 -1
- package/dist/cjs/utils/isALiteral.d.ts +2 -0
- package/dist/cjs/utils/isALiteral.js +9 -0
- package/dist/cjs/utils/isALiteral.js.map +1 -0
- package/dist/cjs/utils/isBooleanExpression.d.ts +1 -1
- package/dist/cjs/utils/isBooleanExpression.js +9 -5
- package/dist/cjs/utils/isBooleanExpression.js.map +1 -1
- package/dist/cjs/utils/isDateParam.js +8 -2
- package/dist/cjs/utils/isDateParam.js.map +1 -1
- package/dist/cjs/utils/isNumberParam.js +8 -2
- package/dist/cjs/utils/isNumberParam.js.map +1 -1
- package/dist/cjs/utils/isStringParam.js +8 -2
- package/dist/cjs/utils/isStringParam.js.map +1 -1
- package/dist/cjs/utils/primitiveFunctions.d.ts +1 -0
- package/dist/cjs/utils/primitiveFunctions.js +5 -1
- package/dist/cjs/utils/primitiveFunctions.js.map +1 -1
- package/dist/module/constants/interfaces.d.ts +15 -6
- package/dist/module/errors/definitions.d.ts +19 -17
- package/dist/module/errors/definitions.js +27 -22
- package/dist/module/errors/definitions.js.map +1 -1
- package/dist/module/errors/dictionary.d.ts +1 -4
- package/dist/module/errors/dictionary.js +4 -19
- package/dist/module/errors/dictionary.js.map +1 -1
- package/dist/module/errors/mismatch.d.ts +12 -11
- package/dist/module/errors/mismatch.js +35 -17
- package/dist/module/errors/mismatch.js.map +1 -1
- package/dist/module/functions/datedif.js +3 -3
- package/dist/module/functions/datedif.js.map +1 -1
- package/dist/module/functions/if.js +27 -4
- package/dist/module/functions/if.js.map +1 -1
- package/dist/module/functions/ifs.js +36 -10
- package/dist/module/functions/ifs.js.map +1 -1
- package/dist/module/functions/isNull.js +57 -5
- package/dist/module/functions/isNull.js.map +1 -1
- package/dist/module/functions/mid.js +34 -2
- package/dist/module/functions/mid.js.map +1 -1
- package/dist/module/grammar/generated/qformula.lang.js +14 -12
- package/dist/module/grammar/generated/qformula.lang.js.map +1 -1
- package/dist/module/grammar/generated/qformula.lang.terms.d.ts +20 -20
- package/dist/module/grammar/generated/qformula.lang.terms.js +1 -1
- package/dist/module/grammar/generated/qformula.lang.terms.js.map +1 -1
- package/dist/module/parser/json-parser.js +7 -5
- package/dist/module/parser/json-parser.js.map +1 -1
- package/dist/module/transpiler/validateFuncStructure.d.ts +1 -1
- package/dist/module/transpiler/validateFuncStructure.js +55 -59
- package/dist/module/transpiler/validateFuncStructure.js.map +1 -1
- package/dist/module/utils/isAColumn.d.ts +2 -3
- package/dist/module/utils/isAColumn.js +2 -6
- package/dist/module/utils/isAColumn.js.map +1 -1
- package/dist/module/utils/isALiteral.d.ts +2 -0
- package/dist/module/utils/isALiteral.js +5 -0
- package/dist/module/utils/isALiteral.js.map +1 -0
- package/dist/module/utils/isBooleanExpression.d.ts +1 -1
- package/dist/module/utils/isBooleanExpression.js +9 -5
- package/dist/module/utils/isBooleanExpression.js.map +1 -1
- package/dist/module/utils/isDateParam.js +8 -2
- package/dist/module/utils/isDateParam.js.map +1 -1
- package/dist/module/utils/isNumberParam.js +8 -2
- package/dist/module/utils/isNumberParam.js.map +1 -1
- package/dist/module/utils/isStringParam.js +8 -2
- package/dist/module/utils/isStringParam.js.map +1 -1
- package/dist/module/utils/primitiveFunctions.d.ts +1 -0
- package/dist/module/utils/primitiveFunctions.js +3 -0
- package/dist/module/utils/primitiveFunctions.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/utils/isNotAColumn.d.ts +0 -3
- package/dist/cjs/utils/isNotAColumn.js +0 -13
- package/dist/cjs/utils/isNotAColumn.js.map +0 -1
- package/dist/module/utils/isNotAColumn.d.ts +0 -3
- package/dist/module/utils/isNotAColumn.js +0 -9
- package/dist/module/utils/isNotAColumn.js.map +0 -1
|
@@ -5,27 +5,8 @@ const isNull_1 = require("../utils/isNull");
|
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
6
|
const dictionary_1 = require("../errors/dictionary");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
|
-
const primitiveFunctions_1 = require("../utils/primitiveFunctions");
|
|
9
8
|
function validateFuncStructure(definition, args, node) {
|
|
10
|
-
var _a;
|
|
11
|
-
const commonArgs = args.map((arg) => arg.node);
|
|
12
|
-
const primitive = (0, primitiveFunctions_1.getFunctionPrimitive)(definition, commonArgs);
|
|
13
|
-
const singlePrimitive = Array.isArray(primitive) ? undefined : primitive;
|
|
14
|
-
if (!(0, isNull_1.isNull)(definition.maxPrimitiveValues)) {
|
|
15
|
-
const isPrimitiveAllowed = typeof primitive === 'string' ||
|
|
16
|
-
(Array.isArray(primitive) &&
|
|
17
|
-
primitive.length === definition.maxPrimitiveValues);
|
|
18
|
-
if (!isPrimitiveAllowed) {
|
|
19
|
-
const validator = Object.assign({ valid: false, source: constants_1.RESPONSE_LEVEL.function }, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.inferredPrimitive]);
|
|
20
|
-
const { expected, received } = (0, errors_1.validateParameters)(definition, args, singlePrimitive);
|
|
21
|
-
throw new errors_1.FunctionArgumentsMismatch({
|
|
22
|
-
node,
|
|
23
|
-
validator,
|
|
24
|
-
expected,
|
|
25
|
-
received,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
9
|
+
var _a, _b;
|
|
29
10
|
let parameterIndex = 0;
|
|
30
11
|
let argumentIndex = 0;
|
|
31
12
|
const parameters = definition.parameters || [];
|
|
@@ -33,6 +14,9 @@ function validateFuncStructure(definition, args, node) {
|
|
|
33
14
|
parameterIndex += 1;
|
|
34
15
|
argumentIndex += 1;
|
|
35
16
|
};
|
|
17
|
+
const execValidators = [];
|
|
18
|
+
let invalidValidator = false;
|
|
19
|
+
let hasMissmatch = false;
|
|
36
20
|
while (parameterIndex < parameters.length) {
|
|
37
21
|
const parameter = parameters[parameterIndex];
|
|
38
22
|
const { value, dataType } = (_a = args[argumentIndex]) !== null && _a !== void 0 ? _a : {};
|
|
@@ -41,55 +25,67 @@ function validateFuncStructure(definition, args, node) {
|
|
|
41
25
|
continue;
|
|
42
26
|
}
|
|
43
27
|
if ((0, isNull_1.isNull)(value) && !parameter.optional) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
parameter,
|
|
49
|
-
validator,
|
|
50
|
-
expected,
|
|
51
|
-
received,
|
|
52
|
-
});
|
|
28
|
+
invalidValidator = true;
|
|
29
|
+
hasMissmatch = true;
|
|
30
|
+
execValidators.push(Object.assign(Object.assign({ valid: false, source: constants_1.RESPONSE_LEVEL.function }, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingArg]), { parameter,
|
|
31
|
+
argumentIndex }));
|
|
53
32
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
const validatorContext = {
|
|
34
|
+
fnNode: node,
|
|
35
|
+
argument: (_b = args[argumentIndex]) !== null && _b !== void 0 ? _b : {},
|
|
36
|
+
};
|
|
37
|
+
for (const validatorFunction of parameter.validator) {
|
|
38
|
+
const validator = validatorFunction(value, dataType, validatorContext);
|
|
39
|
+
execValidators.push(Object.assign(Object.assign({}, validator), { parameter,
|
|
40
|
+
argumentIndex }));
|
|
57
41
|
if (!validator.valid) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
validator.source = constants_1.RESPONSE_LEVEL.function;
|
|
65
|
-
throw new errors_1.FunctionArgumentsMismatch({
|
|
66
|
-
node,
|
|
67
|
-
parameter,
|
|
68
|
-
validator,
|
|
69
|
-
expected,
|
|
70
|
-
received,
|
|
71
|
-
});
|
|
42
|
+
if (validator.mismatchData && !hasMissmatch)
|
|
43
|
+
hasMissmatch = true;
|
|
44
|
+
if (!invalidValidator)
|
|
45
|
+
invalidValidator = true;
|
|
46
|
+
break;
|
|
72
47
|
}
|
|
73
|
-
}
|
|
48
|
+
}
|
|
74
49
|
incrementCounter();
|
|
75
|
-
const
|
|
76
|
-
|
|
50
|
+
const parameterListCompleted = parameterIndex === parameters.length;
|
|
51
|
+
const hasMoreArguments = argumentIndex < args.length;
|
|
77
52
|
const isRecursive = typeof (definition === null || definition === void 0 ? void 0 : definition.recursiveStartIn) === 'number';
|
|
78
|
-
if (hasMoreArguments && isRecursive) {
|
|
53
|
+
if (parameterListCompleted && hasMoreArguments && isRecursive) {
|
|
79
54
|
parameterIndex = definition.recursiveStartIn;
|
|
80
55
|
}
|
|
81
56
|
}
|
|
57
|
+
if (invalidValidator) {
|
|
58
|
+
if (hasMissmatch) {
|
|
59
|
+
throwFunctionMismatch(definition, args, node, {
|
|
60
|
+
validators: execValidators,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const failedValidator = execValidators.find((val) => !val.valid);
|
|
65
|
+
if (failedValidator)
|
|
66
|
+
throwArgumentError(node, failedValidator);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
82
69
|
if (argumentIndex < args.length) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
throw new errors_1.FunctionArgumentsMismatch({
|
|
86
|
-
node,
|
|
87
|
-
validator,
|
|
88
|
-
expected,
|
|
89
|
-
received,
|
|
70
|
+
throwFunctionMismatch(definition, args, node, {
|
|
71
|
+
error: dictionary_1.ERROR_LIST.tooManyArguments,
|
|
90
72
|
});
|
|
91
73
|
}
|
|
92
|
-
return true;
|
|
93
74
|
}
|
|
94
75
|
exports.validateFuncStructure = validateFuncStructure;
|
|
76
|
+
function throwFunctionMismatch(definition, args, node, validatorInfo, parameter) {
|
|
77
|
+
var _a;
|
|
78
|
+
const baseValidator = Object.assign({ valid: false, source: constants_1.RESPONSE_LEVEL.function }, dictionary_1.ERROR_DICTIONARY[(_a = validatorInfo.error) !== null && _a !== void 0 ? _a : dictionary_1.ERROR_LIST.unknown]);
|
|
79
|
+
const { expected, received, validator } = (0, errors_1.validateParameters)(definition, args, validatorInfo.validators);
|
|
80
|
+
throw new errors_1.FunctionArgumentsMismatch({
|
|
81
|
+
node,
|
|
82
|
+
parameter,
|
|
83
|
+
validator: validator || baseValidator,
|
|
84
|
+
expected,
|
|
85
|
+
received,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function throwArgumentError(node, validator) {
|
|
89
|
+
throw new errors_1.ArgumentValidatorError(node, validator);
|
|
90
|
+
}
|
|
95
91
|
//# sourceMappingURL=validateFuncStructure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateFuncStructure.js","sourceRoot":"","sources":["../../../src/transpiler/validateFuncStructure.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"validateFuncStructure.js","sourceRoot":"","sources":["../../../src/transpiler/validateFuncStructure.ts"],"names":[],"mappings":";;;AAOA,4CAAyC;AAEzC,sCAImB;AACnB,qDAAoE;AACpE,4CAA8C;AAE9C,SAAgB,qBAAqB,CACjC,UAA8B,EAC9B,IAA8B,EAC9B,IAAqB;;IAErB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IAC/C,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC1B,cAAc,IAAI,CAAC,CAAC;QACpB,aAAa,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC;IACF,MAAM,cAAc,GAAiC,EAAE,CAAC;IACxD,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,OAAO,cAAc,GAAG,UAAU,CAAC,MAAM,EAAE;QACvC,MAAM,SAAS,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;QAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAA,IAAI,CAAC,aAAa,CAAC,mCAAI,EAAE,CAAC;QAEtD,IAAI,IAAA,eAAM,EAAC,KAAK,CAAC,IAAI,SAAS,CAAC,QAAQ,EAAE;YACrC,gBAAgB,EAAE,CAAC;YACnB,SAAS;SACZ;QACD,IAAI,IAAA,eAAM,EAAC,KAAK,CA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|
-
export declare function isAColumn(_param: any, _dataType: Primitive | undefined, argument: ProcessNodeResult): ValidatorResponse;
|
|
1
|
+
import { ValidatorParameterContext } from '../constants/interfaces';
|
|
2
|
+
export declare function isAColumn(context: ValidatorParameterContext): boolean;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAColumn = void 0;
|
|
4
|
-
const dictionary_1 = require("../errors/dictionary");
|
|
5
4
|
const constants_1 = require("../constants");
|
|
6
|
-
function isAColumn(
|
|
7
|
-
|
|
8
|
-
if (!valid)
|
|
9
|
-
return Object.assign({ valid }, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingColumnExpression]);
|
|
10
|
-
return { valid };
|
|
5
|
+
function isAColumn(context) {
|
|
6
|
+
return context.argument.type === constants_1.AST_TYPES.column;
|
|
11
7
|
}
|
|
12
8
|
exports.isAColumn = isAColumn;
|
|
13
9
|
//# sourceMappingURL=isAColumn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAColumn.js","sourceRoot":"","sources":["../../../src/utils/isAColumn.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isAColumn.js","sourceRoot":"","sources":["../../../src/utils/isAColumn.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAGzC,SAAgB,SAAS,CAAC,OAAkC;IACxD,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,qBAAS,CAAC,MAAM,CAAC;AACtD,CAAC;AAFD,8BAEC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isALiteral = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function isALiteral(context) {
|
|
6
|
+
return context.argument.type === constants_1.AST_TYPES.literal;
|
|
7
|
+
}
|
|
8
|
+
exports.isALiteral = isALiteral;
|
|
9
|
+
//# sourceMappingURL=isALiteral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isALiteral.js","sourceRoot":"","sources":["../../../src/utils/isALiteral.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAGzC,SAAgB,UAAU,CAAC,OAAkC;IACzD,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,qBAAS,CAAC,OAAO,CAAC;AACvD,CAAC;AAFD,gCAEC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Primitive } from '../constants';
|
|
2
2
|
import { ValidatorResponse } from '../constants/interfaces';
|
|
3
|
-
export declare function isBooleanExpression(
|
|
3
|
+
export declare function isBooleanExpression(_param: any, dataType: Primitive | undefined): ValidatorResponse;
|
|
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isBooleanExpression = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
const dictionary_1 = require("../errors/dictionary");
|
|
6
|
-
function isBooleanExpression(
|
|
6
|
+
function isBooleanExpression(_param, dataType) {
|
|
7
7
|
const valid = dataType === constants_1.AST_PRIMITIVES.BOOLEAN;
|
|
8
|
-
|
|
9
|
-
return Object.assign({ valid }, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.booleanExpression]);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
8
|
+
const baseResponse = {
|
|
12
9
|
valid,
|
|
10
|
+
mismatchData: {
|
|
11
|
+
primitive: constants_1.AST_PRIMITIVES.BOOLEAN,
|
|
12
|
+
},
|
|
13
13
|
};
|
|
14
|
+
if (!valid) {
|
|
15
|
+
return Object.assign(Object.assign({}, baseResponse), dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.booleanExpression]);
|
|
16
|
+
}
|
|
17
|
+
return baseResponse;
|
|
14
18
|
}
|
|
15
19
|
exports.isBooleanExpression = isBooleanExpression;
|
|
16
20
|
//# sourceMappingURL=isBooleanExpression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBooleanExpression.js","sourceRoot":"","sources":["../../../src/utils/isBooleanExpression.ts"],"names":[],"mappings":";;;AAAA,4CAAyD;AAEzD,qDAAoE;AAEpE,SAAgB,mBAAmB,CAC/B,
|
|
1
|
+
{"version":3,"file":"isBooleanExpression.js","sourceRoot":"","sources":["../../../src/utils/isBooleanExpression.ts"],"names":[],"mappings":";;;AAAA,4CAAyD;AAEzD,qDAAoE;AAEpE,SAAgB,mBAAmB,CAC/B,MAAW,EACX,QAA+B;IAE/B,MAAM,KAAK,GAAG,QAAQ,KAAK,0BAAc,CAAC,OAAO,CAAC;IAClD,MAAM,YAAY,GAAG;QACjB,KAAK;QACL,YAAY,EAAE;YACV,SAAS,EAAE,0BAAc,CAAC,OAAO;SACpC;KACJ,CAAC;IACF,IAAI,CAAC,KAAK,EAAE;QACR,uCACO,YAAY,GACZ,6BAAgB,CAAC,uBAAU,CAAC,iBAAiB,CAAC,EACnD;KACL;IACD,OAAO,YAAY,CAAC;AACxB,CAAC;AAlBD,kDAkBC"}
|
|
@@ -5,9 +5,15 @@ const dictionary_1 = require("../errors/dictionary");
|
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
function isDateParam(_param, dataType) {
|
|
7
7
|
const valid = dataType === constants_1.AST_PRIMITIVES.DATE;
|
|
8
|
+
const baseResponse = {
|
|
9
|
+
valid,
|
|
10
|
+
mismatchData: {
|
|
11
|
+
primitive: constants_1.AST_PRIMITIVES.DATE,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
8
14
|
if (!valid)
|
|
9
|
-
return Object.assign({
|
|
10
|
-
return
|
|
15
|
+
return Object.assign(Object.assign({}, baseResponse), dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingDate]);
|
|
16
|
+
return baseResponse;
|
|
11
17
|
}
|
|
12
18
|
exports.isDateParam = isDateParam;
|
|
13
19
|
//# sourceMappingURL=isDateParam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDateParam.js","sourceRoot":"","sources":["../../../src/utils/isDateParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,WAAW,CACvB,MAAW,EACX,QAA+B;IAE/B,MAAM,KAAK,GAAG,QAAQ,KAAK,0BAAc,CAAC,IAAI,CAAC;IAC/C,IAAI,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"isDateParam.js","sourceRoot":"","sources":["../../../src/utils/isDateParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,WAAW,CACvB,MAAW,EACX,QAA+B;IAE/B,MAAM,KAAK,GAAG,QAAQ,KAAK,0BAAc,CAAC,IAAI,CAAC;IAC/C,MAAM,YAAY,GAAG;QACjB,KAAK;QACL,YAAY,EAAE;YACV,SAAS,EAAE,0BAAc,CAAC,IAAI;SACjC;KACJ,CAAC;IACF,IAAI,CAAC,KAAK;QACN,uCAAY,YAAY,GAAK,6BAAgB,CAAC,uBAAU,CAAC,WAAW,CAAC,EAAG;IAC5E,OAAO,YAAY,CAAC;AACxB,CAAC;AAdD,kCAcC"}
|
|
@@ -6,9 +6,15 @@ const constants_1 = require("../constants");
|
|
|
6
6
|
function isNumberParam(param, dataType) {
|
|
7
7
|
const valid = typeof param === constants_1.AST_PRIMITIVES.NUMBER ||
|
|
8
8
|
dataType === constants_1.AST_PRIMITIVES.NUMBER;
|
|
9
|
+
const baseResponse = {
|
|
10
|
+
valid,
|
|
11
|
+
mismatchData: {
|
|
12
|
+
primitive: constants_1.AST_PRIMITIVES.NUMBER,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
9
15
|
if (!valid)
|
|
10
|
-
return Object.assign({
|
|
11
|
-
return
|
|
16
|
+
return Object.assign(Object.assign({}, baseResponse), dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingNumber]);
|
|
17
|
+
return baseResponse;
|
|
12
18
|
}
|
|
13
19
|
exports.isNumberParam = isNumberParam;
|
|
14
20
|
//# sourceMappingURL=isNumberParam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isNumberParam.js","sourceRoot":"","sources":["../../../src/utils/isNumberParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,aAAa,CACzB,KAAU,EACV,QAA+B;IAE/B,MAAM,KAAK,GACP,OAAO,KAAK,KAAK,0BAAc,CAAC,MAAM;QACtC,QAAQ,KAAK,0BAAc,CAAC,MAAM,CAAC;IACvC,IAAI,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"isNumberParam.js","sourceRoot":"","sources":["../../../src/utils/isNumberParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,aAAa,CACzB,KAAU,EACV,QAA+B;IAE/B,MAAM,KAAK,GACP,OAAO,KAAK,KAAK,0BAAc,CAAC,MAAM;QACtC,QAAQ,KAAK,0BAAc,CAAC,MAAM,CAAC;IACvC,MAAM,YAAY,GAAG;QACjB,KAAK;QACL,YAAY,EAAE;YACV,SAAS,EAAE,0BAAc,CAAC,MAAM;SACnC;KACJ,CAAC;IACF,IAAI,CAAC,KAAK;QACN,uCACO,YAAY,GACZ,6BAAgB,CAAC,uBAAU,CAAC,aAAa,CAAC,EAC/C;IACN,OAAO,YAAY,CAAC;AACxB,CAAC;AAnBD,sCAmBC"}
|
|
@@ -6,9 +6,15 @@ const constants_1 = require("../constants");
|
|
|
6
6
|
function isStringParam(param, dataType) {
|
|
7
7
|
const valid = dataType === constants_1.AST_PRIMITIVES.STRING ||
|
|
8
8
|
(dataType === undefined && typeof param === constants_1.AST_PRIMITIVES.STRING);
|
|
9
|
+
const baseResponse = {
|
|
10
|
+
valid,
|
|
11
|
+
mismatchData: {
|
|
12
|
+
primitive: constants_1.AST_PRIMITIVES.STRING,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
9
15
|
if (!valid)
|
|
10
|
-
return Object.assign({
|
|
11
|
-
return
|
|
16
|
+
return Object.assign(Object.assign({}, baseResponse), dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingString]);
|
|
17
|
+
return baseResponse;
|
|
12
18
|
}
|
|
13
19
|
exports.isStringParam = isStringParam;
|
|
14
20
|
//# sourceMappingURL=isStringParam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isStringParam.js","sourceRoot":"","sources":["../../../src/utils/isStringParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,aAAa,CACzB,KAAU,EACV,QAA+B;IAE/B,MAAM,KAAK,GACP,QAAQ,KAAK,0BAAc,CAAC,MAAM;QAClC,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,0BAAc,CAAC,MAAM,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"isStringParam.js","sourceRoot":"","sources":["../../../src/utils/isStringParam.ts"],"names":[],"mappings":";;;AAAA,qDAAoE;AACpE,4CAAyD;AAGzD,SAAgB,aAAa,CACzB,KAAU,EACV,QAA+B;IAE/B,MAAM,KAAK,GACP,QAAQ,KAAK,0BAAc,CAAC,MAAM;QAClC,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,0BAAc,CAAC,MAAM,CAAC,CAAC;IACvE,MAAM,YAAY,GAAG;QACjB,KAAK;QACL,YAAY,EAAE;YACV,SAAS,EAAE,0BAAc,CAAC,MAAM;SACnC;KACJ,CAAC;IACF,IAAI,CAAC,KAAK;QACN,uCACO,YAAY,GACZ,6BAAgB,CAAC,uBAAU,CAAC,aAAa,CAAC,EAC/C;IACN,OAAO,YAAY,CAAC;AACxB,CAAC;AAnBD,sCAmBC"}
|
|
@@ -3,3 +3,4 @@ import { CommonAST, FunctionDefinition } from '../constants/interfaces';
|
|
|
3
3
|
export declare function primitiveIsIncluded(primitive: Primitive, ...allowedPrimitives: AST_PRIMITIVES[]): boolean;
|
|
4
4
|
export declare function getFunctionPrimitive(definition: FunctionDefinition, args: CommonAST[]): Primitive;
|
|
5
5
|
export declare function inferPrimitive(...primitives: Primitive[]): Primitive;
|
|
6
|
+
export declare function isSinglePrimitive(primitive: Primitive): primitive is AST_PRIMITIVES;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inferPrimitive = exports.getFunctionPrimitive = exports.primitiveIsIncluded = void 0;
|
|
3
|
+
exports.isSinglePrimitive = exports.inferPrimitive = exports.getFunctionPrimitive = exports.primitiveIsIncluded = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
function primitiveIsIncluded(primitive, ...allowedPrimitives) {
|
|
6
6
|
const primitives = Array.isArray(primitive) ? primitive : [primitive];
|
|
@@ -36,4 +36,8 @@ function inferPrimitive(...primitives) {
|
|
|
36
36
|
: flattedPrimitives;
|
|
37
37
|
}
|
|
38
38
|
exports.inferPrimitive = inferPrimitive;
|
|
39
|
+
function isSinglePrimitive(primitive) {
|
|
40
|
+
return !Array.isArray(primitive);
|
|
41
|
+
}
|
|
42
|
+
exports.isSinglePrimitive = isSinglePrimitive;
|
|
39
43
|
//# sourceMappingURL=primitiveFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitiveFunctions.js","sourceRoot":"","sources":["../../../src/utils/primitiveFunctions.ts"],"names":[],"mappings":";;;AAAA,4CAAyD;AAGzD,SAAgB,mBAAmB,CAC/B,SAAoB,EACpB,GAAG,iBAAmC;IAEtC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtE,OAAO,UAAU,CA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,CAAC,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC5B,CAAC;AAED,SAAgB,cAAc,CAAC,GAAG,UAAuB;IACrD,MAAM,iBAAiB,GAAG,cAAc,CAAC,GAAG,UAAU,CAAC,CAAC;IACxD,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,0BAAc,CAAC,OAAO,CAAC;IAClE,OAAO,iBAAiB,CAAC,MAAM,KAAK,CAAC;QACjC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACtB,CAAC,CAAC,iBAAiB,CAAC;AAC5B,CAAC;AAND,wCAMC;AAED,SAAgB,iBAAiB,CAC7B,SAAoB;IAEpB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAJD,8CAIC"}
|
|
@@ -6,14 +6,13 @@ interface FunctionElementDefinition {
|
|
|
6
6
|
export interface FunctionDefinition extends FunctionElementDefinition {
|
|
7
7
|
recursiveStartIn?: number;
|
|
8
8
|
transpiler: EnginesFunction;
|
|
9
|
-
parameters?: Array<
|
|
9
|
+
parameters?: Array<FunctionParameter>;
|
|
10
10
|
primitiveResult: Primitive | ((args: CommonAST[]) => Primitive);
|
|
11
|
-
maxPrimitiveValues?: number;
|
|
12
11
|
}
|
|
13
12
|
export type EnginesFunction = {
|
|
14
13
|
[key in ENGINES]: Function;
|
|
15
14
|
};
|
|
16
|
-
export interface
|
|
15
|
+
export interface FunctionParameter extends FunctionElementDefinition {
|
|
17
16
|
optional: boolean;
|
|
18
17
|
generic?: boolean;
|
|
19
18
|
validator: Array<ValidatorFunctionParameter>;
|
|
@@ -24,8 +23,12 @@ export interface ProcessNodeResult {
|
|
|
24
23
|
dataType: Primitive;
|
|
25
24
|
node: CommonAST;
|
|
26
25
|
}
|
|
26
|
+
export interface ValidatorParameterContext {
|
|
27
|
+
fnNode: FunctionCallAST;
|
|
28
|
+
argument: ProcessNodeResult;
|
|
29
|
+
}
|
|
27
30
|
interface ValidatorFunctionParameter {
|
|
28
|
-
(value: any, dataType: Primitive | undefined,
|
|
31
|
+
(value: any, dataType: Primitive | undefined, context: ValidatorParameterContext): ValidatorResponse;
|
|
29
32
|
}
|
|
30
33
|
export interface ValidatorResponse {
|
|
31
34
|
valid: boolean;
|
|
@@ -33,9 +36,15 @@ export interface ValidatorResponse {
|
|
|
33
36
|
source?: RESPONSE_LEVEL;
|
|
34
37
|
message?: string;
|
|
35
38
|
info?: any;
|
|
39
|
+
mismatchData?: ValidatorExpectedInfo;
|
|
40
|
+
}
|
|
41
|
+
export interface ValidatorParameterResponse extends ValidatorResponse {
|
|
42
|
+
parameter: FunctionParameter;
|
|
43
|
+
argumentIndex: number;
|
|
36
44
|
}
|
|
37
|
-
export interface
|
|
38
|
-
|
|
45
|
+
export interface ValidatorExpectedInfo {
|
|
46
|
+
primitive: AST_PRIMITIVES;
|
|
47
|
+
type?: AST_TYPES;
|
|
39
48
|
}
|
|
40
49
|
export interface TranspilationResponse {
|
|
41
50
|
valid: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorDictionary } from './dictionary';
|
|
2
|
+
import { BinaryExpressionAST, CommonAST, FunctionCallAST, FunctionParameter, UnaryExpressionAST, UnknownAST, ValidatorParameterResponse, ValidatorResponse } from '../constants/interfaces';
|
|
2
3
|
import { Primitive } from '../constants';
|
|
3
4
|
export declare class BaseError extends Error {
|
|
4
5
|
code: string;
|
|
@@ -10,15 +11,28 @@ export declare class BaseError extends Error {
|
|
|
10
11
|
export declare class GenericError extends BaseError {
|
|
11
12
|
constructor(message?: string);
|
|
12
13
|
}
|
|
13
|
-
export declare class
|
|
14
|
+
export declare class FunctionError extends BaseError {
|
|
15
|
+
node: FunctionCallAST;
|
|
16
|
+
constructor(node: FunctionCallAST, errorDict: ErrorDictionary);
|
|
17
|
+
}
|
|
18
|
+
export declare class UnknownFunctionError extends FunctionError {
|
|
14
19
|
node: FunctionCallAST;
|
|
15
20
|
constructor(node: FunctionCallAST);
|
|
16
21
|
}
|
|
17
|
-
export declare class
|
|
22
|
+
export declare class ArgumentError extends FunctionError {
|
|
23
|
+
node: FunctionCallAST;
|
|
24
|
+
constructor(node: FunctionCallAST, errorDict: ErrorDictionary);
|
|
25
|
+
}
|
|
26
|
+
export declare class ArgumentValidatorError extends FunctionError {
|
|
18
27
|
node: FunctionCallAST;
|
|
19
|
-
|
|
28
|
+
readonly validator: ValidatorParameterResponse;
|
|
29
|
+
constructor(node: FunctionCallAST, validator: ValidatorParameterResponse);
|
|
30
|
+
}
|
|
31
|
+
export declare class MissingArgumentError extends ArgumentError {
|
|
32
|
+
node: FunctionCallAST;
|
|
33
|
+
parameter: FunctionParameter;
|
|
20
34
|
readonly argumentIndex: number;
|
|
21
|
-
constructor(node: FunctionCallAST, parameter:
|
|
35
|
+
constructor(node: FunctionCallAST, parameter: FunctionParameter, argumentIndex: number);
|
|
22
36
|
toString(): string;
|
|
23
37
|
}
|
|
24
38
|
export declare class MissingParenthesisError extends BaseError {
|
|
@@ -29,10 +43,6 @@ export declare class UnknownTokenError extends BaseError {
|
|
|
29
43
|
node: UnknownAST;
|
|
30
44
|
constructor(node: UnknownAST);
|
|
31
45
|
}
|
|
32
|
-
export declare class NotAllowedExpressionError extends BaseError {
|
|
33
|
-
node: CommonAST;
|
|
34
|
-
constructor(node: CommonAST);
|
|
35
|
-
}
|
|
36
46
|
export declare class NotAllowedOperationError extends BaseError {
|
|
37
47
|
node: UnaryExpressionAST | BinaryExpressionAST;
|
|
38
48
|
constructor(node: UnaryExpressionAST | BinaryExpressionAST);
|
|
@@ -49,15 +59,7 @@ export declare class InvalidArgumentError extends BaseError {
|
|
|
49
59
|
readonly argumentIndex: number;
|
|
50
60
|
constructor(node: FunctionCallAST, validatorResponse: ValidatorResponse, argumentIndex: number);
|
|
51
61
|
}
|
|
52
|
-
export declare class UnknownExpressionError extends BaseError {
|
|
53
|
-
expression: CommonAST;
|
|
54
|
-
constructor(expression: CommonAST);
|
|
55
|
-
}
|
|
56
62
|
export declare class InferredPrimitiveError extends BaseError {
|
|
57
63
|
expression: CommonAST;
|
|
58
64
|
constructor(expression: CommonAST);
|
|
59
65
|
}
|
|
60
|
-
export declare class ArgumentsDataTypeError extends BaseError {
|
|
61
|
-
expression: CommonAST;
|
|
62
|
-
constructor(expression: CommonAST);
|
|
63
|
-
}
|
|
@@ -27,15 +27,38 @@ export class GenericError extends BaseError {
|
|
|
27
27
|
super(ERROR_DICTIONARY[ERROR_LIST.unknown].code, message);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
export class
|
|
30
|
+
export class FunctionError extends BaseError {
|
|
31
|
+
constructor(node, errorDict) {
|
|
32
|
+
super(errorDict.code, errorDict.message, node);
|
|
33
|
+
this.node = node;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class UnknownFunctionError extends FunctionError {
|
|
31
37
|
constructor(node) {
|
|
32
|
-
super(
|
|
38
|
+
super(node, ERROR_DICTIONARY[ERROR_LIST.unknownFunction]);
|
|
39
|
+
this.node = node;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class ArgumentError extends FunctionError {
|
|
43
|
+
constructor(node, errorDict) {
|
|
44
|
+
super(node, errorDict);
|
|
33
45
|
this.node = node;
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
|
-
export class
|
|
48
|
+
export class ArgumentValidatorError extends FunctionError {
|
|
49
|
+
constructor(node, validator) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
super(node, {
|
|
52
|
+
message: (_a = validator.message) !== null && _a !== void 0 ? _a : '',
|
|
53
|
+
code: (_b = validator.code) !== null && _b !== void 0 ? _b : ERROR_LIST.unknown,
|
|
54
|
+
});
|
|
55
|
+
this.node = node;
|
|
56
|
+
this.validator = validator;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export class MissingArgumentError extends ArgumentError {
|
|
37
60
|
constructor(node, parameter, argumentIndex) {
|
|
38
|
-
super(
|
|
61
|
+
super(node, ERROR_DICTIONARY[ERROR_LIST.missingArg]);
|
|
39
62
|
this.node = node;
|
|
40
63
|
this.parameter = parameter;
|
|
41
64
|
this.argumentIndex = argumentIndex;
|
|
@@ -56,12 +79,6 @@ export class UnknownTokenError extends BaseError {
|
|
|
56
79
|
this.node = node;
|
|
57
80
|
}
|
|
58
81
|
}
|
|
59
|
-
export class NotAllowedExpressionError extends BaseError {
|
|
60
|
-
constructor(node) {
|
|
61
|
-
super(ERROR_DICTIONARY[ERROR_LIST.notAllowedExpression].code, ERROR_DICTIONARY[ERROR_LIST.notAllowedExpression].message, node);
|
|
62
|
-
this.node = node;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
82
|
export class NotAllowedOperationError extends BaseError {
|
|
66
83
|
constructor(node) {
|
|
67
84
|
super(ERROR_DICTIONARY[ERROR_LIST.notAllowedOperation].code, ERROR_DICTIONARY[ERROR_LIST.notAllowedOperation].message, node);
|
|
@@ -90,22 +107,10 @@ export class InvalidArgumentError extends BaseError {
|
|
|
90
107
|
this.argumentIndex = argumentIndex;
|
|
91
108
|
}
|
|
92
109
|
}
|
|
93
|
-
export class UnknownExpressionError extends BaseError {
|
|
94
|
-
constructor(expression) {
|
|
95
|
-
super(ERROR_DICTIONARY[ERROR_LIST.unknownExpression].code, ERROR_DICTIONARY[ERROR_LIST.unknownExpression].message, expression);
|
|
96
|
-
this.expression = expression;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
110
|
export class InferredPrimitiveError extends BaseError {
|
|
100
111
|
constructor(expression) {
|
|
101
112
|
super(ERROR_DICTIONARY[ERROR_LIST.inferredPrimitive].code, ERROR_DICTIONARY[ERROR_LIST.inferredPrimitive].message, expression);
|
|
102
113
|
this.expression = expression;
|
|
103
114
|
}
|
|
104
115
|
}
|
|
105
|
-
export class ArgumentsDataTypeError extends BaseError {
|
|
106
|
-
constructor(expression) {
|
|
107
|
-
super(ERROR_DICTIONARY[ERROR_LIST.argumentsDataType].code, ERROR_DICTIONARY[ERROR_LIST.argumentsDataType].message, expression);
|
|
108
|
-
this.expression = expression;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
116
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/errors/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/errors/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAa7E,MAAM,OAAO,SAAU,SAAQ,KAAK;IAChC,YACW,IAAY,EACZ,OAAe,EACf,IAA8C;QAErD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAA0C;QAGrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,QAAQ;;QACJ,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;YACzB,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;SAC1C;aAAM,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;YAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,EAAE,CAAC;SAC7D;aAAM,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;YAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI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,IAAI,cAAc;;QACd,OAAO,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,SAAS,CAAC;IACtC,CAAC;CACJ;AAED,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAChD,YAAmB,IAAqB;QACpC,KAAK,CACD,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAClD,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,OAAO,EACrD,IAAI,CACP,CAAC;QALa,SAAI,GAAJ,IAAI,CAAiB;IAMxC,CAAC;CACJ;AAED,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC/C,YACW,IAAqB,EACrB,iBAAoC,EAC3B,aAAqB;QAErC,KAAK,CACD,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,KAAI,EAAE,EAC7B,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,OAAO,KAAI,EAAE,EAChC,IAAI,CACP,CAAC;QARK,SAAI,GAAJ,IAAI,CAAiB;QACrB,sBAAiB,GAAjB,iBAAiB,CAAmB;QAC3B,kBAAa,GAAb,aAAa,CAAQ;IAOzC,CAAC;CACJ;AAED,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACjD,YAAmB,UAAqB;QACpC,KAAK,CACD,gBAAgB,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,EACnD,gBAAgB,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO,EACtD,UAAU,CACb,CAAC;QALa,eAAU,GAAV,UAAU,CAAW;IAMxC,CAAC;CACJ"}
|
|
@@ -5,16 +5,14 @@ export declare enum ERROR_LIST {
|
|
|
5
5
|
missingString = "missingString",
|
|
6
6
|
missingNumber = "missingNumber",
|
|
7
7
|
missingDate = "missingDate",
|
|
8
|
-
|
|
8
|
+
greaterThan = "greaterThan",
|
|
9
9
|
missingArg = "missingArg",
|
|
10
10
|
missingParenthesis = "missingParenthesis",
|
|
11
11
|
unknownFunction = "unknownFunction",
|
|
12
12
|
unknown = "unknown",
|
|
13
13
|
customDateDifParams = "customDateDifParams",
|
|
14
14
|
tooManyArguments = "tooManyArguments",
|
|
15
|
-
unknownExpression = "unknownExpression",
|
|
16
15
|
unknownToken = "unknownToken",
|
|
17
|
-
notAllowedExpression = "notAllowedExpression",
|
|
18
16
|
notAllowedOperation = "notAllowedOperation",
|
|
19
17
|
outOfRange = "outOfRange",
|
|
20
18
|
invalidCastNumber = "invalidCastNumber",
|
|
@@ -22,7 +20,6 @@ export declare enum ERROR_LIST {
|
|
|
22
20
|
booleanExpression = "booleanExpression",
|
|
23
21
|
missingColumnExpression = "missingColumnExpression",
|
|
24
22
|
noColumnExpression = "noColumnExpression",
|
|
25
|
-
argumentsDataType = "argumentsDataType",
|
|
26
23
|
functionArgumentsMismatch = "functionArgumentsMismatch"
|
|
27
24
|
}
|
|
28
25
|
type ErrorsType = {
|