@cellaware/utils 8.6.33 → 8.7.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.
@@ -1,5 +1,11 @@
1
1
  export interface SubscriptionIntegration {
2
- vendor: 'teams' | 'slack';
2
+ integrationId: string;
3
+ name: string;
4
+ description: string;
5
+ vendor: 'teams';
3
6
  type: 'webhook';
4
7
  url: string;
8
+ clientId: string;
9
+ userId: string;
5
10
  }
11
+ export declare function initSubscriptionIntegration(): SubscriptionIntegration;
@@ -1 +1,12 @@
1
- export {};
1
+ export function initSubscriptionIntegration() {
2
+ return {
3
+ integrationId: '',
4
+ name: '',
5
+ description: '',
6
+ vendor: 'teams',
7
+ type: 'webhook',
8
+ url: '',
9
+ clientId: '',
10
+ userId: ''
11
+ };
12
+ }
@@ -1,5 +1,6 @@
1
1
  import { DataContext } from "./client.js";
2
2
  import { DatagridStateBase } from "./datagrid.js";
3
+ import { SubscriptionIntegration } from "./integration.js";
3
4
  export declare const REPORT_VISIBILITY_PRIVATE = "private";
4
5
  export declare const REPORT_VISIBILITY_PUBLIC = "public";
5
6
  export declare const REPORT_VISIBILITY_GLOBAL = "global";
