@qrvey/formula-lang 0.5.1 → 0.6.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/dist/cjs/constants/index.d.ts +0 -27
  3. package/dist/cjs/constants/index.js +1 -86
  4. package/dist/cjs/constants/index.js.map +1 -1
  5. package/dist/cjs/constants/interfaces.d.ts +4 -3
  6. package/dist/cjs/errors/analyzer/elasticsearch.d.ts +8 -0
  7. package/dist/cjs/errors/analyzer/elasticsearch.js +21 -0
  8. package/dist/cjs/errors/analyzer/elasticsearch.js.map +1 -0
  9. package/dist/cjs/errors/analyzer/index.d.ts +3 -0
  10. package/dist/cjs/errors/analyzer/index.js +31 -0
  11. package/dist/cjs/errors/analyzer/index.js.map +1 -0
  12. package/dist/cjs/errors/analyzer/redshift.d.ts +8 -0
  13. package/dist/cjs/errors/analyzer/redshift.js +21 -0
  14. package/dist/cjs/errors/analyzer/redshift.js.map +1 -0
  15. package/dist/cjs/errors/analyzer/snowflake.d.ts +8 -0
  16. package/dist/cjs/errors/analyzer/snowflake.js +25 -0
  17. package/dist/cjs/errors/analyzer/snowflake.js.map +1 -0
  18. package/dist/cjs/errors/definitions.d.ts +5 -2
  19. package/dist/cjs/errors/definitions.js +16 -11
  20. package/dist/cjs/errors/definitions.js.map +1 -1
  21. package/dist/cjs/errors/dictionary.d.ts +27 -0
  22. package/dist/cjs/errors/dictionary.js +89 -0
  23. package/dist/cjs/errors/dictionary.js.map +1 -0
  24. package/dist/cjs/errors/index.d.ts +1 -1
  25. package/dist/cjs/errors/index.js +1 -3
  26. package/dist/cjs/errors/index.js.map +1 -1
  27. package/dist/cjs/functions/datedif.js +2 -2
  28. package/dist/cjs/functions/datedif.js.map +1 -1
  29. package/dist/cjs/index.d.ts +1 -1
  30. package/dist/cjs/index.js +2 -1
  31. package/dist/cjs/index.js.map +1 -1
  32. package/dist/cjs/parser/json-parser.js +7 -3
  33. package/dist/cjs/parser/json-parser.js.map +1 -1
  34. package/dist/cjs/transpiler/formulaErrorList.d.ts +7 -0
  35. package/dist/cjs/transpiler/formulaErrorList.js +28 -0
  36. package/dist/cjs/transpiler/formulaErrorList.js.map +1 -0
  37. package/dist/cjs/transpiler/index.d.ts +9 -8
  38. package/dist/cjs/transpiler/index.js +35 -28
  39. package/dist/cjs/transpiler/index.js.map +1 -1
  40. package/dist/cjs/transpiler/validateFuncStructure.js +1 -1
  41. package/dist/cjs/transpiler/validateFuncStructure.js.map +1 -1
  42. package/dist/cjs/utils/isDateParam.js +2 -2
  43. package/dist/cjs/utils/isDateParam.js.map +1 -1
  44. package/dist/cjs/utils/isNumberParam.js +2 -2
  45. package/dist/cjs/utils/isNumberParam.js.map +1 -1
  46. package/dist/cjs/utils/isPositiveNumberParam.js +2 -2
  47. package/dist/cjs/utils/isPositiveNumberParam.js.map +1 -1
  48. package/dist/cjs/utils/isStringParam.js +2 -2
  49. package/dist/cjs/utils/isStringParam.js.map +1 -1
  50. package/dist/module/constants/index.d.ts +0 -27
  51. package/dist/module/constants/index.js +0 -85
  52. package/dist/module/constants/index.js.map +1 -1
  53. package/dist/module/constants/interfaces.d.ts +4 -3
  54. package/dist/module/errors/analyzer/elasticsearch.d.ts +8 -0
  55. package/dist/module/errors/analyzer/elasticsearch.js +17 -0
  56. package/dist/module/errors/analyzer/elasticsearch.js.map +1 -0
  57. package/dist/module/errors/analyzer/index.d.ts +3 -0
  58. package/dist/module/errors/analyzer/index.js +27 -0
  59. package/dist/module/errors/analyzer/index.js.map +1 -0
  60. package/dist/module/errors/analyzer/redshift.d.ts +8 -0
  61. package/dist/module/errors/analyzer/redshift.js +17 -0
  62. package/dist/module/errors/analyzer/redshift.js.map +1 -0
  63. package/dist/module/errors/analyzer/snowflake.d.ts +8 -0
  64. package/dist/module/errors/analyzer/snowflake.js +21 -0
  65. package/dist/module/errors/analyzer/snowflake.js.map +1 -0
  66. package/dist/module/errors/definitions.d.ts +5 -2
  67. package/dist/module/errors/definitions.js +7 -2
  68. package/dist/module/errors/definitions.js.map +1 -1
  69. package/dist/module/errors/dictionary.d.ts +27 -0
  70. package/dist/module/errors/dictionary.js +86 -0
  71. package/dist/module/errors/dictionary.js.map +1 -0
  72. package/dist/module/errors/index.d.ts +1 -1
  73. package/dist/module/errors/index.js +1 -3
  74. package/dist/module/errors/index.js.map +1 -1
  75. package/dist/module/functions/datedif.js +1 -1
  76. package/dist/module/functions/datedif.js.map +1 -1
  77. package/dist/module/index.d.ts +1 -1
  78. package/dist/module/index.js +1 -1
  79. package/dist/module/index.js.map +1 -1
  80. package/dist/module/parser/json-parser.js +7 -3
  81. package/dist/module/parser/json-parser.js.map +1 -1
  82. package/dist/module/transpiler/formulaErrorList.d.ts +7 -0
  83. package/dist/module/transpiler/formulaErrorList.js +24 -0
  84. package/dist/module/transpiler/formulaErrorList.js.map +1 -0
  85. package/dist/module/transpiler/index.d.ts +9 -8
  86. package/dist/module/transpiler/index.js +35 -28
  87. package/dist/module/transpiler/index.js.map +1 -1
  88. package/dist/module/transpiler/validateFuncStructure.js +1 -1
  89. package/dist/module/transpiler/validateFuncStructure.js.map +1 -1
  90. package/dist/module/utils/isDateParam.js +1 -1
  91. package/dist/module/utils/isDateParam.js.map +1 -1
  92. package/dist/module/utils/isNumberParam.js +1 -1
  93. package/dist/module/utils/isNumberParam.js.map +1 -1
  94. package/dist/module/utils/isPositiveNumberParam.js +1 -1
  95. package/dist/module/utils/isPositiveNumberParam.js.map +1 -1
  96. package/dist/module/utils/isStringParam.js +1 -1
  97. package/dist/module/utils/isStringParam.js.map +1 -1
  98. package/package.json +3 -2
  99. package/.vscode/launch.json +0 -15
  100. package/dist/cjs/errors/elasticsearch.d.ts +0 -24
  101. package/dist/cjs/errors/elasticsearch.js +0 -30
  102. package/dist/cjs/errors/elasticsearch.js.map +0 -1
  103. package/dist/cjs/errors/engineErrors.d.ts +0 -2
  104. package/dist/cjs/errors/engineErrors.js +0 -25
  105. package/dist/cjs/errors/engineErrors.js.map +0 -1
  106. package/dist/cjs/errors/snowflake.d.ts +0 -15
  107. package/dist/cjs/errors/snowflake.js +0 -20
  108. package/dist/cjs/errors/snowflake.js.map +0 -1
  109. package/dist/module/errors/elasticsearch.d.ts +0 -24
  110. package/dist/module/errors/elasticsearch.js +0 -27
  111. package/dist/module/errors/elasticsearch.js.map +0 -1
  112. package/dist/module/errors/engineErrors.d.ts +0 -2
  113. package/dist/module/errors/engineErrors.js +0 -21
  114. package/dist/module/errors/engineErrors.js.map +0 -1
  115. package/dist/module/errors/snowflake.d.ts +0 -15
  116. package/dist/module/errors/snowflake.js +0 -17
  117. package/dist/module/errors/snowflake.js.map +0 -1
  118. package/jest.config.ts +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
