@qrvey/utils 1.11.0-3 → 1.11.0-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/charts/adapters/endpointDataGet.js +0 -1
  2. package/dist/charts/adapters/endpointDataValidators.js +1 -5
  3. package/dist/cjs/charts/adapters/endpointDataGet.js +0 -1
  4. package/dist/cjs/charts/adapters/endpointDataValidators.js +1 -5
  5. package/dist/cjs/column_format/helpers/defineXYChartFormat.js +2 -4
  6. package/dist/cjs/format/format.js +4 -2
  7. package/dist/cjs/format/localization.js +2 -3
  8. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +30 -0
  9. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionsType.d.ts +1 -0
  10. package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +1 -0
  11. package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +139 -0
  12. package/dist/cjs/qrvey/interfaces/IBModel.d.ts +2 -0
  13. package/dist/cjs/qrvey/interfaces/IBModelConnection.d.ts +7 -0
  14. package/dist/cjs/qrvey/interfaces/IBModelConnection.js +2 -0
  15. package/dist/cjs/qrvey/interfaces/index.d.ts +1 -0
  16. package/dist/cjs/qrvey/interfaces/index.js +1 -0
  17. package/dist/cjs/services/adapters/BModelToUIModel.adapter.js +1 -0
  18. package/dist/column_format/helpers/defineXYChartFormat.js +2 -4
  19. package/dist/format/format.js +4 -2
  20. package/dist/format/localization.js +2 -3
  21. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +30 -0
  22. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderFunctionsType.d.ts +1 -0
  23. package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderListModal.d.ts +1 -0
  24. package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +139 -0
  25. package/dist/qrvey/interfaces/IBModel.d.ts +2 -0
  26. package/dist/qrvey/interfaces/IBModelConnection.d.ts +7 -0
  27. package/dist/qrvey/interfaces/IBModelConnection.js +1 -0
  28. package/dist/qrvey/interfaces/index.d.ts +1 -0
  29. package/dist/qrvey/interfaces/index.js +1 -0
  30. package/dist/services/adapters/BModelToUIModel.adapter.js +1 -0
  31. package/package.json +2 -1
@@ -202,7 +202,6 @@ export function getAggFiltersResults(logics = [], summaries = []) {
202
202
  value: expression.value,
203
203
  };
204
204
  }
205
- return;
206
205
  })
207
206
  .filter(Boolean),
208
207
  });
@@ -40,11 +40,7 @@ export function hasMinorVersion(version, current) {
40
40
  const splitVersion = (v) => v.split(".").map((t) => parseInt(t));
41
41
  const currentVersion = splitVersion(current);
42
42
  const chartVersion = splitVersion(version);
43
- if (chartVersion[0] < currentVersion[0])
44
- return true;
45
- else if (chartVersion[1] < currentVersion[1])
46
- return true;
47
- return false;
43
+ return (chartVersion[0] < currentVersion[0] || chartVersion[1] < currentVersion[1]);
48
44
  }
49
45
  export function isColumnDate(column) {
50
46
  if (column == null)
@@ -211,7 +211,6 @@ function getAggFiltersResults(logics = [], summaries = []) {
211
211
  value: expression.value,
212
212
  };
213
213
  }
214
- return;
215
214
  })
216
215
  .filter(Boolean),
217
216
  });
@@ -45,11 +45,7 @@ function hasMinorVersion(version, current) {
45
45
  const splitVersion = (v) => v.split(".").map((t) => parseInt(t));
46
46
  const currentVersion = splitVersion(current);
47
47
  const chartVersion = splitVersion(version);
48
- if (chartVersion[0] < currentVersion[0])
49
- return true;
50
- else if (chartVersion[1] < currentVersion[1])
51
- return true;
52
- return false;
48
+ return (chartVersion[0] < currentVersion[0] || chartVersion[1] < currentVersion[1]);
53
49
  }
54
50
  exports.hasMinorVersion = hasMinorVersion;
