react-semaphor 0.1.563 → 0.1.565
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/DATA_APP_SDK.md +3 -3
- package/README.md +2 -2
- package/dist/analytics-protocol/index.js +8 -8
- package/dist/assistant-context/index.js +3 -2
- package/dist/brand-studio/index.js +28 -29
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{assistant-chat-iIp02_77.js → assistant-chat-DNfb5fbF.js} +294 -294
- package/dist/chunks/{bookmark-impact-D4Kl4amw.js → bookmark-impact-CHr7b1J2.js} +2 -2
- package/dist/chunks/bookmark-state-ByODVqee.js +1613 -0
- package/dist/chunks/card-filter-builder-CcEcfaYz.js +4100 -0
- package/dist/chunks/{switch-BW4yXSYs.js → code-editor-DJNOsgJH.js} +463 -442
- package/dist/chunks/{comparison-window-caption-D1EUXzaR.js → comparison-window-caption-CMLb3mut.js} +451 -419
- package/dist/chunks/{dashboard-CmqeP3QZ.js → dashboard-CtIfxycc.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-D3mc6peE.js +4910 -0
- package/dist/chunks/{dashboard-controls-B253nJS-.js → dashboard-controls-BFv0zdws.js} +684 -674
- package/dist/chunks/{dashboard-json-osQuinUZ.js → dashboard-json-CXn_3OYb.js} +4 -4
- package/dist/chunks/{dates-DFY7Gfss.js → dates-DcRxw17S.js} +13 -13
- package/dist/chunks/{edit-dashboard-visual-CMar-NhA.js → edit-dashboard-visual-Y6HatqBd.js} +7704 -10337
- package/dist/chunks/filter-reach-copy-DbggA5B7.js +4673 -0
- package/dist/chunks/{filter-value-text-CPwFkrMz.js → filter-value-text-7zhmth1S.js} +2 -2
- package/dist/chunks/{index-CNGkfUp4.js → index-DDa_rklN.js} +69 -64
- package/dist/chunks/index-RNaTnE3m.js +585 -0
- package/dist/chunks/{layout-grid-BM65viQh.js → layout-grid-0hIlqEtk.js} +1 -1
- package/dist/chunks/{list-filter-BoeLBfL3.js → list-filter-DkgoCeBm.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-hEucouWM.js → matrix-analytical-definition-C9xB_T84.js} +18 -18
- package/dist/chunks/{matrix-card-CCh9JjP1.js → matrix-card-BSUeSXpD.js} +2 -2
- package/dist/chunks/{matrix-member-presentation-DsAUbuoL.js → matrix-member-presentation-DZNgQpUq.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-DsLdFdSa.js → matrix-operation-contract-Eb6elidS.js} +1 -1
- package/dist/chunks/{metric-comparison-Bnso1cm1.js → metric-comparison-ChXUFaZu.js} +1 -1
- package/dist/chunks/{palette-p1XSJFgB.js → palette-4vf2BEEg.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-B53jqszr.js → pivot-result-contract-expectations-Ddh1rNz5.js} +4 -4
- package/dist/chunks/{pivot-result-identity-Dq5jm-EC.js → pivot-result-identity-BlbLrqaC.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-l54wJyYE.js → report-preferences-dialog-Db-b04B4.js} +122 -131
- package/dist/chunks/{report-runtime-context-BITkNSDa.js → report-runtime-context-DnA_PiKo.js} +1 -1
- package/dist/chunks/resolve-dashboard-input-context-C18J-YZC.js +21394 -0
- package/dist/chunks/{save-CHV1B1fL.js → save-D6pHmSSP.js} +1 -1
- package/dist/chunks/saved-dashboard-context-DhC_EVus.js +629 -0
- package/dist/chunks/{selection-reducer-Bz5aywT4.js → selection-reducer-OaJ-N5uN.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-C3EQEiD9.js → semaphor-ready-indicator-T6TsiBMT.js} +80879 -80744
- package/dist/chunks/{shelf-drop-preview-context-BODiBlqT.js → shelf-drop-preview-context-CNWL_b0S.js} +407 -407
- package/dist/chunks/{source-entity-resolution-DdDVXFB8.js → source-entity-resolution-DF6GulDn.js} +1 -1
- package/dist/chunks/stored-dashboard-IdmtrNkA.js +5026 -0
- package/dist/chunks/{table-export-sheet-bSXxGn-v.js → table-export-sheet--DUKWk6o.js} +1 -1
- package/dist/chunks/{temporal-input-presentation-sk9gqLi6.js → temporal-input-presentation--2r9BLr0.js} +392 -377
- package/dist/chunks/{token-types-BUK06hU2.js → token-types-C8JymO8s.js} +1 -1
- package/dist/chunks/{upload-BnmuyPqW.js → upload-Cf3wXZT8.js} +1 -1
- package/dist/chunks/{validators-BIM0FE31.js → validators-wtjw0aw6.js} +7 -7
- package/dist/chunks/variable-draft-3xseULxR.js +241 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2226 -1704
- package/dist/data-app-sdk/index.js +4 -4
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.js +174 -167
- package/dist/index.js +190 -188
- package/dist/layouts/index.js +1 -1
- package/dist/pdf-export-policy/index.js +80 -28
- package/dist/pdf-table-layout/index.js +65 -65
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/components/activity/activity-bell.d.ts +5 -1
- package/dist/types/components/activity/activity-types.d.ts +12 -4
- package/dist/types/components/dashboard-variables/data-variables-menu.d.ts +8 -0
- package/dist/types/components/dashboard-variables/variable-editor-host.d.ts +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +62 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +33 -2
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +7 -2
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +4 -2
- package/dist/types/lib/dashboard-variables/data-text.d.ts +33 -0
- package/dist/types/lib/dashboard-variables/types.d.ts +207 -0
- package/dist/types/lib/document/document-edits.d.ts +16 -1
- package/dist/types/lib/document/document-panel-target.d.ts +1 -1
- package/dist/types/lib/document/document-section-query-options.d.ts +29 -0
- package/dist/types/lib/document/document-table-data-policy.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +92 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +6 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +1 -0
- package/dist/types/lib/query-context/use-semantic-execution-payload-for-cards.d.ts +24 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +36 -0
- package/dist/types/lib/text-variables/temporal-input-text.d.ts +28 -0
- package/dist/types/lib/text-variables/text-variable-types.d.ts +72 -0
- package/dist/types/lib/types/common-types.d.ts +155 -51
- package/dist/types/lib/utils/card-definition.d.ts +2 -2
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +51 -1
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +1088 -431
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +18 -1
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -1
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +40 -40
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +16 -16
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/dashboard-filter-targets.d.ts +29 -0
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +7 -4
- package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +159 -0
- package/dist/types/shared/dashboard-authoring/dashboard-variable-changes.d.ts +61 -0
- package/dist/types/shared/dashboard-authoring/document-section-cards.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +50 -3
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +48 -1
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -2
- package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +87 -13
- package/dist/types/shared/dashboard-authoring/text-card-words/chip-colors.d.ts +23 -0
- package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +90 -8
- package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +31 -3
- package/dist/types/shared/dashboard-authoring/text-card-words/variable-words.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/variable-draft.d.ts +125 -0
- package/dist/types/shared/dashboard-authoring/variable-editability.d.ts +24 -0
- package/dist/types/shared/dashboard-authoring/variable-references.d.ts +39 -0
- package/dist/types/shared/format-utils/document-print.d.ts +4 -2
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/pdf-capacity-lines.d.ts +17 -0
- package/dist/types/shared/format-utils/pdf-delivery.d.ts +8 -1
- package/dist/types/shared/format-utils/pdf-export-policy.d.ts +74 -6
- package/dist/types/shared/format-utils/presentation-execution.d.ts +9 -0
- package/package.json +2 -2
- package/src/data-app-sdk/README.md +3 -3
- package/dist/chunks/bookmark-state-CWeoGbrx.js +0 -743
- package/dist/chunks/braces-DzgoQC64.js +0 -23
- package/dist/chunks/dashboard-briefing-launcher-TYlSW77S.js +0 -3828
- package/dist/chunks/filter-reach-copy-CvV7W5dd.js +0 -3965
- package/dist/chunks/global-date-filter-utils-N1kcsOFE.js +0 -16722
- package/dist/chunks/index-CJW5BdWT.js +0 -583
- package/dist/chunks/resolve-dashboard-input-context-DaDrZGuA.js +0 -8214
- package/dist/chunks/saved-dashboard-context-DFYBrE6O.js +0 -564
- package/dist/chunks/use-create-flow-overlay-state-BXY8-Cyz.js +0 -1436
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
var Z = Object.defineProperty;
|
|
2
|
-
var G = (e, t, r) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var k = (e, t, r) => G(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { c as Q, e as M, d as U, g as H, j as K, k as W, p as E, m as X, n as Y, r as L, o as ee, q as te, s as re } from "./resolve-dashboard-input-context-DaDrZGuA.js";
|
|
5
|
-
import { z as v } from "./bookmark-state-CWeoGbrx.js";
|
|
6
|
-
import { s as ae, i as ne, n as se, c as oe, d as ie, e as de, f as le, j as ce } from "./global-date-filter-utils-N1kcsOFE.js";
|
|
7
|
-
import { f as g, A as P, c as ue, d as fe, e as D } from "./context-R31TSL5V.js";
|
|
8
|
-
import { a as me, T as he, P as pe, o as I, d as j, b as q } from "./filter-value-text-CPwFkrMz.js";
|
|
9
|
-
import { v as ge, am as be } from "./validators-BIM0FE31.js";
|
|
10
|
-
import { a as Ce } from "./metric-comparison-Bnso1cm1.js";
|
|
11
|
-
function Ie(e) {
|
|
12
|
-
const t = e.qualifiedFieldName || e.name;
|
|
13
|
-
return e.label && e.label !== t ? `${e.label} (field ${t})` : t;
|
|
14
|
-
}
|
|
15
|
-
function ye(e, t = {}) {
|
|
16
|
-
if (!e) return [];
|
|
17
|
-
const r = O(e, t);
|
|
18
|
-
return r.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? r : [R(e, r)];
|
|
19
|
-
}
|
|
20
|
-
function O(e, t) {
|
|
21
|
-
const r = e.groups.flatMap((a) => {
|
|
22
|
-
const n = O(a, t);
|
|
23
|
-
if (n.length === 0) return [];
|
|
24
|
-
const s = R(a, n);
|
|
25
|
-
return [n.length > 1 && !a.negate ? { ...s, text: `(${s.text})` } : s];
|
|
26
|
-
});
|
|
27
|
-
return [...e.conditions.map((a) => xe(a, t)), ...r];
|
|
28
|
-
}
|
|
29
|
-
function R(e, t) {
|
|
30
|
-
const r = t.map((a) => a.text).join(e.logicalOperator === "OR" ? " or " : " and ");
|
|
31
|
-
return {
|
|
32
|
-
text: e.negate ? `not (${r})` : r,
|
|
33
|
-
omittedValues: t.reduce((a, n) => a + n.omittedValues, 0)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function xe(e, t) {
|
|
37
|
-
const r = Array.isArray(e.value) ? e.value : [e.value];
|
|
38
|
-
return me({
|
|
39
|
-
subject: Ie(e.field),
|
|
40
|
-
operator: e.operator,
|
|
41
|
-
values: r,
|
|
42
|
-
reading: Se(e),
|
|
43
|
-
relative: ge(e.relativeMeta),
|
|
44
|
-
latestValue: e.latestValue,
|
|
45
|
-
shownAs: e.label
|
|
46
|
-
}, t);
|
|
47
|
-
}
|
|
48
|
-
function Se(e) {
|
|
49
|
-
return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : be(e.field.dataType) ? he : pe;
|
|
50
|
-
}
|
|
51
|
-
function B(e) {
|
|
52
|
-
if (e.kind === "target") return `a target of ${e.targetValue}`;
|
|
53
|
-
const t = e.kind === "previous_period" ? e.offsetPeriods : e.offsetYears, r = e.kind === "previous_period" ? t && t > 1 ? `the period ${t} periods earlier` : "the previous period" : t && t > 1 ? `the same period ${t} years earlier` : "the same period a year earlier", a = [
|
|
54
|
-
e.alignment === "weekday" ? "aligned by weekday" : void 0,
|
|
55
|
-
e.toDate ? "to date (the same elapsed part of the period)" : void 0
|
|
56
|
-
].filter(Boolean);
|
|
57
|
-
return a.length ? `${r}, ${a.join(", ")}` : r;
|
|
58
|
-
}
|
|
59
|
-
function ve(e) {
|
|
60
|
-
return (e == null ? void 0 : e.kind) === "field_date" ? `the ${JSON.stringify(e.label)} filter` : "the dashboard date";
|
|
61
|
-
}
|
|
62
|
-
function Ve(e, t) {
|
|
63
|
-
const r = t.source === "explicit" ? "set on the measure" : `from the dashboard date comparison on ${ve(t.owner)}`;
|
|
64
|
-
return `${e} is compared with ${B(t.spec)} (${r})`;
|
|
65
|
-
}
|
|
66
|
-
function $(e) {
|
|
67
|
-
const t = ae(e) ?? "undefined";
|
|
68
|
-
return `${w(t, 2654435769).toString(16)}${w(t, 2246822507).toString(16)}`;
|
|
69
|
-
}
|
|
70
|
-
function w(e, t) {
|
|
71
|
-
let r = 3735928559 ^ t, a = 1103547991 ^ t;
|
|
72
|
-
for (let n = 0; n < e.length; n++) {
|
|
73
|
-
const s = e.charCodeAt(n);
|
|
74
|
-
r = Math.imul(r ^ s, 2654435761), a = Math.imul(a ^ s, 1597334677);
|
|
75
|
-
}
|
|
76
|
-
return r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(a ^ a >>> 13, 3266489909), a = Math.imul(a ^ a >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), 4294967296 * (2097151 & a) + (r >>> 0);
|
|
77
|
-
}
|
|
78
|
-
const u = P;
|
|
79
|
-
function $e(e, t, r) {
|
|
80
|
-
var _;
|
|
81
|
-
const a = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, n = qe(e, t);
|
|
82
|
-
if (n) {
|
|
83
|
-
const y = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? _e(t) : void 0, V = y ? g(y, u.textChars) : void 0;
|
|
84
|
-
return {
|
|
85
|
-
// A card that runs but is not described still changes when it runs differently.
|
|
86
|
-
fingerprint: $(a ? F(a, r.calendar) : { reason: n, message: V }),
|
|
87
|
-
description: { status: "not_described", reason: n, ...V ? { message: V } : {} }
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
const s = a, d = s.queryContext, c = De(s), o = Ae(s, r), m = Me(s), i = we(s), l = d.drillSteps.map((y) => g(
|
|
91
|
-
`${JSON.stringify(y.label)} (then by ${y.toField.label || y.toField.name})`,
|
|
92
|
-
u.textChars
|
|
93
|
-
)), f = (_ = s.card.sql) == null ? void 0 : _.trim(), p = f ? Ee(s) : [], b = {
|
|
94
|
-
fields: I(c.length, u.cardFields),
|
|
95
|
-
filters: I(o.length, u.cardFilters),
|
|
96
|
-
controls: I(m.length, u.cardControls),
|
|
97
|
-
drillSteps: I(l.length, u.drillSteps),
|
|
98
|
-
sqlParameters: I(p.length, u.sqlParameters),
|
|
99
|
-
comparisons: I(i.length, u.cardFields)
|
|
100
|
-
}, h = Object.fromEntries(Object.entries(b).filter(([, y]) => y > 0));
|
|
101
|
-
return {
|
|
102
|
-
fingerprint: $(F(s, r.calendar)),
|
|
103
|
-
description: {
|
|
104
|
-
status: "described",
|
|
105
|
-
fields: c.slice(0, u.cardFields),
|
|
106
|
-
filters: o.slice(0, u.cardFilters),
|
|
107
|
-
controls: m.slice(0, u.cardControls),
|
|
108
|
-
drillPath: l.slice(0, u.drillSteps),
|
|
109
|
-
...f ? {
|
|
110
|
-
sql: {
|
|
111
|
-
text: g(f, u.sqlChars),
|
|
112
|
-
parameters: p.slice(0, u.sqlParameters)
|
|
113
|
-
}
|
|
114
|
-
} : {},
|
|
115
|
-
...i.length ? { comparisons: i.slice(0, u.cardFields) } : {},
|
|
116
|
-
...Object.keys(h).length ? { omitted: h } : {}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function qe(e, t) {
|
|
121
|
-
if (e.type === "matrixTable") return "matrix";
|
|
122
|
-
if (e.type === "custom" || ne(e)) return "custom_visual";
|
|
123
|
-
if (se(e.python ?? "").trim()) return "python";
|
|
124
|
-
if (t === "pending") return "snapshot_pending";
|
|
125
|
-
if ((t == null ? void 0 : t.status) !== "ready") return "snapshot_blocked";
|
|
126
|
-
}
|
|
127
|
-
function _e(e) {
|
|
128
|
-
if (e.message) return e.message;
|
|
129
|
-
const t = e.mappingDispositions.flatMap((r) => r.status === "block" ? [`${r.inputId} (${r.reason})`] : []);
|
|
130
|
-
return t.length ? `dashboard inputs that cannot apply to this card: ${t.join(", ")}` : void 0;
|
|
131
|
-
}
|
|
132
|
-
function F(e, t) {
|
|
133
|
-
return Q(e.card, e.queryContext, t).queryInputIdentity;
|
|
134
|
-
}
|
|
135
|
-
const ke = [
|
|
136
|
-
["row", "rows"],
|
|
137
|
-
["column", "columns"],
|
|
138
|
-
["measure", "metrics"],
|
|
139
|
-
["detail", "details"]
|
|
140
|
-
];
|
|
141
|
-
function De(e) {
|
|
142
|
-
const { fields: t } = oe({
|
|
143
|
-
type: e.card.type,
|
|
144
|
-
config: e.queryContext.finalConfig
|
|
145
|
-
});
|
|
146
|
-
return ke.flatMap(([r, a]) => t[a].map((n) => {
|
|
147
|
-
const s = n.aggregate, d = n.granularity;
|
|
148
|
-
return {
|
|
149
|
-
role: r,
|
|
150
|
-
label: g(n.label || n.name, u.labelChars),
|
|
151
|
-
name: g(n.name, u.labelChars),
|
|
152
|
-
...s ? { aggregate: s } : {},
|
|
153
|
-
...d ? { granularity: d } : {}
|
|
154
|
-
};
|
|
155
|
-
}));
|
|
156
|
-
}
|
|
157
|
-
function we(e) {
|
|
158
|
-
const t = e.queryContext;
|
|
159
|
-
return (t.finalConfig.metricColumns ?? []).flatMap((r) => {
|
|
160
|
-
const a = Ce({
|
|
161
|
-
metricComparison: r.comparison,
|
|
162
|
-
globalDateComparison: t.globalDateComparison
|
|
163
|
-
});
|
|
164
|
-
return a ? [g(Ve(Fe(r.label || r.name), a), u.textChars)] : [];
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function Fe(e) {
|
|
168
|
-
return JSON.stringify(e);
|
|
169
|
-
}
|
|
170
|
-
function Ae(e, { calendar: t }) {
|
|
171
|
-
const r = e.queryContext, a = { maxListedValues: u.inputValues, timeZone: t.tz }, n = e.card.inlineFilters ?? [], s = new Set(n.map((i) => i.id)), d = new Map(
|
|
172
|
-
[...r.queryFilterDefinitions, ...n].map((i) => [i.id, i.title])
|
|
173
|
-
), c = r.cardFilterValues.map((i) => {
|
|
174
|
-
const l = d.get(i.filterId) || i.name, f = i.dateOwner === "global_date" ? `${l} (the dashboard date, on this card's field ${i.name})` : `${l} (field ${i.name})`, p = j(i, f, a);
|
|
175
|
-
return {
|
|
176
|
-
origin: s.has(i.filterId) ? "card_input" : "dashboard_input",
|
|
177
|
-
text: g(p.text, u.textChars),
|
|
178
|
-
...p.omittedValues ? { omittedValues: p.omittedValues } : {}
|
|
179
|
-
};
|
|
180
|
-
}), o = r.resolvedFilterParts, m = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([i, l]) => ye(l, a).map((f) => ({
|
|
181
|
-
origin: i,
|
|
182
|
-
text: g(f.text, u.textChars),
|
|
183
|
-
...f.omittedValues ? { omittedValues: f.omittedValues } : {}
|
|
184
|
-
})));
|
|
185
|
-
return [...c, ...m];
|
|
186
|
-
}
|
|
187
|
-
function Te(e) {
|
|
188
|
-
const t = e.queryContext, r = M({
|
|
189
|
-
sql: e.card.sql,
|
|
190
|
-
controlBindings: t.controlBindings
|
|
191
|
-
});
|
|
192
|
-
return [.../* @__PURE__ */ new Set([
|
|
193
|
-
...t.controlBindings.map((n) => n.controlId),
|
|
194
|
-
...r.map((n) => n.controlId)
|
|
195
|
-
])].map((n) => ({
|
|
196
|
-
id: n,
|
|
197
|
-
bindings: t.controlBindings.filter((s) => s.controlId === n),
|
|
198
|
-
sqlParameterIds: r.filter((s) => s.controlId === n).map((s) => s.paramId)
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
function Me(e) {
|
|
202
|
-
const t = e.queryContext, r = new Map(
|
|
203
|
-
[...t.controlDefinitions, ...t.cardControlDefinitions].map((a) => [a.id, a])
|
|
204
|
-
);
|
|
205
|
-
return Te(e).map(({ id: a, bindings: n, sqlParameterIds: s }) => {
|
|
206
|
-
var o;
|
|
207
|
-
const d = t.controlValues[a], c = /* @__PURE__ */ new Set([
|
|
208
|
-
...n.filter((m) => m.target !== "sql_param").map((m) => Le(m, d)),
|
|
209
|
-
...s.map((m) => `SQL parameter ${m}`)
|
|
210
|
-
]);
|
|
211
|
-
return {
|
|
212
|
-
label: g(((o = r.get(a)) == null ? void 0 : o.label) || a, u.labelChars),
|
|
213
|
-
valueText: g(
|
|
214
|
-
`${q(d, { maxListedValues: u.inputValues }).text}${c.size ? `; ${[...c].join("; ")}` : ""}`,
|
|
215
|
-
u.textChars
|
|
216
|
-
)
|
|
217
|
-
};
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
function Ee(e) {
|
|
221
|
-
const t = e.queryContext;
|
|
222
|
-
return M({ sql: e.card.sql, controlBindings: t.controlBindings }).map((r) => ({
|
|
223
|
-
name: g(r.paramId, u.labelChars),
|
|
224
|
-
valueText: g(
|
|
225
|
-
q(t.controlValues[r.controlId], { maxListedValues: u.inputValues }).text,
|
|
226
|
-
u.textChars
|
|
227
|
-
)
|
|
228
|
-
}));
|
|
229
|
-
}
|
|
230
|
-
function Le(e, t) {
|
|
231
|
-
const r = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : void 0;
|
|
232
|
-
switch (e.target) {
|
|
233
|
-
case "sql_param":
|
|
234
|
-
return `SQL parameter ${e.paramId}`;
|
|
235
|
-
case "presentation_currency":
|
|
236
|
-
return "display currency only";
|
|
237
|
-
case "config_aggregation":
|
|
238
|
-
return `sets the aggregation${r && e.mapping[r] ? ` to ${e.mapping[r]}` : ""}`;
|
|
239
|
-
case "config_grain":
|
|
240
|
-
return `sets the time grain${r && e.mapping[r] ? ` to ${e.mapping[r]}` : ""}`;
|
|
241
|
-
case "config_field_selector":
|
|
242
|
-
case "config_metric_selector": {
|
|
243
|
-
const a = r ? e.mapping[r] : void 0, n = e.target === "config_field_selector" ? "field" : "measure";
|
|
244
|
-
if (!a) return `chooses the ${n}`;
|
|
245
|
-
const s = "kind" in a ? `Matrix ${a.id}` : `${a.label || a.name}${"aggregate" in a && a.aggregate ? ` (${a.aggregate})` : ""}`;
|
|
246
|
-
return `chooses the ${n} ${JSON.stringify(s)}`;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
class S extends Error {
|
|
251
|
-
constructor(r, a) {
|
|
252
|
-
super(a);
|
|
253
|
-
k(this, "code");
|
|
254
|
-
this.name = "AssistantContextSourceError", this.code = r;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
const C = P, Pe = "Untitled";
|
|
258
|
-
function je(e) {
|
|
259
|
-
var b;
|
|
260
|
-
if (e.surface === "none")
|
|
261
|
-
return A({
|
|
262
|
-
version: D,
|
|
263
|
-
surface: "none",
|
|
264
|
-
otherSheets: [],
|
|
265
|
-
activeInputs: [],
|
|
266
|
-
cards: [],
|
|
267
|
-
timeZone: e.timeZone
|
|
268
|
-
});
|
|
269
|
-
const { dashboard: t, sheetId: r, calendar: a } = e, n = t.sheets ?? [], s = n.find((h) => h.id === r);
|
|
270
|
-
if (r !== null && !s)
|
|
271
|
-
throw new S("sheet_not_found", `sheet ${r} is not on dashboard ${t.id}`);
|
|
272
|
-
const d = n.filter((h) => h.id !== r), c = s ? v(t).filter((h) => h.sheetId === r) : [], o = c.slice(0, C.summaryCards), m = e.selectedCard ? c.find((h) => h.cardId === e.selectedCard.cardId) : void 0, i = ((b = e.selectedCard) == null ? void 0 : b.card) ?? (m == null ? void 0 : m.card);
|
|
273
|
-
if (e.selectedCard && !i)
|
|
274
|
-
throw new S(
|
|
275
|
-
"card_not_on_sheet",
|
|
276
|
-
`card ${e.selectedCard.cardId} is not on sheet ${r}`
|
|
277
|
-
);
|
|
278
|
-
const l = s ? Be(e, s, c) : [], f = {
|
|
279
|
-
otherSheets: I(d.length, C.otherSheets),
|
|
280
|
-
activeInputs: I(l.length, C.activeInputs),
|
|
281
|
-
cards: I(c.length, C.summaryCards)
|
|
282
|
-
}, p = Object.fromEntries(Object.entries(f).filter(([, h]) => h > 0));
|
|
283
|
-
return A({
|
|
284
|
-
version: D,
|
|
285
|
-
surface: e.editing ? "editor" : "dashboard",
|
|
286
|
-
dashboard: {
|
|
287
|
-
id: t.id,
|
|
288
|
-
title: x(t.title),
|
|
289
|
-
unsavedEdits: e.unsavedEdits
|
|
290
|
-
},
|
|
291
|
-
...s ? { sheet: { id: s.id, title: x(s.title) } } : {},
|
|
292
|
-
otherSheets: d.slice(0, C.otherSheets).map((h) => ({ id: h.id, title: x(h.title) })),
|
|
293
|
-
activeInputs: l.slice(0, C.activeInputs),
|
|
294
|
-
cards: o.map((h) => N(h.card)),
|
|
295
|
-
...i && e.selectedCard ? { selectedCard: Oe(i, e.selectedCard.snapshot, a) } : {},
|
|
296
|
-
...e.editing ? { editing: e.editing } : {},
|
|
297
|
-
...Object.keys(p).length ? { omitted: p } : {},
|
|
298
|
-
timeZone: a.tz
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
function Oe(e, t, r) {
|
|
302
|
-
return { ...N(e), ...$e(e, t, { calendar: r }) };
|
|
303
|
-
}
|
|
304
|
-
function A(e) {
|
|
305
|
-
const t = ue(e);
|
|
306
|
-
if (t > C.contextBytes) throw new fe(t);
|
|
307
|
-
return e;
|
|
308
|
-
}
|
|
309
|
-
function x(e) {
|
|
310
|
-
return g((e == null ? void 0 : e.trim()) || Pe, C.labelChars);
|
|
311
|
-
}
|
|
312
|
-
function N(e) {
|
|
313
|
-
const t = Re(e);
|
|
314
|
-
return {
|
|
315
|
-
id: e.id,
|
|
316
|
-
title: x(e.title),
|
|
317
|
-
visualType: e.type,
|
|
318
|
-
...t ? { source: t } : {}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
function Re(e) {
|
|
322
|
-
var r;
|
|
323
|
-
const t = ce(e);
|
|
324
|
-
if (t.kind === "config")
|
|
325
|
-
return t.executableSources.length === 1 ? t.executableSources[0] : void 0;
|
|
326
|
-
if (t.kind === "sql") {
|
|
327
|
-
const a = ((r = e.dataSource) == null ? void 0 : r.connectionId) || e.connectionId;
|
|
328
|
-
return a ? { kind: "sql", connectionId: a } : void 0;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function Be(e, t, r) {
|
|
332
|
-
const { dashboard: a } = e, n = t.kind === "document" ? "document" : "dashboard", s = n === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: d } = U(s), c = (l, f) => H({
|
|
333
|
-
dashboard: a,
|
|
334
|
-
sheetId: t.id,
|
|
335
|
-
card: l,
|
|
336
|
-
sectionId: f,
|
|
337
|
-
runtimeValues: e.runtimeValues,
|
|
338
|
-
transientContexts: s,
|
|
339
|
-
calendar: e.calendar
|
|
340
|
-
}), o = /* @__PURE__ */ new Map(), m = (l) => {
|
|
341
|
-
l.inputs.forEach((f, p) => {
|
|
342
|
-
if (T(f)) return;
|
|
343
|
-
const b = l.resolvedInputs[p], h = o.get(f.id) ?? { input: f };
|
|
344
|
-
!h.resolved && b && Ne(b) && (h.resolved = b), o.set(f.id, h);
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
m(c(null));
|
|
348
|
-
let i = K(a).filter((l) => {
|
|
349
|
-
var f;
|
|
350
|
-
return !T(l) && !((f = o.get(l.id)) != null && f.resolved);
|
|
351
|
-
});
|
|
352
|
-
for (const l of r) {
|
|
353
|
-
if (i.length === 0) break;
|
|
354
|
-
const f = l.kind === "documentSectionCard" ? l.sectionId : void 0, p = { sheetId: t.id, sheetKind: n, cardId: l.cardId, sectionId: f };
|
|
355
|
-
if (i.some((b) => ie(b, p))) {
|
|
356
|
-
try {
|
|
357
|
-
m(c(l.card, f));
|
|
358
|
-
} catch {
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
i = i.filter((b) => {
|
|
362
|
-
var h;
|
|
363
|
-
return !((h = o.get(b.id)) != null && h.resolved);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return [...o.values()].flatMap((l) => {
|
|
368
|
-
if (!l.resolved) return [];
|
|
369
|
-
const f = l.input.kind === "filter" && !d && !de(l.input), p = ze(l, e.calendar.tz, f);
|
|
370
|
-
return p ? [p] : [];
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function T(e) {
|
|
374
|
-
var r;
|
|
375
|
-
const t = (r = e.compatibility) == null ? void 0 : r.source;
|
|
376
|
-
return t === "cardInlineFilter" || t === "cardControl";
|
|
377
|
-
}
|
|
378
|
-
function Ne(e) {
|
|
379
|
-
if (e.kind === "filter") return !!e.filterValue;
|
|
380
|
-
const t = e.controlValue;
|
|
381
|
-
return t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : !0;
|
|
382
|
-
}
|
|
383
|
-
function ze(e, t, r) {
|
|
384
|
-
const { input: a, resolved: n } = e, s = x(a.label), d = {
|
|
385
|
-
inputId: a.id,
|
|
386
|
-
label: s,
|
|
387
|
-
...a.kind === "filter" && le(a.filter) ? { globalDate: !0 } : {}
|
|
388
|
-
};
|
|
389
|
-
if (a.runtimeScope === "perCard" || a.runtimeScope === "perDocumentSection")
|
|
390
|
-
return { ...d, value: { kind: "varies" } };
|
|
391
|
-
const c = { maxListedValues: C.inputValues, timeZone: t };
|
|
392
|
-
let o;
|
|
393
|
-
if ((n == null ? void 0 : n.kind) === "filter" && n.filterValue)
|
|
394
|
-
o = j(n.filterValue, s, c);
|
|
395
|
-
else if ((n == null ? void 0 : n.kind) === "control") {
|
|
396
|
-
const i = q(n.controlValue, c);
|
|
397
|
-
o = { text: `${s} is set to ${i.text}`, omittedValues: i.omittedValues };
|
|
398
|
-
}
|
|
399
|
-
if (!o) return;
|
|
400
|
-
const m = (n == null ? void 0 : n.kind) === "filter" ? n.comparisonSelection : void 0;
|
|
401
|
-
return (m == null ? void 0 : m.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${B(m.spec)}` }), {
|
|
402
|
-
...d,
|
|
403
|
-
value: {
|
|
404
|
-
kind: "set",
|
|
405
|
-
text: g(o.text, C.textChars),
|
|
406
|
-
...o.omittedValues ? { omittedValues: o.omittedValues } : {},
|
|
407
|
-
...r ? { notApplied: "opened_from_another_dashboard" } : {},
|
|
408
|
-
// The resolved value itself, with any date comparison on it and whether
|
|
409
|
-
// the view applies it, so any change counts, shown or not.
|
|
410
|
-
fingerprint: $(
|
|
411
|
-
(n == null ? void 0 : n.kind) === "filter" ? { filter: n.filterValue, comparison: n.comparisonSelection ?? null, notApplied: r } : { control: n == null ? void 0 : n.controlValue }
|
|
412
|
-
)
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function rt(e) {
|
|
417
|
-
return Je(e).context;
|
|
418
|
-
}
|
|
419
|
-
function Je(e) {
|
|
420
|
-
const { place: t, calendar: r } = e, a = E(e.dashboard), n = ee({ dashboard: a, host: {}, calendar: r, materializeInputs: !1 }), s = {
|
|
421
|
-
...L({ dashboard: a, capture: {}, calendar: r }).runtimeValues,
|
|
422
|
-
cardViewState: t.cardViewState ?? {}
|
|
423
|
-
}, d = t.cardId ? Ge(a, t.cardId) : void 0, c = d ? z({
|
|
424
|
-
dashboard: a,
|
|
425
|
-
location: d,
|
|
426
|
-
runtimeValues: s,
|
|
427
|
-
semanticExecutionPayload: e.semanticExecutionPayload,
|
|
428
|
-
calendar: r,
|
|
429
|
-
withRequest: !0
|
|
430
|
-
}) : void 0, o = je({
|
|
431
|
-
surface: "dashboard",
|
|
432
|
-
dashboard: a,
|
|
433
|
-
// A sheet that does not hold the card is refused by the projection.
|
|
434
|
-
sheetId: t.sheetId ?? (d == null ? void 0 : d.sheetId) ?? n.selectedSheetId,
|
|
435
|
-
unsavedEdits: !1,
|
|
436
|
-
runtimeValues: s,
|
|
437
|
-
transientContexts: void 0,
|
|
438
|
-
...d && c !== void 0 ? { selectedCard: { cardId: d.cardId, snapshot: c } } : {},
|
|
439
|
-
calendar: r
|
|
440
|
-
});
|
|
441
|
-
return {
|
|
442
|
-
context: o,
|
|
443
|
-
openDashboard: a,
|
|
444
|
-
...o.selectedCard && c !== void 0 ? { cardReplay: Ze({ dashboard: a, cardId: o.selectedCard.id, snapshot: c }) } : {}
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
function Ze(e) {
|
|
448
|
-
const t = e.dashboard ? v(e.dashboard).find((a) => a.cardId === e.cardId) : void 0, r = J({
|
|
449
|
-
card: e.card ?? (t == null ? void 0 : t.card),
|
|
450
|
-
snapshot: e.snapshot,
|
|
451
|
-
documentSection: (t == null ? void 0 : t.kind) === "documentSectionCard"
|
|
452
|
-
});
|
|
453
|
-
return r.status === "ready" ? { selectedCardRequest: r.request } : {
|
|
454
|
-
selectedCardUnavailable: {
|
|
455
|
-
cardId: e.cardId,
|
|
456
|
-
reason: r.reason,
|
|
457
|
-
...r.message ? { message: r.message } : {}
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
function Ge(e, t) {
|
|
462
|
-
const r = v(e).find((a) => a.cardId === t);
|
|
463
|
-
if (!r)
|
|
464
|
-
throw new S("card_not_found", `card ${t} is not on dashboard ${e.id}`);
|
|
465
|
-
return r;
|
|
466
|
-
}
|
|
467
|
-
function z(e) {
|
|
468
|
-
const { dashboard: t, location: r, runtimeValues: a } = e, n = r.kind === "documentSectionCard" ? Qe(t, r) : void 0;
|
|
469
|
-
return te({
|
|
470
|
-
dashboard: t,
|
|
471
|
-
cardId: r.cardId,
|
|
472
|
-
cardOverride: r.card,
|
|
473
|
-
sheetId: r.sheetId,
|
|
474
|
-
transientContexts: e.transientContexts,
|
|
475
|
-
cardViewStates: a.cardViewState,
|
|
476
|
-
viewerTableSettings: void 0,
|
|
477
|
-
adHocFilterValues: a.adHocFilterValues,
|
|
478
|
-
inlineFilterValuesMap: a.inlineFilterValuesMap,
|
|
479
|
-
dashboardControlValues: a.controlValues,
|
|
480
|
-
cardControlValuesMap: a.cardControlValuesMap,
|
|
481
|
-
dashboardInputValues: a.dashboardInputValues,
|
|
482
|
-
semanticExecutionPayload: e.semanticExecutionPayload,
|
|
483
|
-
calendar: e.calendar,
|
|
484
|
-
...n ? { documentSection: n } : {},
|
|
485
|
-
...e.withRequest ? { withRequest: !0 } : {}
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
function J(e) {
|
|
489
|
-
var r;
|
|
490
|
-
const { snapshot: t } = e;
|
|
491
|
-
if (e.documentSection) return { status: "unavailable", reason: "document_section" };
|
|
492
|
-
if (((r = e.card) == null ? void 0 : r.type) === "matrixTable") return { status: "unavailable", reason: "matrix" };
|
|
493
|
-
if (t === "pending") return { status: "unavailable", reason: "pending" };
|
|
494
|
-
if (!t || t.status !== "ready")
|
|
495
|
-
return {
|
|
496
|
-
status: "unavailable",
|
|
497
|
-
reason: "blocked",
|
|
498
|
-
...t != null && t.message ? { message: t.message } : {}
|
|
499
|
-
};
|
|
500
|
-
if (t.matrix) return { status: "unavailable", reason: "matrix" };
|
|
501
|
-
if (!t.request) return { status: "unavailable", reason: "no_query" };
|
|
502
|
-
try {
|
|
503
|
-
const { connectionId: a, requestPayloadBase: n } = W(t.card, t.request);
|
|
504
|
-
return { status: "ready", request: { cardId: t.card.id, connectionId: a, payload: n } };
|
|
505
|
-
} catch {
|
|
506
|
-
return { status: "unavailable", reason: "no_query" };
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
function at(e) {
|
|
510
|
-
const { calendar: t } = e, r = e.host ?? {}, a = E(
|
|
511
|
-
r.controlContract ? X(Y(e.dashboard), {
|
|
512
|
-
controlContractOverrides: r.controlContract,
|
|
513
|
-
cardId: e.cardId
|
|
514
|
-
}) : e.dashboard
|
|
515
|
-
), n = v(a).find((m) => m.cardId === e.cardId);
|
|
516
|
-
if (!n) return { status: "refused", reason: "card_not_found" };
|
|
517
|
-
if (n.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
|
|
518
|
-
const { runtimeValues: s, transientContexts: d } = L({
|
|
519
|
-
dashboard: a,
|
|
520
|
-
capture: r,
|
|
521
|
-
calendar: t
|
|
522
|
-
}), c = z({
|
|
523
|
-
dashboard: a,
|
|
524
|
-
location: n,
|
|
525
|
-
runtimeValues: s,
|
|
526
|
-
semanticExecutionPayload: e.semanticExecutionPayload,
|
|
527
|
-
calendar: t,
|
|
528
|
-
transientContexts: d,
|
|
529
|
-
withRequest: !0
|
|
530
|
-
});
|
|
531
|
-
if (!c) return { status: "refused", reason: "card_not_found" };
|
|
532
|
-
const o = J({ card: n.card, snapshot: c, documentSection: !1 });
|
|
533
|
-
return o.status === "ready" ? { ...o, renderConfig: c.queryContext.finalConfig } : o.reason === "pending" ? { status: "refused", reason: "blocked" } : {
|
|
534
|
-
status: "refused",
|
|
535
|
-
reason: o.reason,
|
|
536
|
-
...o.message ? { message: o.message } : {}
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
function Qe(e, t) {
|
|
540
|
-
var a, n, s;
|
|
541
|
-
const r = (a = e.sheets) == null ? void 0 : a.find((d) => d.id === t.sheetId);
|
|
542
|
-
if ((s = (n = r == null ? void 0 : r.document) == null ? void 0 : n.inputs) != null && s.length && re(e, t.sheetId).length === 0)
|
|
543
|
-
throw new S(
|
|
544
|
-
"document_inputs_not_built",
|
|
545
|
-
`card ${t.cardId} runs with the document's own inputs on sheet ${t.sheetId}, which only the page builds`
|
|
546
|
-
);
|
|
547
|
-
return {
|
|
548
|
-
sheetId: t.sheetId,
|
|
549
|
-
sectionId: t.sectionId,
|
|
550
|
-
documentFilterValues: [],
|
|
551
|
-
documentControlDefinitions: [],
|
|
552
|
-
documentControlValues: {}
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
export {
|
|
556
|
-
S as A,
|
|
557
|
-
Ze as a,
|
|
558
|
-
at as b,
|
|
559
|
-
J as c,
|
|
560
|
-
rt as d,
|
|
561
|
-
Je as e,
|
|
562
|
-
z as f,
|
|
563
|
-
je as p
|
|
564
|
-
};
|