- <a name="0.5.0"></a>
2
- # [0.5.0](https://bitbucket.org/qrvey/qrvey_formula_lang/compare/v0.4.0...v0.5.0) (2023-04-27)
1
+ <a name="0.6.0"></a>
2
+ # [0.6.0](https://bitbucket.org/qrvey/qrvey_formula_lang/compare/v0.5.2...v0.6.0) (2023-05-03)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **expressionerror:** thrown an error for invalid and unary expression ([2b156f1](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/2b156f1))
8
+
9
+
10
+ ### Features
11
+
12
+ * **error analyzer:** add a error analyzer ([7db6dcc](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/7db6dcc))
13
+ * **errorhandling:** acumulate errors and return it ([941c9f4](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/941c9f4))
14
+ * **errorhandling:** Refactor error handling ([5c5c418](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/5c5c418))
15
+ * **errorhandling:** Refactor method error acumulation ([9d1ce8d](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/9d1ce8d))
16
+ * **errorhandling:** Refactor transpiler class to set no public methods ([87b0a1a](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/87b0a1a))
17
+ * **runtime error:** analyze error from runtime engines ([6a0e0cd](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/6a0e0cd))
18
+ * (missinargument) Return argument index in missing argument error ([fa94a8b](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/fa94a8b))
19
+ * (missinargument) Return parameter in missing argument error ([e2c1a3e](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/e2c1a3e))
20
+
21
+
22
+
23
+ <a name="0.5.2"></a>
24
+ # [0.5.2](https://bitbucket.org/qrvey/qrvey_formula_lang/compare/v0.4.0...v0.5.0) (2023-04-27)
3
25
 