55
51
  function isColumnDate(column) {
@@ -22,7 +22,7 @@ const defineXYChartFormat = (column, settings) => {
22
22
  const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup, timeGroup, calculation, } = column;
23
23
  const { shelfType, withoutFormat } = settings;
24
24
  const columnDefaultFormat = defaultFormat || outputFormat;
25
- //Defaults
25
+ // Defaults
26
26
  const defaultText = "Default";
27
27
  const defaultAbb = { type: "NUMERIC", format: "Abbreviated" /* LOCALE_FORMATS.ABBREVIATED */ };
28
28
  const defaultDecimal = { type: "NUMERIC", format: "Decimal" /* LOCALE_FORMATS.DECIMAL */ };
@@ -81,9 +81,7 @@ const defineXYChartFormat = (column, settings) => {
81
81
  hasDefaultFormat)
82
82
  return defaultDecimal;
83
83
  if (isUsedAsNumericColumn) {
84
- if ((isUsedAsNumericColumn &&
85
- (columnCurrentFormat === null || columnCurrentFormat === void 0 ? void 0 : columnCurrentFormat.type) !== COLUMN_1.COLUMN.NUMERIC) ||
86
- withoutFormat)
84
+ if ((columnCurrentFormat === null || columnCurrentFormat === void 0 ? void 0 : columnCurrentFormat.type) !== COLUMN_1.COLUMN.NUMERIC || withoutFormat)
87
85
  return defaultAbb;
88
86
  return columnCurrentFormat;
89
87
  }
@@ -95,8 +95,10 @@ function formatNumber(num, outputFormat, _config) {
95
95
  return (currency +
96
96
  (0, d3_format_1.format)(`,.${num_decimals}f`)(absNum).replace(/\.(%*)$/, "$1"));
97
97
  }
98
- case "Percentage":
99
- return `${(0, d3_format_1.format)(`,.${num_decimals}f`)(_num).replace(/\.(%*)$/, "$1")}%`;
98
+ case "Percentage": {
99
+ const numDecimal = (0, d3_format_1.format)(`,.${num_decimals}f`)(_num);
100
+ return `${numDecimal.replace(/\.(%*)$/, "$1")}%`;
101
+ }
100
102
  case "Scientific":
101
103
  return Number(_num)
102
104
  .toExponential(num_decimals)
@@ -44,9 +44,8 @@ function formatLocaleDate(value, outputFormat, config) {
44
44
  const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, "");
45
45
  const dateParam = getDateWithOffset(dateValue, config === null || config === void 0 ? void 0 : config.offset);
46
46
  let langOpts = options;
47
- if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
48
- if ((0, isDateTimeFormat_1.isDateTimeFormat)(outputFormat))
49
- langOpts = definition_1.DATETIME_OPTIONS;
47
+ if ((outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) && (0, isDateTimeFormat_1.isDateTimeFormat)(outputFormat)) {
48
+ langOpts = definition_1.DATETIME_OPTIONS;
50
49
  }
51
50
  try {
52
51
  const key = lang + JSON.stringify(langOpts);
@@ -28,4 +28,34 @@ export interface II18nFormulaBuilderCreateModal {
28
28
  required_name_toast: string;
29
29
  parameters: string;
30
30
  example: string;
31
+ formula_name_error_character: string;
32
+ formula_name_error_reserved_word: string;
33
+ formula_type: string;
34
+ formula_custom_script_mode: string;
35
+ formula_mode: {
36
+ title: string;
37
+ info: string;
38
+ tab_formula: string;
39
+ tab_testing: string;
40
+ tab_testing_tooltip: string;
41
+ show_columns: string;
42
+ hide_columns: string;
43
+ tooltip_error_name_formula: string;
44
+ tooltip_error_name: string;
45
+ tooltip_error_formula: string;
46
+ switch_editor: string;
47
+ switch_editor_description: string;
48
+ switch_editor_button_continue: string;
49
+ input: string;
50
+ output: string;
51
+ output_result: string;
52
+ output_case: string;
53
+ randomize_data: string;
54
+ randomize_data_tooltip: string;
55
+ console_output_title: string;
56
+ console_output_button: string;
57
+ test_formula: string;
58
+ functions: Record<string, Record<string, string>>;
59
+ editor: Record<string, unknown>;
60
+ };
31
61
  }
@@ -4,4 +4,5 @@ export interface II18nFormulaBuilderFunctionsType {
4
4
  string: string;
5
5
  date: string;
6
6
  aggregate: string;
7
+ logical: string;
7
8
  }
@@ -5,4 +5,5 @@ export interface II18nFormulaBuilderListModal {
5
5
  information_text_link: string;
6
6
  information_text_text: string;
7
7
  title_header: string;
8
+ column_editor_type: string;
8
9
  }
@@ -9,6 +9,7 @@ exports.I18N_FORMULA_BUILDER = {
9
9
  information_text_link: "Learn how to",
10
10
  information_text_text: "create and work with formulas",
11
11
  title_header: "Formulas",
12
+ column_editor_type: "Editor Type",
12
13
  },
13
14
  list_table: {
14
15
  duplicate_copy: "Copy",
@@ -56,6 +57,143 @@ exports.I18N_FORMULA_BUILDER = {
56
57
  required_name_toast: "Formula Name is required.",
57
58
  parameters: "Parameters",
58
59
  example: "Example",
60
+ formula_name_error_character: "The formula name cannot be a special character.",
61
+ formula_name_error_reserved_word: "The formula name cannot be a reserved word: null, true or false.",
62
+ formula_type: "Formula Type",
63
+ formula_custom_script_mode: "Custom Script Mode",
64
+ formula_mode: {
65
+ title: "Formula Mode",
66
+ info: "Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: “MM/DD/YYYY” or “MM/DD/YYYY HH:MM:SS”",
67
+ tab_formula: "Formula",
68
+ tab_testing: "Testing",
69
+ tab_testing_tooltip: "This formula contains errors or is not finished.",
70
+ show_columns: "Show Columns and Functions",
71
+ hide_columns: "Hide Columns and Functions",
72
+ tooltip_error_name_formula: "A name and a valid formula are mandatory to save.",
73
+ tooltip_error_name: "A name is mandatory to save.",
74
+ tooltip_error_formula: "A valid formula is mandatory to save.",
75
+ switch_editor: "Switch Editor",
76
+ switch_editor_description: "Switching formula editors will cause all your progress to be lost. Would you like to continue?",
77
+ switch_editor_button_continue: "Continue",
78
+ input: "Input",
79
+ output: "Output",
80
+ output_case: "Test Case",
81
+ output_result: "Result",
82
+ randomize_data: "Randomize data",
83
+ randomize_data_tooltip: "Refresh the testing data with random data from the dataset.",
84
+ console_output_title: "Console Output",
85
+ console_output_button: "See Console Output",
86
+ test_formula: "Test Formula",
87
+ functions: {
88
+ abs: {
89
+ description: "Returns the absolute value of a number.",
90
+ function_placeholder: "ABS(number)",
91
+ param_number_name: "number",
92
+ param_number_description: "The argument whose absolute value is to be determined. It must be a number a numeric column.",
93
+ },
94
+ datedif: {
95
+ description: "Calculates the difference between two dates based on the date part requested.",
96
+ function_placeholder: "DATEDIF(date_value1, date_value2, 'date_part')",
97
+ param_date_value1_name: "date_value1",
98
+ param_date_value1_description: "The first date value. It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
99
+ param_date_value2_name: "date_value2",
100
+ param_date_value2_description: "The second date value. It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'. This date should always be equal or greater than date_value1.",
101
+ param_date_part_name: "date_part",
102
+ param_date_part_description: "Date part allows: 'Y' the number of complete years in the period, 'M' the number of complete months in the period, 'D' the number of days in the period.",
103
+ },
104
+ day: {
105
+ description: "Returns the day of a date. The day is given as an integer ranging from 1 to 31.",
106
+ function_placeholder: "DAY(date_value1)",
107
+ param_date_value1_name: "date_value1",
108
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
109
+ },
110
+ hour: {
111
+ description: "Returns the hour of a datetime value. The hour is given as an integer ranging from 0 to 23.",
112
+ function_placeholder: "HOUR(date_value1)",
113
+ param_date_value1_name: "date_value1",
114
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
115
+ },
116
+ minute: {
117
+ description: "Returns the minute of a datetime value. The minute is given as an integer ranging from 0 to 59.",
118
+ function_placeholder: "MINUTE(date_value1)",
119
+ param_date_value1_name: "date_value1",
120
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
121
+ },
122
+ second: {
123
+ description: "Returns the second of a datetime value. The second is given as an integer ranging from 0 to 59.",
124
+ function_placeholder: "SECOND(date_value1)",
125
+ param_date_value1_name: "date_value1",
126
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
127
+ },
128
+ year: {
129
+ description: "Returns the year of a date. The year is given as an integer ranging from 1900 to 9999.Parameters",
130
+ function_placeholder: "YEAR(date_value1)",
131
+ param_date_value1_name: "date_value1",
132
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
133
+ },
134
+ month: {
135
+ description: "Returns the month of a date. The month is given as an integer ranging from 1 (January) to 12 (December).",
136
+ function_placeholder: "MONTH(date_value1)",
137
+ param_date_value1_name: "date_value1",
138
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
139
+ },
140
+ if: {
141
+ description: "Performs a logical test and returns a value based on the result.",
142
+ function_placeholder: "IF(logicalTest,valueIfTrue,valueIfFalse)",
143
+ param_logicalTest_name: "logicalTest (required)",
144
+ param_logicalTest_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
145
+ param_valueIfTrue_name: "valueIfTrue (required)",
146
+ param_valueIfTrue_description: "Value that the function will return in case the result of the logicalTest is equal to true. It can be a number, datetime value, boolean or string.",
147
+ param_valueIfFalse_name: "valueIfFalse (optional)",
148
+ param_valueIfFalse_description: "Value that the function will return in case the result of the logicalTest is equal to false. It can be a number, datetime value, boolean or string. If not defined, the function will return false by default.",
149
+ },
150
+ ifs: {
151
+ description: "Allows different logical tests and returns the values set for the first condition equal to true.",
152
+ function_placeholder: "IFS(logicalTest1,valueIfTrue1,logicalTest2,valueIfTrue2,...)",
153
+ param_logicalTest1_name: "logicalTest1 (required)",
154
+ param_logicalTest1_description: "logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
155
+ param_valueIfTrue1_name: "valueIfTrue1 (required)",
156
+ param_valueIfTrue1_description: "Value that the function will return in case the result of the logicalTest1 is equal to true. It can be a number, datetime value, boolean or string.",
157
+ param_logicalTest2_name: "logicalTest2...n (optional)",
158
+ param_logicalTest2_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value. This test will only be evaluated if the previous test was equal to false.",
159
+ param_valueIfTrue2_name: "valueIfTrue2...n (optional)",
160
+ param_valueIfTrue2_description: "Value that the function will return in case the result of the logicalTest2...n is equal to true. It can be a number, datetime value, boolean or string.",
161
+ },
162
+ mid: {
163
+ description: "Returns a specific number of characters from a text string. The resulting substring begins at the specified beginIndex and extends the number of characters specified on numChars.",
164
+ function_placeholder: "MID(string1, beginIndex, numChars)",
165
+ param_string1_name: "string1",
166
+ param_string1_description: "Text string containing the characters you want to extract.",
167
+ param_beginIndex_name: "beginIndex",
168
+ param_beginIndex_description: "The beginning index containing the first character you want to extract.",
169
+ param_numChars_name: "numChars",
170
+ param_numChars_description: "The number of characters you want to extract from the text string starting from beginIndex.",
171
+ },
172
+ },
173
+ editor: {
174
+ error_messages: {
175
+ NUMBER_ARGS: "Ilegal number of arguments for function",
176
+ NULL_FOUNDS: "Can not apply function with null values",
177
+ FLOATING_POINT: "Invalid floating point operation to integer",
178
+ MISSING_STRING: "Element has to be a String",
179
+ MISSING_NUMBER: "Element has to be a Number",
180
+ MISSING_DATE: "Element has to be a Date",
181
+ GREATER_THAN_ZERO: "Element has to be greater than 0",
182
+ MISSING_ARG: "Missing arguments",
183
+ MISSING_PARENTHESIS: "Missing parenthesis",
184
+ UNKNOWN_TOKEN: "Unknown token",
185
+ UNKNOWN_FUNCTION: "Unknown function",
186
+ UNKNOWN: "Unknown error",
187
+ TOO_MANY_ARGUMENTS: "Too many arguments",
188
+ DATE_DIF_UNIT_PARAM: "Unit param have to be equal to: 'Y', 'M', 'D'",
189
+ UNKNOWN_EXPRESSION: "Unknown expression",
190
+ NOT_ALLOWED_EXPRESSION: "Expression not allowed",
191
+ OUT_OF_RANGE: "Expression out of range",
192
+ INVALID_CAST_NUMBER: "Invalid cast number",
193
+ INVALID_BOOLEAN_ARGUMENT: "Invalid boolean argument"
194
+ }
195
+ }
196
+ }
59
197
  },
60
198
  functions_type: {
61
199
  all: "All",
@@ -63,6 +201,7 @@ exports.I18N_FORMULA_BUILDER = {
63
201
  string: "String/Text",
64
202
  date: "Date/Time",
65
203
  aggregate: "Aggregates",
204
+ logical: "Logical",
66
205
  },
67
206
  function_is_null: {
68
207
  description: "Replaces NULL with the specified replacement value.",
@@ -3,6 +3,7 @@ import { IBModelBranchesMap } from "./IBModelBranchesMap";
3
3
  import { IBModelData } from "./IBModelData";
4
4
  import { IAppType } from "./IAppType";
5
5
  import { IBTimezone } from "../../dates/interfaces/IBTimezone";
6
+ import { IBModelConnection } from "./IBModelConnection";
6
7
  export interface IBModel {
7
8
  appType: IAppType;
8
9
  appid: string;
@@ -22,4 +23,5 @@ export interface IBModel {
22
23
  status: IAppStatus;
23
24
  timezone: IBTimezone;
24
25
  userid: string;
26
+ datasources: IBModelConnection[];
25
27
  }
@@ -0,0 +1,7 @@
1
+ export interface IBModelConnection {
2
+ connectionId: string;
3
+ connectorType: string;
4
+ datasourceId: string;
5
+ name: string;
6
+ __connectorTypeSaved: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,6 +4,7 @@ export * from "./IBDataset";
4
4
  export * from "./IBModel";
5
5
  export * from "./IBModelBranchesMapBranch";
6
6
  export * from "./IBModelData";
7
+ export * from "./IBModelConnection";
7
8
  export * from "./ICalculation";
8
9
  export * from "./ICalculationInfo";
9
10
  export * from "./ICalculationType";
@@ -20,6 +20,7 @@ __exportStar(require("./IBDataset"), exports);
20
20
  __exportStar(require("./IBModel"), exports);
21
21
  __exportStar(require("./IBModelBranchesMapBranch"), exports);
22
22
  __exportStar(require("./IBModelData"), exports);
23
+ __exportStar(require("./IBModelConnection"), exports);
23
24
  __exportStar(require("./ICalculation"), exports);
24
25
  __exportStar(require("./ICalculationInfo"), exports);
25
26
  __exportStar(require("./ICalculationType"), exports);
@@ -26,6 +26,7 @@ function BModelToUIModel(model) {
26
26
  status: model.status,
27
27
  timezone: (0, BTimezoneToUITimezone_1.BTimezoneToUITimezone)(model.timezone),
28
28
  userid: model.userid,
29
+ datasources: model.datasources,
29
30
  };
30
31
  }
31
32
  exports.BModelToUIModel = BModelToUIModel;
@@ -19,7 +19,7 @@ export const defineXYChartFormat = (column, settings) => {
19
19
  const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup, timeGroup, calculation, } = column;
20
20
  const { shelfType, withoutFormat } = settings;
21
21
  const columnDefaultFormat = defaultFormat || outputFormat;
22
- //Defaults
22
+ // Defaults
23
23
  const defaultText = "Default";
24
24
  const defaultAbb = { type: "NUMERIC", format: "Abbreviated" /* LOCALE_FORMATS.ABBREVIATED */ };
25
25
  const defaultDecimal = { type: "NUMERIC", format: "Decimal" /* LOCALE_FORMATS.DECIMAL */ };
@@ -78,9 +78,7 @@ export const defineXYChartFormat = (column, settings) => {
78
78
  hasDefaultFormat)
79
79
  return defaultDecimal;
80
80
  if (isUsedAsNumericColumn) {
81
- if ((isUsedAsNumericColumn &&
82
- (columnCurrentFormat === null || columnCurrentFormat === void 0 ? void 0 : columnCurrentFormat.type) !== COLUMN.NUMERIC) ||
83
- withoutFormat)
81
+ if ((columnCurrentFormat === null || columnCurrentFormat === void 0 ? void 0 : columnCurrentFormat.type) !== COLUMN.NUMERIC || withoutFormat)
84
82
  return defaultAbb;
85
83
  return columnCurrentFormat;
86
84
  }
@@ -87,8 +87,10 @@ function formatNumber(num, outputFormat, _config) {
87
87
  return (currency +
88
88
  d3Format(`,.${num_decimals}f`)(absNum).replace(/\.(%*)$/, "$1"));
89
89
  }
90
- case "Percentage":
91
- return `${d3Format(`,.${num_decimals}f`)(_num).replace(/\.(%*)$/, "$1")}%`;
90
+ case "Percentage": {
91
+ const numDecimal = d3Format(`,.${num_decimals}f`)(_num);
92
+ return `${numDecimal.replace(/\.(%*)$/, "$1")}%`;
93
+ }
92
94
  case "Scientific":
93
95
  return Number(_num)
94
96
  .toExponential(num_decimals)
@@ -38,9 +38,8 @@ function formatLocaleDate(value, outputFormat, config) {
38
38
  const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, "");
39
39
  const dateParam = getDateWithOffset(dateValue, config === null || config === void 0 ? void 0 : config.offset);
40
40
  let langOpts = options;
41
- if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
42
- if (isDateTimeFormat(outputFormat))
43
- langOpts = DATETIME_OPTIONS;
41
+ if ((outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) && isDateTimeFormat(outputFormat)) {
42
+ langOpts = DATETIME_OPTIONS;
44
43
  }
45
44
  try {
46
45
  const key = lang + JSON.stringify(langOpts);
@@ -28,4 +28,34 @@ export interface II18nFormulaBuilderCreateModal {
28
28
  required_name_toast: string;
29
29
  parameters: string;
30
30
  example: string;
31
+ formula_name_error_character: string;
32
+ formula_name_error_reserved_word: string;
33
+ formula_type: string;
34
+ formula_custom_script_mode: string;
35
+ formula_mode: {
36
+ title: string;
37
+ info: string;
38
+ tab_formula: string;
39
+ tab_testing: string;
40
+ tab_testing_tooltip: string;
41
+ show_columns: string;
42
+ hide_columns: string;
43
+ tooltip_error_name_formula: string;
44
+ tooltip_error_name: string;
45
+ tooltip_error_formula: string;
46
+ switch_editor: string;
47
+ switch_editor_description: string;
48
+ switch_editor_button_continue: string;
49
+ input: string;
50
+ output: string;
51
+ output_result: string;
52
+ output_case: string;
53
+ randomize_data: string;
54
+ randomize_data_tooltip: string;
55
+ console_output_title: string;
56
+ console_output_button: string;
57
+ test_formula: string;
58
+ functions: Record<string, Record<string, string>>;
59
+ editor: Record<string, unknown>;
60
+ };
31
61
  }
@@ -4,4 +4,5 @@ export interface II18nFormulaBuilderFunctionsType {
4
4
  string: string;
5
5
  date: string;
6
6
  aggregate: string;
7
+ logical: string;
7
8
  }
@@ -5,4 +5,5 @@ export interface II18nFormulaBuilderListModal {
5
5
  information_text_link: string;
6
6
  information_text_text: string;
7
7
  title_header: string;
8
+ column_editor_type: string;
8
9
  }
@@ -6,6 +6,7 @@ export const I18N_FORMULA_BUILDER = {
6
6
  information_text_link: "Learn how to",
7
7
  information_text_text: "create and work with formulas",
8
8
  title_header: "Formulas",
9
+ column_editor_type: "Editor Type",
9
10
  },
10
11
  list_table: {
11
12
  duplicate_copy: "Copy",
@@ -53,6 +54,143 @@ export const I18N_FORMULA_BUILDER = {
53
54
  required_name_toast: "Formula Name is required.",
54
55
  parameters: "Parameters",
55
56
  example: "Example",
57
+ formula_name_error_character: "The formula name cannot be a special character.",
58
+ formula_name_error_reserved_word: "The formula name cannot be a reserved word: null, true or false.",
59
+ formula_type: "Formula Type",
60
+ formula_custom_script_mode: "Custom Script Mode",
61
+ formula_mode: {
62
+ title: "Formula Mode",
63
+ info: "Allows mathematical and logical operators including +, -, *, /, (), =, >, <, >=, <=, <>. Numbers must be entered in en-US format. Date time values should be entered with format: “MM/DD/YYYY” or “MM/DD/YYYY HH:MM:SS”",
64
+ tab_formula: "Formula",
65
+ tab_testing: "Testing",
66
+ tab_testing_tooltip: "This formula contains errors or is not finished.",
67
+ show_columns: "Show Columns and Functions",
68
+ hide_columns: "Hide Columns and Functions",
69
+ tooltip_error_name_formula: "A name and a valid formula are mandatory to save.",
70
+ tooltip_error_name: "A name is mandatory to save.",
71
+ tooltip_error_formula: "A valid formula is mandatory to save.",
72
+ switch_editor: "Switch Editor",
73
+ switch_editor_description: "Switching formula editors will cause all your progress to be lost. Would you like to continue?",
74
+ switch_editor_button_continue: "Continue",
75
+ input: "Input",
76
+ output: "Output",
77
+ output_case: "Test Case",
78
+ output_result: "Result",
79
+ randomize_data: "Randomize data",
80
+ randomize_data_tooltip: "Refresh the testing data with random data from the dataset.",
81
+ console_output_title: "Console Output",
82
+ console_output_button: "See Console Output",
83
+ test_formula: "Test Formula",
84
+ functions: {
85
+ abs: {
86
+ description: "Returns the absolute value of a number.",
87
+ function_placeholder: "ABS(number)",
88
+ param_number_name: "number",
89
+ param_number_description: "The argument whose absolute value is to be determined. It must be a number a numeric column.",
90
+ },
91
+ datedif: {
92
+ description: "Calculates the difference between two dates based on the date part requested.",
93
+ function_placeholder: "DATEDIF(date_value1, date_value2, 'date_part')",
94
+ param_date_value1_name: "date_value1",
95
+ param_date_value1_description: "The first date value. It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
96
+ param_date_value2_name: "date_value2",
97
+ param_date_value2_description: "The second date value. It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'. This date should always be equal or greater than date_value1.",
98
+ param_date_part_name: "date_part",
99
+ param_date_part_description: "Date part allows: 'Y' the number of complete years in the period, 'M' the number of complete months in the period, 'D' the number of days in the period.",
100
+ },
101
+ day: {
102
+ description: "Returns the day of a date. The day is given as an integer ranging from 1 to 31.",
103
+ function_placeholder: "DAY(date_value1)",
104
+ param_date_value1_name: "date_value1",
105
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
106
+ },
107
+ hour: {
108
+ description: "Returns the hour of a datetime value. The hour is given as an integer ranging from 0 to 23.",
109
+ function_placeholder: "HOUR(date_value1)",
110
+ param_date_value1_name: "date_value1",
111
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
112
+ },
113
+ minute: {
114
+ description: "Returns the minute of a datetime value. The minute is given as an integer ranging from 0 to 59.",
115
+ function_placeholder: "MINUTE(date_value1)",
116
+ param_date_value1_name: "date_value1",
117
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
118
+ },
119
+ second: {
120
+ description: "Returns the second of a datetime value. The second is given as an integer ranging from 0 to 59.",
121
+ function_placeholder: "SECOND(date_value1)",
122
+ param_date_value1_name: "date_value1",
123
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS', datetime values without time will be assumed as 00:00:00.",
124
+ },
125
+ year: {
126
+ description: "Returns the year of a date. The year is given as an integer ranging from 1900 to 9999.Parameters",
127
+ function_placeholder: "YEAR(date_value1)",
128
+ param_date_value1_name: "date_value1",
129
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
130
+ },
131
+ month: {
132
+ description: "Returns the month of a date. The month is given as an integer ranging from 1 (January) to 12 (December).",
133
+ function_placeholder: "MONTH(date_value1)",
134
+ param_date_value1_name: "date_value1",
135
+ param_date_value1_description: "It can be a column or a datetime value entered with a format of either 'MM/DD/YYYY' or 'MM/DD/YYYY HH:MM:SS'.",
136
+ },
137
+ if: {
138
+ description: "Performs a logical test and returns a value based on the result.",
139
+ function_placeholder: "IF(logicalTest,valueIfTrue,valueIfFalse)",
140
+ param_logicalTest_name: "logicalTest (required)",
141
+ param_logicalTest_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
142
+ param_valueIfTrue_name: "valueIfTrue (required)",
143
+ param_valueIfTrue_description: "Value that the function will return in case the result of the logicalTest is equal to true. It can be a number, datetime value, boolean or string.",
144
+ param_valueIfFalse_name: "valueIfFalse (optional)",
145
+ param_valueIfFalse_description: "Value that the function will return in case the result of the logicalTest is equal to false. It can be a number, datetime value, boolean or string. If not defined, the function will return false by default.",
146
+ },
147
+ ifs: {
148
+ description: "Allows different logical tests and returns the values set for the first condition equal to true.",
149
+ function_placeholder: "IFS(logicalTest1,valueIfTrue1,logicalTest2,valueIfTrue2,...)",
150
+ param_logicalTest1_name: "logicalTest1 (required)",
151
+ param_logicalTest1_description: "logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value.",
152
+ param_valueIfTrue1_name: "valueIfTrue1 (required)",
153
+ param_valueIfTrue1_description: "Value that the function will return in case the result of the logicalTest1 is equal to true. It can be a number, datetime value, boolean or string.",
154
+ param_logicalTest2_name: "logicalTest2...n (optional)",
155
+ param_logicalTest2_description: "Logical test between two values, it should include logical operators such as =, >, <, >=, <= or <>. This argument can also be anything that returns a boolean value. This test will only be evaluated if the previous test was equal to false.",
156
+ param_valueIfTrue2_name: "valueIfTrue2...n (optional)",
157
+ param_valueIfTrue2_description: "Value that the function will return in case the result of the logicalTest2...n is equal to true. It can be a number, datetime value, boolean or string.",
158
+ },
159
+ mid: {
160
+ description: "Returns a specific number of characters from a text string. The resulting substring begins at the specified beginIndex and extends the number of characters specified on numChars.",
161
+ function_placeholder: "MID(string1, beginIndex, numChars)",
162
+ param_string1_name: "string1",
163
+ param_string1_description: "Text string containing the characters you want to extract.",
164
+ param_beginIndex_name: "beginIndex",
165
+ param_beginIndex_description: "The beginning index containing the first character you want to extract.",
166
+ param_numChars_name: "numChars",
167
+ param_numChars_description: "The number of characters you want to extract from the text string starting from beginIndex.",
168
+ },
169
+ },
170
+ editor: {
171
+ error_messages: {
172
+ NUMBER_ARGS: "Ilegal number of arguments for function",
173
+ NULL_FOUNDS: "Can not apply function with null values",
174
+ FLOATING_POINT: "Invalid floating point operation to integer",
175
+ MISSING_STRING: "Element has to be a String",
176
+ MISSING_NUMBER: "Element has to be a Number",
177
+ MISSING_DATE: "Element has to be a Date",
178
+ GREATER_THAN_ZERO: "Element has to be greater than 0",
179
+ MISSING_ARG: "Missing arguments",
180
+ MISSING_PARENTHESIS: "Missing parenthesis",
181
+ UNKNOWN_TOKEN: "Unknown token",
182
+ UNKNOWN_FUNCTION: "Unknown function",
183
+ UNKNOWN: "Unknown error",
184
+ TOO_MANY_ARGUMENTS: "Too many arguments",
185
+ DATE_DIF_UNIT_PARAM: "Unit param have to be equal to: 'Y', 'M', 'D'",
186
+ UNKNOWN_EXPRESSION: "Unknown expression",
187
+ NOT_ALLOWED_EXPRESSION: "Expression not allowed",
188
+ OUT_OF_RANGE: "Expression out of range",
189
+ INVALID_CAST_NUMBER: "Invalid cast number",
190
+ INVALID_BOOLEAN_ARGUMENT: "Invalid boolean argument"
191
+ }
192
+ }
193
+ }
56
194
  },
57
195
  functions_type: {
58
196
  all: "All",
@@ -60,6 +198,7 @@ export const I18N_FORMULA_BUILDER = {
60
198
  string: "String/Text",
61
199
  date: "Date/Time",
62
200
  aggregate: "Aggregates",
201
+ logical: "Logical",
63
202
  },
64
203
  function_is_null: {
65
204
  description: "Replaces NULL with the specified replacement value.",
@@ -3,6 +3,7 @@ import { IBModelBranchesMap } from "./IBModelBranchesMap";
3
3
  import { IBModelData } from "./IBModelData";
4
4
  import { IAppType } from "./IAppType";
5
5
  import { IBTimezone } from "../../dates/interfaces/IBTimezone";
6
+ import { IBModelConnection } from "./IBModelConnection";
6
7
  export interface IBModel {
7
8
  appType: IAppType;
8
9
  appid: string;
@@ -22,4 +23,5 @@ export interface IBModel {
22
23
  status: IAppStatus;
23
24
  timezone: IBTimezone;
24
25
  userid: string;
26
+ datasources: IBModelConnection[];
25
27
  }
@@ -0,0 +1,7 @@
1
+ export interface IBModelConnection {
2
+ connectionId: string;
3
+ connectorType: string;
4
+ datasourceId: string;
5
+ name: string;
6
+ __connectorTypeSaved: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,6 +4,7 @@ export * from "./IBDataset";
4
4
  export * from "./IBModel";
5
5
  export * from "./IBModelBranchesMapBranch";
6
6
  export * from "./IBModelData";
7
+ export * from "./IBModelConnection";
7
8
  export * from "./ICalculation";
8
9
  export * from "./ICalculationInfo";
9
10
  export * from "./ICalculationType";
@@ -4,6 +4,7 @@ export * from "./IBDataset";
4
4
  export * from "./IBModel";
5
5
  export * from "./IBModelBranchesMapBranch";
6
6
  export * from "./IBModelData";
7
+ export * from "./IBModelConnection";
7
8
  export * from "./ICalculation";
8
9
  export * from "./ICalculationInfo";
9
10
  export * from "./ICalculationType";
@@ -23,5 +23,6 @@ export function BModelToUIModel(model) {
23
23
  status: model.status,
24
24
  timezone: BTimezoneToUITimezone(model.timezone),
25
25
  userid: model.userid,
26
+ datasources: model.datasources,
26
27
  };
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.11.0-3",
3
+ "version": "1.11.0-5",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "eslint": "8.33.0",
32
32
  "eslint-config-prettier": "8.6.0",
33
33
  "eslint-plugin-prettier": "4.2.1",
34
+ "eslint-plugin-sonarjs": "0.19.0",
34
35
  "husky": "8.0.3",
35
36
  "jest": "29.4.1",
36
37
  "lint-staged": "13.1.0",