@@ -96,6 +97,7 @@ export interface ReportSchedule {
96
97
  popup?: boolean;
97
98
  email?: boolean;
98
99
  additionalEmails?: string[];
100
+ integrations?: string[];
99
101
  excel?: boolean;
100
102
  parameterValues?: ReportParameterValue[];
101
103
  clientId: string;
@@ -107,6 +109,7 @@ export interface InstanceReportSchedule {
107
109
  cronExpression: string;
108
110
  popups: Set<string>;
109
111
  emails: Set<string>;
112
+ integrations: Set<SubscriptionIntegration>;
110
113
  excel: boolean;
111
114
  parameterValues: ReportParameterValue[];
112
115
  }
@@ -41,6 +41,7 @@ export function initReportSchedule() {
41
41
  popup: false,
42
42
  email: false,
43
43
  additionalEmails: [],
44
+ integrations: [],
44
45
  // subscriptions: [],
45
46
  excel: false,
46
47
  parameterValues: [],
@@ -33,9 +33,10 @@ export declare function createTeamsReportBriefCard(briefMarkdown: string, report
33
33
  };
34
34
  body: ({
35
35
  type: string;
36
- text: string;
37
- size: string;
38
- weight: string;
36
+ facts: {
37
+ title: string;
38
+ value: string;
39
+ }[];
39
40
  } | {
40
41
  type: string;
41
42
  text: string;
@@ -44,6 +45,7 @@ export declare function createTeamsReportBriefCard(briefMarkdown: string, report
44
45
  wrap: boolean;
45
46
  } | {
46
47
  type: string;
48
+ separator: boolean;
47
49
  items: {
48
50
  type: string;
49
51
  text: string;
@@ -59,8 +61,21 @@ export declare function createTeamsReportTableCard(lineTitle: string, table: any
59
61
  };
60
62
  body: ({
61
63
  type: string;
64
+ facts: {
65
+ title: string;
66
+ value: string;
67
+ }[];
68
+ } | {
69
+ type: string;
70
+ separator: boolean;
62
71
  text: string;
63
72
  size: string;
73
+ } | {
74
+ type: string;
75
+ text: string;
76
+ size: string;
77
+ isSubtle: boolean;
78
+ wrap: boolean;
64
79
  } | {
65
80
  type: string;
66
81
  roundedCorners: boolean;
@@ -77,9 +92,10 @@ export declare function createTeamsReportValueCard(lineTitle: string, columnName
77
92
  };
78
93
  body: ({
79
94
  type: string;
80
- text: string;
81
- size: string;
82
- weight: string;
95
+ facts: {
96
+ title: string;
97
+ value: string;
98
+ }[];
83
99
  } | {
84
100
  type: string;
85
101
  text: string;
@@ -88,6 +104,7 @@ export declare function createTeamsReportValueCard(lineTitle: string, columnName
88
104
  wrap: boolean;
89
105
  } | {
90
106
  type: string;
107
+ separator: boolean;
91
108
  roundedCorners: boolean;
92
109
  style: string | undefined;
93
110
  items: {
@@ -109,9 +126,10 @@ export declare function createTeamsReportChartCard(lineTitle: string, png: strin
109
126
  };
110
127
  body: ({
111
128
  type: string;
112
- text: string;
113
- size: string;
114
- weight: string;
129
+ facts: {
130
+ title: string;
131
+ value: string;
132
+ }[];
115
133
  } | {
116
134
  type: string;
117
135
  text: string;
@@ -120,6 +138,7 @@ export declare function createTeamsReportChartCard(lineTitle: string, png: strin
120
138
  wrap: boolean;
121
139
  } | {
122
140
  type: string;
141
+ separator: boolean;
123
142
  url: string;
124
143
  })[];
125
144
  };
@@ -131,6 +150,13 @@ export declare function createTeamsAlertTableCard(condition: string, rows: any[]
131
150
  };
132
151
  body: ({
133
152
  type: string;
153
+ facts: {
154
+ title: string;
155
+ value: string;
156
+ }[];
157
+ } | {
158
+ type: string;
159
+ separator: boolean;
134
160
  text: string;
135
161
  size: string;
136
162
  } | {
@@ -167,6 +193,18 @@ export declare function createTeamsAlertTableCard(condition: string, rows: any[]
167
193
  }[];
168
194
  }[];
169
195
  })[];
196
+ text?: undefined;
197
+ size?: undefined;
198
+ style?: undefined;
199
+ } | {
200
+ type: string;
201
+ text: string;
202
+ size: string;
203
+ style: string;
204
+ roundedCorners?: undefined;
205
+ firstRowAsHeaders?: undefined;
206
+ columns?: undefined;
207
+ rows?: undefined;
170
208
  })[];
171
209
  };
172
210
  export declare function sendTeamsWebhook(url: string, card: any): Promise<Response>;
@@ -1,15 +1,19 @@
1
1
  import { createTeamsTableColumns, createTeamsTableRow, DATAGRID_HTML_COLS, DATAGRID_TEAMS_ROWS, mapTeamsStyles } from "./datagrid.js";
2
- function createTeamsTitleItem(title) {
2
+ function createTeamsTitleItem(title, value) {
3
3
  return {
4
- type: "TextBlock",
5
- text: title,
6
- size: "Medium",
7
- weight: "Bolder"
4
+ type: "FactSet",
5
+ facts: [
6
+ {
7
+ title: `${title}:`,
8
+ value
9
+ }
10
+ ]
8
11
  };
9
12
  }
10
13
  function createTeamsTableQualifierItem() {
11
14
  return {
12
15
  type: "TextBlock",
16
+ separator: true,
13
17
  text: `Displaying first **${DATAGRID_TEAMS_ROWS} rows** and **${DATAGRID_HTML_COLS} columns**`,
14
18
  size: "Small"
15
19
  };
@@ -23,43 +27,6 @@ function createTeamsSummaryItem(summary) {
23
27
  wrap: true
24
28
  };
25
29
  }
26
- // function createTeamsReportSourceItem(reportTitle: string) {
27
- // return {
28
- // type: "Container",
29
- // // layouts: [
30
- // // {
31
- // // type: "Layout.Flow",
32
- // // horizontalItemsAlignment: "Left",
33
- // // minItemWidth: "0px"
34
- // // }
35
- // // ],
36
- // items: [
37
- // {
38
- // type: "TextBlock",
39
- // text: `Report: **${reportTitle}**`,
40
- // size: "Small",
41
- // }
42
- // ]
43
- // };
44
- // }
45
- // function createTeamsAlertSourceItem(alertTitle: string) {
46
- // return {
47
- // type: "Container",
48
- // items: [
49
- // {
50
- // type: "Badge",
51
- // text: "Alert",
52
- // size: "Large",
53
- // style: "Attention"
54
- // },
55
- // {
56
- // type: "TextBlock",
57
- // text: `Alert: **${alertTitle}**`,
58
- // size: "Small",
59
- // }
60
- // ]
61
- // };
62
- // }
63
30
  export function createTeamsTableItem(rows) {
64
31
  if (rows.length === 0) {
65
32
  return [];
@@ -77,9 +44,10 @@ export function createTeamsReportBriefCard(briefMarkdown, reportTitle) {
77
44
  version: "1.5",
78
45
  msteams: { width: "Full" },
79
46
  body: [
80
- createTeamsTitleItem(`Brief - ${reportTitle}`),
47
+ createTeamsTitleItem(reportTitle, 'Brief'),
81
48
  {
82
49
  type: "Container",
50
+ separator: true,
83
51
  items: [
84
52
  {
85
53
  type: "TextBlock",
@@ -88,8 +56,7 @@ export function createTeamsReportBriefCard(briefMarkdown, reportTitle) {
88
56
  }
89
57
  ]
90
58
  },
91
- createTeamsSummaryItem('ChatWMS can make mistakes. [Check important info.](https://chatwms.io/user-manual/chatwms/disclaimer)'),
92
- // createTeamsReportSourceItem(reportTitle)
59
+ createTeamsSummaryItem('ChatWMS can make mistakes. [Check important info.](https://chatwms.io/user-manual/chatwms/disclaimer)')
93
60
  ]
94
61
  };
95
62
  }
@@ -99,7 +66,7 @@ export function createTeamsReportTableCard(lineTitle, table, summary, reportTitl
99
66
  version: "1.5",
100
67
  msteams: { width: "Full" },
101
68
  body: [
102
- createTeamsTitleItem(`${lineTitle} - ${reportTitle}`),
69
+ createTeamsTitleItem(reportTitle, lineTitle),
103
70
  createTeamsTableQualifierItem(),
104
71
  {
105
72
  type: "Table",
@@ -108,8 +75,7 @@ export function createTeamsReportTableCard(lineTitle, table, summary, reportTitl
108
75
  columns: table.length === 0 ? [] : table[0].cells.map(() => ({ width: 3 })),
109
76
  rows: table
110
77
  },
111
- createTeamsSummaryItem(summary),
112
- // createTeamsReportSourceItem(reportTitle)
78
+ createTeamsSummaryItem(summary)
113
79
  ]
114
80
  };
115
81
  }
@@ -148,9 +114,10 @@ export function createTeamsReportValueCard(lineTitle, columnName, value, styles,
148
114
  version: "1.5",
149
115
  msteams: { width: "Full" },
150
116
  body: [
151
- createTeamsTitleItem(`${lineTitle} - ${reportTitle}`),
117
+ createTeamsTitleItem(reportTitle, lineTitle),
152
118
  {
153
119
  type: "Container",
120
+ separator: true,
154
121
  roundedCorners: true,
155
122
  style,
156
123
  items: [
@@ -165,8 +132,7 @@ export function createTeamsReportValueCard(lineTitle, columnName, value, styles,
165
132
  }
166
133
  ]
167
134
  },
168
- createTeamsSummaryItem(summary),
169
- // createTeamsReportSourceItem(reportTitle)
135
+ createTeamsSummaryItem(summary)
170
136
  ]
171
137
  };
172
138
  }
@@ -176,13 +142,13 @@ export function createTeamsReportChartCard(lineTitle, png, summary, reportTitle)
176
142
  version: "1.5",
177
143
  msteams: { width: "Full" },
178
144
  body: [
179
- createTeamsTitleItem(`${lineTitle} - ${reportTitle}`),
145
+ createTeamsTitleItem(reportTitle, lineTitle),
180
146
  {
181
147
  type: "Image",
182
- url: png
148
+ separator: true,
149
+ url: png,
183
150
  },
184
- createTeamsSummaryItem(summary),
185
- // createTeamsReportSourceItem(reportTitle)
151
+ createTeamsSummaryItem(summary)
186
152
  ]
187
153
  };
188
154
  }
@@ -193,7 +159,7 @@ export function createTeamsAlertTableCard(condition, rows, alertTitle) {
193
159
  version: "1.5",
194
160
  msteams: { width: "Full" },
195
161
  body: [
196
- createTeamsTitleItem(`${condition} - ${alertTitle}`),
162
+ createTeamsTitleItem(alertTitle, condition),
197
163
  createTeamsTableQualifierItem(),
198
164
  {
199
165
  type: "Table",
@@ -202,7 +168,12 @@ export function createTeamsAlertTableCard(condition, rows, alertTitle) {
202
168
  columns: table.length === 0 ? [] : table[0].cells.map(() => ({ width: 3 })),
203
169
  rows: table
204
170
  },
205
- // createTeamsAlertSourceItem(alertTitle)
171
+ {
172
+ type: "Badge",
173
+ text: "Alert",
174
+ size: "Large",
175
+ style: "Attention"
176
+ }
206
177
  ]
207
178
  };
208
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.6.33",
3
+ "version": "8.7.0",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",