4
26
 
5
27
  ### Features
@@ -14,32 +14,6 @@ export declare enum AST_TYPES {
14
14
  literal = "Literal",
15
15
  unknown = "Unknown"
16
16
  }
17
- export declare enum ERROR_LIST {
18
- arguments = "arguments",
19
- nulls = "nulls",
20
- floatingPoint = "floatingPoint",
21
- missingString = "missingString",
22
- missingNumber = "missingNumber",
23
- missingDate = "missingDate",
24
- greaterThanZero = "greaterThanZero",
25
- missingArg = "missingArg",
26
- missingParenthesis = "missingParenthesis",
27
- unknownFunction = "unknownFunction",
28
- unknown = "unknown",
29
- customDateDifParams = "customDateDifParams",
30
- tooManyArguments = "tooManyArguments",
31
- unknownExpression = "unknownExpression",
32
- unknownToken = "unknownToken",
33
- notAllowedExpression = "notAllowedExpression"
34
- }
35
- type iErrorsType = {
36
- [key in ERROR_LIST]: IErrorDictionary;
37
- };
38
- interface IErrorDictionary {
39
- message: string;
40
- code: string;
41
- }
42
- export declare const ERROR_DICTIONARY: iErrorsType;
43
17
  export type CustomEngineOperators = {
44
18
  [key in ENGINES]?: {
45
19
  [T: string]: string;
@@ -50,4 +24,3 @@ export declare enum ELASTICSEARCH_SCRIPT_NAMES {
50
24
  dateFormat = "DATE_FORMAT_SCRIPT",
51
25
  setTimezone = "SET_TIMEZONE_SCRIPT"
52
26
  }
53
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ELASTICSEARCH_SCRIPT_NAMES = exports.CustomOperators = exports.ERROR_DICTIONARY = exports.ERROR_LIST = exports.AST_TYPES = exports.ENGINES = void 0;
3
+ exports.ELASTICSEARCH_SCRIPT_NAMES = exports.CustomOperators = exports.AST_TYPES = exports.ENGINES = void 0;
4
4
  var ENGINES;
5
5
  (function (ENGINES) {
6
6
  ENGINES["ELASTICSEARCH"] = "elasticsearch";
@@ -19,91 +19,6 @@ var AST_TYPES;
19
19
  AST_TYPES["literal"] = "Literal";
20
20
  AST_TYPES["unknown"] = "Unknown";
21
21
  })(AST_TYPES = exports.AST_TYPES || (exports.AST_TYPES = {}));
22
- var ERROR_LIST;
23
- (function (ERROR_LIST) {
24
- ERROR_LIST["arguments"] = "arguments";
25
- ERROR_LIST["nulls"] = "nulls";
26
- ERROR_LIST["floatingPoint"] = "floatingPoint";
27
- ERROR_LIST["missingString"] = "missingString";
28
- ERROR_LIST["missingNumber"] = "missingNumber";
29
- ERROR_LIST["missingDate"] = "missingDate";
30
- ERROR_LIST["greaterThanZero"] = "greaterThanZero";
31
- ERROR_LIST["missingArg"] = "missingArg";
32
- ERROR_LIST["missingParenthesis"] = "missingParenthesis";
33
- ERROR_LIST["unknownFunction"] = "unknownFunction";
34
- ERROR_LIST["unknown"] = "unknown";
35
- ERROR_LIST["customDateDifParams"] = "customDateDifParams";
36
- ERROR_LIST["tooManyArguments"] = "tooManyArguments";
37
- ERROR_LIST["unknownExpression"] = "unknownExpression";
38
- ERROR_LIST["unknownToken"] = "unknownToken";
39
- ERROR_LIST["notAllowedExpression"] = "notAllowedExpression";
40
- })(ERROR_LIST = exports.ERROR_LIST || (exports.ERROR_LIST = {}));
41
- exports.ERROR_DICTIONARY = {
42
- [ERROR_LIST.arguments]: {
43
- message: 'Ilegal number of arguments for function',
44
- code: 'NUMBER_ARGS',
45
- },
46
- [ERROR_LIST.nulls]: {
47
- message: 'Can not apply function with null values',
48
- code: 'NULL_FOUNDS',
49
- },
50
- [ERROR_LIST.floatingPoint]: {
51
- message: 'Invalid floating point operation to integer',
52
- code: 'FLOATING_POINT',
53
- },
54
- [ERROR_LIST.missingString]: {
55
- message: 'Element has to be a String',
56
- code: 'MISSING_STRING',
57
- },
58
- [ERROR_LIST.missingNumber]: {
59
- message: 'Element has to be a Number',
60
- code: 'MISSING_NUMBER',
61
- },
62
- [ERROR_LIST.missingDate]: {
63
- message: 'Element has to be a Date',
64
- code: 'MISSING_DATE',
65
- },
66
- [ERROR_LIST.greaterThanZero]: {
67
- message: 'Element has to be greater than 0',
68
- code: 'GREATER_THAN_ZERO',
69
- },
70
- [ERROR_LIST.missingArg]: {
71
- message: 'Missing arguments',
72
- code: 'MISSING_ARG',
73
- },
74
- [ERROR_LIST.missingParenthesis]: {
75
- message: 'Missing parenthesis',
76
- code: 'MISSING_PARENTHESIS',
77
- },
78
- [ERROR_LIST.unknownToken]: {
79
- message: 'Unknown token',
80
- code: 'UNKNOWN_TOKEN',
81
- },
82
- [ERROR_LIST.unknownFunction]: {
83
- message: 'Unknown function',
84
- code: 'UNKNOWN_FUNCTION',
85
- },
86
- [ERROR_LIST.unknown]: {
87
- message: 'Unknown error',
88
- code: 'UNKNOWN',
89
- },
90
- [ERROR_LIST.tooManyArguments]: {
91
- message: 'Too many arguments',
92
- code: 'TOO_MANY_ARGUMENTS',
93
- },
94
- [ERROR_LIST.customDateDifParams]: {
95
- message: 'Unit param have to be equal to: "Y", "M", "D"',
96
- code: 'DATE_DIF_UNIT_PARAM',
97
- },
98
- [ERROR_LIST.unknownExpression]: {
99
- message: 'Unknown expression',
100
- code: 'UNKNOWN_EXPRESSION',
101
- },
102
- [ERROR_LIST.notAllowedExpression]: {
103
- message: 'Expression not allowed',
104
- code: 'NOT_ALLOWED_EXPRESSION',
105
- },
106
- };
107
22
  exports.CustomOperators = {
108
23
  [ENGINES.ELASTICSEARCH]: {
109
24
  '=': '==',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":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AC,EAAE;QAC/B,OAAO,EAAE,wBAAwB;QACjC,IAAI,EAAE,wBAAwB;KACjC;CACJ,CAAC;AAMW,QAAA,eAAe,GAA0B;IAClD,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACrB,GAAG,EAAE,IAAI;KACZ;CACJ,CAAC;AAEF,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IAClC,+DAAiC,CAAA;IACjC,iEAAmC,CAAA;AACvC,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAIX;AAJD,WAAY,OAAO;IACf,0CAA+B,CAAA;IAC/B,kCAAuB,CAAA;IACvB,gCAAqB,CAAA;AACzB,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AAED,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,kDAAqC,CAAA;IACrC,gDAAmC,CAAA;IACnC,0CAA6B,CAAA;IAC7B,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;AACvB,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAMY,QAAA,eAAe,GAA0B;IAClD,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACrB,GAAG,EAAE,IAAI;KACZ;CACJ,CAAC;AAEF,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IAClC,+DAAiC,CAAA;IACjC,iEAAmC,CAAA;AACvC,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC"}
@@ -6,13 +6,13 @@ interface FunctionElementDefinition {
6
6
  }
7
7
  export interface FunctionDefinition extends FunctionElementDefinition {
8
8
  recursiveStartIn?: number;
9
- transpiler: TranspilerEnginesFunction;
9
+ transpiler: EnginesFunction;
10
10
  parameters?: Array<FunctionParameters>;
11
11
  }
12
- export type TranspilerEnginesFunction = {
12
+ export type EnginesFunction = {
13
13
  [key in ENGINES]: Function;
14
14
  };
15
- interface FunctionParameters extends FunctionElementDefinition {
15
+ export interface FunctionParameters extends FunctionElementDefinition {
16
16
  type: string;
17
17
  optional: boolean;
18
18
  validator: Array<ValidatorFunctionParameter>;
@@ -28,6 +28,7 @@ export interface ValidatorResponse {
28
28
  valid: boolean;
29
29
  code?: string;
30
30
  message?: string;
31
+ info?: any;
31
32
  }
32
33
  export interface TranspilationResponse {
33
34
  valid: boolean;
@@ -0,0 +1,8 @@
1
+ import { ERROR_LIST } from '../dictionary';
2
+ export declare function getInfo(errorObj: any): {
3
+ errorList: {
4
+ regex: RegExp;
5
+ value: ERROR_LIST;
6
+ }[];
7
+ messageList: any[];
8
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInfo = void 0;
4
+ const dictionary_1 = require("../dictionary");
5
+ function getInfo(errorObj) {
6
+ const messageList = [];
7
+ const { type: { message }, } = errorObj;
8
+ messageList.push(message);
9
+ return {
10
+ errorList,
11
+ messageList,
12
+ };
13
+ }
14
+ exports.getInfo = getInfo;
15
+ const errorList = [
16
+ {
17
+ regex: /.* Cannot apply .* operation to types .* and .*/,
18
+ value: dictionary_1.ERROR_LIST.unknownToken,
19
+ },
20
+ ];
21
+ //# sourceMappingURL=elasticsearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elasticsearch.js","sourceRoot":"","sources":["../../../../src/errors/analyzer/elasticsearch.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE3C,SAAgB,OAAO,CAAC,QAAa;IACjC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,EACF,IAAI,EAAE,EAAE,OAAO,EAAE,GACpB,GAAG,QAAQ,CAAC;IACb,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO;QACH,SAAS;QACT,WAAW;KACd,CAAC;AACN,CAAC;AAVD,0BAUC;AAED,MAAM,SAAS,GAAG;IACd;QACI,KAAK,EAAE,iDAAiD;QACxD,KAAK,EAAE,uBAAU,CAAC,YAAY;KACjC;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ENGINES } from '../../constants';
2
+ import { ValidatorResponse } from '../../constants/interfaces';
3
+ export declare function errorAnalyzer(engine: ENGINES, errorObj: unknown): ValidatorResponse;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorAnalyzer = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const dictionary_1 = require("../dictionary");
6
+ const snowflake_1 = require("./snowflake");
7
+ const elasticsearch_1 = require("./elasticsearch");
8
+ const redshift_1 = require("./redshift");
9
+ function errorAnalyzer(engine, errorObj) {
10
+ const info = {
11
+ [constants_1.ENGINES.ELASTICSEARCH]: elasticsearch_1.getInfo,
12
+ [constants_1.ENGINES.SNOWFLAKE]: snowflake_1.getInfo,
13
+ [constants_1.ENGINES.REDSHIFT]: redshift_1.getInfo,
14
+ };
15
+ const { errorList, messageList } = info[engine](errorObj);
16
+ const currentError = analyzer(messageList, errorList);
17
+ return Object.assign({ valid: false, info: errorObj }, currentError);
18
+ }
19
+ exports.errorAnalyzer = errorAnalyzer;
20
+ function analyzer(messageList, errorList) {
21
+ let result = dictionary_1.ERROR_DICTIONARY.unknown;
22
+ messageList.forEach((message) => {
23
+ errorList.forEach((element) => {
24
+ const regex = new RegExp(element.regex, 'g');
25
+ if (regex.test(message))
26
+ result = dictionary_1.ERROR_DICTIONARY[element.value];
27
+ });
28
+ });
29
+ return result;
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/errors/analyzer/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAE1C,8CAA8E;AAC9E,2CAAmD;AACnD,mDAA2D;AAC3D,yCAAiD;AAEjD,SAAgB,aAAa,CACzB,MAAe,EACf,QAAiB;IAEjB,MAAM,IAAI,GAAoB;QAC1B,CAAC,mBAAO,CAAC,aAAa,CAAC,EAAE,uBAAa;QACtC,CAAC,mBAAO,CAAC,SAAS,CAAC,EAAE,mBAAS;QAC9B,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE,kBAAQ;KAC/B,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACtD,uBAAS,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAK,YAAY,EAAG;AAC7D,CAAC;AAZD,sCAYC;AAED,SAAS,QAAQ,CACb,WAA0B,EAC1B,SAA2B;IAE3B,IAAI,MAAM,GAAG,6BAAgB,CAAC,OAAO,CAAC;IACtC,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1B,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC7C,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;gBAAE,MAAM,GAAG,6BAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ERROR_LIST } from '../dictionary';
2
+ export declare function getInfo(errorObj: any): {
3
+ errorList: {
4
+ regex: RegExp;
5
+ value: ERROR_LIST;
6
+ }[];
7
+ messageList: any[];
8
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInfo = void 0;
4
+ const dictionary_1 = require("../dictionary");
5
+ function getInfo(errorObj) {
6
+ const messageList = [];
7
+ const { hint: message } = errorObj;
8
+ messageList.push(message);
9
+ return {
10
+ errorList,
11
+ messageList,
12
+ };
13
+ }
14
+ exports.getInfo = getInfo;
15
+ const errorList = [
16
+ {
17
+ regex: /No operator matches the given name and argument type.*/,
18
+ value: dictionary_1.ERROR_LIST.unknownToken,
19
+ },
20
+ ];
21
+ //# sourceMappingURL=redshift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redshift.js","sourceRoot":"","sources":["../../../../src/errors/analyzer/redshift.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE3C,SAAgB,OAAO,CAAC,QAAa;IACjC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IACnC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO;QACH,SAAS;QACT,WAAW;KACd,CAAC;AACN,CAAC;AARD,0BAQC;AAED,MAAM,SAAS,GAAG;IACd;QACI,KAAK,EAAE,wDAAwD;QAC/D,KAAK,EAAE,uBAAU,CAAC,YAAY;KACjC;CACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ERROR_LIST } from '../dictionary';
2
+ export declare function getInfo(errorObj: any): {
3
+ errorList: {
4
+ regex: RegExp;
5
+ value: ERROR_LIST;
6
+ }[];
7
+ messageList: any[];
8
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInfo = void 0;
4
+ const dictionary_1 = require("../dictionary");
5
+ function getInfo(errorObj) {
6
+ const messageList = [];
7
+ const { message } = errorObj;
8
+ messageList.push(message);
9
+ return {
10
+ errorList,
11
+ messageList,
12
+ };
13
+ }
14
+ exports.getInfo = getInfo;
15
+ const errorList = [
16
+ {
17
+ regex: /Invalid floating point operation/,
18
+ value: dictionary_1.ERROR_LIST.floatingPoint,
19
+ },
20
+ {
21
+ regex: /Numeric value .* is not recognized/,
22
+ value: dictionary_1.ERROR_LIST.unknownToken,
23
+ },
24
+ ];
25
+ //# sourceMappingURL=snowflake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snowflake.js","sourceRoot":"","sources":["../../../../src/errors/analyzer/snowflake.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE3C,SAAgB,OAAO,CAAC,QAAa;IACjC,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC7B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO;QACH,SAAS;QACT,WAAW;KACd,CAAC;AACN,CAAC;AARD,0BAQC;AAED,MAAM,SAAS,GAAG;IACd;QACI,KAAK,EAAE,kCAAkC;QACzC,KAAK,EAAE,uBAAU,CAAC,aAAa;KAClC;IACD;QACI,KAAK,EAAE,oCAAoC;QAC3C,KAAK,EAAE,uBAAU,CAAC,YAAY;KACjC;CACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { CommonAST, FunctionCallAST, UnknownAST, ValidatorResponse } from '../constants/interfaces';
1
+ import { CommonAST, FunctionCallAST, FunctionParameters, UnknownAST, ValidatorResponse } from '../constants/interfaces';
2
2
  export declare class BaseError extends Error {
3
3
  code: string;
4
4
  message: string;
@@ -15,7 +15,10 @@ export declare class UnknownFunctionError extends BaseError {
15
15
  }
16
16
  export declare class MissingArgumentError extends BaseError {
17
17
  node: FunctionCallAST;
18
- constructor(node: FunctionCallAST);
18
+ parameter: FunctionParameters;
19
+ readonly argumentIndex: number;
20
+ constructor(node: FunctionCallAST, parameter: FunctionParameters, argumentIndex: number);
21
+ toString(): string;
19
22
  }
20
23
  export declare class MissingParenthesisError extends BaseError {
21
24
  node: FunctionCallAST;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnknownExpressionError = exports.InvalidArgumentError = exports.TooManyArgumentsError = exports.NotAllowedExpressionError = exports.UnknownTokenError = exports.MissingParenthesisError = exports.MissingArgumentError = exports.UnknownFunctionError = exports.GenericError = exports.BaseError = void 0;
4
- const constants_1 = require("../constants");
4
+ const dictionary_1 = require("./dictionary");
5
5
  class BaseError extends Error {
6
6
  constructor(code, message, node) {
7
7
  super(message);
@@ -27,49 +27,54 @@ class BaseError extends Error {
27
27
  }
28
28
  exports.BaseError = BaseError;
29
29
  class GenericError extends BaseError {
30
- constructor(message = constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknown].message) {
31
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknown].code, message);
30
+ constructor(message = dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknown].message) {
31
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknown].code, message);
32
32
  }
33
33
  }
34
34
  exports.GenericError = GenericError;
35
35
  class UnknownFunctionError extends BaseError {
36
36
  constructor(node) {
37
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownFunction].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownFunction].message, node);
37
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownFunction].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownFunction].message, node);
38
38
  this.node = node;
39
39
  }
40
40
  }
41
41
  exports.UnknownFunctionError = UnknownFunctionError;
42
42
  class MissingArgumentError extends BaseError {
43
- constructor(node) {
44
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.missingArg].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.missingArg].message, node);
43
+ constructor(node, parameter, argumentIndex) {
44
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingArg].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingArg].message, node);
45
45
  this.node = node;
