@cellaware/utils 7.2.5 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatwms/alerts.d.ts +86 -0
- package/dist/chatwms/alerts.js +62 -0
- package/dist/chatwms/client.d.ts +4 -0
- package/dist/chatwms/client.js +3 -0
- package/dist/chatwms/dashboards.d.ts +80 -0
- package/dist/chatwms/dashboards.js +17 -0
- package/dist/chatwms/datagrid.d.ts +120 -0
- package/dist/chatwms/datagrid.js +781 -0
- package/dist/chatwms/developer.d.ts +27 -0
- package/dist/chatwms/developer.js +12 -0
- package/dist/chatwms/reports.d.ts +66 -0
- package/dist/chatwms/reports.js +24 -0
- package/dist/chatwms/search.d.ts +12 -0
- package/dist/chatwms/search.js +9 -0
- package/dist/util.d.ts +10 -2
- package/dist/util.js +64 -19
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DataContext } from "./client.js";
|
|
2
|
+
import { DatagridCondition, DatagridStateBase } from "./datagrid.js";
|
|
3
|
+
export declare const ALERT_VISIBILITY_PRIVATE = "private";
|
|
4
|
+
export declare const ALERT_VISIBILITY_PUBLIC = "public";
|
|
5
|
+
/**
|
|
6
|
+
* Alert Strategy
|
|
7
|
+
*
|
|
8
|
+
* The strategy influences alert sending behavior when the previous alert execution
|
|
9
|
+
* resulted in the condition being met/alert being sent. Traditionally, alert systems
|
|
10
|
+
* will just send notifications over and over while the condition is met. This may be
|
|
11
|
+
* good sometimes, but could be very annoying otherwise. The strategy allows users to
|
|
12
|
+
* configure this behavior.
|
|
13
|
+
*
|
|
14
|
+
* - once: will send once when the condition is met and will not send again until the condition
|
|
15
|
+
* is no longer met
|
|
16
|
+
* - change: if the condition is met, will send if there was a meaningful change in the data
|
|
17
|
+
* since last execution
|
|
18
|
+
* - always: sends every time as long as the condition is met
|
|
19
|
+
*/
|
|
20
|
+
export declare const ALERT_STRATEGY_ONCE = "once";
|
|
21
|
+
export declare const ALERT_STRATEGY_CHANGE = "change";
|
|
22
|
+
export declare const ALERT_STRATEGY_ALWAYS = "always";
|
|
23
|
+
export interface Alert {
|
|
24
|
+
alertId: string;
|
|
25
|
+
alertTitle: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
visibility: string;
|
|
28
|
+
readonly: boolean;
|
|
29
|
+
folder: string;
|
|
30
|
+
strategy: string;
|
|
31
|
+
contentInfo: AlertContentInfo;
|
|
32
|
+
conditionInfo: DatagridCondition;
|
|
33
|
+
clientId: string;
|
|
34
|
+
userId: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function initAlert(): Alert;
|
|
37
|
+
export interface InstanceAlert extends Alert {
|
|
38
|
+
subscriptions: AlertSubscription[];
|
|
39
|
+
}
|
|
40
|
+
export interface AlertWithSubscriptions extends Alert {
|
|
41
|
+
subscriptions: AlertSubscriptionType[];
|
|
42
|
+
lastMet: string;
|
|
43
|
+
lastSent: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AlertContentInfo extends DatagridStateBase {
|
|
46
|
+
contextName: DataContext;
|
|
47
|
+
specification: string;
|
|
48
|
+
query: string;
|
|
49
|
+
summary: string;
|
|
50
|
+
reviewOk?: boolean;
|
|
51
|
+
reviewConfidence?: string;
|
|
52
|
+
reviewFeedback?: string;
|
|
53
|
+
tableGroups?: string[];
|
|
54
|
+
developer?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface AlertTestResult {
|
|
57
|
+
met: boolean;
|
|
58
|
+
rows: any[];
|
|
59
|
+
hashedRows: string[];
|
|
60
|
+
}
|
|
61
|
+
export declare function initAlertTestResult(): AlertTestResult;
|
|
62
|
+
export interface AlertExecution {
|
|
63
|
+
alertId: string;
|
|
64
|
+
alertTitle: string;
|
|
65
|
+
strategy: string;
|
|
66
|
+
conditionInfo: DatagridCondition;
|
|
67
|
+
met: boolean;
|
|
68
|
+
hashedRows: string[];
|
|
69
|
+
error: string;
|
|
70
|
+
sent: boolean;
|
|
71
|
+
clientId: string;
|
|
72
|
+
customer: string;
|
|
73
|
+
warehouse: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
datetime: Date;
|
|
76
|
+
}
|
|
77
|
+
export type AlertSubscriptionType = 'popup' | 'email' | 'teams';
|
|
78
|
+
export declare const ALERT_SUBSCRIPTION_TYPES: string[];
|
|
79
|
+
export interface AlertSubscription {
|
|
80
|
+
alertId: string;
|
|
81
|
+
type: AlertSubscriptionType;
|
|
82
|
+
clientId: string;
|
|
83
|
+
userId: string;
|
|
84
|
+
userDetails: string;
|
|
85
|
+
}
|
|
86
|
+
export declare function initAlertSubscription(): AlertSubscription;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CHATWMS_CONTEXT_NAME } from "./client.js";
|
|
2
|
+
import { initDatagridCondition } from "./datagrid.js";
|
|
3
|
+
export const ALERT_VISIBILITY_PRIVATE = 'private';
|
|
4
|
+
export const ALERT_VISIBILITY_PUBLIC = 'public';
|
|
5
|
+
/**
|
|
6
|
+
* Alert Strategy
|
|
7
|
+
*
|
|
8
|
+
* The strategy influences alert sending behavior when the previous alert execution
|
|
9
|
+
* resulted in the condition being met/alert being sent. Traditionally, alert systems
|
|
10
|
+
* will just send notifications over and over while the condition is met. This may be
|
|
11
|
+
* good sometimes, but could be very annoying otherwise. The strategy allows users to
|
|
12
|
+
* configure this behavior.
|
|
13
|
+
*
|
|
14
|
+
* - once: will send once when the condition is met and will not send again until the condition
|
|
15
|
+
* is no longer met
|
|
16
|
+
* - change: if the condition is met, will send if there was a meaningful change in the data
|
|
17
|
+
* since last execution
|
|
18
|
+
* - always: sends every time as long as the condition is met
|
|
19
|
+
*/
|
|
20
|
+
export const ALERT_STRATEGY_ONCE = 'once';
|
|
21
|
+
export const ALERT_STRATEGY_CHANGE = 'change';
|
|
22
|
+
export const ALERT_STRATEGY_ALWAYS = 'always';
|
|
23
|
+
export function initAlert() {
|
|
24
|
+
return {
|
|
25
|
+
alertId: '',
|
|
26
|
+
alertTitle: '',
|
|
27
|
+
enabled: false,
|
|
28
|
+
visibility: ALERT_VISIBILITY_PRIVATE,
|
|
29
|
+
readonly: false,
|
|
30
|
+
folder: '',
|
|
31
|
+
strategy: ALERT_STRATEGY_ONCE,
|
|
32
|
+
contentInfo: initAlertContentInfo(),
|
|
33
|
+
conditionInfo: initDatagridCondition(),
|
|
34
|
+
clientId: '',
|
|
35
|
+
userId: ''
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function initAlertContentInfo() {
|
|
39
|
+
return {
|
|
40
|
+
contextName: CHATWMS_CONTEXT_NAME,
|
|
41
|
+
specification: '',
|
|
42
|
+
query: '',
|
|
43
|
+
summary: ''
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function initAlertTestResult() {
|
|
47
|
+
return {
|
|
48
|
+
met: false,
|
|
49
|
+
rows: [],
|
|
50
|
+
hashedRows: []
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export const ALERT_SUBSCRIPTION_TYPES = ['popup', 'email', 'teams'];
|
|
54
|
+
export function initAlertSubscription() {
|
|
55
|
+
return {
|
|
56
|
+
alertId: '',
|
|
57
|
+
type: 'email',
|
|
58
|
+
clientId: '',
|
|
59
|
+
userId: '',
|
|
60
|
+
userDetails: ''
|
|
61
|
+
};
|
|
62
|
+
}
|
package/dist/chatwms/client.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const CHATWMS_GENERIC_CLIENT_ID = "chatwms";
|
|
2
|
+
export declare const CHATWMS_CONTEXT_NAME = "chatwms";
|
|
3
|
+
export declare const DATABASE_CONTEXT_NAME = "database";
|
|
4
|
+
export declare const COSMOS_CONTEXT_NAME = "cosmos";
|
|
5
|
+
export type DataContext = 'chatwms' | 'database' | 'cosmos';
|
|
2
6
|
export declare function chatwmsGetClientId(customer: string, warehouse: string): string;
|
|
3
7
|
export declare function chatwmsGetWarehouseFromClientId(clientId: string, customer: string): string;
|
|
4
8
|
export declare function chatwmsGetWarehouse(warehouse: string, organization?: string): string;
|
package/dist/chatwms/client.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export const CHATWMS_GENERIC_CLIENT_ID = 'chatwms';
|
|
2
|
+
export const CHATWMS_CONTEXT_NAME = 'chatwms';
|
|
3
|
+
export const DATABASE_CONTEXT_NAME = 'database';
|
|
4
|
+
export const COSMOS_CONTEXT_NAME = 'cosmos';
|
|
2
5
|
export function chatwmsGetClientId(customer, warehouse) {
|
|
3
6
|
return `${customer}_${warehouse}`;
|
|
4
7
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DataContext } from "./client.js";
|
|
2
|
+
import { DatagridStateBase } from "./datagrid.js";
|
|
3
|
+
export declare const DASHBOARD_VISIBILITY_PRIVATE = "private";
|
|
4
|
+
export declare const DASHBOARD_VISIBILITY_PUBLIC = "public";
|
|
5
|
+
export declare const DASHBOARD_VISIBILITY_GLOBAL = "global";
|
|
6
|
+
export interface DashboardFilter {
|
|
7
|
+
sequence: number;
|
|
8
|
+
name: string;
|
|
9
|
+
sortDescending: boolean;
|
|
10
|
+
defaultValue: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DashboardParameter {
|
|
13
|
+
sequence: number;
|
|
14
|
+
name: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
exampleValue: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Dashboard {
|
|
19
|
+
dashboardId: string;
|
|
20
|
+
dashboardTitle: string;
|
|
21
|
+
dashboardRoute: string;
|
|
22
|
+
visibility: string;
|
|
23
|
+
readonly: boolean;
|
|
24
|
+
filters: DashboardFilter[];
|
|
25
|
+
parameters: DashboardParameter[];
|
|
26
|
+
folder: string;
|
|
27
|
+
clientId: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function initDashboard(): Dashboard;
|
|
31
|
+
export interface WidgetDashboardFilter {
|
|
32
|
+
sequence: number;
|
|
33
|
+
filterName: string;
|
|
34
|
+
columnName: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WidgetDashboardParameter {
|
|
37
|
+
sequence: number;
|
|
38
|
+
parameterName: string;
|
|
39
|
+
columnName: string;
|
|
40
|
+
}
|
|
41
|
+
export interface DashboardWidgetContentInfo extends DatagridStateBase {
|
|
42
|
+
visualizationOption: string;
|
|
43
|
+
dashboardFilters: WidgetDashboardFilter[];
|
|
44
|
+
dashboardParameters: WidgetDashboardParameter[];
|
|
45
|
+
contextName: DataContext;
|
|
46
|
+
specification: string;
|
|
47
|
+
query: string;
|
|
48
|
+
summary: string;
|
|
49
|
+
reviewOk?: boolean;
|
|
50
|
+
reviewConfidence?: string;
|
|
51
|
+
reviewFeedback?: string;
|
|
52
|
+
tableGroups?: string[];
|
|
53
|
+
developer?: boolean;
|
|
54
|
+
archive?: boolean;
|
|
55
|
+
referenceWidgetId?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface DashboardWidgetLayoutInfo {
|
|
58
|
+
id: string;
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
w: number;
|
|
62
|
+
h: number;
|
|
63
|
+
}
|
|
64
|
+
export interface DashboardWidget {
|
|
65
|
+
widgetId: string;
|
|
66
|
+
widgetTitle: string;
|
|
67
|
+
dashboardId: string;
|
|
68
|
+
contentInfo: DashboardWidgetContentInfo;
|
|
69
|
+
layoutInfo: DashboardWidgetLayoutInfo;
|
|
70
|
+
clientId: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
}
|
|
73
|
+
export interface DashboardUsage {
|
|
74
|
+
dashboardId: string;
|
|
75
|
+
dashboardTitle: string;
|
|
76
|
+
visibility: string;
|
|
77
|
+
clientId: string;
|
|
78
|
+
userId: string;
|
|
79
|
+
datetime: Date;
|
|
80
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const DASHBOARD_VISIBILITY_PRIVATE = 'private';
|
|
2
|
+
export const DASHBOARD_VISIBILITY_PUBLIC = 'public';
|
|
3
|
+
export const DASHBOARD_VISIBILITY_GLOBAL = 'global';
|
|
4
|
+
export function initDashboard() {
|
|
5
|
+
return {
|
|
6
|
+
dashboardId: '',
|
|
7
|
+
dashboardTitle: '',
|
|
8
|
+
dashboardRoute: '',
|
|
9
|
+
visibility: DASHBOARD_VISIBILITY_PRIVATE,
|
|
10
|
+
readonly: false,
|
|
11
|
+
filters: [],
|
|
12
|
+
parameters: [],
|
|
13
|
+
folder: '',
|
|
14
|
+
clientId: '',
|
|
15
|
+
userId: ''
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export interface DatagridStateBase {
|
|
2
|
+
columnState?: ColumnState[];
|
|
3
|
+
columnGroupState?: any[];
|
|
4
|
+
isPivotMode?: boolean;
|
|
5
|
+
filterModel?: FilterModel;
|
|
6
|
+
columnFormats?: ColumnFormat[];
|
|
7
|
+
}
|
|
8
|
+
export interface DatagridState extends DatagridStateBase {
|
|
9
|
+
adjRowData: any[];
|
|
10
|
+
chartRowData: any[];
|
|
11
|
+
}
|
|
12
|
+
export declare function initDatagridState(): DatagridState;
|
|
13
|
+
export type ColumnState = {
|
|
14
|
+
colId: string;
|
|
15
|
+
hide?: boolean | null;
|
|
16
|
+
sort?: 'asc' | 'desc' | null;
|
|
17
|
+
sortIndex?: number | null;
|
|
18
|
+
aggFunc?: string | null;
|
|
19
|
+
pivot?: boolean;
|
|
20
|
+
pivotIndex?: number | null;
|
|
21
|
+
rowGroup?: boolean;
|
|
22
|
+
rowGroupIndex?: number | null;
|
|
23
|
+
};
|
|
24
|
+
type FilterType = 'text' | 'number' | 'set';
|
|
25
|
+
type Operator = 'AND' | 'OR';
|
|
26
|
+
type SimpleCondition = {
|
|
27
|
+
filterType: FilterType;
|
|
28
|
+
type: string;
|
|
29
|
+
filter?: any;
|
|
30
|
+
filterTo?: any;
|
|
31
|
+
values?: any[];
|
|
32
|
+
};
|
|
33
|
+
type CompoundFilter = {
|
|
34
|
+
filterType: FilterType;
|
|
35
|
+
operator: Operator;
|
|
36
|
+
conditions: SimpleCondition[];
|
|
37
|
+
};
|
|
38
|
+
type ColumnFilter = SimpleCondition | CompoundFilter;
|
|
39
|
+
type FilterModel = Record<string, ColumnFilter>;
|
|
40
|
+
export interface ColumnFormat {
|
|
41
|
+
name: string;
|
|
42
|
+
displayName: string;
|
|
43
|
+
/** `text` | `number` | `date` | `boolean` */
|
|
44
|
+
type: string;
|
|
45
|
+
valueFormat: ValueFormat;
|
|
46
|
+
conditionalFormats: ConditionalFormat[];
|
|
47
|
+
}
|
|
48
|
+
export declare const DEFAULT_VALUE_FORMAT_VALUE = "none";
|
|
49
|
+
export interface ValueFormat {
|
|
50
|
+
/** `none` | `lower` | `upper` | `title` */
|
|
51
|
+
txtCaseVal: string;
|
|
52
|
+
/** `none` | `0` | `1` | `2` | `3` | `4` */
|
|
53
|
+
numRoundVal: string;
|
|
54
|
+
/** `none` | `on` */
|
|
55
|
+
numCommaVal: string;
|
|
56
|
+
/** `none` | `dollar` */
|
|
57
|
+
numCurrencyVal: string;
|
|
58
|
+
/** `none` | `1` | `100` */
|
|
59
|
+
numPercentVal: string;
|
|
60
|
+
/** `none` | `slash` | `dash` */
|
|
61
|
+
dteSeparatorVal: string;
|
|
62
|
+
/** `none` | `numeric` | `2-digit` */
|
|
63
|
+
dteYearVal: string;
|
|
64
|
+
/** `none` | `numeric` | `2-digit` | `long` | `short` */
|
|
65
|
+
dteMonthVal: string;
|
|
66
|
+
/** `none` | `numeric` | `2-digit` */
|
|
67
|
+
dteDayVal: string;
|
|
68
|
+
/** `none` | `long` | `short` */
|
|
69
|
+
dteWeekdayVal: string;
|
|
70
|
+
/** `none` | `h12` | `h24` (we will translate to `h23`) */
|
|
71
|
+
dteHourcycleVal: string;
|
|
72
|
+
/** `none` | `numeric` | `2-digit` */
|
|
73
|
+
dteHourVal: string;
|
|
74
|
+
/** `none` | `numeric` | `2-digit` */
|
|
75
|
+
dteMinuteVal: string;
|
|
76
|
+
/** `none` | `numeric` | `2-digit` */
|
|
77
|
+
dteSecondVal: string;
|
|
78
|
+
}
|
|
79
|
+
export declare function evaluateValueFormat(colFmt: ColumnFormat, value: any, locale: string): any;
|
|
80
|
+
export declare function formatNumberEnabled(fmt: ValueFormat): boolean;
|
|
81
|
+
export declare enum ConditionalFormatRule {
|
|
82
|
+
CONTAINS = "conditional-format-rule-contains",
|
|
83
|
+
DOES_NOT_CONTAIN = "conditional-format-rule-does-not-contain",
|
|
84
|
+
BEGINS_WITH = "conditional-format-rule-begins-with",
|
|
85
|
+
ENDS_WITH = "conditional-format-rule-ends-with",
|
|
86
|
+
GREATER_THAN = "conditional-format-rule-greater-than",
|
|
87
|
+
GREATER_THAN_OR_EQUAL_TO = "conditional-format-rule-greater-than-or-equal-to",
|
|
88
|
+
LESS_THAN = "conditional-format-rule-less-than",
|
|
89
|
+
LESS_THAN_OR_EQUAL_TO = "conditional-format-rule-less-than-or-equal-to",
|
|
90
|
+
BETWEEN = "conditional-format-rule-between",
|
|
91
|
+
EQUALS = "conditional-format-rule-equals",
|
|
92
|
+
DOES_NOT_EQUAL = "conditional-format-rule-does-not-equal",
|
|
93
|
+
BLANK = "conditional-format-rule-blank",
|
|
94
|
+
NOT_BLANK = "conditional-format-rule-not-blank"
|
|
95
|
+
}
|
|
96
|
+
export declare const CONDITIONAL_FORMAT_RULES: string[];
|
|
97
|
+
export declare const CONDITIONAL_FORMAT_RULES_TEXT: string[];
|
|
98
|
+
export declare const CONDITIONAL_FORMAT_RULES_NUMBER: string[];
|
|
99
|
+
export declare const CONDITIONAL_FORMAT_RULES_BOOLEAN: string[];
|
|
100
|
+
export interface ConditionalFormat {
|
|
101
|
+
sequence: number;
|
|
102
|
+
rule: string;
|
|
103
|
+
value: string;
|
|
104
|
+
value2?: string;
|
|
105
|
+
style: string;
|
|
106
|
+
row: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface DatagridCondition {
|
|
109
|
+
columnName: string;
|
|
110
|
+
/** `text` | `number` | `date` | `boolean` */
|
|
111
|
+
dataType: string;
|
|
112
|
+
rule: string;
|
|
113
|
+
value: string;
|
|
114
|
+
value2?: string;
|
|
115
|
+
}
|
|
116
|
+
export declare function initDatagridCondition(): DatagridCondition;
|
|
117
|
+
export declare function summarizeCondition(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string>): Promise<string>;
|
|
118
|
+
export declare function codifyCondition(condition: DatagridCondition): string;
|
|
119
|
+
export declare function transformDatagrid(rows: any[], datagridState: DatagridStateBase, locale: string, condition?: DatagridCondition): DatagridState;
|
|
120
|
+
export {};
|