@cellaware/utils 8.6.31 → 8.6.32

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.
@@ -25,7 +25,7 @@ export declare function createTeamsTableItem(rows: any[]): ({
25
25
  }[];
26
26
  }[];
27
27
  })[];
28
- export declare function createTeamsBriefCard(markdown: string, source: string): {
28
+ export declare function createTeamsReportBriefCard(briefMarkdown: string, reportTitle: string): {
29
29
  type: string;
30
30
  version: string;
31
31
  msteams: {
@@ -44,13 +44,17 @@ export declare function createTeamsBriefCard(markdown: string, source: string):
44
44
  wrap: boolean;
45
45
  } | {
46
46
  type: string;
47
- facts: {
48
- title: string;
49
- value: string;
47
+ layouts: {
48
+ type: string;
49
+ horizontalItemsAlignment: string;
50
+ minItemWidth: string;
51
+ }[];
52
+ items: {
53
+ type: string;
54
+ text: string;
50
55
  }[];
51
56
  } | {
52
57
  type: string;
53
- roundedCorners: boolean;
54
58
  items: {
55
59
  type: string;
56
60
  text: string;
@@ -58,7 +62,7 @@ export declare function createTeamsBriefCard(markdown: string, source: string):
58
62
  }[];
59
63
  })[];
60
64
  };
61
- export declare function createTeamsTableCard(title: string, table: any[], summary: string, source: string): {
65
+ export declare function createTeamsReportTableCard(lineTitle: string, table: any[], summary: string, reportTitle: string): {
62
66
  type: string;
63
67
  version: string;
64
68
  msteams: {
@@ -70,9 +74,14 @@ export declare function createTeamsTableCard(title: string, table: any[], summar
70
74
  size: string;
71
75
  } | {
72
76
  type: string;
73
- facts: {
74
- title: string;
75
- value: string;
77
+ layouts: {
78
+ type: string;
79
+ horizontalItemsAlignment: string;
80
+ minItemWidth: string;
81
+ }[];
82
+ items: {
83
+ type: string;
84
+ text: string;
76
85
  }[];
77
86
  } | {
78
87
  type: string;
@@ -82,7 +91,7 @@ export declare function createTeamsTableCard(title: string, table: any[], summar
82
91
  rows: any[];
83
92
  })[];
84
93
  };
85
- export declare function createTeamsValueCard(title: string, columnName: string, value: any, styles: string[], summary: string, source: string): {
94
+ export declare function createTeamsReportValueCard(lineTitle: string, columnName: string, value: any, styles: string[], summary: string, reportTitle: string): {
86
95
  type: string;
87
96
  version: string;
88
97
  msteams: {
@@ -101,9 +110,14 @@ export declare function createTeamsValueCard(title: string, columnName: string,
101
110
  wrap: boolean;
102
111
  } | {
103
112
  type: string;
104
- facts: {
105
- title: string;
106
- value: string;
113
+ layouts: {
114
+ type: string;
115
+ horizontalItemsAlignment: string;
116
+ minItemWidth: string;
117
+ }[];
118
+ items: {
119
+ type: string;
120
+ text: string;
107
121
  }[];
108
122
  } | {
109
123
  type: string;
@@ -120,7 +134,7 @@ export declare function createTeamsValueCard(title: string, columnName: string,
120
134
  }[];
121
135
  })[];
122
136
  };
123
- export declare function createTeamsChartCard(title: string, png: string, summary: string, source: string): {
137
+ export declare function createTeamsReportChartCard(lineTitle: string, png: string, summary: string, reportTitle: string): {
124
138
  type: string;
125
139
  version: string;
126
140
  msteams: {
@@ -139,13 +153,77 @@ export declare function createTeamsChartCard(title: string, png: string, summary
139
153
  wrap: boolean;
140
154
  } | {
141
155
  type: string;
142
- facts: {
143
- title: string;
144
- value: string;
156
+ layouts: {
157
+ type: string;
158
+ horizontalItemsAlignment: string;
159
+ minItemWidth: string;
160
+ }[];
161
+ items: {
162
+ type: string;
163
+ text: string;
145
164
  }[];
146
165
  } | {
147
166
  type: string;
148
167
  url: string;
149
168
  })[];
150
169
  };
170
+ export declare function createTeamsAlertTableCard(condition: string, rows: any[], alertTitle: string): {
171
+ type: string;
172
+ version: string;
173
+ msteams: {
174
+ width: string;
175
+ };
176
+ body: ({
177
+ type: string;
178
+ text: string;
179
+ size: string;
180
+ } | {
181
+ type: string;
182
+ items: ({
183
+ type: string;
184
+ text: string;
185
+ size: string;
186
+ style: string;
187
+ } | {
188
+ type: string;
189
+ text: string;
190
+ size?: undefined;
191
+ style?: undefined;
192
+ })[];
193
+ } | {
194
+ type: string;
195
+ roundedCorners: boolean;
196
+ firstRowAsHeaders: boolean;
197
+ columns: {
198
+ width: number;
199
+ }[];
200
+ rows: ({
201
+ type: string;
202
+ cells: {
203
+ type: string;
204
+ items: {
205
+ type: string;
206
+ text: any;
207
+ size: string;
208
+ weight: string;
209
+ }[];
210
+ }[];
211
+ } | {
212
+ type: string;
213
+ style: string | undefined;
214
+ cells: {
215
+ type: string;
216
+ style: string | undefined;
217
+ items: {
218
+ type: string;
219
+ text: any;
220
+ size: string;
221
+ color: string | undefined;
222
+ weight: string | undefined;
223
+ isSubtle: true | undefined;
224
+ }[];
225
+ }[];
226
+ })[];
227
+ })[];
228
+ };
151
229
  export declare function sendTeamsWebhook(url: string, card: any): Promise<Response>;
@@ -23,13 +23,37 @@ function createTeamsSummaryItem(summary) {
23
23
  wrap: true
24
24
  };
25
25
  }
26
- function createTeamsSourceItem(text) {
26
+ function createTeamsReportSourceItem(reportTitle) {
27
27
  return {
28
- type: "FactSet",
29
- facts: [
28
+ type: "Container",
29
+ layouts: [
30
30
  {
31
- title: "Source:",
32
- value: text
31
+ type: "Layout.Flow",
32
+ horizontalItemsAlignment: "Left",
33
+ minItemWidth: "0px"
34
+ }
35
+ ],
36
+ items: [
37
+ {
38
+ type: "TextBlock",
39
+ text: `Report: **${reportTitle}**`
40
+ }
41
+ ]
42
+ };
43
+ }
44
+ function createTeamsAlertSourceItem(alertTitle) {
45
+ return {
46
+ type: "Container",
47
+ items: [
48
+ {
49
+ type: "Badge",
50
+ text: "Alert",
51
+ size: "Large",
52
+ style: "Attention"
53
+ },
54
+ {
55
+ type: "TextBlock",
56
+ text: `Alert: **${alertTitle}**`
33
57
  }
34
58
  ]
35
59
  };
@@ -45,7 +69,7 @@ export function createTeamsTableItem(rows) {
45
69
  ...teamsRows
46
70
  ];
47
71
  }
48
- export function createTeamsBriefCard(markdown, source) {
72
+ export function createTeamsReportBriefCard(briefMarkdown, reportTitle) {
49
73
  return {
50
74
  type: "AdaptiveCard",
51
75
  version: "1.5",
@@ -54,27 +78,26 @@ export function createTeamsBriefCard(markdown, source) {
54
78
  createTeamsTitleItem('Brief'),
55
79
  {
56
80
  type: "Container",
57
- roundedCorners: true,
58
81
  items: [
59
82
  {
60
83
  type: "TextBlock",
61
- text: markdown,
84
+ text: briefMarkdown,
62
85
  wrap: true,
63
86
  }
64
87
  ]
65
88
  },
66
89
  createTeamsSummaryItem('ChatWMS can make mistakes. [Check important info.](https://chatwms.io/user-manual/chatwms/disclaimer)'),
67
- createTeamsSourceItem(source)
90
+ createTeamsReportSourceItem(reportTitle)
68
91
  ]
69
92
  };
70
93
  }
71
- export function createTeamsTableCard(title, table, summary, source) {
94
+ export function createTeamsReportTableCard(lineTitle, table, summary, reportTitle) {
72
95
  return {
73
96
  type: "AdaptiveCard",
74
97
  version: "1.5",
75
98
  msteams: { width: "Full" },
76
99
  body: [
77
- createTeamsTitleItem(title),
100
+ createTeamsTitleItem(lineTitle),
78
101
  createTeamsTableQualifierItem(),
79
102
  {
80
103
  type: "Table",
@@ -84,11 +107,11 @@ export function createTeamsTableCard(title, table, summary, source) {
84
107
  rows: table
85
108
  },
86
109
  createTeamsSummaryItem(summary),
87
- createTeamsSourceItem(source)
110
+ createTeamsReportSourceItem(reportTitle)
88
111
  ]
89
112
  };
90
113
  }
91
- export function createTeamsValueCard(title, columnName, value, styles, summary, source) {
114
+ export function createTeamsReportValueCard(lineTitle, columnName, value, styles, summary, reportTitle) {
92
115
  // NOTE: we only care about mapping style string (represented as row styles) to column styles.
93
116
  let rowStyles = [];
94
117
  let columnStyles = [];
@@ -123,7 +146,7 @@ export function createTeamsValueCard(title, columnName, value, styles, summary,
123
146
  version: "1.5",
124
147
  msteams: { width: "Full" },
125
148
  body: [
126
- createTeamsTitleItem(title),
149
+ createTeamsTitleItem(lineTitle),
127
150
  {
128
151
  type: "Container",
129
152
  roundedCorners: true,
@@ -141,23 +164,43 @@ export function createTeamsValueCard(title, columnName, value, styles, summary,
141
164
  ]
142
165
  },
143
166
  createTeamsSummaryItem(summary),
144
- createTeamsSourceItem(source)
167
+ createTeamsReportSourceItem(reportTitle)
145
168
  ]
146
169
  };
147
170
  }
148
- export function createTeamsChartCard(title, png, summary, source) {
171
+ export function createTeamsReportChartCard(lineTitle, png, summary, reportTitle) {
149
172
  return {
150
173
  type: "AdaptiveCard",
151
174
  version: "1.5",
152
175
  msteams: { width: "Full" },
153
176
  body: [
154
- createTeamsTitleItem(title),
177
+ createTeamsTitleItem(lineTitle),
155
178
  {
156
179
  type: "Image",
157
180
  url: png
158
181
  },
159
182
  createTeamsSummaryItem(summary),
160
- createTeamsSourceItem(source)
183
+ createTeamsReportSourceItem(reportTitle)
184
+ ]
185
+ };
186
+ }
187
+ export function createTeamsAlertTableCard(condition, rows, alertTitle) {
188
+ const table = createTeamsTableItem(rows);
189
+ return {
190
+ type: "AdaptiveCard",
191
+ version: "1.5",
192
+ msteams: { width: "Full" },
193
+ body: [
194
+ createTeamsTitleItem(condition),
195
+ createTeamsTableQualifierItem(),
196
+ {
197
+ type: "Table",
198
+ roundedCorners: true,
199
+ firstRowAsHeaders: true,
200
+ columns: table.length === 0 ? [] : table[0].cells.map(() => ({ width: 3 })),
201
+ rows: table
202
+ },
203
+ createTeamsAlertSourceItem(alertTitle)
161
204
  ]
162
205
  };
163
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.6.31",
3
+ "version": "8.6.32",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",