46
+ this.parameter = parameter;
47
+ this.argumentIndex = argumentIndex;
48
+ }
49
+ toString() {
50
+ return `${this.code}: ${this.message} ${this.parameter.name}`;
46
51
  }
47
52
  }
48
53
  exports.MissingArgumentError = MissingArgumentError;
49
54
  class MissingParenthesisError extends BaseError {
50
55
  constructor(node) {
51
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.missingParenthesis].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.missingParenthesis].message, node);
56
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingParenthesis].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.missingParenthesis].message, node);
52
57
  this.node = node;
53
58
  }
54
59
  }
55
60
  exports.MissingParenthesisError = MissingParenthesisError;
56
61
  class UnknownTokenError extends BaseError {
57
62
  constructor(node) {
58
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownToken].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownToken].message, node);
63
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownToken].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownToken].message, node);
59
64
  this.node = node;
60
65
  }
61
66
  }
62
67
  exports.UnknownTokenError = UnknownTokenError;
63
68
  class NotAllowedExpressionError extends BaseError {
64
69
  constructor(node) {
65
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.notAllowedExpression].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.notAllowedExpression].message, node);
70
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.notAllowedExpression].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.notAllowedExpression].message, node);
66
71
  this.node = node;
67
72
  }
68
73
  }
