@andpipes/widget-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/chunk-GG2BTLFR.js +53 -0
- package/dist/index.cjs +1043 -0
- package/dist/index.d.cts +494 -0
- package/dist/index.d.ts +494 -0
- package/dist/index.js +918 -0
- package/dist/render-token-limit-5gpQxyG-.d.cts +14 -0
- package/dist/render-token-limit-5gpQxyG-.d.ts +14 -0
- package/dist/render-token.cjs +153 -0
- package/dist/render-token.d.cts +25 -0
- package/dist/render-token.d.ts +25 -0
- package/dist/render-token.js +123 -0
- package/package.json +37 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WIDGET_RENDER_TOKEN_MAX_BYTES,
|
|
3
|
+
estimateWidgetRenderTokenBytes,
|
|
4
|
+
isWidgetRenderPayloadWithinTokenLimit
|
|
5
|
+
} from "./chunk-GG2BTLFR.js";
|
|
6
|
+
|
|
7
|
+
// src/build/builder.ts
|
|
8
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE9 } from "@andpipes/localization";
|
|
9
|
+
|
|
10
|
+
// src/redact/forbidden.ts
|
|
11
|
+
var DEFAULT_FORBIDDEN_PII = [
|
|
12
|
+
"phone",
|
|
13
|
+
"email",
|
|
14
|
+
"real_name",
|
|
15
|
+
"address",
|
|
16
|
+
"payment_info",
|
|
17
|
+
"token",
|
|
18
|
+
"access_token",
|
|
19
|
+
"refresh_token",
|
|
20
|
+
"id_token",
|
|
21
|
+
"session_token",
|
|
22
|
+
"secret",
|
|
23
|
+
"client_secret",
|
|
24
|
+
"api_key",
|
|
25
|
+
"authorization",
|
|
26
|
+
"password",
|
|
27
|
+
"private_key"
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// src/redact/redact.ts
|
|
31
|
+
var DEFAULT_PLACEHOLDER = "[REDACTED]";
|
|
32
|
+
var SAFE_LABEL_MAP_KEYS = /* @__PURE__ */ new Set(["fieldLabels", "attributeLabels"]);
|
|
33
|
+
var SEMANTIC_CHANGE_VALUE_KEYS = /* @__PURE__ */ new Set(["before", "after"]);
|
|
34
|
+
function normalizeKey(key) {
|
|
35
|
+
return key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
36
|
+
}
|
|
37
|
+
function isPlainObject(value) {
|
|
38
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39
|
+
}
|
|
40
|
+
function safeAssign(target, key, value) {
|
|
41
|
+
Object.defineProperty(target, key, {
|
|
42
|
+
value,
|
|
43
|
+
writable: true,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function redactWidgetPayload(data, forbidden = DEFAULT_FORBIDDEN_PII, options = {}) {
|
|
49
|
+
const placeholder = options.placeholder === void 0 ? DEFAULT_PLACEHOLDER : options.placeholder;
|
|
50
|
+
const forbiddenSet = new Set(forbidden.map(normalizeKey));
|
|
51
|
+
const redactions = [];
|
|
52
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
53
|
+
function walk(value2, path, parentKey) {
|
|
54
|
+
if (Array.isArray(value2)) {
|
|
55
|
+
if (seen.has(value2)) {
|
|
56
|
+
return "[Circular]";
|
|
57
|
+
}
|
|
58
|
+
seen.add(value2);
|
|
59
|
+
const mapped = value2.map((item, index) => walk(item, `${path}[${index}]`, parentKey));
|
|
60
|
+
seen.delete(value2);
|
|
61
|
+
return mapped;
|
|
62
|
+
}
|
|
63
|
+
if (isPlainObject(value2)) {
|
|
64
|
+
if (seen.has(value2)) {
|
|
65
|
+
return "[Circular]";
|
|
66
|
+
}
|
|
67
|
+
seen.add(value2);
|
|
68
|
+
const result = {};
|
|
69
|
+
const semanticField = typeof value2.field === "string" && forbiddenSet.has(normalizeKey(value2.field)) ? value2.field : null;
|
|
70
|
+
const isSafeLabelMap = parentKey !== void 0 && SAFE_LABEL_MAP_KEYS.has(parentKey);
|
|
71
|
+
for (const [key, child] of Object.entries(value2)) {
|
|
72
|
+
const childPath = path.length > 0 ? `${path}.${key}` : key;
|
|
73
|
+
const directForbidden = forbiddenSet.has(normalizeKey(key)) && !isSafeLabelMap;
|
|
74
|
+
const semanticForbidden = semanticField !== null && SEMANTIC_CHANGE_VALUE_KEYS.has(key);
|
|
75
|
+
if (directForbidden || semanticForbidden) {
|
|
76
|
+
redactions.push({ path: childPath, key: semanticField ?? key });
|
|
77
|
+
if (placeholder !== null) {
|
|
78
|
+
safeAssign(result, key, placeholder);
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
safeAssign(result, key, walk(child, childPath, key));
|
|
83
|
+
}
|
|
84
|
+
seen.delete(value2);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
return value2;
|
|
88
|
+
}
|
|
89
|
+
const value = walk(data, "");
|
|
90
|
+
return { value, redactions };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/schema/templates.ts
|
|
94
|
+
var LEGACY_WIDGET_TEMPLATES = [
|
|
95
|
+
"kpi_cards",
|
|
96
|
+
"ranking_table",
|
|
97
|
+
"trend_chart",
|
|
98
|
+
"insight_list",
|
|
99
|
+
"confirmation_panel"
|
|
100
|
+
];
|
|
101
|
+
var ADVANCED_WIDGET_TEMPLATES = [
|
|
102
|
+
"detail_card",
|
|
103
|
+
"search_result_cards",
|
|
104
|
+
"setup_draft_review"
|
|
105
|
+
];
|
|
106
|
+
var WIDGET_TEMPLATES = [...LEGACY_WIDGET_TEMPLATES, ...ADVANCED_WIDGET_TEMPLATES];
|
|
107
|
+
function isWidgetTemplate(value) {
|
|
108
|
+
return typeof value === "string" && WIDGET_TEMPLATES.includes(value);
|
|
109
|
+
}
|
|
110
|
+
function isAdvancedWidgetTemplate(value) {
|
|
111
|
+
return typeof value === "string" && ADVANCED_WIDGET_TEMPLATES.includes(value);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/schema/envelope.ts
|
|
115
|
+
var WIDGET_SCHEMA_LEGACY_VERSION = "1.0.0";
|
|
116
|
+
var WIDGET_SCHEMA_VERSION = "1.1.0";
|
|
117
|
+
var WIDGET_SCHEMA_VERSIONS = [
|
|
118
|
+
WIDGET_SCHEMA_LEGACY_VERSION,
|
|
119
|
+
WIDGET_SCHEMA_VERSION
|
|
120
|
+
];
|
|
121
|
+
function isWidgetSchemaVersion(value) {
|
|
122
|
+
return typeof value === "string" && WIDGET_SCHEMA_VERSIONS.includes(value);
|
|
123
|
+
}
|
|
124
|
+
function isWidgetTemplateSupportedAtVersion(template, version) {
|
|
125
|
+
if (!isWidgetTemplate(template) || !isWidgetSchemaVersion(version)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return version === WIDGET_SCHEMA_VERSION || !isAdvancedWidgetTemplate(template);
|
|
129
|
+
}
|
|
130
|
+
var SEMVER_PATTERN = "^\\d+\\.\\d+\\.\\d+$";
|
|
131
|
+
var WIDGET_ENVELOPE_V1_SCHEMA = {
|
|
132
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
133
|
+
$id: "https://andpipe.dev/schema/widget-envelope/v1.json",
|
|
134
|
+
title: "andpipe Widget envelope v1",
|
|
135
|
+
type: "object",
|
|
136
|
+
required: ["structuredContent", "content", "textFallback", "_meta"],
|
|
137
|
+
properties: {
|
|
138
|
+
structuredContent: { type: "object" },
|
|
139
|
+
content: {
|
|
140
|
+
type: "array",
|
|
141
|
+
minItems: 1,
|
|
142
|
+
items: {
|
|
143
|
+
type: "object",
|
|
144
|
+
required: ["type", "text"],
|
|
145
|
+
properties: {
|
|
146
|
+
type: { const: "text" },
|
|
147
|
+
text: { type: "string", minLength: 1 }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
textFallback: { type: "string", minLength: 1 },
|
|
152
|
+
_meta: {
|
|
153
|
+
type: "object",
|
|
154
|
+
required: ["widget", "fallback"],
|
|
155
|
+
properties: {
|
|
156
|
+
widget: {
|
|
157
|
+
type: "object",
|
|
158
|
+
required: ["template", "version"],
|
|
159
|
+
properties: {
|
|
160
|
+
template: { type: "string", enum: [...WIDGET_TEMPLATES] },
|
|
161
|
+
version: { type: "string", enum: [...WIDGET_SCHEMA_VERSIONS] }
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
fallback: {
|
|
165
|
+
type: "object",
|
|
166
|
+
required: ["type"],
|
|
167
|
+
properties: {
|
|
168
|
+
type: { const: "markdown" }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/fallback/confirmation-panel.ts
|
|
177
|
+
import { DEFAULT_LOCALE, LOCALIZED_TEXT } from "@andpipes/localization";
|
|
178
|
+
|
|
179
|
+
// src/fallback/markdown.ts
|
|
180
|
+
function escapeCell(value) {
|
|
181
|
+
return String(value).replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
|
182
|
+
}
|
|
183
|
+
function tableRow(cells) {
|
|
184
|
+
return `| ${cells.map(escapeCell).join(" | ")} |`;
|
|
185
|
+
}
|
|
186
|
+
function markdownTable(headers, rows) {
|
|
187
|
+
const head = tableRow(headers);
|
|
188
|
+
const divider = `| ${headers.map(() => "---").join(" | ")} |`;
|
|
189
|
+
if (rows.length === 0) {
|
|
190
|
+
return `${head}
|
|
191
|
+
${divider}`;
|
|
192
|
+
}
|
|
193
|
+
const body = rows.map(tableRow).join("\n");
|
|
194
|
+
return `${head}
|
|
195
|
+
${divider}
|
|
196
|
+
${body}`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/fallback/confirmation-panel.ts
|
|
200
|
+
function confirmationPanelFallback(data, locale = DEFAULT_LOCALE) {
|
|
201
|
+
const text = LOCALIZED_TEXT[locale].widget;
|
|
202
|
+
const lines = [`## ${data.title}`];
|
|
203
|
+
if (data.summary) {
|
|
204
|
+
lines.push(data.summary);
|
|
205
|
+
}
|
|
206
|
+
if (data.risk) {
|
|
207
|
+
lines.push(`- risk: ${data.risk}`);
|
|
208
|
+
}
|
|
209
|
+
if (data.changes && data.changes.length > 0) {
|
|
210
|
+
const rows = data.changes.map((change) => [
|
|
211
|
+
change.field,
|
|
212
|
+
change.before ?? "",
|
|
213
|
+
change.after ?? ""
|
|
214
|
+
]);
|
|
215
|
+
lines.push(
|
|
216
|
+
markdownTable(
|
|
217
|
+
[text.tableHeaders.field, text.tableHeaders.before, text.tableHeaders.after],
|
|
218
|
+
rows
|
|
219
|
+
)
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
lines.push(
|
|
223
|
+
data.requiresConfirmation ? text.confirmationRequired.replace("{action}", data.action) : text.executionStatement.replace("{action}", data.action)
|
|
224
|
+
);
|
|
225
|
+
return lines.join("\n");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/fallback/detail-card.ts
|
|
229
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE2, LOCALIZED_TEXT as LOCALIZED_TEXT2 } from "@andpipes/localization";
|
|
230
|
+
function detailCardFallback(data, locale = DEFAULT_LOCALE2) {
|
|
231
|
+
const headers = LOCALIZED_TEXT2[locale].widget.tableHeaders;
|
|
232
|
+
const lines = [`## ${data.title}`];
|
|
233
|
+
if (data.subtitle) lines.push(data.subtitle);
|
|
234
|
+
if (data.status) lines.push(`- status: ${data.status.label}`);
|
|
235
|
+
if (data.description) lines.push(data.description);
|
|
236
|
+
const rows = Object.entries(data.fields).map(([key, value]) => [
|
|
237
|
+
data.fieldLabels?.[key] ?? key,
|
|
238
|
+
String(value)
|
|
239
|
+
]);
|
|
240
|
+
lines.push(markdownTable([headers.field, headers.value], rows));
|
|
241
|
+
return lines.join("\n");
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/fallback/insight-list.ts
|
|
245
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE3, LOCALIZED_TEXT as LOCALIZED_TEXT3 } from "@andpipes/localization";
|
|
246
|
+
function insightListFallback(data, locale = DEFAULT_LOCALE3) {
|
|
247
|
+
const text = LOCALIZED_TEXT3[locale].widget;
|
|
248
|
+
const lines = [`## ${data.title ?? text.defaultTitles.insightList}`];
|
|
249
|
+
for (const insight of data.insights) {
|
|
250
|
+
lines.push(`- [${insight.severity}] ${insight.message}`);
|
|
251
|
+
if (insight.recommendation) {
|
|
252
|
+
lines.push(` \u2192 ${insight.recommendation}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return lines.join("\n");
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// src/fallback/kpi-cards.ts
|
|
259
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE4, LOCALIZED_TEXT as LOCALIZED_TEXT4 } from "@andpipes/localization";
|
|
260
|
+
var DIRECTION_ARROW = {
|
|
261
|
+
up: "\u25B2",
|
|
262
|
+
down: "\u25BC",
|
|
263
|
+
flat: "\u2192"
|
|
264
|
+
};
|
|
265
|
+
function formatDelta(delta) {
|
|
266
|
+
return `${DIRECTION_ARROW[delta.direction]} ${delta.value}`;
|
|
267
|
+
}
|
|
268
|
+
function kpiCardsFallback(data, locale = DEFAULT_LOCALE4) {
|
|
269
|
+
const text = LOCALIZED_TEXT4[locale].widget;
|
|
270
|
+
const lines = [`## ${data.title ?? text.defaultTitles.kpiCards}`];
|
|
271
|
+
for (const card of data.cards) {
|
|
272
|
+
const unit = card.unit ?? "";
|
|
273
|
+
const delta = card.delta ? `\uFF08${formatDelta(card.delta)}\uFF09` : "";
|
|
274
|
+
const caption = card.caption ? ` \u2014 ${card.caption}` : "";
|
|
275
|
+
lines.push(`- **${card.label}**: ${card.value}${unit}${delta}${caption}`);
|
|
276
|
+
}
|
|
277
|
+
return lines.join("\n");
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/fallback/ranking-table.ts
|
|
281
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE5, LOCALIZED_TEXT as LOCALIZED_TEXT5 } from "@andpipes/localization";
|
|
282
|
+
function rankingTableFallback(data, locale = DEFAULT_LOCALE5) {
|
|
283
|
+
const text = LOCALIZED_TEXT5[locale].widget;
|
|
284
|
+
const hasRank = data.rows.some((row) => row.rank !== void 0);
|
|
285
|
+
const headers = [
|
|
286
|
+
...hasRank ? ["#"] : [],
|
|
287
|
+
...data.columns.map((column) => column.label)
|
|
288
|
+
];
|
|
289
|
+
const rows = data.rows.map((row) => [
|
|
290
|
+
...hasRank ? [row.rank ?? ""] : [],
|
|
291
|
+
...data.columns.map((column) => row.cells[column.key] ?? "")
|
|
292
|
+
]);
|
|
293
|
+
return `## ${data.title ?? text.defaultTitles.rankingTable}
|
|
294
|
+
${markdownTable(headers, rows)}`;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/fallback/search-result-cards.ts
|
|
298
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE6, LOCALIZED_TEXT as LOCALIZED_TEXT6 } from "@andpipes/localization";
|
|
299
|
+
function searchResultCardsFallback(data, locale = DEFAULT_LOCALE6) {
|
|
300
|
+
const text = LOCALIZED_TEXT6[locale].widget.searchResults;
|
|
301
|
+
const lines = [`## ${data.title ?? text.title}`];
|
|
302
|
+
if (data.query) lines.push(`${text.query}: ${data.query}`);
|
|
303
|
+
if (data.results.length === 0) {
|
|
304
|
+
lines.push(text.empty);
|
|
305
|
+
return lines.join("\n");
|
|
306
|
+
}
|
|
307
|
+
for (const result of data.results) {
|
|
308
|
+
lines.push(`### ${result.title}`);
|
|
309
|
+
if (result.badge) lines.push(`- status: ${result.badge.label}`);
|
|
310
|
+
if (result.summary) lines.push(result.summary);
|
|
311
|
+
for (const [key, value] of Object.entries(result.attributes ?? {})) {
|
|
312
|
+
lines.push(`- **${result.attributeLabels?.[key] ?? key}**: ${String(value)}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return lines.join("\n");
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/fallback/setup-draft-review.ts
|
|
319
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE7, LOCALIZED_TEXT as LOCALIZED_TEXT7 } from "@andpipes/localization";
|
|
320
|
+
function setupDraftReviewFallback(data, locale = DEFAULT_LOCALE7) {
|
|
321
|
+
const text = LOCALIZED_TEXT7[locale].widget;
|
|
322
|
+
const lines = [`## ${data.title}`];
|
|
323
|
+
if (data.summary) lines.push(data.summary);
|
|
324
|
+
if (data.status) lines.push(`- status: ${data.status}`);
|
|
325
|
+
for (const warning of data.warnings ?? []) lines.push(`- warning: ${warning}`);
|
|
326
|
+
for (const section of data.sections) {
|
|
327
|
+
lines.push(`### ${section.title}`);
|
|
328
|
+
lines.push(
|
|
329
|
+
markdownTable(
|
|
330
|
+
[text.tableHeaders.field, text.tableHeaders.before, text.tableHeaders.after],
|
|
331
|
+
section.changes.map((change) => [change.field, change.before ?? "", change.after ?? ""])
|
|
332
|
+
)
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
lines.push(text.confirmationRequired.replace("{action}", data.action));
|
|
336
|
+
return lines.join("\n");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/fallback/trend-chart.ts
|
|
340
|
+
import { DEFAULT_LOCALE as DEFAULT_LOCALE8, LOCALIZED_TEXT as LOCALIZED_TEXT8 } from "@andpipes/localization";
|
|
341
|
+
function trendChartFallback(data, locale = DEFAULT_LOCALE8) {
|
|
342
|
+
const text = LOCALIZED_TEXT8[locale].widget;
|
|
343
|
+
const lines = [`## ${data.title ?? text.defaultTitles.trendChart}`];
|
|
344
|
+
const yLabel = data.unit ? `y (${data.unit})` : "y";
|
|
345
|
+
for (const series of data.series) {
|
|
346
|
+
lines.push(`### ${series.name}`);
|
|
347
|
+
const rows = series.points.map((point) => [point.x, point.y]);
|
|
348
|
+
lines.push(markdownTable(["x", yLabel], rows));
|
|
349
|
+
}
|
|
350
|
+
return lines.join("\n");
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/schema/widgets/confirmation-panel.ts
|
|
354
|
+
var CONFIRMATION_PANEL_SCHEMA = {
|
|
355
|
+
$id: "https://andpipe.dev/schema/widget/confirmation-panel/v1.json",
|
|
356
|
+
type: "object",
|
|
357
|
+
required: ["title", "action", "requiresConfirmation"],
|
|
358
|
+
additionalProperties: false,
|
|
359
|
+
properties: {
|
|
360
|
+
title: { type: "string", minLength: 1 },
|
|
361
|
+
action: { type: "string", minLength: 1 },
|
|
362
|
+
requiresConfirmation: { type: "boolean" },
|
|
363
|
+
summary: { type: "string" },
|
|
364
|
+
risk: { type: "string", enum: ["low", "medium", "high"] },
|
|
365
|
+
changes: {
|
|
366
|
+
type: "array",
|
|
367
|
+
items: {
|
|
368
|
+
type: "object",
|
|
369
|
+
required: ["field"],
|
|
370
|
+
additionalProperties: false,
|
|
371
|
+
properties: {
|
|
372
|
+
field: { type: "string" },
|
|
373
|
+
before: { type: "string" },
|
|
374
|
+
after: { type: "string" }
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// src/schema/widgets/shared.ts
|
|
382
|
+
var WIDGET_BADGE_SCHEMA = {
|
|
383
|
+
type: "object",
|
|
384
|
+
required: ["label", "tone"],
|
|
385
|
+
additionalProperties: false,
|
|
386
|
+
properties: {
|
|
387
|
+
label: { type: "string", minLength: 1, maxLength: 80 },
|
|
388
|
+
tone: { type: "string", enum: ["neutral", "success", "warning", "danger"] }
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
var WIDGET_SCALAR_SCHEMA = {
|
|
392
|
+
type: ["string", "number", "boolean"]
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// src/schema/widgets/detail-card.ts
|
|
396
|
+
var DETAIL_CARD_SCHEMA = {
|
|
397
|
+
$id: "https://andpipe.dev/schema/widget/detail-card/v1.1.json",
|
|
398
|
+
type: "object",
|
|
399
|
+
required: ["title", "fields"],
|
|
400
|
+
additionalProperties: false,
|
|
401
|
+
properties: {
|
|
402
|
+
title: { type: "string", minLength: 1, maxLength: 200 },
|
|
403
|
+
subtitle: { type: "string", maxLength: 300 },
|
|
404
|
+
description: { type: "string", maxLength: 2e3 },
|
|
405
|
+
fields: {
|
|
406
|
+
type: "object",
|
|
407
|
+
minProperties: 1,
|
|
408
|
+
maxProperties: 24,
|
|
409
|
+
additionalProperties: WIDGET_SCALAR_SCHEMA
|
|
410
|
+
},
|
|
411
|
+
fieldLabels: {
|
|
412
|
+
type: "object",
|
|
413
|
+
maxProperties: 24,
|
|
414
|
+
additionalProperties: { type: "string", minLength: 1, maxLength: 120 }
|
|
415
|
+
},
|
|
416
|
+
status: WIDGET_BADGE_SCHEMA
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// src/schema/widgets/insight-list.ts
|
|
421
|
+
var INSIGHT_LIST_SCHEMA = {
|
|
422
|
+
$id: "https://andpipe.dev/schema/widget/insight-list/v1.json",
|
|
423
|
+
type: "object",
|
|
424
|
+
required: ["insights"],
|
|
425
|
+
additionalProperties: false,
|
|
426
|
+
properties: {
|
|
427
|
+
title: { type: "string" },
|
|
428
|
+
insights: {
|
|
429
|
+
type: "array",
|
|
430
|
+
minItems: 1,
|
|
431
|
+
items: {
|
|
432
|
+
type: "object",
|
|
433
|
+
required: ["severity", "message"],
|
|
434
|
+
additionalProperties: false,
|
|
435
|
+
properties: {
|
|
436
|
+
severity: { type: "string", enum: ["info", "warning", "critical"] },
|
|
437
|
+
message: { type: "string", minLength: 1 },
|
|
438
|
+
recommendation: { type: "string" }
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
// src/schema/widgets/kpi-cards.ts
|
|
446
|
+
var KPI_CARDS_SCHEMA = {
|
|
447
|
+
$id: "https://andpipe.dev/schema/widget/kpi-cards/v1.json",
|
|
448
|
+
type: "object",
|
|
449
|
+
required: ["cards"],
|
|
450
|
+
additionalProperties: false,
|
|
451
|
+
properties: {
|
|
452
|
+
title: { type: "string" },
|
|
453
|
+
cards: {
|
|
454
|
+
type: "array",
|
|
455
|
+
minItems: 1,
|
|
456
|
+
items: {
|
|
457
|
+
type: "object",
|
|
458
|
+
required: ["label", "value"],
|
|
459
|
+
additionalProperties: false,
|
|
460
|
+
properties: {
|
|
461
|
+
label: { type: "string", minLength: 1 },
|
|
462
|
+
value: { type: ["string", "number"] },
|
|
463
|
+
unit: { type: "string" },
|
|
464
|
+
delta: {
|
|
465
|
+
type: "object",
|
|
466
|
+
required: ["value", "direction"],
|
|
467
|
+
additionalProperties: false,
|
|
468
|
+
properties: {
|
|
469
|
+
value: { type: "number" },
|
|
470
|
+
direction: { type: "string", enum: ["up", "down", "flat"] }
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
caption: { type: "string" }
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
// src/schema/widgets/ranking-table.ts
|
|
481
|
+
var RANKING_TABLE_SCHEMA = {
|
|
482
|
+
$id: "https://andpipe.dev/schema/widget/ranking-table/v1.json",
|
|
483
|
+
type: "object",
|
|
484
|
+
required: ["columns", "rows"],
|
|
485
|
+
additionalProperties: false,
|
|
486
|
+
properties: {
|
|
487
|
+
title: { type: "string" },
|
|
488
|
+
columns: {
|
|
489
|
+
type: "array",
|
|
490
|
+
minItems: 1,
|
|
491
|
+
items: {
|
|
492
|
+
type: "object",
|
|
493
|
+
required: ["key", "label"],
|
|
494
|
+
additionalProperties: false,
|
|
495
|
+
properties: {
|
|
496
|
+
key: { type: "string", minLength: 1 },
|
|
497
|
+
label: { type: "string" }
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
rows: {
|
|
502
|
+
type: "array",
|
|
503
|
+
items: {
|
|
504
|
+
type: "object",
|
|
505
|
+
required: ["cells"],
|
|
506
|
+
additionalProperties: false,
|
|
507
|
+
properties: {
|
|
508
|
+
rank: { type: "number" },
|
|
509
|
+
// cells は表の列値を自由キーで持つ意図的な領域。値は string | number に限定する。
|
|
510
|
+
cells: {
|
|
511
|
+
type: "object",
|
|
512
|
+
additionalProperties: { type: ["string", "number"] }
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// src/schema/widgets/search-result-cards.ts
|
|
521
|
+
var SEARCH_RESULT_CARDS_SCHEMA = {
|
|
522
|
+
$id: "https://andpipe.dev/schema/widget/search-result-cards/v1.1.json",
|
|
523
|
+
type: "object",
|
|
524
|
+
required: ["results"],
|
|
525
|
+
additionalProperties: false,
|
|
526
|
+
properties: {
|
|
527
|
+
title: { type: "string", maxLength: 200 },
|
|
528
|
+
query: { type: "string", maxLength: 500 },
|
|
529
|
+
results: {
|
|
530
|
+
type: "array",
|
|
531
|
+
maxItems: 50,
|
|
532
|
+
items: {
|
|
533
|
+
type: "object",
|
|
534
|
+
required: ["id", "title"],
|
|
535
|
+
additionalProperties: false,
|
|
536
|
+
properties: {
|
|
537
|
+
id: { type: "string", minLength: 1, maxLength: 200 },
|
|
538
|
+
title: { type: "string", minLength: 1, maxLength: 300 },
|
|
539
|
+
summary: { type: "string", maxLength: 1e3 },
|
|
540
|
+
attributes: {
|
|
541
|
+
type: "object",
|
|
542
|
+
maxProperties: 20,
|
|
543
|
+
additionalProperties: WIDGET_SCALAR_SCHEMA
|
|
544
|
+
},
|
|
545
|
+
attributeLabels: {
|
|
546
|
+
type: "object",
|
|
547
|
+
maxProperties: 20,
|
|
548
|
+
additionalProperties: { type: "string", minLength: 1, maxLength: 120 }
|
|
549
|
+
},
|
|
550
|
+
badge: WIDGET_BADGE_SCHEMA
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
// src/schema/widgets/setup-draft-review.ts
|
|
558
|
+
var SETUP_DRAFT_CHANGE_SCHEMA = {
|
|
559
|
+
type: "object",
|
|
560
|
+
required: ["field"],
|
|
561
|
+
additionalProperties: false,
|
|
562
|
+
properties: {
|
|
563
|
+
field: { type: "string", minLength: 1, maxLength: 200 },
|
|
564
|
+
before: { type: "string", maxLength: 2e3 },
|
|
565
|
+
after: { type: "string", maxLength: 2e3 }
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
var SETUP_DRAFT_REVIEW_SCHEMA = {
|
|
569
|
+
$id: "https://andpipe.dev/schema/widget/setup-draft-review/v1.1.json",
|
|
570
|
+
type: "object",
|
|
571
|
+
required: ["title", "action", "requiresConfirmation", "sections"],
|
|
572
|
+
additionalProperties: false,
|
|
573
|
+
properties: {
|
|
574
|
+
title: { type: "string", minLength: 1, maxLength: 200 },
|
|
575
|
+
action: { type: "string", minLength: 1, maxLength: 200 },
|
|
576
|
+
requiresConfirmation: { const: true },
|
|
577
|
+
summary: { type: "string", maxLength: 2e3 },
|
|
578
|
+
status: { type: "string", enum: ["draft", "ready_for_review", "blocked"] },
|
|
579
|
+
warnings: {
|
|
580
|
+
type: "array",
|
|
581
|
+
maxItems: 20,
|
|
582
|
+
items: { type: "string", minLength: 1, maxLength: 500 }
|
|
583
|
+
},
|
|
584
|
+
sections: {
|
|
585
|
+
type: "array",
|
|
586
|
+
minItems: 1,
|
|
587
|
+
maxItems: 20,
|
|
588
|
+
items: {
|
|
589
|
+
type: "object",
|
|
590
|
+
required: ["title", "changes"],
|
|
591
|
+
additionalProperties: false,
|
|
592
|
+
properties: {
|
|
593
|
+
title: { type: "string", minLength: 1, maxLength: 200 },
|
|
594
|
+
changes: {
|
|
595
|
+
type: "array",
|
|
596
|
+
minItems: 1,
|
|
597
|
+
maxItems: 50,
|
|
598
|
+
items: SETUP_DRAFT_CHANGE_SCHEMA
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// src/schema/widgets/trend-chart.ts
|
|
607
|
+
var TREND_CHART_SCHEMA = {
|
|
608
|
+
$id: "https://andpipe.dev/schema/widget/trend-chart/v1.json",
|
|
609
|
+
type: "object",
|
|
610
|
+
required: ["series"],
|
|
611
|
+
additionalProperties: false,
|
|
612
|
+
properties: {
|
|
613
|
+
title: { type: "string" },
|
|
614
|
+
unit: { type: "string" },
|
|
615
|
+
series: {
|
|
616
|
+
type: "array",
|
|
617
|
+
minItems: 1,
|
|
618
|
+
items: {
|
|
619
|
+
type: "object",
|
|
620
|
+
required: ["name", "points"],
|
|
621
|
+
additionalProperties: false,
|
|
622
|
+
properties: {
|
|
623
|
+
name: { type: "string", minLength: 1 },
|
|
624
|
+
points: {
|
|
625
|
+
type: "array",
|
|
626
|
+
items: {
|
|
627
|
+
type: "object",
|
|
628
|
+
required: ["x", "y"],
|
|
629
|
+
additionalProperties: false,
|
|
630
|
+
properties: {
|
|
631
|
+
x: { type: "string" },
|
|
632
|
+
y: { type: "number" }
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// src/schema/widgets/index.ts
|
|
643
|
+
var WIDGET_REGISTRY_ENTRIES = {
|
|
644
|
+
kpi_cards: {
|
|
645
|
+
schema: KPI_CARDS_SCHEMA,
|
|
646
|
+
fallback: (data, locale) => kpiCardsFallback(data, locale)
|
|
647
|
+
},
|
|
648
|
+
ranking_table: {
|
|
649
|
+
schema: RANKING_TABLE_SCHEMA,
|
|
650
|
+
fallback: (data, locale) => rankingTableFallback(data, locale)
|
|
651
|
+
},
|
|
652
|
+
trend_chart: {
|
|
653
|
+
schema: TREND_CHART_SCHEMA,
|
|
654
|
+
fallback: (data, locale) => trendChartFallback(data, locale)
|
|
655
|
+
},
|
|
656
|
+
insight_list: {
|
|
657
|
+
schema: INSIGHT_LIST_SCHEMA,
|
|
658
|
+
fallback: (data, locale) => insightListFallback(data, locale)
|
|
659
|
+
},
|
|
660
|
+
confirmation_panel: {
|
|
661
|
+
schema: CONFIRMATION_PANEL_SCHEMA,
|
|
662
|
+
fallback: (data, locale) => confirmationPanelFallback(data, locale)
|
|
663
|
+
},
|
|
664
|
+
detail_card: {
|
|
665
|
+
schema: DETAIL_CARD_SCHEMA,
|
|
666
|
+
fallback: (data, locale) => detailCardFallback(data, locale)
|
|
667
|
+
},
|
|
668
|
+
search_result_cards: {
|
|
669
|
+
schema: SEARCH_RESULT_CARDS_SCHEMA,
|
|
670
|
+
fallback: (data, locale) => searchResultCardsFallback(data, locale)
|
|
671
|
+
},
|
|
672
|
+
setup_draft_review: {
|
|
673
|
+
schema: SETUP_DRAFT_REVIEW_SCHEMA,
|
|
674
|
+
fallback: (data, locale) => setupDraftReviewFallback(data, locale)
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
var WIDGET_REGISTRY = Object.freeze(
|
|
678
|
+
Object.assign(
|
|
679
|
+
/* @__PURE__ */ Object.create(null),
|
|
680
|
+
WIDGET_REGISTRY_ENTRIES
|
|
681
|
+
)
|
|
682
|
+
);
|
|
683
|
+
function getWidgetTemplateEntry(template) {
|
|
684
|
+
if (!isWidgetTemplate(template)) {
|
|
685
|
+
return void 0;
|
|
686
|
+
}
|
|
687
|
+
return WIDGET_REGISTRY[template];
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// src/validate/ajv.ts
|
|
691
|
+
import Ajv from "ajv";
|
|
692
|
+
import addFormats from "ajv-formats";
|
|
693
|
+
function createAjv() {
|
|
694
|
+
const ajv2 = new Ajv({ allErrors: true, strict: false });
|
|
695
|
+
addFormats(ajv2);
|
|
696
|
+
return ajv2;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/validate/envelope.ts
|
|
700
|
+
var cached;
|
|
701
|
+
function getValidator() {
|
|
702
|
+
if (!cached) {
|
|
703
|
+
cached = createAjv().compile(WIDGET_ENVELOPE_V1_SCHEMA);
|
|
704
|
+
}
|
|
705
|
+
return cached;
|
|
706
|
+
}
|
|
707
|
+
function validateWidgetEnvelope(value) {
|
|
708
|
+
const validate = getValidator();
|
|
709
|
+
if (!validate(value)) {
|
|
710
|
+
const errors = (validate.errors ?? []).map((error) => {
|
|
711
|
+
const path = error.instancePath.length > 0 ? error.instancePath : "(root)";
|
|
712
|
+
return { path, message: `${path} ${error.message ?? "invalid"}` };
|
|
713
|
+
});
|
|
714
|
+
return { ok: false, errors };
|
|
715
|
+
}
|
|
716
|
+
const widget = value._meta.widget;
|
|
717
|
+
if (!isWidgetTemplateSupportedAtVersion(widget.template, widget.version)) {
|
|
718
|
+
return {
|
|
719
|
+
ok: false,
|
|
720
|
+
errors: [
|
|
721
|
+
{
|
|
722
|
+
path: "/_meta/widget/version",
|
|
723
|
+
message: `/_meta/widget/version is incompatible with template ${String(widget.template)}`
|
|
724
|
+
}
|
|
725
|
+
]
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
return { ok: true, errors: [] };
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// src/validate/widget-data.ts
|
|
732
|
+
var ajv = createAjv();
|
|
733
|
+
var cache = /* @__PURE__ */ new Map();
|
|
734
|
+
function getValidator2(template) {
|
|
735
|
+
const cached2 = cache.get(template);
|
|
736
|
+
if (cached2) {
|
|
737
|
+
return cached2;
|
|
738
|
+
}
|
|
739
|
+
const entry = getWidgetTemplateEntry(template);
|
|
740
|
+
if (!entry) {
|
|
741
|
+
throw new Error(`unreachable unknown widget template: ${template}`);
|
|
742
|
+
}
|
|
743
|
+
const validator = ajv.compile(entry.schema);
|
|
744
|
+
cache.set(template, validator);
|
|
745
|
+
return validator;
|
|
746
|
+
}
|
|
747
|
+
function validateWidgetData(template, value) {
|
|
748
|
+
if (!isWidgetTemplate(template)) {
|
|
749
|
+
const templateName = typeof template === "symbol" ? template.toString() : String(template);
|
|
750
|
+
return {
|
|
751
|
+
ok: false,
|
|
752
|
+
errors: [{ path: "template", message: `\u672A\u77E5\u306E widget template: ${templateName}` }]
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
const validate = getValidator2(template);
|
|
756
|
+
if (validate(value)) {
|
|
757
|
+
return { ok: true, errors: [] };
|
|
758
|
+
}
|
|
759
|
+
const errors = (validate.errors ?? []).map((error) => {
|
|
760
|
+
const path = error.instancePath.length > 0 ? error.instancePath : "(root)";
|
|
761
|
+
return { path, message: `${path} ${error.message ?? "invalid"}` };
|
|
762
|
+
});
|
|
763
|
+
return { ok: false, errors };
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// src/build/builder.ts
|
|
767
|
+
var WidgetSchemaError = class extends Error {
|
|
768
|
+
template;
|
|
769
|
+
issues;
|
|
770
|
+
constructor(template, message, issues = []) {
|
|
771
|
+
super(message);
|
|
772
|
+
this.name = "WidgetSchemaError";
|
|
773
|
+
this.template = describeWidgetTemplate(template);
|
|
774
|
+
this.issues = issues;
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
function describeWidgetTemplate(template) {
|
|
778
|
+
return typeof template === "symbol" ? template.toString() : String(template);
|
|
779
|
+
}
|
|
780
|
+
function buildWidgetResponse(input) {
|
|
781
|
+
const { template, data } = input;
|
|
782
|
+
const forbidden = [.../* @__PURE__ */ new Set([...DEFAULT_FORBIDDEN_PII, ...input.forbidden ?? []])];
|
|
783
|
+
const version = input.version ?? WIDGET_SCHEMA_VERSION;
|
|
784
|
+
const locale = input.locale ?? DEFAULT_LOCALE9;
|
|
785
|
+
const entry = getWidgetTemplateEntry(template);
|
|
786
|
+
if (!entry) {
|
|
787
|
+
throw new WidgetSchemaError(
|
|
788
|
+
template,
|
|
789
|
+
`\u672A\u77E5\u306E widget template: ${describeWidgetTemplate(template)}`
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
if (!isWidgetTemplateSupportedAtVersion(template, version)) {
|
|
793
|
+
throw new WidgetSchemaError(
|
|
794
|
+
template,
|
|
795
|
+
`\u672A\u5BFE\u5FDC\u306E widget template/version: ${describeWidgetTemplate(template)}@${version}`
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
const dataCheck = validateWidgetData(template, data);
|
|
799
|
+
if (!dataCheck.ok) {
|
|
800
|
+
throw new WidgetSchemaError(
|
|
801
|
+
template,
|
|
802
|
+
`widget data \u304C ${template} schema \u306B\u9055\u53CD\u3057\u3066\u3044\u307E\u3059`,
|
|
803
|
+
dataCheck.errors.map((error) => error.message)
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
const { value: redacted, redactions } = redactWidgetPayload(data, forbidden);
|
|
807
|
+
const textFallback = entry.fallback(redacted, locale);
|
|
808
|
+
if (textFallback.length === 0) {
|
|
809
|
+
throw new WidgetSchemaError(template, `textFallback \u304C\u7A7A\u3067\u3059: ${template}`);
|
|
810
|
+
}
|
|
811
|
+
const content = [{ type: "text", text: textFallback }];
|
|
812
|
+
const envelope = {
|
|
813
|
+
structuredContent: redacted,
|
|
814
|
+
content,
|
|
815
|
+
textFallback,
|
|
816
|
+
_meta: {
|
|
817
|
+
widget: { template, version },
|
|
818
|
+
fallback: { type: "markdown" }
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
if (!isWidgetRenderPayloadWithinTokenLimit({
|
|
822
|
+
template,
|
|
823
|
+
version,
|
|
824
|
+
structuredContent: redacted,
|
|
825
|
+
textFallback
|
|
826
|
+
})) {
|
|
827
|
+
throw new WidgetSchemaError(
|
|
828
|
+
template,
|
|
829
|
+
`widget render payload \u304C64 KiB token\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u307E\u3059: ${template}`
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
const envelopeCheck = validateWidgetEnvelope(envelope);
|
|
833
|
+
if (!envelopeCheck.ok) {
|
|
834
|
+
throw new WidgetSchemaError(
|
|
835
|
+
template,
|
|
836
|
+
`\u751F\u6210\u3057\u305F envelope \u304C schema \u306B\u9055\u53CD\u3057\u3066\u3044\u307E\u3059: ${template}`,
|
|
837
|
+
envelopeCheck.errors.map((error) => error.message)
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
return { envelope, redactions };
|
|
841
|
+
}
|
|
842
|
+
function buildKpiCards(data, options) {
|
|
843
|
+
return buildWidgetResponse({ template: "kpi_cards", data, ...options });
|
|
844
|
+
}
|
|
845
|
+
function buildRankingTable(data, options) {
|
|
846
|
+
return buildWidgetResponse({ template: "ranking_table", data, ...options });
|
|
847
|
+
}
|
|
848
|
+
function buildTrendChart(data, options) {
|
|
849
|
+
return buildWidgetResponse({ template: "trend_chart", data, ...options });
|
|
850
|
+
}
|
|
851
|
+
function buildInsightList(data, options) {
|
|
852
|
+
return buildWidgetResponse({ template: "insight_list", data, ...options });
|
|
853
|
+
}
|
|
854
|
+
function buildConfirmationPanel(data, options) {
|
|
855
|
+
return buildWidgetResponse({ template: "confirmation_panel", data, ...options });
|
|
856
|
+
}
|
|
857
|
+
function buildDetailCard(data, options) {
|
|
858
|
+
return buildWidgetResponse({ template: "detail_card", data, ...options });
|
|
859
|
+
}
|
|
860
|
+
function buildSearchResultCards(data, options) {
|
|
861
|
+
return buildWidgetResponse({ template: "search_result_cards", data, ...options });
|
|
862
|
+
}
|
|
863
|
+
function buildSetupDraftReview(data, options) {
|
|
864
|
+
return buildWidgetResponse({ template: "setup_draft_review", data, ...options });
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// src/index.ts
|
|
868
|
+
var packageName = "@andpipes/widget-sdk";
|
|
869
|
+
export {
|
|
870
|
+
ADVANCED_WIDGET_TEMPLATES,
|
|
871
|
+
CONFIRMATION_PANEL_SCHEMA,
|
|
872
|
+
DEFAULT_FORBIDDEN_PII,
|
|
873
|
+
DETAIL_CARD_SCHEMA,
|
|
874
|
+
INSIGHT_LIST_SCHEMA,
|
|
875
|
+
KPI_CARDS_SCHEMA,
|
|
876
|
+
LEGACY_WIDGET_TEMPLATES,
|
|
877
|
+
RANKING_TABLE_SCHEMA,
|
|
878
|
+
SEARCH_RESULT_CARDS_SCHEMA,
|
|
879
|
+
SEMVER_PATTERN,
|
|
880
|
+
SETUP_DRAFT_REVIEW_SCHEMA,
|
|
881
|
+
TREND_CHART_SCHEMA,
|
|
882
|
+
WIDGET_ENVELOPE_V1_SCHEMA,
|
|
883
|
+
WIDGET_REGISTRY,
|
|
884
|
+
WIDGET_RENDER_TOKEN_MAX_BYTES,
|
|
885
|
+
WIDGET_SCHEMA_LEGACY_VERSION,
|
|
886
|
+
WIDGET_SCHEMA_VERSION,
|
|
887
|
+
WIDGET_SCHEMA_VERSIONS,
|
|
888
|
+
WIDGET_TEMPLATES,
|
|
889
|
+
WidgetSchemaError,
|
|
890
|
+
buildConfirmationPanel,
|
|
891
|
+
buildDetailCard,
|
|
892
|
+
buildInsightList,
|
|
893
|
+
buildKpiCards,
|
|
894
|
+
buildRankingTable,
|
|
895
|
+
buildSearchResultCards,
|
|
896
|
+
buildSetupDraftReview,
|
|
897
|
+
buildTrendChart,
|
|
898
|
+
buildWidgetResponse,
|
|
899
|
+
confirmationPanelFallback,
|
|
900
|
+
detailCardFallback,
|
|
901
|
+
estimateWidgetRenderTokenBytes,
|
|
902
|
+
getWidgetTemplateEntry,
|
|
903
|
+
insightListFallback,
|
|
904
|
+
isAdvancedWidgetTemplate,
|
|
905
|
+
isWidgetRenderPayloadWithinTokenLimit,
|
|
906
|
+
isWidgetSchemaVersion,
|
|
907
|
+
isWidgetTemplate,
|
|
908
|
+
isWidgetTemplateSupportedAtVersion,
|
|
909
|
+
kpiCardsFallback,
|
|
910
|
+
packageName,
|
|
911
|
+
rankingTableFallback,
|
|
912
|
+
redactWidgetPayload,
|
|
913
|
+
searchResultCardsFallback,
|
|
914
|
+
setupDraftReviewFallback,
|
|
915
|
+
trendChartFallback,
|
|
916
|
+
validateWidgetData,
|
|
917
|
+
validateWidgetEnvelope
|
|
918
|
+
};
|