react-semaphor 0.1.421 → 0.1.423
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +2 -2
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +913 -712
- package/dist/chunks/{analyze-result-contract-sWcmvBOA.js → analyze-result-contract-D7pjjYPy.js} +45 -46
- package/dist/chunks/{analyze-result-contract-B5Eeu7vD.js → analyze-result-contract-DpDcImgk.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-CscmhyuZ.js → calendar-preferences-dialog-CTmeASaM.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-cN3_2C-u.js → calendar-preferences-dialog-t5ET6MON.js} +3 -3
- package/dist/chunks/card-config-utils-15sRtebL.js +1 -0
- package/dist/chunks/card-config-utils-BYZ5MJOh.js +16 -0
- package/dist/chunks/dashboard-briefing-launcher-Cavd0QJb.js +3401 -0
- package/dist/chunks/dashboard-briefing-launcher-S2akO-ub.js +26 -0
- package/dist/chunks/dashboard-controls-BJLrErjW.js +2322 -0
- package/dist/chunks/dashboard-controls-DzbP8AXA.js +52 -0
- package/dist/chunks/dashboard-json-5tWb5KD6.js +1 -0
- package/dist/chunks/{dashboard-json-Cxhw2TZc.js → dashboard-json-Do2-pdPZ.js} +12 -11
- package/dist/chunks/{edit-dashboard-visual-BigSJ3-x.js → edit-dashboard-visual-Cw6bq4_w.js} +7058 -6989
- package/dist/chunks/edit-dashboard-visual-Yh5YFgMF.js +178 -0
- package/dist/chunks/index-BPM3gDRw.js +1406 -0
- package/dist/chunks/{index-CH2ZzQo4.js → index-yHe0SeLO.js} +81534 -75430
- package/dist/chunks/{switch-TbCsyhv9.js → switch-2bh3Hka1.js} +620 -633
- package/dist/chunks/{switch-CiOjVyVI.js → switch-DMT7qf_R.js} +24 -24
- package/dist/chunks/{update-policy-2MZ-Vf7v.js → update-policy-BCJc0oI5.js} +1 -1
- package/dist/chunks/{update-policy-qpyAkOyO.js → update-policy-C1pmhLz9.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BzcJWNzh.js → use-create-flow-overlay-state-5MDbZcs1.js} +515 -544
- package/dist/chunks/use-create-flow-overlay-state-BNczg9Gj.js +11 -0
- package/dist/chunks/{validators-Dj1Y-46V.js → validators-DMlVbd1p.js} +1 -1
- package/dist/chunks/{validators-D0pfj3jJ.js → validators-PXkij33j.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +2 -2
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +108 -108
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +165 -340
- package/dist/data-app-codegen-node/index.js +761 -952
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +91 -95
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +168 -164
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +0 -4
- package/dist/types/briefings.d.ts +2388 -7
- package/dist/types/dashboard-assistant.d.ts +0 -1
- package/dist/types/data-app-sdk-validation.d.ts +0 -1
- package/dist/types/data-app-sdk.d.ts +0 -2
- package/dist/types/main.d.ts +70 -10
- package/dist/types/types.d.ts +4 -8
- package/package.json +1 -1
- package/dist/chunks/dashboard-briefing-launcher-BYTBNetR.js +0 -9077
- package/dist/chunks/dashboard-briefing-launcher-DmZkzIC3.js +0 -80
- package/dist/chunks/dashboard-controls-9DFeKIP4.js +0 -52
- package/dist/chunks/dashboard-controls-PhzuaTBj.js +0 -2280
- package/dist/chunks/dashboard-json-DyRHI3mL.js +0 -1
- package/dist/chunks/edit-dashboard-visual-3_jiBXsu.js +0 -178
- package/dist/chunks/index-BKDQw0aK.js +0 -1346
- package/dist/chunks/use-create-flow-overlay-state-DUQmgb9H.js +0 -21
package/dist/briefings/index.js
CHANGED
|
@@ -1,7 +1,224 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var ee = (t, n, e) => n in t ? Q(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
|
+
var M = (t, n, e) => ee(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { i as te } from "../chunks/card-config-utils-BYZ5MJOh.js";
|
|
5
|
+
const P = [
|
|
6
|
+
"SUN",
|
|
7
|
+
"MON",
|
|
8
|
+
"TUE",
|
|
9
|
+
"WED",
|
|
10
|
+
"THU",
|
|
11
|
+
"FRI",
|
|
12
|
+
"SAT"
|
|
13
|
+
], ne = new Map(
|
|
14
|
+
P.map((t, n) => [t, n])
|
|
15
|
+
), Xe = {
|
|
16
|
+
cadence: "weekly",
|
|
17
|
+
hour: 9,
|
|
18
|
+
minute: 0,
|
|
19
|
+
weekdays: [1]
|
|
20
|
+
};
|
|
21
|
+
function Qe(t) {
|
|
22
|
+
if (typeof t != "string" || t.length === 0 || t !== t.trim() || /^(?:(?:UTC|GMT)[+-]|[+-]\d{2}:\d{2}$)/.test(t))
|
|
23
|
+
return !1;
|
|
24
|
+
try {
|
|
25
|
+
return new Intl.DateTimeFormat("en-US", { timeZone: t }).format(), !0;
|
|
26
|
+
} catch {
|
|
27
|
+
return !1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function re(t) {
|
|
31
|
+
return Number.isInteger(t.minute) && t.minute >= 0 && t.minute <= 59 && Number.isInteger(t.hour) && t.hour >= 0 && t.hour <= 23;
|
|
32
|
+
}
|
|
33
|
+
function U(t) {
|
|
34
|
+
if (t.length === 0) return null;
|
|
35
|
+
const n = [...t].sort((e, r) => e - r);
|
|
36
|
+
return n.some(
|
|
37
|
+
(e, r) => !Number.isInteger(e) || e < 0 || e > 6 || r > 0 && e === n[r - 1]
|
|
38
|
+
) ? null : n;
|
|
39
|
+
}
|
|
40
|
+
function et(t) {
|
|
41
|
+
if (!re(t))
|
|
42
|
+
throw new Error("Choose a valid schedule time.");
|
|
43
|
+
const n = `${t.minute} ${t.hour}`;
|
|
44
|
+
switch (t.cadence) {
|
|
45
|
+
case "daily":
|
|
46
|
+
return `${n} * * *`;
|
|
47
|
+
case "weekly": {
|
|
48
|
+
const e = U(t.weekdays);
|
|
49
|
+
if (!e) throw new Error("Choose at least one weekday.");
|
|
50
|
+
return `${n} * * ${e.map((r) => P[r]).join(",")}`;
|
|
51
|
+
}
|
|
52
|
+
case "twice_monthly":
|
|
53
|
+
return `${n} 1,15 * *`;
|
|
54
|
+
case "monthly":
|
|
55
|
+
return `${n} 1 * *`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function oe(t) {
|
|
59
|
+
if (typeof t != "string" || t.length === 0)
|
|
60
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
61
|
+
if (t !== t.trim() || t.includes(" "))
|
|
62
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
63
|
+
const n = t.split(" ");
|
|
64
|
+
if (n.length !== 5)
|
|
65
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
66
|
+
const [e, r, o, i, a] = n;
|
|
67
|
+
if (!/^(0|[1-9]\d?)$/.test(e) || !/^(0|[1-9]\d?)$/.test(r))
|
|
68
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
69
|
+
const l = Number(e), f = Number(r);
|
|
70
|
+
if (l > 59 || f > 23 || i !== "*")
|
|
71
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
72
|
+
if (o === "*" && a === "*")
|
|
73
|
+
return {
|
|
74
|
+
ok: !0,
|
|
75
|
+
value: { cadence: "daily", hour: f, minute: l, weekdays: [] }
|
|
76
|
+
};
|
|
77
|
+
if (o === "*" && a !== "*") {
|
|
78
|
+
const m = a.split(",").map((p) => ne.get(p));
|
|
79
|
+
if (m.some((p) => p === void 0))
|
|
80
|
+
return { ok: !1, issue: "Choose a supported schedule." };
|
|
81
|
+
const I = m, v = U(I);
|
|
82
|
+
return !v || v.some((p, C) => p !== I[C]) ? { ok: !1, issue: "Choose a supported schedule." } : {
|
|
83
|
+
ok: !0,
|
|
84
|
+
value: { cadence: "weekly", hour: f, minute: l, weekdays: v }
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return o === "1,15" && a === "*" ? {
|
|
88
|
+
ok: !0,
|
|
89
|
+
value: { cadence: "twice_monthly", hour: f, minute: l, weekdays: [] }
|
|
90
|
+
} : o === "1" && a === "*" ? {
|
|
91
|
+
ok: !0,
|
|
92
|
+
value: { cadence: "monthly", hour: f, minute: l, weekdays: [] }
|
|
93
|
+
} : { ok: !1, issue: "Choose a supported schedule." };
|
|
94
|
+
}
|
|
95
|
+
function ie(t, n, e) {
|
|
96
|
+
return new Intl.DateTimeFormat(e, {
|
|
97
|
+
hour: "numeric",
|
|
98
|
+
minute: "2-digit",
|
|
99
|
+
timeZone: "UTC"
|
|
100
|
+
}).format(new Date(Date.UTC(2020, 0, 1, t, n)));
|
|
101
|
+
}
|
|
102
|
+
function ae(t, n) {
|
|
103
|
+
var e;
|
|
104
|
+
if (t === "UTC") return "UTC";
|
|
105
|
+
try {
|
|
106
|
+
return ((e = new Intl.DateTimeFormat(n, {
|
|
107
|
+
timeZone: t,
|
|
108
|
+
timeZoneName: "longGeneric"
|
|
109
|
+
}).formatToParts(new Date(Date.UTC(2020, 0, 1))).find((o) => o.type === "timeZoneName")) == null ? void 0 : e.value) ?? t;
|
|
110
|
+
} catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function tt(t, n, e = "en-US") {
|
|
115
|
+
const r = oe(t);
|
|
116
|
+
if (!r.ok) return null;
|
|
117
|
+
try {
|
|
118
|
+
const o = ie(r.value.hour, r.value.minute, e), i = ae(n, e);
|
|
119
|
+
if (!i) return null;
|
|
120
|
+
switch (r.value.cadence) {
|
|
121
|
+
case "daily":
|
|
122
|
+
return `Daily at ${o} ${i}`;
|
|
123
|
+
case "weekly": {
|
|
124
|
+
const a = new Intl.DateTimeFormat(e, {
|
|
125
|
+
weekday: "long",
|
|
126
|
+
timeZone: "UTC"
|
|
127
|
+
});
|
|
128
|
+
return `${r.value.weekdays.map(
|
|
129
|
+
(f) => a.format(new Date(Date.UTC(2023, 0, 1 + f)))
|
|
130
|
+
).join(" and ")} at ${o} ${i}`;
|
|
131
|
+
}
|
|
132
|
+
case "twice_monthly":
|
|
133
|
+
return `On the 1st and 15th at ${o} ${i}`;
|
|
134
|
+
case "monthly":
|
|
135
|
+
return `Monthly on the 1st at ${o} ${i}`;
|
|
136
|
+
}
|
|
137
|
+
} catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const ce = /* @__PURE__ */ new Set([
|
|
142
|
+
"table",
|
|
143
|
+
"aggregateTable",
|
|
144
|
+
"pivotTable",
|
|
145
|
+
"detailTable"
|
|
146
|
+
]), le = /* @__PURE__ */ new Set([
|
|
147
|
+
"bar",
|
|
148
|
+
"horizontalBar",
|
|
149
|
+
"line",
|
|
150
|
+
"area",
|
|
151
|
+
"stackedArea",
|
|
152
|
+
"combo",
|
|
153
|
+
"pie",
|
|
154
|
+
"doughnut",
|
|
155
|
+
"radar",
|
|
156
|
+
"polarArea",
|
|
157
|
+
"bubble",
|
|
158
|
+
"scatter",
|
|
159
|
+
"stackedBar",
|
|
160
|
+
"stackedLine",
|
|
161
|
+
"table",
|
|
162
|
+
"pivotTable",
|
|
163
|
+
"aggregateTable",
|
|
164
|
+
"matrixTable",
|
|
165
|
+
"detailTable",
|
|
166
|
+
"kpi",
|
|
167
|
+
"pyramid",
|
|
168
|
+
"tornado",
|
|
169
|
+
"range",
|
|
170
|
+
"map",
|
|
171
|
+
"funnel",
|
|
172
|
+
"bullet",
|
|
173
|
+
"heatmap",
|
|
174
|
+
"treemap",
|
|
175
|
+
"custom"
|
|
176
|
+
]);
|
|
177
|
+
function nt(t) {
|
|
178
|
+
var r, o, i;
|
|
179
|
+
const n = le.has(t.type) && (t.type !== "custom" || !!((r = t.customCardPreferences) != null && r.url));
|
|
180
|
+
return t.type === "text" || !n || te(t) ? { formats: [], defaultFormat: null } : {
|
|
181
|
+
formats: de({
|
|
182
|
+
cardType: t.type,
|
|
183
|
+
allowDownload: (o = t.preferences) == null ? void 0 : o.allowDownload
|
|
184
|
+
}),
|
|
185
|
+
defaultFormat: se({
|
|
186
|
+
cardType: t.type,
|
|
187
|
+
allowDownload: (i = t.preferences) == null ? void 0 : i.allowDownload
|
|
188
|
+
})
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function de(t) {
|
|
192
|
+
return t.allowDownload === !1 ? ["pdf"] : ["pdf", "csv"];
|
|
193
|
+
}
|
|
194
|
+
function se(t) {
|
|
195
|
+
return ce.has(t.cardType) && t.allowDownload !== !1 ? "csv" : "pdf";
|
|
196
|
+
}
|
|
197
|
+
function rt(t) {
|
|
198
|
+
return t != null && t.role ? t.type === "tenant" ? t.role === "POWER_USER" : ["AUTHOR", "ADMIN", "SUPER_ADMIN"].includes(t.role) : !1;
|
|
199
|
+
}
|
|
200
|
+
function ot(t) {
|
|
201
|
+
return t.canCreate ? [
|
|
202
|
+
...t.scheduledReportAvailable ? ["scheduled_report"] : [],
|
|
203
|
+
...t.analyticalBriefingsEnabled ? ["analytical_briefing"] : []
|
|
204
|
+
] : [];
|
|
205
|
+
}
|
|
206
|
+
function fe(t) {
|
|
207
|
+
const n = (t == null ? void 0 : t.channels) ?? [];
|
|
208
|
+
return n.length === 1 && n[0] === "EMAIL";
|
|
209
|
+
}
|
|
210
|
+
function ue(t) {
|
|
211
|
+
return t.body.type === "generated_analysis" ? "Analytical briefing" : t.body.type === "custom_message" && t.attachments.length > 0 && fe(t.deliveryConfig) ? t.scheduleExpr ? "Scheduled report" : "On-demand report" : "Plain briefing";
|
|
212
|
+
}
|
|
213
|
+
function it(t) {
|
|
214
|
+
const n = ue(t), e = n === "Scheduled report" || n === "On-demand report" ? "report" : "briefing";
|
|
215
|
+
return {
|
|
216
|
+
typeLabel: n,
|
|
217
|
+
noun: e,
|
|
218
|
+
pluralNoun: e === "report" ? "reports" : "briefings"
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const L = "BRIEFING", me = ["markdown", "html"], N = ["markdown"], w = 20, d = {
|
|
5
222
|
name: 500,
|
|
6
223
|
description: 2e3,
|
|
7
224
|
instruction: 5e4,
|
|
@@ -17,61 +234,61 @@ const w = "BRIEFING", Z = ["markdown", "html"], V = ["markdown"], ze = 20, l = {
|
|
|
17
234
|
presentationTone: 500,
|
|
18
235
|
presentationFormat: 2e3,
|
|
19
236
|
id: 500
|
|
20
|
-
},
|
|
237
|
+
}, b = {
|
|
21
238
|
maxBlocks: 50,
|
|
22
239
|
maxTableRows: 100,
|
|
23
240
|
maxTableColumns: 20,
|
|
24
|
-
maxTableCellCharacters:
|
|
25
|
-
maxParagraphCharacters:
|
|
26
|
-
maxFindingCharacters:
|
|
241
|
+
maxTableCellCharacters: d.contentCell,
|
|
242
|
+
maxParagraphCharacters: d.contentText,
|
|
243
|
+
maxFindingCharacters: d.contentText,
|
|
27
244
|
maxListItems: 100,
|
|
28
245
|
// A kpi_grid is rendered as a 2-up tile arrangement in emails. Cap at 8 so
|
|
29
246
|
// the visual stays at most 4 rows (4 columns wide on desktop would force
|
|
30
247
|
// tiny tiles in narrow client panels; 2-up was the chosen layout).
|
|
31
248
|
maxKpiTiles: 8
|
|
32
|
-
},
|
|
249
|
+
}, j = new Set(me), pe = /* @__PURE__ */ new Set([
|
|
33
250
|
"EMAIL",
|
|
34
251
|
"WEBHOOK",
|
|
35
252
|
"SLACK",
|
|
36
253
|
"IN_APP",
|
|
37
254
|
"TELEGRAM"
|
|
38
|
-
]),
|
|
255
|
+
]), D = {
|
|
39
256
|
maxToolCalls: { min: 1, max: 100 },
|
|
40
257
|
maxRows: { min: 1, max: 1e5 },
|
|
41
258
|
timeoutMs: { min: 1e3, max: 30 * 6e4 }
|
|
42
|
-
},
|
|
259
|
+
}, he = /* @__PURE__ */ new Set([
|
|
43
260
|
"letter",
|
|
44
261
|
"legal",
|
|
45
262
|
"a4",
|
|
46
263
|
"a3",
|
|
47
264
|
"tabloid"
|
|
48
|
-
]),
|
|
265
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
49
266
|
"portrait",
|
|
50
267
|
"landscape"
|
|
51
|
-
]),
|
|
268
|
+
]), ge = /* @__PURE__ */ new Set([",", ";", " "]), ve = /* @__PURE__ */ new Set([
|
|
52
269
|
"current",
|
|
53
270
|
"all"
|
|
54
|
-
]),
|
|
271
|
+
]), be = /* @__PURE__ */ new Set([
|
|
55
272
|
"concise",
|
|
56
273
|
"balanced",
|
|
57
274
|
"detailed"
|
|
58
|
-
]),
|
|
275
|
+
]), Ie = /* @__PURE__ */ new Set([
|
|
59
276
|
"info",
|
|
60
277
|
"positive",
|
|
61
278
|
"warning",
|
|
62
279
|
"critical"
|
|
63
|
-
]),
|
|
280
|
+
]), $e = /* @__PURE__ */ new Set([
|
|
64
281
|
"text",
|
|
65
282
|
"number",
|
|
66
283
|
"currency",
|
|
67
284
|
"percent",
|
|
68
285
|
"date",
|
|
69
286
|
"boolean"
|
|
70
|
-
]),
|
|
287
|
+
]), Ee = /* @__PURE__ */ new Set([
|
|
71
288
|
"left",
|
|
72
289
|
"center",
|
|
73
290
|
"right"
|
|
74
|
-
]),
|
|
291
|
+
]), Te = [
|
|
75
292
|
"pageSize",
|
|
76
293
|
"orientation",
|
|
77
294
|
"includeFilters",
|
|
@@ -94,678 +311,686 @@ const w = "BRIEFING", Z = ["markdown", "html"], V = ["markdown"], ze = 20, l = {
|
|
|
94
311
|
"dashboardInputExecutionSnapshot",
|
|
95
312
|
"selectedSheetId",
|
|
96
313
|
"cardType",
|
|
314
|
+
"allowDownload",
|
|
97
315
|
"theme"
|
|
98
316
|
];
|
|
99
|
-
class
|
|
317
|
+
class A extends Error {
|
|
100
318
|
constructor(e) {
|
|
101
|
-
super(e.map((
|
|
102
|
-
|
|
319
|
+
super(e.map((r) => `${r.field}: ${r.message}`).join("; "));
|
|
320
|
+
M(this, "issues");
|
|
103
321
|
this.name = "BriefingContractError", this.issues = e;
|
|
104
322
|
}
|
|
105
323
|
}
|
|
106
|
-
function
|
|
107
|
-
return typeof
|
|
324
|
+
function q(t) {
|
|
325
|
+
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
108
326
|
}
|
|
109
|
-
function c(
|
|
110
|
-
|
|
327
|
+
function c(t, n, e) {
|
|
328
|
+
t.push({ field: n, message: e });
|
|
111
329
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
330
|
+
function g(t, n, e) {
|
|
331
|
+
return q(t) ? t : (c(e, n, "Expected an object."), {});
|
|
114
332
|
}
|
|
115
|
-
function
|
|
333
|
+
function u(t, n, e, r) {
|
|
116
334
|
const o = new Set(e);
|
|
117
|
-
Object.keys(
|
|
335
|
+
Object.keys(t).forEach((i) => {
|
|
118
336
|
o.has(i) || c(
|
|
119
|
-
|
|
120
|
-
|
|
337
|
+
r,
|
|
338
|
+
n ? `${n}.${i}` : i,
|
|
121
339
|
`Unexpected field "${i}".`
|
|
122
340
|
);
|
|
123
341
|
});
|
|
124
342
|
}
|
|
125
|
-
function
|
|
126
|
-
if (typeof
|
|
127
|
-
return c(
|
|
128
|
-
const o =
|
|
129
|
-
return o ? (o.length > e && c(
|
|
343
|
+
function y(t, n, e, r) {
|
|
344
|
+
if (typeof t != "string")
|
|
345
|
+
return c(r, n, "Expected a string."), "";
|
|
346
|
+
const o = t.trim();
|
|
347
|
+
return o ? (o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o) : (c(r, n, "Required value cannot be empty."), "");
|
|
130
348
|
}
|
|
131
|
-
function
|
|
132
|
-
if (
|
|
349
|
+
function h(t, n, e, r) {
|
|
350
|
+
if (t == null)
|
|
133
351
|
return;
|
|
134
|
-
if (typeof
|
|
135
|
-
c(
|
|
352
|
+
if (typeof t != "string") {
|
|
353
|
+
c(r, n, "Expected a string.");
|
|
136
354
|
return;
|
|
137
355
|
}
|
|
138
|
-
const o =
|
|
356
|
+
const o = t.trim();
|
|
139
357
|
if (o)
|
|
140
|
-
return o.length > e && c(
|
|
358
|
+
return o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o;
|
|
141
359
|
}
|
|
142
|
-
function
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
360
|
+
function Ce(t, n, e, r) {
|
|
361
|
+
if (typeof t != "string")
|
|
362
|
+
return c(r, n, "Expected a string."), "";
|
|
363
|
+
const o = t.trim();
|
|
364
|
+
return o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o;
|
|
365
|
+
}
|
|
366
|
+
function ke(t, n, e) {
|
|
367
|
+
if (t != null) {
|
|
368
|
+
if (!Number.isInteger(t) || Number(t) < 0) {
|
|
369
|
+
c(e, n, "Expected a non-negative integer.");
|
|
146
370
|
return;
|
|
147
371
|
}
|
|
148
|
-
return Number(
|
|
372
|
+
return Number(t);
|
|
149
373
|
}
|
|
150
374
|
}
|
|
151
|
-
function $(
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
154
|
-
if (!Array.isArray(
|
|
155
|
-
return c(e,
|
|
375
|
+
function $(t, n, e, r = {}) {
|
|
376
|
+
if (t == null)
|
|
377
|
+
return r.required ? (c(e, n, "Expected at least one evidence id."), []) : void 0;
|
|
378
|
+
if (!Array.isArray(t))
|
|
379
|
+
return c(e, n, "Expected an array."), r.required ? [] : void 0;
|
|
156
380
|
const o = [];
|
|
157
|
-
return
|
|
158
|
-
const
|
|
381
|
+
return t.forEach((i, a) => {
|
|
382
|
+
const l = y(
|
|
159
383
|
i,
|
|
160
|
-
`${
|
|
161
|
-
|
|
384
|
+
`${n}.${a}`,
|
|
385
|
+
d.id,
|
|
162
386
|
e
|
|
163
387
|
);
|
|
164
|
-
|
|
165
|
-
}),
|
|
388
|
+
l && !o.includes(l) && o.push(l);
|
|
389
|
+
}), r.required && o.length === 0 && c(e, n, "Expected at least one evidence id."), o.length > 0 || r.required ? o : void 0;
|
|
166
390
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
391
|
+
function T(t, n, e, r) {
|
|
392
|
+
return t == null ? n : typeof t != "boolean" ? (c(r, e, "Expected a boolean."), n) : t;
|
|
169
393
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
394
|
+
function Ae(t, n) {
|
|
395
|
+
return t == null ? "ACTIVE" : t === "ACTIVE" || t === "PAUSED" || t === "DISABLED" ? t : (c(n, "status", "Expected ACTIVE, PAUSED, or DISABLED."), "ACTIVE");
|
|
172
396
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
397
|
+
function xe(t) {
|
|
398
|
+
return t.includes("@") && t.includes(".") && !t.includes(" ");
|
|
175
399
|
}
|
|
176
|
-
function
|
|
177
|
-
if (
|
|
400
|
+
function K(t, n) {
|
|
401
|
+
if (t == null)
|
|
178
402
|
return { type: "project" };
|
|
179
|
-
const e =
|
|
180
|
-
return
|
|
403
|
+
const e = g(t, "source", n), r = e.type;
|
|
404
|
+
return r === "project" ? (u(e, "source", ["type"], n), { type: "project" }) : r === "dashboard" ? (u(e, "source", ["type", "dashboardId"], n), {
|
|
181
405
|
type: "dashboard",
|
|
182
|
-
dashboardId:
|
|
406
|
+
dashboardId: y(
|
|
183
407
|
e.dashboardId,
|
|
184
408
|
"source.dashboardId",
|
|
185
|
-
|
|
186
|
-
|
|
409
|
+
d.id,
|
|
410
|
+
n
|
|
187
411
|
)
|
|
188
|
-
}) : (c(
|
|
412
|
+
}) : (c(n, "source.type", "Expected project or dashboard."), { type: "project" });
|
|
189
413
|
}
|
|
190
|
-
function
|
|
191
|
-
const e =
|
|
192
|
-
return
|
|
414
|
+
function G(t, n) {
|
|
415
|
+
const e = g(t, "body", n), r = e.type;
|
|
416
|
+
return r === "generated_analysis" ? (u(e, "body", ["type", "instruction"], n), {
|
|
193
417
|
type: "generated_analysis",
|
|
194
|
-
instruction:
|
|
418
|
+
instruction: y(
|
|
195
419
|
e.instruction,
|
|
196
420
|
"body.instruction",
|
|
197
|
-
|
|
198
|
-
|
|
421
|
+
d.instruction,
|
|
422
|
+
n
|
|
199
423
|
)
|
|
200
|
-
}) :
|
|
424
|
+
}) : r === "custom_message" ? (u(e, "body", ["type", "message"], n), {
|
|
201
425
|
type: "custom_message",
|
|
202
|
-
message:
|
|
426
|
+
message: Ce(
|
|
203
427
|
e.message,
|
|
204
428
|
"body.message",
|
|
205
|
-
|
|
206
|
-
|
|
429
|
+
d.customMessage,
|
|
430
|
+
n
|
|
207
431
|
)
|
|
208
|
-
}) :
|
|
209
|
-
|
|
432
|
+
}) : r === "none" ? (u(e, "body", ["type"], n), { type: "none" }) : (c(
|
|
433
|
+
n,
|
|
210
434
|
"body.type",
|
|
211
435
|
"Expected generated_analysis, custom_message, or none."
|
|
212
436
|
), { type: "none" });
|
|
213
437
|
}
|
|
214
|
-
function
|
|
215
|
-
if (
|
|
216
|
-
return [...
|
|
217
|
-
if (!Array.isArray(
|
|
218
|
-
return c(
|
|
219
|
-
if (
|
|
438
|
+
function Se(t, n) {
|
|
439
|
+
if (t == null)
|
|
440
|
+
return [...N];
|
|
441
|
+
if (!Array.isArray(t))
|
|
442
|
+
return c(n, "presentation.artifactFormats", "Expected an array."), [...N];
|
|
443
|
+
if (t.length === 0)
|
|
220
444
|
return c(
|
|
221
|
-
|
|
445
|
+
n,
|
|
222
446
|
"presentation.artifactFormats",
|
|
223
447
|
"Choose at least one artifact format."
|
|
224
448
|
), [];
|
|
225
449
|
const e = [];
|
|
226
|
-
return
|
|
227
|
-
if (typeof
|
|
450
|
+
return t.forEach((r, o) => {
|
|
451
|
+
if (typeof r != "string" || !j.has(r)) {
|
|
228
452
|
c(
|
|
229
|
-
|
|
453
|
+
n,
|
|
230
454
|
`presentation.artifactFormats.${o}`,
|
|
231
455
|
"Expected markdown or html."
|
|
232
456
|
);
|
|
233
457
|
return;
|
|
234
458
|
}
|
|
235
|
-
e.includes(
|
|
459
|
+
e.includes(r) || e.push(r);
|
|
236
460
|
}), e;
|
|
237
461
|
}
|
|
238
|
-
function
|
|
239
|
-
if (
|
|
462
|
+
function H(t, n) {
|
|
463
|
+
if (t == null)
|
|
240
464
|
return {
|
|
241
|
-
artifactFormats: [...
|
|
465
|
+
artifactFormats: [...N],
|
|
242
466
|
includeEvidence: !0,
|
|
243
467
|
includeSql: !0
|
|
244
468
|
};
|
|
245
|
-
const e =
|
|
246
|
-
|
|
469
|
+
const e = g(t, "presentation", n);
|
|
470
|
+
u(
|
|
247
471
|
e,
|
|
248
472
|
"presentation",
|
|
249
473
|
["artifactFormats", "includeEvidence", "includeSql", "audience", "tone", "format"],
|
|
250
|
-
|
|
474
|
+
n
|
|
251
475
|
);
|
|
252
|
-
const
|
|
253
|
-
artifactFormats:
|
|
254
|
-
includeEvidence:
|
|
476
|
+
const r = {
|
|
477
|
+
artifactFormats: Se(e.artifactFormats, n),
|
|
478
|
+
includeEvidence: T(
|
|
255
479
|
e.includeEvidence,
|
|
256
480
|
!0,
|
|
257
481
|
"presentation.includeEvidence",
|
|
258
|
-
|
|
482
|
+
n
|
|
259
483
|
),
|
|
260
|
-
includeSql:
|
|
484
|
+
includeSql: T(
|
|
261
485
|
e.includeSql,
|
|
262
486
|
!0,
|
|
263
487
|
"presentation.includeSql",
|
|
264
|
-
|
|
488
|
+
n
|
|
265
489
|
)
|
|
266
|
-
}, o =
|
|
490
|
+
}, o = h(
|
|
267
491
|
e.audience,
|
|
268
492
|
"presentation.audience",
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
), i =
|
|
493
|
+
d.presentationAudience,
|
|
494
|
+
n
|
|
495
|
+
), i = h(
|
|
272
496
|
e.tone,
|
|
273
497
|
"presentation.tone",
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
), a =
|
|
498
|
+
d.presentationTone,
|
|
499
|
+
n
|
|
500
|
+
), a = h(
|
|
277
501
|
e.format,
|
|
278
502
|
"presentation.format",
|
|
279
|
-
|
|
280
|
-
|
|
503
|
+
d.presentationFormat,
|
|
504
|
+
n
|
|
281
505
|
);
|
|
282
|
-
return o && (
|
|
506
|
+
return o && (r.audience = o), i && (r.tone = i), a && (r.format = a), r;
|
|
283
507
|
}
|
|
284
|
-
function
|
|
285
|
-
return Array.isArray(
|
|
508
|
+
function we(t, n, e) {
|
|
509
|
+
return Array.isArray(t) ? (t.length === 0 && c(e, n, "Expected at least one item."), t.length > b.maxListItems && c(
|
|
286
510
|
e,
|
|
287
|
-
|
|
288
|
-
`Must have ${
|
|
289
|
-
),
|
|
290
|
-
(
|
|
291
|
-
|
|
292
|
-
`${
|
|
293
|
-
|
|
511
|
+
n,
|
|
512
|
+
`Must have ${b.maxListItems} items or fewer.`
|
|
513
|
+
), t.slice(0, b.maxListItems).map(
|
|
514
|
+
(r, o) => y(
|
|
515
|
+
r,
|
|
516
|
+
`${n}.${o}`,
|
|
517
|
+
d.contentItem,
|
|
294
518
|
e
|
|
295
519
|
)
|
|
296
|
-
).filter(Boolean)) : (c(e,
|
|
520
|
+
).filter(Boolean)) : (c(e, n, "Expected an array."), []);
|
|
297
521
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
522
|
+
function De(t, n, e) {
|
|
523
|
+
return t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? typeof t == "string" && t.length > d.contentCell ? (c(
|
|
300
524
|
e,
|
|
301
|
-
|
|
302
|
-
`Must be ${
|
|
303
|
-
),
|
|
304
|
-
}
|
|
305
|
-
function
|
|
306
|
-
if (!Array.isArray(
|
|
307
|
-
return c(e,
|
|
308
|
-
|
|
525
|
+
n,
|
|
526
|
+
`Must be ${d.contentCell} characters or fewer.`
|
|
527
|
+
), t.slice(0, d.contentCell)) : typeof t == "number" && !Number.isFinite(t) ? (c(e, n, "Expected a finite number."), null) : t : (c(e, n, "Expected a string, number, boolean, or null."), null);
|
|
528
|
+
}
|
|
529
|
+
function _e(t, n, e) {
|
|
530
|
+
if (!Array.isArray(t))
|
|
531
|
+
return c(e, n, "Expected an array."), [];
|
|
532
|
+
t.length === 0 && c(e, n, "Expected at least one column."), t.length > b.maxTableColumns && c(
|
|
309
533
|
e,
|
|
310
|
-
|
|
311
|
-
`Must have ${
|
|
534
|
+
n,
|
|
535
|
+
`Must have ${b.maxTableColumns} columns or fewer.`
|
|
312
536
|
);
|
|
313
|
-
const
|
|
314
|
-
return
|
|
315
|
-
const a = `${
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
|
|
537
|
+
const r = /* @__PURE__ */ new Set();
|
|
538
|
+
return t.slice(0, b.maxTableColumns).map((o, i) => {
|
|
539
|
+
const a = `${n}.${i}`, l = g(o, a, e);
|
|
540
|
+
u(l, a, ["key", "label", "kind", "align"], e);
|
|
541
|
+
const f = y(
|
|
542
|
+
l.key,
|
|
319
543
|
`${a}.key`,
|
|
320
|
-
|
|
544
|
+
d.id,
|
|
321
545
|
e
|
|
322
546
|
);
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
|
|
547
|
+
f && (r.has(f) && c(e, `${a}.key`, "Column key must be unique."), r.add(f));
|
|
548
|
+
const s = y(
|
|
549
|
+
l.label,
|
|
326
550
|
`${a}.label`,
|
|
327
|
-
|
|
551
|
+
d.contentTitle,
|
|
328
552
|
e
|
|
329
|
-
),
|
|
330
|
-
|
|
553
|
+
), m = E(
|
|
554
|
+
l.kind,
|
|
331
555
|
`${a}.kind`,
|
|
332
|
-
|
|
556
|
+
$e,
|
|
333
557
|
"text, number, currency, percent, date, or boolean",
|
|
334
558
|
e
|
|
335
559
|
), I = E(
|
|
336
|
-
|
|
560
|
+
l.align,
|
|
337
561
|
`${a}.align`,
|
|
338
|
-
|
|
562
|
+
Ee,
|
|
339
563
|
"left, center, or right",
|
|
340
564
|
e
|
|
341
565
|
);
|
|
342
566
|
return {
|
|
343
|
-
key:
|
|
344
|
-
label:
|
|
345
|
-
...
|
|
567
|
+
key: f,
|
|
568
|
+
label: s,
|
|
569
|
+
...m ? { kind: m } : {},
|
|
346
570
|
...I ? { align: I } : {}
|
|
347
571
|
};
|
|
348
572
|
});
|
|
349
573
|
}
|
|
350
|
-
function
|
|
351
|
-
if (!Array.isArray(
|
|
352
|
-
return c(
|
|
353
|
-
|
|
574
|
+
function Be(t, n, e, r) {
|
|
575
|
+
if (!Array.isArray(t))
|
|
576
|
+
return c(r, n, "Expected an array."), [];
|
|
577
|
+
t.length > b.maxTableRows && c(
|
|
578
|
+
r,
|
|
354
579
|
n,
|
|
355
|
-
|
|
356
|
-
`Must have ${g.maxTableRows} rows or fewer.`
|
|
580
|
+
`Must have ${b.maxTableRows} rows or fewer.`
|
|
357
581
|
);
|
|
358
582
|
const o = new Set(e.map((i) => i.key).filter(Boolean));
|
|
359
|
-
return
|
|
360
|
-
const
|
|
361
|
-
return Object.keys(
|
|
362
|
-
o.has(
|
|
583
|
+
return t.slice(0, b.maxTableRows).map((i, a) => {
|
|
584
|
+
const l = `${n}.${a}`, f = g(i, l, r);
|
|
585
|
+
return Object.keys(f).forEach((s) => {
|
|
586
|
+
o.has(s) || c(r, `${l}.${s}`, `Unexpected table cell "${s}".`);
|
|
363
587
|
}), Object.fromEntries(
|
|
364
|
-
e.map((
|
|
365
|
-
|
|
366
|
-
|
|
588
|
+
e.map((s) => [
|
|
589
|
+
s.key,
|
|
590
|
+
De(f[s.key] ?? null, `${l}.${s.key}`, r)
|
|
367
591
|
])
|
|
368
592
|
);
|
|
369
593
|
});
|
|
370
594
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
595
|
+
function Le(t, n, e) {
|
|
596
|
+
const r = `content.blocks.${n}`, o = g(t, r, e), i = o.type;
|
|
373
597
|
if (i === "heading") {
|
|
374
|
-
|
|
598
|
+
u(o, r, ["type", "text", "level", "evidenceIds"], e);
|
|
375
599
|
const a = o.level === void 0 || o.level === null ? void 0 : o.level === 2 || o.level === 3 ? o.level : void 0;
|
|
376
|
-
o.level !== void 0 && o.level !== null && a === void 0 && c(e, `${
|
|
377
|
-
const
|
|
600
|
+
o.level !== void 0 && o.level !== null && a === void 0 && c(e, `${r}.level`, "Expected 2 or 3.");
|
|
601
|
+
const l = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
378
602
|
return {
|
|
379
603
|
type: "heading",
|
|
380
|
-
text:
|
|
604
|
+
text: y(
|
|
381
605
|
o.text,
|
|
382
|
-
`${
|
|
383
|
-
|
|
606
|
+
`${r}.text`,
|
|
607
|
+
d.contentTitle,
|
|
384
608
|
e
|
|
385
609
|
),
|
|
386
610
|
...a ? { level: a } : {},
|
|
387
|
-
...
|
|
611
|
+
...l ? { evidenceIds: l } : {}
|
|
388
612
|
};
|
|
389
613
|
}
|
|
390
614
|
if (i === "paragraph") {
|
|
391
|
-
|
|
392
|
-
const a = $(o.evidenceIds, `${
|
|
615
|
+
u(o, r, ["type", "text", "evidenceIds"], e);
|
|
616
|
+
const a = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
393
617
|
return {
|
|
394
618
|
type: "paragraph",
|
|
395
|
-
text:
|
|
619
|
+
text: y(
|
|
396
620
|
o.text,
|
|
397
|
-
`${
|
|
398
|
-
|
|
621
|
+
`${r}.text`,
|
|
622
|
+
d.contentText,
|
|
399
623
|
e
|
|
400
624
|
),
|
|
401
625
|
...a ? { evidenceIds: a } : {}
|
|
402
626
|
};
|
|
403
627
|
}
|
|
404
628
|
if (i === "finding") {
|
|
405
|
-
|
|
406
|
-
const a =
|
|
629
|
+
u(o, r, ["type", "title", "text", "severity", "evidenceIds"], e);
|
|
630
|
+
const a = h(
|
|
407
631
|
o.title,
|
|
408
|
-
`${
|
|
409
|
-
|
|
632
|
+
`${r}.title`,
|
|
633
|
+
d.contentTitle,
|
|
410
634
|
e
|
|
411
|
-
),
|
|
635
|
+
), l = E(
|
|
412
636
|
o.severity,
|
|
413
|
-
`${
|
|
414
|
-
|
|
637
|
+
`${r}.severity`,
|
|
638
|
+
Ie,
|
|
415
639
|
"info, positive, warning, or critical",
|
|
416
640
|
e
|
|
417
641
|
);
|
|
418
642
|
return {
|
|
419
643
|
type: "finding",
|
|
420
644
|
...a ? { title: a } : {},
|
|
421
|
-
text:
|
|
645
|
+
text: y(
|
|
422
646
|
o.text,
|
|
423
|
-
`${
|
|
424
|
-
|
|
647
|
+
`${r}.text`,
|
|
648
|
+
d.contentText,
|
|
425
649
|
e
|
|
426
650
|
),
|
|
427
|
-
...
|
|
428
|
-
evidenceIds: $(o.evidenceIds, `${
|
|
651
|
+
...l ? { severity: l } : {},
|
|
652
|
+
evidenceIds: $(o.evidenceIds, `${r}.evidenceIds`, e, {
|
|
429
653
|
required: !0
|
|
430
654
|
}) ?? []
|
|
431
655
|
};
|
|
432
656
|
}
|
|
433
657
|
if (i === "bullets" || i === "actions" || i === "limitations") {
|
|
434
|
-
|
|
435
|
-
const a =
|
|
658
|
+
u(o, r, ["type", "title", "items", "evidenceIds"], e);
|
|
659
|
+
const a = h(
|
|
436
660
|
o.title,
|
|
437
|
-
`${
|
|
438
|
-
|
|
661
|
+
`${r}.title`,
|
|
662
|
+
d.contentTitle,
|
|
439
663
|
e
|
|
440
|
-
),
|
|
664
|
+
), l = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
441
665
|
return {
|
|
442
666
|
type: i,
|
|
443
667
|
...a ? { title: a } : {},
|
|
444
|
-
items:
|
|
445
|
-
...
|
|
668
|
+
items: we(o.items, `${r}.items`, e),
|
|
669
|
+
...l ? { evidenceIds: l } : {}
|
|
446
670
|
};
|
|
447
671
|
}
|
|
448
672
|
if (i === "metric") {
|
|
449
|
-
|
|
673
|
+
u(
|
|
450
674
|
o,
|
|
451
|
-
|
|
675
|
+
r,
|
|
452
676
|
["type", "label", "value", "previousValue", "delta", "unit", "evidenceIds"],
|
|
453
677
|
e
|
|
454
678
|
);
|
|
455
679
|
const a = typeof o.value == "string" || typeof o.value == "number" ? o.value : "";
|
|
456
|
-
a === "" && c(e, `${
|
|
457
|
-
const
|
|
458
|
-
o.previousValue !== void 0 && o.previousValue !== null &&
|
|
459
|
-
const
|
|
460
|
-
o.delta !== void 0 && o.delta !== null &&
|
|
461
|
-
const
|
|
680
|
+
a === "" && c(e, `${r}.value`, "Expected a string or number.");
|
|
681
|
+
const l = o.previousValue === void 0 || o.previousValue === null || typeof o.previousValue == "string" || typeof o.previousValue == "number" ? o.previousValue : void 0;
|
|
682
|
+
o.previousValue !== void 0 && o.previousValue !== null && l === void 0 && c(e, `${r}.previousValue`, "Expected a string, number, or null.");
|
|
683
|
+
const f = o.delta === void 0 || o.delta === null || typeof o.delta == "string" || typeof o.delta == "number" ? o.delta : void 0;
|
|
684
|
+
o.delta !== void 0 && o.delta !== null && f === void 0 && c(e, `${r}.delta`, "Expected a string, number, or null.");
|
|
685
|
+
const s = h(
|
|
462
686
|
o.unit,
|
|
463
|
-
`${
|
|
464
|
-
|
|
687
|
+
`${r}.unit`,
|
|
688
|
+
d.contentTitle,
|
|
465
689
|
e
|
|
466
|
-
),
|
|
690
|
+
), m = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
467
691
|
return {
|
|
468
692
|
type: "metric",
|
|
469
|
-
label:
|
|
693
|
+
label: y(
|
|
470
694
|
o.label,
|
|
471
|
-
`${
|
|
472
|
-
|
|
695
|
+
`${r}.label`,
|
|
696
|
+
d.contentTitle,
|
|
473
697
|
e
|
|
474
698
|
),
|
|
475
699
|
value: a,
|
|
476
|
-
...
|
|
477
|
-
...
|
|
478
|
-
...
|
|
479
|
-
...
|
|
700
|
+
...l !== void 0 ? { previousValue: l } : {},
|
|
701
|
+
...f !== void 0 ? { delta: f } : {},
|
|
702
|
+
...s ? { unit: s } : {},
|
|
703
|
+
...m ? { evidenceIds: m } : {}
|
|
480
704
|
};
|
|
481
705
|
}
|
|
482
706
|
if (i === "kpi_grid") {
|
|
483
|
-
|
|
484
|
-
const a =
|
|
707
|
+
u(o, r, ["type", "title", "tiles", "evidenceIds"], e);
|
|
708
|
+
const a = h(
|
|
485
709
|
o.title,
|
|
486
|
-
`${
|
|
487
|
-
|
|
710
|
+
`${r}.title`,
|
|
711
|
+
d.contentTitle,
|
|
488
712
|
e
|
|
489
|
-
),
|
|
490
|
-
Array.isArray(o.tiles) || c(e, `${
|
|
713
|
+
), l = Array.isArray(o.tiles) ? o.tiles : [];
|
|
714
|
+
Array.isArray(o.tiles) || c(e, `${r}.tiles`, "Expected an array."), l.length === 0 && c(e, `${r}.tiles`, "Expected at least one tile."), l.length > b.maxKpiTiles && c(
|
|
491
715
|
e,
|
|
492
|
-
`${
|
|
493
|
-
`Must have ${
|
|
716
|
+
`${r}.tiles`,
|
|
717
|
+
`Must have ${b.maxKpiTiles} tiles or fewer.`
|
|
494
718
|
);
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
|
|
719
|
+
const f = l.slice(0, b.maxKpiTiles).map((m, I) => {
|
|
720
|
+
const v = `${r}.tiles.${I}`, p = g(m, v, e);
|
|
721
|
+
u(
|
|
722
|
+
p,
|
|
498
723
|
v,
|
|
499
|
-
b,
|
|
500
724
|
["label", "value", "previousValue", "delta", "unit", "evidenceIds"],
|
|
501
725
|
e
|
|
502
726
|
);
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
const
|
|
506
|
-
|
|
727
|
+
const C = typeof p.value == "string" || typeof p.value == "number" ? p.value : "";
|
|
728
|
+
C === "" && c(e, `${v}.value`, "Expected a string or number.");
|
|
729
|
+
const x = p.previousValue === void 0 || p.previousValue === null || typeof p.previousValue == "string" || typeof p.previousValue == "number" ? p.previousValue : void 0;
|
|
730
|
+
p.previousValue !== void 0 && p.previousValue !== null && x === void 0 && c(
|
|
507
731
|
e,
|
|
508
|
-
`${
|
|
732
|
+
`${v}.previousValue`,
|
|
509
733
|
"Expected a string, number, or null."
|
|
510
734
|
);
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
`${
|
|
516
|
-
|
|
735
|
+
const S = p.delta === void 0 || p.delta === null || typeof p.delta == "string" || typeof p.delta == "number" ? p.delta : void 0;
|
|
736
|
+
p.delta !== void 0 && p.delta !== null && S === void 0 && c(e, `${v}.delta`, "Expected a string, number, or null.");
|
|
737
|
+
const V = h(
|
|
738
|
+
p.unit,
|
|
739
|
+
`${v}.unit`,
|
|
740
|
+
d.contentTitle,
|
|
517
741
|
e
|
|
518
|
-
),
|
|
519
|
-
|
|
520
|
-
`${
|
|
742
|
+
), z = $(
|
|
743
|
+
p.evidenceIds,
|
|
744
|
+
`${v}.evidenceIds`,
|
|
521
745
|
e
|
|
522
746
|
);
|
|
523
747
|
return {
|
|
524
|
-
label:
|
|
525
|
-
|
|
526
|
-
`${
|
|
527
|
-
|
|
748
|
+
label: y(
|
|
749
|
+
p.label,
|
|
750
|
+
`${v}.label`,
|
|
751
|
+
d.contentTitle,
|
|
528
752
|
e
|
|
529
753
|
),
|
|
530
|
-
value:
|
|
531
|
-
...
|
|
532
|
-
...
|
|
533
|
-
...
|
|
534
|
-
...
|
|
754
|
+
value: C,
|
|
755
|
+
...x !== void 0 ? { previousValue: x } : {},
|
|
756
|
+
...S !== void 0 ? { delta: S } : {},
|
|
757
|
+
...V ? { unit: V } : {},
|
|
758
|
+
...z ? { evidenceIds: z } : {}
|
|
535
759
|
};
|
|
536
|
-
}),
|
|
760
|
+
}), s = $(
|
|
537
761
|
o.evidenceIds,
|
|
538
|
-
`${
|
|
762
|
+
`${r}.evidenceIds`,
|
|
539
763
|
e
|
|
540
764
|
);
|
|
541
765
|
return {
|
|
542
766
|
type: "kpi_grid",
|
|
543
767
|
...a ? { title: a } : {},
|
|
544
|
-
tiles:
|
|
545
|
-
...
|
|
768
|
+
tiles: f,
|
|
769
|
+
...s ? { evidenceIds: s } : {}
|
|
546
770
|
};
|
|
547
771
|
}
|
|
548
772
|
if (i === "progress") {
|
|
549
|
-
|
|
773
|
+
u(o, r, ["type", "label", "value", "detail", "evidenceIds"], e);
|
|
550
774
|
const a = typeof o.value == "number" && Number.isFinite(o.value) ? o.value : 0;
|
|
551
|
-
(typeof o.value != "number" || !Number.isFinite(o.value)) && c(e, `${
|
|
552
|
-
const
|
|
775
|
+
(typeof o.value != "number" || !Number.isFinite(o.value)) && c(e, `${r}.value`, "Expected a finite number.");
|
|
776
|
+
const l = h(
|
|
553
777
|
o.detail,
|
|
554
|
-
`${
|
|
555
|
-
|
|
778
|
+
`${r}.detail`,
|
|
779
|
+
d.contentText,
|
|
556
780
|
e
|
|
557
|
-
),
|
|
781
|
+
), f = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
558
782
|
return {
|
|
559
783
|
type: "progress",
|
|
560
|
-
label:
|
|
784
|
+
label: y(
|
|
561
785
|
o.label,
|
|
562
|
-
`${
|
|
563
|
-
|
|
786
|
+
`${r}.label`,
|
|
787
|
+
d.contentTitle,
|
|
564
788
|
e
|
|
565
789
|
),
|
|
566
790
|
value: a,
|
|
567
|
-
...
|
|
568
|
-
...
|
|
791
|
+
...l ? { detail: l } : {},
|
|
792
|
+
...f ? { evidenceIds: f } : {}
|
|
569
793
|
};
|
|
570
794
|
}
|
|
571
795
|
if (i === "table") {
|
|
572
|
-
|
|
796
|
+
u(
|
|
573
797
|
o,
|
|
574
|
-
|
|
798
|
+
r,
|
|
575
799
|
["type", "id", "title", "columns", "rows", "caption", "totalRows", "evidenceIds"],
|
|
576
800
|
e
|
|
577
801
|
);
|
|
578
|
-
const a =
|
|
802
|
+
const a = _e(o.columns, `${r}.columns`, e), l = h(
|
|
579
803
|
o.title,
|
|
580
|
-
`${
|
|
581
|
-
|
|
804
|
+
`${r}.title`,
|
|
805
|
+
d.contentTitle,
|
|
582
806
|
e
|
|
583
|
-
),
|
|
807
|
+
), f = h(
|
|
584
808
|
o.id,
|
|
585
|
-
`${
|
|
586
|
-
|
|
809
|
+
`${r}.id`,
|
|
810
|
+
d.id,
|
|
587
811
|
e
|
|
588
|
-
),
|
|
812
|
+
), s = h(
|
|
589
813
|
o.caption,
|
|
590
|
-
`${
|
|
591
|
-
|
|
814
|
+
`${r}.caption`,
|
|
815
|
+
d.contentItem,
|
|
592
816
|
e
|
|
593
|
-
),
|
|
817
|
+
), m = ke(
|
|
594
818
|
o.totalRows,
|
|
595
|
-
`${
|
|
819
|
+
`${r}.totalRows`,
|
|
596
820
|
e
|
|
597
|
-
), I = $(o.evidenceIds, `${
|
|
821
|
+
), I = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
598
822
|
return {
|
|
599
823
|
type: "table",
|
|
600
|
-
...
|
|
601
|
-
...
|
|
824
|
+
...f ? { id: f } : {},
|
|
825
|
+
...l ? { title: l } : {},
|
|
602
826
|
columns: a,
|
|
603
|
-
rows:
|
|
604
|
-
...
|
|
605
|
-
...
|
|
827
|
+
rows: Be(o.rows, `${r}.rows`, a, e),
|
|
828
|
+
...s ? { caption: s } : {},
|
|
829
|
+
...m !== void 0 ? { totalRows: m } : {},
|
|
606
830
|
...I ? { evidenceIds: I } : {}
|
|
607
831
|
};
|
|
608
832
|
}
|
|
609
833
|
if (i === "evidence_appendix") {
|
|
610
|
-
|
|
611
|
-
const a =
|
|
834
|
+
u(o, r, ["type", "title", "evidenceIds"], e);
|
|
835
|
+
const a = h(
|
|
612
836
|
o.title,
|
|
613
|
-
`${
|
|
614
|
-
|
|
837
|
+
`${r}.title`,
|
|
838
|
+
d.contentTitle,
|
|
615
839
|
e
|
|
616
840
|
);
|
|
617
841
|
return {
|
|
618
842
|
type: "evidence_appendix",
|
|
619
843
|
...a ? { title: a } : {},
|
|
620
|
-
evidenceIds: $(o.evidenceIds, `${
|
|
844
|
+
evidenceIds: $(o.evidenceIds, `${r}.evidenceIds`, e, {
|
|
621
845
|
required: !0
|
|
622
846
|
}) ?? []
|
|
623
847
|
};
|
|
624
848
|
}
|
|
625
849
|
if (i === "sql") {
|
|
626
|
-
|
|
627
|
-
const a =
|
|
850
|
+
u(o, r, ["type", "title", "sql", "evidenceIds"], e);
|
|
851
|
+
const a = h(
|
|
628
852
|
o.title,
|
|
629
|
-
`${
|
|
630
|
-
|
|
853
|
+
`${r}.title`,
|
|
854
|
+
d.contentTitle,
|
|
631
855
|
e
|
|
632
|
-
),
|
|
856
|
+
), l = y(
|
|
633
857
|
o.sql,
|
|
634
|
-
`${
|
|
635
|
-
|
|
858
|
+
`${r}.sql`,
|
|
859
|
+
d.contentSql,
|
|
636
860
|
e
|
|
637
|
-
),
|
|
861
|
+
), f = $(o.evidenceIds, `${r}.evidenceIds`, e);
|
|
638
862
|
return {
|
|
639
863
|
type: "sql",
|
|
640
864
|
...a ? { title: a } : {},
|
|
641
|
-
sql:
|
|
642
|
-
...
|
|
865
|
+
sql: l,
|
|
866
|
+
...f ? { evidenceIds: f } : {}
|
|
643
867
|
};
|
|
644
868
|
}
|
|
645
869
|
return c(
|
|
646
870
|
e,
|
|
647
|
-
`${
|
|
871
|
+
`${r}.type`,
|
|
648
872
|
"Expected heading, paragraph, finding, bullets, metric, kpi_grid, progress, table, actions, limitations, sql, or evidence_appendix."
|
|
649
873
|
), {
|
|
650
874
|
type: "paragraph",
|
|
651
875
|
text: ""
|
|
652
876
|
};
|
|
653
877
|
}
|
|
654
|
-
function
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
const
|
|
878
|
+
function Ne(t) {
|
|
879
|
+
const n = [], e = g(t, "content", n);
|
|
880
|
+
u(e, "content", ["version", "title", "summary", "blocks"], n), e.version !== 1 && c(n, "content.version", "Expected version 1.");
|
|
881
|
+
const r = h(
|
|
658
882
|
e.title,
|
|
659
883
|
"content.title",
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
), o =
|
|
884
|
+
d.contentTitle,
|
|
885
|
+
n
|
|
886
|
+
), o = h(
|
|
663
887
|
e.summary,
|
|
664
888
|
"content.summary",
|
|
665
|
-
|
|
666
|
-
|
|
889
|
+
d.contentSummary,
|
|
890
|
+
n
|
|
667
891
|
);
|
|
668
|
-
Array.isArray(e.blocks) || c(
|
|
892
|
+
Array.isArray(e.blocks) || c(n, "content.blocks", "Expected an array.");
|
|
669
893
|
const i = Array.isArray(e.blocks) ? e.blocks : [];
|
|
670
|
-
i.length === 0 && c(
|
|
671
|
-
|
|
894
|
+
i.length === 0 && c(n, "content.blocks", "Expected at least one block."), i.length > b.maxBlocks && c(
|
|
895
|
+
n,
|
|
672
896
|
"content.blocks",
|
|
673
|
-
`Must have ${
|
|
897
|
+
`Must have ${b.maxBlocks} blocks or fewer.`
|
|
674
898
|
);
|
|
675
|
-
const a = i.slice(0,
|
|
676
|
-
return
|
|
899
|
+
const a = i.slice(0, b.maxBlocks).map((l, f) => Le(l, f, n));
|
|
900
|
+
return O(n), {
|
|
677
901
|
version: 1,
|
|
678
|
-
...
|
|
902
|
+
...r ? { title: r } : {},
|
|
679
903
|
...o ? { summary: o } : {},
|
|
680
904
|
blocks: a
|
|
681
905
|
};
|
|
682
906
|
}
|
|
683
|
-
function
|
|
907
|
+
function at(t) {
|
|
684
908
|
try {
|
|
685
909
|
return {
|
|
686
910
|
valid: !0,
|
|
687
|
-
value:
|
|
911
|
+
value: Ne(t),
|
|
688
912
|
issues: []
|
|
689
913
|
};
|
|
690
|
-
} catch (
|
|
691
|
-
if (
|
|
692
|
-
return { valid: !1, issues:
|
|
693
|
-
throw
|
|
914
|
+
} catch (n) {
|
|
915
|
+
if (n instanceof A)
|
|
916
|
+
return { valid: !1, issues: n.issues };
|
|
917
|
+
throw n;
|
|
694
918
|
}
|
|
695
919
|
}
|
|
696
|
-
function
|
|
697
|
-
return typeof
|
|
920
|
+
function k(t, n, e, r) {
|
|
921
|
+
return typeof t == "string" && e.includes(t) ? t : (c(r, n, `Expected ${e.join(" or ")}.`), e[0]);
|
|
698
922
|
}
|
|
699
|
-
function E(
|
|
700
|
-
if (
|
|
701
|
-
if (typeof
|
|
702
|
-
return
|
|
703
|
-
c(o,
|
|
923
|
+
function E(t, n, e, r, o) {
|
|
924
|
+
if (t != null) {
|
|
925
|
+
if (typeof t == "string" && e.has(t))
|
|
926
|
+
return t;
|
|
927
|
+
c(o, n, `Expected ${r}.`);
|
|
704
928
|
}
|
|
705
929
|
}
|
|
706
|
-
function
|
|
707
|
-
if (
|
|
708
|
-
if (!Array.isArray(
|
|
709
|
-
c(e,
|
|
930
|
+
function Oe(t, n, e) {
|
|
931
|
+
if (t != null) {
|
|
932
|
+
if (!Array.isArray(t)) {
|
|
933
|
+
c(e, n, "Expected an array.");
|
|
710
934
|
return;
|
|
711
935
|
}
|
|
712
|
-
return
|
|
936
|
+
return t;
|
|
713
937
|
}
|
|
714
938
|
}
|
|
715
|
-
function
|
|
716
|
-
if (
|
|
717
|
-
if (!
|
|
718
|
-
c(e,
|
|
939
|
+
function Fe(t, n, e) {
|
|
940
|
+
if (t != null) {
|
|
941
|
+
if (!q(t)) {
|
|
942
|
+
c(e, n, "Expected an object.");
|
|
719
943
|
return;
|
|
720
944
|
}
|
|
721
|
-
return
|
|
945
|
+
return t;
|
|
722
946
|
}
|
|
723
947
|
}
|
|
724
|
-
function
|
|
725
|
-
if (
|
|
948
|
+
function Re(t, n, e) {
|
|
949
|
+
if (t == null)
|
|
726
950
|
return;
|
|
727
|
-
const
|
|
728
|
-
|
|
951
|
+
const r = g(t, n, e);
|
|
952
|
+
u(r, n, Te, e);
|
|
729
953
|
const o = {}, i = E(
|
|
730
|
-
|
|
731
|
-
`${
|
|
732
|
-
|
|
954
|
+
r.pageSize,
|
|
955
|
+
`${n}.pageSize`,
|
|
956
|
+
he,
|
|
733
957
|
"letter, legal, a4, a3, or tabloid",
|
|
734
958
|
e
|
|
735
959
|
), a = E(
|
|
736
|
-
|
|
737
|
-
`${
|
|
738
|
-
|
|
960
|
+
r.orientation,
|
|
961
|
+
`${n}.orientation`,
|
|
962
|
+
ye,
|
|
739
963
|
"portrait or landscape",
|
|
740
964
|
e
|
|
741
|
-
),
|
|
742
|
-
|
|
743
|
-
`${
|
|
744
|
-
|
|
965
|
+
), l = E(
|
|
966
|
+
r.delimiter,
|
|
967
|
+
`${n}.delimiter`,
|
|
968
|
+
ge,
|
|
745
969
|
"comma, semicolon, or tab",
|
|
746
970
|
e
|
|
747
|
-
),
|
|
748
|
-
|
|
749
|
-
`${
|
|
750
|
-
|
|
971
|
+
), f = E(
|
|
972
|
+
r.sheetSelection,
|
|
973
|
+
`${n}.sheetSelection`,
|
|
974
|
+
ve,
|
|
751
975
|
"current or all",
|
|
752
976
|
e
|
|
753
977
|
);
|
|
754
|
-
i && (o.pageSize = i), a && (o.orientation = a),
|
|
755
|
-
for (const
|
|
978
|
+
i && (o.pageSize = i), a && (o.orientation = a), l && (o.delimiter = l), f && (o.sheetSelection = f);
|
|
979
|
+
for (const s of [
|
|
756
980
|
"includeFilters",
|
|
757
981
|
"includeTimestamp",
|
|
758
982
|
"includeHeaders",
|
|
759
|
-
"useFormattedValues"
|
|
983
|
+
"useFormattedValues",
|
|
984
|
+
"allowDownload"
|
|
760
985
|
])
|
|
761
|
-
if (!(
|
|
762
|
-
if (typeof
|
|
763
|
-
c(e, `${
|
|
986
|
+
if (!(r[s] === void 0 || r[s] === null)) {
|
|
987
|
+
if (typeof r[s] != "boolean") {
|
|
988
|
+
c(e, `${n}.${s}`, "Expected a boolean.");
|
|
764
989
|
continue;
|
|
765
990
|
}
|
|
766
|
-
o[
|
|
991
|
+
o[s] = r[s];
|
|
767
992
|
}
|
|
768
|
-
for (const
|
|
993
|
+
for (const s of [
|
|
769
994
|
"currentSheetId",
|
|
770
995
|
"currentSheetName",
|
|
771
996
|
"filterLine",
|
|
@@ -773,15 +998,15 @@ function $e(r, t, e) {
|
|
|
773
998
|
"cardType",
|
|
774
999
|
"theme"
|
|
775
1000
|
]) {
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
`${
|
|
779
|
-
|
|
1001
|
+
const m = h(
|
|
1002
|
+
r[s],
|
|
1003
|
+
`${n}.${s}`,
|
|
1004
|
+
d.id,
|
|
780
1005
|
e
|
|
781
1006
|
);
|
|
782
|
-
|
|
1007
|
+
m && (o[s] = m);
|
|
783
1008
|
}
|
|
784
|
-
for (const
|
|
1009
|
+
for (const s of [
|
|
785
1010
|
"filterValues",
|
|
786
1011
|
"inlineFilterValues",
|
|
787
1012
|
"sheetFilterValues",
|
|
@@ -789,293 +1014,256 @@ function $e(r, t, e) {
|
|
|
789
1014
|
"cardControlDefinitions",
|
|
790
1015
|
"controlBindings"
|
|
791
1016
|
]) {
|
|
792
|
-
const
|
|
793
|
-
|
|
1017
|
+
const m = Oe(r[s], `${n}.${s}`, e);
|
|
1018
|
+
m && (o[s] = m);
|
|
794
1019
|
}
|
|
795
|
-
for (const
|
|
1020
|
+
for (const s of [
|
|
796
1021
|
"controlValues",
|
|
797
1022
|
"tablePreferences",
|
|
798
1023
|
"dashboardInputExecutionSnapshot"
|
|
799
1024
|
]) {
|
|
800
|
-
const
|
|
801
|
-
|
|
1025
|
+
const m = Fe(r[s], `${n}.${s}`, e);
|
|
1026
|
+
m && (o[s] = m);
|
|
802
1027
|
}
|
|
803
1028
|
return Object.keys(o).length > 0 ? o : void 0;
|
|
804
1029
|
}
|
|
805
|
-
function
|
|
806
|
-
const o =
|
|
807
|
-
|
|
1030
|
+
function _(t, n, e, r) {
|
|
1031
|
+
const o = h(
|
|
1032
|
+
n,
|
|
808
1033
|
e,
|
|
809
|
-
|
|
810
|
-
|
|
1034
|
+
d.attachmentTitle,
|
|
1035
|
+
r
|
|
811
1036
|
);
|
|
812
|
-
return o && (
|
|
1037
|
+
return o && (t.title = o), t;
|
|
813
1038
|
}
|
|
814
|
-
function
|
|
815
|
-
const o =
|
|
816
|
-
return o && (
|
|
1039
|
+
function B(t, n, e, r) {
|
|
1040
|
+
const o = Re(n, e, r);
|
|
1041
|
+
return o && (t.settings = o), t;
|
|
817
1042
|
}
|
|
818
|
-
function
|
|
819
|
-
const
|
|
1043
|
+
function Ve(t, n, e) {
|
|
1044
|
+
const r = `attachments.${n}`, o = g(t, r, e), i = o.type;
|
|
820
1045
|
if (i === "dashboard") {
|
|
821
|
-
|
|
1046
|
+
u(
|
|
822
1047
|
o,
|
|
823
|
-
|
|
1048
|
+
r,
|
|
824
1049
|
["type", "dashboardId", "format", "title", "settings"],
|
|
825
1050
|
e
|
|
826
1051
|
);
|
|
827
|
-
const a =
|
|
1052
|
+
const a = _(
|
|
828
1053
|
{
|
|
829
1054
|
type: "dashboard",
|
|
830
|
-
dashboardId:
|
|
1055
|
+
dashboardId: y(
|
|
831
1056
|
o.dashboardId,
|
|
832
|
-
`${
|
|
833
|
-
|
|
1057
|
+
`${r}.dashboardId`,
|
|
1058
|
+
d.id,
|
|
834
1059
|
e
|
|
835
1060
|
),
|
|
836
|
-
format:
|
|
1061
|
+
format: k(o.format, `${r}.format`, ["pdf"], e)
|
|
837
1062
|
},
|
|
838
1063
|
o.title,
|
|
839
|
-
`${
|
|
1064
|
+
`${r}.title`,
|
|
840
1065
|
e
|
|
841
1066
|
);
|
|
842
|
-
return
|
|
1067
|
+
return B(a, o.settings, `${r}.settings`, e);
|
|
843
1068
|
}
|
|
844
1069
|
if (i === "dashboard_sheet" || i === "document_sheet") {
|
|
845
|
-
|
|
1070
|
+
u(
|
|
846
1071
|
o,
|
|
847
|
-
|
|
1072
|
+
r,
|
|
848
1073
|
["type", "dashboardId", "sheetId", "format", "title", "settings"],
|
|
849
1074
|
e
|
|
850
1075
|
);
|
|
851
|
-
const a =
|
|
1076
|
+
const a = _(
|
|
852
1077
|
{
|
|
853
1078
|
type: i,
|
|
854
|
-
dashboardId:
|
|
1079
|
+
dashboardId: y(
|
|
855
1080
|
o.dashboardId,
|
|
856
|
-
`${
|
|
857
|
-
|
|
1081
|
+
`${r}.dashboardId`,
|
|
1082
|
+
d.id,
|
|
858
1083
|
e
|
|
859
1084
|
),
|
|
860
|
-
sheetId:
|
|
1085
|
+
sheetId: y(
|
|
861
1086
|
o.sheetId,
|
|
862
|
-
`${
|
|
863
|
-
|
|
1087
|
+
`${r}.sheetId`,
|
|
1088
|
+
d.id,
|
|
864
1089
|
e
|
|
865
1090
|
),
|
|
866
|
-
format:
|
|
1091
|
+
format: k(o.format, `${r}.format`, ["pdf"], e)
|
|
867
1092
|
},
|
|
868
1093
|
o.title,
|
|
869
|
-
`${
|
|
1094
|
+
`${r}.title`,
|
|
870
1095
|
e
|
|
871
1096
|
);
|
|
872
|
-
return
|
|
873
|
-
}
|
|
874
|
-
if (i === "visual") {
|
|
875
|
-
m(
|
|
876
|
-
o,
|
|
877
|
-
n,
|
|
878
|
-
["type", "dashboardId", "visualId", "format", "title", "settings"],
|
|
879
|
-
e
|
|
880
|
-
);
|
|
881
|
-
const a = T(
|
|
882
|
-
{
|
|
883
|
-
type: "visual",
|
|
884
|
-
dashboardId: u(
|
|
885
|
-
o.dashboardId,
|
|
886
|
-
`${n}.dashboardId`,
|
|
887
|
-
l.id,
|
|
888
|
-
e
|
|
889
|
-
),
|
|
890
|
-
visualId: u(
|
|
891
|
-
o.visualId,
|
|
892
|
-
`${n}.visualId`,
|
|
893
|
-
l.id,
|
|
894
|
-
e
|
|
895
|
-
),
|
|
896
|
-
format: x(
|
|
897
|
-
o.format,
|
|
898
|
-
`${n}.format`,
|
|
899
|
-
["pdf", "png"],
|
|
900
|
-
e
|
|
901
|
-
)
|
|
902
|
-
},
|
|
903
|
-
o.title,
|
|
904
|
-
`${n}.title`,
|
|
905
|
-
e
|
|
906
|
-
);
|
|
907
|
-
return A(a, o.settings, `${n}.settings`, e);
|
|
1097
|
+
return B(a, o.settings, `${r}.settings`, e);
|
|
908
1098
|
}
|
|
909
1099
|
if (i === "card") {
|
|
910
|
-
|
|
1100
|
+
u(
|
|
911
1101
|
o,
|
|
912
|
-
|
|
1102
|
+
r,
|
|
913
1103
|
["type", "dashboardId", "cardId", "format", "title", "settings"],
|
|
914
1104
|
e
|
|
915
1105
|
);
|
|
916
|
-
const a =
|
|
1106
|
+
const a = _(
|
|
917
1107
|
{
|
|
918
1108
|
type: "card",
|
|
919
|
-
dashboardId:
|
|
1109
|
+
dashboardId: y(
|
|
920
1110
|
o.dashboardId,
|
|
921
|
-
`${
|
|
922
|
-
|
|
1111
|
+
`${r}.dashboardId`,
|
|
1112
|
+
d.id,
|
|
923
1113
|
e
|
|
924
1114
|
),
|
|
925
|
-
cardId:
|
|
1115
|
+
cardId: y(
|
|
926
1116
|
o.cardId,
|
|
927
|
-
`${
|
|
928
|
-
|
|
1117
|
+
`${r}.cardId`,
|
|
1118
|
+
d.id,
|
|
929
1119
|
e
|
|
930
1120
|
),
|
|
931
|
-
format:
|
|
1121
|
+
format: k(
|
|
932
1122
|
o.format,
|
|
933
|
-
`${
|
|
934
|
-
["csv", "pdf"
|
|
1123
|
+
`${r}.format`,
|
|
1124
|
+
["csv", "pdf"],
|
|
935
1125
|
e
|
|
936
1126
|
)
|
|
937
1127
|
},
|
|
938
1128
|
o.title,
|
|
939
|
-
`${
|
|
1129
|
+
`${r}.title`,
|
|
940
1130
|
e
|
|
941
1131
|
);
|
|
942
|
-
return
|
|
1132
|
+
return B(a, o.settings, `${r}.settings`, e);
|
|
943
1133
|
}
|
|
944
1134
|
return c(
|
|
945
1135
|
e,
|
|
946
|
-
`${
|
|
947
|
-
"Expected dashboard, dashboard_sheet, document_sheet,
|
|
1136
|
+
`${r}.type`,
|
|
1137
|
+
"Expected dashboard, dashboard_sheet, document_sheet, or card."
|
|
948
1138
|
), { type: "dashboard", dashboardId: "", format: "pdf" };
|
|
949
1139
|
}
|
|
950
|
-
function
|
|
951
|
-
switch (
|
|
1140
|
+
function ze(t) {
|
|
1141
|
+
switch (t.type) {
|
|
952
1142
|
case "dashboard":
|
|
953
|
-
return `${
|
|
1143
|
+
return `${t.type}:${t.dashboardId}:${t.format}`;
|
|
954
1144
|
case "dashboard_sheet":
|
|
955
1145
|
case "document_sheet":
|
|
956
|
-
return `${
|
|
957
|
-
case "visual":
|
|
958
|
-
return `${r.type}:${r.dashboardId}:${r.visualId}:${r.format}`;
|
|
1146
|
+
return `${t.type}:${t.dashboardId}:${t.sheetId}:${t.format}`;
|
|
959
1147
|
case "card":
|
|
960
|
-
return `${
|
|
1148
|
+
return `${t.type}:${t.dashboardId}:${t.cardId}:${t.format}`;
|
|
961
1149
|
}
|
|
962
1150
|
}
|
|
963
|
-
function
|
|
964
|
-
if (
|
|
1151
|
+
function W(t, n) {
|
|
1152
|
+
if (t == null)
|
|
965
1153
|
return [];
|
|
966
|
-
if (!Array.isArray(
|
|
967
|
-
return c(
|
|
968
|
-
|
|
969
|
-
|
|
1154
|
+
if (!Array.isArray(t))
|
|
1155
|
+
return c(n, "attachments", "Expected an array."), [];
|
|
1156
|
+
t.length > w && c(
|
|
1157
|
+
n,
|
|
970
1158
|
"attachments",
|
|
971
|
-
|
|
1159
|
+
`Choose ${w} attachments or fewer.`
|
|
972
1160
|
);
|
|
973
|
-
const e =
|
|
1161
|
+
const e = t.slice(0, w).map((o, i) => Ve(o, i, n)), r = /* @__PURE__ */ new Set();
|
|
974
1162
|
return e.forEach((o, i) => {
|
|
975
|
-
const a =
|
|
976
|
-
|
|
1163
|
+
const a = ze(o);
|
|
1164
|
+
r.has(a) && c(n, `attachments.${i}`, "Duplicate attachment."), r.add(a);
|
|
977
1165
|
}), e;
|
|
978
1166
|
}
|
|
979
|
-
function
|
|
980
|
-
if (
|
|
1167
|
+
function Z(t, n) {
|
|
1168
|
+
if (t == null)
|
|
981
1169
|
return;
|
|
982
|
-
const e =
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
return Object.keys(
|
|
1170
|
+
const e = g(t, "limits", n);
|
|
1171
|
+
u(e, "limits", Object.keys(D), n);
|
|
1172
|
+
const r = {};
|
|
1173
|
+
return Object.keys(D).forEach((o) => {
|
|
986
1174
|
const i = e[o];
|
|
987
1175
|
if (i == null)
|
|
988
1176
|
return;
|
|
989
|
-
const a =
|
|
1177
|
+
const a = D[o];
|
|
990
1178
|
if (typeof i != "number" || !Number.isInteger(i) || i < a.min || i > a.max) {
|
|
991
1179
|
c(
|
|
992
|
-
|
|
1180
|
+
n,
|
|
993
1181
|
`limits.${o}`,
|
|
994
1182
|
`Expected an integer between ${a.min} and ${a.max}.`
|
|
995
1183
|
);
|
|
996
1184
|
return;
|
|
997
1185
|
}
|
|
998
|
-
|
|
999
|
-
}), Object.keys(
|
|
1186
|
+
r[o] = i;
|
|
1187
|
+
}), Object.keys(r).length > 0 ? r : void 0;
|
|
1000
1188
|
}
|
|
1001
|
-
function
|
|
1002
|
-
if (
|
|
1003
|
-
throw new
|
|
1189
|
+
function O(t) {
|
|
1190
|
+
if (t.length > 0)
|
|
1191
|
+
throw new A(t);
|
|
1004
1192
|
}
|
|
1005
|
-
function
|
|
1006
|
-
|
|
1193
|
+
function Y(t, n, e) {
|
|
1194
|
+
!(t.type === "generated_analysis" || t.type === "custom_message" && !!t.message.trim()) && n.length === 0 && c(
|
|
1007
1195
|
e,
|
|
1008
1196
|
"body",
|
|
1009
1197
|
"Add briefing instructions, a custom message, or at least one attachment."
|
|
1010
1198
|
);
|
|
1011
1199
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1200
|
+
function J(t) {
|
|
1201
|
+
const n = [], e = g(t, "jobConfig", n);
|
|
1202
|
+
u(
|
|
1015
1203
|
e,
|
|
1016
1204
|
"jobConfig",
|
|
1017
1205
|
["kind", "source", "body", "attachments", "presentation", "limits"],
|
|
1018
|
-
|
|
1019
|
-
), e.kind !==
|
|
1020
|
-
const
|
|
1021
|
-
return
|
|
1022
|
-
kind:
|
|
1023
|
-
source:
|
|
1206
|
+
n
|
|
1207
|
+
), e.kind !== L && c(n, "kind", "Expected BRIEFING.");
|
|
1208
|
+
const r = K(e.source, n), o = G(e.body, n), i = W(e.attachments, n), a = H(e.presentation, n), l = Z(e.limits, n);
|
|
1209
|
+
return Y(o, i, n), O(n), {
|
|
1210
|
+
kind: L,
|
|
1211
|
+
source: r,
|
|
1024
1212
|
body: o,
|
|
1025
1213
|
attachments: i,
|
|
1026
1214
|
presentation: a,
|
|
1027
|
-
...
|
|
1215
|
+
...l ? { limits: l } : {}
|
|
1028
1216
|
};
|
|
1029
1217
|
}
|
|
1030
|
-
function
|
|
1031
|
-
return
|
|
1032
|
-
...
|
|
1033
|
-
kind:
|
|
1218
|
+
function ct(t) {
|
|
1219
|
+
return J({
|
|
1220
|
+
...t,
|
|
1221
|
+
kind: L
|
|
1034
1222
|
});
|
|
1035
1223
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const o = `${
|
|
1224
|
+
function F(t, n, e, r = "deliveryConfig.recipients") {
|
|
1225
|
+
const o = `${r}.${n}`, i = g(t, o, e), a = i.type;
|
|
1038
1226
|
if (a === "email") {
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1227
|
+
u(i, o, ["type", "address", "name"], e);
|
|
1228
|
+
const l = y(
|
|
1041
1229
|
i.address,
|
|
1042
1230
|
`${o}.address`,
|
|
1043
|
-
|
|
1231
|
+
d.id,
|
|
1044
1232
|
e
|
|
1045
|
-
),
|
|
1233
|
+
), f = h(
|
|
1046
1234
|
i.name,
|
|
1047
1235
|
`${o}.name`,
|
|
1048
|
-
|
|
1236
|
+
d.attachmentTitle,
|
|
1049
1237
|
e
|
|
1050
1238
|
);
|
|
1051
|
-
return
|
|
1239
|
+
return l && !xe(l) && c(e, `${o}.address`, "Email address is invalid."), {
|
|
1052
1240
|
type: "email",
|
|
1053
|
-
address:
|
|
1054
|
-
...
|
|
1241
|
+
address: l,
|
|
1242
|
+
...f ? { name: f } : {}
|
|
1055
1243
|
};
|
|
1056
1244
|
}
|
|
1057
|
-
return a === "user" ? (
|
|
1245
|
+
return a === "user" ? (u(i, o, ["type", "userId"], e), {
|
|
1058
1246
|
type: "user",
|
|
1059
|
-
userId:
|
|
1247
|
+
userId: y(
|
|
1060
1248
|
i.userId,
|
|
1061
1249
|
`${o}.userId`,
|
|
1062
|
-
|
|
1250
|
+
d.id,
|
|
1063
1251
|
e
|
|
1064
1252
|
)
|
|
1065
|
-
}) : a === "tenant_user" ? (
|
|
1253
|
+
}) : a === "tenant_user" ? (u(i, o, ["type", "tenantUserId"], e), {
|
|
1066
1254
|
type: "tenant_user",
|
|
1067
|
-
tenantUserId:
|
|
1255
|
+
tenantUserId: y(
|
|
1068
1256
|
i.tenantUserId,
|
|
1069
1257
|
`${o}.tenantUserId`,
|
|
1070
|
-
|
|
1258
|
+
d.id,
|
|
1071
1259
|
e
|
|
1072
1260
|
)
|
|
1073
|
-
}) : a === "group" ? (
|
|
1261
|
+
}) : a === "group" ? (u(i, o, ["type", "groupId"], e), {
|
|
1074
1262
|
type: "group",
|
|
1075
|
-
groupId:
|
|
1263
|
+
groupId: y(
|
|
1076
1264
|
i.groupId,
|
|
1077
1265
|
`${o}.groupId`,
|
|
1078
|
-
|
|
1266
|
+
d.id,
|
|
1079
1267
|
e
|
|
1080
1268
|
)
|
|
1081
1269
|
}) : (c(
|
|
@@ -1084,122 +1272,122 @@ function N(r, t, e, n = "deliveryConfig.recipients") {
|
|
|
1084
1272
|
"Expected email, user, tenant_user, or group."
|
|
1085
1273
|
), { type: "email", address: "" });
|
|
1086
1274
|
}
|
|
1087
|
-
function
|
|
1088
|
-
return
|
|
1089
|
-
(e,
|
|
1090
|
-
) : (c(
|
|
1275
|
+
function Me(t, n) {
|
|
1276
|
+
return t == null ? [] : Array.isArray(t) ? t.map(
|
|
1277
|
+
(e, r) => F(e, r, n)
|
|
1278
|
+
) : (c(n, "deliveryConfig.recipients", "Expected an array."), []);
|
|
1091
1279
|
}
|
|
1092
|
-
function
|
|
1093
|
-
if (!Array.isArray(
|
|
1094
|
-
return c(
|
|
1280
|
+
function Pe(t, n) {
|
|
1281
|
+
if (!Array.isArray(t))
|
|
1282
|
+
return c(n, "deliveryConfig.channels", "Expected an array."), [];
|
|
1095
1283
|
const e = [];
|
|
1096
|
-
return
|
|
1097
|
-
if (!
|
|
1284
|
+
return t.forEach((r, o) => {
|
|
1285
|
+
if (!X(r)) {
|
|
1098
1286
|
c(
|
|
1099
|
-
|
|
1287
|
+
n,
|
|
1100
1288
|
`deliveryConfig.channels.${o}`,
|
|
1101
1289
|
"Expected EMAIL, WEBHOOK, SLACK, IN_APP, or TELEGRAM."
|
|
1102
1290
|
);
|
|
1103
1291
|
return;
|
|
1104
1292
|
}
|
|
1105
|
-
e.includes(
|
|
1293
|
+
e.includes(r) || e.push(r);
|
|
1106
1294
|
}), e;
|
|
1107
1295
|
}
|
|
1108
|
-
function
|
|
1109
|
-
if (
|
|
1296
|
+
function Ue(t, n, e) {
|
|
1297
|
+
if (t == null)
|
|
1110
1298
|
return;
|
|
1111
|
-
const
|
|
1112
|
-
return Object.entries(
|
|
1299
|
+
const r = g(t, n, e), o = {};
|
|
1300
|
+
return Object.entries(r).forEach(([i, a]) => {
|
|
1113
1301
|
if (typeof a != "string") {
|
|
1114
|
-
c(e, `${
|
|
1302
|
+
c(e, `${n}.${i}`, "Expected a string.");
|
|
1115
1303
|
return;
|
|
1116
1304
|
}
|
|
1117
1305
|
o[i] = a.trim();
|
|
1118
1306
|
}), Object.keys(o).length > 0 ? o : void 0;
|
|
1119
1307
|
}
|
|
1120
|
-
function
|
|
1121
|
-
if (
|
|
1308
|
+
function je(t, n, e) {
|
|
1309
|
+
if (t == null)
|
|
1122
1310
|
return;
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1311
|
+
const r = g(t, n, e);
|
|
1312
|
+
u(
|
|
1313
|
+
r,
|
|
1125
1314
|
n,
|
|
1126
|
-
t,
|
|
1127
1315
|
["url", "method", "headers", "secretEncrypted"],
|
|
1128
1316
|
e
|
|
1129
1317
|
);
|
|
1130
|
-
const o =
|
|
1131
|
-
|
|
1132
|
-
`${
|
|
1318
|
+
const o = r.method === void 0 || r.method === null ? void 0 : k(r.method, `${n}.method`, ["POST", "PUT"], e), i = Ue(r.headers, `${n}.headers`, e), a = h(
|
|
1319
|
+
r.secretEncrypted,
|
|
1320
|
+
`${n}.secretEncrypted`,
|
|
1133
1321
|
2e3,
|
|
1134
1322
|
e
|
|
1135
1323
|
);
|
|
1136
1324
|
return {
|
|
1137
|
-
url:
|
|
1325
|
+
url: y(r.url, `${n}.url`, 2e3, e),
|
|
1138
1326
|
...o ? { method: o } : {},
|
|
1139
1327
|
...i ? { headers: i } : {},
|
|
1140
1328
|
...a ? { secretEncrypted: a } : {}
|
|
1141
1329
|
};
|
|
1142
1330
|
}
|
|
1143
|
-
function
|
|
1144
|
-
const
|
|
1331
|
+
function qe(t, n, e) {
|
|
1332
|
+
const r = g(t, n, e), o = r.type;
|
|
1145
1333
|
if (o === "channel") {
|
|
1146
|
-
|
|
1334
|
+
u(
|
|
1335
|
+
r,
|
|
1147
1336
|
n,
|
|
1148
|
-
t,
|
|
1149
1337
|
["type", "channelId", "channelName", "isPrivate"],
|
|
1150
1338
|
e
|
|
1151
1339
|
);
|
|
1152
|
-
const i =
|
|
1153
|
-
|
|
1154
|
-
`${
|
|
1155
|
-
|
|
1340
|
+
const i = h(
|
|
1341
|
+
r.channelName,
|
|
1342
|
+
`${n}.channelName`,
|
|
1343
|
+
d.attachmentTitle,
|
|
1156
1344
|
e
|
|
1157
|
-
), a =
|
|
1158
|
-
|
|
1345
|
+
), a = r.isPrivate === void 0 || r.isPrivate === null ? void 0 : T(
|
|
1346
|
+
r.isPrivate,
|
|
1159
1347
|
!1,
|
|
1160
|
-
`${
|
|
1348
|
+
`${n}.isPrivate`,
|
|
1161
1349
|
e
|
|
1162
1350
|
);
|
|
1163
1351
|
return {
|
|
1164
1352
|
type: "channel",
|
|
1165
|
-
channelId:
|
|
1166
|
-
|
|
1167
|
-
`${
|
|
1168
|
-
|
|
1353
|
+
channelId: y(
|
|
1354
|
+
r.channelId,
|
|
1355
|
+
`${n}.channelId`,
|
|
1356
|
+
d.id,
|
|
1169
1357
|
e
|
|
1170
1358
|
),
|
|
1171
1359
|
...i ? { channelName: i } : {},
|
|
1172
1360
|
...a !== void 0 ? { isPrivate: a } : {}
|
|
1173
1361
|
};
|
|
1174
1362
|
}
|
|
1175
|
-
return o === "dm" ? (
|
|
1363
|
+
return o === "dm" ? (u(r, n, ["type", "recipient"], e), c(
|
|
1176
1364
|
e,
|
|
1177
|
-
`${
|
|
1365
|
+
`${n}.type`,
|
|
1178
1366
|
"Slack DM delivery is not supported in V1."
|
|
1179
1367
|
), {
|
|
1180
1368
|
type: "dm",
|
|
1181
|
-
recipient:
|
|
1182
|
-
}) : (c(e, `${
|
|
1369
|
+
recipient: F(r.recipient, 0, e, `${n}.recipient`)
|
|
1370
|
+
}) : (c(e, `${n}.type`, "Expected channel."), { type: "channel", channelId: "" });
|
|
1183
1371
|
}
|
|
1184
|
-
function
|
|
1185
|
-
if (
|
|
1372
|
+
function Ke(t, n, e) {
|
|
1373
|
+
if (t == null)
|
|
1186
1374
|
return;
|
|
1187
|
-
if (!Array.isArray(
|
|
1188
|
-
c(e,
|
|
1375
|
+
if (!Array.isArray(t)) {
|
|
1376
|
+
c(e, n, "Expected an array.");
|
|
1189
1377
|
return;
|
|
1190
1378
|
}
|
|
1191
|
-
const
|
|
1192
|
-
(o, i) =>
|
|
1379
|
+
const r = t.map(
|
|
1380
|
+
(o, i) => F(o, i, e, n)
|
|
1193
1381
|
);
|
|
1194
|
-
return
|
|
1382
|
+
return r.length > 0 ? r : void 0;
|
|
1195
1383
|
}
|
|
1196
|
-
function
|
|
1197
|
-
if (
|
|
1384
|
+
function Ge(t, n, e) {
|
|
1385
|
+
if (t == null)
|
|
1198
1386
|
return;
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1387
|
+
const r = g(t, n, e);
|
|
1388
|
+
u(
|
|
1389
|
+
r,
|
|
1201
1390
|
n,
|
|
1202
|
-
t,
|
|
1203
1391
|
[
|
|
1204
1392
|
"destination",
|
|
1205
1393
|
"threadMentions",
|
|
@@ -1209,43 +1397,43 @@ function Le(r, t, e) {
|
|
|
1209
1397
|
],
|
|
1210
1398
|
e
|
|
1211
1399
|
);
|
|
1212
|
-
const o =
|
|
1213
|
-
|
|
1214
|
-
`${
|
|
1400
|
+
const o = Ke(
|
|
1401
|
+
r.threadMentions,
|
|
1402
|
+
`${n}.threadMentions`,
|
|
1215
1403
|
e
|
|
1216
|
-
), i =
|
|
1217
|
-
|
|
1404
|
+
), i = T(
|
|
1405
|
+
r.postThreadDetail,
|
|
1218
1406
|
!0,
|
|
1219
|
-
`${
|
|
1407
|
+
`${n}.postThreadDetail`,
|
|
1220
1408
|
e
|
|
1221
|
-
), a =
|
|
1222
|
-
|
|
1409
|
+
), a = T(
|
|
1410
|
+
r.includeDashboardLink,
|
|
1223
1411
|
!0,
|
|
1224
|
-
`${
|
|
1412
|
+
`${n}.includeDashboardLink`,
|
|
1225
1413
|
e
|
|
1226
|
-
),
|
|
1227
|
-
|
|
1414
|
+
), l = T(
|
|
1415
|
+
r.includeBriefingLink,
|
|
1228
1416
|
!0,
|
|
1229
|
-
`${
|
|
1417
|
+
`${n}.includeBriefingLink`,
|
|
1230
1418
|
e
|
|
1231
1419
|
);
|
|
1232
1420
|
return {
|
|
1233
|
-
destination:
|
|
1234
|
-
|
|
1235
|
-
`${
|
|
1421
|
+
destination: qe(
|
|
1422
|
+
r.destination,
|
|
1423
|
+
`${n}.destination`,
|
|
1236
1424
|
e
|
|
1237
1425
|
),
|
|
1238
1426
|
...o ? { threadMentions: o } : {},
|
|
1239
|
-
...
|
|
1240
|
-
...
|
|
1241
|
-
...
|
|
1427
|
+
...r.postThreadDetail !== void 0 ? { postThreadDetail: i } : {},
|
|
1428
|
+
...r.includeDashboardLink !== void 0 ? { includeDashboardLink: a } : {},
|
|
1429
|
+
...r.includeBriefingLink !== void 0 ? { includeBriefingLink: l } : {}
|
|
1242
1430
|
};
|
|
1243
1431
|
}
|
|
1244
|
-
function
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1432
|
+
function He(t, n, e) {
|
|
1433
|
+
const r = g(t, n, e);
|
|
1434
|
+
u(
|
|
1435
|
+
r,
|
|
1247
1436
|
n,
|
|
1248
|
-
t,
|
|
1249
1437
|
[
|
|
1250
1438
|
"subjectOverride",
|
|
1251
1439
|
"titleOverride",
|
|
@@ -1258,109 +1446,109 @@ function we(r, t, e) {
|
|
|
1258
1446
|
e
|
|
1259
1447
|
);
|
|
1260
1448
|
const o = E(
|
|
1261
|
-
|
|
1262
|
-
`${
|
|
1263
|
-
|
|
1449
|
+
r.formatProfile,
|
|
1450
|
+
`${n}.formatProfile`,
|
|
1451
|
+
be,
|
|
1264
1452
|
"concise, balanced, or detailed",
|
|
1265
1453
|
e
|
|
1266
|
-
), i =
|
|
1267
|
-
|
|
1268
|
-
`${
|
|
1454
|
+
), i = h(
|
|
1455
|
+
r.subjectOverride,
|
|
1456
|
+
`${n}.subjectOverride`,
|
|
1269
1457
|
500,
|
|
1270
1458
|
e
|
|
1271
|
-
), a =
|
|
1272
|
-
|
|
1273
|
-
`${
|
|
1459
|
+
), a = h(
|
|
1460
|
+
r.titleOverride,
|
|
1461
|
+
`${n}.titleOverride`,
|
|
1274
1462
|
500,
|
|
1275
1463
|
e
|
|
1276
|
-
),
|
|
1277
|
-
|
|
1278
|
-
`${
|
|
1464
|
+
), l = h(
|
|
1465
|
+
r.summaryOverride,
|
|
1466
|
+
`${n}.summaryOverride`,
|
|
1279
1467
|
2e3,
|
|
1280
1468
|
e
|
|
1281
|
-
),
|
|
1282
|
-
|
|
1469
|
+
), f = T(
|
|
1470
|
+
r.actionBlockVisible,
|
|
1283
1471
|
!0,
|
|
1284
|
-
`${
|
|
1472
|
+
`${n}.actionBlockVisible`,
|
|
1285
1473
|
e
|
|
1286
|
-
),
|
|
1287
|
-
|
|
1288
|
-
`${
|
|
1474
|
+
), s = je(
|
|
1475
|
+
r.webhookConfig,
|
|
1476
|
+
`${n}.webhookConfig`,
|
|
1289
1477
|
e
|
|
1290
|
-
),
|
|
1291
|
-
|
|
1292
|
-
`${
|
|
1478
|
+
), m = Ge(
|
|
1479
|
+
r.slackConfig,
|
|
1480
|
+
`${n}.slackConfig`,
|
|
1293
1481
|
e
|
|
1294
1482
|
);
|
|
1295
1483
|
return {
|
|
1296
1484
|
...o ? { formatProfile: o } : {},
|
|
1297
1485
|
...i ? { subjectOverride: i } : {},
|
|
1298
1486
|
...a ? { titleOverride: a } : {},
|
|
1299
|
-
...
|
|
1300
|
-
...
|
|
1301
|
-
...
|
|
1302
|
-
...
|
|
1487
|
+
...l ? { summaryOverride: l } : {},
|
|
1488
|
+
...r.actionBlockVisible !== void 0 ? { actionBlockVisible: f } : {},
|
|
1489
|
+
...m ? { slackConfig: m } : {},
|
|
1490
|
+
...s ? { webhookConfig: s } : {}
|
|
1303
1491
|
};
|
|
1304
1492
|
}
|
|
1305
|
-
function
|
|
1306
|
-
if (
|
|
1493
|
+
function We(t, n) {
|
|
1494
|
+
if (t == null)
|
|
1307
1495
|
return;
|
|
1308
|
-
const e =
|
|
1496
|
+
const e = g(t, "deliveryConfig.channelConfigs", n), r = {};
|
|
1309
1497
|
return Object.entries(e).forEach(([o, i]) => {
|
|
1310
|
-
if (!
|
|
1498
|
+
if (!X(o)) {
|
|
1311
1499
|
c(
|
|
1312
|
-
|
|
1500
|
+
n,
|
|
1313
1501
|
`deliveryConfig.channelConfigs.${o}`,
|
|
1314
1502
|
"Expected a supported delivery channel."
|
|
1315
1503
|
);
|
|
1316
1504
|
return;
|
|
1317
1505
|
}
|
|
1318
|
-
|
|
1506
|
+
r[o] = He(
|
|
1319
1507
|
i,
|
|
1320
1508
|
`deliveryConfig.channelConfigs.${o}`,
|
|
1321
|
-
|
|
1509
|
+
n
|
|
1322
1510
|
);
|
|
1323
|
-
}), Object.keys(
|
|
1511
|
+
}), Object.keys(r).length > 0 ? r : void 0;
|
|
1324
1512
|
}
|
|
1325
|
-
function
|
|
1326
|
-
var
|
|
1327
|
-
if (
|
|
1513
|
+
function Ze(t, n) {
|
|
1514
|
+
var f, s, m;
|
|
1515
|
+
if (t == null)
|
|
1328
1516
|
return null;
|
|
1329
|
-
const e =
|
|
1330
|
-
|
|
1517
|
+
const e = g(t, "deliveryConfig", n);
|
|
1518
|
+
u(
|
|
1331
1519
|
e,
|
|
1332
1520
|
"deliveryConfig",
|
|
1333
1521
|
["recipients", "channels", "channelConfigs"],
|
|
1334
|
-
|
|
1522
|
+
n
|
|
1335
1523
|
);
|
|
1336
|
-
const
|
|
1524
|
+
const r = We(e.channelConfigs, n), o = Me(e.recipients, n), i = Pe(e.channels, n), a = ((s = (f = r == null ? void 0 : r.SLACK) == null ? void 0 : f.slackConfig) == null ? void 0 : s.destination.type) === "channel" && !!r.SLACK.slackConfig.destination.channelId.trim();
|
|
1337
1525
|
return i.some(
|
|
1338
1526
|
(I) => I !== "SLACK"
|
|
1339
1527
|
) && o.length === 0 && c(
|
|
1340
|
-
|
|
1528
|
+
n,
|
|
1341
1529
|
"deliveryConfig.recipients",
|
|
1342
1530
|
"Add at least one recipient or remove delivery config."
|
|
1343
1531
|
), i.length === 0 && c(
|
|
1344
|
-
|
|
1532
|
+
n,
|
|
1345
1533
|
"deliveryConfig.channels",
|
|
1346
1534
|
"Choose at least one delivery channel or remove delivery config."
|
|
1347
1535
|
), i.includes("SLACK") && !a && c(
|
|
1348
|
-
|
|
1536
|
+
n,
|
|
1349
1537
|
"deliveryConfig.channelConfigs.SLACK.slackConfig.destination.channelId",
|
|
1350
1538
|
"Choose a Slack channel destination."
|
|
1351
|
-
), !i.includes("SLACK") && ((
|
|
1352
|
-
|
|
1539
|
+
), !i.includes("SLACK") && ((m = r == null ? void 0 : r.SLACK) != null && m.slackConfig) && c(
|
|
1540
|
+
n,
|
|
1353
1541
|
"deliveryConfig.channelConfigs.SLACK",
|
|
1354
1542
|
"Slack config requires SLACK in deliveryConfig.channels."
|
|
1355
1543
|
), {
|
|
1356
1544
|
recipients: o,
|
|
1357
1545
|
channels: i,
|
|
1358
|
-
...
|
|
1546
|
+
...r ? { channelConfigs: r } : {}
|
|
1359
1547
|
};
|
|
1360
1548
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1549
|
+
function R(t) {
|
|
1550
|
+
const n = [], e = g(t, "draft", n);
|
|
1551
|
+
u(
|
|
1364
1552
|
e,
|
|
1365
1553
|
"draft",
|
|
1366
1554
|
[
|
|
@@ -1376,80 +1564,93 @@ function z(r) {
|
|
|
1376
1564
|
"limits",
|
|
1377
1565
|
"deliveryConfig"
|
|
1378
1566
|
],
|
|
1379
|
-
|
|
1567
|
+
n
|
|
1380
1568
|
);
|
|
1381
|
-
const
|
|
1569
|
+
const r = y(
|
|
1382
1570
|
e.name,
|
|
1383
1571
|
"name",
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
), o =
|
|
1572
|
+
d.name,
|
|
1573
|
+
n
|
|
1574
|
+
), o = h(
|
|
1387
1575
|
e.description,
|
|
1388
1576
|
"description",
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
) ?? null, i =
|
|
1392
|
-
return
|
|
1393
|
-
name:
|
|
1577
|
+
d.description,
|
|
1578
|
+
n
|
|
1579
|
+
) ?? null, i = h(e.scheduleExpr, "scheduleExpr", 500, n) ?? null, a = h(e.timezone, "timezone", 200, n) ?? "UTC", l = Ae(e.status, n), f = K(e.source, n), s = G(e.body, n), m = W(e.attachments, n), I = H(e.presentation, n), v = Z(e.limits, n), p = Ze(e.deliveryConfig, n);
|
|
1580
|
+
return Y(s, m, n), O(n), {
|
|
1581
|
+
name: r,
|
|
1394
1582
|
description: o,
|
|
1395
|
-
status:
|
|
1583
|
+
status: l,
|
|
1396
1584
|
scheduleExpr: i,
|
|
1397
1585
|
timezone: a,
|
|
1398
|
-
source:
|
|
1399
|
-
body:
|
|
1400
|
-
attachments:
|
|
1586
|
+
source: f,
|
|
1587
|
+
body: s,
|
|
1588
|
+
attachments: m,
|
|
1401
1589
|
presentation: I,
|
|
1402
|
-
...
|
|
1403
|
-
deliveryConfig:
|
|
1590
|
+
...v ? { limits: v } : {},
|
|
1591
|
+
deliveryConfig: p
|
|
1404
1592
|
};
|
|
1405
1593
|
}
|
|
1406
|
-
function
|
|
1407
|
-
return
|
|
1594
|
+
function lt(t) {
|
|
1595
|
+
return R(t);
|
|
1408
1596
|
}
|
|
1409
|
-
function
|
|
1410
|
-
return
|
|
1597
|
+
function dt(t) {
|
|
1598
|
+
return R(t);
|
|
1411
1599
|
}
|
|
1412
|
-
function
|
|
1600
|
+
function st(t) {
|
|
1413
1601
|
try {
|
|
1414
|
-
return { valid: !0, value:
|
|
1415
|
-
} catch (
|
|
1416
|
-
if (
|
|
1417
|
-
return { valid: !1, issues:
|
|
1418
|
-
throw
|
|
1602
|
+
return { valid: !0, value: R(t), issues: [] };
|
|
1603
|
+
} catch (n) {
|
|
1604
|
+
if (n instanceof A)
|
|
1605
|
+
return { valid: !1, issues: n.issues };
|
|
1606
|
+
throw n;
|
|
1419
1607
|
}
|
|
1420
1608
|
}
|
|
1421
|
-
function
|
|
1609
|
+
function ft(t) {
|
|
1422
1610
|
try {
|
|
1423
|
-
return { valid: !0, value:
|
|
1424
|
-
} catch (
|
|
1425
|
-
if (
|
|
1426
|
-
return { valid: !1, issues:
|
|
1427
|
-
throw
|
|
1611
|
+
return { valid: !0, value: J(t), issues: [] };
|
|
1612
|
+
} catch (n) {
|
|
1613
|
+
if (n instanceof A)
|
|
1614
|
+
return { valid: !1, issues: n.issues };
|
|
1615
|
+
throw n;
|
|
1428
1616
|
}
|
|
1429
1617
|
}
|
|
1430
|
-
function
|
|
1431
|
-
return typeof
|
|
1618
|
+
function ut(t) {
|
|
1619
|
+
return typeof t == "string" && j.has(t);
|
|
1432
1620
|
}
|
|
1433
|
-
function
|
|
1434
|
-
return typeof
|
|
1621
|
+
function X(t) {
|
|
1622
|
+
return typeof t == "string" && pe.has(t);
|
|
1435
1623
|
}
|
|
1436
1624
|
export {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1625
|
+
me as BRIEFING_ARTIFACT_FORMATS,
|
|
1626
|
+
b as BRIEFING_CONTENT_LIMITS,
|
|
1627
|
+
L as BRIEFING_KIND,
|
|
1628
|
+
d as BRIEFING_TEXT_LIMITS,
|
|
1629
|
+
A as BriefingContractError,
|
|
1630
|
+
N as DEFAULT_BRIEFING_ARTIFACT_FORMATS,
|
|
1631
|
+
Xe as DEFAULT_BRIEFING_SCHEDULE,
|
|
1632
|
+
w as MAX_BRIEFING_ATTACHMENTS,
|
|
1633
|
+
ct as buildBriefingJobConfig,
|
|
1634
|
+
et as buildBriefingScheduleExpr,
|
|
1635
|
+
lt as buildCreateBriefingRequest,
|
|
1636
|
+
dt as buildUpdateBriefingRequest,
|
|
1637
|
+
rt as canCreateBriefingForUser,
|
|
1638
|
+
tt as describeBriefingSchedule,
|
|
1639
|
+
nt as getBriefingCardAttachmentCapability,
|
|
1640
|
+
de as getBriefingCardAttachmentFormats,
|
|
1641
|
+
ot as getBriefingCreationIntents,
|
|
1642
|
+
ue as getBriefingDisplayTypeLabel,
|
|
1643
|
+
it as getBriefingPresentation,
|
|
1644
|
+
se as getDefaultBriefingCardAttachmentFormat,
|
|
1645
|
+
ut as isBriefingArtifactFormat,
|
|
1646
|
+
X as isBriefingDeliveryChannel,
|
|
1647
|
+
fe as isEmailOnlyBriefingDelivery,
|
|
1648
|
+
Qe as isValidBriefingTimezone,
|
|
1649
|
+
Ne as normalizeBriefingContentDocument,
|
|
1650
|
+
R as normalizeBriefingDraft,
|
|
1651
|
+
J as normalizeBriefingJobConfig,
|
|
1652
|
+
oe as parseBriefingScheduleExpr,
|
|
1653
|
+
at as validateBriefingContentDocument,
|
|
1654
|
+
st as validateBriefingDraft,
|
|
1655
|
+
ft as validateBriefingJobConfig
|
|
1455
1656
|
};
|