69
74
  exports.NotAllowedExpressionError = NotAllowedExpressionError;
70
75
  class TooManyArgumentsError extends BaseError {
71
76
  constructor(node) {
72
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.tooManyArguments].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.tooManyArguments].message, node);
77
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.tooManyArguments].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.tooManyArguments].message, node);
73
78
  this.node = node;
74
79
  }
75
80
  }
@@ -83,7 +88,7 @@ class InvalidArgumentError extends BaseError {
83
88
  exports.InvalidArgumentError = InvalidArgumentError;
84
89
  class UnknownExpressionError extends BaseError {
85
90
  constructor(expression) {
86
- super(constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownExpression].code, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.unknownExpression].message, expression);
91
+ super(dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownExpression].code, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.unknownExpression].message, expression);
87
92
  this.expression = expression;
88
93
  }
89
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/errors/definitions.ts"],"names":[],"mappings":";;;AAAA,4CAA4D;AAQ5D,MAAa,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;SAC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AAa,sBAAuB,SAAQ,SAAS;IACjD,YAAmB,UAAqB;QACpC,KAAK,CACD,6BAAgB,CAAC,uBAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,EACnD,6BAAgB,CAAC,uBAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO,EACtD,UAAU,CACb,CAAC;QALa,eAAU,GAAV,UAAU,CAAW;IAMxC,CAAC;CACJ;AARD,wDAQC"}
@@ -0,0 +1,27 @@
1
+ export declare enum ERROR_LIST {
2
+ arguments = "arguments",
3
+ nulls = "nulls",
4
+ floatingPoint = "floatingPoint",
5
+ missingString = "missingString",
6
+ missingNumber = "missingNumber",
7
+ missingDate = "missingDate",
8
+ greaterThanZero = "greaterThanZero",
9
+ missingArg = "missingArg",
10
+ missingParenthesis = "missingParenthesis",
11
+ unknownFunction = "unknownFunction",
12
+ unknown = "unknown",
13
+ customDateDifParams = "customDateDifParams",
14
+ tooManyArguments = "tooManyArguments",
15
+ unknownExpression = "unknownExpression",
16
+ unknownToken = "unknownToken",
17
+ notAllowedExpression = "notAllowedExpression"
18
+ }
19
+ type ErrorsType = {
20
+ [key in ERROR_LIST]: ErrorDictionary;
21
+ };
22
+ export interface ErrorDictionary {
23
+ message: string;
24
+ code: string;
25
+ }
26
+ export declare const ERROR_DICTIONARY: ErrorsType;
27
+ export {};
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERROR_DICTIONARY = exports.ERROR_LIST = void 0;
4
+ var ERROR_LIST;
5
+ (function (ERROR_LIST) {
6
+ ERROR_LIST["arguments"] = "arguments";
7
+ ERROR_LIST["nulls"] = "nulls";
8
+ ERROR_LIST["floatingPoint"] = "floatingPoint";
9
+ ERROR_LIST["missingString"] = "missingString";
10
+ ERROR_LIST["missingNumber"] = "missingNumber";
11
+ ERROR_LIST["missingDate"] = "missingDate";
12
+ ERROR_LIST["greaterThanZero"] = "greaterThanZero";
13
+ ERROR_LIST["missingArg"] = "missingArg";
14
+ ERROR_LIST["missingParenthesis"] = "missingParenthesis";
15
+ ERROR_LIST["unknownFunction"] = "unknownFunction";
16
+ ERROR_LIST["unknown"] = "unknown";
17
+ ERROR_LIST["customDateDifParams"] = "customDateDifParams";
18
+ ERROR_LIST["tooManyArguments"] = "tooManyArguments";
19
+ ERROR_LIST["unknownExpression"] = "unknownExpression";
20
+ ERROR_LIST["unknownToken"] = "unknownToken";
21
+ ERROR_LIST["notAllowedExpression"] = "notAllowedExpression";
22
+ })(ERROR_LIST = exports.ERROR_LIST || (exports.ERROR_LIST = {}));
23
+ exports.ERROR_DICTIONARY = {
24
+ [ERROR_LIST.arguments]: {
25
+ message: 'Ilegal number of arguments for function',
26
+ code: 'NUMBER_ARGS',
27
+ },
28
+ [ERROR_LIST.nulls]: {
29
+ message: 'Can not apply function with null values',
30
+ code: 'NULL_FOUNDS',
31
+ },
32
+ [ERROR_LIST.floatingPoint]: {
33
+ message: 'Invalid floating point operation to integer',
34
+ code: 'FLOATING_POINT',
35
+ },
36
+ [ERROR_LIST.missingString]: {
37
+ message: 'Element has to be a String',
38
+ code: 'MISSING_STRING',
39
+ },
40
+ [ERROR_LIST.missingNumber]: {
41
+ message: 'Element has to be a Number',
42
+ code: 'MISSING_NUMBER',
43
+ },
44
+ [ERROR_LIST.missingDate]: {
45
+ message: 'Element has to be a Date',
46
+ code: 'MISSING_DATE',
47
+ },
48
+ [ERROR_LIST.greaterThanZero]: {
49
+ message: 'Element has to be greater than 0',
50
+ code: 'GREATER_THAN_ZERO',
51
+ },
52
+ [ERROR_LIST.missingArg]: {
53
+ message: 'Missing arguments',
54
+ code: 'MISSING_ARG',
55
+ },
56
+ [ERROR_LIST.missingParenthesis]: {
57
+ message: 'Missing parenthesis',
58
+ code: 'MISSING_PARENTHESIS',
59
+ },
60
+ [ERROR_LIST.unknownToken]: {
61
+ message: 'Unknown token',
62
+ code: 'UNKNOWN_TOKEN',
63
+ },
64
+ [ERROR_LIST.unknownFunction]: {
65
+ message: 'Unknown function',
66
+ code: 'UNKNOWN_FUNCTION',
67
+ },
68
+ [ERROR_LIST.unknown]: {
69
+ message: 'Unknown error',
70
+ code: 'UNKNOWN',
71
+ },
72
+ [ERROR_LIST.tooManyArguments]: {
73
+ message: 'Too many arguments',
74
+ code: 'TOO_MANY_ARGUMENTS',
75
+ },
76
+ [ERROR_LIST.customDateDifParams]: {
77
+ message: 'Unit param have to be equal to: "Y", "M", "D"',
78
+ code: 'DATE_DIF_UNIT_PARAM',
79
+ },
80
+ [ERROR_LIST.unknownExpression]: {
81
+ message: 'Unknown expression',
82
+ code: 'UNKNOWN_EXPRESSION',
83
+ },
84
+ [ERROR_LIST.notAllowedExpression]: {
85
+ message: 'Expression not allowed',
86
+ code: 'NOT_ALLOWED_EXPRESSION',
87
+ },
88
+ };
89
+ //# sourceMappingURL=dictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/errors/dictionary.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAiBX;AAjBD,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,6BAAe,CAAA;IACf,6CAA+B,CAAA;IAC/B,6CAA+B,CAAA;IAC/B,6CAA+B,CAAA;IAC/B,yCAA2B,CAAA;IAC3B,iDAAmC,CAAA;IACnC,uCAAyB,CAAA;IACzB,uDAAyC,CAAA;IACzC,iDAAmC,CAAA;IACnC,iCAAmB,CAAA;IACnB,yDAA2C,CAAA;IAC3C,mDAAqC,CAAA;IACrC,qDAAuC,CAAA;IACvC,2CAA6B,CAAA;IAC7B,2DAA6C,CAAA;AACjD,CAAC,EAjBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAiBrB;AAWY,QAAA,gBAAgB,GAAe;IACxC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACpB,OAAO,EAAE,yCAAyC;QAClD,IAAI,EAAE,aAAa;KACtB;IACD,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAChB,OAAO,EAA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E,qBAAqB;KAC9B;IACD,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;QAC5B,OAAO,EAAE,oBAAoB;QAC7B,IAAI,EAAE,oBAAoB;KAC7B;IACD,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;QAC/B,OAAO,EAAE,wBAAwB;QACjC,IAAI,EAAE,wBAAwB;KACjC;CACJ,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export * from './definitions';
2
- export * from './engineErrors';
2
+ export * from './analyzer';
@@ -15,7 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./definitions"), exports);
18
- //export * from './elasticsearch';
19
- __exportStar(require("./engineErrors"), exports);
20
- //export * from './snowflake';
18
+ __exportStar(require("./analyzer"), exports);
21
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kCAAkC;AAClC,iDAA+B;AAC/B,8BAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DATEDIF = void 0;
4
- const constants_1 = require("../constants");
4
+ const dictionary_1 = require("../errors/dictionary");
5
5
  const scripts_1 = require("../utils/elasticsearch/scripts");
6
6
  const scripts_2 = require("../utils/sql/scripts");
7
7
  const utils_1 = require("../utils");
@@ -44,7 +44,7 @@ function customValidatorYMD(param) {
44
44
  param = (0, utils_1.removeQuotes)(param);
45
45
  const valid = ['Y', 'M', 'D'].includes(param);
46
46
  if (!valid)
47
- return Object.assign({ valid }, constants_1.ERROR_DICTIONARY[constants_1.ERROR_LIST.customDateDifParams]);
47
+ return Object.assign({ valid }, dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.customDateDifParams]);
48
48
  return { valid };
49
49
  }
50
50
  function elasticsearch(start, end, unit) {