@cellaware/utils 8.7.4 → 8.7.6

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.
@@ -6,7 +6,7 @@ const COSMOS_SQL_ACTION_WORDS_REGEX = /\b(insert|update|delete|create|alter|drop
6
6
  const COSMOS_SQL_SELECT_REGEX = /\b(select)\b/gmi;
7
7
  const COSMOS_SQL_FROM_REGEX = /\b(from)\b/gmi;
8
8
  const COSMOS_SQL_WHERE_REGEX = /\b(where)\b/gmi;
9
- const COSMOS_SQL_APPROVED_TABLES_REGEX = /\b(alert_executions|alert_subscriptions|alerts|client_configs|conversation_details|conversation_feedback|conversation_headers|conversation_metadata|conversation_removed_details|conversation_sampled_details|conversation_sampled_metadata|dashboard_usage|dashboard_widgets|dashboards|notifications|notifications_poll|report_lines|report_schedules|report_usage|reports|user_roles)\b/gmi;
9
+ const COSMOS_SQL_APPROVED_TABLES_REGEX = /\b(alert_executions|alert_subscriptions|alerts|client_configs|conversation_details|conversation_feedback|conversation_headers|conversation_metadata|conversation_removed_details|conversation_sampled_details|conversation_sampled_metadata|dashboard_usage|dashboard_widgets|dashboards|errors_temp|notifications|notifications_poll|report_lines|report_schedules|report_usage|reports|subscription_integrations|user_roles)\b/gmi;
10
10
  const _SUBQUERY_QUERY_PLACEHOLDER_UNWRAPPED = '{{query}}';
11
11
  const SUBQUERY_QUERY_PLACEHOLDER = `(${_SUBQUERY_QUERY_PLACEHOLDER_UNWRAPPED})`;
12
12
  const VARIABLE_COSMOS_USER_ID = '__USER_ID__';
@@ -116,6 +116,10 @@ const COSMOS_TABLES = [
116
116
  table_name: 'dashboards',
117
117
  table_description: 'Dashboards'
118
118
  },
119
+ {
120
+ table_name: 'errors_temp',
121
+ table_description: 'Temporary error collection'
122
+ },
119
123
  {
120
124
  table_name: 'notifications',
121
125
  table_description: 'Notifications'
@@ -140,6 +144,10 @@ const COSMOS_TABLES = [
140
144
  table_name: 'reports',
141
145
  table_description: 'Reports'
142
146
  },
147
+ {
148
+ table_name: 'subscription_integrations',
149
+ table_description: 'Subscription Integrations'
150
+ },
143
151
  {
144
152
  table_name: 'user_roles',
145
153
  table_description: 'User Roles'
@@ -148,7 +148,7 @@ export declare function codifyCondition(condition: DatagridCondition): string;
148
148
  *
149
149
  * https://github.com/cellaware/chatwms-az-swa-ng/blob/development/src/app/utils/data.ts#L126
150
150
  */
151
- export declare function stripNumericValueFormat(value: string | number | undefined): any;
151
+ export declare function stripNumericValueFormat(value: string | number | null | undefined): any;
152
152
  interface HtmlColumnStyle {
153
153
  columnName: string;
154
154
  styles: string[];
@@ -18,11 +18,14 @@ export function initVisualDatagridState() {
18
18
  }
19
19
  export const DEFAULT_VALUE_FORMAT_VALUE = 'none';
20
20
  export function evaluateValueFormat(colFmt, value, locale) {
21
- if (value == null)
21
+ // NOTE: this syntax checks for both undefined and null.
22
+ if (value == null) {
22
23
  return value;
24
+ }
23
25
  const fmt = colFmt.valueFormat;
24
- if (!fmt)
26
+ if (!fmt) {
25
27
  return value;
28
+ }
26
29
  try {
27
30
  switch (colFmt.type) {
28
31
  case 'text':
@@ -43,8 +46,9 @@ function formatTextEnabled(fmt) {
43
46
  return fmt.txtCaseVal !== DEFAULT_VALUE_FORMAT_VALUE;
44
47
  }
45
48
  function formatText(value, fmt) {
46
- if (!formatTextEnabled(fmt))
49
+ if (!formatTextEnabled(fmt)) {
47
50
  return value;
51
+ }
48
52
  const str = String(value);
49
53
  switch (fmt.txtCaseVal) {
50
54
  case 'lower': return str.toLowerCase();
@@ -66,11 +70,13 @@ export function formatNumberEnabled(fmt) {
66
70
  fmt.numRoundVal !== DEFAULT_VALUE_FORMAT_VALUE;
67
71
  }
68
72
  function formatNumber(value, fmt) {
69
- if (!formatNumberEnabled(fmt))
73
+ if (!formatNumberEnabled(fmt)) {
70
74
  return value;
75
+ }
71
76
  let num = parseFloat(value);
72
- if (isNaN(num))
77
+ if (isNaN(num)) {
73
78
  return value;
79
+ }
74
80
  /*
75
81
  We need to be intentional about the order of operations for number formatting.
76
82
  For example, some formatting operations will transform the number to a string.
@@ -463,12 +469,18 @@ export function codifyCondition(condition) {
463
469
  * https://github.com/cellaware/chatwms-az-swa-ng/blob/development/src/app/utils/data.ts#L126
464
470
  */
465
471
  export function stripNumericValueFormat(value) {
466
- if (value === undefined)
472
+ // NOTE: this syntax checks for both undefined and null.
473
+ if (value == null) {
467
474
  return null;
468
- if (typeof value === 'number')
475
+ }
476
+ if (typeof value === 'number') {
469
477
  return value;
478
+ }
470
479
  // Remove commas, dollar signs, percent signs
471
480
  const cleaned = value.replace(/[$,%]/g, '').replace(/,/g, '');
481
+ // NOTE: not sure we need this based on how this function is used in these contexts...
482
+ // const number = parseFloat(cleaned);
483
+ // return isNaN(number) ? null : number;
472
484
  return cleaned;
473
485
  }
474
486
  function buildDatagridConditionEvaluator(condition) {
@@ -723,8 +735,9 @@ function pivotData(data, rowGroupCols, pivotCols, valueCols) {
723
735
  function groupAndAggregate(data, rowGroupCols, groupKeys, valueCols) {
724
736
  const level = groupKeys.length;
725
737
  const groupField = rowGroupCols[level]?.field;
726
- if (!groupField)
738
+ if (!groupField) {
727
739
  return data;
740
+ }
728
741
  const grouped = new Map();
729
742
  for (const row of data) {
730
743
  const key = row[groupField];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.7.4",
3
+ "version": "8.7.6",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",