react-semaphor 0.1.314 → 0.1.316
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/brand-studio/index.js +65 -65
- package/dist/briefings/index.cjs +1 -0
- package/dist/briefings/index.js +848 -0
- package/dist/chunks/{braces-CWi8x9ww.js → braces-CDPz6CF2.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-D70CuT-1.js → calendar-preferences-dialog-9NlFzHX8.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-BzpQ5u4h.js → calendar-preferences-dialog-BDdxi7Xm.js} +1 -1
- package/dist/chunks/{chevrons-up-down-B2viXO2I.js → chevrons-up-down-BsdQRmJL.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-5fM_KJoT.js +7321 -0
- package/dist/chunks/dashboard-briefing-launcher-CVxLt10p.js +96 -0
- package/dist/chunks/dashboard-controls-9YV-D1tD.js +2009 -0
- package/dist/chunks/dashboard-controls-UR_m0wD1.js +57 -0
- package/dist/chunks/{dashboard-json-CJCAen1R.js → dashboard-json-CKPID8Am.js} +2 -2
- package/dist/chunks/{dashboard-json-v2C6Tmqf.js → dashboard-json-ws4tortP.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-CmxnZI8I.js +178 -0
- package/dist/chunks/{edit-dashboard-visual-DljWvnMy.js → edit-dashboard-visual-ifKJLMTS.js} +807 -822
- package/dist/chunks/index-Xdag_85e.js +1298 -0
- package/dist/chunks/{index-P5hPTTzm.js → index-gcA9Rs35.js} +41178 -46390
- package/dist/chunks/{palette-CIuwlEiG.js → palette-BlxLchHy.js} +1 -1
- package/dist/chunks/{resource-management-panel-CAxXzMdi.js → resource-management-panel-BduJanWW.js} +1 -1
- package/dist/chunks/{resource-management-panel-Dk0DzgVm.js → resource-management-panel-paSAzVj2.js} +81 -81
- package/dist/chunks/{save-_ALpoMy6.js → save-DVRQBMeb.js} +1 -1
- package/dist/chunks/{switch-B6fh8nb-.js → switch-sauemjyY.js} +199 -199
- package/dist/chunks/{use-create-flow-overlay-state-Cqf7GaFm.js → use-create-flow-overlay-state-DKV6tIc5.js} +254 -225
- package/dist/chunks/use-create-flow-overlay-state-DWnzVVlP.js +26 -0
- package/dist/chunks/{use-visual-utils-CQQ3jvDn.js → use-visual-utils-C8PDxg2w.js} +1 -1
- package/dist/chunks/{use-visual-utils-CPMQLBYR.js → use-visual-utils-Cs0-baCK.js} +48 -48
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +232 -485
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings.d.ts +240 -0
- package/dist/types/dashboard.d.ts +1 -0
- package/dist/types/main.d.ts +619 -1017
- package/dist/types/surfboard.d.ts +1 -0
- package/dist/types/types.d.ts +411 -261
- package/package.json +7 -2
- package/dist/chunks/dashboard-controls-BS_aZcxs.js +0 -57
- package/dist/chunks/dashboard-controls-DbKtbw1V.js +0 -2021
- package/dist/chunks/dashboard-filter-controls-launcher-C8Wm2Smj.js +0 -1540
- package/dist/chunks/dashboard-filter-controls-launcher-CMXpudFJ.js +0 -11
- package/dist/chunks/edit-dashboard-visual-lRn3FeaP.js +0 -183
- package/dist/chunks/index-XYIIY48z.js +0 -1330
- package/dist/chunks/use-create-flow-overlay-state-DMZTflFt.js +0 -16
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var G = (t, n, e) => n in t ? P(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
|
+
var x = (t, n, e) => G(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
const A = "BRIEFING", U = ["markdown", "html"], v = ["markdown"], ue = 20, c = {
|
|
5
|
+
name: 500,
|
|
6
|
+
description: 2e3,
|
|
7
|
+
instruction: 5e4,
|
|
8
|
+
customMessage: 5e4,
|
|
9
|
+
attachmentTitle: 500,
|
|
10
|
+
presentationAudience: 1e3,
|
|
11
|
+
presentationTone: 500,
|
|
12
|
+
presentationFormat: 2e3,
|
|
13
|
+
id: 500
|
|
14
|
+
}, z = new Set(U), H = /* @__PURE__ */ new Set([
|
|
15
|
+
"EMAIL",
|
|
16
|
+
"WEBHOOK",
|
|
17
|
+
"SLACK",
|
|
18
|
+
"IN_APP",
|
|
19
|
+
"TELEGRAM"
|
|
20
|
+
]), $ = {
|
|
21
|
+
maxToolCalls: { min: 1, max: 100 },
|
|
22
|
+
maxRows: { min: 1, max: 1e5 },
|
|
23
|
+
timeoutMs: { min: 1e3, max: 30 * 6e4 }
|
|
24
|
+
}, q = /* @__PURE__ */ new Set([
|
|
25
|
+
"letter",
|
|
26
|
+
"legal",
|
|
27
|
+
"a4",
|
|
28
|
+
"a3",
|
|
29
|
+
"tabloid"
|
|
30
|
+
]), K = /* @__PURE__ */ new Set([
|
|
31
|
+
"portrait",
|
|
32
|
+
"landscape"
|
|
33
|
+
]), X = /* @__PURE__ */ new Set([",", ";", " "]), J = [
|
|
34
|
+
"pageSize",
|
|
35
|
+
"orientation",
|
|
36
|
+
"includeFilters",
|
|
37
|
+
"includeTimestamp",
|
|
38
|
+
"delimiter",
|
|
39
|
+
"includeHeaders",
|
|
40
|
+
"useFormattedValues",
|
|
41
|
+
"sheetSelection",
|
|
42
|
+
"currentSheetId",
|
|
43
|
+
"currentSheetName",
|
|
44
|
+
"filterValues",
|
|
45
|
+
"inlineFilterValues",
|
|
46
|
+
"sheetFilterValues",
|
|
47
|
+
"filterLine",
|
|
48
|
+
"controlValues",
|
|
49
|
+
"controlDefinitions",
|
|
50
|
+
"cardControlDefinitions",
|
|
51
|
+
"controlBindings",
|
|
52
|
+
"tablePreferences",
|
|
53
|
+
"dashboardInputExecutionSnapshot",
|
|
54
|
+
"selectedSheetId",
|
|
55
|
+
"cardType",
|
|
56
|
+
"theme"
|
|
57
|
+
];
|
|
58
|
+
class S extends Error {
|
|
59
|
+
constructor(e) {
|
|
60
|
+
super(e.map((r) => `${r.field}: ${r.message}`).join("; "));
|
|
61
|
+
x(this, "issues");
|
|
62
|
+
this.name = "BriefingContractError", this.issues = e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function F(t) {
|
|
66
|
+
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
67
|
+
}
|
|
68
|
+
function d(t, n, e) {
|
|
69
|
+
t.push({ field: n, message: e });
|
|
70
|
+
}
|
|
71
|
+
function m(t, n, e) {
|
|
72
|
+
return F(t) ? t : (d(e, n, "Expected an object."), {});
|
|
73
|
+
}
|
|
74
|
+
function l(t, n, e, r) {
|
|
75
|
+
const o = new Set(e);
|
|
76
|
+
Object.keys(t).forEach((i) => {
|
|
77
|
+
o.has(i) || d(
|
|
78
|
+
r,
|
|
79
|
+
n ? `${n}.${i}` : i,
|
|
80
|
+
`Unexpected field "${i}".`
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function f(t, n, e, r) {
|
|
85
|
+
if (typeof t != "string")
|
|
86
|
+
return d(r, n, "Expected a string."), "";
|
|
87
|
+
const o = t.trim();
|
|
88
|
+
return o ? (o.length > e && d(r, n, `Must be ${e} characters or fewer.`), o) : (d(r, n, "Required value cannot be empty."), "");
|
|
89
|
+
}
|
|
90
|
+
function u(t, n, e, r) {
|
|
91
|
+
if (t == null)
|
|
92
|
+
return;
|
|
93
|
+
if (typeof t != "string") {
|
|
94
|
+
d(r, n, "Expected a string.");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const o = t.trim();
|
|
98
|
+
if (o)
|
|
99
|
+
return o.length > e && d(r, n, `Must be ${e} characters or fewer.`), o;
|
|
100
|
+
}
|
|
101
|
+
function C(t, n, e, r) {
|
|
102
|
+
return t == null ? n : typeof t != "boolean" ? (d(r, e, "Expected a boolean."), n) : t;
|
|
103
|
+
}
|
|
104
|
+
function W(t, n) {
|
|
105
|
+
return t == null ? "ACTIVE" : t === "ACTIVE" || t === "PAUSED" || t === "DISABLED" ? t : (d(n, "status", "Expected ACTIVE, PAUSED, or DISABLED."), "ACTIVE");
|
|
106
|
+
}
|
|
107
|
+
function Y(t) {
|
|
108
|
+
return t.includes("@") && t.includes(".") && !t.includes(" ");
|
|
109
|
+
}
|
|
110
|
+
function O(t, n) {
|
|
111
|
+
if (t == null)
|
|
112
|
+
return { type: "project" };
|
|
113
|
+
const e = m(t, "source", n), r = e.type;
|
|
114
|
+
return r === "project" ? (l(e, "source", ["type"], n), { type: "project" }) : r === "dashboard" ? (l(e, "source", ["type", "dashboardId"], n), {
|
|
115
|
+
type: "dashboard",
|
|
116
|
+
dashboardId: f(
|
|
117
|
+
e.dashboardId,
|
|
118
|
+
"source.dashboardId",
|
|
119
|
+
c.id,
|
|
120
|
+
n
|
|
121
|
+
)
|
|
122
|
+
}) : (d(n, "source.type", "Expected project or dashboard."), { type: "project" });
|
|
123
|
+
}
|
|
124
|
+
function B(t, n) {
|
|
125
|
+
const e = m(t, "body", n), r = e.type;
|
|
126
|
+
return r === "generated_analysis" ? (l(e, "body", ["type", "instruction"], n), {
|
|
127
|
+
type: "generated_analysis",
|
|
128
|
+
instruction: f(
|
|
129
|
+
e.instruction,
|
|
130
|
+
"body.instruction",
|
|
131
|
+
c.instruction,
|
|
132
|
+
n
|
|
133
|
+
)
|
|
134
|
+
}) : r === "custom_message" ? (l(e, "body", ["type", "message"], n), {
|
|
135
|
+
type: "custom_message",
|
|
136
|
+
message: f(
|
|
137
|
+
e.message,
|
|
138
|
+
"body.message",
|
|
139
|
+
c.customMessage,
|
|
140
|
+
n
|
|
141
|
+
)
|
|
142
|
+
}) : r === "none" ? (l(e, "body", ["type"], n), { type: "none" }) : (d(
|
|
143
|
+
n,
|
|
144
|
+
"body.type",
|
|
145
|
+
"Expected generated_analysis, custom_message, or none."
|
|
146
|
+
), { type: "none" });
|
|
147
|
+
}
|
|
148
|
+
function Z(t, n) {
|
|
149
|
+
if (t == null)
|
|
150
|
+
return [...v];
|
|
151
|
+
if (!Array.isArray(t))
|
|
152
|
+
return d(n, "presentation.artifactFormats", "Expected an array."), [...v];
|
|
153
|
+
if (t.length === 0)
|
|
154
|
+
return d(
|
|
155
|
+
n,
|
|
156
|
+
"presentation.artifactFormats",
|
|
157
|
+
"Choose at least one artifact format."
|
|
158
|
+
), [];
|
|
159
|
+
const e = [];
|
|
160
|
+
return t.forEach((r, o) => {
|
|
161
|
+
if (typeof r != "string" || !z.has(r)) {
|
|
162
|
+
d(
|
|
163
|
+
n,
|
|
164
|
+
`presentation.artifactFormats.${o}`,
|
|
165
|
+
"Expected markdown or html."
|
|
166
|
+
);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
e.includes(r) || e.push(r);
|
|
170
|
+
}), e;
|
|
171
|
+
}
|
|
172
|
+
function R(t, n) {
|
|
173
|
+
if (t == null)
|
|
174
|
+
return {
|
|
175
|
+
artifactFormats: [...v],
|
|
176
|
+
includeEvidence: !0,
|
|
177
|
+
includeSql: !0
|
|
178
|
+
};
|
|
179
|
+
const e = m(t, "presentation", n);
|
|
180
|
+
l(
|
|
181
|
+
e,
|
|
182
|
+
"presentation",
|
|
183
|
+
["artifactFormats", "includeEvidence", "includeSql", "audience", "tone", "format"],
|
|
184
|
+
n
|
|
185
|
+
);
|
|
186
|
+
const r = {
|
|
187
|
+
artifactFormats: Z(e.artifactFormats, n),
|
|
188
|
+
includeEvidence: C(
|
|
189
|
+
e.includeEvidence,
|
|
190
|
+
!0,
|
|
191
|
+
"presentation.includeEvidence",
|
|
192
|
+
n
|
|
193
|
+
),
|
|
194
|
+
includeSql: C(
|
|
195
|
+
e.includeSql,
|
|
196
|
+
!0,
|
|
197
|
+
"presentation.includeSql",
|
|
198
|
+
n
|
|
199
|
+
)
|
|
200
|
+
}, o = u(
|
|
201
|
+
e.audience,
|
|
202
|
+
"presentation.audience",
|
|
203
|
+
c.presentationAudience,
|
|
204
|
+
n
|
|
205
|
+
), i = u(
|
|
206
|
+
e.tone,
|
|
207
|
+
"presentation.tone",
|
|
208
|
+
c.presentationTone,
|
|
209
|
+
n
|
|
210
|
+
), a = u(
|
|
211
|
+
e.format,
|
|
212
|
+
"presentation.format",
|
|
213
|
+
c.presentationFormat,
|
|
214
|
+
n
|
|
215
|
+
);
|
|
216
|
+
return o && (r.audience = o), i && (r.tone = i), a && (r.format = a), r;
|
|
217
|
+
}
|
|
218
|
+
function g(t, n, e, r) {
|
|
219
|
+
return typeof t == "string" && e.includes(t) ? t : (d(r, n, `Expected ${e.join(" or ")}.`), e[0]);
|
|
220
|
+
}
|
|
221
|
+
function I(t, n, e, r, o) {
|
|
222
|
+
if (t != null) {
|
|
223
|
+
if (typeof t == "string" && e.has(t))
|
|
224
|
+
return t;
|
|
225
|
+
d(o, n, `Expected ${r}.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function Q(t, n, e) {
|
|
229
|
+
if (t != null) {
|
|
230
|
+
if (!Array.isArray(t)) {
|
|
231
|
+
d(e, n, "Expected an array.");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
return t;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function ee(t, n, e) {
|
|
238
|
+
if (t != null) {
|
|
239
|
+
if (!F(t)) {
|
|
240
|
+
d(e, n, "Expected an object.");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
return t;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function te(t, n, e) {
|
|
247
|
+
if (t == null)
|
|
248
|
+
return;
|
|
249
|
+
const r = m(t, n, e);
|
|
250
|
+
l(r, n, J, e);
|
|
251
|
+
const o = {}, i = I(
|
|
252
|
+
r.pageSize,
|
|
253
|
+
`${n}.pageSize`,
|
|
254
|
+
q,
|
|
255
|
+
"letter, legal, a4, a3, or tabloid",
|
|
256
|
+
e
|
|
257
|
+
), a = I(
|
|
258
|
+
r.orientation,
|
|
259
|
+
`${n}.orientation`,
|
|
260
|
+
K,
|
|
261
|
+
"portrait or landscape",
|
|
262
|
+
e
|
|
263
|
+
), p = I(
|
|
264
|
+
r.delimiter,
|
|
265
|
+
`${n}.delimiter`,
|
|
266
|
+
X,
|
|
267
|
+
"comma, semicolon, or tab",
|
|
268
|
+
e
|
|
269
|
+
), y = I(
|
|
270
|
+
r.sheetSelection,
|
|
271
|
+
`${n}.sheetSelection`,
|
|
272
|
+
/* @__PURE__ */ new Set(["current", "all"]),
|
|
273
|
+
"current or all",
|
|
274
|
+
e
|
|
275
|
+
);
|
|
276
|
+
i && (o.pageSize = i), a && (o.orientation = a), p && (o.delimiter = p), y && (o.sheetSelection = y);
|
|
277
|
+
for (const s of [
|
|
278
|
+
"includeFilters",
|
|
279
|
+
"includeTimestamp",
|
|
280
|
+
"includeHeaders",
|
|
281
|
+
"useFormattedValues"
|
|
282
|
+
])
|
|
283
|
+
if (!(r[s] === void 0 || r[s] === null)) {
|
|
284
|
+
if (typeof r[s] != "boolean") {
|
|
285
|
+
d(e, `${n}.${s}`, "Expected a boolean.");
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
o[s] = r[s];
|
|
289
|
+
}
|
|
290
|
+
for (const s of [
|
|
291
|
+
"currentSheetId",
|
|
292
|
+
"currentSheetName",
|
|
293
|
+
"filterLine",
|
|
294
|
+
"selectedSheetId",
|
|
295
|
+
"cardType",
|
|
296
|
+
"theme"
|
|
297
|
+
]) {
|
|
298
|
+
const h = u(
|
|
299
|
+
r[s],
|
|
300
|
+
`${n}.${s}`,
|
|
301
|
+
c.id,
|
|
302
|
+
e
|
|
303
|
+
);
|
|
304
|
+
h && (o[s] = h);
|
|
305
|
+
}
|
|
306
|
+
for (const s of [
|
|
307
|
+
"filterValues",
|
|
308
|
+
"inlineFilterValues",
|
|
309
|
+
"sheetFilterValues",
|
|
310
|
+
"controlDefinitions",
|
|
311
|
+
"cardControlDefinitions",
|
|
312
|
+
"controlBindings"
|
|
313
|
+
]) {
|
|
314
|
+
const h = Q(r[s], `${n}.${s}`, e);
|
|
315
|
+
h && (o[s] = h);
|
|
316
|
+
}
|
|
317
|
+
for (const s of [
|
|
318
|
+
"controlValues",
|
|
319
|
+
"tablePreferences",
|
|
320
|
+
"dashboardInputExecutionSnapshot"
|
|
321
|
+
]) {
|
|
322
|
+
const h = ee(r[s], `${n}.${s}`, e);
|
|
323
|
+
h && (o[s] = h);
|
|
324
|
+
}
|
|
325
|
+
return Object.keys(o).length > 0 ? o : void 0;
|
|
326
|
+
}
|
|
327
|
+
function b(t, n, e, r) {
|
|
328
|
+
const o = u(
|
|
329
|
+
n,
|
|
330
|
+
e,
|
|
331
|
+
c.attachmentTitle,
|
|
332
|
+
r
|
|
333
|
+
);
|
|
334
|
+
return o && (t.title = o), t;
|
|
335
|
+
}
|
|
336
|
+
function E(t, n, e, r) {
|
|
337
|
+
const o = te(n, e, r);
|
|
338
|
+
return o && (t.settings = o), t;
|
|
339
|
+
}
|
|
340
|
+
function ne(t, n, e) {
|
|
341
|
+
const r = `attachments.${n}`, o = m(t, r, e), i = o.type;
|
|
342
|
+
if (i === "dashboard") {
|
|
343
|
+
l(
|
|
344
|
+
o,
|
|
345
|
+
r,
|
|
346
|
+
["type", "dashboardId", "format", "title", "settings"],
|
|
347
|
+
e
|
|
348
|
+
);
|
|
349
|
+
const a = b(
|
|
350
|
+
{
|
|
351
|
+
type: "dashboard",
|
|
352
|
+
dashboardId: f(
|
|
353
|
+
o.dashboardId,
|
|
354
|
+
`${r}.dashboardId`,
|
|
355
|
+
c.id,
|
|
356
|
+
e
|
|
357
|
+
),
|
|
358
|
+
format: g(o.format, `${r}.format`, ["pdf"], e)
|
|
359
|
+
},
|
|
360
|
+
o.title,
|
|
361
|
+
`${r}.title`,
|
|
362
|
+
e
|
|
363
|
+
);
|
|
364
|
+
return E(a, o.settings, `${r}.settings`, e);
|
|
365
|
+
}
|
|
366
|
+
if (i === "dashboard_sheet" || i === "document_sheet") {
|
|
367
|
+
l(
|
|
368
|
+
o,
|
|
369
|
+
r,
|
|
370
|
+
["type", "dashboardId", "sheetId", "format", "title", "settings"],
|
|
371
|
+
e
|
|
372
|
+
);
|
|
373
|
+
const a = b(
|
|
374
|
+
{
|
|
375
|
+
type: i,
|
|
376
|
+
dashboardId: f(
|
|
377
|
+
o.dashboardId,
|
|
378
|
+
`${r}.dashboardId`,
|
|
379
|
+
c.id,
|
|
380
|
+
e
|
|
381
|
+
),
|
|
382
|
+
sheetId: f(
|
|
383
|
+
o.sheetId,
|
|
384
|
+
`${r}.sheetId`,
|
|
385
|
+
c.id,
|
|
386
|
+
e
|
|
387
|
+
),
|
|
388
|
+
format: g(o.format, `${r}.format`, ["pdf"], e)
|
|
389
|
+
},
|
|
390
|
+
o.title,
|
|
391
|
+
`${r}.title`,
|
|
392
|
+
e
|
|
393
|
+
);
|
|
394
|
+
return E(a, o.settings, `${r}.settings`, e);
|
|
395
|
+
}
|
|
396
|
+
if (i === "visual") {
|
|
397
|
+
l(
|
|
398
|
+
o,
|
|
399
|
+
r,
|
|
400
|
+
["type", "dashboardId", "visualId", "format", "title", "settings"],
|
|
401
|
+
e
|
|
402
|
+
);
|
|
403
|
+
const a = b(
|
|
404
|
+
{
|
|
405
|
+
type: "visual",
|
|
406
|
+
dashboardId: f(
|
|
407
|
+
o.dashboardId,
|
|
408
|
+
`${r}.dashboardId`,
|
|
409
|
+
c.id,
|
|
410
|
+
e
|
|
411
|
+
),
|
|
412
|
+
visualId: f(
|
|
413
|
+
o.visualId,
|
|
414
|
+
`${r}.visualId`,
|
|
415
|
+
c.id,
|
|
416
|
+
e
|
|
417
|
+
),
|
|
418
|
+
format: g(
|
|
419
|
+
o.format,
|
|
420
|
+
`${r}.format`,
|
|
421
|
+
["pdf", "png"],
|
|
422
|
+
e
|
|
423
|
+
)
|
|
424
|
+
},
|
|
425
|
+
o.title,
|
|
426
|
+
`${r}.title`,
|
|
427
|
+
e
|
|
428
|
+
);
|
|
429
|
+
return E(a, o.settings, `${r}.settings`, e);
|
|
430
|
+
}
|
|
431
|
+
if (i === "card") {
|
|
432
|
+
l(
|
|
433
|
+
o,
|
|
434
|
+
r,
|
|
435
|
+
["type", "dashboardId", "cardId", "format", "title", "settings"],
|
|
436
|
+
e
|
|
437
|
+
);
|
|
438
|
+
const a = b(
|
|
439
|
+
{
|
|
440
|
+
type: "card",
|
|
441
|
+
dashboardId: f(
|
|
442
|
+
o.dashboardId,
|
|
443
|
+
`${r}.dashboardId`,
|
|
444
|
+
c.id,
|
|
445
|
+
e
|
|
446
|
+
),
|
|
447
|
+
cardId: f(
|
|
448
|
+
o.cardId,
|
|
449
|
+
`${r}.cardId`,
|
|
450
|
+
c.id,
|
|
451
|
+
e
|
|
452
|
+
),
|
|
453
|
+
format: g(
|
|
454
|
+
o.format,
|
|
455
|
+
`${r}.format`,
|
|
456
|
+
["csv", "pdf", "png"],
|
|
457
|
+
e
|
|
458
|
+
)
|
|
459
|
+
},
|
|
460
|
+
o.title,
|
|
461
|
+
`${r}.title`,
|
|
462
|
+
e
|
|
463
|
+
);
|
|
464
|
+
return E(a, o.settings, `${r}.settings`, e);
|
|
465
|
+
}
|
|
466
|
+
return d(
|
|
467
|
+
e,
|
|
468
|
+
`${r}.type`,
|
|
469
|
+
"Expected dashboard, dashboard_sheet, document_sheet, visual, or card."
|
|
470
|
+
), { type: "dashboard", dashboardId: "", format: "pdf" };
|
|
471
|
+
}
|
|
472
|
+
function re(t) {
|
|
473
|
+
switch (t.type) {
|
|
474
|
+
case "dashboard":
|
|
475
|
+
return `${t.type}:${t.dashboardId}:${t.format}`;
|
|
476
|
+
case "dashboard_sheet":
|
|
477
|
+
case "document_sheet":
|
|
478
|
+
return `${t.type}:${t.dashboardId}:${t.sheetId}:${t.format}`;
|
|
479
|
+
case "visual":
|
|
480
|
+
return `${t.type}:${t.dashboardId}:${t.visualId}:${t.format}`;
|
|
481
|
+
case "card":
|
|
482
|
+
return `${t.type}:${t.dashboardId}:${t.cardId}:${t.format}`;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function D(t, n) {
|
|
486
|
+
if (t == null)
|
|
487
|
+
return [];
|
|
488
|
+
if (!Array.isArray(t))
|
|
489
|
+
return d(n, "attachments", "Expected an array."), [];
|
|
490
|
+
t.length > 20 && d(
|
|
491
|
+
n,
|
|
492
|
+
"attachments",
|
|
493
|
+
"Choose 20 attachments or fewer."
|
|
494
|
+
);
|
|
495
|
+
const e = t.slice(0, 20).map((o, i) => ne(o, i, n)), r = /* @__PURE__ */ new Set();
|
|
496
|
+
return e.forEach((o, i) => {
|
|
497
|
+
const a = re(o);
|
|
498
|
+
r.has(a) && d(n, `attachments.${i}`, "Duplicate attachment."), r.add(a);
|
|
499
|
+
}), e;
|
|
500
|
+
}
|
|
501
|
+
function V(t, n) {
|
|
502
|
+
if (t == null)
|
|
503
|
+
return;
|
|
504
|
+
const e = m(t, "limits", n);
|
|
505
|
+
l(e, "limits", Object.keys($), n);
|
|
506
|
+
const r = {};
|
|
507
|
+
return Object.keys($).forEach((o) => {
|
|
508
|
+
const i = e[o];
|
|
509
|
+
if (i == null)
|
|
510
|
+
return;
|
|
511
|
+
const a = $[o];
|
|
512
|
+
if (typeof i != "number" || !Number.isInteger(i) || i < a.min || i > a.max) {
|
|
513
|
+
d(
|
|
514
|
+
n,
|
|
515
|
+
`limits.${o}`,
|
|
516
|
+
`Expected an integer between ${a.min} and ${a.max}.`
|
|
517
|
+
);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
r[o] = i;
|
|
521
|
+
}), Object.keys(r).length > 0 ? r : void 0;
|
|
522
|
+
}
|
|
523
|
+
function N(t) {
|
|
524
|
+
if (t.length > 0)
|
|
525
|
+
throw new S(t);
|
|
526
|
+
}
|
|
527
|
+
function j(t, n, e) {
|
|
528
|
+
t.type === "none" && n.length === 0 && d(
|
|
529
|
+
e,
|
|
530
|
+
"body",
|
|
531
|
+
"Add briefing instructions, a custom message, or at least one attachment."
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
function w(t) {
|
|
535
|
+
const n = [], e = m(t, "jobConfig", n);
|
|
536
|
+
l(
|
|
537
|
+
e,
|
|
538
|
+
"jobConfig",
|
|
539
|
+
["kind", "source", "body", "attachments", "presentation", "limits"],
|
|
540
|
+
n
|
|
541
|
+
), e.kind !== A && d(n, "kind", "Expected BRIEFING.");
|
|
542
|
+
const r = O(e.source, n), o = B(e.body, n), i = D(e.attachments, n), a = R(e.presentation, n), p = V(e.limits, n);
|
|
543
|
+
return j(o, i, n), N(n), {
|
|
544
|
+
kind: A,
|
|
545
|
+
source: r,
|
|
546
|
+
body: o,
|
|
547
|
+
attachments: i,
|
|
548
|
+
presentation: a,
|
|
549
|
+
...p ? { limits: p } : {}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function pe(t) {
|
|
553
|
+
return w({
|
|
554
|
+
...t,
|
|
555
|
+
kind: A
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
function oe(t, n, e) {
|
|
559
|
+
const r = `deliveryConfig.recipients.${n}`, o = m(t, r, e), i = o.type;
|
|
560
|
+
if (i === "email") {
|
|
561
|
+
l(o, r, ["type", "address", "name"], e);
|
|
562
|
+
const a = f(
|
|
563
|
+
o.address,
|
|
564
|
+
`${r}.address`,
|
|
565
|
+
c.id,
|
|
566
|
+
e
|
|
567
|
+
), p = u(
|
|
568
|
+
o.name,
|
|
569
|
+
`${r}.name`,
|
|
570
|
+
c.attachmentTitle,
|
|
571
|
+
e
|
|
572
|
+
);
|
|
573
|
+
return a && !Y(a) && d(e, `${r}.address`, "Email address is invalid."), {
|
|
574
|
+
type: "email",
|
|
575
|
+
address: a,
|
|
576
|
+
...p ? { name: p } : {}
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return i === "user" ? (l(o, r, ["type", "userId"], e), {
|
|
580
|
+
type: "user",
|
|
581
|
+
userId: f(
|
|
582
|
+
o.userId,
|
|
583
|
+
`${r}.userId`,
|
|
584
|
+
c.id,
|
|
585
|
+
e
|
|
586
|
+
)
|
|
587
|
+
}) : i === "tenant_user" ? (l(o, r, ["type", "tenantUserId"], e), {
|
|
588
|
+
type: "tenant_user",
|
|
589
|
+
tenantUserId: f(
|
|
590
|
+
o.tenantUserId,
|
|
591
|
+
`${r}.tenantUserId`,
|
|
592
|
+
c.id,
|
|
593
|
+
e
|
|
594
|
+
)
|
|
595
|
+
}) : i === "group" ? (l(o, r, ["type", "groupId"], e), {
|
|
596
|
+
type: "group",
|
|
597
|
+
groupId: f(
|
|
598
|
+
o.groupId,
|
|
599
|
+
`${r}.groupId`,
|
|
600
|
+
c.id,
|
|
601
|
+
e
|
|
602
|
+
)
|
|
603
|
+
}) : (d(
|
|
604
|
+
e,
|
|
605
|
+
`${r}.type`,
|
|
606
|
+
"Expected email, user, tenant_user, or group."
|
|
607
|
+
), { type: "email", address: "" });
|
|
608
|
+
}
|
|
609
|
+
function ie(t, n) {
|
|
610
|
+
return Array.isArray(t) ? t.map(
|
|
611
|
+
(e, r) => oe(e, r, n)
|
|
612
|
+
) : (d(n, "deliveryConfig.recipients", "Expected an array."), []);
|
|
613
|
+
}
|
|
614
|
+
function ae(t, n) {
|
|
615
|
+
if (!Array.isArray(t))
|
|
616
|
+
return d(n, "deliveryConfig.channels", "Expected an array."), [];
|
|
617
|
+
const e = [];
|
|
618
|
+
return t.forEach((r, o) => {
|
|
619
|
+
if (!M(r)) {
|
|
620
|
+
d(
|
|
621
|
+
n,
|
|
622
|
+
`deliveryConfig.channels.${o}`,
|
|
623
|
+
"Expected EMAIL, WEBHOOK, SLACK, IN_APP, or TELEGRAM."
|
|
624
|
+
);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
e.includes(r) || e.push(r);
|
|
628
|
+
}), e;
|
|
629
|
+
}
|
|
630
|
+
function de(t, n, e) {
|
|
631
|
+
if (t == null)
|
|
632
|
+
return;
|
|
633
|
+
const r = m(t, n, e), o = {};
|
|
634
|
+
return Object.entries(r).forEach(([i, a]) => {
|
|
635
|
+
if (typeof a != "string") {
|
|
636
|
+
d(e, `${n}.${i}`, "Expected a string.");
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
o[i] = a.trim();
|
|
640
|
+
}), Object.keys(o).length > 0 ? o : void 0;
|
|
641
|
+
}
|
|
642
|
+
function ce(t, n, e) {
|
|
643
|
+
if (t == null)
|
|
644
|
+
return;
|
|
645
|
+
const r = m(t, n, e);
|
|
646
|
+
l(
|
|
647
|
+
r,
|
|
648
|
+
n,
|
|
649
|
+
["url", "method", "headers", "secretEncrypted"],
|
|
650
|
+
e
|
|
651
|
+
);
|
|
652
|
+
const o = r.method === void 0 || r.method === null ? void 0 : g(r.method, `${n}.method`, ["POST", "PUT"], e), i = de(r.headers, `${n}.headers`, e), a = u(
|
|
653
|
+
r.secretEncrypted,
|
|
654
|
+
`${n}.secretEncrypted`,
|
|
655
|
+
2e3,
|
|
656
|
+
e
|
|
657
|
+
);
|
|
658
|
+
return {
|
|
659
|
+
url: f(r.url, `${n}.url`, 2e3, e),
|
|
660
|
+
...o ? { method: o } : {},
|
|
661
|
+
...i ? { headers: i } : {},
|
|
662
|
+
...a ? { secretEncrypted: a } : {}
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
function se(t, n, e) {
|
|
666
|
+
const r = m(t, n, e);
|
|
667
|
+
l(
|
|
668
|
+
r,
|
|
669
|
+
n,
|
|
670
|
+
[
|
|
671
|
+
"subjectOverride",
|
|
672
|
+
"titleOverride",
|
|
673
|
+
"summaryOverride",
|
|
674
|
+
"actionBlockVisible",
|
|
675
|
+
"webhookConfig"
|
|
676
|
+
],
|
|
677
|
+
e
|
|
678
|
+
);
|
|
679
|
+
const o = u(
|
|
680
|
+
r.subjectOverride,
|
|
681
|
+
`${n}.subjectOverride`,
|
|
682
|
+
500,
|
|
683
|
+
e
|
|
684
|
+
), i = u(
|
|
685
|
+
r.titleOverride,
|
|
686
|
+
`${n}.titleOverride`,
|
|
687
|
+
500,
|
|
688
|
+
e
|
|
689
|
+
), a = u(
|
|
690
|
+
r.summaryOverride,
|
|
691
|
+
`${n}.summaryOverride`,
|
|
692
|
+
2e3,
|
|
693
|
+
e
|
|
694
|
+
), p = C(
|
|
695
|
+
r.actionBlockVisible,
|
|
696
|
+
!0,
|
|
697
|
+
`${n}.actionBlockVisible`,
|
|
698
|
+
e
|
|
699
|
+
), y = ce(
|
|
700
|
+
r.webhookConfig,
|
|
701
|
+
`${n}.webhookConfig`,
|
|
702
|
+
e
|
|
703
|
+
);
|
|
704
|
+
return {
|
|
705
|
+
...o ? { subjectOverride: o } : {},
|
|
706
|
+
...i ? { titleOverride: i } : {},
|
|
707
|
+
...a ? { summaryOverride: a } : {},
|
|
708
|
+
...r.actionBlockVisible !== void 0 ? { actionBlockVisible: p } : {},
|
|
709
|
+
...y ? { webhookConfig: y } : {}
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function le(t, n) {
|
|
713
|
+
if (t == null)
|
|
714
|
+
return;
|
|
715
|
+
const e = m(t, "deliveryConfig.channelConfigs", n), r = {};
|
|
716
|
+
return Object.entries(e).forEach(([o, i]) => {
|
|
717
|
+
if (!M(o)) {
|
|
718
|
+
d(
|
|
719
|
+
n,
|
|
720
|
+
`deliveryConfig.channelConfigs.${o}`,
|
|
721
|
+
"Expected a supported delivery channel."
|
|
722
|
+
);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
r[o] = se(
|
|
726
|
+
i,
|
|
727
|
+
`deliveryConfig.channelConfigs.${o}`,
|
|
728
|
+
n
|
|
729
|
+
);
|
|
730
|
+
}), Object.keys(r).length > 0 ? r : void 0;
|
|
731
|
+
}
|
|
732
|
+
function fe(t, n) {
|
|
733
|
+
if (t == null)
|
|
734
|
+
return null;
|
|
735
|
+
const e = m(t, "deliveryConfig", n);
|
|
736
|
+
l(
|
|
737
|
+
e,
|
|
738
|
+
"deliveryConfig",
|
|
739
|
+
["recipients", "channels", "channelConfigs"],
|
|
740
|
+
n
|
|
741
|
+
);
|
|
742
|
+
const r = le(e.channelConfigs, n), o = ie(e.recipients, n), i = ae(e.channels, n);
|
|
743
|
+
return o.length === 0 && d(
|
|
744
|
+
n,
|
|
745
|
+
"deliveryConfig.recipients",
|
|
746
|
+
"Add at least one recipient or remove delivery config."
|
|
747
|
+
), i.length === 0 && d(
|
|
748
|
+
n,
|
|
749
|
+
"deliveryConfig.channels",
|
|
750
|
+
"Choose at least one delivery channel or remove delivery config."
|
|
751
|
+
), {
|
|
752
|
+
recipients: o,
|
|
753
|
+
channels: i,
|
|
754
|
+
...r ? { channelConfigs: r } : {}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function T(t) {
|
|
758
|
+
const n = [], e = m(t, "draft", n);
|
|
759
|
+
l(
|
|
760
|
+
e,
|
|
761
|
+
"draft",
|
|
762
|
+
[
|
|
763
|
+
"name",
|
|
764
|
+
"description",
|
|
765
|
+
"status",
|
|
766
|
+
"scheduleExpr",
|
|
767
|
+
"timezone",
|
|
768
|
+
"source",
|
|
769
|
+
"body",
|
|
770
|
+
"attachments",
|
|
771
|
+
"presentation",
|
|
772
|
+
"limits",
|
|
773
|
+
"deliveryConfig"
|
|
774
|
+
],
|
|
775
|
+
n
|
|
776
|
+
);
|
|
777
|
+
const r = f(
|
|
778
|
+
e.name,
|
|
779
|
+
"name",
|
|
780
|
+
c.name,
|
|
781
|
+
n
|
|
782
|
+
), o = u(
|
|
783
|
+
e.description,
|
|
784
|
+
"description",
|
|
785
|
+
c.description,
|
|
786
|
+
n
|
|
787
|
+
) ?? null, i = u(e.scheduleExpr, "scheduleExpr", 500, n) ?? null, a = u(e.timezone, "timezone", 200, n) ?? "UTC", p = W(e.status, n), y = O(e.source, n), s = B(e.body, n), h = D(e.attachments, n), k = R(e.presentation, n), _ = V(e.limits, n), L = fe(e.deliveryConfig, n);
|
|
788
|
+
return j(s, h, n), N(n), {
|
|
789
|
+
name: r,
|
|
790
|
+
description: o,
|
|
791
|
+
status: p,
|
|
792
|
+
scheduleExpr: i,
|
|
793
|
+
timezone: a,
|
|
794
|
+
source: y,
|
|
795
|
+
body: s,
|
|
796
|
+
attachments: h,
|
|
797
|
+
presentation: k,
|
|
798
|
+
..._ ? { limits: _ } : {},
|
|
799
|
+
deliveryConfig: L
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
function he(t) {
|
|
803
|
+
return T(t);
|
|
804
|
+
}
|
|
805
|
+
function ye(t) {
|
|
806
|
+
return T(t);
|
|
807
|
+
}
|
|
808
|
+
function ge(t) {
|
|
809
|
+
try {
|
|
810
|
+
return { valid: !0, value: T(t), issues: [] };
|
|
811
|
+
} catch (n) {
|
|
812
|
+
if (n instanceof S)
|
|
813
|
+
return { valid: !1, issues: n.issues };
|
|
814
|
+
throw n;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function Ie(t) {
|
|
818
|
+
try {
|
|
819
|
+
return { valid: !0, value: w(t), issues: [] };
|
|
820
|
+
} catch (n) {
|
|
821
|
+
if (n instanceof S)
|
|
822
|
+
return { valid: !1, issues: n.issues };
|
|
823
|
+
throw n;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function be(t) {
|
|
827
|
+
return typeof t == "string" && z.has(t);
|
|
828
|
+
}
|
|
829
|
+
function M(t) {
|
|
830
|
+
return typeof t == "string" && H.has(t);
|
|
831
|
+
}
|
|
832
|
+
export {
|
|
833
|
+
U as BRIEFING_ARTIFACT_FORMATS,
|
|
834
|
+
A as BRIEFING_KIND,
|
|
835
|
+
c as BRIEFING_TEXT_LIMITS,
|
|
836
|
+
S as BriefingContractError,
|
|
837
|
+
v as DEFAULT_BRIEFING_ARTIFACT_FORMATS,
|
|
838
|
+
ue as MAX_BRIEFING_ATTACHMENTS,
|
|
839
|
+
pe as buildBriefingJobConfig,
|
|
840
|
+
he as buildCreateBriefingRequest,
|
|
841
|
+
ye as buildUpdateBriefingRequest,
|
|
842
|
+
be as isBriefingArtifactFormat,
|
|
843
|
+
M as isBriefingDeliveryChannel,
|
|
844
|
+
T as normalizeBriefingDraft,
|
|
845
|
+
w as normalizeBriefingJobConfig,
|
|
846
|
+
ge as validateBriefingDraft,
|
|
847
|
+
Ie as validateBriefingJobConfig
|
|
848
|
+
};
|